@atlaskit/smart-card 44.5.4 → 44.6.1

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 (46) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/__tests__/vr-tests/__snapshots__/inline-card/inline-card-unauthorised-social-proof-exploratory-low-share-previewing-headline-and-short-connect-label--default.png +3 -0
  3. package/dist/cjs/__tests__/vr-tests/__snapshots__/inline-card/inline-card-unauthorised-social-proof-no-context-percentage-headline-with-short-connect-label--default.png +3 -0
  4. package/dist/cjs/__tests__/vr-tests/__snapshots__/inline-card/inline-card-unauthorised-social-proof-persisted-percentage-previews-headline-30-and-short-connect-label--default.png +3 -0
  5. package/dist/cjs/messages.js +20 -0
  6. package/dist/cjs/state/hooks/use-incoming-outgoing-links/index.js +20 -5
  7. package/dist/cjs/state/services/current-site-cloud-id/index.js +2 -1
  8. package/dist/cjs/utils/analytics/analytics.js +1 -1
  9. package/dist/cjs/view/InlineCard/UnauthorisedView/index.compiled.css +21 -0
  10. package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +108 -14
  11. package/dist/cjs/view/InlineCard/common/action-button/index.compiled.css +4 -7
  12. package/dist/cjs/view/InlineCard/common/action-button/index.js +21 -3
  13. package/dist/cjs/view/LinkUrl/index.js +1 -1
  14. package/dist/es2019/__tests__/vr-tests/__snapshots__/inline-card/inline-card-unauthorised-social-proof-exploratory-low-share-previewing-headline-and-short-connect-label--default.png +3 -0
  15. package/dist/es2019/__tests__/vr-tests/__snapshots__/inline-card/inline-card-unauthorised-social-proof-no-context-percentage-headline-with-short-connect-label--default.png +3 -0
  16. package/dist/es2019/__tests__/vr-tests/__snapshots__/inline-card/inline-card-unauthorised-social-proof-persisted-percentage-previews-headline-30-and-short-connect-label--default.png +3 -0
  17. package/dist/es2019/messages.js +20 -0
  18. package/dist/es2019/state/hooks/use-incoming-outgoing-links/index.js +4 -2
  19. package/dist/es2019/state/services/current-site-cloud-id/index.js +2 -2
  20. package/dist/es2019/utils/analytics/analytics.js +1 -1
  21. package/dist/es2019/view/InlineCard/UnauthorisedView/index.compiled.css +21 -0
  22. package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +95 -2
  23. package/dist/es2019/view/InlineCard/common/action-button/index.compiled.css +4 -7
  24. package/dist/es2019/view/InlineCard/common/action-button/index.js +19 -2
  25. package/dist/es2019/view/LinkUrl/index.js +1 -1
  26. package/dist/esm/__tests__/vr-tests/__snapshots__/inline-card/inline-card-unauthorised-social-proof-exploratory-low-share-previewing-headline-and-short-connect-label--default.png +3 -0
  27. package/dist/esm/__tests__/vr-tests/__snapshots__/inline-card/inline-card-unauthorised-social-proof-no-context-percentage-headline-with-short-connect-label--default.png +3 -0
  28. package/dist/esm/__tests__/vr-tests/__snapshots__/inline-card/inline-card-unauthorised-social-proof-persisted-percentage-previews-headline-30-and-short-connect-label--default.png +3 -0
  29. package/dist/esm/messages.js +20 -0
  30. package/dist/esm/state/hooks/use-incoming-outgoing-links/index.js +20 -5
  31. package/dist/esm/state/services/current-site-cloud-id/index.js +2 -1
  32. package/dist/esm/utils/analytics/analytics.js +1 -1
  33. package/dist/esm/view/InlineCard/UnauthorisedView/index.compiled.css +21 -0
  34. package/dist/esm/view/InlineCard/UnauthorisedView/index.js +108 -14
  35. package/dist/esm/view/InlineCard/common/action-button/index.compiled.css +4 -7
  36. package/dist/esm/view/InlineCard/common/action-button/index.js +21 -3
  37. package/dist/esm/view/LinkUrl/index.js +1 -1
  38. package/dist/types/messages.d.ts +1 -1
  39. package/dist/types/state/services/current-site-cloud-id/index.d.ts +1 -1
  40. package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +1 -1
  41. package/dist/types/view/InlineCard/common/action-button/index.d.ts +7 -0
  42. package/dist/types-ts4.5/messages.d.ts +1 -1
  43. package/dist/types-ts4.5/state/services/current-site-cloud-id/index.d.ts +1 -1
  44. package/dist/types-ts4.5/view/InlineCard/UnauthorisedView/index.d.ts +1 -1
  45. package/dist/types-ts4.5/view/InlineCard/common/action-button/index.d.ts +7 -0
  46. package/package.json +5 -2
@@ -1,11 +1,17 @@
1
1
  /* index.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
+ import "./index.compiled.css";
3
4
  import { ax, ix } from "@compiled/react/runtime";
4
5
  import React from 'react';
5
6
  import { FormattedMessage } from 'react-intl';
7
+ import { di } from 'react-magnetic-di';
6
8
  import LockLockedIcon from '@atlaskit/icon/core/lock-locked';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
10
+ import { Box } from '@atlaskit/primitives/compiled';
11
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
12
  import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
8
13
  import { messages } from '../../../messages';
14
+ import { getCachedProviderPctMapAndRefresh } from '../../../state/services/personalization';
9
15
  import { HoverCard } from '../../HoverCard';
10
16
  import { ActionButton } from '../common/action-button';
11
17
  import { Frame } from '../Frame';
@@ -16,6 +22,86 @@ const fallbackUnauthorizedIcon = () => {
16
22
  label: "error"
17
23
  });
18
24
  };
25
+
26
+ /**
27
+ * When persisted personalization adoption from {@link getCachedProviderPctMapAndRefresh} is strictly below this value,
28
+ * the pill uses exploratory "previewing" copy instead of a percentage headline.
29
+ */
30
+ const SOCIAL_PROOF_TEAM_PREVIEW_THRESHOLD = 30;
31
+ const SOCIAL_PROOF_TRAIT_NAME = 'sl_3p_connected_providers_site_pct';
32
+ const socialProofPillStyles = {
33
+ strong: "_k48pwu06",
34
+ inlineContainer: "_1e0c116y _4cvr1h6o",
35
+ root: "_2rko12b0 _1e0c1nu9 _4cvr1h6o _vchhusvi _p12f1osq _bfhk1dpa _syazazsu _y3gn18uv _1wybtjj4 _s7n4t94y _ca0qv77o _n3tdv77o _u5f312x7 _19bv12x7 _2hwx1b66",
36
+ label: "_1reo15vq _18m915vq _1bto1l2s _o5721q9c"
37
+ };
38
+
39
+ /**
40
+ * Renders the social-proof pill and Connect button using persisted percentages only ({@link getCachedProviderPctMapAndRefresh}) — no
41
+ * loading skeleton; either the cached percentage is shown or the legacy long connect label is used.
42
+ *
43
+ * Only mounted when the parent has passed the killswitch and
44
+ * `platform_sl_3p_preauth_social_proof_inline_cta`. See platform docs: `rules-of-hooks.md` "Should §1".
45
+ */
46
+ const UnauthorisedConnectWithSocialProof = ({
47
+ context,
48
+ extensionKey,
49
+ testId,
50
+ onConnectClick
51
+ }) => {
52
+ var _context$trim;
53
+ // TODO We need to decide what should we do with FedRAMP. It will not work there (_edge/tenant_info is not available) but so maybe
54
+ // we can just leave it like that and whole feature won't trigger befcause of that.
55
+ const providerPctMap = getCachedProviderPctMapAndRefresh(SOCIAL_PROOF_TRAIT_NAME);
56
+ const connectedPct = extensionKey && providerPctMap ? providerPctMap[extensionKey] : undefined;
57
+ const isEnabled = true;
58
+ const trimmedProviderDisplayName = (_context$trim = context === null || context === void 0 ? void 0 : context.trim()) !== null && _context$trim !== void 0 ? _context$trim : '';
59
+ const hasProviderDisplayName = trimmedProviderDisplayName.length > 0;
60
+ const isSocialProofUsageHighEnough = connectedPct !== undefined && connectedPct >= SOCIAL_PROOF_TEAM_PREVIEW_THRESHOLD;
61
+
62
+ /**
63
+ * Persisted personalization is required. Below {@link SOCIAL_PROOF_TEAM_PREVIEW_THRESHOLD} adoption we also require
64
+ * a provider display name; otherwise omit the pill and use the legacy long connect treatment.
65
+ */
66
+ const showSocialProofPill = isEnabled && connectedPct !== undefined && (isSocialProofUsageHighEnough || hasProviderDisplayName);
67
+ const bold = chunks => /*#__PURE__*/React.createElement(Box, {
68
+ as: "strong",
69
+ xcss: socialProofPillStyles.strong
70
+ }, chunks);
71
+ const socialProofPillContent = isSocialProofUsageHighEnough ? hasProviderDisplayName ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.social_proof_inline_cta_tag_high_with_context, {
72
+ values: {
73
+ connectedPct,
74
+ context: trimmedProviderDisplayName,
75
+ b: bold
76
+ }
77
+ })) : /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.social_proof_inline_cta_tag_high_no_context, {
78
+ values: {
79
+ connectedPct,
80
+ b: bold
81
+ }
82
+ })) : /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.social_proof_inline_cta_tag_low_with_context, {
83
+ values: {
84
+ context: trimmedProviderDisplayName
85
+ }
86
+ }));
87
+ return /*#__PURE__*/React.createElement(React.Fragment, null, showSocialProofPill ? /*#__PURE__*/React.createElement(Box, {
88
+ as: "span",
89
+ xcss: socialProofPillStyles.root,
90
+ testId: `${testId}-social-proof-tag`
91
+ }, /*#__PURE__*/React.createElement(Box, {
92
+ as: "span",
93
+ xcss: socialProofPillStyles.label
94
+ }, socialProofPillContent)) : null, /*#__PURE__*/React.createElement(ActionButton, {
95
+ onClick: onConnectClick,
96
+ viewType: "unauthorised",
97
+ testId: "button-connect-account",
98
+ isSocialProofInlineUnauthorisedConnect: showSocialProofPill
99
+ }, showSocialProofPill ? /*#__PURE__*/React.createElement(FormattedMessage, messages.connect_inline_social_proof) : /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_link_account_card_name, {
100
+ values: {
101
+ context
102
+ }
103
+ }))));
104
+ };
19
105
  export const InlineCardUnauthorizedView = ({
20
106
  url,
21
107
  id,
@@ -26,12 +112,14 @@ export const InlineCardUnauthorizedView = ({
26
112
  testId = 'inline-card-unauthorized-view',
27
113
  showHoverPreview = false,
28
114
  truncateInline,
29
- context
115
+ context,
116
+ extensionKey
30
117
  }) => {
31
118
  const frameRef = React.useRef(null);
32
119
  const {
33
120
  fireEvent
34
121
  } = useAnalyticsEvents();
122
+ const isSocialProofInlineCtaEnabled = onAuthorise && fg('platform_sl_3p_preauth_soc_proof_inline_killswitch') && expValEquals('platform_sl_3p_preauth_social_proof_inline_cta', 'isEnabled', true);
35
123
  const handleConnectAccount = React.useCallback(event => {
36
124
  event.preventDefault();
37
125
  event.stopPropagation();
@@ -63,7 +151,12 @@ export const InlineCardUnauthorizedView = ({
63
151
  link: url,
64
152
  onClick: onClick,
65
153
  titleColor: "var(--ds-text-subtle, #505258)"
66
- }), onAuthorise && renderActionButton());
154
+ }), onAuthorise && (isSocialProofInlineCtaEnabled ? /*#__PURE__*/React.createElement(UnauthorisedConnectWithSocialProof, {
155
+ context: context,
156
+ extensionKey: extensionKey,
157
+ testId: testId,
158
+ onConnectClick: handleConnectAccount
159
+ }) : renderActionButton()));
67
160
  if (onAuthorise && showHoverPreview) {
68
161
  return /*#__PURE__*/React.createElement(HoverCard, {
69
162
  url: url,
@@ -1,17 +1,16 @@
1
1
 
2
- ._1s7zia51{border-right:var(--ds-border-width,1px) solid var(--ds-border,#0b120e24)}
3
- ._n7zlia51{border-bottom:var(--ds-border-width,1px) solid var(--ds-border,#0b120e24)}
4
- ._x3doia51{border-top:var(--ds-border-width,1px) solid var(--ds-border,#0b120e24)}._13liidpf{border-top-left-radius:0}
5
- ._13lilb4i{border-top-left-radius:var(--ds-radius-xsmall,2px)}
2
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}._13lilb4i{border-top-left-radius:var(--ds-radius-xsmall,2px)}
6
3
  ._16d9qvcn{-webkit-box-decoration-break:clone;box-decoration-break:clone}
7
4
  ._19bv12x7{padding-left:var(--ds-space-075,6px)}
8
5
  ._1e0c1bgi{display:contents}
9
6
  ._1e0c1nu9{display:inline}
10
7
  ._1nmz9jpi{word-break:break-all}
11
8
  ._1o0zlb4i{border-bottom-right-radius:var(--ds-radius-xsmall,2px)}
9
+ ._1wybtjj4{font-size:.8em}
12
10
  ._1y1m1u8q{background-clip:padding-box}
13
11
  ._2hwxt94y{margin-right:1px}
14
12
  ._2hwxv77o{margin-right:var(--ds-space-025,2px)}
13
+ ._4cvr1h6o{align-items:center}
15
14
  ._80om13gf{cursor:not-allowed}
16
15
  ._80omtlke{cursor:pointer}
17
16
  ._bfhkby5v{background-color:var(--ds-background-disabled,#17171708)}
@@ -21,19 +20,17 @@
21
20
  ._ca0qv77o{padding-top:var(--ds-space-025,2px)}
22
21
  ._k48p1wq8{font-weight:var(--ds-font-weight-medium,500)}
23
22
  ._k48pi7a9{font-weight:var(--ds-font-weight-regular,400)}
24
- ._mrkbidpf{border-bottom-left-radius:0}
25
23
  ._mrkblb4i{border-bottom-left-radius:var(--ds-radius-xsmall,2px)}
26
24
  ._n3tdt94y{padding-bottom:1px}
27
25
  ._n3tdv77o{padding-bottom:var(--ds-space-025,2px)}
28
26
  ._o5721btx{white-space:break-spaces}
29
- ._o5721q9c{white-space:nowrap}
30
27
  ._qrwqlb4i{border-top-right-radius:var(--ds-radius-xsmall,2px)}
28
+ ._s7n4t94y{vertical-align:1px}
31
29
  ._syaz15cr{color:var(--ds-text-inverse,#fff)}
32
30
  ._syaz1gmx{color:var(--ds-text-disabled,#080f214a)}
33
31
  ._syazi7uo{color:var(--ds-text,#292a2e)}
34
32
  ._u5f312x7{padding-right:var(--ds-space-075,6px)}
35
33
  ._y3gn18uv{text-align:initial}
36
- ._4cvxq98m:hover{border-color:var(--ds-border-selected,#1868db)}
37
34
  ._irr31q28:hover{background-color:var(--ds-background-selected-bold-hovered,#1558bc)}
38
35
  ._irr3plhp:hover{background-color:var(--ds-background-neutral-hovered,#0b120e24)}
39
36
  ._1di612kk:active{background-color:var(--ds-background-selected-bold-pressed,#123263)}
@@ -4,15 +4,19 @@ import "./index.compiled.css";
4
4
  import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
6
  import { forwardRef } from 'react';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { Pressable } from '@atlaskit/primitives/compiled';
8
9
  const styles = {
9
10
  button: "_1e0c1bgi",
10
11
  innerContainer: "_1e0c1nu9 _1y1m1u8q _16d9qvcn _k48p1wq8 _19bv12x7 _ca0qv77o _n3tdv77o _u5f312x7 _y3gn18uv _o5721btx _1nmz9jpi",
12
+ innerContainerSocialProofConnect: "_2rko12b0 _syaz15cr _80omtlke _bfhkjmqp _2hwxv77o _1e0c1nu9 _4cvr1h6o _1wybtjj4 _1y1m1u8q _16d9qvcn _19bv12x7 _ca0qv77o _n3tdv77o _u5f312x7 _y3gn18uv _s7n4t94y _o5721btx _1nmz9jpi _irr31q28 _1di612kk",
11
13
  enabled: "_syazi7uo _80omtlke _bfhki8nm _irr3plhp _1di61gdz",
12
14
  disabled: "_syaz1gmx _80om13gf _bfhkby5v",
13
- unauthorised: "_syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _13lilb4i _mrkblb4i _ca0qt94y _n3tdt94y _2hwxt94y _k48pi7a9 _irr31q28 _1di612kk",
14
- action: "_x3doia51 _1s7zia51 _n7zlia51 _syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _13liidpf _mrkbidpf _2hwxv77o _k48pi7a9 _o5721q9c _4cvxq98m _irr31q28 _1di612kk"
15
+ unauthorised: "_syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _13lilb4i _mrkblb4i _ca0qt94y _n3tdt94y _2hwxt94y _k48pi7a9 _irr31q28 _1di612kk"
15
16
  };
17
+
18
+ /* eslint-enable @compiled/shorthand-property-sorting */
19
+
16
20
  /**
17
21
  * Action button has to be a span for the overflow to work correctly
18
22
  */
@@ -20,8 +24,21 @@ export const ActionButton = /*#__PURE__*/forwardRef(({
20
24
  children,
21
25
  isDisabled,
22
26
  viewType = 'default',
27
+ isSocialProofInlineUnauthorisedConnect = false,
23
28
  ...props
24
29
  }, ref) => {
30
+ const shouldUseSocialProofConnect = isSocialProofInlineUnauthorisedConnect && viewType === 'unauthorised' && fg('platform_sl_3p_preauth_soc_proof_inline_killswitch');
31
+ if (shouldUseSocialProofConnect && !isDisabled) {
32
+ return /*#__PURE__*/React.createElement(Pressable, _extends({}, props, {
33
+ ref: ref,
34
+ style: {
35
+ font: `inherit`
36
+ },
37
+ xcss: styles.button
38
+ }), /*#__PURE__*/React.createElement("span", {
39
+ className: ax([styles.innerContainerSocialProofConnect])
40
+ }, children));
41
+ }
25
42
  return /*#__PURE__*/React.createElement(Pressable, _extends({}, props, {
26
43
  isDisabled: isDisabled,
27
44
  ref: ref
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
12
12
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
13
13
  const PACKAGE_DATA = {
14
14
  packageName: "@atlaskit/smart-card",
15
- packageVersion: "44.5.3",
15
+ packageVersion: "44.6.0",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  const Anchor = withLinkClickedEvent('a');
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f5c8377b1d3f1c46152e4056e25fac995df7a0c309fc3bd720342e3f5c83a290
3
+ size 18488
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36b68e91316715be24892707009d7e486e55f1b86c08e879640c90ba6b7edd86
3
+ size 19001
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8333dc40a888fb5ecb629497b5c97541a43beaf45b4d1a5dc3b347747c308c02
3
+ size 19222
@@ -175,6 +175,26 @@ export var messages = defineMessages({
175
175
  defaultMessage: 'Connect to {context}',
176
176
  description: 'Shown on a button to connect user external account to their Atlassian account.'
177
177
  },
178
+ connect_inline_social_proof: {
179
+ id: 'fabric.linking.connect_inline_social_proof',
180
+ defaultMessage: 'Connect',
181
+ description: 'Shown on a button for unauthorised inline smart links when the social proof inline CTA experiment is active. Replaces the longer "Connect your {context} account" label.'
182
+ },
183
+ social_proof_inline_cta_tag_high_with_context: {
184
+ id: 'fabric.linking.social_proof_inline_cta_tag_high_with_context',
185
+ defaultMessage: '<b>{connectedPct}%</b> of your team previews {context}',
186
+ description: 'Social-proof tag pill beside the shortcut "Connect" on an unauthorised inline smart link when adoption is not in the exploratory range. {connectedPct} is the approximate share previewing/using the integration; {context} is the provider display name.'
187
+ },
188
+ social_proof_inline_cta_tag_high_no_context: {
189
+ id: 'fabric.linking.social_proof_inline_cta_tag_high_no_context',
190
+ defaultMessage: '<b>{connectedPct}%</b> of your team previews this',
191
+ description: 'Social-proof tag pill when adoption is above the exploratory threshold and no provider display name is available; {connectedPct} is the approximate share previewing the integration.'
192
+ },
193
+ social_proof_inline_cta_tag_low_with_context: {
194
+ id: 'fabric.linking.social_proof_inline_cta_tag_low_with_context',
195
+ defaultMessage: 'Your team is previewing {context}',
196
+ description: 'Social-proof tag pill when share is below the percentage headline threshold; shown only when a provider display name is available. Omit the pill entirely when personalization is unavailable or the provider name is unknown.'
197
+ },
178
198
  connect_unauthorised_account_description: {
179
199
  id: 'fabric.linking.connect_unauthorised_account_description',
180
200
  defaultMessage: 'Connect your {context} account to collaborate on work across Atlassian products.',
@@ -2,6 +2,8 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { useCallback, useMemo } from 'react';
4
4
  import { request } from '@atlaskit/linking-common';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { getCurrentSiteCloudId } from '../use-current-site-cloud-id';
5
7
  import { queryIncomingOutgoingLinks as queryIncomingOutgoingAris } from './query';
6
8
  /**
7
9
  * @param baseUriWithNoTrailingSlash base url which will then be appended with /gateway/api/graphql to make requests to AGG
@@ -70,11 +72,24 @@ var useIncomingOutgoingAri = function useIncomingOutgoingAri() {
70
72
  }
71
73
  return _context3.abrupt("return", match[2]);
72
74
  case 4:
73
- _context3.next = 6;
74
- return getCurrentSiteId();
75
- case 6:
76
- return _context3.abrupt("return", _context3.sent);
75
+ if (!fg('platform_sl_3p_preauth_soc_proof_inline_killswitch')) {
76
+ _context3.next = 10;
77
+ break;
78
+ }
79
+ _context3.next = 7;
80
+ return getCurrentSiteCloudId(baseUriWithNoTrailingSlash);
77
81
  case 7:
82
+ _context3.t0 = _context3.sent;
83
+ _context3.next = 13;
84
+ break;
85
+ case 10:
86
+ _context3.next = 12;
87
+ return getCurrentSiteId();
88
+ case 12:
89
+ _context3.t0 = _context3.sent;
90
+ case 13:
91
+ return _context3.abrupt("return", _context3.t0);
92
+ case 14:
78
93
  case "end":
79
94
  return _context3.stop();
80
95
  }
@@ -83,7 +98,7 @@ var useIncomingOutgoingAri = function useIncomingOutgoingAri() {
83
98
  return function (_x3) {
84
99
  return _ref3.apply(this, arguments);
85
100
  };
86
- }(), [getCurrentSiteId]);
101
+ }(), [getCurrentSiteId, baseUriWithNoTrailingSlash]);
87
102
  var getIncomingOutgoingAris = useCallback(
88
103
  /*#__PURE__*/
89
104
  /**
@@ -143,11 +143,12 @@ export var CurrentSiteCloudIdService = /*#__PURE__*/function () {
143
143
  return _get.apply(this, arguments);
144
144
  }
145
145
  return get;
146
- }() /** Clears the session pin so the next {@link get} may run `tenant_info` again (e.g. tests). */)
146
+ }() /** Clears session pin and persisted storage so the next {@link get} is a fresh tenant_info fetch. */)
147
147
  }, {
148
148
  key: "clearCache",
149
149
  value: function clearCache() {
150
150
  this.tenantInfoInflightPromise = null;
151
+ smartCardStorage.removeItem(CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY);
151
152
  }
152
153
  }]);
153
154
  }();
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
4
4
  export var context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card" || '',
7
- packageVersion: "44.5.3" || ''
7
+ packageVersion: "44.6.0" || ''
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -0,0 +1,21 @@
1
+
2
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}._18m915vq{overflow-y:hidden}
3
+ ._19bv12x7{padding-left:var(--ds-space-075,6px)}
4
+ ._1bto1l2s{text-overflow:ellipsis}
5
+ ._1e0c116y{display:inline-flex}
6
+ ._1e0c1nu9{display:inline}
7
+ ._1reo15vq{overflow-x:hidden}
8
+ ._1wybtjj4{font-size:.8em}
9
+ ._2hwx1b66{margin-right:var(--ds-space-050,4px)}
10
+ ._4cvr1h6o{align-items:center}
11
+ ._bfhk1dpa{background-color:var(--ds-background-neutral-subtle-hovered,#0515240f)}
12
+ ._ca0qv77o{padding-top:var(--ds-space-025,2px)}
13
+ ._k48pwu06{font-weight:var(--ds-font-weight-bold,653)}
14
+ ._n3tdv77o{padding-bottom:var(--ds-space-025,2px)}
15
+ ._o5721q9c{white-space:nowrap}
16
+ ._p12f1osq{max-width:100%}
17
+ ._s7n4t94y{vertical-align:1px}
18
+ ._syazazsu{color:var(--ds-text-subtle,#505258)}
19
+ ._u5f312x7{padding-right:var(--ds-space-075,6px)}
20
+ ._vchhusvi{box-sizing:border-box}
21
+ ._y3gn18uv{text-align:initial}
@@ -1,11 +1,17 @@
1
1
  /* index.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
+ import "./index.compiled.css";
3
4
  import { ax, ix } from "@compiled/react/runtime";
4
5
  import React from 'react';
5
6
  import { FormattedMessage } from 'react-intl';
7
+ import { di } from 'react-magnetic-di';
6
8
  import LockLockedIcon from '@atlaskit/icon/core/lock-locked';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
10
+ import { Box } from '@atlaskit/primitives/compiled';
11
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
12
  import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
8
13
  import { messages } from '../../../messages';
14
+ import { getCachedProviderPctMapAndRefresh } from '../../../state/services/personalization';
9
15
  import { HoverCard } from '../../HoverCard';
10
16
  import { ActionButton } from '../common/action-button';
11
17
  import { Frame } from '../Frame';
@@ -16,22 +22,105 @@ var fallbackUnauthorizedIcon = function fallbackUnauthorizedIcon() {
16
22
  label: "error"
17
23
  });
18
24
  };
19
- export var InlineCardUnauthorizedView = function InlineCardUnauthorizedView(_ref) {
20
- var url = _ref.url,
21
- id = _ref.id,
22
- icon = _ref.icon,
23
- onAuthorise = _ref.onAuthorise,
24
- onClick = _ref.onClick,
25
- isSelected = _ref.isSelected,
26
- _ref$testId = _ref.testId,
27
- testId = _ref$testId === void 0 ? 'inline-card-unauthorized-view' : _ref$testId,
28
- _ref$showHoverPreview = _ref.showHoverPreview,
29
- showHoverPreview = _ref$showHoverPreview === void 0 ? false : _ref$showHoverPreview,
30
- truncateInline = _ref.truncateInline,
31
- context = _ref.context;
25
+
26
+ /**
27
+ * When persisted personalization adoption from {@link getCachedProviderPctMapAndRefresh} is strictly below this value,
28
+ * the pill uses exploratory "previewing" copy instead of a percentage headline.
29
+ */
30
+ var SOCIAL_PROOF_TEAM_PREVIEW_THRESHOLD = 30;
31
+ var SOCIAL_PROOF_TRAIT_NAME = 'sl_3p_connected_providers_site_pct';
32
+ var socialProofPillStyles = {
33
+ strong: "_k48pwu06",
34
+ inlineContainer: "_1e0c116y _4cvr1h6o",
35
+ root: "_2rko12b0 _1e0c1nu9 _4cvr1h6o _vchhusvi _p12f1osq _bfhk1dpa _syazazsu _y3gn18uv _1wybtjj4 _s7n4t94y _ca0qv77o _n3tdv77o _u5f312x7 _19bv12x7 _2hwx1b66",
36
+ label: "_1reo15vq _18m915vq _1bto1l2s _o5721q9c"
37
+ };
38
+
39
+ /**
40
+ * Renders the social-proof pill and Connect button using persisted percentages only ({@link getCachedProviderPctMapAndRefresh}) — no
41
+ * loading skeleton; either the cached percentage is shown or the legacy long connect label is used.
42
+ *
43
+ * Only mounted when the parent has passed the killswitch and
44
+ * `platform_sl_3p_preauth_social_proof_inline_cta`. See platform docs: `rules-of-hooks.md` "Should §1".
45
+ */
46
+ var UnauthorisedConnectWithSocialProof = function UnauthorisedConnectWithSocialProof(_ref) {
47
+ var _context$trim;
48
+ var context = _ref.context,
49
+ extensionKey = _ref.extensionKey,
50
+ testId = _ref.testId,
51
+ onConnectClick = _ref.onConnectClick;
52
+ // TODO We need to decide what should we do with FedRAMP. It will not work there (_edge/tenant_info is not available) but so maybe
53
+ // we can just leave it like that and whole feature won't trigger befcause of that.
54
+ var providerPctMap = getCachedProviderPctMapAndRefresh(SOCIAL_PROOF_TRAIT_NAME);
55
+ var connectedPct = extensionKey && providerPctMap ? providerPctMap[extensionKey] : undefined;
56
+ var isEnabled = true;
57
+ var trimmedProviderDisplayName = (_context$trim = context === null || context === void 0 ? void 0 : context.trim()) !== null && _context$trim !== void 0 ? _context$trim : '';
58
+ var hasProviderDisplayName = trimmedProviderDisplayName.length > 0;
59
+ var isSocialProofUsageHighEnough = connectedPct !== undefined && connectedPct >= SOCIAL_PROOF_TEAM_PREVIEW_THRESHOLD;
60
+
61
+ /**
62
+ * Persisted personalization is required. Below {@link SOCIAL_PROOF_TEAM_PREVIEW_THRESHOLD} adoption we also require
63
+ * a provider display name; otherwise omit the pill and use the legacy long connect treatment.
64
+ */
65
+ var showSocialProofPill = isEnabled && connectedPct !== undefined && (isSocialProofUsageHighEnough || hasProviderDisplayName);
66
+ var bold = function bold(chunks) {
67
+ return /*#__PURE__*/React.createElement(Box, {
68
+ as: "strong",
69
+ xcss: socialProofPillStyles.strong
70
+ }, chunks);
71
+ };
72
+ var socialProofPillContent = isSocialProofUsageHighEnough ? hasProviderDisplayName ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.social_proof_inline_cta_tag_high_with_context, {
73
+ values: {
74
+ connectedPct: connectedPct,
75
+ context: trimmedProviderDisplayName,
76
+ b: bold
77
+ }
78
+ })) : /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.social_proof_inline_cta_tag_high_no_context, {
79
+ values: {
80
+ connectedPct: connectedPct,
81
+ b: bold
82
+ }
83
+ })) : /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.social_proof_inline_cta_tag_low_with_context, {
84
+ values: {
85
+ context: trimmedProviderDisplayName
86
+ }
87
+ }));
88
+ return /*#__PURE__*/React.createElement(React.Fragment, null, showSocialProofPill ? /*#__PURE__*/React.createElement(Box, {
89
+ as: "span",
90
+ xcss: socialProofPillStyles.root,
91
+ testId: "".concat(testId, "-social-proof-tag")
92
+ }, /*#__PURE__*/React.createElement(Box, {
93
+ as: "span",
94
+ xcss: socialProofPillStyles.label
95
+ }, socialProofPillContent)) : null, /*#__PURE__*/React.createElement(ActionButton, {
96
+ onClick: onConnectClick,
97
+ viewType: "unauthorised",
98
+ testId: "button-connect-account",
99
+ isSocialProofInlineUnauthorisedConnect: showSocialProofPill
100
+ }, showSocialProofPill ? /*#__PURE__*/React.createElement(FormattedMessage, messages.connect_inline_social_proof) : /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_link_account_card_name, {
101
+ values: {
102
+ context: context
103
+ }
104
+ }))));
105
+ };
106
+ export var InlineCardUnauthorizedView = function InlineCardUnauthorizedView(_ref2) {
107
+ var url = _ref2.url,
108
+ id = _ref2.id,
109
+ icon = _ref2.icon,
110
+ onAuthorise = _ref2.onAuthorise,
111
+ onClick = _ref2.onClick,
112
+ isSelected = _ref2.isSelected,
113
+ _ref2$testId = _ref2.testId,
114
+ testId = _ref2$testId === void 0 ? 'inline-card-unauthorized-view' : _ref2$testId,
115
+ _ref2$showHoverPrevie = _ref2.showHoverPreview,
116
+ showHoverPreview = _ref2$showHoverPrevie === void 0 ? false : _ref2$showHoverPrevie,
117
+ truncateInline = _ref2.truncateInline,
118
+ context = _ref2.context,
119
+ extensionKey = _ref2.extensionKey;
32
120
  var frameRef = React.useRef(null);
33
121
  var _useAnalyticsEvents = useAnalyticsEvents(),
34
122
  fireEvent = _useAnalyticsEvents.fireEvent;
123
+ var isSocialProofInlineCtaEnabled = onAuthorise && fg('platform_sl_3p_preauth_soc_proof_inline_killswitch') && expValEquals('platform_sl_3p_preauth_social_proof_inline_cta', 'isEnabled', true);
35
124
  var handleConnectAccount = React.useCallback(function (event) {
36
125
  event.preventDefault();
37
126
  event.stopPropagation();
@@ -63,7 +152,12 @@ export var InlineCardUnauthorizedView = function InlineCardUnauthorizedView(_ref
63
152
  link: url,
64
153
  onClick: onClick,
65
154
  titleColor: "var(--ds-text-subtle, #505258)"
66
- }), onAuthorise && renderActionButton());
155
+ }), onAuthorise && (isSocialProofInlineCtaEnabled ? /*#__PURE__*/React.createElement(UnauthorisedConnectWithSocialProof, {
156
+ context: context,
157
+ extensionKey: extensionKey,
158
+ testId: testId,
159
+ onConnectClick: handleConnectAccount
160
+ }) : renderActionButton()));
67
161
  if (onAuthorise && showHoverPreview) {
68
162
  return /*#__PURE__*/React.createElement(HoverCard, {
69
163
  url: url,
@@ -1,17 +1,16 @@
1
1
 
2
- ._1s7zia51{border-right:var(--ds-border-width,1px) solid var(--ds-border,#0b120e24)}
3
- ._n7zlia51{border-bottom:var(--ds-border-width,1px) solid var(--ds-border,#0b120e24)}
4
- ._x3doia51{border-top:var(--ds-border-width,1px) solid var(--ds-border,#0b120e24)}._13liidpf{border-top-left-radius:0}
5
- ._13lilb4i{border-top-left-radius:var(--ds-radius-xsmall,2px)}
2
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}._13lilb4i{border-top-left-radius:var(--ds-radius-xsmall,2px)}
6
3
  ._16d9qvcn{-webkit-box-decoration-break:clone;box-decoration-break:clone}
7
4
  ._19bv12x7{padding-left:var(--ds-space-075,6px)}
8
5
  ._1e0c1bgi{display:contents}
9
6
  ._1e0c1nu9{display:inline}
10
7
  ._1nmz9jpi{word-break:break-all}
11
8
  ._1o0zlb4i{border-bottom-right-radius:var(--ds-radius-xsmall,2px)}
9
+ ._1wybtjj4{font-size:.8em}
12
10
  ._1y1m1u8q{background-clip:padding-box}
13
11
  ._2hwxt94y{margin-right:1px}
14
12
  ._2hwxv77o{margin-right:var(--ds-space-025,2px)}
13
+ ._4cvr1h6o{align-items:center}
15
14
  ._80om13gf{cursor:not-allowed}
16
15
  ._80omtlke{cursor:pointer}
17
16
  ._bfhkby5v{background-color:var(--ds-background-disabled,#17171708)}
@@ -21,19 +20,17 @@
21
20
  ._ca0qv77o{padding-top:var(--ds-space-025,2px)}
22
21
  ._k48p1wq8{font-weight:var(--ds-font-weight-medium,500)}
23
22
  ._k48pi7a9{font-weight:var(--ds-font-weight-regular,400)}
24
- ._mrkbidpf{border-bottom-left-radius:0}
25
23
  ._mrkblb4i{border-bottom-left-radius:var(--ds-radius-xsmall,2px)}
26
24
  ._n3tdt94y{padding-bottom:1px}
27
25
  ._n3tdv77o{padding-bottom:var(--ds-space-025,2px)}
28
26
  ._o5721btx{white-space:break-spaces}
29
- ._o5721q9c{white-space:nowrap}
30
27
  ._qrwqlb4i{border-top-right-radius:var(--ds-radius-xsmall,2px)}
28
+ ._s7n4t94y{vertical-align:1px}
31
29
  ._syaz15cr{color:var(--ds-text-inverse,#fff)}
32
30
  ._syaz1gmx{color:var(--ds-text-disabled,#080f214a)}
33
31
  ._syazi7uo{color:var(--ds-text,#292a2e)}
34
32
  ._u5f312x7{padding-right:var(--ds-space-075,6px)}
35
33
  ._y3gn18uv{text-align:initial}
36
- ._4cvxq98m:hover{border-color:var(--ds-border-selected,#1868db)}
37
34
  ._irr31q28:hover{background-color:var(--ds-background-selected-bold-hovered,#1558bc)}
38
35
  ._irr3plhp:hover{background-color:var(--ds-background-neutral-hovered,#0b120e24)}
39
36
  ._1di612kk:active{background-color:var(--ds-background-selected-bold-pressed,#123263)}
@@ -1,20 +1,24 @@
1
1
  /* index.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["children", "isDisabled", "viewType"];
4
+ var _excluded = ["children", "isDisabled", "viewType", "isSocialProofInlineUnauthorisedConnect"];
5
5
  import "./index.compiled.css";
6
6
  import * as React from 'react';
7
7
  import { ax, ix } from "@compiled/react/runtime";
8
8
  import { forwardRef } from 'react';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { Pressable } from '@atlaskit/primitives/compiled';
10
11
  var styles = {
11
12
  button: "_1e0c1bgi",
12
13
  innerContainer: "_1e0c1nu9 _1y1m1u8q _16d9qvcn _k48p1wq8 _19bv12x7 _ca0qv77o _n3tdv77o _u5f312x7 _y3gn18uv _o5721btx _1nmz9jpi",
14
+ innerContainerSocialProofConnect: "_2rko12b0 _syaz15cr _80omtlke _bfhkjmqp _2hwxv77o _1e0c1nu9 _4cvr1h6o _1wybtjj4 _1y1m1u8q _16d9qvcn _19bv12x7 _ca0qv77o _n3tdv77o _u5f312x7 _y3gn18uv _s7n4t94y _o5721btx _1nmz9jpi _irr31q28 _1di612kk",
13
15
  enabled: "_syazi7uo _80omtlke _bfhki8nm _irr3plhp _1di61gdz",
14
16
  disabled: "_syaz1gmx _80om13gf _bfhkby5v",
15
- unauthorised: "_syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _13lilb4i _mrkblb4i _ca0qt94y _n3tdt94y _2hwxt94y _k48pi7a9 _irr31q28 _1di612kk",
16
- action: "_x3doia51 _1s7zia51 _n7zlia51 _syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _13liidpf _mrkbidpf _2hwxv77o _k48pi7a9 _o5721q9c _4cvxq98m _irr31q28 _1di612kk"
17
+ unauthorised: "_syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _13lilb4i _mrkblb4i _ca0qt94y _n3tdt94y _2hwxt94y _k48pi7a9 _irr31q28 _1di612kk"
17
18
  };
19
+
20
+ /* eslint-enable @compiled/shorthand-property-sorting */
21
+
18
22
  /**
19
23
  * Action button has to be a span for the overflow to work correctly
20
24
  */
@@ -23,7 +27,21 @@ export var ActionButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
23
27
  isDisabled = _ref.isDisabled,
24
28
  _ref$viewType = _ref.viewType,
25
29
  viewType = _ref$viewType === void 0 ? 'default' : _ref$viewType,
30
+ _ref$isSocialProofInl = _ref.isSocialProofInlineUnauthorisedConnect,
31
+ isSocialProofInlineUnauthorisedConnect = _ref$isSocialProofInl === void 0 ? false : _ref$isSocialProofInl,
26
32
  props = _objectWithoutProperties(_ref, _excluded);
33
+ var shouldUseSocialProofConnect = isSocialProofInlineUnauthorisedConnect && viewType === 'unauthorised' && fg('platform_sl_3p_preauth_soc_proof_inline_killswitch');
34
+ if (shouldUseSocialProofConnect && !isDisabled) {
35
+ return /*#__PURE__*/React.createElement(Pressable, _extends({}, props, {
36
+ ref: ref,
37
+ style: {
38
+ font: "inherit"
39
+ },
40
+ xcss: styles.button
41
+ }), /*#__PURE__*/React.createElement("span", {
42
+ className: ax([styles.innerContainerSocialProofConnect])
43
+ }, children));
44
+ }
27
45
  return /*#__PURE__*/React.createElement(Pressable, _extends({}, props, {
28
46
  isDisabled: isDisabled,
29
47
  ref: ref
@@ -15,7 +15,7 @@ import LinkWarningModal from './LinkWarningModal';
15
15
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
16
16
  var PACKAGE_DATA = {
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "44.5.3",
18
+ packageVersion: "44.6.0",
19
19
  componentName: 'linkUrl'
20
20
  };
21
21
  var Anchor = withLinkClickedEvent('a');