/* RovoUnauthorisedView.tsx generated by @compiled/babel-plugin v0.40.0 */
"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 _reactIntl = require("react-intl");
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
var _aiGenerativeTextSummary = _interopRequireDefault(require("@atlaskit/icon/core/ai-generative-text-summary"));
var _link = _interopRequireDefault(require("@atlaskit/icon/core/link"));
var _rovoChat = _interopRequireDefault(require("@atlaskit/icon/core/rovo-chat"));
var _linkExtractors = require("@atlaskit/link-extractors");
var _logo = require("@atlaskit/logo");
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");
var _FlexibleCard = _interopRequireDefault(require("../../../../FlexibleCard"));
var _elements = require("../../../../FlexibleCard/components/elements");
var _graphics = require("./graphics");
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: _link.default,
  message: _messages.messages.rovo_unauthorised_feature_clear_link_names,
  testIdSuffix: 'clear-link-names'
}, {
  icon: _aiGenerativeTextSummary.default,
  message: _messages.messages.rovo_unauthorised_feature_understand_linked_docs,
  testIdSuffix: 'understand-linked-docs'
}, {
  icon: _rovoChat.default,
  message: _messages.messages.rovo_unauthorised_feature_go_deeper_smart_suggestions,
  testIdSuffix: 'go-deeper-smart-suggestions'
}];
var sparkleWrapBase = null;
var sparkleLeftWrap = null;
var sparkleGreyRightWrap = null;
var sparkleVioletRightWrap = null;
var layoutStyles = {
  connectorStroke: "_syaz1fxt _1e0c1txw _1o9zidpf",
  atlassianIconTile: "_2rko1mok _1e0c1txw _4cvr1h6o _1bah1h6o _1bsbzwfg _4t3izwfg _bfhk16e3",
  header: "_bfhk11bn _ca0q1ejb _u5f3pxbi _n3tdutpp _19bvpxbi _13li1mok _qrwq1mok _kqswh2mm",
  headerGraphicRow: "_zulpu2gc _1e0c1txw _4cvr1h6o _1bah1h6o _otyrutpp",
  headerTitle: "_y3gn1h6o",
  body: "_ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi",
  featureIconCell: "_1e0c1txw _4cvr1h6o _1bah1h6o _1o9zidpf _1bsb7vkz",
  footer: "_zulputpp _19pkutpp _ca0q1b66 _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]);
  var handleDismiss = (0, _react.useCallback)(function () {
    if (onDismiss) {
      fireEvent('ui.button.clicked.dismiss', {});
      onDismiss();
    }
  }, [fireEvent, onDismiss]);
  return /*#__PURE__*/React.createElement(_FlexibleCard.default, (0, _extends2.default)({}, flexibleCardProps, {
    testId: testId,
    ui: {
      hideElevation: true,
      hideBackground: true,
      removeBlockRestriction: true,
      hidePadding: true
    }
  }), /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: layoutStyles.header
  }, /*#__PURE__*/React.createElement("div", {
    className: (0, _runtime.ax)(["_1o9zidpf _1e0c1txw _kqswstnw", "_syaz1yjp _154i1ul9 _1ltv1v6z"])
  }, /*#__PURE__*/React.createElement(_graphics.DenseSparkle, null)), /*#__PURE__*/React.createElement("div", {
    className: (0, _runtime.ax)(["_1o9zidpf _1e0c1txw _kqswstnw", "_syazwejn _154i1crf _1xi2qslr"])
  }, /*#__PURE__*/React.createElement(_graphics.SparseSparkle, null)), /*#__PURE__*/React.createElement("div", {
    className: (0, _runtime.ax)(["_1o9zidpf _1e0c1txw _kqswstnw", "_syazuq3u _1bsbqslr _154i1ylp _1xi21v6z"])
  }, /*#__PURE__*/React.createElement(_graphics.DenseSparkle, null)), /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: layoutStyles.headerGraphicRow
  }, /*#__PURE__*/React.createElement(_elements.LinkIcon, {
    size: _constants.SmartLinkSize.Medium,
    isTiledIcon: true
  }), /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: layoutStyles.connectorStroke
  }, /*#__PURE__*/React.createElement(_graphics.SquiglyArrow, null)), /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: layoutStyles.atlassianIconTile
  }, /*#__PURE__*/React.createElement(_logo.AtlassianIcon, {
    appearance: "inverse",
    size: "small"
  }))), /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: layoutStyles.headerTitle
  }, /*#__PURE__*/React.createElement(_compiled.Text, {
    weight: "bold",
    size: "medium",
    color: "color.text"
  }, providerName ? /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, (0, _extends2.default)({}, _messages.messages.rovo_unauthorised_title, {
    values: {
      context: providerName
    }
  })) : /*#__PURE__*/React.createElement(_reactIntl.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) {
    var FeatureIcon = feature.icon;
    return /*#__PURE__*/React.createElement(_compiled.Inline, {
      key: feature.testIdSuffix,
      space: "space.150",
      alignBlock: "center",
      testId: "".concat(testId, "-feature-").concat(feature.testIdSuffix)
    }, /*#__PURE__*/React.createElement(_compiled.Box, {
      xcss: layoutStyles.featureIconCell
    }, /*#__PURE__*/React.createElement(FeatureIcon, {
      label: ""
    })), /*#__PURE__*/React.createElement(_compiled.Text, null, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, feature.message)));
  })), /*#__PURE__*/React.createElement(_compiled.Box, {
    xcss: layoutStyles.footer
  }, /*#__PURE__*/React.createElement(_compiled.Inline, {
    space: "space.050",
    alignBlock: "center"
  }, /*#__PURE__*/React.createElement(_new.default, {
    appearance: "subtle",
    spacing: "compact",
    onClick: handleDismiss,
    testId: "".concat(testId, "-not-now")
  }, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, _messages.messages.rovo_unauthorised_not_now)), /*#__PURE__*/React.createElement(_new.default, {
    appearance: "primary",
    onClick: handleAuthorize,
    testId: "".concat(testId, "-connect-account")
  }, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, _messages.messages.rovo_unauthorised_connect_account)))))));
};
var _default = exports.default = RovoUnauthorisedView;