import _defineProperty from "@babel/runtime/helpers/defineProperty";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
import { fg } from '@atlaskit/platform-feature-flags';
import { useSmartLinkContext } from '../../../state';
import { getExtensionKey } from '../../../state/helpers';
import { getSocialProofExperimentMeta, getInlineSocialProofExperimentMeta } from '../../../state/hooks/use-social-proof-experiment';
var useExperimentMetaEventAttributes = function useExperimentMetaEventAttributes(_ref) {
  var appearance = _ref.appearance,
    state = _ref.state;
  var _useSmartLinkContext = useSmartLinkContext(),
    baseUriWithNoTrailingSlash = _useSmartLinkContext.connections.client.baseUrlOverride;
  var details = state.details,
    status = state.status;
  var extensionKey = getExtensionKey(details);
  if (!fg('social-proof-3p-unauth-block-fg') && !fg('platform_sl_3p_preauth_soc_proof_inline_killswitch')) {
    return undefined;
  }
  var blockSocialProofExperimentMeta = appearance === 'block' && status === 'unauthorized' && fg('social-proof-3p-unauth-block-fg') ? getSocialProofExperimentMeta({
    extensionKey: extensionKey,
    baseUriWithNoTrailingSlash: baseUriWithNoTrailingSlash
  }) : undefined;
  var inlineSocialProofExperimentMeta = appearance === 'inline' && status === 'unauthorized' && fg('platform_sl_3p_preauth_soc_proof_inline_killswitch') ? getInlineSocialProofExperimentMeta({
    extensionKey: extensionKey,
    baseUriWithNoTrailingSlash: baseUriWithNoTrailingSlash
  }) : undefined;
  var experimentMeta = _objectSpread(_objectSpread({}, blockSocialProofExperimentMeta), inlineSocialProofExperimentMeta);
  if (Object.keys(experimentMeta).length > 0) {
    return experimentMeta;
  }
};
export default useExperimentMetaEventAttributes;