@atlaskit/smart-card 44.23.3 → 44.24.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 (51) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/extractors/action/extract-invoke-view-action.js +11 -1
  3. package/dist/cjs/extractors/flexible/actions/index.js +5 -2
  4. package/dist/cjs/extractors/flexible/extract-state.js +8 -5
  5. package/dist/cjs/extractors/flexible/index.js +6 -3
  6. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +17 -2
  7. package/dist/cjs/utils/analytics/analytics.js +1 -1
  8. package/dist/cjs/view/CardWithUrl/component.js +4 -3
  9. package/dist/cjs/view/FlexibleCard/index.js +12 -2
  10. package/dist/cjs/view/LinkUrl/index.js +1 -1
  11. package/dist/es2019/extractors/action/extract-invoke-view-action.js +10 -1
  12. package/dist/es2019/extractors/flexible/actions/index.js +5 -1
  13. package/dist/es2019/extractors/flexible/extract-state.js +8 -4
  14. package/dist/es2019/extractors/flexible/index.js +6 -2
  15. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +13 -2
  16. package/dist/es2019/utils/analytics/analytics.js +1 -1
  17. package/dist/es2019/view/CardWithUrl/component.js +4 -3
  18. package/dist/es2019/view/FlexibleCard/index.js +10 -3
  19. package/dist/es2019/view/LinkUrl/index.js +1 -1
  20. package/dist/esm/extractors/action/extract-invoke-view-action.js +11 -1
  21. package/dist/esm/extractors/flexible/actions/index.js +5 -2
  22. package/dist/esm/extractors/flexible/extract-state.js +8 -5
  23. package/dist/esm/extractors/flexible/index.js +6 -3
  24. package/dist/esm/state/hooks-external/useSmartLinkActions.js +17 -2
  25. package/dist/esm/utils/analytics/analytics.js +1 -1
  26. package/dist/esm/view/CardWithUrl/component.js +4 -3
  27. package/dist/esm/view/FlexibleCard/index.js +13 -3
  28. package/dist/esm/view/LinkUrl/index.js +1 -1
  29. package/dist/types/entry-points/card-types.d.ts +1 -1
  30. package/dist/types/extractors/action/extract-invoke-preview-action.d.ts +2 -1
  31. package/dist/types/extractors/action/extract-invoke-view-action.d.ts +5 -2
  32. package/dist/types/extractors/action/types.d.ts +1 -0
  33. package/dist/types/extractors/flexible/actions/index.d.ts +3 -1
  34. package/dist/types/extractors/flexible/extract-state.d.ts +2 -1
  35. package/dist/types/extractors/flexible/index.d.ts +1 -1
  36. package/dist/types/view/Card/types.d.ts +79 -25
  37. package/dist/types/view/CardWithUrl/types.d.ts +2 -3
  38. package/dist/types/view/FlexibleCard/types.d.ts +2 -0
  39. package/dist/types/view/types.d.ts +12 -0
  40. package/dist/types-ts4.5/entry-points/card-types.d.ts +1 -1
  41. package/dist/types-ts4.5/extractors/action/extract-invoke-preview-action.d.ts +2 -1
  42. package/dist/types-ts4.5/extractors/action/extract-invoke-view-action.d.ts +5 -2
  43. package/dist/types-ts4.5/extractors/action/types.d.ts +1 -0
  44. package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +3 -1
  45. package/dist/types-ts4.5/extractors/flexible/extract-state.d.ts +2 -1
  46. package/dist/types-ts4.5/extractors/flexible/index.d.ts +1 -1
  47. package/dist/types-ts4.5/view/Card/types.d.ts +79 -25
  48. package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +2 -3
  49. package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +2 -0
  50. package/dist/types-ts4.5/view/types.d.ts +12 -0
  51. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 44.24.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b108dbe3ff3fa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b108dbe3ff3fa) -
8
+ Return destination url from smart link onClick callback.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 44.23.4
15
+
16
+ ### Patch Changes
17
+
18
+ - [`36b77f485aef1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/36b77f485aef1) -
19
+ Append url with cross-product analytics params on go to link via embed modal and action hook
20
+ - Updated dependencies
21
+
3
22
  ## 44.23.3
4
23
 
5
24
  ### Patch Changes
@@ -8,6 +8,7 @@ exports.extractInvokeViewAction = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _linkExtractors = require("@atlaskit/link-extractors");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _constants = require("../../constants");
12
13
  var _helpers = require("../../state/helpers");
13
14
  var _utils = require("../../utils");
@@ -16,6 +17,7 @@ var _extractActions = require("../common/actions/extractActions");
16
17
  var extractInvokeViewAction = exports.extractInvokeViewAction = function extractInvokeViewAction(_ref, force) {
17
18
  var actionOptions = _ref.actionOptions,
18
19
  appearance = _ref.appearance,
20
+ transformUrl = _ref.transformUrl,
19
21
  id = _ref.id,
20
22
  response = _ref.response;
21
23
  if (!(0, _canShowAction.canShowAction)(_constants.CardAction.ViewAction, actionOptions)) {
@@ -33,11 +35,19 @@ var extractInvokeViewAction = exports.extractInvokeViewAction = function extract
33
35
  return {
34
36
  actionFn: function () {
35
37
  var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
38
+ var _transformUrl, destinationUrl;
36
39
  return _regenerator.default.wrap(function (_context) {
37
40
  while (1) switch (_context.prev = _context.next) {
38
41
  case 0:
39
- return _context.abrupt("return", (0, _utils.openUrl)(url));
42
+ if (!(0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping')) {
43
+ _context.next = 1;
44
+ break;
45
+ }
46
+ destinationUrl = (_transformUrl = transformUrl === null || transformUrl === void 0 ? void 0 : transformUrl(url)) !== null && _transformUrl !== void 0 ? _transformUrl : url;
47
+ return _context.abrupt("return", (0, _utils.openUrl)(destinationUrl));
40
48
  case 1:
49
+ return _context.abrupt("return", (0, _utils.openUrl)(url));
50
+ case 2:
41
51
  case "end":
42
52
  return _context.stop();
43
53
  }
@@ -28,6 +28,7 @@ var extractFlexibleCardActions = exports.extractFlexibleCardActions = function e
28
28
  product = _ref.product,
29
29
  response = _ref.response,
30
30
  rovoConfig = _ref.rovoConfig,
31
+ transformUrl = _ref.transformUrl,
31
32
  url = _ref.url,
32
33
  isPreviewPanelAvailable = _ref.isPreviewPanelAvailable,
33
34
  openPreviewPanel = _ref.openPreviewPanel;
@@ -41,7 +42,7 @@ var extractFlexibleCardActions = exports.extractFlexibleCardActions = function e
41
42
  appearance: appearance,
42
43
  id: id,
43
44
  response: response
44
- })), _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewClientAction)({
45
+ })), _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewClientAction)(_objectSpread({
45
46
  actionOptions: actionOptions,
46
47
  appearance: appearance,
47
48
  fireEvent: fireEvent,
@@ -50,7 +51,9 @@ var extractFlexibleCardActions = exports.extractFlexibleCardActions = function e
50
51
  response: response,
51
52
  isPreviewPanelAvailable: isPreviewPanelAvailable,
52
53
  openPreviewPanel: openPreviewPanel
53
- })), _constants.ActionName.AutomationAction, (0, _extractAutomationAction.extractAutomationAction)(response)), _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch') ? (0, _defineProperty2.default)({}, _constants.ActionName.RovoChatAction, (0, _extractRovoChatAction.default)({
54
+ }, (0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping') ? {
55
+ transformUrl: transformUrl
56
+ } : undefined))), _constants.ActionName.AutomationAction, (0, _extractAutomationAction.extractAutomationAction)(response)), _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch') ? (0, _defineProperty2.default)({}, _constants.ActionName.RovoChatAction, (0, _extractRovoChatAction.default)({
54
57
  actionOptions: actionOptions,
55
58
  appearance: appearance,
56
59
  id: id,
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _linkExtractors = require("@atlaskit/link-extractors");
10
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
11
  var _constants = require("../../constants");
11
12
  var _helpers = require("../../state/helpers");
12
13
  var _canShowAction = require("../../utils/actions/can-show-action");
@@ -28,7 +29,7 @@ var toInvokeRequest = function toInvokeRequest(extensionKey, resourceIdentifiers
28
29
  details: details
29
30
  };
30
31
  };
31
- var extractAction = function extractAction(response, id, actionOptions, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel) {
32
+ var extractAction = function extractAction(response, id, actionOptions, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel, transformUrl) {
32
33
  var _action$dataRetrieval, _extractInvokePreview, _action$dataUpdateAct;
33
34
  var extensionKey = (0, _helpers.getExtensionKey)(response);
34
35
  var data = response === null || response === void 0 ? void 0 : response.data;
@@ -44,7 +45,7 @@ var extractAction = function extractAction(response, id, actionOptions, appearan
44
45
  }
45
46
  var read = toInvokeRequest(extensionKey, action.resourceIdentifiers, (_action$dataRetrieval = action.dataRetrievalAction) === null || _action$dataRetrieval === void 0 ? void 0 : _action$dataRetrieval.name);
46
47
  var url = (0, _linkExtractors.extractLink)(data);
47
- var invokePreviewAction = response ? (_extractInvokePreview = (0, _extractInvokePreviewAction.extractInvokePreviewAction)({
48
+ var invokePreviewAction = response ? (_extractInvokePreview = (0, _extractInvokePreviewAction.extractInvokePreviewAction)(_objectSpread({
48
49
  actionOptions: actionOptions,
49
50
  appearance: appearance,
50
51
  fireEvent: fireEvent,
@@ -56,7 +57,9 @@ var extractAction = function extractAction(response, id, actionOptions, appearan
56
57
  response: response,
57
58
  isPreviewPanelAvailable: isPreviewPanelAvailable,
58
59
  openPreviewPanel: openPreviewPanel
59
- })) === null || _extractInvokePreview === void 0 ? void 0 : _extractInvokePreview.invokeAction : undefined;
60
+ }, (0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping') ? {
61
+ transformUrl: transformUrl
62
+ } : undefined))) === null || _extractInvokePreview === void 0 ? void 0 : _extractInvokePreview.invokeAction : undefined;
60
63
  var details = {
61
64
  id: id,
62
65
  url: url,
@@ -68,7 +71,7 @@ var extractAction = function extractAction(response, id, actionOptions, appearan
68
71
  update: update
69
72
  } : undefined;
70
73
  };
71
- var extractState = function extractState(response, actionOptions, id, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel) {
74
+ var extractState = function extractState(response, actionOptions, id, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel, transformUrl) {
72
75
  if (!response || !response.data) {
73
76
  return;
74
77
  }
@@ -79,7 +82,7 @@ var extractState = function extractState(response, actionOptions, id, appearance
79
82
  if (!(0, _canShowAction.canShowAction)(_constants.CardAction.ChangeStatusAction, actionOptions)) {
80
83
  return lozenge;
81
84
  }
82
- var action = extractAction(response, id, actionOptions, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel);
85
+ var action = extractAction(response, id, actionOptions, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel, (0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping') ? transformUrl : undefined);
83
86
  return _objectSpread(_objectSpread({}, lozenge), {}, {
84
87
  action: action
85
88
  });
@@ -20,7 +20,7 @@ var _icon = require("./icon");
20
20
  var _extractProviderIcon = require("./icon/extract-provider-icon");
21
21
  var _latestCommit = require("./latest-commit");
22
22
  var _utils = require("./utils");
23
- var _excluded = ["appearance", "fireEvent", "id", "onClick", "onAuxClick", "onContextMenu", "origin", "product", "resolve", "rovoConfig", "actionOptions", "response", "status", "aiSummaryConfig", "isPreviewPanelAvailable", "openPreviewPanel"];
23
+ var _excluded = ["appearance", "fireEvent", "id", "onClick", "onAuxClick", "onContextMenu", "origin", "product", "resolve", "rovoConfig", "actionOptions", "response", "status", "aiSummaryConfig", "isPreviewPanelAvailable", "openPreviewPanel", "transformUrl"];
24
24
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
25
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
26
  var extractFlexibleUiContext = function extractFlexibleUiContext() {
@@ -41,6 +41,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
41
41
  aiSummaryConfig = _ref.aiSummaryConfig,
42
42
  isPreviewPanelAvailable = _ref.isPreviewPanelAvailable,
43
43
  openPreviewPanel = _ref.openPreviewPanel,
44
+ transformUrl = _ref.transformUrl,
44
45
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
45
46
  if (!response) {
46
47
  return undefined;
@@ -65,7 +66,9 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
65
66
  // Use the original URL in edge cases, such as short links for AI summary and copy link actions.
66
67
  isPreviewPanelAvailable: isPreviewPanelAvailable,
67
68
  openPreviewPanel: openPreviewPanel
68
- })),
69
+ }, (0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping') ? {
70
+ transformUrl: transformUrl
71
+ } : undefined)),
69
72
  appliedToComponentsCount: (0, _utils.extractAppliedToComponentsCount)(data),
70
73
  assignedToGroup: (0, _utils.extractPersonAssignedToAsArray)(data),
71
74
  attachmentCount: (0, _utils.extractAttachmentCount)(data),
@@ -97,7 +100,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
97
100
  snippet: (0, _extractSummary.extractSmartLinkSummary)(response) || undefined,
98
101
  // Explicitly set here to remove an empty string
99
102
  sourceBranch: (0, _utils.extractSourceBranch)(data),
100
- state: (0, _extractState.default)(response, actionOptions, id, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel),
103
+ state: (0, _extractState.default)(response, actionOptions, id, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel, (0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping') ? transformUrl : undefined),
101
104
  subscriberCount: (0, _utils.extractSubscriberCount)(data),
102
105
  subTasksProgress: (0, _utils.extractSubTasksProgress)(data),
103
106
  storyPoints: (0, _utils.extractStoryPoints)(data),
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _react = require("react");
10
10
  var _uuid = _interopRequireDefault(require("uuid"));
11
11
  var _linkProvider = require("@atlaskit/link-provider");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
14
  var _useAnalyticsEvents2 = require("../../common/analytics/generated/use-analytics-events");
14
15
  var _extractInvokeDownloadAction = require("../../extractors/action/extract-invoke-download-action");
@@ -18,6 +19,7 @@ var _messages = require("../../messages");
18
19
  var _toAction = require("../../utils/actions/to-action");
19
20
  var _useInvokeClientAction = _interopRequireDefault(require("../hooks/use-invoke-client-action"));
20
21
  var _useResolve = _interopRequireDefault(require("../hooks/use-resolve"));
22
+ var _useSmartLinkCrossProductUrlWrapper = require("../hooks/use-smart-link-cross-product-url-wrapper");
21
23
  var _store = require("../store");
22
24
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
25
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
@@ -41,6 +43,9 @@ function useSmartLinkActions(_ref) {
41
43
  fireEvent: fireEvent
42
44
  });
43
45
  var resolve = (0, _useResolve.default)();
46
+ var appendCrossProductAnalyticsParams = (0, _useSmartLinkCrossProductUrlWrapper.useSmartLinkCrossProductUrlWrapperGated)({
47
+ details: linkState.details
48
+ });
44
49
  if ((0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test') && prefetch && !linkState.details) {
45
50
  resolve(url);
46
51
  }
@@ -56,7 +61,12 @@ function useSmartLinkActions(_ref) {
56
61
  if (downloadActionProps) {
57
62
  actions.push((0, _toAction.toAction)(downloadActionProps, invokeClientAction, _messages.messages.download, 'download-content'));
58
63
  }
59
- var viewActionProps = (0, _extractInvokeViewAction.extractInvokeViewAction)(invokeParam);
64
+ var viewActionProps = (0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping') ? (0, _extractInvokeViewAction.extractInvokeViewAction)(_objectSpread(_objectSpread({}, invokeParam), {}, {
65
+ transformUrl: function transformUrl() {
66
+ var destinationUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : url;
67
+ return appendCrossProductAnalyticsParams(destinationUrl);
68
+ }
69
+ })) : (0, _extractInvokeViewAction.extractInvokeViewAction)(invokeParam);
60
70
  if (viewActionProps) {
61
71
  actions.push((0, _toAction.toAction)(viewActionProps, invokeClientAction, _messages.messages.view, 'view-content'));
62
72
  }
@@ -65,7 +75,12 @@ function useSmartLinkActions(_ref) {
65
75
  origin: origin,
66
76
  isPreviewPanelAvailable: isPreviewPanelAvailable,
67
77
  openPreviewPanel: openPreviewPanel
68
- }));
78
+ }, (0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping') ? {
79
+ transformUrl: function transformUrl() {
80
+ var destinationUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : url;
81
+ return appendCrossProductAnalyticsParams(destinationUrl);
82
+ }
83
+ } : undefined));
69
84
  if (previewActionProps) {
70
85
  actions.push((0, _toAction.toAction)(previewActionProps.invokeAction, invokeClientAction, _messages.messages.preview_improved, 'preview-content'));
71
86
  }
@@ -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.23.2" || ''
14
+ packageVersion: "44.23.4" || ''
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -170,9 +170,10 @@ function Component(_ref) {
170
170
  // FIXME: preferredUrl should be rendered in the DOM anchor href instead of derived at click time
171
171
  var preferredUrl = (0, _helpers.getClickUrl)(url, state.details);
172
172
  var destinationUrl = (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
173
-
174
- // FIXME: Consumer that handle click even themselves via callback won't have the decorated URL
175
- onClick === null || onClick === void 0 || onClick(event);
173
+ onClick === null || onClick === void 0 || onClick(event, {
174
+ url: url,
175
+ destinationUrl: destinationUrl
176
+ });
176
177
 
177
178
  // Check if the event is prevented via onClick callback
178
179
  var consumerPreventedNavigation = event.defaultPrevented && !isEventDefaultPrevented;
@@ -19,6 +19,7 @@ var _flexibleUiContext = require("../../state/flexible-ui-context");
19
19
  var _useAiSummaryConfig = require("../../state/hooks/use-ai-summary-config");
20
20
  var _useResolve = _interopRequireDefault(require("../../state/hooks/use-resolve"));
21
21
  var _useRovoConfig = _interopRequireDefault(require("../../state/hooks/use-rovo-config"));
22
+ var _useSmartLinkCrossProductUrlWrapper = require("../../state/hooks/use-smart-link-cross-product-url-wrapper");
22
23
  var _container = _interopRequireDefault(require("./components/container"));
23
24
  var _utils = require("./utils");
24
25
  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); }
@@ -68,6 +69,14 @@ var FlexibleCard = function FlexibleCard(_ref) {
68
69
  var cardType = cardState.status,
69
70
  details = cardState.details;
70
71
  var status = cardType;
72
+ var appendCrossProductAnalyticsParams = (0, _useSmartLinkCrossProductUrlWrapper.useSmartLinkCrossProductUrlWrapperGated)({
73
+ details: details
74
+ });
75
+ var transformUrlCallback = (0, _react.useCallback)(function () {
76
+ var destinationUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : url;
77
+ return appendCrossProductAnalyticsParams(destinationUrl);
78
+ }, [appendCrossProductAnalyticsParams, url]);
79
+ var transformUrl = (0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping') ? transformUrlCallback : undefined;
71
80
 
72
81
  // if we have placeholder state it means we can internally use it
73
82
  // as temporary resolved data until the actual data comes back as one of the final statuses
@@ -97,9 +106,10 @@ var FlexibleCard = function FlexibleCard(_ref) {
97
106
  status: placeholderCardState ? placeHolderStatus : status,
98
107
  url: url,
99
108
  isPreviewPanelAvailable: isPreviewPanelAvailable,
100
- openPreviewPanel: openPreviewPanel
109
+ openPreviewPanel: openPreviewPanel,
110
+ transformUrl: transformUrl
101
111
  }));
102
- }, [aiSummaryConfig, appearance, actionOptions, details, id, isPreviewPanelAvailable, onAuthorize, onClick, onAuxClick, onContextMenu, openPreviewPanel, origin, placeholderCardState, placeHolderStatus, product, renderers, resolve, rovoConfig, status, url, fireEvent]);
112
+ }, [aiSummaryConfig, appearance, actionOptions, details, id, isPreviewPanelAvailable, onAuthorize, onClick, onAuxClick, onContextMenu, openPreviewPanel, origin, placeholderCardState, placeHolderStatus, product, renderers, resolve, rovoConfig, status, transformUrl, url, fireEvent]);
103
113
  var flexibleCardContext = (0, _react.useMemo)(function () {
104
114
  return {
105
115
  data: context,
@@ -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.23.2",
22
+ packageVersion: "44.23.4",
23
23
  componentName: 'linkUrl'
24
24
  };
25
25
  var LinkUrl = function LinkUrl(_ref) {
@@ -1,4 +1,5 @@
1
1
  import { extractLink } from '@atlaskit/link-extractors';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { CardAction } from '../../constants';
3
4
  import { getDefinitionId, getExtensionKey, getResourceType } from '../../state/helpers';
4
5
  import { openUrl } from '../../utils';
@@ -7,6 +8,7 @@ import { getActionsFromJsonLd } from '../common/actions/extractActions';
7
8
  export const extractInvokeViewAction = ({
8
9
  actionOptions,
9
10
  appearance,
11
+ transformUrl,
10
12
  id,
11
13
  response
12
14
  }, force) => {
@@ -21,7 +23,14 @@ export const extractInvokeViewAction = ({
21
23
  const viewActionExists = getActionsFromJsonLd(data).find(action => action['@type'] === 'ViewAction');
22
24
  if (url && (viewActionExists || force)) {
23
25
  return {
24
- actionFn: async () => openUrl(url),
26
+ actionFn: async () => {
27
+ if (fg('platform_smartlink_xpc_url_wrapping')) {
28
+ var _transformUrl;
29
+ const destinationUrl = (_transformUrl = transformUrl === null || transformUrl === void 0 ? void 0 : transformUrl(url)) !== null && _transformUrl !== void 0 ? _transformUrl : url;
30
+ return openUrl(destinationUrl);
31
+ }
32
+ return openUrl(url);
33
+ },
25
34
  actionSubjectId: 'shortcutGoToLink',
26
35
  actionType: 'ViewAction',
27
36
  definitionId: getDefinitionId(response),
@@ -18,6 +18,7 @@ export const extractFlexibleCardActions = ({
18
18
  product,
19
19
  response,
20
20
  rovoConfig,
21
+ transformUrl,
21
22
  url,
22
23
  isPreviewPanelAvailable,
23
24
  openPreviewPanel
@@ -44,7 +45,10 @@ export const extractFlexibleCardActions = ({
44
45
  origin,
45
46
  response,
46
47
  isPreviewPanelAvailable,
47
- openPreviewPanel
48
+ openPreviewPanel,
49
+ ...(fg('platform_smartlink_xpc_url_wrapping') ? {
50
+ transformUrl
51
+ } : undefined)
48
52
  }),
49
53
  [ActionName.AutomationAction]: extractAutomationAction(response),
50
54
  [InternalActionName.AISummaryAction]: extractAISummaryAction(response, url, actionOptions, aiSummaryConfig),
@@ -1,4 +1,5 @@
1
1
  import { extractLink } from '@atlaskit/link-extractors';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { CardAction } from '../../constants';
3
4
  import { getExtensionKey } from '../../state/helpers';
4
5
  import { canShowAction } from '../../utils/actions/can-show-action';
@@ -18,7 +19,7 @@ const toInvokeRequest = (extensionKey, resourceIdentifiers, actionType, details)
18
19
  details
19
20
  };
20
21
  };
21
- const extractAction = (response, id, actionOptions, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel) => {
22
+ const extractAction = (response, id, actionOptions, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel, transformUrl) => {
22
23
  var _action$dataRetrieval, _extractInvokePreview, _action$dataUpdateAct;
23
24
  const extensionKey = getExtensionKey(response);
24
25
  const data = response === null || response === void 0 ? void 0 : response.data;
@@ -41,7 +42,10 @@ const extractAction = (response, id, actionOptions, appearance, origin, fireEven
41
42
  origin,
42
43
  response,
43
44
  isPreviewPanelAvailable,
44
- openPreviewPanel
45
+ openPreviewPanel,
46
+ ...(fg('platform_smartlink_xpc_url_wrapping') ? {
47
+ transformUrl
48
+ } : undefined)
45
49
  })) === null || _extractInvokePreview === void 0 ? void 0 : _extractInvokePreview.invokeAction : undefined;
46
50
  const details = {
47
51
  id,
@@ -54,7 +58,7 @@ const extractAction = (response, id, actionOptions, appearance, origin, fireEven
54
58
  update
55
59
  } : undefined;
56
60
  };
57
- const extractState = (response, actionOptions, id, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel) => {
61
+ const extractState = (response, actionOptions, id, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel, transformUrl) => {
58
62
  if (!response || !response.data) {
59
63
  return;
60
64
  }
@@ -65,7 +69,7 @@ const extractState = (response, actionOptions, id, appearance, origin, fireEvent
65
69
  if (!canShowAction(CardAction.ChangeStatusAction, actionOptions)) {
66
70
  return lozenge;
67
71
  }
68
- const action = extractAction(response, id, actionOptions, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel);
72
+ const action = extractAction(response, id, actionOptions, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel, fg('platform_smartlink_xpc_url_wrapping') ? transformUrl : undefined);
69
73
  return {
70
74
  ...lozenge,
71
75
  action
@@ -28,6 +28,7 @@ const extractFlexibleUiContext = ({
28
28
  aiSummaryConfig,
29
29
  isPreviewPanelAvailable,
30
30
  openPreviewPanel,
31
+ transformUrl,
31
32
  ...props
32
33
  } = {}) => {
33
34
  if (!response) {
@@ -52,7 +53,10 @@ const extractFlexibleUiContext = ({
52
53
  url: props.url,
53
54
  // Use the original URL in edge cases, such as short links for AI summary and copy link actions.
54
55
  isPreviewPanelAvailable,
55
- openPreviewPanel
56
+ openPreviewPanel,
57
+ ...(fg('platform_smartlink_xpc_url_wrapping') ? {
58
+ transformUrl
59
+ } : undefined)
56
60
  }),
57
61
  appliedToComponentsCount: extractAppliedToComponentsCount(data),
58
62
  assignedToGroup: extractPersonAssignedToAsArray(data),
@@ -85,7 +89,7 @@ const extractFlexibleUiContext = ({
85
89
  snippet: extractSmartLinkSummary(response) || undefined,
86
90
  // Explicitly set here to remove an empty string
87
91
  sourceBranch: extractSourceBranch(data),
88
- state: extractState(response, actionOptions, id, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel),
92
+ state: extractState(response, actionOptions, id, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel, fg('platform_smartlink_xpc_url_wrapping') ? transformUrl : undefined),
89
93
  subscriberCount: extractSubscriberCount(data),
90
94
  subTasksProgress: extractSubTasksProgress(data),
91
95
  storyPoints: extractStoryPoints(data),
@@ -3,6 +3,7 @@ import { useMemo } from 'react';
3
3
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
4
4
  import uuid from 'uuid';
5
5
  import { useSmartLinkContext } from '@atlaskit/link-provider';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
8
  import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
8
9
  import { extractInvokeDownloadAction } from '../../extractors/action/extract-invoke-download-action';
@@ -12,6 +13,7 @@ import { messages } from '../../messages';
12
13
  import { toAction } from '../../utils/actions/to-action';
13
14
  import useInvokeClientAction from '../hooks/use-invoke-client-action';
14
15
  import useResolve from '../hooks/use-resolve';
16
+ import { useSmartLinkCrossProductUrlWrapperGated } from '../hooks/use-smart-link-cross-product-url-wrapper';
15
17
  import { useSmartCardState as useLinkState } from '../store';
16
18
  export function useSmartLinkActions({
17
19
  url,
@@ -34,6 +36,9 @@ export function useSmartLinkActions({
34
36
  fireEvent
35
37
  });
36
38
  const resolve = useResolve();
39
+ const appendCrossProductAnalyticsParams = useSmartLinkCrossProductUrlWrapperGated({
40
+ details: linkState.details
41
+ });
37
42
  if (expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') && prefetch && !linkState.details) {
38
43
  resolve(url);
39
44
  }
@@ -49,7 +54,10 @@ export function useSmartLinkActions({
49
54
  if (downloadActionProps) {
50
55
  actions.push(toAction(downloadActionProps, invokeClientAction, messages.download, 'download-content'));
51
56
  }
52
- const viewActionProps = extractInvokeViewAction(invokeParam);
57
+ const viewActionProps = fg('platform_smartlink_xpc_url_wrapping') ? extractInvokeViewAction({
58
+ ...invokeParam,
59
+ transformUrl: (destinationUrl = url) => appendCrossProductAnalyticsParams(destinationUrl)
60
+ }) : extractInvokeViewAction(invokeParam);
53
61
  if (viewActionProps) {
54
62
  actions.push(toAction(viewActionProps, invokeClientAction, messages.view, 'view-content'));
55
63
  }
@@ -58,7 +66,10 @@ export function useSmartLinkActions({
58
66
  fireEvent,
59
67
  origin,
60
68
  isPreviewPanelAvailable,
61
- openPreviewPanel
69
+ openPreviewPanel,
70
+ ...(fg('platform_smartlink_xpc_url_wrapping') ? {
71
+ transformUrl: (destinationUrl = url) => appendCrossProductAnalyticsParams(destinationUrl)
72
+ } : undefined)
62
73
  });
63
74
  if (previewActionProps) {
64
75
  actions.push(toAction(previewActionProps.invokeAction, invokeClientAction, messages.preview_improved, 'preview-content'));
@@ -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.23.2" || ''
5
+ packageVersion: "44.23.4" || ''
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -161,9 +161,10 @@ function Component({
161
161
  // FIXME: preferredUrl should be rendered in the DOM anchor href instead of derived at click time
162
162
  const preferredUrl = getClickUrl(url, state.details);
163
163
  const destinationUrl = (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
164
-
165
- // FIXME: Consumer that handle click even themselves via callback won't have the decorated URL
166
- onClick === null || onClick === void 0 ? void 0 : onClick(event);
164
+ onClick === null || onClick === void 0 ? void 0 : onClick(event, {
165
+ url,
166
+ destinationUrl
167
+ });
167
168
 
168
169
  // Check if the event is prevented via onClick callback
169
170
  const consumerPreventedNavigation = event.defaultPrevented && !isEventDefaultPrevented;
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useEffect, useMemo } from 'react';
2
+ import React, { useCallback, useEffect, useMemo } from 'react';
3
3
  import { useSmartLinkContext } from '@atlaskit/link-provider';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
5
  import UFOHoldLoad from '@atlaskit/react-ufo/load-hold';
@@ -10,6 +10,7 @@ import { FlexibleCardContext } from '../../state/flexible-ui-context';
10
10
  import { useAISummaryConfig } from '../../state/hooks/use-ai-summary-config';
11
11
  import useResolve from '../../state/hooks/use-resolve';
12
12
  import useRovoConfig from '../../state/hooks/use-rovo-config';
13
+ import { useSmartLinkCrossProductUrlWrapperGated } from '../../state/hooks/use-smart-link-cross-product-url-wrapper';
13
14
  import Container from './components/container';
14
15
  import { getContextByStatus } from './utils';
15
16
  const PENDING_LINK_STATUSES = [SmartLinkStatus.Pending, SmartLinkStatus.Resolving];
@@ -60,6 +61,11 @@ const FlexibleCard = ({
60
61
  details
61
62
  } = cardState;
62
63
  const status = cardType;
64
+ const appendCrossProductAnalyticsParams = useSmartLinkCrossProductUrlWrapperGated({
65
+ details
66
+ });
67
+ const transformUrlCallback = useCallback((destinationUrl = url) => appendCrossProductAnalyticsParams(destinationUrl), [appendCrossProductAnalyticsParams, url]);
68
+ const transformUrl = fg('platform_smartlink_xpc_url_wrapping') ? transformUrlCallback : undefined;
63
69
 
64
70
  // if we have placeholder state it means we can internally use it
65
71
  // as temporary resolved data until the actual data comes back as one of the final statuses
@@ -86,8 +92,9 @@ const FlexibleCard = ({
86
92
  status: placeholderCardState ? placeHolderStatus : status,
87
93
  url,
88
94
  isPreviewPanelAvailable,
89
- openPreviewPanel
90
- }), [aiSummaryConfig, appearance, actionOptions, details, id, isPreviewPanelAvailable, onAuthorize, onClick, onAuxClick, onContextMenu, openPreviewPanel, origin, placeholderCardState, placeHolderStatus, product, renderers, resolve, rovoConfig, status, url, fireEvent]);
95
+ openPreviewPanel,
96
+ transformUrl
97
+ }), [aiSummaryConfig, appearance, actionOptions, details, id, isPreviewPanelAvailable, onAuthorize, onClick, onAuxClick, onContextMenu, openPreviewPanel, origin, placeholderCardState, placeHolderStatus, product, renderers, resolve, rovoConfig, status, transformUrl, url, fireEvent]);
91
98
  const flexibleCardContext = useMemo(() => ({
92
99
  data: context,
93
100
  status: placeHolderStatus !== null && placeHolderStatus !== void 0 ? placeHolderStatus : status,
@@ -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.23.2",
12
+ packageVersion: "44.23.4",
13
13
  componentName: 'linkUrl'
14
14
  };
15
15
  const LinkUrl = ({
@@ -1,6 +1,7 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { extractLink } from '@atlaskit/link-extractors';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { CardAction } from '../../constants';
5
6
  import { getDefinitionId, getExtensionKey, getResourceType } from '../../state/helpers';
6
7
  import { openUrl } from '../../utils';
@@ -9,6 +10,7 @@ import { getActionsFromJsonLd } from '../common/actions/extractActions';
9
10
  export var extractInvokeViewAction = function extractInvokeViewAction(_ref, force) {
10
11
  var actionOptions = _ref.actionOptions,
11
12
  appearance = _ref.appearance,
13
+ transformUrl = _ref.transformUrl,
12
14
  id = _ref.id,
13
15
  response = _ref.response;
14
16
  if (!canShowAction(CardAction.ViewAction, actionOptions)) {
@@ -26,11 +28,19 @@ export var extractInvokeViewAction = function extractInvokeViewAction(_ref, forc
26
28
  return {
27
29
  actionFn: function () {
28
30
  var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
31
+ var _transformUrl, destinationUrl;
29
32
  return _regeneratorRuntime.wrap(function (_context) {
30
33
  while (1) switch (_context.prev = _context.next) {
31
34
  case 0:
32
- return _context.abrupt("return", openUrl(url));
35
+ if (!fg('platform_smartlink_xpc_url_wrapping')) {
36
+ _context.next = 1;
37
+ break;
38
+ }
39
+ destinationUrl = (_transformUrl = transformUrl === null || transformUrl === void 0 ? void 0 : transformUrl(url)) !== null && _transformUrl !== void 0 ? _transformUrl : url;
40
+ return _context.abrupt("return", openUrl(destinationUrl));
33
41
  case 1:
42
+ return _context.abrupt("return", openUrl(url));
43
+ case 2:
34
44
  case "end":
35
45
  return _context.stop();
36
46
  }
@@ -21,6 +21,7 @@ export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref
21
21
  product = _ref.product,
22
22
  response = _ref.response,
23
23
  rovoConfig = _ref.rovoConfig,
24
+ transformUrl = _ref.transformUrl,
24
25
  url = _ref.url,
25
26
  isPreviewPanelAvailable = _ref.isPreviewPanelAvailable,
26
27
  openPreviewPanel = _ref.openPreviewPanel;
@@ -34,7 +35,7 @@ export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref
34
35
  appearance: appearance,
35
36
  id: id,
36
37
  response: response
37
- })), ActionName.FollowAction, extractFollowAction(response, actionOptions, id)), ActionName.PreviewAction, extractPreviewClientAction({
38
+ })), ActionName.FollowAction, extractFollowAction(response, actionOptions, id)), ActionName.PreviewAction, extractPreviewClientAction(_objectSpread({
38
39
  actionOptions: actionOptions,
39
40
  appearance: appearance,
40
41
  fireEvent: fireEvent,
@@ -43,7 +44,9 @@ export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref
43
44
  response: response,
44
45
  isPreviewPanelAvailable: isPreviewPanelAvailable,
45
46
  openPreviewPanel: openPreviewPanel
46
- })), ActionName.AutomationAction, extractAutomationAction(response)), InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), fg('platform_sl_3p_auth_rovo_action_kill_switch') ? _defineProperty({}, ActionName.RovoChatAction, extractRovoChatAction({
47
+ }, fg('platform_smartlink_xpc_url_wrapping') ? {
48
+ transformUrl: transformUrl
49
+ } : undefined))), ActionName.AutomationAction, extractAutomationAction(response)), InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), fg('platform_sl_3p_auth_rovo_action_kill_switch') ? _defineProperty({}, ActionName.RovoChatAction, extractRovoChatAction({
47
50
  actionOptions: actionOptions,
48
51
  appearance: appearance,
49
52
  id: id,