@atlaskit/smart-card 43.0.2 → 43.1.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 (32) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/extractors/action/extract-invoke-preview-action.js +6 -3
  3. package/dist/cjs/state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator.js +7 -18
  4. package/dist/cjs/utils/analytics/analytics.js +1 -1
  5. package/dist/cjs/view/CardWithUrl/component.js +7 -1
  6. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +1 -1
  7. package/dist/cjs/view/LinkUrl/index.js +1 -1
  8. package/dist/es2019/extractors/action/extract-invoke-preview-action.js +7 -3
  9. package/dist/es2019/state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator.js +4 -16
  10. package/dist/es2019/utils/analytics/analytics.js +1 -1
  11. package/dist/es2019/view/CardWithUrl/component.js +7 -1
  12. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +1 -1
  13. package/dist/es2019/view/LinkUrl/index.js +1 -1
  14. package/dist/esm/extractors/action/extract-invoke-preview-action.js +6 -3
  15. package/dist/esm/state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator.js +6 -16
  16. package/dist/esm/utils/analytics/analytics.js +1 -1
  17. package/dist/esm/view/CardWithUrl/component.js +7 -1
  18. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +1 -1
  19. package/dist/esm/view/LinkUrl/index.js +1 -1
  20. package/dist/types/extractors/action/extract-invoke-preview-action.d.ts +3 -0
  21. package/dist/types/extractors/flexible/actions/index.d.ts +3 -0
  22. package/dist/types/extractors/flexible/extract-state.d.ts +3 -0
  23. package/dist/types/state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator.d.ts +1 -2
  24. package/dist/types/state/hooks/useSmartLink.d.ts +3 -0
  25. package/dist/types/view/FlexibleCard/types.d.ts +3 -0
  26. package/dist/types-ts4.5/extractors/action/extract-invoke-preview-action.d.ts +3 -0
  27. package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +3 -0
  28. package/dist/types-ts4.5/extractors/flexible/extract-state.d.ts +3 -0
  29. package/dist/types-ts4.5/state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator.d.ts +1 -2
  30. package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +3 -0
  31. package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +3 -0
  32. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 43.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9fa4acd606891`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9fa4acd606891) -
8
+ Remove experiment gate for sharepoint and google hyperlink resolve
9
+ - Updated dependencies
10
+
11
+ ## 43.1.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`6b08c3a8cde08`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6b08c3a8cde08) -
16
+ Construct confluence url from smart card embed preview href when smart card url is short
17
+ confluence url, in the form "{host}/wiki/x/{hash}"
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 43.0.2
4
24
 
5
25
  ### Patch Changes
@@ -67,7 +67,7 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
67
67
  invokeAction: {
68
68
  actionFn: function () {
69
69
  var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
70
- var resolvedUrl, responseUrl, _extractSmartLinkProv, _extractSmartLinkEmbe, _actionOptions$previe, _actionOptions$previe2;
70
+ var _extractSmartLinkEmbe, resolvedUrl, responseUrl, _extractSmartLinkProv, _extractSmartLinkEmbe2, _actionOptions$previe, _actionOptions$previe2;
71
71
  return _regenerator.default.wrap(function _callee$(_context) {
72
72
  while (1) switch (_context.prev = _context.next) {
73
73
  case 0:
@@ -84,7 +84,10 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
84
84
  ari: ari,
85
85
  url: resolvedUrl,
86
86
  name: name,
87
- iconUrl: undefined
87
+ iconUrl: undefined,
88
+ panelData: {
89
+ embedUrl: (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test') ? (_extractSmartLinkEmbe = (0, _linkExtractors.extractSmartLinkEmbed)(response)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src : undefined
90
+ }
88
91
  });
89
92
  (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test') && firePreviewActionUIEvent({
90
93
  previewType: 'panel'
@@ -105,7 +108,7 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
105
108
  providerName: (_extractSmartLinkProv = (0, _linkExtractors.extractSmartLinkProvider)(response)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text,
106
109
  onClose: onClose,
107
110
  origin: origin,
108
- src: (_extractSmartLinkEmbe = (0, _linkExtractors.extractSmartLinkEmbed)(response)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src,
111
+ src: (_extractSmartLinkEmbe2 = (0, _linkExtractors.extractSmartLinkEmbed)(response)) === null || _extractSmartLinkEmbe2 === void 0 ? void 0 : _extractSmartLinkEmbe2.src,
109
112
  title: (0, _linkExtractors.extractSmartLinkTitle)(response),
110
113
  url: url,
111
114
  isBlanketHidden: (0, _platformFeatureFlags.fg)('linking_platform_hide_preview_action_blanket_prop') ? actionOptions === null || actionOptions === void 0 || (_actionOptions$previe = actionOptions.previewAction) === null || _actionOptions$previe === void 0 ? void 0 : _actionOptions$previe.hideBlanket : undefined,
@@ -1,36 +1,25 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports.isSharePointDomain = exports.isGoogleDomain = exports.default = void 0;
6
+ exports.shouldResolveUrl = exports.default = void 0;
8
7
  var _react = require("react");
9
- var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
10
8
  var _linkProvider = require("@atlaskit/link-provider");
11
- var isSharePointDomain = exports.isSharePointDomain = function isSharePointDomain(href) {
9
+ var allowedHostnames = ['sharepoint.com', 'onedrive.live.com', 'docs.google.com', 'drive.google.com'];
10
+ var shouldResolveUrl = exports.shouldResolveUrl = function shouldResolveUrl(href) {
12
11
  try {
13
12
  var hostname = new URL(href).hostname.toLowerCase();
14
- return hostname.includes('sharepoint.com') || hostname.includes('onedrive.live.com');
13
+ return allowedHostnames.some(function (allowedHostname) {
14
+ return hostname.includes(allowedHostname);
15
+ });
15
16
  } catch (_unused) {
16
17
  return false;
17
18
  }
18
19
  };
19
- var isGoogleDomain = exports.isGoogleDomain = function isGoogleDomain(href) {
20
- try {
21
- var hostname = new URL(href).hostname.toLowerCase();
22
- return hostname.includes('docs.google.com') || hostname.includes('drive.google.com');
23
- } catch (_unused2) {
24
- return false;
25
- }
26
- };
27
20
  var useResolveHyperlinkValidator = function useResolveHyperlinkValidator() {
28
21
  var href = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
29
22
  var hasSmartCardProvider = !!(0, _react.useContext)(_linkProvider.SmartCardContext);
30
- var isSharePointResolveEnabled = _featureGateJsClient.default.getExperimentValue('platform_editor_resolve_hyperlinks_confluence', 'isEnabled', false) || _featureGateJsClient.default.getExperimentValue('platform_editor_resolve_hyperlinks_jira', 'isEnabled', false);
31
- var isGoogleResolveEnabled = _featureGateJsClient.default.getExperimentValue('platform_editor_resolve_google_hyperlinks', 'isEnabled', false);
32
- var shouldResolveSharePoint = isSharePointDomain(href) && isSharePointResolveEnabled;
33
- var shouldResolveGoogle = isGoogleDomain(href) && isGoogleResolveEnabled;
34
- return hasSmartCardProvider && (shouldResolveSharePoint || shouldResolveGoogle);
23
+ return hasSmartCardProvider && shouldResolveUrl(href);
35
24
  };
36
25
  var _default = exports.default = useResolveHyperlinkValidator;
@@ -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: "0.0.0-development"
14
+ packageVersion: "43.1.0"
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -8,7 +8,9 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.CardWithUrlContent = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _analyticsNext = require("@atlaskit/analytics-next");
11
+ var _linkExtractors = require("@atlaskit/link-extractors");
11
12
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
12
14
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
13
15
  var _useAnalyticsEvents2 = require("../../common/analytics/generated/use-analytics-events");
14
16
  var _constants = require("../../constants");
@@ -121,13 +123,17 @@ function Component(_ref) {
121
123
  if (!isModifierKeyPressed && ari && name && openPreviewPanel && isPreviewPanelAvailable !== null && isPreviewPanelAvailable !== void 0 && isPreviewPanelAvailable({
122
124
  ari: ari
123
125
  }) && !isDisablePreviewPanel) {
126
+ var _extractSmartLinkEmbe;
124
127
  event.preventDefault();
125
128
  event.stopPropagation();
126
129
  openPreviewPanel({
127
130
  url: url,
128
131
  ari: ari,
129
132
  name: name,
130
- iconUrl: (0, _helpers.getObjectIconUrl)(state.details)
133
+ iconUrl: (0, _helpers.getObjectIconUrl)(state.details),
134
+ panelData: {
135
+ embedUrl: (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test') ? (_extractSmartLinkEmbe = (0, _linkExtractors.extractSmartLinkEmbed)(state.details)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src : undefined
136
+ }
131
137
  });
132
138
  (0, _click.fireLinkClickedEvent)(createAnalyticsEvent)(event, {
133
139
  attributes: {
@@ -230,7 +230,7 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
230
230
  return /*#__PURE__*/_react.default.createElement("span", {
231
231
  ref: parentSpan
232
232
  }, /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, triggerProps, {
233
- // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events, @atlassian/a11y/mouse-events-have-key-events
233
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
234
234
  onMouseOver: initShowCard
235
235
  // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
236
236
  ,
@@ -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: "0.0.0-development",
25
+ packageVersion: "43.1.0",
26
26
  componentName: 'linkUrl'
27
27
  };
28
28
  var Anchor = (0, _click.withLinkClickedEvent)('a');
@@ -58,6 +58,7 @@ export const extractInvokePreviewAction = param => {
58
58
  invokeAction: {
59
59
  actionFn: async () => {
60
60
  if (hasPreviewPanel) {
61
+ var _extractSmartLinkEmbe;
61
62
  let resolvedUrl = url;
62
63
  if (expValEquals('platform_hover_card_preview_panel', 'cohort', 'test')) {
63
64
  const responseUrl = response.data && 'url' in response.data ? response.data.url : undefined;
@@ -67,13 +68,16 @@ export const extractInvokePreviewAction = param => {
67
68
  ari: ari,
68
69
  url: resolvedUrl,
69
70
  name: name,
70
- iconUrl: undefined
71
+ iconUrl: undefined,
72
+ panelData: {
73
+ embedUrl: expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') ? (_extractSmartLinkEmbe = extractSmartLinkEmbed(response)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src : undefined
74
+ }
71
75
  });
72
76
  expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') && firePreviewActionUIEvent({
73
77
  previewType: 'panel'
74
78
  });
75
79
  } else {
76
- var _extractSmartLinkProv, _extractSmartLinkEmbe, _actionOptions$previe, _actionOptions$previe2;
80
+ var _extractSmartLinkProv, _extractSmartLinkEmbe2, _actionOptions$previe, _actionOptions$previe2;
77
81
  await openEmbedModal({
78
82
  fireEvent,
79
83
  extensionKey,
@@ -86,7 +90,7 @@ export const extractInvokePreviewAction = param => {
86
90
  providerName: (_extractSmartLinkProv = extractSmartLinkProvider(response)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text,
87
91
  onClose,
88
92
  origin,
89
- src: (_extractSmartLinkEmbe = extractSmartLinkEmbed(response)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src,
93
+ src: (_extractSmartLinkEmbe2 = extractSmartLinkEmbed(response)) === null || _extractSmartLinkEmbe2 === void 0 ? void 0 : _extractSmartLinkEmbe2.src,
90
94
  title: extractSmartLinkTitle(response),
91
95
  url,
92
96
  isBlanketHidden: fg('linking_platform_hide_preview_action_blanket_prop') ? actionOptions === null || actionOptions === void 0 ? void 0 : (_actionOptions$previe = actionOptions.previewAction) === null || _actionOptions$previe === void 0 ? void 0 : _actionOptions$previe.hideBlanket : undefined,
@@ -1,28 +1,16 @@
1
1
  import { useContext } from 'react';
2
- import FeatureGates from '@atlaskit/feature-gate-js-client';
3
2
  import { SmartCardContext } from '@atlaskit/link-provider';
4
- export const isSharePointDomain = href => {
3
+ const allowedHostnames = ['sharepoint.com', 'onedrive.live.com', 'docs.google.com', 'drive.google.com'];
4
+ export const shouldResolveUrl = href => {
5
5
  try {
6
6
  const hostname = new URL(href).hostname.toLowerCase();
7
- return hostname.includes('sharepoint.com') || hostname.includes('onedrive.live.com');
8
- } catch {
9
- return false;
10
- }
11
- };
12
- export const isGoogleDomain = href => {
13
- try {
14
- const hostname = new URL(href).hostname.toLowerCase();
15
- return hostname.includes('docs.google.com') || hostname.includes('drive.google.com');
7
+ return allowedHostnames.some(allowedHostname => hostname.includes(allowedHostname));
16
8
  } catch {
17
9
  return false;
18
10
  }
19
11
  };
20
12
  const useResolveHyperlinkValidator = (href = '') => {
21
13
  const hasSmartCardProvider = !!useContext(SmartCardContext);
22
- const isSharePointResolveEnabled = FeatureGates.getExperimentValue('platform_editor_resolve_hyperlinks_confluence', 'isEnabled', false) || FeatureGates.getExperimentValue('platform_editor_resolve_hyperlinks_jira', 'isEnabled', false);
23
- const isGoogleResolveEnabled = FeatureGates.getExperimentValue('platform_editor_resolve_google_hyperlinks', 'isEnabled', false);
24
- const shouldResolveSharePoint = isSharePointDomain(href) && isSharePointResolveEnabled;
25
- const shouldResolveGoogle = isGoogleDomain(href) && isGoogleResolveEnabled;
26
- return hasSmartCardProvider && (shouldResolveSharePoint || shouldResolveGoogle);
14
+ return hasSmartCardProvider && shouldResolveUrl(href);
27
15
  };
28
16
  export default useResolveHyperlinkValidator;
@@ -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: "0.0.0-development"
5
+ packageVersion: "43.1.0"
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,6 +1,8 @@
1
1
  import React, { useCallback, useEffect, useMemo } from 'react';
2
2
  import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
3
+ import { extractSmartLinkEmbed } from '@atlaskit/link-extractors';
3
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
6
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
7
  import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
6
8
  import { CardDisplay } from '../../constants';
@@ -112,13 +114,17 @@ function Component({
112
114
  if (!isModifierKeyPressed && ari && name && openPreviewPanel && isPreviewPanelAvailable !== null && isPreviewPanelAvailable !== void 0 && isPreviewPanelAvailable({
113
115
  ari
114
116
  }) && !isDisablePreviewPanel) {
117
+ var _extractSmartLinkEmbe;
115
118
  event.preventDefault();
116
119
  event.stopPropagation();
117
120
  openPreviewPanel({
118
121
  url,
119
122
  ari,
120
123
  name,
121
- iconUrl: getObjectIconUrl(state.details)
124
+ iconUrl: getObjectIconUrl(state.details),
125
+ panelData: {
126
+ embedUrl: expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') ? (_extractSmartLinkEmbe = extractSmartLinkEmbed(state.details)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src : undefined
127
+ }
122
128
  });
123
129
  fireLinkClickedEvent(createAnalyticsEvent)(event, {
124
130
  attributes: {
@@ -207,7 +207,7 @@ export const HoverCardComponent = ({
207
207
  }) => /*#__PURE__*/React.createElement("span", {
208
208
  ref: parentSpan
209
209
  }, /*#__PURE__*/React.createElement("span", _extends({}, triggerProps, {
210
- // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events, @atlassian/a11y/mouse-events-have-key-events
210
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
211
211
  onMouseOver: initShowCard
212
212
  // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
213
213
  ,
@@ -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: "0.0.0-development",
15
+ packageVersion: "43.1.0",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  const Anchor = withLinkClickedEvent('a');
@@ -60,7 +60,7 @@ export var extractInvokePreviewAction = function extractInvokePreviewAction(para
60
60
  invokeAction: {
61
61
  actionFn: function () {
62
62
  var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
63
- var resolvedUrl, responseUrl, _extractSmartLinkProv, _extractSmartLinkEmbe, _actionOptions$previe, _actionOptions$previe2;
63
+ var _extractSmartLinkEmbe, resolvedUrl, responseUrl, _extractSmartLinkProv, _extractSmartLinkEmbe2, _actionOptions$previe, _actionOptions$previe2;
64
64
  return _regeneratorRuntime.wrap(function _callee$(_context) {
65
65
  while (1) switch (_context.prev = _context.next) {
66
66
  case 0:
@@ -77,7 +77,10 @@ export var extractInvokePreviewAction = function extractInvokePreviewAction(para
77
77
  ari: ari,
78
78
  url: resolvedUrl,
79
79
  name: name,
80
- iconUrl: undefined
80
+ iconUrl: undefined,
81
+ panelData: {
82
+ embedUrl: expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') ? (_extractSmartLinkEmbe = extractSmartLinkEmbed(response)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src : undefined
83
+ }
81
84
  });
82
85
  expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') && firePreviewActionUIEvent({
83
86
  previewType: 'panel'
@@ -98,7 +101,7 @@ export var extractInvokePreviewAction = function extractInvokePreviewAction(para
98
101
  providerName: (_extractSmartLinkProv = extractSmartLinkProvider(response)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text,
99
102
  onClose: onClose,
100
103
  origin: origin,
101
- src: (_extractSmartLinkEmbe = extractSmartLinkEmbed(response)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src,
104
+ src: (_extractSmartLinkEmbe2 = extractSmartLinkEmbed(response)) === null || _extractSmartLinkEmbe2 === void 0 ? void 0 : _extractSmartLinkEmbe2.src,
102
105
  title: extractSmartLinkTitle(response),
103
106
  url: url,
104
107
  isBlanketHidden: fg('linking_platform_hide_preview_action_blanket_prop') ? actionOptions === null || actionOptions === void 0 || (_actionOptions$previe = actionOptions.previewAction) === null || _actionOptions$previe === void 0 ? void 0 : _actionOptions$previe.hideBlanket : undefined,
@@ -1,29 +1,19 @@
1
1
  import { useContext } from 'react';
2
- import FeatureGates from '@atlaskit/feature-gate-js-client';
3
2
  import { SmartCardContext } from '@atlaskit/link-provider';
4
- export var isSharePointDomain = function isSharePointDomain(href) {
3
+ var allowedHostnames = ['sharepoint.com', 'onedrive.live.com', 'docs.google.com', 'drive.google.com'];
4
+ export var shouldResolveUrl = function shouldResolveUrl(href) {
5
5
  try {
6
6
  var hostname = new URL(href).hostname.toLowerCase();
7
- return hostname.includes('sharepoint.com') || hostname.includes('onedrive.live.com');
7
+ return allowedHostnames.some(function (allowedHostname) {
8
+ return hostname.includes(allowedHostname);
9
+ });
8
10
  } catch (_unused) {
9
11
  return false;
10
12
  }
11
13
  };
12
- export var isGoogleDomain = function isGoogleDomain(href) {
13
- try {
14
- var hostname = new URL(href).hostname.toLowerCase();
15
- return hostname.includes('docs.google.com') || hostname.includes('drive.google.com');
16
- } catch (_unused2) {
17
- return false;
18
- }
19
- };
20
14
  var useResolveHyperlinkValidator = function useResolveHyperlinkValidator() {
21
15
  var href = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
22
16
  var hasSmartCardProvider = !!useContext(SmartCardContext);
23
- var isSharePointResolveEnabled = FeatureGates.getExperimentValue('platform_editor_resolve_hyperlinks_confluence', 'isEnabled', false) || FeatureGates.getExperimentValue('platform_editor_resolve_hyperlinks_jira', 'isEnabled', false);
24
- var isGoogleResolveEnabled = FeatureGates.getExperimentValue('platform_editor_resolve_google_hyperlinks', 'isEnabled', false);
25
- var shouldResolveSharePoint = isSharePointDomain(href) && isSharePointResolveEnabled;
26
- var shouldResolveGoogle = isGoogleDomain(href) && isGoogleResolveEnabled;
27
- return hasSmartCardProvider && (shouldResolveSharePoint || shouldResolveGoogle);
17
+ return hasSmartCardProvider && shouldResolveUrl(href);
28
18
  };
29
19
  export default useResolveHyperlinkValidator;
@@ -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: "0.0.0-development"
7
+ packageVersion: "43.1.0"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,6 +1,8 @@
1
1
  import React, { useCallback, useEffect, useMemo } from 'react';
2
2
  import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
3
+ import { extractSmartLinkEmbed } from '@atlaskit/link-extractors';
3
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
6
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
7
  import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
6
8
  import { CardDisplay } from '../../constants';
@@ -112,13 +114,17 @@ function Component(_ref) {
112
114
  if (!isModifierKeyPressed && ari && name && openPreviewPanel && isPreviewPanelAvailable !== null && isPreviewPanelAvailable !== void 0 && isPreviewPanelAvailable({
113
115
  ari: ari
114
116
  }) && !isDisablePreviewPanel) {
117
+ var _extractSmartLinkEmbe;
115
118
  event.preventDefault();
116
119
  event.stopPropagation();
117
120
  openPreviewPanel({
118
121
  url: url,
119
122
  ari: ari,
120
123
  name: name,
121
- iconUrl: getObjectIconUrl(state.details)
124
+ iconUrl: getObjectIconUrl(state.details),
125
+ panelData: {
126
+ embedUrl: expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') ? (_extractSmartLinkEmbe = extractSmartLinkEmbed(state.details)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src : undefined
127
+ }
122
128
  });
123
129
  fireLinkClickedEvent(createAnalyticsEvent)(event, {
124
130
  attributes: {
@@ -221,7 +221,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
221
221
  return /*#__PURE__*/React.createElement("span", {
222
222
  ref: parentSpan
223
223
  }, /*#__PURE__*/React.createElement("span", _extends({}, triggerProps, {
224
- // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events, @atlassian/a11y/mouse-events-have-key-events
224
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
225
225
  onMouseOver: initShowCard
226
226
  // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
227
227
  ,
@@ -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: "0.0.0-development",
18
+ packageVersion: "43.1.0",
19
19
  componentName: 'linkUrl'
20
20
  };
21
21
  var Anchor = withLinkClickedEvent('a');
@@ -13,6 +13,9 @@ export type ExtractInvokePreviewActionParam = ExtractClientActionsParam & {
13
13
  ari: string;
14
14
  iconUrl: string | undefined;
15
15
  name: string;
16
+ panelData: {
17
+ embedUrl?: string;
18
+ };
16
19
  url: string;
17
20
  }) => void;
18
21
  origin?: AnalyticsOrigin;
@@ -17,6 +17,9 @@ export type ExtractActionsParam = {
17
17
  ari: string;
18
18
  iconUrl: string | undefined;
19
19
  name: string;
20
+ panelData: {
21
+ embedUrl?: string;
22
+ };
20
23
  url: string;
21
24
  }) => void;
22
25
  origin?: AnalyticsOrigin;
@@ -10,6 +10,9 @@ declare const extractState: (response?: JsonLd.Response, actionOptions?: CardAct
10
10
  ari: string;
11
11
  iconUrl: string | undefined;
12
12
  name: string;
13
+ panelData: {
14
+ embedUrl?: string;
15
+ };
13
16
  url: string;
14
17
  }) => void) => LinkLozenge | undefined;
15
18
  export default extractState;
@@ -1,4 +1,3 @@
1
- export declare const isSharePointDomain: (href: string) => boolean;
2
- export declare const isGoogleDomain: (href: string) => boolean;
1
+ export declare const shouldResolveUrl: (href: string) => boolean;
3
2
  declare const useResolveHyperlinkValidator: (href?: string) => boolean;
4
3
  export default useResolveHyperlinkValidator;
@@ -17,6 +17,9 @@ export declare function useSmartLink(id: string, url: string): {
17
17
  ari: string;
18
18
  iconUrl: string | undefined;
19
19
  name: string;
20
+ panelData: {
21
+ embedUrl?: string;
22
+ };
20
23
  url: string;
21
24
  }) => void) | undefined;
22
25
  };
@@ -176,6 +176,9 @@ export type ExtractFlexibleUiDataContextParams = Pick<FlexibleCardProps, 'appear
176
176
  ari: string;
177
177
  iconUrl: string | undefined;
178
178
  name: string;
179
+ panelData: {
180
+ embedUrl?: string;
181
+ };
179
182
  url: string;
180
183
  }) => void;
181
184
  resolve?: ResolveFunction;
@@ -13,6 +13,9 @@ export type ExtractInvokePreviewActionParam = ExtractClientActionsParam & {
13
13
  ari: string;
14
14
  iconUrl: string | undefined;
15
15
  name: string;
16
+ panelData: {
17
+ embedUrl?: string;
18
+ };
16
19
  url: string;
17
20
  }) => void;
18
21
  origin?: AnalyticsOrigin;
@@ -17,6 +17,9 @@ export type ExtractActionsParam = {
17
17
  ari: string;
18
18
  iconUrl: string | undefined;
19
19
  name: string;
20
+ panelData: {
21
+ embedUrl?: string;
22
+ };
20
23
  url: string;
21
24
  }) => void;
22
25
  origin?: AnalyticsOrigin;
@@ -10,6 +10,9 @@ declare const extractState: (response?: JsonLd.Response, actionOptions?: CardAct
10
10
  ari: string;
11
11
  iconUrl: string | undefined;
12
12
  name: string;
13
+ panelData: {
14
+ embedUrl?: string;
15
+ };
13
16
  url: string;
14
17
  }) => void) => LinkLozenge | undefined;
15
18
  export default extractState;
@@ -1,4 +1,3 @@
1
- export declare const isSharePointDomain: (href: string) => boolean;
2
- export declare const isGoogleDomain: (href: string) => boolean;
1
+ export declare const shouldResolveUrl: (href: string) => boolean;
3
2
  declare const useResolveHyperlinkValidator: (href?: string) => boolean;
4
3
  export default useResolveHyperlinkValidator;
@@ -17,6 +17,9 @@ export declare function useSmartLink(id: string, url: string): {
17
17
  ari: string;
18
18
  iconUrl: string | undefined;
19
19
  name: string;
20
+ panelData: {
21
+ embedUrl?: string;
22
+ };
20
23
  url: string;
21
24
  }) => void) | undefined;
22
25
  };
@@ -176,6 +176,9 @@ export type ExtractFlexibleUiDataContextParams = Pick<FlexibleCardProps, 'appear
176
176
  ari: string;
177
177
  iconUrl: string | undefined;
178
178
  name: string;
179
+ panelData: {
180
+ embedUrl?: string;
181
+ };
179
182
  url: string;
180
183
  }) => void;
181
184
  resolve?: ResolveFunction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "43.0.2",
3
+ "version": "43.1.1",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -59,7 +59,7 @@
59
59
  "@atlaskit/logo": "^19.9.0",
60
60
  "@atlaskit/lozenge": "^13.0.0",
61
61
  "@atlaskit/menu": "^8.4.0",
62
- "@atlaskit/modal-dialog": "^14.4.0",
62
+ "@atlaskit/modal-dialog": "^14.5.0",
63
63
  "@atlaskit/outbound-auth-flow-client": "^3.4.0",
64
64
  "@atlaskit/platform-feature-flags": "^1.1.0",
65
65
  "@atlaskit/popup": "^4.4.0",
@@ -70,7 +70,7 @@
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.5.0",
73
+ "@atlaskit/tmp-editor-statsig": "^13.6.0",
74
74
  "@atlaskit/tokens": "^6.4.0",
75
75
  "@atlaskit/tooltip": "^20.5.0",
76
76
  "@atlaskit/ufo": "^0.4.0",