"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useFeedState = useFeedState;
var _useAuth = _interopRequireDefault(require("../../../../../core/hooks/useAuth"));
var _useSocialSettings = _interopRequireDefault(require("../../../../../core/hooks/useSocialSettings"));
var _objects = require("../../../../hooks/objects");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function useFeedState({
  userId,
  isBrand,
  isUserLoading
}) {
  const {
    client
  } = (0, _useAuth.default)();
  const {
    socialSettings
  } = (0, _useSocialSettings.default)();
  const {
    followInfo
  } = (0, _objects.useFollowInfo)({
    userId,
    enabled: !!userId
  });
  const isMyProfile = (client === null || client === void 0 ? void 0 : client.userId) === userId;
  const isBlockedByMe = (followInfo === null || followInfo === void 0 ? void 0 : followInfo.status) === 'blocked';
  const isFollowing = (followInfo === null || followInfo === void 0 ? void 0 : followInfo.status) === 'accepted';
  const isPrivate = !isMyProfile && (isBrand || (socialSettings === null || socialSettings === void 0 ? void 0 : socialSettings.userPrivacySetting) === 'private') && !isFollowing;

  // Hold feedEnabled false while the user object is still loading so brand-private
  // profiles don't flash feed content before isBrand is known.
  const isBrandResolved = isMyProfile || !isUserLoading;
  const feedEnabled = isBrandResolved && !isBlockedByMe && !isPrivate;
  return {
    isBlockedByMe,
    isPrivate,
    feedEnabled
  };
}
//# sourceMappingURL=useFeedState.js.map