@atlaskit/smart-card 26.14.0 → 26.14.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.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/EmbedModal/utils.js +30 -56
- package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +1 -2
- package/dist/cjs/view/FlexibleCard/components/utils.js +37 -2
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/EmbedModal/utils.js +14 -46
- package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +2 -2
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +2 -3
- package/dist/es2019/view/FlexibleCard/components/utils.js +35 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/EmbedModal/utils.js +29 -53
- package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +2 -2
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +2 -3
- package/dist/esm/view/FlexibleCard/components/utils.js +34 -0
- package/dist/types/view/EmbedModal/utils.d.ts +2 -10
- package/dist/types/view/FlexibleCard/components/actions/action/preview-action/types.d.ts +0 -4
- package/dist/types/view/FlexibleCard/components/utils.d.ts +64 -0
- package/dist/types-ts4.5/view/EmbedModal/utils.d.ts +2 -10
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/preview-action/types.d.ts +0 -4
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +64 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/version.json
CHANGED
|
@@ -5,53 +5,19 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
9
|
-
exports.previewFunction = previewFunction;
|
|
8
|
+
exports.openEmbedModal = openEmbedModal;
|
|
10
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
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
|
|
18
|
-
var _constants = require("../../constants");
|
|
19
|
-
var _excluded = ["popupMountPointId", "onClose"];
|
|
16
|
+
var _excluded = ["onClose"];
|
|
20
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
download = _ref.downloadUrl,
|
|
25
|
-
isSupportTheming = _ref.isSupportTheming,
|
|
26
|
-
linkIcon = _ref.linkIcon,
|
|
27
|
-
_ref$onClose = _ref.onClose,
|
|
28
|
-
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
|
|
29
|
-
providerName = _ref.providerName,
|
|
30
|
-
src = _ref.src,
|
|
31
|
-
title = _ref.title,
|
|
32
|
-
url = _ref.url;
|
|
33
|
-
var EmbedIcon = {
|
|
34
|
-
icon: /*#__PURE__*/_react.default.createElement(_icon.default, (0, _extends2.default)({}, linkIcon, {
|
|
35
|
-
size: _constants.SmartLinkSize.Large
|
|
36
|
-
})),
|
|
37
|
-
isFlexibleUi: true
|
|
38
|
-
};
|
|
39
|
-
return previewFunction({
|
|
40
|
-
popupMountPointId: 'twp-editor-preview-iframe',
|
|
41
|
-
showModal: true,
|
|
42
|
-
iframeName: 'twp-editor-preview-iframe',
|
|
43
|
-
onClose: onClose,
|
|
44
|
-
download: download,
|
|
45
|
-
icon: EmbedIcon,
|
|
46
|
-
providerName: providerName || 'Preview',
|
|
47
|
-
src: src,
|
|
48
|
-
title: title,
|
|
49
|
-
url: url,
|
|
50
|
-
analytics: analytics,
|
|
51
|
-
origin: 'smartLinkCard',
|
|
52
|
-
isSupportTheming: isSupportTheming
|
|
53
|
-
});
|
|
54
|
-
};
|
|
19
|
+
var IFRAME_NAME = 'twp-editor-preview-iframe';
|
|
20
|
+
var POPUP_MOUNT_POINT_ID = 'twp-editor-preview-iframe';
|
|
55
21
|
|
|
56
22
|
/*
|
|
57
23
|
Explanatory note:
|
|
@@ -66,47 +32,55 @@ var openPreviewModal = function openPreviewModal(_ref) {
|
|
|
66
32
|
you find an elegant solution around this, you should definitely feel free to
|
|
67
33
|
refactor it.
|
|
68
34
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return _previewFunction.apply(this, arguments);
|
|
35
|
+
function openEmbedModal() {
|
|
36
|
+
return _openEmbedModal.apply(this, arguments);
|
|
72
37
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
75
|
-
var
|
|
38
|
+
function _openEmbedModal() {
|
|
39
|
+
_openEmbedModal = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
40
|
+
var _ref,
|
|
41
|
+
_ref$onClose,
|
|
42
|
+
_onClose,
|
|
43
|
+
props,
|
|
44
|
+
popupMountPoint,
|
|
45
|
+
Modal,
|
|
46
|
+
_args = arguments;
|
|
76
47
|
return _regenerator.default.wrap(function _callee$(_context2) {
|
|
77
48
|
while (1) switch (_context2.prev = _context2.next) {
|
|
78
49
|
case 0:
|
|
79
|
-
|
|
80
|
-
|
|
50
|
+
_ref = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
51
|
+
_ref$onClose = _ref.onClose, _onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose, props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
52
|
+
popupMountPoint = document.getElementById(POPUP_MOUNT_POINT_ID);
|
|
81
53
|
if (!popupMountPoint) {
|
|
82
54
|
popupMountPoint = document.createElement('div');
|
|
83
|
-
popupMountPoint.id =
|
|
55
|
+
popupMountPoint.id = POPUP_MOUNT_POINT_ID;
|
|
84
56
|
popupMountPoint.setAttribute('data-testid', 'preview-modal');
|
|
85
57
|
document.body.appendChild(popupMountPoint);
|
|
86
58
|
}
|
|
87
|
-
_context2.next =
|
|
59
|
+
_context2.next = 6;
|
|
88
60
|
return Promise.resolve().then(function () {
|
|
89
61
|
return _interopRequireWildcard(require('./index'));
|
|
90
62
|
});
|
|
91
|
-
case
|
|
63
|
+
case 6:
|
|
92
64
|
Modal = _context2.sent;
|
|
93
65
|
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_reactIntlNext.IntlProvider, {
|
|
94
66
|
locale: "en"
|
|
95
|
-
}, /*#__PURE__*/_react.default.createElement(Modal.default, (0, _extends2.default)({},
|
|
67
|
+
}, /*#__PURE__*/_react.default.createElement(Modal.default, (0, _extends2.default)({}, props, {
|
|
68
|
+
iframeName: IFRAME_NAME,
|
|
96
69
|
onClose: function onClose(_context) {
|
|
97
70
|
if (popupMountPoint) {
|
|
98
71
|
_reactDom.default.unmountComponentAtNode(popupMountPoint);
|
|
99
72
|
}
|
|
100
|
-
if (
|
|
101
|
-
|
|
73
|
+
if (_onClose) {
|
|
74
|
+
_onClose(_context);
|
|
102
75
|
}
|
|
103
|
-
}
|
|
76
|
+
},
|
|
77
|
+
showModal: true
|
|
104
78
|
}))), popupMountPoint);
|
|
105
|
-
case
|
|
79
|
+
case 8:
|
|
106
80
|
case "end":
|
|
107
81
|
return _context2.stop();
|
|
108
82
|
}
|
|
109
83
|
}, _callee);
|
|
110
84
|
}));
|
|
111
|
-
return
|
|
85
|
+
return _openEmbedModal.apply(this, arguments);
|
|
112
86
|
}
|
|
@@ -11,10 +11,10 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
var _index = _interopRequireDefault(require("../index"));
|
|
12
12
|
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
13
13
|
var _state = require("../../../../../../state");
|
|
14
|
-
var _utils = require("../../../../../EmbedModal/utils");
|
|
15
14
|
var _reactIntlNext = require("react-intl-next");
|
|
16
15
|
var _messages = require("../../../../../../messages");
|
|
17
16
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
17
|
+
var _utils = require("../../../utils");
|
|
18
18
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
19
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
20
|
var PreviewAction = function PreviewAction(props) {
|
|
@@ -35,7 +35,7 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
35
35
|
var previewText = enableImprovedPreviewAction ? _messages.messages.preview_improved : _messages.messages.preview;
|
|
36
36
|
if (src && url) {
|
|
37
37
|
var embedModal = function embedModal() {
|
|
38
|
-
return (0, _utils.
|
|
38
|
+
return (0, _utils.openEmbedModalWithFlexibleUiIcon)({
|
|
39
39
|
title: title,
|
|
40
40
|
providerName: providerName,
|
|
41
41
|
downloadUrl: downloadUrl,
|
|
@@ -16,7 +16,6 @@ var _styled = require("./styled");
|
|
|
16
16
|
var _utils = require("../../../../utils");
|
|
17
17
|
var _messages = require("../../../../../../../messages");
|
|
18
18
|
var _flexibleUiContext = require("../../../../../../../state/flexible-ui-context");
|
|
19
|
-
var _utils2 = require("../../../../../../EmbedModal/utils");
|
|
20
19
|
var _useResolve = _interopRequireDefault(require("../../../../../../../state/hooks/use-resolve"));
|
|
21
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /** @jsx jsx */
|
|
@@ -39,7 +38,7 @@ var LozengeActionError = function LozengeActionError(_ref) {
|
|
|
39
38
|
var handlePreviewOpen = (0, _react2.useCallback)(function () {
|
|
40
39
|
if (isPreviewAvailable) {
|
|
41
40
|
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkLozengeActionErrorOpenPreviewClickedEvent();
|
|
42
|
-
return (0,
|
|
41
|
+
return (0, _utils.openEmbedModalWithFlexibleUiIcon)(_objectSpread(_objectSpread({}, previewData), {}, {
|
|
43
42
|
analytics: analytics,
|
|
44
43
|
onClose: handlePreviewClose
|
|
45
44
|
}));
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.sizeToButtonSpacing = exports.hasWhiteSpace = exports.getTruncateStyles = exports.getMaxLines = exports.getMaxLineHeight = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconWidth = exports.getIconSizeStyles = exports.getFormattedMessage = void 0;
|
|
7
|
+
exports.sizeToButtonSpacing = exports.openEmbedModalWithFlexibleUiIcon = exports.hasWhiteSpace = exports.getTruncateStyles = exports.getMaxLines = exports.getMaxLineHeight = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconWidth = exports.getIconSizeStyles = exports.getFormattedMessage = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -12,6 +12,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
13
|
var _reactIntlNext = require("react-intl-next");
|
|
14
14
|
var _constants = require("../../../constants");
|
|
15
|
+
var _icon = _interopRequireDefault(require("./elements/icon"));
|
|
16
|
+
var _utils = require("../../EmbedModal/utils");
|
|
15
17
|
var _sizeToButtonSpacing, _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
16
18
|
var sizeToButtonSpacing = (_sizeToButtonSpacing = {}, (0, _defineProperty2.default)(_sizeToButtonSpacing, _constants.SmartLinkSize.Small, 'none'), (0, _defineProperty2.default)(_sizeToButtonSpacing, _constants.SmartLinkSize.Medium, 'compact'), (0, _defineProperty2.default)(_sizeToButtonSpacing, _constants.SmartLinkSize.Large, 'compact'), (0, _defineProperty2.default)(_sizeToButtonSpacing, _constants.SmartLinkSize.XLarge, 'default'), _sizeToButtonSpacing);
|
|
17
19
|
exports.sizeToButtonSpacing = sizeToButtonSpacing;
|
|
@@ -105,4 +107,37 @@ exports.getTruncateStyles = getTruncateStyles;
|
|
|
105
107
|
var hasWhiteSpace = function hasWhiteSpace(str) {
|
|
106
108
|
return str.search(/\s/) >= 0;
|
|
107
109
|
};
|
|
108
|
-
exports.hasWhiteSpace = hasWhiteSpace;
|
|
110
|
+
exports.hasWhiteSpace = hasWhiteSpace;
|
|
111
|
+
var openEmbedModalWithFlexibleUiIcon = function openEmbedModalWithFlexibleUiIcon(_ref) {
|
|
112
|
+
var analytics = _ref.analytics,
|
|
113
|
+
downloadUrl = _ref.downloadUrl,
|
|
114
|
+
linkIcon = _ref.linkIcon,
|
|
115
|
+
onClose = _ref.onClose,
|
|
116
|
+
providerName = _ref.providerName,
|
|
117
|
+
src = _ref.src,
|
|
118
|
+
title = _ref.title,
|
|
119
|
+
url = _ref.url,
|
|
120
|
+
isSupportTheming = _ref.isSupportTheming;
|
|
121
|
+
var icon = {
|
|
122
|
+
icon: /*#__PURE__*/_react.default.createElement(_icon.default, (0, _extends2.default)({}, linkIcon, {
|
|
123
|
+
size: _constants.SmartLinkSize.Large
|
|
124
|
+
})),
|
|
125
|
+
isFlexibleUi: true
|
|
126
|
+
};
|
|
127
|
+
return (0, _utils.openEmbedModal)({
|
|
128
|
+
analytics: analytics,
|
|
129
|
+
download: downloadUrl,
|
|
130
|
+
icon: icon,
|
|
131
|
+
// Flex should not send origin as block card. It should be able to support
|
|
132
|
+
// its internal parent components like hover card, block card and
|
|
133
|
+
// itself as a standalone. To be investigated and fix in EDM-7520.
|
|
134
|
+
origin: 'smartLinkCard',
|
|
135
|
+
providerName: providerName,
|
|
136
|
+
onClose: onClose,
|
|
137
|
+
src: src,
|
|
138
|
+
title: title,
|
|
139
|
+
url: url,
|
|
140
|
+
isSupportTheming: isSupportTheming
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
exports.openEmbedModalWithFlexibleUiIcon = openEmbedModalWithFlexibleUiIcon;
|
package/dist/es2019/version.json
CHANGED
|
@@ -2,41 +2,8 @@ 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
|
-
|
|
6
|
-
|
|
7
|
-
export const openPreviewModal = ({
|
|
8
|
-
analytics,
|
|
9
|
-
downloadUrl: download,
|
|
10
|
-
isSupportTheming,
|
|
11
|
-
linkIcon,
|
|
12
|
-
onClose = () => {},
|
|
13
|
-
providerName,
|
|
14
|
-
src,
|
|
15
|
-
title,
|
|
16
|
-
url
|
|
17
|
-
}) => {
|
|
18
|
-
const EmbedIcon = {
|
|
19
|
-
icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
|
|
20
|
-
size: SmartLinkSize.Large
|
|
21
|
-
})),
|
|
22
|
-
isFlexibleUi: true
|
|
23
|
-
};
|
|
24
|
-
return previewFunction({
|
|
25
|
-
popupMountPointId: 'twp-editor-preview-iframe',
|
|
26
|
-
showModal: true,
|
|
27
|
-
iframeName: 'twp-editor-preview-iframe',
|
|
28
|
-
onClose,
|
|
29
|
-
download,
|
|
30
|
-
icon: EmbedIcon,
|
|
31
|
-
providerName: providerName || 'Preview',
|
|
32
|
-
src,
|
|
33
|
-
title,
|
|
34
|
-
url,
|
|
35
|
-
analytics,
|
|
36
|
-
origin: 'smartLinkCard',
|
|
37
|
-
isSupportTheming
|
|
38
|
-
});
|
|
39
|
-
};
|
|
5
|
+
const IFRAME_NAME = 'twp-editor-preview-iframe';
|
|
6
|
+
const POPUP_MOUNT_POINT_ID = 'twp-editor-preview-iframe';
|
|
40
7
|
|
|
41
8
|
/*
|
|
42
9
|
Explanatory note:
|
|
@@ -51,30 +18,31 @@ export const openPreviewModal = ({
|
|
|
51
18
|
you find an elegant solution around this, you should definitely feel free to
|
|
52
19
|
refactor it.
|
|
53
20
|
*/
|
|
54
|
-
export async function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}) {
|
|
21
|
+
export async function openEmbedModal({
|
|
22
|
+
onClose = () => {},
|
|
23
|
+
...props
|
|
24
|
+
} = {}) {
|
|
59
25
|
let popupMountPoint;
|
|
60
|
-
popupMountPoint = document.getElementById(
|
|
26
|
+
popupMountPoint = document.getElementById(POPUP_MOUNT_POINT_ID);
|
|
61
27
|
if (!popupMountPoint) {
|
|
62
28
|
popupMountPoint = document.createElement('div');
|
|
63
|
-
popupMountPoint.id =
|
|
29
|
+
popupMountPoint.id = POPUP_MOUNT_POINT_ID;
|
|
64
30
|
popupMountPoint.setAttribute('data-testid', 'preview-modal');
|
|
65
31
|
document.body.appendChild(popupMountPoint);
|
|
66
32
|
}
|
|
67
33
|
let Modal = await import('./index');
|
|
68
34
|
ReactDOM.render( /*#__PURE__*/React.createElement(IntlProvider, {
|
|
69
35
|
locale: "en"
|
|
70
|
-
}, /*#__PURE__*/React.createElement(Modal.default, _extends({},
|
|
36
|
+
}, /*#__PURE__*/React.createElement(Modal.default, _extends({}, props, {
|
|
37
|
+
iframeName: IFRAME_NAME,
|
|
71
38
|
onClose: _context => {
|
|
72
39
|
if (popupMountPoint) {
|
|
73
40
|
ReactDOM.unmountComponentAtNode(popupMountPoint);
|
|
74
41
|
}
|
|
75
|
-
if (
|
|
76
|
-
|
|
42
|
+
if (onClose) {
|
|
43
|
+
onClose(_context);
|
|
77
44
|
}
|
|
78
|
-
}
|
|
45
|
+
},
|
|
46
|
+
showModal: true
|
|
79
47
|
}))), popupMountPoint);
|
|
80
48
|
}
|
|
@@ -3,10 +3,10 @@ import React from 'react';
|
|
|
3
3
|
import Action from '../index';
|
|
4
4
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
5
5
|
import { useSmartLinkAnalytics } from '../../../../../../state';
|
|
6
|
-
import { openPreviewModal } from '../../../../../EmbedModal/utils';
|
|
7
6
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
7
|
import { messages } from '../../../../../../messages';
|
|
9
8
|
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
9
|
+
import { openEmbedModalWithFlexibleUiIcon } from '../../../utils';
|
|
10
10
|
const PreviewAction = props => {
|
|
11
11
|
const {
|
|
12
12
|
appearance,
|
|
@@ -26,7 +26,7 @@ const PreviewAction = props => {
|
|
|
26
26
|
const enableImprovedPreviewAction = Boolean(useFeatureFlag('enableImprovedPreviewAction'));
|
|
27
27
|
const previewText = enableImprovedPreviewAction ? messages.preview_improved : messages.preview;
|
|
28
28
|
if (src && url) {
|
|
29
|
-
const embedModal = () =>
|
|
29
|
+
const embedModal = () => openEmbedModalWithFlexibleUiIcon({
|
|
30
30
|
title,
|
|
31
31
|
providerName,
|
|
32
32
|
downloadUrl,
|
|
@@ -6,10 +6,9 @@ import { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
|
6
6
|
import { R50, R500 } from '@atlaskit/theme/colors';
|
|
7
7
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
8
8
|
import { dropdownItemGroupStyles, contentStyles, linkStyles, textStyles } from './styled';
|
|
9
|
-
import { getFormattedMessage } from '../../../../utils';
|
|
9
|
+
import { getFormattedMessage, openEmbedModalWithFlexibleUiIcon } from '../../../../utils';
|
|
10
10
|
import { messages } from '../../../../../../../messages';
|
|
11
11
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../../state/flexible-ui-context';
|
|
12
|
-
import { openPreviewModal } from '../../../../../../EmbedModal/utils';
|
|
13
12
|
import useResolve from '../../../../../../../state/hooks/use-resolve';
|
|
14
13
|
const MAX_LINE_NUMBER = 8;
|
|
15
14
|
const LozengeActionError = ({
|
|
@@ -30,7 +29,7 @@ const LozengeActionError = ({
|
|
|
30
29
|
const handlePreviewOpen = useCallback(() => {
|
|
31
30
|
if (isPreviewAvailable) {
|
|
32
31
|
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkLozengeActionErrorOpenPreviewClickedEvent();
|
|
33
|
-
return
|
|
32
|
+
return openEmbedModalWithFlexibleUiIcon({
|
|
34
33
|
...previewData,
|
|
35
34
|
analytics,
|
|
36
35
|
onClose: handlePreviewClose
|
|
@@ -3,6 +3,8 @@ import React from 'react';
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
5
5
|
import { SmartLinkSize } from '../../../constants';
|
|
6
|
+
import Icon from './elements/icon';
|
|
7
|
+
import { openEmbedModal } from '../../EmbedModal/utils';
|
|
6
8
|
export const sizeToButtonSpacing = {
|
|
7
9
|
[SmartLinkSize.Small]: 'none',
|
|
8
10
|
[SmartLinkSize.Medium]: 'compact',
|
|
@@ -130,4 +132,37 @@ export const getTruncateStyles = (maxLines, lineHeight = '1rem', wordBreak = 'br
|
|
|
130
132
|
`;
|
|
131
133
|
export const hasWhiteSpace = str => {
|
|
132
134
|
return str.search(/\s/) >= 0;
|
|
135
|
+
};
|
|
136
|
+
export const openEmbedModalWithFlexibleUiIcon = ({
|
|
137
|
+
analytics,
|
|
138
|
+
downloadUrl,
|
|
139
|
+
linkIcon,
|
|
140
|
+
onClose,
|
|
141
|
+
providerName,
|
|
142
|
+
src,
|
|
143
|
+
title,
|
|
144
|
+
url,
|
|
145
|
+
isSupportTheming
|
|
146
|
+
}) => {
|
|
147
|
+
const icon = {
|
|
148
|
+
icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
|
|
149
|
+
size: SmartLinkSize.Large
|
|
150
|
+
})),
|
|
151
|
+
isFlexibleUi: true
|
|
152
|
+
};
|
|
153
|
+
return openEmbedModal({
|
|
154
|
+
analytics,
|
|
155
|
+
download: downloadUrl,
|
|
156
|
+
icon,
|
|
157
|
+
// Flex should not send origin as block card. It should be able to support
|
|
158
|
+
// its internal parent components like hover card, block card and
|
|
159
|
+
// itself as a standalone. To be investigated and fix in EDM-7520.
|
|
160
|
+
origin: 'smartLinkCard',
|
|
161
|
+
providerName,
|
|
162
|
+
onClose,
|
|
163
|
+
src,
|
|
164
|
+
title,
|
|
165
|
+
url,
|
|
166
|
+
isSupportTheming
|
|
167
|
+
});
|
|
133
168
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -1,46 +1,13 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
|
|
4
|
-
var _excluded = ["popupMountPointId", "onClose"];
|
|
4
|
+
var _excluded = ["onClose"];
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import ReactDOM from 'react-dom';
|
|
8
8
|
import { IntlProvider } from 'react-intl-next';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export var openPreviewModal = function openPreviewModal(_ref) {
|
|
12
|
-
var analytics = _ref.analytics,
|
|
13
|
-
download = _ref.downloadUrl,
|
|
14
|
-
isSupportTheming = _ref.isSupportTheming,
|
|
15
|
-
linkIcon = _ref.linkIcon,
|
|
16
|
-
_ref$onClose = _ref.onClose,
|
|
17
|
-
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
|
|
18
|
-
providerName = _ref.providerName,
|
|
19
|
-
src = _ref.src,
|
|
20
|
-
title = _ref.title,
|
|
21
|
-
url = _ref.url;
|
|
22
|
-
var EmbedIcon = {
|
|
23
|
-
icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
|
|
24
|
-
size: SmartLinkSize.Large
|
|
25
|
-
})),
|
|
26
|
-
isFlexibleUi: true
|
|
27
|
-
};
|
|
28
|
-
return previewFunction({
|
|
29
|
-
popupMountPointId: 'twp-editor-preview-iframe',
|
|
30
|
-
showModal: true,
|
|
31
|
-
iframeName: 'twp-editor-preview-iframe',
|
|
32
|
-
onClose: onClose,
|
|
33
|
-
download: download,
|
|
34
|
-
icon: EmbedIcon,
|
|
35
|
-
providerName: providerName || 'Preview',
|
|
36
|
-
src: src,
|
|
37
|
-
title: title,
|
|
38
|
-
url: url,
|
|
39
|
-
analytics: analytics,
|
|
40
|
-
origin: 'smartLinkCard',
|
|
41
|
-
isSupportTheming: isSupportTheming
|
|
42
|
-
});
|
|
43
|
-
};
|
|
9
|
+
var IFRAME_NAME = 'twp-editor-preview-iframe';
|
|
10
|
+
var POPUP_MOUNT_POINT_ID = 'twp-editor-preview-iframe';
|
|
44
11
|
|
|
45
12
|
/*
|
|
46
13
|
Explanatory note:
|
|
@@ -55,44 +22,53 @@ export var openPreviewModal = function openPreviewModal(_ref) {
|
|
|
55
22
|
you find an elegant solution around this, you should definitely feel free to
|
|
56
23
|
refactor it.
|
|
57
24
|
*/
|
|
58
|
-
export function
|
|
59
|
-
return
|
|
25
|
+
export function openEmbedModal() {
|
|
26
|
+
return _openEmbedModal.apply(this, arguments);
|
|
60
27
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
var
|
|
28
|
+
function _openEmbedModal() {
|
|
29
|
+
_openEmbedModal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
30
|
+
var _ref,
|
|
31
|
+
_ref$onClose,
|
|
32
|
+
_onClose,
|
|
33
|
+
props,
|
|
34
|
+
popupMountPoint,
|
|
35
|
+
Modal,
|
|
36
|
+
_args = arguments;
|
|
64
37
|
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
65
38
|
while (1) switch (_context2.prev = _context2.next) {
|
|
66
39
|
case 0:
|
|
67
|
-
|
|
68
|
-
|
|
40
|
+
_ref = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
41
|
+
_ref$onClose = _ref.onClose, _onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose, props = _objectWithoutProperties(_ref, _excluded);
|
|
42
|
+
popupMountPoint = document.getElementById(POPUP_MOUNT_POINT_ID);
|
|
69
43
|
if (!popupMountPoint) {
|
|
70
44
|
popupMountPoint = document.createElement('div');
|
|
71
|
-
popupMountPoint.id =
|
|
45
|
+
popupMountPoint.id = POPUP_MOUNT_POINT_ID;
|
|
72
46
|
popupMountPoint.setAttribute('data-testid', 'preview-modal');
|
|
73
47
|
document.body.appendChild(popupMountPoint);
|
|
74
48
|
}
|
|
75
|
-
_context2.next =
|
|
49
|
+
_context2.next = 6;
|
|
76
50
|
return import('./index');
|
|
77
|
-
case
|
|
51
|
+
case 6:
|
|
78
52
|
Modal = _context2.sent;
|
|
79
53
|
ReactDOM.render( /*#__PURE__*/React.createElement(IntlProvider, {
|
|
80
54
|
locale: "en"
|
|
81
|
-
}, /*#__PURE__*/React.createElement(Modal.default, _extends({},
|
|
55
|
+
}, /*#__PURE__*/React.createElement(Modal.default, _extends({}, props, {
|
|
56
|
+
iframeName: IFRAME_NAME,
|
|
82
57
|
onClose: function onClose(_context) {
|
|
83
58
|
if (popupMountPoint) {
|
|
84
59
|
ReactDOM.unmountComponentAtNode(popupMountPoint);
|
|
85
60
|
}
|
|
86
|
-
if (
|
|
87
|
-
|
|
61
|
+
if (_onClose) {
|
|
62
|
+
_onClose(_context);
|
|
88
63
|
}
|
|
89
|
-
}
|
|
64
|
+
},
|
|
65
|
+
showModal: true
|
|
90
66
|
}))), popupMountPoint);
|
|
91
|
-
case
|
|
67
|
+
case 8:
|
|
92
68
|
case "end":
|
|
93
69
|
return _context2.stop();
|
|
94
70
|
}
|
|
95
71
|
}, _callee);
|
|
96
72
|
}));
|
|
97
|
-
return
|
|
73
|
+
return _openEmbedModal.apply(this, arguments);
|
|
98
74
|
}
|
|
@@ -6,10 +6,10 @@ import React from 'react';
|
|
|
6
6
|
import Action from '../index';
|
|
7
7
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
8
8
|
import { useSmartLinkAnalytics } from '../../../../../../state';
|
|
9
|
-
import { openPreviewModal } from '../../../../../EmbedModal/utils';
|
|
10
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
11
10
|
import { messages } from '../../../../../../messages';
|
|
12
11
|
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
12
|
+
import { openEmbedModalWithFlexibleUiIcon } from '../../../utils';
|
|
13
13
|
var PreviewAction = function PreviewAction(props) {
|
|
14
14
|
var appearance = props.appearance,
|
|
15
15
|
asDropDownItem = props.asDropDownItem,
|
|
@@ -28,7 +28,7 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
28
28
|
var previewText = enableImprovedPreviewAction ? messages.preview_improved : messages.preview;
|
|
29
29
|
if (src && url) {
|
|
30
30
|
var embedModal = function embedModal() {
|
|
31
|
-
return
|
|
31
|
+
return openEmbedModalWithFlexibleUiIcon({
|
|
32
32
|
title: title,
|
|
33
33
|
providerName: providerName,
|
|
34
34
|
downloadUrl: downloadUrl,
|
|
@@ -9,10 +9,9 @@ import { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
|
9
9
|
import { R50, R500 } from '@atlaskit/theme/colors';
|
|
10
10
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
11
11
|
import { dropdownItemGroupStyles, contentStyles, linkStyles, textStyles } from './styled';
|
|
12
|
-
import { getFormattedMessage } from '../../../../utils';
|
|
12
|
+
import { getFormattedMessage, openEmbedModalWithFlexibleUiIcon } from '../../../../utils';
|
|
13
13
|
import { messages } from '../../../../../../../messages';
|
|
14
14
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../../state/flexible-ui-context';
|
|
15
|
-
import { openPreviewModal } from '../../../../../../EmbedModal/utils';
|
|
16
15
|
import useResolve from '../../../../../../../state/hooks/use-resolve';
|
|
17
16
|
var MAX_LINE_NUMBER = 8;
|
|
18
17
|
var LozengeActionError = function LozengeActionError(_ref) {
|
|
@@ -33,7 +32,7 @@ var LozengeActionError = function LozengeActionError(_ref) {
|
|
|
33
32
|
var handlePreviewOpen = useCallback(function () {
|
|
34
33
|
if (isPreviewAvailable) {
|
|
35
34
|
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkLozengeActionErrorOpenPreviewClickedEvent();
|
|
36
|
-
return
|
|
35
|
+
return openEmbedModalWithFlexibleUiIcon(_objectSpread(_objectSpread({}, previewData), {}, {
|
|
37
36
|
analytics: analytics,
|
|
38
37
|
onClose: handlePreviewClose
|
|
39
38
|
}));
|
|
@@ -6,6 +6,8 @@ import React from 'react';
|
|
|
6
6
|
import { css } from '@emotion/react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
8
|
import { SmartLinkSize } from '../../../constants';
|
|
9
|
+
import Icon from './elements/icon';
|
|
10
|
+
import { openEmbedModal } from '../../EmbedModal/utils';
|
|
9
11
|
export var sizeToButtonSpacing = (_sizeToButtonSpacing = {}, _defineProperty(_sizeToButtonSpacing, SmartLinkSize.Small, 'none'), _defineProperty(_sizeToButtonSpacing, SmartLinkSize.Medium, 'compact'), _defineProperty(_sizeToButtonSpacing, SmartLinkSize.Large, 'compact'), _defineProperty(_sizeToButtonSpacing, SmartLinkSize.XLarge, 'default'), _sizeToButtonSpacing);
|
|
10
12
|
export var getFormattedMessage = function getFormattedMessage(message) {
|
|
11
13
|
if (message) {
|
|
@@ -88,4 +90,36 @@ export var getTruncateStyles = function getTruncateStyles(maxLines) {
|
|
|
88
90
|
};
|
|
89
91
|
export var hasWhiteSpace = function hasWhiteSpace(str) {
|
|
90
92
|
return str.search(/\s/) >= 0;
|
|
93
|
+
};
|
|
94
|
+
export var openEmbedModalWithFlexibleUiIcon = function openEmbedModalWithFlexibleUiIcon(_ref) {
|
|
95
|
+
var analytics = _ref.analytics,
|
|
96
|
+
downloadUrl = _ref.downloadUrl,
|
|
97
|
+
linkIcon = _ref.linkIcon,
|
|
98
|
+
onClose = _ref.onClose,
|
|
99
|
+
providerName = _ref.providerName,
|
|
100
|
+
src = _ref.src,
|
|
101
|
+
title = _ref.title,
|
|
102
|
+
url = _ref.url,
|
|
103
|
+
isSupportTheming = _ref.isSupportTheming;
|
|
104
|
+
var icon = {
|
|
105
|
+
icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
|
|
106
|
+
size: SmartLinkSize.Large
|
|
107
|
+
})),
|
|
108
|
+
isFlexibleUi: true
|
|
109
|
+
};
|
|
110
|
+
return openEmbedModal({
|
|
111
|
+
analytics: analytics,
|
|
112
|
+
download: downloadUrl,
|
|
113
|
+
icon: icon,
|
|
114
|
+
// Flex should not send origin as block card. It should be able to support
|
|
115
|
+
// its internal parent components like hover card, block card and
|
|
116
|
+
// itself as a standalone. To be investigated and fix in EDM-7520.
|
|
117
|
+
origin: 'smartLinkCard',
|
|
118
|
+
providerName: providerName,
|
|
119
|
+
onClose: onClose,
|
|
120
|
+
src: src,
|
|
121
|
+
title: title,
|
|
122
|
+
url: url,
|
|
123
|
+
isSupportTheming: isSupportTheming
|
|
124
|
+
});
|
|
91
125
|
};
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { AnalyticsFacade } from '../../state/analytics';
|
|
4
|
-
type PreviewModalProps = {
|
|
5
|
-
analytics?: AnalyticsFacade;
|
|
6
|
-
onClose?: () => void;
|
|
7
|
-
} & PreviewActionData;
|
|
8
|
-
export declare const openPreviewModal: ({ analytics, downloadUrl: download, isSupportTheming, linkIcon, onClose, providerName, src, title, url, }: PreviewModalProps) => Promise<void>;
|
|
9
|
-
export declare function previewFunction({ popupMountPointId, onClose: onEmbedClose, ...rest }: PreviewFunctionProps): Promise<void>;
|
|
10
|
-
export {};
|
|
1
|
+
import { EmbedModalProps } from './types';
|
|
2
|
+
export declare function openEmbedModal({ onClose, ...props }?: Partial<EmbedModalProps>): Promise<void>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Icon } from '../../../../../../state/flexible-ui-context/types';
|
|
2
|
-
import { EmbedModalProps } from '../../../../../../view/EmbedModal/types';
|
|
3
2
|
import { ActionProps } from '../types';
|
|
4
3
|
export type PreviewActionProps = ActionProps & FlexibleEmbedProps;
|
|
5
4
|
export type FlexibleEmbedProps = {
|
|
@@ -11,6 +10,3 @@ export type FlexibleEmbedProps = {
|
|
|
11
10
|
url: string;
|
|
12
11
|
isSupportTheming?: boolean;
|
|
13
12
|
};
|
|
14
|
-
export interface PreviewFunctionProps extends EmbedModalProps {
|
|
15
|
-
popupMountPointId: string;
|
|
16
|
-
}
|
|
@@ -3,6 +3,8 @@ import { SerializedStyles } from '@emotion/react';
|
|
|
3
3
|
import { Spacing } from '@atlaskit/button';
|
|
4
4
|
import { SmartLinkSize } from '../../../constants';
|
|
5
5
|
import { MessageProps } from './types';
|
|
6
|
+
import { AnalyticsFacade } from '../../../state/analytics';
|
|
7
|
+
import { PreviewActionData } from '../../../state/flexible-ui-context/types';
|
|
6
8
|
export declare const sizeToButtonSpacing: Record<SmartLinkSize, Spacing>;
|
|
7
9
|
export declare const getFormattedMessage: (message?: MessageProps) => JSX.Element | undefined;
|
|
8
10
|
export declare const getIconSizeStyles: (width: string) => SerializedStyles;
|
|
@@ -13,3 +15,65 @@ export declare const getMaxLineHeight: (size: SmartLinkSize) => 1.5 | 1.75;
|
|
|
13
15
|
export declare const getMaxLines: (value: number, defaultValue: number, max: number, min: number) => number;
|
|
14
16
|
export declare const getTruncateStyles: (maxLines: number, lineHeight?: string, wordBreak?: 'break-word' | 'break-all') => SerializedStyles;
|
|
15
17
|
export declare const hasWhiteSpace: (str: string) => boolean;
|
|
18
|
+
export declare const openEmbedModalWithFlexibleUiIcon: ({ analytics, downloadUrl, linkIcon, onClose, providerName, src, title, url, isSupportTheming, }: PreviewActionData & {
|
|
19
|
+
analytics?: {
|
|
20
|
+
ui: {
|
|
21
|
+
authEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiAuthEventProps) => void;
|
|
22
|
+
authAlternateAccountEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiAuthAlternateAccountEventProps) => void;
|
|
23
|
+
buttonClickedEvent: (data: Partial<import("../../..").AnalyticsPayload> & {
|
|
24
|
+
actionSubjectId: string;
|
|
25
|
+
}) => void;
|
|
26
|
+
cardClickedEvent: ({ id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId, }: import("../../../utils/analytics/types").UiCardClickedEventProps) => void;
|
|
27
|
+
iframeDwelledEvent: ({ id, display, status, definitionId, extensionKey, location, destinationProduct, destinationSubproduct, dwellTime, dwellPercentVisible, }: import("../../../utils/analytics/types").UiIframeDwelledEventProps) => void;
|
|
28
|
+
iframeFocusedEvent: ({ id, display, status, definitionId, extensionKey, location, destinationProduct, destinationSubproduct, }: import("../../../utils/analytics/types").UiIframeFocusedEventProps) => void;
|
|
29
|
+
actionClickedEvent: ({ id, actionType, display, invokeType, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiActionClickedEventProps) => void;
|
|
30
|
+
hoverCardOpenLinkClickedEvent: ({ previewDisplay, definitionId, extensionKey, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: import("../../../utils/analytics/types").UiHoverCardOpenLinkClickedEventProps) => void;
|
|
31
|
+
closedAuthEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiClosedAuthEventProps) => void;
|
|
32
|
+
modalClosedEvent: (data: Partial<import("../../..").AnalyticsPayload> & {
|
|
33
|
+
actionSubjectId: string;
|
|
34
|
+
}) => void;
|
|
35
|
+
renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiRenderSuccessEventProps) => void;
|
|
36
|
+
renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiRenderFailedEventProps) => void;
|
|
37
|
+
hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("../../../utils/analytics/types").UiHoverCardViewedEventProps) => void;
|
|
38
|
+
hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("../../../utils/analytics/types").UiHoverCardDismissedEventProps) => void;
|
|
39
|
+
learnMoreClickedEvent: () => void;
|
|
40
|
+
smartLinkLozengeActionClickedEvent: () => void;
|
|
41
|
+
smartLinkLozengeActionListItemClickedEvent: () => void;
|
|
42
|
+
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => void;
|
|
43
|
+
};
|
|
44
|
+
operational: {
|
|
45
|
+
invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").InvokeSucceededEventProps) => void;
|
|
46
|
+
invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").InvokeFailedEventProps) => void;
|
|
47
|
+
connectSucceededEvent: ({ id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").ConnectSucceededEventProps) => void;
|
|
48
|
+
connectFailedEvent: ({ id, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").ConnectFailedEventProps) => void;
|
|
49
|
+
instrument: ({ id, status, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, error, }: import("../../../utils/analytics/types").InstrumentEventProps) => void;
|
|
50
|
+
chunkloadFailedEvent: ({ display, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiRenderFailedEventProps) => void;
|
|
51
|
+
};
|
|
52
|
+
track: {
|
|
53
|
+
appAccountConnected: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").CommonEventProps) => void;
|
|
54
|
+
appAccountAuthStarted: ({ extensionKey, location, }: import("../../../utils/analytics/types").CommonEventProps) => void;
|
|
55
|
+
linkUpdated: (props: import("../../../utils/analytics/types").CommonEventProps & {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}) => void;
|
|
58
|
+
smartLinkQuickActionStarted: (props: {
|
|
59
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../../utils/analytics/analytics").TrackQuickActionType;
|
|
60
|
+
}) => void;
|
|
61
|
+
smartLinkQuickActionSuccess: (props: {
|
|
62
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../../utils/analytics/analytics").TrackQuickActionType;
|
|
63
|
+
}) => void;
|
|
64
|
+
smartLinkQuickActionFailed: (props: {
|
|
65
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../../utils/analytics/analytics").TrackQuickActionType;
|
|
66
|
+
reason?: import("../../../utils/analytics/analytics").TrackQuickActionFailureReason | undefined;
|
|
67
|
+
step?: string | undefined;
|
|
68
|
+
}) => void;
|
|
69
|
+
hoverCardResolutionStarted: () => void;
|
|
70
|
+
};
|
|
71
|
+
screen: {
|
|
72
|
+
authPopupEvent: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").CommonEventProps) => void;
|
|
73
|
+
modalViewedEvent: (data: Partial<import("../../..").AnalyticsPayload> & {
|
|
74
|
+
name: "embedPreviewModal";
|
|
75
|
+
}) => void;
|
|
76
|
+
};
|
|
77
|
+
} | undefined;
|
|
78
|
+
onClose?: (() => void) | undefined;
|
|
79
|
+
}) => Promise<void>;
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { AnalyticsFacade } from '../../state/analytics';
|
|
4
|
-
type PreviewModalProps = {
|
|
5
|
-
analytics?: AnalyticsFacade;
|
|
6
|
-
onClose?: () => void;
|
|
7
|
-
} & PreviewActionData;
|
|
8
|
-
export declare const openPreviewModal: ({ analytics, downloadUrl: download, isSupportTheming, linkIcon, onClose, providerName, src, title, url, }: PreviewModalProps) => Promise<void>;
|
|
9
|
-
export declare function previewFunction({ popupMountPointId, onClose: onEmbedClose, ...rest }: PreviewFunctionProps): Promise<void>;
|
|
10
|
-
export {};
|
|
1
|
+
import { EmbedModalProps } from './types';
|
|
2
|
+
export declare function openEmbedModal({ onClose, ...props }?: Partial<EmbedModalProps>): Promise<void>;
|
package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/preview-action/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Icon } from '../../../../../../state/flexible-ui-context/types';
|
|
2
|
-
import { EmbedModalProps } from '../../../../../../view/EmbedModal/types';
|
|
3
2
|
import { ActionProps } from '../types';
|
|
4
3
|
export type PreviewActionProps = ActionProps & FlexibleEmbedProps;
|
|
5
4
|
export type FlexibleEmbedProps = {
|
|
@@ -11,6 +10,3 @@ export type FlexibleEmbedProps = {
|
|
|
11
10
|
url: string;
|
|
12
11
|
isSupportTheming?: boolean;
|
|
13
12
|
};
|
|
14
|
-
export interface PreviewFunctionProps extends EmbedModalProps {
|
|
15
|
-
popupMountPointId: string;
|
|
16
|
-
}
|
|
@@ -3,6 +3,8 @@ import { SerializedStyles } from '@emotion/react';
|
|
|
3
3
|
import { Spacing } from '@atlaskit/button';
|
|
4
4
|
import { SmartLinkSize } from '../../../constants';
|
|
5
5
|
import { MessageProps } from './types';
|
|
6
|
+
import { AnalyticsFacade } from '../../../state/analytics';
|
|
7
|
+
import { PreviewActionData } from '../../../state/flexible-ui-context/types';
|
|
6
8
|
export declare const sizeToButtonSpacing: Record<SmartLinkSize, Spacing>;
|
|
7
9
|
export declare const getFormattedMessage: (message?: MessageProps) => JSX.Element | undefined;
|
|
8
10
|
export declare const getIconSizeStyles: (width: string) => SerializedStyles;
|
|
@@ -13,3 +15,65 @@ export declare const getMaxLineHeight: (size: SmartLinkSize) => 1.5 | 1.75;
|
|
|
13
15
|
export declare const getMaxLines: (value: number, defaultValue: number, max: number, min: number) => number;
|
|
14
16
|
export declare const getTruncateStyles: (maxLines: number, lineHeight?: string, wordBreak?: 'break-word' | 'break-all') => SerializedStyles;
|
|
15
17
|
export declare const hasWhiteSpace: (str: string) => boolean;
|
|
18
|
+
export declare const openEmbedModalWithFlexibleUiIcon: ({ analytics, downloadUrl, linkIcon, onClose, providerName, src, title, url, isSupportTheming, }: PreviewActionData & {
|
|
19
|
+
analytics?: {
|
|
20
|
+
ui: {
|
|
21
|
+
authEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiAuthEventProps) => void;
|
|
22
|
+
authAlternateAccountEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiAuthAlternateAccountEventProps) => void;
|
|
23
|
+
buttonClickedEvent: (data: Partial<import("../../..").AnalyticsPayload> & {
|
|
24
|
+
actionSubjectId: string;
|
|
25
|
+
}) => void;
|
|
26
|
+
cardClickedEvent: ({ id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId, }: import("../../../utils/analytics/types").UiCardClickedEventProps) => void;
|
|
27
|
+
iframeDwelledEvent: ({ id, display, status, definitionId, extensionKey, location, destinationProduct, destinationSubproduct, dwellTime, dwellPercentVisible, }: import("../../../utils/analytics/types").UiIframeDwelledEventProps) => void;
|
|
28
|
+
iframeFocusedEvent: ({ id, display, status, definitionId, extensionKey, location, destinationProduct, destinationSubproduct, }: import("../../../utils/analytics/types").UiIframeFocusedEventProps) => void;
|
|
29
|
+
actionClickedEvent: ({ id, actionType, display, invokeType, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiActionClickedEventProps) => void;
|
|
30
|
+
hoverCardOpenLinkClickedEvent: ({ previewDisplay, definitionId, extensionKey, destinationProduct, destinationSubproduct, location, previewInvokeMethod, }: import("../../../utils/analytics/types").UiHoverCardOpenLinkClickedEventProps) => void;
|
|
31
|
+
closedAuthEvent: ({ display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiClosedAuthEventProps) => void;
|
|
32
|
+
modalClosedEvent: (data: Partial<import("../../..").AnalyticsPayload> & {
|
|
33
|
+
actionSubjectId: string;
|
|
34
|
+
}) => void;
|
|
35
|
+
renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiRenderSuccessEventProps) => void;
|
|
36
|
+
renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiRenderFailedEventProps) => void;
|
|
37
|
+
hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("../../../utils/analytics/types").UiHoverCardViewedEventProps) => void;
|
|
38
|
+
hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("../../../utils/analytics/types").UiHoverCardDismissedEventProps) => void;
|
|
39
|
+
learnMoreClickedEvent: () => void;
|
|
40
|
+
smartLinkLozengeActionClickedEvent: () => void;
|
|
41
|
+
smartLinkLozengeActionListItemClickedEvent: () => void;
|
|
42
|
+
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => void;
|
|
43
|
+
};
|
|
44
|
+
operational: {
|
|
45
|
+
invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").InvokeSucceededEventProps) => void;
|
|
46
|
+
invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").InvokeFailedEventProps) => void;
|
|
47
|
+
connectSucceededEvent: ({ id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").ConnectSucceededEventProps) => void;
|
|
48
|
+
connectFailedEvent: ({ id, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").ConnectFailedEventProps) => void;
|
|
49
|
+
instrument: ({ id, status, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, error, }: import("../../../utils/analytics/types").InstrumentEventProps) => void;
|
|
50
|
+
chunkloadFailedEvent: ({ display, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").UiRenderFailedEventProps) => void;
|
|
51
|
+
};
|
|
52
|
+
track: {
|
|
53
|
+
appAccountConnected: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").CommonEventProps) => void;
|
|
54
|
+
appAccountAuthStarted: ({ extensionKey, location, }: import("../../../utils/analytics/types").CommonEventProps) => void;
|
|
55
|
+
linkUpdated: (props: import("../../../utils/analytics/types").CommonEventProps & {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}) => void;
|
|
58
|
+
smartLinkQuickActionStarted: (props: {
|
|
59
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../../utils/analytics/analytics").TrackQuickActionType;
|
|
60
|
+
}) => void;
|
|
61
|
+
smartLinkQuickActionSuccess: (props: {
|
|
62
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../../utils/analytics/analytics").TrackQuickActionType;
|
|
63
|
+
}) => void;
|
|
64
|
+
smartLinkQuickActionFailed: (props: {
|
|
65
|
+
smartLinkActionType: import("@atlaskit/linking-types").SmartLinkActionType | import("../../../utils/analytics/analytics").TrackQuickActionType;
|
|
66
|
+
reason?: import("../../../utils/analytics/analytics").TrackQuickActionFailureReason | undefined;
|
|
67
|
+
step?: string | undefined;
|
|
68
|
+
}) => void;
|
|
69
|
+
hoverCardResolutionStarted: () => void;
|
|
70
|
+
};
|
|
71
|
+
screen: {
|
|
72
|
+
authPopupEvent: ({ extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../../utils/analytics/types").CommonEventProps) => void;
|
|
73
|
+
modalViewedEvent: (data: Partial<import("../../..").AnalyticsPayload> & {
|
|
74
|
+
name: "embedPreviewModal";
|
|
75
|
+
}) => void;
|
|
76
|
+
};
|
|
77
|
+
} | undefined;
|
|
78
|
+
onClose?: (() => void) | undefined;
|
|
79
|
+
}) => Promise<void>;
|