/* RovoUnauthorisedView.tsx generated by @compiled/babel-plugin v0.39.1 */
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
require("./RovoUnauthorisedView.compiled.css");
var _react = _interopRequireWildcard(require("react"));
var React = _react;
var _runtime = require("@compiled/react/runtime");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _reactIntlNext = require("react-intl-next");
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
var _icon = require("@atlaskit/icon");
var _aiSparkle = _interopRequireDefault(require("@atlaskit/icon/core/ai-sparkle"));
var _appSwitcher = _interopRequireDefault(require("@atlaskit/icon/core/app-switcher"));
var _globe = _interopRequireDefault(require("@atlaskit/icon/core/globe"));
var _search = _interopRequireDefault(require("@atlaskit/icon/core/search"));
var _linkExtractors = require("@atlaskit/link-extractors");
var _compiled = require("@atlaskit/primitives/compiled");
var _useAnalyticsEvents2 = require("../../../../../common/analytics/generated/use-analytics-events");
var _constants = require("../../../../../constants");
var _messages = require("../../../../../messages");
var _actions = require("../../../../../state/actions");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var ROVO_FEATURES = [{
  icon: _globe.default,
  appearance: 'blue',
  titleMessage: _messages.messages.rovo_unauthorised_feature_document_summaries_title,
  descMessage: _messages.messages.rovo_unauthorised_feature_document_summaries_desc,
  testIdSuffix: 'document-summaries'
}, {
  icon: _search.default,
  appearance: 'purple',
  titleMessage: _messages.messages.rovo_unauthorised_feature_related_content_title,
  descMessage: _messages.messages.rovo_unauthorised_feature_related_content_desc,
  testIdSuffix: 'related-content'
}, {
  icon: _aiSparkle.default,
  appearance: 'orange',
  titleMessage: _messages.messages.rovo_unauthorised_feature_smart_suggestions_title,
  descMessage: _messages.messages.rovo_unauthorised_feature_smart_suggestions_desc,
  testIdSuffix: 'smart-suggestions'
}, {
  icon: _appSwitcher.default,
  appearance: 'teal',
  titleMessage: _messages.messages.rovo_unauthorised_feature_cross_reference_title,
  descMessage: _messages.messages.rovo_unauthorised_feature_cross_reference_desc,
  testIdSuffix: 'cross-reference'
}];
var layoutStyles = {
  header: "_bfhkomb0 _syaz15cr _ca0qutpp _u5f3pxbi _n3tdutpp _19bvpxbi _13li1mok _qrwq1mok",
  body: "_ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi",
  footer: "_19pkpxbi _ca0qutpp",
  footerActions: "_zulputpp _1e0c1txw _4cvr1h6o _1bahesu3 _1n261g80"
};
var RovoUnauthorisedView = function RovoUnauthorisedView(_ref) {
  var _ref$id = _ref.id,
    id = _ref$id === void 0 ? '' : _ref$id,
    flexibleCardProps = _ref.flexibleCardProps,
    onDismiss = _ref.onDismiss,
    _ref$testId = _ref.testId,
    testId = _ref$testId === void 0 ? 'hover-card-rovo-unauthorised-view' : _ref$testId,
    url = _ref.url;
  var providerName = (0, _react.useMemo)(function () {
    var _extractSmartLinkProv;
    return (_extractSmartLinkProv = (0, _linkExtractors.extractSmartLinkProvider)(flexibleCardProps.cardState.details)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text;
  }, [flexibleCardProps.cardState.details]);
  var _useSmartCardActions = (0, _actions.useSmartCardActions)(id, url),
    authorize = _useSmartCardActions.authorize;
  var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
    fireEvent = _useAnalyticsEvents.fireEvent;
  var handleAuthorize = (0, _react.useCallback)(function () {
    if (authorize) {
      fireEvent('track.applicationAccount.authStarted', {});
      authorize(_constants.CardDisplay.HoverCardPreview);
    }
  }, [authorize, fireEvent]);
  return /*#__PURE__*/React.createElement(_compiled.Box, {
    testId: testId
  }, /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: layoutStyles.header
  }, /*#__PURE__*/React.createElement(_compiled.Text, {
    weight: "bold",
    size: "medium",
    color: "color.text.inverse"
  }, providerName ? /*#__PURE__*/React.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages.rovo_unauthorised_title, {
    values: {
      context: providerName
    }
  })) : /*#__PURE__*/React.createElement(_reactIntlNext.FormattedMessage, _messages.messages.rovo_unauthorised_title_no_provider))), /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: layoutStyles.body
  }, /*#__PURE__*/React.createElement(_compiled.Stack, {
    space: "space.050"
  }, /*#__PURE__*/React.createElement(_compiled.Stack, {
    space: "space.200"
  }, ROVO_FEATURES.map(function (feature) {
    return /*#__PURE__*/React.createElement(_compiled.Inline, {
      key: feature.testIdSuffix,
      space: "space.100",
      alignBlock: "center",
      testId: "".concat(testId, "-feature-row-").concat(feature.testIdSuffix)
    }, /*#__PURE__*/React.createElement(_icon.IconTile, {
      icon: feature.icon,
      label: '',
      appearance: feature.appearance,
      size: "medium",
      testId: "".concat(testId, "-feature-").concat(feature.testIdSuffix)
    }), /*#__PURE__*/React.createElement(_compiled.Stack, {
      space: "space.025"
    }, /*#__PURE__*/React.createElement(_compiled.Text, {
      size: "small",
      weight: "bold"
    }, /*#__PURE__*/React.createElement(_reactIntlNext.FormattedMessage, feature.titleMessage)), /*#__PURE__*/React.createElement(_compiled.Text, {
      size: "small",
      color: "color.text.subtlest"
    }, /*#__PURE__*/React.createElement(_reactIntlNext.FormattedMessage, feature.descMessage))));
  })), /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: layoutStyles.footer
  }, /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: layoutStyles.footerActions
  }, /*#__PURE__*/React.createElement(_new.default, {
    appearance: "subtle",
    onClick: onDismiss,
    testId: "".concat(testId, "-not-now")
  }, /*#__PURE__*/React.createElement(_reactIntlNext.FormattedMessage, _messages.messages.rovo_unauthorised_not_now)), /*#__PURE__*/React.createElement(_new.default, {
    appearance: "primary",
    onClick: handleAuthorize,
    testId: "".concat(testId, "-connect-account")
  }, /*#__PURE__*/React.createElement(_reactIntlNext.FormattedMessage, _messages.messages.rovo_unauthorised_connect_account)))))));
};
var _default = exports.default = RovoUnauthorisedView;