"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = require("react");
var _AmityPostContentComponentStyle = require("../../../../enums/AmityPostContentComponentStyle");
var _Components = require("./Components");
var _tsSdkReactNative = require("@amityco/ts-sdk-react-native");
var _enums = require("../../../../enums");
const AmityPostEngagementActionsComponent = ({
  AmityPostContentComponentStyle = _AmityPostContentComponentStyle.AmityPostContentComponentStyleEnum.detail,
  targetId,
  targetType,
  postId,
  pageId = _enums.PageID.WildCardPage,
  componentId = _enums.ComponentID.WildCardComponent
}) => {
  const [communityData, setCommunityData] = (0, _react.useState)(null);
  (0, _react.useEffect)(() => {
    if (targetType === 'community' && targetId) {
      _tsSdkReactNative.CommunityRepository.getCommunity(targetId, ({
        data,
        error,
        loading
      }) => {
        if (!error && !loading) {
          setCommunityData(data);
        }
      });
    }
  }, [targetId, targetType]);
  if (AmityPostContentComponentStyle === _AmityPostContentComponentStyle.AmityPostContentComponentStyleEnum.feed) return /*#__PURE__*/React.createElement(_Components.AmityPostEngagementActionsSubComponent.FeedStyle, {
    community: communityData,
    pageId: pageId,
    componentId: componentId,
    postId: postId
  });
  if (AmityPostContentComponentStyle === _AmityPostContentComponentStyle.AmityPostContentComponentStyleEnum.detail) return /*#__PURE__*/React.createElement(_Components.AmityPostEngagementActionsSubComponent.DetailStyle, {
    community: communityData,
    postId: postId,
    pageId: pageId,
    componentId: componentId
  });
  return null;
};
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(AmityPostEngagementActionsComponent);
//# sourceMappingURL=EngagementActions.js.map