@atlaskit/smart-card 43.5.2 → 43.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 (41) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/compass.yml +3 -0
  3. package/dist/cjs/extractors/action/extract-invoke-preview-action.js +11 -6
  4. package/dist/cjs/ssr.js +2 -1
  5. package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +3 -1
  6. package/dist/cjs/state/hooks/use-invoke-client-action/index.js +3 -0
  7. package/dist/cjs/state/hooks/use-resolve-hyperlink/index.js +3 -0
  8. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +2 -1
  9. package/dist/cjs/state/hooks-external/useSmartLinkReload.js +3 -0
  10. package/dist/cjs/utils/analytics/analytics.js +1 -1
  11. package/dist/cjs/view/CardWithUrl/loader.js +2 -1
  12. package/dist/cjs/view/EmbedModal/utils.js +3 -21
  13. package/dist/cjs/view/LinkUrl/index.js +1 -1
  14. package/dist/es2019/extractors/action/extract-invoke-preview-action.js +9 -4
  15. package/dist/es2019/ssr.js +2 -0
  16. package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +3 -0
  17. package/dist/es2019/state/hooks/use-invoke-client-action/index.js +3 -0
  18. package/dist/es2019/state/hooks/use-resolve-hyperlink/index.js +3 -0
  19. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +3 -0
  20. package/dist/es2019/state/hooks-external/useSmartLinkReload.js +3 -0
  21. package/dist/es2019/utils/analytics/analytics.js +1 -1
  22. package/dist/es2019/view/CardWithUrl/loader.js +2 -0
  23. package/dist/es2019/view/EmbedModal/utils.js +0 -12
  24. package/dist/es2019/view/LinkUrl/index.js +1 -1
  25. package/dist/esm/extractors/action/extract-invoke-preview-action.js +9 -4
  26. package/dist/esm/ssr.js +2 -0
  27. package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +3 -0
  28. package/dist/esm/state/hooks/use-invoke-client-action/index.js +3 -0
  29. package/dist/esm/state/hooks/use-resolve-hyperlink/index.js +3 -0
  30. package/dist/esm/state/hooks-external/useSmartLinkActions.js +3 -0
  31. package/dist/esm/state/hooks-external/useSmartLinkReload.js +3 -0
  32. package/dist/esm/utils/analytics/analytics.js +1 -1
  33. package/dist/esm/view/CardWithUrl/loader.js +2 -0
  34. package/dist/esm/view/EmbedModal/utils.js +3 -21
  35. package/dist/esm/view/LinkUrl/index.js +1 -1
  36. package/package.json +8 -11
  37. package/dist/cjs/utils/iframe-utils.js +0 -40
  38. package/dist/es2019/utils/iframe-utils.js +0 -34
  39. package/dist/esm/utils/iframe-utils.js +0 -34
  40. package/dist/types/utils/iframe-utils.d.ts +0 -5
  41. package/dist/types-ts4.5/utils/iframe-utils.d.ts +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 43.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 43.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`e5c510a42227e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e5c510a42227e) -
14
+ [ux] Disable preview modals within preview panels
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 43.5.2
4
21
 
5
22
  ### Patch Changes
package/compass.yml CHANGED
@@ -13,6 +13,9 @@ fields:
13
13
  tier: 3
14
14
  lifecycle: Active
15
15
  links:
16
+ - name: Root Repository
17
+ type: REPOSITORY
18
+ url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master
16
19
  - name: ''
17
20
  type: CHAT_CHANNEL
18
21
  url: 'https://atlassian.enterprise.slack.com/archives/CFKGAQZRV'
@@ -9,13 +9,13 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
11
  var _linkExtractors = require("@atlaskit/link-extractors");
12
+ var _utils = require("@atlaskit/linking-common/utils");
12
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
14
15
  var _index = require("../../index");
15
16
  var _helpers = require("../../state/helpers");
16
17
  var _canShowAction = require("../../utils/actions/can-show-action");
17
- var _iframeUtils = require("../../utils/iframe-utils");
18
- var _utils = require("../../view/EmbedModal/utils");
18
+ var _utils2 = require("../../view/EmbedModal/utils");
19
19
  var _extractIsSupportTheming = require("../common/meta/extractIsSupportTheming");
20
20
  var _extractIsTrusted = require("../common/meta/extractIsTrusted");
21
21
  var _icon = require("../flexible/icon");
@@ -41,7 +41,7 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
41
41
  var hasPreviewPanel = hasPreviewPanelParams && isPreviewPanelAvailable({
42
42
  ari: ari
43
43
  });
44
- var isInPreviewPanel = (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test') && (0, _iframeUtils.isModalWithinPreviewPanelIFrame)();
44
+ var isInPreviewPanel = (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test') && (0, _utils.isWithinPreviewPanelIFrame)();
45
45
  var data = response.data;
46
46
  var meta = response.meta;
47
47
  if (!(0, _canShowAction.canShowAction)(_index.CardAction.PreviewAction, actionOptions)) {
@@ -61,9 +61,15 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
61
61
  });
62
62
  };
63
63
  var src = (_extractPreviewData = (0, _linkExtractors.extractPreview)(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
64
+
65
+ // disallow preview modals within preview panels
66
+ if (!hasPreviewPanel && isInPreviewPanel && (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel_modal', 'cohort', 'test')) {
67
+ return;
68
+ }
64
69
  if (src) {
65
70
  var extensionKey = (0, _helpers.getExtensionKey)(response);
66
71
  return {
72
+ hasPreviewPanel: hasPreviewPanel,
67
73
  invokeAction: {
68
74
  actionFn: function () {
69
75
  var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
@@ -96,7 +102,7 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
96
102
  break;
97
103
  case 7:
98
104
  _context.next = 9;
99
- return (0, _utils.openEmbedModal)(_objectSpread({
105
+ return (0, _utils2.openEmbedModal)(_objectSpread({
100
106
  fireEvent: fireEvent,
101
107
  extensionKey: extensionKey,
102
108
  id: id,
@@ -136,8 +142,7 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
136
142
  display: display,
137
143
  extensionKey: extensionKey,
138
144
  id: id
139
- },
140
- hasPreviewPanel: hasPreviewPanel
145
+ }
141
146
  };
142
147
  }
143
148
  };
package/dist/cjs/ssr.js CHANGED
@@ -18,11 +18,12 @@ var _component = require("./view/CardWithUrl/component");
18
18
  var _LoadingCardLink = require("./view/CardWithUrl/component-lazy/LoadingCardLink");
19
19
  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); }
20
20
  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; }
21
- 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; }
21
+ 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
22
22
  // SSR friendly version of smart-card
23
23
  // simplifies the logic around rendering and loading placeholders and
24
24
  // only contains whats necessary to render the card on SSR mode
25
25
  var CardSSR = exports.CardSSR = function CardSSR(props) {
26
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
26
27
  var _useState = (0, _react.useState)(function () {
27
28
  var _props$id;
28
29
  return (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : (0, _uuid.default)();
@@ -21,7 +21,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
21
21
  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; }
22
22
  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; }
23
23
  function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
24
- function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function _throw(r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
24
+ function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function _throw(r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
25
25
  var CONVO_AI_ENDPOINT = 'assist/api/ai/v2/ai-feature/smartlinksummary/stream';
26
26
  var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
27
27
  function AISummaryService(props) {
@@ -117,6 +117,8 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
117
117
  _subscriber = _step2.value;
118
118
  _subscriber(this.state);
119
119
  }
120
+
121
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
120
122
  } catch (err) {
121
123
  _iterator2.e(err);
122
124
  } finally {
@@ -14,6 +14,8 @@ var _useAnalyticsEvents2 = require("../../../common/analytics/generated/use-anal
14
14
  var measure = _interopRequireWildcard(require("../../../utils/performance"));
15
15
  var _analytics = require("../../analytics");
16
16
  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); }
17
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
18
+
17
19
  var ACTION_EXPERIENCE_NAME = 'smart-link-action-invocation';
18
20
 
19
21
  /**
@@ -31,6 +33,7 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
31
33
  while (1) switch (_context.prev = _context.next) {
32
34
  case 0:
33
35
  actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
36
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
34
37
  experienceId = (0, _uuid.default)(); // Begin performance instrumentation.
35
38
  markName = "".concat(experienceId, "-").concat(actionType);
36
39
  measure.mark(markName, 'pending');
@@ -16,8 +16,11 @@ var _helpers = require("../../helpers");
16
16
  var _store = require("../../store");
17
17
  var _useScheduledRegister = require("./useScheduledRegister");
18
18
  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); }
19
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
20
+
19
21
  var useResolveHyperlink = function useResolveHyperlink(_ref) {
20
22
  var href = _ref.href;
23
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
21
24
  var _useState = (0, _react.useState)(function () {
22
25
  return (0, _uuid.default)();
23
26
  }),
@@ -20,13 +20,14 @@ var _useInvokeClientAction = _interopRequireDefault(require("../hooks/use-invoke
20
20
  var _useResolve = _interopRequireDefault(require("../hooks/use-resolve"));
21
21
  var _store = require("../store");
22
22
  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
- 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; }
23
+ 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
24
24
  function useSmartLinkActions(_ref) {
25
25
  var url = _ref.url,
26
26
  appearance = _ref.appearance,
27
27
  origin = _ref.origin,
28
28
  actionOptions = _ref.actionOptions,
29
29
  prefetch = _ref.prefetch;
30
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
30
31
  var id = (0, _react.useMemo)(function () {
31
32
  return (0, _uuid.default)();
32
33
  }, []);
@@ -8,6 +8,8 @@ exports.useSmartLinkReload = useSmartLinkReload;
8
8
  var _react = require("react");
9
9
  var _uuid = _interopRequireDefault(require("uuid"));
10
10
  var _actions = require("../actions");
11
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
12
+
11
13
  /**
12
14
  * Exposes a programmatic way to reload the data being used to render a Smart Link.
13
15
  * @param
@@ -15,6 +17,7 @@ var _actions = require("../actions");
15
17
  */
16
18
  function useSmartLinkReload(_ref) {
17
19
  var url = _ref.url;
20
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
18
21
  var id = (0, _react.useMemo)(function () {
19
22
  return (0, _uuid.default)();
20
23
  }, []);
@@ -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: "43.5.1"
14
+ packageVersion: "0.0.0-development"
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -22,7 +22,7 @@ var _performance = require("../../utils/performance");
22
22
  var _LoadingCardLink = require("./component-lazy/LoadingCardLink");
23
23
  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; }
24
24
  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; }
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" != (0, _typeof2.default)(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); }
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" != (0, _typeof2.default)(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); } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
26
26
  var LazyCardWithUrlContent = exports.LazyCardWithUrlContent = /*#__PURE__*/(0, _react.lazy)(function () {
27
27
  return (0, _utils.importWithRetry)(function () {
28
28
  return Promise.resolve().then(function () {
@@ -31,6 +31,7 @@ var LazyCardWithUrlContent = exports.LazyCardWithUrlContent = /*#__PURE__*/(0, _
31
31
  });
32
32
  });
33
33
  function CardWithURLRenderer(props) {
34
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
34
35
  var _useState = (0, _react.useState)(function () {
35
36
  return props.id ? props.id : (0, _uuid.default)();
36
37
  }),
@@ -8,18 +8,13 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.openEmbedModal = openEmbedModal;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
14
13
  var _react = _interopRequireDefault(require("react"));
15
14
  var _reactDom = _interopRequireDefault(require("react-dom"));
16
15
  var _reactIntlNext = require("react-intl-next");
17
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
18
- var _iframeUtils = require("../../utils/iframe-utils");
19
16
  var _excluded = ["onClose"];
20
17
  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); }
21
- 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; }
22
- 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; }
23
18
  var IFRAME_NAME = 'twp-editor-preview-iframe';
24
19
  var POPUP_MOUNT_POINT_ID = 'twp-editor-preview-iframe';
25
20
 
@@ -53,19 +48,6 @@ function _openEmbedModal() {
53
48
  case 0:
54
49
  _ref = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
55
50
  _ref$onClose = _ref.onClose, _onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose, props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
56
- if (!(0, _expValEquals.expValEquals)('platform_hover_card_preview_panel_modal', 'cohort', 'test')) {
57
- _context2.next = 6;
58
- break;
59
- }
60
- if (!props.isInPreviewPanel) {
61
- _context2.next = 6;
62
- break;
63
- }
64
- (0, _iframeUtils.openEmbedModalInParent)(_objectSpread({
65
- onClose: _onClose
66
- }, props));
67
- return _context2.abrupt("return");
68
- case 6:
69
51
  popupMountPoint = document.getElementById(POPUP_MOUNT_POINT_ID);
70
52
  if (!popupMountPoint) {
71
53
  popupMountPoint = document.createElement('div');
@@ -73,11 +55,11 @@ function _openEmbedModal() {
73
55
  popupMountPoint.setAttribute('data-testid', 'preview-modal');
74
56
  document.body.appendChild(popupMountPoint);
75
57
  }
76
- _context2.next = 10;
58
+ _context2.next = 6;
77
59
  return Promise.resolve().then(function () {
78
60
  return _interopRequireWildcard(require('./index'));
79
61
  });
80
- case 10:
62
+ case 6:
81
63
  Modal = _context2.sent;
82
64
  _reactDom.default.render( /*#__PURE__*/_react.default.createElement(_reactIntlNext.IntlProvider, {
83
65
  locale: "en"
@@ -93,7 +75,7 @@ function _openEmbedModal() {
93
75
  },
94
76
  showModal: true
95
77
  }))), popupMountPoint);
96
- case 12:
78
+ case 8:
97
79
  case "end":
98
80
  return _context2.stop();
99
81
  }
@@ -22,7 +22,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
22
22
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
23
23
  var PACKAGE_DATA = {
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "43.5.1",
25
+ packageVersion: "0.0.0-development",
26
26
  componentName: 'linkUrl'
27
27
  };
28
28
  var Anchor = (0, _click.withLinkClickedEvent)('a');
@@ -1,10 +1,10 @@
1
1
  import { extractPreview as extractPreviewData, extractSmartLinkAri, extractSmartLinkEmbed, extractSmartLinkProvider, extractSmartLinkTitle, extractSmartLinkUrl } from '@atlaskit/link-extractors';
2
+ import { isWithinPreviewPanelIFrame } from '@atlaskit/linking-common/utils';
2
3
  import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  import { ActionName, CardAction } from '../../index';
5
6
  import { getExtensionKey } from '../../state/helpers';
6
7
  import { canShowAction } from '../../utils/actions/can-show-action';
7
- import { isModalWithinPreviewPanelIFrame } from '../../utils/iframe-utils';
8
8
  import { openEmbedModal } from '../../view/EmbedModal/utils';
9
9
  import { extractIsSupportTheming } from '../common/meta/extractIsSupportTheming';
10
10
  import { extractIsTrusted } from '../common/meta/extractIsTrusted';
@@ -31,7 +31,7 @@ export const extractInvokePreviewAction = param => {
31
31
  const hasPreviewPanel = hasPreviewPanelParams && isPreviewPanelAvailable({
32
32
  ari: ari
33
33
  });
34
- const isInPreviewPanel = expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') && isModalWithinPreviewPanelIFrame();
34
+ const isInPreviewPanel = expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') && isWithinPreviewPanelIFrame();
35
35
  const data = response.data;
36
36
  const meta = response.meta;
37
37
  if (!canShowAction(CardAction.PreviewAction, actionOptions)) {
@@ -52,9 +52,15 @@ export const extractInvokePreviewAction = param => {
52
52
  });
53
53
  };
54
54
  const src = (_extractPreviewData = extractPreviewData(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
55
+
56
+ // disallow preview modals within preview panels
57
+ if (!hasPreviewPanel && isInPreviewPanel && expValEquals('platform_hover_card_preview_panel_modal', 'cohort', 'test')) {
58
+ return;
59
+ }
55
60
  if (src) {
56
61
  const extensionKey = getExtensionKey(response);
57
62
  return {
63
+ hasPreviewPanel,
58
64
  invokeAction: {
59
65
  actionFn: async () => {
60
66
  if (hasPreviewPanel) {
@@ -109,8 +115,7 @@ export const extractInvokePreviewAction = param => {
109
115
  display,
110
116
  extensionKey,
111
117
  id
112
- },
113
- hasPreviewPanel: hasPreviewPanel
118
+ }
114
119
  };
115
120
  }
116
121
  };
@@ -1,5 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { ErrorBoundary } from 'react-error-boundary';
3
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
3
4
  import uuid from 'uuid';
4
5
  import { AnalyticsContext } from '@atlaskit/analytics-next';
5
6
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -10,6 +11,7 @@ import { LoadingCardLink } from './view/CardWithUrl/component-lazy/LoadingCardLi
10
11
  // simplifies the logic around rendering and loading placeholders and
11
12
  // only contains whats necessary to render the card on SSR mode
12
13
  export const CardSSR = props => {
14
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
13
15
  const [id] = useState(() => {
14
16
  var _props$id;
15
17
  return (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : uuid();
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
2
3
  import uuid from 'uuid';
3
4
  import { getBaseUrl } from '@atlaskit/linking-common';
4
5
  import { readStream } from './readStream';
@@ -74,6 +75,8 @@ export class AISummaryService {
74
75
  for (const subscriber of this.subscribedStateSetters) {
75
76
  subscriber(this.state);
76
77
  }
78
+
79
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
77
80
  const id = uuid();
78
81
  try {
79
82
  var _this$onStart, _this$onSuccess;
@@ -1,4 +1,6 @@
1
1
  import { useCallback } from 'react';
2
+
3
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
2
4
  import uuid from 'uuid';
3
5
  import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
4
6
  import * as measure from '../../../utils/performance';
@@ -25,6 +27,7 @@ const useInvokeClientAction = ({
25
27
  id,
26
28
  resourceType = null
27
29
  }) => {
30
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
28
31
  const experienceId = uuid();
29
32
 
30
33
  // Begin performance instrumentation.
@@ -1,4 +1,6 @@
1
1
  import { useEffect, useState } from 'react';
2
+
3
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
2
4
  import uuid from 'uuid';
3
5
  import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
4
6
  import * as measure from '../../../utils/performance';
@@ -9,6 +11,7 @@ import { useScheduledRegister } from './useScheduledRegister';
9
11
  const useResolveHyperlink = ({
10
12
  href
11
13
  }) => {
14
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
12
15
  const [id] = useState(() => uuid());
13
16
  const state = useSmartCardState(href);
14
17
  const definitionId = getDefinitionId(state.details);
@@ -1,4 +1,6 @@
1
1
  import { useMemo } from 'react';
2
+
3
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
2
4
  import uuid from 'uuid';
3
5
  import { useSmartLinkContext } from '@atlaskit/link-provider';
4
6
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -18,6 +20,7 @@ export function useSmartLinkActions({
18
20
  actionOptions,
19
21
  prefetch
20
22
  }) {
23
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
21
24
  const id = useMemo(() => uuid(), []);
22
25
  const linkState = useLinkState(url);
23
26
  const {
@@ -1,4 +1,6 @@
1
1
  import { useMemo } from 'react';
2
+
3
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
2
4
  import uuid from 'uuid';
3
5
  import { useSmartCardActions as useLinkActions } from '../actions';
4
6
  /**
@@ -9,6 +11,7 @@ import { useSmartCardActions as useLinkActions } from '../actions';
9
11
  export function useSmartLinkReload({
10
12
  url
11
13
  }) {
14
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
12
15
  const id = useMemo(() => uuid(), []);
13
16
  const linkActions = useLinkActions(id, url);
14
17
  return linkActions.reload;
@@ -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: "43.5.1"
5
+ packageVersion: "0.0.0-development"
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,6 +1,7 @@
1
1
  import React, { lazy, Suspense, useCallback, useEffect, useState } from 'react';
2
2
  import { ErrorBoundary } from 'react-error-boundary';
3
3
  import { di } from 'react-magnetic-di';
4
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
4
5
  import uuid from 'uuid';
5
6
  import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
6
7
  import { failUfoExperience, startUfoExperience } from '../../state/analytics';
@@ -11,6 +12,7 @@ import { clearMarks, clearMeasures } from '../../utils/performance';
11
12
  import { LoadingCardLink } from './component-lazy/LoadingCardLink';
12
13
  export const LazyCardWithUrlContent = /*#__PURE__*/lazy(() => importWithRetry(() => import( /* webpackChunkName: "@atlaskit-internal_smartcard-urlcardcontent" */'./component-lazy/index')));
13
14
  export function CardWithURLRenderer(props) {
15
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
14
16
  const [id] = useState(() => props.id ? props.id : uuid());
15
17
  const {
16
18
  fireEvent
@@ -2,8 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import ReactDOM from 'react-dom';
4
4
  import { IntlProvider } from 'react-intl-next';
5
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
- import { openEmbedModalInParent } from '../../utils/iframe-utils';
7
5
  const IFRAME_NAME = 'twp-editor-preview-iframe';
8
6
  const POPUP_MOUNT_POINT_ID = 'twp-editor-preview-iframe';
9
7
 
@@ -24,16 +22,6 @@ export async function openEmbedModal({
24
22
  onClose = () => {},
25
23
  ...props
26
24
  } = {}) {
27
- // If the modal trigger is in an iframe and the user has preview panels enabled, send a message to open modal to the parent product
28
- if (expValEquals('platform_hover_card_preview_panel_modal', 'cohort', 'test')) {
29
- if (props.isInPreviewPanel) {
30
- openEmbedModalInParent({
31
- onClose,
32
- ...props
33
- });
34
- return;
35
- }
36
- }
37
25
  let popupMountPoint;
38
26
  popupMountPoint = document.getElementById(POPUP_MOUNT_POINT_ID);
39
27
  if (!popupMountPoint) {
@@ -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: "43.5.1",
15
+ packageVersion: "0.0.0-development",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  const Anchor = withLinkClickedEvent('a');
@@ -4,12 +4,12 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  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; }
5
5
  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) { _defineProperty(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; }
6
6
  import { extractPreview as extractPreviewData, extractSmartLinkAri, extractSmartLinkEmbed, extractSmartLinkProvider, extractSmartLinkTitle, extractSmartLinkUrl } from '@atlaskit/link-extractors';
7
+ import { isWithinPreviewPanelIFrame } from '@atlaskit/linking-common/utils';
7
8
  import { fg } from '@atlaskit/platform-feature-flags';
8
9
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
10
  import { ActionName, CardAction } from '../../index';
10
11
  import { getExtensionKey } from '../../state/helpers';
11
12
  import { canShowAction } from '../../utils/actions/can-show-action';
12
- import { isModalWithinPreviewPanelIFrame } from '../../utils/iframe-utils';
13
13
  import { openEmbedModal } from '../../view/EmbedModal/utils';
14
14
  import { extractIsSupportTheming } from '../common/meta/extractIsSupportTheming';
15
15
  import { extractIsTrusted } from '../common/meta/extractIsTrusted';
@@ -34,7 +34,7 @@ export var extractInvokePreviewAction = function extractInvokePreviewAction(para
34
34
  var hasPreviewPanel = hasPreviewPanelParams && isPreviewPanelAvailable({
35
35
  ari: ari
36
36
  });
37
- var isInPreviewPanel = expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') && isModalWithinPreviewPanelIFrame();
37
+ var isInPreviewPanel = expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') && isWithinPreviewPanelIFrame();
38
38
  var data = response.data;
39
39
  var meta = response.meta;
40
40
  if (!canShowAction(CardAction.PreviewAction, actionOptions)) {
@@ -54,9 +54,15 @@ export var extractInvokePreviewAction = function extractInvokePreviewAction(para
54
54
  });
55
55
  };
56
56
  var src = (_extractPreviewData = extractPreviewData(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
57
+
58
+ // disallow preview modals within preview panels
59
+ if (!hasPreviewPanel && isInPreviewPanel && expValEquals('platform_hover_card_preview_panel_modal', 'cohort', 'test')) {
60
+ return;
61
+ }
57
62
  if (src) {
58
63
  var extensionKey = getExtensionKey(response);
59
64
  return {
65
+ hasPreviewPanel: hasPreviewPanel,
60
66
  invokeAction: {
61
67
  actionFn: function () {
62
68
  var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
@@ -129,8 +135,7 @@ export var extractInvokePreviewAction = function extractInvokePreviewAction(para
129
135
  display: display,
130
136
  extensionKey: extensionKey,
131
137
  id: id
132
- },
133
- hasPreviewPanel: hasPreviewPanel
138
+ }
134
139
  };
135
140
  }
136
141
  };
package/dist/esm/ssr.js CHANGED
@@ -4,6 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
4
4
  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) { _defineProperty(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; }
5
5
  import React, { useState } from 'react';
6
6
  import { ErrorBoundary } from 'react-error-boundary';
7
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
7
8
  import uuid from 'uuid';
8
9
  import { AnalyticsContext } from '@atlaskit/analytics-next';
9
10
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -14,6 +15,7 @@ import { LoadingCardLink } from './view/CardWithUrl/component-lazy/LoadingCardLi
14
15
  // simplifies the logic around rendering and loading placeholders and
15
16
  // only contains whats necessary to render the card on SSR mode
16
17
  export var CardSSR = function CardSSR(props) {
18
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
17
19
  var _useState = useState(function () {
18
20
  var _props$id;
19
21
  return (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : uuid();
@@ -10,6 +10,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
10
10
  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) { _defineProperty(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; }
11
11
  function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
12
12
  function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function _throw(r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
13
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
13
14
  import uuid from 'uuid';
14
15
  import { getBaseUrl } from '@atlaskit/linking-common';
15
16
  import { readStream } from './readStream';
@@ -110,6 +111,8 @@ export var AISummaryService = /*#__PURE__*/function () {
110
111
  _subscriber = _step2.value;
111
112
  _subscriber(this.state);
112
113
  }
114
+
115
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
113
116
  } catch (err) {
114
117
  _iterator2.e(err);
115
118
  } finally {
@@ -1,6 +1,8 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { useCallback } from 'react';
4
+
5
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
4
6
  import uuid from 'uuid';
5
7
  import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
6
8
  import * as measure from '../../../utils/performance';
@@ -22,6 +24,7 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
22
24
  while (1) switch (_context.prev = _context.next) {
23
25
  case 0:
24
26
  actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
27
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
25
28
  experienceId = uuid(); // Begin performance instrumentation.
26
29
  markName = "".concat(experienceId, "-").concat(actionType);
27
30
  measure.mark(markName, 'pending');
@@ -1,5 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { useEffect, useState } from 'react';
3
+
4
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
3
5
  import uuid from 'uuid';
4
6
  import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
5
7
  import * as measure from '../../../utils/performance';
@@ -9,6 +11,7 @@ import { useSmartCardState } from '../../store';
9
11
  import { useScheduledRegister } from './useScheduledRegister';
10
12
  var useResolveHyperlink = function useResolveHyperlink(_ref) {
11
13
  var href = _ref.href;
14
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
12
15
  var _useState = useState(function () {
13
16
  return uuid();
14
17
  }),
@@ -2,6 +2,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  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) { _defineProperty(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; }
4
4
  import { useMemo } from 'react';
5
+
6
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
5
7
  import uuid from 'uuid';
6
8
  import { useSmartLinkContext } from '@atlaskit/link-provider';
7
9
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -20,6 +22,7 @@ export function useSmartLinkActions(_ref) {
20
22
  origin = _ref.origin,
21
23
  actionOptions = _ref.actionOptions,
22
24
  prefetch = _ref.prefetch;
25
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
23
26
  var id = useMemo(function () {
24
27
  return uuid();
25
28
  }, []);
@@ -1,4 +1,6 @@
1
1
  import { useMemo } from 'react';
2
+
3
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
2
4
  import uuid from 'uuid';
3
5
  import { useSmartCardActions as useLinkActions } from '../actions';
4
6
  /**
@@ -8,6 +10,7 @@ import { useSmartCardActions as useLinkActions } from '../actions';
8
10
  */
9
11
  export function useSmartLinkReload(_ref) {
10
12
  var url = _ref.url;
13
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
11
14
  var id = useMemo(function () {
12
15
  return uuid();
13
16
  }, []);
@@ -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: "43.5.1"
7
+ packageVersion: "0.0.0-development"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -5,6 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  import React, { lazy, Suspense, useCallback, useEffect, useState } from 'react';
6
6
  import { ErrorBoundary } from 'react-error-boundary';
7
7
  import { di } from 'react-magnetic-di';
8
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
8
9
  import uuid from 'uuid';
9
10
  import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
10
11
  import { failUfoExperience, startUfoExperience } from '../../state/analytics';
@@ -19,6 +20,7 @@ export var LazyCardWithUrlContent = /*#__PURE__*/lazy(function () {
19
20
  });
20
21
  });
21
22
  export function CardWithURLRenderer(props) {
23
+ // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
22
24
  var _useState = useState(function () {
23
25
  return props.id ? props.id : uuid();
24
26
  }),
@@ -1,16 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
4
  var _excluded = ["onClose"];
6
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
- 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; }
8
- 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) { _defineProperty(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; }
9
6
  import React from 'react';
10
7
  import ReactDOM from 'react-dom';
11
8
  import { IntlProvider } from 'react-intl-next';
12
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
- import { openEmbedModalInParent } from '../../utils/iframe-utils';
14
9
  var IFRAME_NAME = 'twp-editor-preview-iframe';
15
10
  var POPUP_MOUNT_POINT_ID = 'twp-editor-preview-iframe';
16
11
 
@@ -44,19 +39,6 @@ function _openEmbedModal() {
44
39
  case 0:
45
40
  _ref = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
46
41
  _ref$onClose = _ref.onClose, _onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose, props = _objectWithoutProperties(_ref, _excluded);
47
- if (!expValEquals('platform_hover_card_preview_panel_modal', 'cohort', 'test')) {
48
- _context2.next = 6;
49
- break;
50
- }
51
- if (!props.isInPreviewPanel) {
52
- _context2.next = 6;
53
- break;
54
- }
55
- openEmbedModalInParent(_objectSpread({
56
- onClose: _onClose
57
- }, props));
58
- return _context2.abrupt("return");
59
- case 6:
60
42
  popupMountPoint = document.getElementById(POPUP_MOUNT_POINT_ID);
61
43
  if (!popupMountPoint) {
62
44
  popupMountPoint = document.createElement('div');
@@ -64,9 +46,9 @@ function _openEmbedModal() {
64
46
  popupMountPoint.setAttribute('data-testid', 'preview-modal');
65
47
  document.body.appendChild(popupMountPoint);
66
48
  }
67
- _context2.next = 10;
49
+ _context2.next = 6;
68
50
  return import('./index');
69
- case 10:
51
+ case 6:
70
52
  Modal = _context2.sent;
71
53
  ReactDOM.render( /*#__PURE__*/React.createElement(IntlProvider, {
72
54
  locale: "en"
@@ -82,7 +64,7 @@ function _openEmbedModal() {
82
64
  },
83
65
  showModal: true
84
66
  }))), popupMountPoint);
85
- case 12:
67
+ case 8:
86
68
  case "end":
87
69
  return _context2.stop();
88
70
  }
@@ -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: "43.5.1",
18
+ packageVersion: "0.0.0-development",
19
19
  componentName: 'linkUrl'
20
20
  };
21
21
  var Anchor = withLinkClickedEvent('a');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "43.5.2",
3
+ "version": "43.6.1",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/avatar": "^25.5.0",
33
33
  "@atlaskit/avatar-group": "^12.4.0",
34
34
  "@atlaskit/badge": "^18.2.0",
35
- "@atlaskit/button": "^23.5.0",
35
+ "@atlaskit/button": "^23.6.0",
36
36
  "@atlaskit/checkbox": "^17.1.0",
37
37
  "@atlaskit/css": "^0.15.0",
38
38
  "@atlaskit/dropdown-menu": "^16.3.0",
@@ -54,10 +54,10 @@
54
54
  "@atlaskit/link-client-extension": "^6.0.0",
55
55
  "@atlaskit/link-extractors": "^2.4.0",
56
56
  "@atlaskit/link-test-helpers": "^8.4.0",
57
- "@atlaskit/linking-common": "^9.7.0",
57
+ "@atlaskit/linking-common": "^9.8.0",
58
58
  "@atlaskit/linking-types": "^14.1.0",
59
59
  "@atlaskit/logo": "^19.9.0",
60
- "@atlaskit/lozenge": "^13.0.0",
60
+ "@atlaskit/lozenge": "^13.1.0",
61
61
  "@atlaskit/menu": "^8.4.0",
62
62
  "@atlaskit/modal-dialog": "^14.6.0",
63
63
  "@atlaskit/outbound-auth-flow-client": "^3.4.0",
@@ -70,9 +70,9 @@
70
70
  "@atlaskit/textarea": "^8.0.0",
71
71
  "@atlaskit/textfield": "^8.0.0",
72
72
  "@atlaskit/theme": "^21.0.0",
73
- "@atlaskit/tmp-editor-statsig": "^13.26.0",
74
- "@atlaskit/tokens": "^7.1.0",
75
- "@atlaskit/tooltip": "^20.7.0",
73
+ "@atlaskit/tmp-editor-statsig": "^13.32.0",
74
+ "@atlaskit/tokens": "^8.0.0",
75
+ "@atlaskit/tooltip": "^20.8.0",
76
76
  "@atlaskit/ufo": "^0.4.0",
77
77
  "@babel/runtime": "^7.0.0",
78
78
  "@compiled/react": "^0.18.6",
@@ -102,7 +102,7 @@
102
102
  "@atlaskit/media-test-helpers": "^39.0.0",
103
103
  "@atlaskit/react-ufo": "^4.14.0",
104
104
  "@atlaskit/ssr": "workspace:^",
105
- "@atlassian/analytics-tooling": "^0.5.0",
105
+ "@atlassian/analytics-tooling": "workspace:^",
106
106
  "@atlassian/feature-flags-test-utils": "^1.0.0",
107
107
  "@atlassian/gemini": "^1.20.0",
108
108
  "@testing-library/dom": "^10.1.0",
@@ -231,9 +231,6 @@
231
231
  },
232
232
  "navx-1910-fix-hovercard-performance-metrics": {
233
233
  "type": "boolean"
234
- },
235
- "platform_editor_google_hovercard_experiment": {
236
- "type": "string"
237
234
  }
238
235
  },
239
236
  "compassUnitTestMetricSourceId": "ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:metric-source/c5751cc6-3513-4070-9deb-af31e86aed34/f74ef1bc-7240-4aac-9dc8-9dc43b502089"
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.openEmbedModalInParent = exports.isWithinPreviewPanel = exports.isModalWithinPreviewPanelIFrame = exports.isInIframe = void 0;
7
- var isInIframe = exports.isInIframe = function isInIframe() {
8
- try {
9
- return window !== window.top;
10
- } catch (_unused) {
11
- // If we can't access window.top due to cross-origin restrictions, assume we're in an iframe
12
- return true;
13
- }
14
- };
15
- var isWithinPreviewPanel = exports.isWithinPreviewPanel = function isWithinPreviewPanel() {
16
- try {
17
- var params = new URLSearchParams(window.location.search);
18
- return params.has('previewPanels') || params.get('embeddedConfluenceSource') === 'confluence-page-preview-panel';
19
- } catch (_unused2) {
20
- return false;
21
- }
22
- };
23
- var isModalWithinPreviewPanelIFrame = exports.isModalWithinPreviewPanelIFrame = function isModalWithinPreviewPanelIFrame() {
24
- return isInIframe() && isWithinPreviewPanel();
25
- };
26
-
27
- // Signals parent product to open embed modal via postMessage when in iframe context
28
- var openEmbedModalInParent = exports.openEmbedModalInParent = function openEmbedModalInParent(modalProps) {
29
- if (!isInIframe()) {
30
- return;
31
- }
32
- window.parent.postMessage({
33
- type: 'OPEN_EMBED_MODAL',
34
- payload: {
35
- modal: {
36
- url: (modalProps === null || modalProps === void 0 ? void 0 : modalProps.url) || ''
37
- }
38
- }
39
- }, '*');
40
- };
@@ -1,34 +0,0 @@
1
- export const isInIframe = () => {
2
- try {
3
- return window !== window.top;
4
- } catch {
5
- // If we can't access window.top due to cross-origin restrictions, assume we're in an iframe
6
- return true;
7
- }
8
- };
9
- export const isWithinPreviewPanel = () => {
10
- try {
11
- const params = new URLSearchParams(window.location.search);
12
- return params.has('previewPanels') || params.get('embeddedConfluenceSource') === 'confluence-page-preview-panel';
13
- } catch {
14
- return false;
15
- }
16
- };
17
- export const isModalWithinPreviewPanelIFrame = () => {
18
- return isInIframe() && isWithinPreviewPanel();
19
- };
20
-
21
- // Signals parent product to open embed modal via postMessage when in iframe context
22
- export const openEmbedModalInParent = modalProps => {
23
- if (!isInIframe()) {
24
- return;
25
- }
26
- window.parent.postMessage({
27
- type: 'OPEN_EMBED_MODAL',
28
- payload: {
29
- modal: {
30
- url: (modalProps === null || modalProps === void 0 ? void 0 : modalProps.url) || ''
31
- }
32
- }
33
- }, '*');
34
- };
@@ -1,34 +0,0 @@
1
- export var isInIframe = function isInIframe() {
2
- try {
3
- return window !== window.top;
4
- } catch (_unused) {
5
- // If we can't access window.top due to cross-origin restrictions, assume we're in an iframe
6
- return true;
7
- }
8
- };
9
- export var isWithinPreviewPanel = function isWithinPreviewPanel() {
10
- try {
11
- var params = new URLSearchParams(window.location.search);
12
- return params.has('previewPanels') || params.get('embeddedConfluenceSource') === 'confluence-page-preview-panel';
13
- } catch (_unused2) {
14
- return false;
15
- }
16
- };
17
- export var isModalWithinPreviewPanelIFrame = function isModalWithinPreviewPanelIFrame() {
18
- return isInIframe() && isWithinPreviewPanel();
19
- };
20
-
21
- // Signals parent product to open embed modal via postMessage when in iframe context
22
- export var openEmbedModalInParent = function openEmbedModalInParent(modalProps) {
23
- if (!isInIframe()) {
24
- return;
25
- }
26
- window.parent.postMessage({
27
- type: 'OPEN_EMBED_MODAL',
28
- payload: {
29
- modal: {
30
- url: (modalProps === null || modalProps === void 0 ? void 0 : modalProps.url) || ''
31
- }
32
- }
33
- }, '*');
34
- };
@@ -1,5 +0,0 @@
1
- import type { EmbedModalProps } from '../view/EmbedModal/types';
2
- export declare const isInIframe: () => boolean;
3
- export declare const isWithinPreviewPanel: () => boolean;
4
- export declare const isModalWithinPreviewPanelIFrame: () => boolean;
5
- export declare const openEmbedModalInParent: (modalProps: Partial<EmbedModalProps>) => void;
@@ -1,5 +0,0 @@
1
- import type { EmbedModalProps } from '../view/EmbedModal/types';
2
- export declare const isInIframe: () => boolean;
3
- export declare const isWithinPreviewPanel: () => boolean;
4
- export declare const isModalWithinPreviewPanelIFrame: () => boolean;
5
- export declare const openEmbedModalInParent: (modalProps: Partial<EmbedModalProps>) => void;