@atlaskit/smart-card 44.20.3 → 44.21.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 44.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b7eed2769e9dc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b7eed2769e9dc) -
8
+ [ux] Suppress the existing post-auth connect flag when the GDrive Smart Link post-auth Rovo Chat
9
+ experiment treatment opens Rovo Chat.
10
+
3
11
  ## 44.20.3
4
12
 
5
13
  ### Patch Changes
@@ -27,7 +27,26 @@ var _useInvokeClientAction = _interopRequireDefault(require("../hooks/use-invoke
27
27
  var _useResolve = _interopRequireDefault(require("../hooks/use-resolve"));
28
28
  var POST_AUTH_CHAT_EXTENSION_KEY = 'google-object-provider';
29
29
  var SMART_LINK_TO_ROVO_SOURCE = 'smart-link';
30
+ var getPostAuthChatPayloadId = function getPostAuthChatPayloadId() {
31
+ if (typeof crypto !== 'undefined') {
32
+ if (typeof crypto.randomUUID === 'function') {
33
+ return crypto.randomUUID();
34
+ }
35
+ if (typeof crypto.getRandomValues === 'function') {
36
+ var values = new Uint32Array(4);
37
+ crypto.getRandomValues(values);
38
+ return "smart-link-post-auth-chat-".concat(Array.from(values, function (value) {
39
+ return value.toString(16);
40
+ }).join('-'));
41
+ }
42
+ }
43
+ return "smart-link-post-auth-chat-".concat(Date.now());
44
+ };
30
45
  var sendPostAuthChatOpenMessage = function sendPostAuthChatOpenMessage(url) {
46
+ var _window$parent;
47
+ if (typeof window === 'undefined' || typeof ((_window$parent = window.parent) === null || _window$parent === void 0 ? void 0 : _window$parent.postMessage) !== 'function') {
48
+ return;
49
+ }
31
50
  var payload = {
32
51
  type: 'chat-new',
33
52
  source: SMART_LINK_TO_ROVO_SOURCE,
@@ -52,7 +71,7 @@ var sendPostAuthChatOpenMessage = function sendPostAuthChatOpenMessage(url) {
52
71
  window.parent.postMessage({
53
72
  eventType: _postMessageToPubsub.ROVO_POST_MESSAGE_EVENT_TYPE,
54
73
  payload: payload,
55
- payloadId: crypto.randomUUID()
74
+ payloadId: getPostAuthChatPayloadId()
56
75
  }, '*');
57
76
  };
58
77
  var useSmartCardActions = exports.useSmartCardActions = function useSmartCardActions(id, url) {
@@ -174,28 +193,29 @@ var useSmartCardActions = exports.useSmartCardActions = function useSmartCardAct
174
193
  fireEvent('operational.smartLink.connectSucceeded', {
175
194
  definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
176
195
  });
177
- if (status === 'unauthorized' && (0, _platformFeatureFlags.fg)('platform_sl_connect_account_flag')) {
178
- var provider = (0, _linkExtractors.extractSmartLinkProvider)(details);
179
- flags === null || flags === void 0 || flags.showConnectFlag({
180
- id: "smart-link-connect-success-".concat(extensionKey),
181
- provider: provider
182
- });
183
- }
184
- reload();
185
196
 
186
197
  // Post-auth Chat onboarding: auto-open Rovo Chat mini-modal with the
187
198
  // authed 3P link as context, for supported providers (e.g. Google Drive).
188
199
  // Provider eligibility is derived from the pre-auth SmartLink state.
189
200
  var isEligibleForPostAuthChat = status === 'unauthorized' && isSupportedPostAuthChatExtensionKey && (0, _platformFeatureFlags.fg)('platform_sl_3p_post_auth_chat_open_fg') && (0, _rovo.getIsRovoChatEnabled)(rovoOptionsRef.current);
190
- if (isEligibleForPostAuthChat) {
191
- // Experiment check: fires exposure for both control and treatment.
192
- // Only reached after eligibility preconditions + kill switch pass, so
193
- // exposure is counted for the triggered eligible pool.
194
- var isEnabled = (0, _expValEquals.expValEquals)('platform_sl_3p_post_auth_chat_open_exp', 'isEnabled', true);
195
- if (isEnabled) {
196
- sendPostAuthChatOpenMessage(url);
201
+
202
+ // Experiment check: fires exposure for both control and treatment.
203
+ // Only reached after eligibility preconditions + kill switch pass, so
204
+ // exposure is counted for the triggered eligible pool.
205
+ var isPostAuthChatTreatment = isEligibleForPostAuthChat && (0, _expValEquals.expValEquals)('platform_sl_3p_post_auth_chat_open_exp', 'isEnabled', true);
206
+ if (status === 'unauthorized' && !isPostAuthChatTreatment) {
207
+ if ((0, _platformFeatureFlags.fg)('platform_sl_connect_account_flag')) {
208
+ var provider = (0, _linkExtractors.extractSmartLinkProvider)(details);
209
+ flags === null || flags === void 0 || flags.showConnectFlag({
210
+ id: "smart-link-connect-success-".concat(extensionKey),
211
+ provider: provider
212
+ });
197
213
  }
198
214
  }
215
+ reload();
216
+ if (isPostAuthChatTreatment) {
217
+ sendPostAuthChatOpenMessage(url);
218
+ }
199
219
  }, function (err) {
200
220
  var _err$type;
201
221
  (0, _analytics.startUfoExperience)('smart-link-authenticated', id, {
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
11
11
  var context = exports.context = {
12
12
  componentName: 'smart-cards',
13
13
  packageName: "@atlaskit/smart-card" || '',
14
- packageVersion: "44.20.2" || ''
14
+ packageVersion: "44.20.3" || ''
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -19,7 +19,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
19
19
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
20
20
  var PACKAGE_DATA = {
21
21
  packageName: "@atlaskit/smart-card",
22
- packageVersion: "44.20.2",
22
+ packageVersion: "44.20.3",
23
23
  componentName: 'linkUrl'
24
24
  };
25
25
  var LinkUrl = function LinkUrl(_ref) {
@@ -18,7 +18,24 @@ import useInvokeClientAction from '../hooks/use-invoke-client-action';
18
18
  import useResolve from '../hooks/use-resolve';
19
19
  const POST_AUTH_CHAT_EXTENSION_KEY = 'google-object-provider';
20
20
  const SMART_LINK_TO_ROVO_SOURCE = 'smart-link';
21
+ const getPostAuthChatPayloadId = () => {
22
+ if (typeof crypto !== 'undefined') {
23
+ if (typeof crypto.randomUUID === 'function') {
24
+ return crypto.randomUUID();
25
+ }
26
+ if (typeof crypto.getRandomValues === 'function') {
27
+ const values = new Uint32Array(4);
28
+ crypto.getRandomValues(values);
29
+ return `smart-link-post-auth-chat-${Array.from(values, value => value.toString(16)).join('-')}`;
30
+ }
31
+ }
32
+ return `smart-link-post-auth-chat-${Date.now()}`;
33
+ };
21
34
  const sendPostAuthChatOpenMessage = url => {
35
+ var _window$parent;
36
+ if (typeof window === 'undefined' || typeof ((_window$parent = window.parent) === null || _window$parent === void 0 ? void 0 : _window$parent.postMessage) !== 'function') {
37
+ return;
38
+ }
22
39
  const payload = {
23
40
  type: 'chat-new',
24
41
  source: SMART_LINK_TO_ROVO_SOURCE,
@@ -43,7 +60,7 @@ const sendPostAuthChatOpenMessage = url => {
43
60
  window.parent.postMessage({
44
61
  eventType: ROVO_POST_MESSAGE_EVENT_TYPE,
45
62
  payload,
46
- payloadId: crypto.randomUUID()
63
+ payloadId: getPostAuthChatPayloadId()
47
64
  }, '*');
48
65
  };
49
66
  export const useSmartCardActions = (id, url) => {
@@ -155,28 +172,29 @@ export const useSmartCardActions = (id, url) => {
155
172
  fireEvent('operational.smartLink.connectSucceeded', {
156
173
  definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
157
174
  });
158
- if (status === 'unauthorized' && fg('platform_sl_connect_account_flag')) {
159
- const provider = extractSmartLinkProvider(details);
160
- flags === null || flags === void 0 ? void 0 : flags.showConnectFlag({
161
- id: `smart-link-connect-success-${extensionKey}`,
162
- provider
163
- });
164
- }
165
- reload();
166
175
 
167
176
  // Post-auth Chat onboarding: auto-open Rovo Chat mini-modal with the
168
177
  // authed 3P link as context, for supported providers (e.g. Google Drive).
169
178
  // Provider eligibility is derived from the pre-auth SmartLink state.
170
179
  const isEligibleForPostAuthChat = status === 'unauthorized' && isSupportedPostAuthChatExtensionKey && fg('platform_sl_3p_post_auth_chat_open_fg') && getIsRovoChatEnabled(rovoOptionsRef.current);
171
- if (isEligibleForPostAuthChat) {
172
- // Experiment check: fires exposure for both control and treatment.
173
- // Only reached after eligibility preconditions + kill switch pass, so
174
- // exposure is counted for the triggered eligible pool.
175
- const isEnabled = expValEquals('platform_sl_3p_post_auth_chat_open_exp', 'isEnabled', true);
176
- if (isEnabled) {
177
- sendPostAuthChatOpenMessage(url);
180
+
181
+ // Experiment check: fires exposure for both control and treatment.
182
+ // Only reached after eligibility preconditions + kill switch pass, so
183
+ // exposure is counted for the triggered eligible pool.
184
+ const isPostAuthChatTreatment = isEligibleForPostAuthChat && expValEquals('platform_sl_3p_post_auth_chat_open_exp', 'isEnabled', true);
185
+ if (status === 'unauthorized' && !isPostAuthChatTreatment) {
186
+ if (fg('platform_sl_connect_account_flag')) {
187
+ const provider = extractSmartLinkProvider(details);
188
+ flags === null || flags === void 0 ? void 0 : flags.showConnectFlag({
189
+ id: `smart-link-connect-success-${extensionKey}`,
190
+ provider
191
+ });
178
192
  }
179
193
  }
194
+ reload();
195
+ if (isPostAuthChatTreatment) {
196
+ sendPostAuthChatOpenMessage(url);
197
+ }
180
198
  }, err => {
181
199
  var _err$type;
182
200
  startUfoExperience('smart-link-authenticated', id, {
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
2
2
  export const context = {
3
3
  componentName: 'smart-cards',
4
4
  packageName: "@atlaskit/smart-card" || '',
5
- packageVersion: "44.20.2" || ''
5
+ packageVersion: "44.20.3" || ''
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -9,7 +9,7 @@ import LinkWarningModal from './LinkWarningModal';
9
9
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
10
10
  const PACKAGE_DATA = {
11
11
  packageName: "@atlaskit/smart-card",
12
- packageVersion: "44.20.2",
12
+ packageVersion: "44.20.3",
13
13
  componentName: 'linkUrl'
14
14
  };
15
15
  const LinkUrl = ({
@@ -20,7 +20,26 @@ import useInvokeClientAction from '../hooks/use-invoke-client-action';
20
20
  import useResolve from '../hooks/use-resolve';
21
21
  var POST_AUTH_CHAT_EXTENSION_KEY = 'google-object-provider';
22
22
  var SMART_LINK_TO_ROVO_SOURCE = 'smart-link';
23
+ var getPostAuthChatPayloadId = function getPostAuthChatPayloadId() {
24
+ if (typeof crypto !== 'undefined') {
25
+ if (typeof crypto.randomUUID === 'function') {
26
+ return crypto.randomUUID();
27
+ }
28
+ if (typeof crypto.getRandomValues === 'function') {
29
+ var values = new Uint32Array(4);
30
+ crypto.getRandomValues(values);
31
+ return "smart-link-post-auth-chat-".concat(Array.from(values, function (value) {
32
+ return value.toString(16);
33
+ }).join('-'));
34
+ }
35
+ }
36
+ return "smart-link-post-auth-chat-".concat(Date.now());
37
+ };
23
38
  var sendPostAuthChatOpenMessage = function sendPostAuthChatOpenMessage(url) {
39
+ var _window$parent;
40
+ if (typeof window === 'undefined' || typeof ((_window$parent = window.parent) === null || _window$parent === void 0 ? void 0 : _window$parent.postMessage) !== 'function') {
41
+ return;
42
+ }
24
43
  var payload = {
25
44
  type: 'chat-new',
26
45
  source: SMART_LINK_TO_ROVO_SOURCE,
@@ -45,7 +64,7 @@ var sendPostAuthChatOpenMessage = function sendPostAuthChatOpenMessage(url) {
45
64
  window.parent.postMessage({
46
65
  eventType: ROVO_POST_MESSAGE_EVENT_TYPE,
47
66
  payload: payload,
48
- payloadId: crypto.randomUUID()
67
+ payloadId: getPostAuthChatPayloadId()
49
68
  }, '*');
50
69
  };
51
70
  export var useSmartCardActions = function useSmartCardActions(id, url) {
@@ -167,28 +186,29 @@ export var useSmartCardActions = function useSmartCardActions(id, url) {
167
186
  fireEvent('operational.smartLink.connectSucceeded', {
168
187
  definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
169
188
  });
170
- if (status === 'unauthorized' && fg('platform_sl_connect_account_flag')) {
171
- var provider = extractSmartLinkProvider(details);
172
- flags === null || flags === void 0 || flags.showConnectFlag({
173
- id: "smart-link-connect-success-".concat(extensionKey),
174
- provider: provider
175
- });
176
- }
177
- reload();
178
189
 
179
190
  // Post-auth Chat onboarding: auto-open Rovo Chat mini-modal with the
180
191
  // authed 3P link as context, for supported providers (e.g. Google Drive).
181
192
  // Provider eligibility is derived from the pre-auth SmartLink state.
182
193
  var isEligibleForPostAuthChat = status === 'unauthorized' && isSupportedPostAuthChatExtensionKey && fg('platform_sl_3p_post_auth_chat_open_fg') && getIsRovoChatEnabled(rovoOptionsRef.current);
183
- if (isEligibleForPostAuthChat) {
184
- // Experiment check: fires exposure for both control and treatment.
185
- // Only reached after eligibility preconditions + kill switch pass, so
186
- // exposure is counted for the triggered eligible pool.
187
- var isEnabled = expValEquals('platform_sl_3p_post_auth_chat_open_exp', 'isEnabled', true);
188
- if (isEnabled) {
189
- sendPostAuthChatOpenMessage(url);
194
+
195
+ // Experiment check: fires exposure for both control and treatment.
196
+ // Only reached after eligibility preconditions + kill switch pass, so
197
+ // exposure is counted for the triggered eligible pool.
198
+ var isPostAuthChatTreatment = isEligibleForPostAuthChat && expValEquals('platform_sl_3p_post_auth_chat_open_exp', 'isEnabled', true);
199
+ if (status === 'unauthorized' && !isPostAuthChatTreatment) {
200
+ if (fg('platform_sl_connect_account_flag')) {
201
+ var provider = extractSmartLinkProvider(details);
202
+ flags === null || flags === void 0 || flags.showConnectFlag({
203
+ id: "smart-link-connect-success-".concat(extensionKey),
204
+ provider: provider
205
+ });
190
206
  }
191
207
  }
208
+ reload();
209
+ if (isPostAuthChatTreatment) {
210
+ sendPostAuthChatOpenMessage(url);
211
+ }
192
212
  }, function (err) {
193
213
  var _err$type;
194
214
  startUfoExperience('smart-link-authenticated', id, {
@@ -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.20.2" || ''
7
+ packageVersion: "44.20.3" || ''
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -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: "44.20.2",
15
+ packageVersion: "44.20.3",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  var LinkUrl = function LinkUrl(_ref) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "44.20.3",
3
+ "version": "44.21.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"