@atlaskit/smart-card 43.5.2 → 43.6.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 +11 -0
- package/compass.yml +3 -0
- package/dist/cjs/extractors/action/extract-invoke-preview-action.js +11 -6
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/EmbedModal/utils.js +3 -21
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/action/extract-invoke-preview-action.js +9 -4
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/EmbedModal/utils.js +0 -12
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/action/extract-invoke-preview-action.js +9 -4
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/EmbedModal/utils.js +3 -21
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/package.json +3 -6
- package/dist/cjs/utils/iframe-utils.js +0 -40
- package/dist/es2019/utils/iframe-utils.js +0 -34
- package/dist/esm/utils/iframe-utils.js +0 -34
- package/dist/types/utils/iframe-utils.d.ts +0 -5
- package/dist/types-ts4.5/utils/iframe-utils.d.ts +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 43.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`e5c510a42227e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e5c510a42227e) -
|
|
8
|
+
[ux] Disable preview modals within preview panels
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 43.5.2
|
|
4
15
|
|
|
5
16
|
### 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
|
|
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,
|
|
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,
|
|
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
|
};
|
|
@@ -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: "
|
|
14
|
+
packageVersion: "0.0.0-development"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -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 =
|
|
58
|
+
_context2.next = 6;
|
|
77
59
|
return Promise.resolve().then(function () {
|
|
78
60
|
return _interopRequireWildcard(require('./index'));
|
|
79
61
|
});
|
|
80
|
-
case
|
|
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
|
|
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: "
|
|
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') &&
|
|
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
|
};
|
|
@@ -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: "
|
|
5
|
+
packageVersion: "0.0.0-development"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -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: "
|
|
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') &&
|
|
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
|
};
|
|
@@ -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: "
|
|
7
|
+
packageVersion: "0.0.0-development"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -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 =
|
|
49
|
+
_context2.next = 6;
|
|
68
50
|
return import('./index');
|
|
69
|
-
case
|
|
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
|
|
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: "
|
|
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.
|
|
3
|
+
"version": "43.6.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -54,7 +54,7 @@
|
|
|
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.
|
|
57
|
+
"@atlaskit/linking-common": "^9.8.0",
|
|
58
58
|
"@atlaskit/linking-types": "^14.1.0",
|
|
59
59
|
"@atlaskit/logo": "^19.9.0",
|
|
60
60
|
"@atlaskit/lozenge": "^13.0.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.
|
|
73
|
+
"@atlaskit/tmp-editor-statsig": "^13.28.0",
|
|
74
74
|
"@atlaskit/tokens": "^7.1.0",
|
|
75
75
|
"@atlaskit/tooltip": "^20.7.0",
|
|
76
76
|
"@atlaskit/ufo": "^0.4.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;
|