@atlaskit/smart-card 45.27.1 → 45.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/analytics.spec.yaml +23 -0
  3. package/dist/cjs/__tests__/informational-vr-tests/__snapshots__/pre-auth-value-proposition-modal/text-only--light-mode.png +3 -0
  4. package/dist/cjs/__tests__/informational-vr-tests/__snapshots__/pre-auth-value-proposition-modal/with-image--light-mode.png +3 -0
  5. package/dist/cjs/common/analytics/generated/use-analytics-events.js +1 -1
  6. package/dist/cjs/entry-points/pre-auth-value-proposition-modal.js +12 -0
  7. package/dist/cjs/state/services/pre-auth-value-proposition-modal/index.js +122 -0
  8. package/dist/cjs/utils/analytics/analytics.js +1 -1
  9. package/dist/cjs/view/LinkUrl/index.js +1 -1
  10. package/dist/cjs/view/PreAuthValuePropositionModal/IllustrationPane.compiled.css +30 -0
  11. package/dist/cjs/view/PreAuthValuePropositionModal/IllustrationPane.js +58 -0
  12. package/dist/cjs/view/PreAuthValuePropositionModal/assets/graphics-with-grid-no-provider-icons-2x.png +0 -0
  13. package/dist/cjs/view/PreAuthValuePropositionModal/index.compiled.css +17 -0
  14. package/dist/cjs/view/PreAuthValuePropositionModal/index.js +304 -0
  15. package/dist/es2019/__tests__/informational-vr-tests/__snapshots__/pre-auth-value-proposition-modal/text-only--light-mode.png +3 -0
  16. package/dist/es2019/__tests__/informational-vr-tests/__snapshots__/pre-auth-value-proposition-modal/with-image--light-mode.png +3 -0
  17. package/dist/es2019/common/analytics/generated/use-analytics-events.js +1 -1
  18. package/dist/es2019/entry-points/pre-auth-value-proposition-modal.js +1 -0
  19. package/dist/es2019/state/services/pre-auth-value-proposition-modal/index.js +97 -0
  20. package/dist/es2019/utils/analytics/analytics.js +1 -1
  21. package/dist/es2019/view/LinkUrl/index.js +1 -1
  22. package/dist/es2019/view/PreAuthValuePropositionModal/IllustrationPane.compiled.css +30 -0
  23. package/dist/es2019/view/PreAuthValuePropositionModal/IllustrationPane.js +51 -0
  24. package/dist/es2019/view/PreAuthValuePropositionModal/assets/graphics-with-grid-no-provider-icons-2x.png +0 -0
  25. package/dist/es2019/view/PreAuthValuePropositionModal/index.compiled.css +17 -0
  26. package/dist/es2019/view/PreAuthValuePropositionModal/index.js +282 -0
  27. package/dist/esm/__tests__/informational-vr-tests/__snapshots__/pre-auth-value-proposition-modal/text-only--light-mode.png +3 -0
  28. package/dist/esm/__tests__/informational-vr-tests/__snapshots__/pre-auth-value-proposition-modal/with-image--light-mode.png +3 -0
  29. package/dist/esm/common/analytics/generated/use-analytics-events.js +1 -1
  30. package/dist/esm/entry-points/pre-auth-value-proposition-modal.js +1 -0
  31. package/dist/esm/state/services/pre-auth-value-proposition-modal/index.js +115 -0
  32. package/dist/esm/utils/analytics/analytics.js +1 -1
  33. package/dist/esm/view/LinkUrl/index.js +1 -1
  34. package/dist/esm/view/PreAuthValuePropositionModal/IllustrationPane.compiled.css +30 -0
  35. package/dist/esm/view/PreAuthValuePropositionModal/IllustrationPane.js +52 -0
  36. package/dist/esm/view/PreAuthValuePropositionModal/assets/graphics-with-grid-no-provider-icons-2x.png +0 -0
  37. package/dist/esm/view/PreAuthValuePropositionModal/index.compiled.css +17 -0
  38. package/dist/esm/view/PreAuthValuePropositionModal/index.js +293 -0
  39. package/dist/types/common/analytics/generated/analytics.types.d.ts +14 -1
  40. package/dist/types/entry-points/pre-auth-value-proposition-modal.d.ts +1 -0
  41. package/dist/types/state/services/pre-auth-value-proposition-modal/index.d.ts +11 -0
  42. package/dist/types/view/PreAuthValuePropositionModal/IllustrationPane.d.ts +10 -0
  43. package/dist/types/view/PreAuthValuePropositionModal/index.d.ts +5 -0
  44. package/package.json +1 -1
  45. package/pre-auth-value-proposition-modal/package.json +10 -0
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
12
12
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
13
13
  var PACKAGE_DATA = {
14
14
  packageName: "@atlaskit/smart-card",
15
- packageVersion: "45.27.0",
15
+ packageVersion: "45.27.1",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  var LinkUrl = function LinkUrl(_ref) {
@@ -0,0 +1,30 @@
1
+ ._154i18e8{top:53px}
2
+ ._154i1rp4{top:215px}
3
+ ._154intd2{top:184px}
4
+ ._154invl5{top:355px}
5
+ ._18m915vq{overflow-y:hidden}
6
+ ._1bah1h6o{justify-content:center}
7
+ ._1bsb1kdj{width:25pc}
8
+ ._1bsb1ylp{width:40px}
9
+ ._1bsbl52n{width:17px}
10
+ ._1bsbo7ao{width:15px}
11
+ ._1e0c1txw{display:flex}
12
+ ._1e0c1ule{display:block}
13
+ ._1ein1kw7{border-end-end-radius:inherit}
14
+ ._1ltv1uvc{left:107px}
15
+ ._1ltv5rga{left:123px}
16
+ ._1ltvs0l4{left:121px}
17
+ ._1ltvvbgk{left:4pc}
18
+ ._1o9zidpf{flex-shrink:0}
19
+ ._1reo15vq{overflow-x:hidden}
20
+ ._4cvr1h6o{align-items:center}
21
+ ._4t3i1osq{height:100%}
22
+ ._4t3i1ylp{height:40px}
23
+ ._4t3ikbql{height:450px}
24
+ ._4t3il52n{height:17px}
25
+ ._4t3io7ao{height:15px}
26
+ ._5fbc1kw7{border-start-end-radius:inherit}
27
+ ._kqswh2mm{position:relative}
28
+ ._kqswstnw{position:absolute}
29
+ ._t9ec1b7d{transform:rotate(-3.18deg)}
30
+ ._t9ec751h{transform:rotate(3.37deg)}
@@ -0,0 +1,52 @@
1
+ /* IllustrationPane.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ import "./IllustrationPane.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ import { Box } from '@atlaskit/primitives/compiled/box';
6
+
7
+ // Asset imports require an explicit extension for TypeScript and ESLint resolution.
8
+ // oxlint-disable-next-line import/extensions
9
+ import illustrationWithoutProviderIcons from './assets/graphics-with-grid-no-provider-icons-2x.png';
10
+ var styles = {
11
+ illustration: "_1e0c1ule _4t3ikbql _1bsb1kdj",
12
+ illustrationLayer: "_1reo15vq _18m915vq _1ein1kw7 _5fbc1kw7 _4t3ikbql _kqswh2mm _1bsb1kdj",
13
+ rightPane: "_1reo15vq _18m915vq _4cvr1h6o _1ein1kw7 _5fbc1kw7 _1e0c1txw _1o9zidpf _4t3i1osq _1bah1h6o _1bsb1kdj"
14
+ };
15
+
16
+ // Pixel offsets and rotations are from the Figma illustration, not space tokens.
17
+ var illustrationIconStyles = {
18
+ footer: "_4t3io7ao _1ltv1uvc _kqswstnw _154invl5 _t9ec1b7d _1bsbo7ao",
19
+ searchFirst: "_4t3il52n _1ltv5rga _kqswstnw _154intd2 _t9ec751h _1bsbl52n",
20
+ searchSecond: "_4t3il52n _1ltvs0l4 _kqswstnw _154i1rp4 _t9ec751h _1bsbl52n",
21
+ top: "_1reo15vq _18m915vq _4t3i1ylp _1ltvvbgk _kqswstnw _154i18e8 _1bsb1ylp"
22
+ };
23
+ var IllustrationPane = function IllustrationPane(_ref) {
24
+ var renderProviderIcon = _ref.renderProviderIcon;
25
+ return /*#__PURE__*/React.createElement(Box, {
26
+ xcss: styles.rightPane
27
+ }, /*#__PURE__*/React.createElement(Box, {
28
+ xcss: styles.illustrationLayer
29
+ }, /*#__PURE__*/React.createElement("img", {
30
+ alt: "",
31
+ "aria-hidden": "true",
32
+ "data-testid": "pre-auth-value-proposition-modal-illustration",
33
+ height: 450,
34
+ src: illustrationWithoutProviderIcons,
35
+ srcSet: "".concat(illustrationWithoutProviderIcons, " 2x"),
36
+ width: 400,
37
+ className: ax([styles.illustration])
38
+ }), /*#__PURE__*/React.createElement("div", {
39
+ "aria-hidden": "true",
40
+ className: ax([illustrationIconStyles.top])
41
+ }, renderProviderIcon(40, 'pre-auth-value-proposition-modal-illustration-icon')), /*#__PURE__*/React.createElement("div", {
42
+ "aria-hidden": "true",
43
+ className: ax([illustrationIconStyles.searchFirst])
44
+ }, renderProviderIcon(17, 'pre-auth-value-proposition-modal-illustration-icon')), /*#__PURE__*/React.createElement("div", {
45
+ "aria-hidden": "true",
46
+ className: ax([illustrationIconStyles.searchSecond])
47
+ }, renderProviderIcon(17, 'pre-auth-value-proposition-modal-illustration-icon')), /*#__PURE__*/React.createElement("div", {
48
+ "aria-hidden": "true",
49
+ className: ax([illustrationIconStyles.footer])
50
+ }, renderProviderIcon(15, 'pre-auth-value-proposition-modal-illustration-icon'))));
51
+ };
52
+ export default IllustrationPane;
@@ -0,0 +1,17 @@
1
+ ._2rko1kw7{border-radius:inherit}
2
+ ._zulp1ejb{gap:var(--ds-space-300,24px)}
3
+ ._zulppxbi{gap:var(--ds-space-200,1pc)}._16jlkb7n{flex-grow:1}
4
+ ._18m915vq{overflow-y:hidden}
5
+ ._19bv1jfw{padding-left:var(--ds-space-500,40px)}
6
+ ._1bsb1kdj{width:25pc}
7
+ ._1bsbnklw{width:20pc}
8
+ ._1e0c1txw{display:flex}
9
+ ._1o9zidpf{flex-shrink:0}
10
+ ._1reo15vq{overflow-x:hidden}
11
+ ._2lx21bp4{flex-direction:column}
12
+ ._4cvr1fhb{align-items:stretch}
13
+ ._4cvr1h6o{align-items:center}
14
+ ._4t3i1osq{height:100%}
15
+ ._ca0q1jfw{padding-top:var(--ds-space-500,40px)}
16
+ ._n3td1jfw{padding-bottom:var(--ds-space-500,40px)}
17
+ ._u5f31jfw{padding-right:var(--ds-space-500,40px)}
@@ -0,0 +1,293 @@
1
+ /* index.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _extends from "@babel/runtime/helpers/extends";
4
+ import "./index.compiled.css";
5
+ import { ax, ix } from "@compiled/react/runtime";
6
+ import React, { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState } from 'react';
7
+ import { defineMessages, FormattedMessage } from 'react-intl';
8
+ import Button from '@atlaskit/button/default/button';
9
+ import Heading from '@atlaskit/heading/heading';
10
+ import { extractSmartLinkProvider } from '@atlaskit/link-extractors/extract-smart-link-provider';
11
+ import ModalBody from '@atlaskit/modal-dialog/modal-body';
12
+ import Modal from '@atlaskit/modal-dialog/modal-dialog';
13
+ import ModalTitle from '@atlaskit/modal-dialog/modal-title';
14
+ import ModalTransition from '@atlaskit/modal-dialog/modal-transition';
15
+ import { expVal } from '@atlaskit/platform-feature-experiments/exp-val';
16
+ import { Box } from '@atlaskit/primitives/compiled/box';
17
+ import { Flex } from '@atlaskit/primitives/compiled/flex';
18
+ import { Stack } from '@atlaskit/primitives/compiled/stack';
19
+ import { Text } from '@atlaskit/primitives/compiled/text';
20
+ import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
21
+ import { messages as smartCardMessages } from '../../messages';
22
+ import { getExtensionKey, getServices } from '../../state/helpers';
23
+ import useSocialProof from '../../state/hooks/use-social-proof';
24
+ import { useSmartLink } from '../../state/hooks/useSmartLink';
25
+ import { preAuthValuePropositionModalService } from '../../state/services/pre-auth-value-proposition-modal';
26
+ import { SmartLinkAnalyticsContext } from '../../utils/analytics/SmartLinkAnalyticsContext';
27
+ import ImageIcon from '../common/image-icon';
28
+ var IllustrationPane = /*#__PURE__*/lazy(function () {
29
+ return import( /* webpackChunkName: "@atlaskit-internal_smart-card-pre-auth-value-proposition-illustration" */'./IllustrationPane');
30
+ });
31
+ var SOCIAL_PROOF_TEAM_PREVIEW_THRESHOLD = 30;
32
+ var SMART_LINK_MODAL_ID = 'pre-auth-value-proposition-modal';
33
+ var messages = defineMessages({
34
+ close: {
35
+ id: 'smart-card.view.PreAuthValuePropositionModal.close',
36
+ defaultMessage: 'Close',
37
+ description: 'Closes the pre-auth value proposition modal.'
38
+ },
39
+ connect: {
40
+ id: 'smart-card.view.PreAuthValuePropositionModal.connect',
41
+ defaultMessage: 'Connect {providerName}',
42
+ description: 'Connect button in the pre-auth value proposition modal. providerName is supplied by the Smart Link response.'
43
+ },
44
+ embedBenefit: {
45
+ id: 'smart-card.view.PreAuthValuePropositionModal.embedBenefit',
46
+ defaultMessage: '<b>Embed</b> richer link previews without leaving your workflow',
47
+ description: 'Explains the benefit of embedding richer Smart Link previews without leaving the current workflow.'
48
+ },
49
+ searchBenefit: {
50
+ id: 'smart-card.view.PreAuthValuePropositionModal.searchBenefit',
51
+ defaultMessage: '<b>Search</b> across {providerName} and Atlassian content in one place',
52
+ description: 'Explains the cross-product search benefit. providerName is supplied by the Smart Link response.'
53
+ },
54
+ seeBenefit: {
55
+ id: 'smart-card.view.PreAuthValuePropositionModal.seeBenefit',
56
+ defaultMessage: '<b>See</b> Rovo answers grounded in your {providerName} content',
57
+ description: 'Explains the Rovo benefit. providerName is supplied by the Smart Link response.'
58
+ },
59
+ title: {
60
+ id: 'smart-card.view.PreAuthValuePropositionModal.title',
61
+ defaultMessage: 'Connect {providerName}',
62
+ description: 'Title for the pre-auth value proposition modal. providerName is supplied by the Smart Link response.'
63
+ }
64
+ });
65
+ var styles = {
66
+ bodyCopy: "_1bsbnklw",
67
+ content: "_zulp1ejb _1e0c1txw _2lx21bp4 _4t3i1osq _n3td1jfw _19bv1jfw _u5f31jfw _ca0q1jfw",
68
+ copyColumn: "_zulppxbi _1e0c1txw _2lx21bp4 _16jlkb7n",
69
+ leftPane: "_1e0c1txw _2lx21bp4 _1o9zidpf _4t3i1osq _1bsb1kdj",
70
+ providerIcon: "_4cvr1h6o _1e0c1txw _1o9zidpf",
71
+ splitLayout: "_2rko1kw7 _1reo15vq _18m915vq _4cvr1fhb _1e0c1txw _4t3i1osq"
72
+ };
73
+ var bold = function bold(chunks) {
74
+ return /*#__PURE__*/React.createElement(Text, {
75
+ as: "strong"
76
+ }, chunks);
77
+ };
78
+ var getModalCloseMethod = function getModalCloseMethod(event) {
79
+ return 'key' in event && event.key === 'Escape' ? 'escape' : 'overlay';
80
+ };
81
+ var ModalCopy = function ModalCopy(_ref) {
82
+ var connectedPct = _ref.connectedPct,
83
+ isSocialProofAvailable = _ref.isSocialProofAvailable,
84
+ onClose = _ref.onClose,
85
+ onConnect = _ref.onConnect,
86
+ providerIcon = _ref.providerIcon,
87
+ providerName = _ref.providerName;
88
+ var messageValues = {
89
+ b: bold,
90
+ providerName: providerName
91
+ };
92
+ var isSocialProofUsageHighEnough = connectedPct !== undefined && connectedPct >= SOCIAL_PROOF_TEAM_PREVIEW_THRESHOLD;
93
+ return /*#__PURE__*/React.createElement(ModalBody, {
94
+ hasInlinePadding: false
95
+ }, /*#__PURE__*/React.createElement(Box, {
96
+ xcss: styles.content
97
+ }, /*#__PURE__*/React.createElement(Box, {
98
+ xcss: styles.copyColumn
99
+ }, /*#__PURE__*/React.createElement(Stack, {
100
+ space: "space.250"
101
+ }, providerIcon && /*#__PURE__*/React.createElement(Box, {
102
+ xcss: styles.providerIcon
103
+ }, providerIcon), /*#__PURE__*/React.createElement(ModalTitle, {
104
+ isMultiline: false
105
+ }, /*#__PURE__*/React.createElement(Heading, {
106
+ as: "span",
107
+ color: "color.text",
108
+ size: "large"
109
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.title, {
110
+ values: {
111
+ providerName: providerName
112
+ }
113
+ }))))), /*#__PURE__*/React.createElement(Box, {
114
+ xcss: styles.bodyCopy
115
+ }, /*#__PURE__*/React.createElement(Stack, {
116
+ space: "space.200"
117
+ }, /*#__PURE__*/React.createElement(Text, {
118
+ as: "p",
119
+ color: "color.text",
120
+ size: "large"
121
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.seeBenefit, {
122
+ values: messageValues
123
+ }))), /*#__PURE__*/React.createElement(Text, {
124
+ as: "p",
125
+ color: "color.text",
126
+ size: "large"
127
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.searchBenefit, {
128
+ values: messageValues
129
+ }))), /*#__PURE__*/React.createElement(Text, {
130
+ as: "p",
131
+ color: "color.text",
132
+ size: "large"
133
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.embedBenefit, {
134
+ values: messageValues
135
+ })))))), isSocialProofAvailable && /*#__PURE__*/React.createElement(Text, {
136
+ as: "p",
137
+ color: "color.text.subtlest",
138
+ size: "small",
139
+ testId: "pre-auth-value-proposition-modal-social-proof"
140
+ }, isSocialProofUsageHighEnough ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, smartCardMessages.social_proof_inline_cta_tag_high_with_context, {
141
+ values: {
142
+ connectedPct: connectedPct,
143
+ context: providerName,
144
+ b: bold
145
+ }
146
+ })) : /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, smartCardMessages.social_proof_inline_cta_tag_low_with_context, {
147
+ values: {
148
+ context: providerName
149
+ }
150
+ }))), /*#__PURE__*/React.createElement(Flex, {
151
+ gap: "space.075",
152
+ justifyContent: "start"
153
+ }, /*#__PURE__*/React.createElement(Button, {
154
+ appearance: "primary",
155
+ onClick: onConnect,
156
+ autoFocus: true,
157
+ spacing: "default"
158
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect, {
159
+ values: {
160
+ providerName: providerName
161
+ }
162
+ }))), /*#__PURE__*/React.createElement(Button, {
163
+ appearance: "subtle",
164
+ onClick: onClose
165
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages.close)))));
166
+ };
167
+ var PreAuthValuePropositionModalContent = function PreAuthValuePropositionModalContent(_ref2) {
168
+ var _provider$iconLabel;
169
+ var onFinished = _ref2.onFinished,
170
+ url = _ref2.url;
171
+ var _useSmartLink = useSmartLink(SMART_LINK_MODAL_ID, url, 'inline'),
172
+ actions = _useSmartLink.actions,
173
+ config = _useSmartLink.config,
174
+ state = _useSmartLink.state;
175
+ var _useAnalyticsEvents = useAnalyticsEvents(),
176
+ fireEvent = _useAnalyticsEvents.fireEvent;
177
+ var _useState = useState(false),
178
+ _useState2 = _slicedToArray(_useState, 2),
179
+ isOpen = _useState2[0],
180
+ setIsOpen = _useState2[1];
181
+ var _useState3 = useState('modal_text_only'),
182
+ _useState4 = _slicedToArray(_useState3, 2),
183
+ visibleVariant = _useState4[0],
184
+ setVisibleVariant = _useState4[1];
185
+ var modalOpenTimeRef = useRef(Date.now());
186
+ var provider = useMemo(function () {
187
+ return extractSmartLinkProvider(state.details);
188
+ }, [state.details]);
189
+ var providerName = provider === null || provider === void 0 ? void 0 : provider.text;
190
+ var providerIconUrl = typeof (provider === null || provider === void 0 ? void 0 : provider.icon) === 'string' ? provider.icon : undefined;
191
+ var renderProviderIcon = function renderProviderIcon(size, testId, label) {
192
+ if (providerIconUrl) {
193
+ var sizePx = "".concat(size, "px");
194
+ return /*#__PURE__*/React.createElement(ImageIcon, {
195
+ height: sizePx,
196
+ hideLoadingSkeleton: true,
197
+ label: label !== null && label !== void 0 ? label : '',
198
+ testId: testId,
199
+ url: providerIconUrl,
200
+ width: sizePx
201
+ });
202
+ }
203
+ return provider === null || provider === void 0 ? void 0 : provider.icon;
204
+ };
205
+ var providerIcon = renderProviderIcon(24, 'pre-auth-value-proposition-modal-provider-icon', (_provider$iconLabel = provider === null || provider === void 0 ? void 0 : provider.iconLabel) !== null && _provider$iconLabel !== void 0 ? _provider$iconLabel : providerName);
206
+ var services = getServices(state.details);
207
+ var extensionKey = getExtensionKey(state.details);
208
+ var _useSocialProof = useSocialProof(extensionKey, true),
209
+ connectedPct = _useSocialProof.connectedPct,
210
+ isSocialProofAvailable = _useSocialProof.isEnabled;
211
+ var hasSupportedAuthorization = (config === null || config === void 0 ? void 0 : config.authFlow) !== 'disabled' && services.length > 0;
212
+ var isBaseEligible = state.status === 'unauthorized' && Boolean(providerName) && Boolean(extensionKey) && hasSupportedAuthorization;
213
+ useEffect(function () {
214
+ if (state.status === 'pending' || state.status === 'resolving') {
215
+ return;
216
+ }
217
+ if (!isBaseEligible || !extensionKey || preAuthValuePropositionModalService.hasReachedShowLimit(extensionKey)) {
218
+ onFinished();
219
+ return;
220
+ }
221
+ var experimentVariant = expVal('platform_sl_3p_preauth_value_modal', 'variant', 'control');
222
+ if (experimentVariant === 'modal_text_only' || experimentVariant === 'modal_with_image') {
223
+ preAuthValuePropositionModalService.recordShow(extensionKey);
224
+ setVisibleVariant(experimentVariant);
225
+ setIsOpen(true);
226
+ return;
227
+ }
228
+ onFinished();
229
+ }, [extensionKey, isBaseEligible, onFinished, state.status]);
230
+ var dismissModal = useCallback(function (closeMethod) {
231
+ fireEvent('ui.modal.closed.preAuthValueProposition', {
232
+ closeMethod: closeMethod,
233
+ dwellTime: Date.now() - modalOpenTimeRef.current
234
+ });
235
+ setIsOpen(false);
236
+ onFinished();
237
+ }, [fireEvent, onFinished]);
238
+ var handleCloseButton = useCallback(function () {
239
+ dismissModal('button');
240
+ }, [dismissModal]);
241
+ var handleModalClose = useCallback(function (event) {
242
+ dismissModal(getModalCloseMethod(event));
243
+ }, [dismissModal]);
244
+ var handleOpenComplete = useCallback(function () {
245
+ modalOpenTimeRef.current = Date.now();
246
+ fireEvent('ui.modal.opened.preAuthValueProposition', {});
247
+ }, [fireEvent]);
248
+ var connectAccount = useCallback(function () {
249
+ fireEvent('track.applicationAccount.authStarted', {});
250
+ setIsOpen(false);
251
+ actions.authorize('inline');
252
+ onFinished();
253
+ }, [actions, fireEvent, onFinished]);
254
+ if (!isOpen || !providerName) {
255
+ return null;
256
+ }
257
+ var modalCopy = /*#__PURE__*/React.createElement(ModalCopy, {
258
+ connectedPct: connectedPct,
259
+ isSocialProofAvailable: isSocialProofAvailable,
260
+ onClose: handleCloseButton,
261
+ onConnect: connectAccount,
262
+ providerIcon: providerIcon,
263
+ providerName: providerName
264
+ });
265
+ var showIllustration = visibleVariant === 'modal_with_image';
266
+ return /*#__PURE__*/React.createElement(ModalTransition, null, /*#__PURE__*/React.createElement(Modal, {
267
+ onClose: handleModalClose,
268
+ onOpenComplete: handleOpenComplete,
269
+ testId: "pre-auth-value-proposition-modal",
270
+ width: showIllustration ? 800 : 400
271
+ }, showIllustration ? /*#__PURE__*/React.createElement(Box, {
272
+ xcss: styles.splitLayout
273
+ }, /*#__PURE__*/React.createElement(Box, {
274
+ xcss: styles.leftPane
275
+ }, modalCopy), /*#__PURE__*/React.createElement(Suspense, {
276
+ fallback: null
277
+ }, /*#__PURE__*/React.createElement(IllustrationPane, {
278
+ renderProviderIcon: renderProviderIcon
279
+ }))) : modalCopy));
280
+ };
281
+ export var PreAuthValuePropositionModal = function PreAuthValuePropositionModal(_ref3) {
282
+ var onFinished = _ref3.onFinished,
283
+ url = _ref3.url;
284
+ return /*#__PURE__*/React.createElement(SmartLinkAnalyticsContext, {
285
+ display: "inline",
286
+ id: SMART_LINK_MODAL_ID,
287
+ source: "preAuthValuePropositionModal",
288
+ url: url
289
+ }, /*#__PURE__*/React.createElement(PreAuthValuePropositionModalContent, {
290
+ onFinished: onFinished,
291
+ url: url
292
+ }));
293
+ };
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::326efd393bebe329396aa4b676d0ff6d>>
6
+ * @codegen <<SignedSource::6942f25d7f2e287cebf52d4a52dcf493>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card
8
8
  */
9
9
  export type PackageMetaDataContextType = {
@@ -98,6 +98,11 @@ export type ModalOpenedRelatedLinksAttributesType = {};
98
98
  export type ModalClosedRelatedLinksAttributesType = {
99
99
  dwellTime: number;
100
100
  };
101
+ export type ModalOpenedPreAuthValuePropositionAttributesType = {};
102
+ export type ModalClosedPreAuthValuePropositionAttributesType = {
103
+ closeMethod: 'button' | 'escape' | 'overlay';
104
+ dwellTime: number;
105
+ };
101
106
  export type RelatedLinksSuccessAttributesType = {
102
107
  incomingCount: number;
103
108
  outgoingCount: number;
@@ -340,6 +345,14 @@ export type AnalyticsEventAttributes = {
340
345
  /**
341
346
  * fired when related links modal is closed */
342
347
  'ui.modal.closed.relatedLinks': ModalClosedRelatedLinksAttributesType;
348
+ /**
349
+ * Fired when the pre-auth value proposition modal is shown after an eligible unauthorized Smart Link is created or converted.
350
+ * */
351
+ 'ui.modal.opened.preAuthValueProposition': ModalOpenedPreAuthValuePropositionAttributesType;
352
+ /**
353
+ * Fired when the user dismisses the pre-auth value proposition modal without connecting.
354
+ * */
355
+ 'ui.modal.closed.preAuthValueProposition': ModalClosedPreAuthValuePropositionAttributesType;
343
356
  /**
344
357
  * fired when related links are retrieved successfully */
345
358
  'operational.relatedLinks.success': RelatedLinksSuccessAttributesType;
@@ -0,0 +1 @@
1
+ export { PreAuthValuePropositionModal, type PreAuthValuePropositionModalProps, } from '../view/PreAuthValuePropositionModal';
@@ -0,0 +1,11 @@
1
+ export declare const PRE_AUTH_VALUE_PROPOSITION_MODAL_STORAGE_ITEM_KEY = "pre-auth-value-proposition-modal-shown-providers:v3";
2
+ export declare const PRE_AUTH_VALUE_PROPOSITION_MODAL_COOLDOWN_MS: number;
3
+ export declare class PreAuthValuePropositionModalService {
4
+ private storedShowState;
5
+ hasReachedShowLimit(extensionKey: string): boolean;
6
+ recordShow(extensionKey: string): void;
7
+ reset(): void;
8
+ private getStoredShowState;
9
+ private readStoredShowState;
10
+ }
11
+ export declare const preAuthValuePropositionModalService: PreAuthValuePropositionModalService;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React from 'react';
6
+ type IllustrationPaneProps = {
7
+ renderProviderIcon: (size: number, testId?: string) => React.ReactNode;
8
+ };
9
+ declare const IllustrationPane: ({ renderProviderIcon }: IllustrationPaneProps) => JSX.Element;
10
+ export default IllustrationPane;
@@ -0,0 +1,5 @@
1
+ export type PreAuthValuePropositionModalProps = {
2
+ onFinished: () => void;
3
+ url: string;
4
+ };
5
+ export declare const PreAuthValuePropositionModal: ({ onFinished, url, }: PreAuthValuePropositionModalProps) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "45.27.1",
3
+ "version": "45.28.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/smart-card/pre-auth-value-proposition-modal",
3
+ "main": "../dist/cjs/entry-points/pre-auth-value-proposition-modal.js",
4
+ "module": "../dist/esm/entry-points/pre-auth-value-proposition-modal.js",
5
+ "module:es2019": "../dist/es2019/entry-points/pre-auth-value-proposition-modal.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../dist/types/entry-points/pre-auth-value-proposition-modal.d.ts"
10
+ }