"use strict";

exports.__esModule = true;
exports.default = exports.Notification = exports.Main = exports.Explore = void 0;

var _react = _interopRequireDefault(require("react"));

var _index = _interopRequireDefault(require("./index"));

var _core = require("@selfcommunity/core");

var _FeedObject = _interopRequireWildcard(require("../FeedObject"));

var _feedObject = require("../../types/feedObject");

var _Notification = _interopRequireWildcard(require("../Notification"));

var _FeedUpdates = _interopRequireDefault(require("../FeedUpdates"));

var _BroadcastMessages = _interopRequireDefault(require("../BroadcastMessages"));

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
var _default = {
  title: 'Design System/SC UI/Feed',
  component: _index.default
}; // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args

exports.default = _default;

const Template = args => /*#__PURE__*/_react.default.createElement("div", {
  style: {
    width: '100%',
    height: '500px',
    marginTop: 30
  }
}, /*#__PURE__*/_react.default.createElement(_index.default, args));

const Main = Template.bind({});
exports.Main = Main;
Main.args = {
  endpoint: _core.Endpoints.MainFeed,
  ItemComponent: _FeedObject.default,
  itemPropsGenerator: (scUser, item) => ({
    feedObject: item[item.type],
    feedObjectType: item.type,
    feedObjectActivities: item.activities ? item.activities : null,
    markRead: scUser ? !item.seen_by_id.includes(scUser.id) : false
  }),
  itemIdGenerator: item => item[item.type].id,
  ItemSkeleton: _FeedObject.FeedObjectSkeleton,
  ItemSkeletonProps: {
    template: _feedObject.SCFeedObjectTemplateType.PREVIEW
  }
};
const Explore = Template.bind({});
exports.Explore = Explore;
Explore.args = {
  endpoint: _core.Endpoints.ExploreFeed,
  ItemComponent: _FeedObject.default,
  itemPropsGenerator: (scUser, item) => ({
    feedObject: item[item.type],
    feedObjectType: item.type,
    feedObjectActivities: item.activities ? item.activities : null,
    markRead: scUser ? !item.seen_by_id.includes(scUser.id) : false
  }),
  itemIdGenerator: item => item[item.type].id,
  ItemSkeleton: _FeedObject.FeedObjectSkeleton,
  ItemSkeletonProps: {
    template: _feedObject.SCFeedObjectTemplateType.PREVIEW
  }
};
const Notification = Template.bind({});
exports.Notification = Notification;
Notification.args = {
  id: 'notifications_feed',
  endpoint: _core.Endpoints.UserNotificationList,
  widgets: [{
    type: 'widget',
    component: _FeedUpdates.default,
    componentProps: {
      variant: 'outlined',
      subscriptionChannel: _core.SCNotificationTopicType.INTERACTION,
      publicationChannel: 'notifications_feed'
    },
    column: 'left',
    position: 0
  }, {
    type: 'widget',
    component: _BroadcastMessages.default,
    componentProps: {
      variant: 'outlined',
      subscriptionChannel: `notifications_feed`
    },
    column: 'left',
    position: 1
  }],
  ItemComponent: _Notification.default,
  itemPropsGenerator: (scUser, item) => ({
    notificationObject: item
  }),
  itemIdGenerator: item => item.sid,
  ItemSkeleton: _Notification.NotificationSkeleton
};