@atlaskit/smart-card 43.0.2 → 43.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 43.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`6b08c3a8cde08`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6b08c3a8cde08) -
8
+ Construct confluence url from smart card embed preview href when smart card url is short
9
+ confluence url, in the form "{host}/wiki/x/{hash}"
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 43.0.2
4
16
 
5
17
  ### 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,
@@ -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: {
@@ -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,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: {
@@ -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,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: {
@@ -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;
@@ -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;
@@ -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.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -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",