@atlaskit/smart-card 25.2.1 → 25.3.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 +6 -0
- package/dist/cjs/extractors/block/index.js +4 -3
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +5 -2
- package/dist/cjs/extractors/common/meta/extractIsSupportTheming.js +11 -0
- package/dist/cjs/extractors/constants.js +6 -2
- package/dist/cjs/extractors/embed/index.js +3 -1
- package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +4 -1
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +2 -1
- package/dist/cjs/view/EmbedCard/views/ResolvedView.js +10 -2
- package/dist/cjs/view/EmbedModal/index.js +10 -2
- package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +4 -2
- package/dist/es2019/extractors/block/index.js +4 -3
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +5 -2
- package/dist/es2019/extractors/common/meta/extractIsSupportTheming.js +4 -0
- package/dist/es2019/extractors/constants.js +4 -1
- package/dist/es2019/extractors/embed/index.js +9 -9
- package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +4 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +2 -1
- package/dist/es2019/view/EmbedCard/views/ResolvedView.js +11 -2
- package/dist/es2019/view/EmbedModal/index.js +11 -2
- package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +4 -2
- package/dist/esm/extractors/block/index.js +4 -3
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +5 -2
- package/dist/esm/extractors/common/meta/extractIsSupportTheming.js +4 -0
- package/dist/esm/extractors/constants.js +4 -1
- package/dist/esm/extractors/embed/index.js +3 -1
- package/dist/esm/extractors/flexible/actions/extract-preview-action.js +4 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/views/ResolvedView.js +2 -1
- package/dist/esm/view/EmbedCard/views/ResolvedView.js +10 -2
- package/dist/esm/view/EmbedModal/index.js +10 -2
- package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +4 -2
- package/dist/types/extractors/block/index.d.ts +1 -1
- package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +2 -1
- package/dist/types/extractors/common/meta/extractIsSupportTheming.d.ts +2 -0
- package/dist/types/extractors/constants.d.ts +1 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +1 -0
- package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +1 -0
- package/dist/types/view/BlockCard/views/ResolvedView.d.ts +3 -1
- package/dist/types/view/EmbedCard/views/ResolvedView.d.ts +1 -0
- package/dist/types/view/EmbedModal/index.d.ts +1 -0
- package/dist/types/view/EmbedModal/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/actions/action/preview-action/types.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 25.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`4a1604ce132`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4a1604ce132) - Adds a new themeMode query param to preview links url from 1P integrators that support different theme modes.
|
|
8
|
+
|
|
3
9
|
## 25.2.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -35,14 +35,15 @@ var extractBlockDetails = function extractBlockDetails(jsonLd) {
|
|
|
35
35
|
return !!detail;
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
|
-
var extractBlockActions = function extractBlockActions(props, jsonLd, opts, platform) {
|
|
38
|
+
var extractBlockActions = function extractBlockActions(props, jsonLd, opts, platform, meta) {
|
|
39
39
|
if (opts) {
|
|
40
40
|
var handleInvoke = opts.handleInvoke;
|
|
41
41
|
var actions = (0, _extractActions.extractActions)(jsonLd, handleInvoke);
|
|
42
42
|
var previewAction = (0, _extractPreviewAction.extractPreviewAction)(_objectSpread(_objectSpread({}, opts), {}, {
|
|
43
43
|
viewProps: props,
|
|
44
44
|
jsonLd: jsonLd,
|
|
45
|
-
platform: platform
|
|
45
|
+
platform: platform,
|
|
46
|
+
meta: meta
|
|
46
47
|
}));
|
|
47
48
|
|
|
48
49
|
// The previewAction should always be the last action
|
|
@@ -91,7 +92,7 @@ var extractBlockProps = function extractBlockProps(jsonLd, meta, opts, renderers
|
|
|
91
92
|
isTrusted: (0, _extractIsTrusted.extractIsTrusted)(meta)
|
|
92
93
|
};
|
|
93
94
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
94
|
-
actions: extractBlockActions(props, jsonLd, opts, platform)
|
|
95
|
+
actions: extractBlockActions(props, jsonLd, opts, platform, meta)
|
|
95
96
|
});
|
|
96
97
|
};
|
|
97
98
|
exports.extractBlockProps = extractBlockProps;
|
|
@@ -10,6 +10,7 @@ var _detail = require("../detail");
|
|
|
10
10
|
var _extractors = require("@atlaskit/linking-common/extractors");
|
|
11
11
|
var _BlockCard = require("../../../view/BlockCard");
|
|
12
12
|
var _constants = require("../../../constants");
|
|
13
|
+
var _extractIsSupportTheming = require("../../common/meta/extractIsSupportTheming");
|
|
13
14
|
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; }
|
|
14
15
|
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; }
|
|
15
16
|
var getMetadataFromJsonLd = function getMetadataFromJsonLd(jsonLd, platform) {
|
|
@@ -62,7 +63,8 @@ var extractPreviewAction = function extractPreviewAction(_ref) {
|
|
|
62
63
|
origin = _ref.origin,
|
|
63
64
|
_ref$source = _ref.source,
|
|
64
65
|
source = _ref$source === void 0 ? 'block' : _ref$source,
|
|
65
|
-
analytics = _ref.analytics
|
|
66
|
+
analytics = _ref.analytics,
|
|
67
|
+
meta = _ref.meta;
|
|
66
68
|
// Extract metadata from view props & raw JSON-LD.
|
|
67
69
|
var metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
|
|
68
70
|
var metadataFromViewProps = getMetadataFromResolvedProps(viewProps);
|
|
@@ -80,7 +82,8 @@ var extractPreviewAction = function extractPreviewAction(_ref) {
|
|
|
80
82
|
},
|
|
81
83
|
onViewActionClick: function onViewActionClick() {
|
|
82
84
|
handleInvoke(getInvokeOpts(key, 'ViewAction'));
|
|
83
|
-
}
|
|
85
|
+
},
|
|
86
|
+
isSupportTheming: (0, _extractIsSupportTheming.extractIsSupportTheming)(meta)
|
|
84
87
|
}));
|
|
85
88
|
// Setup props to go through proper Redux 'invocation' flow
|
|
86
89
|
// for analytics, further state management if required in future.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.extractIsSupportTheming = void 0;
|
|
7
|
+
var _constants = require("../../constants");
|
|
8
|
+
var extractIsSupportTheming = function extractIsSupportTheming(meta) {
|
|
9
|
+
return Boolean((meta === null || meta === void 0 ? void 0 : meta.key) && _constants.PROVIDER_KEYS_WITH_THEMING.includes(meta.key));
|
|
10
|
+
};
|
|
11
|
+
exports.extractIsSupportTheming = extractIsSupportTheming;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.JIRA_TASK = exports.JIRA_SUB_TASK = exports.JIRA_STORY = exports.JIRA_SERVICE_REQUEST = exports.JIRA_PROBLEM = exports.JIRA_INCIDENT = exports.JIRA_GENERATOR_ID = exports.JIRA_EPIC = exports.JIRA_CUSTOM_TASK_TYPE = exports.JIRA_CHANGE = exports.JIRA_BUG = exports.CONFLUENCE_GENERATOR_ID = void 0;
|
|
6
|
+
exports.PROVIDER_KEYS_WITH_THEMING = exports.JIRA_TASK = exports.JIRA_SUB_TASK = exports.JIRA_STORY = exports.JIRA_SERVICE_REQUEST = exports.JIRA_PROBLEM = exports.JIRA_INCIDENT = exports.JIRA_GENERATOR_ID = exports.JIRA_EPIC = exports.JIRA_CUSTOM_TASK_TYPE = exports.JIRA_CHANGE = exports.JIRA_BUG = exports.CONFLUENCE_GENERATOR_ID = void 0;
|
|
7
7
|
var CONFLUENCE_GENERATOR_ID = 'https://www.atlassian.com/#Confluence';
|
|
8
8
|
exports.CONFLUENCE_GENERATOR_ID = CONFLUENCE_GENERATOR_ID;
|
|
9
9
|
var JIRA_GENERATOR_ID = 'https://www.atlassian.com/#Jira';
|
|
@@ -28,4 +28,8 @@ exports.JIRA_CHANGE = JIRA_CHANGE;
|
|
|
28
28
|
var JIRA_PROBLEM = 'JiraProblem';
|
|
29
29
|
exports.JIRA_PROBLEM = JIRA_PROBLEM;
|
|
30
30
|
var JIRA_CUSTOM_TASK_TYPE = 'JiraCustomTaskType';
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
//List of provider keys that support theme modes for the embedded content.
|
|
33
|
+
exports.JIRA_CUSTOM_TASK_TYPE = JIRA_CUSTOM_TASK_TYPE;
|
|
34
|
+
var PROVIDER_KEYS_WITH_THEMING = ['jira-object-provider', 'confluence-object-provider', 'watermelon-object-provider'];
|
|
35
|
+
exports.PROVIDER_KEYS_WITH_THEMING = PROVIDER_KEYS_WITH_THEMING;
|
|
@@ -8,6 +8,7 @@ exports.extractEmbedProps = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _extractors = require("@atlaskit/linking-common/extractors");
|
|
10
10
|
var _extractIsTrusted = require("../common/meta/extractIsTrusted");
|
|
11
|
+
var _extractIsSupportTheming = require("../common/meta/extractIsSupportTheming");
|
|
11
12
|
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; }
|
|
12
13
|
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; }
|
|
13
14
|
var extractEmbedPreview = function extractEmbedPreview(jsonLd, platform, iframeUrlType) {
|
|
@@ -24,7 +25,8 @@ var extractEmbedProps = function extractEmbedProps(jsonLd, meta, platform, ifram
|
|
|
24
25
|
title: (0, _extractors.extractTitle)(jsonLd),
|
|
25
26
|
context: (0, _extractors.extractProvider)(jsonLd),
|
|
26
27
|
preview: extractEmbedPreview(jsonLd, platform, iframeUrlType),
|
|
27
|
-
isTrusted: (0, _extractIsTrusted.extractIsTrusted)(meta)
|
|
28
|
+
isTrusted: (0, _extractIsTrusted.extractIsTrusted)(meta),
|
|
29
|
+
isSupportTheming: (0, _extractIsSupportTheming.extractIsSupportTheming)(meta)
|
|
28
30
|
};
|
|
29
31
|
};
|
|
30
32
|
exports.extractEmbedProps = extractEmbedProps;
|
|
@@ -8,9 +8,11 @@ var _detail = require("../../common/detail");
|
|
|
8
8
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
9
9
|
var _extractors = require("@atlaskit/linking-common/extractors");
|
|
10
10
|
var _icon = require("../icon");
|
|
11
|
+
var _extractIsSupportTheming = require("../../common/meta/extractIsSupportTheming");
|
|
11
12
|
var extractPreviewAction = function extractPreviewAction(response) {
|
|
12
13
|
var _extractPreviewData;
|
|
13
14
|
var data = response.data;
|
|
15
|
+
var meta = response.meta;
|
|
14
16
|
var src = (_extractPreviewData = (0, _linkingCommon.extractPreview)(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
|
|
15
17
|
if (src) {
|
|
16
18
|
var _extractProvider;
|
|
@@ -20,7 +22,8 @@ var extractPreviewAction = function extractPreviewAction(response) {
|
|
|
20
22
|
src: src,
|
|
21
23
|
title: (0, _extractors.extractTitle)(data),
|
|
22
24
|
linkIcon: (0, _icon.extractLinkIcon)(response),
|
|
23
|
-
url: (0, _extractors.extractLink)(data)
|
|
25
|
+
url: (0, _extractors.extractLink)(data),
|
|
26
|
+
isSupportTheming: (0, _extractIsSupportTheming.extractIsSupportTheming)(meta)
|
|
24
27
|
};
|
|
25
28
|
}
|
|
26
29
|
};
|
package/dist/cjs/version.json
CHANGED
|
@@ -63,7 +63,8 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
63
63
|
_ref$testId = _ref.testId,
|
|
64
64
|
testId = _ref$testId === void 0 ? 'block-card-resolved-view' : _ref$testId,
|
|
65
65
|
_ref$showActions = _ref.showActions,
|
|
66
|
-
showActions = _ref$showActions === void 0 ? true : _ref$showActions
|
|
66
|
+
showActions = _ref$showActions === void 0 ? true : _ref$showActions,
|
|
67
|
+
isSupportTheming = _ref.isSupportTheming;
|
|
67
68
|
var resolvedMetadata = details.length > 0 ? (0, _react.jsx)(_MetadataList.MetadataList, {
|
|
68
69
|
testId: testId ? "".concat(testId, "-meta") : undefined,
|
|
69
70
|
items: details
|
|
@@ -11,6 +11,7 @@ var _link = _interopRequireDefault(require("@atlaskit/icon/glyph/link"));
|
|
|
11
11
|
var _ExpandedFrame = require("../components/ExpandedFrame");
|
|
12
12
|
var _ImageIcon = require("../components/ImageIcon");
|
|
13
13
|
var _Frame = require("../components/Frame");
|
|
14
|
+
var _tokens = require("@atlaskit/tokens");
|
|
14
15
|
/** @jsx jsx */
|
|
15
16
|
|
|
16
17
|
var EmbedCardResolvedView = /*#__PURE__*/_react2.default.forwardRef(function (_ref, embedIframeRef) {
|
|
@@ -27,7 +28,8 @@ var EmbedCardResolvedView = /*#__PURE__*/_react2.default.forwardRef(function (_r
|
|
|
27
28
|
testId = _ref$testId === void 0 ? 'embed-card-resolved-view' : _ref$testId,
|
|
28
29
|
inheritDimensions = _ref.inheritDimensions,
|
|
29
30
|
onIframeDwell = _ref.onIframeDwell,
|
|
30
|
-
onIframeFocus = _ref.onIframeFocus
|
|
31
|
+
onIframeFocus = _ref.onIframeFocus,
|
|
32
|
+
isSupportTheming = _ref.isSupportTheming;
|
|
31
33
|
var iconFromContext = context === null || context === void 0 ? void 0 : context.icon;
|
|
32
34
|
var src = typeof iconFromContext === 'string' ? iconFromContext : undefined;
|
|
33
35
|
var text = title || (context === null || context === void 0 ? void 0 : context.text);
|
|
@@ -47,6 +49,12 @@ var EmbedCardResolvedView = /*#__PURE__*/_react2.default.forwardRef(function (_r
|
|
|
47
49
|
default: linkGlyph
|
|
48
50
|
});
|
|
49
51
|
}, [src, linkGlyph, iconFromContext]);
|
|
52
|
+
var _useThemeObserver = (0, _tokens.useThemeObserver)(),
|
|
53
|
+
colorMode = _useThemeObserver.colorMode;
|
|
54
|
+
var previewUrl = preview === null || preview === void 0 ? void 0 : preview.src;
|
|
55
|
+
if (previewUrl && isSupportTheming && colorMode) {
|
|
56
|
+
previewUrl = "".concat(previewUrl).concat(previewUrl.includes('?') ? '&' : '?', "themeMode=").concat(colorMode);
|
|
57
|
+
}
|
|
50
58
|
return (0, _react.jsx)(_ExpandedFrame.ExpandedFrame, {
|
|
51
59
|
isSelected: isSelected,
|
|
52
60
|
isFrameVisible: isFrameVisible,
|
|
@@ -58,7 +66,7 @@ var EmbedCardResolvedView = /*#__PURE__*/_react2.default.forwardRef(function (_r
|
|
|
58
66
|
onClick: onClick,
|
|
59
67
|
inheritDimensions: inheritDimensions
|
|
60
68
|
}, (0, _react.jsx)(_Frame.Frame, {
|
|
61
|
-
url:
|
|
69
|
+
url: previewUrl,
|
|
62
70
|
isTrusted: isTrusted,
|
|
63
71
|
testId: testId,
|
|
64
72
|
ref: embedIframeRef,
|
|
@@ -15,6 +15,7 @@ var _embedContent = _interopRequireDefault(require("./components/embed-content")
|
|
|
15
15
|
var _types = require("./types");
|
|
16
16
|
var _errorBoundary = _interopRequireDefault(require("./components/error-boundary"));
|
|
17
17
|
var _analytics = _interopRequireDefault(require("./components/analytics"));
|
|
18
|
+
var _tokens = require("@atlaskit/tokens");
|
|
18
19
|
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); }
|
|
19
20
|
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; }
|
|
20
21
|
var toSize = function toSize(width) {
|
|
@@ -42,7 +43,8 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
42
43
|
_ref$testId = _ref.testId,
|
|
43
44
|
testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
|
|
44
45
|
title = _ref.title,
|
|
45
|
-
url = _ref.url
|
|
46
|
+
url = _ref.url,
|
|
47
|
+
isSupportTheming = _ref.isSupportTheming;
|
|
46
48
|
var defaultWidth = toWidth(size);
|
|
47
49
|
var _useState = (0, _react.useState)(showModal),
|
|
48
50
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -82,6 +84,12 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
82
84
|
});
|
|
83
85
|
}
|
|
84
86
|
}, [onResize, width]);
|
|
87
|
+
var _useThemeObserver = (0, _tokens.useThemeObserver)(),
|
|
88
|
+
colorMode = _useThemeObserver.colorMode;
|
|
89
|
+
var previewUrl = src;
|
|
90
|
+
if (previewUrl && isSupportTheming && colorMode) {
|
|
91
|
+
previewUrl = "".concat(previewUrl).concat(previewUrl.includes('?') ? '&' : '?', "themeMode=").concat(colorMode);
|
|
92
|
+
}
|
|
85
93
|
return /*#__PURE__*/_react.default.createElement(_modalDialog.ModalTransition, null, isOpen && /*#__PURE__*/_react.default.createElement(_modalDialog.default, {
|
|
86
94
|
height: "100%",
|
|
87
95
|
onClose: handleOnClose,
|
|
@@ -103,7 +111,7 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
103
111
|
}), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalBody, null, /*#__PURE__*/_react.default.createElement(_embedContent.default, {
|
|
104
112
|
isTrusted: isTrusted,
|
|
105
113
|
name: iframeName,
|
|
106
|
-
src:
|
|
114
|
+
src: previewUrl,
|
|
107
115
|
testId: testId
|
|
108
116
|
}))));
|
|
109
117
|
};
|
|
@@ -34,7 +34,8 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
34
34
|
url = props.url,
|
|
35
35
|
title = props.title,
|
|
36
36
|
providerName = props.providerName,
|
|
37
|
-
downloadUrl = props.downloadUrl
|
|
37
|
+
downloadUrl = props.downloadUrl,
|
|
38
|
+
isSupportTheming = props.isSupportTheming;
|
|
38
39
|
var defaultAnalytics = (0, _state.useSmartLinkAnalytics)(url, function () {});
|
|
39
40
|
var analytics = (0, _flexibleUiContext.useFlexibleUiAnalyticsContext)() || defaultAnalytics;
|
|
40
41
|
var EmbedIcon = {
|
|
@@ -55,7 +56,8 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
55
56
|
title: title,
|
|
56
57
|
url: url,
|
|
57
58
|
analytics: analytics,
|
|
58
|
-
origin: 'smartLinkCard'
|
|
59
|
+
origin: 'smartLinkCard',
|
|
60
|
+
isSupportTheming: isSupportTheming
|
|
59
61
|
});
|
|
60
62
|
};
|
|
61
63
|
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -21,7 +21,7 @@ const extractBlockIcon = jsonLd => {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
const extractBlockDetails = jsonLd => [extractCommentCount(jsonLd), extractProgrammingLanguage(jsonLd), extractSubscriberCount(jsonLd), extractAttachmentCount(jsonLd)].filter(detail => !!detail);
|
|
24
|
-
export const extractBlockActions = (props, jsonLd, opts, platform) => {
|
|
24
|
+
export const extractBlockActions = (props, jsonLd, opts, platform, meta) => {
|
|
25
25
|
if (opts) {
|
|
26
26
|
const {
|
|
27
27
|
handleInvoke
|
|
@@ -31,7 +31,8 @@ export const extractBlockActions = (props, jsonLd, opts, platform) => {
|
|
|
31
31
|
...opts,
|
|
32
32
|
viewProps: props,
|
|
33
33
|
jsonLd,
|
|
34
|
-
platform
|
|
34
|
+
platform,
|
|
35
|
+
meta
|
|
35
36
|
});
|
|
36
37
|
|
|
37
38
|
// The previewAction should always be the last action
|
|
@@ -79,6 +80,6 @@ export const extractBlockProps = (jsonLd, meta, opts, renderers, platform) => {
|
|
|
79
80
|
};
|
|
80
81
|
return {
|
|
81
82
|
...props,
|
|
82
|
-
actions: extractBlockActions(props, jsonLd, opts, platform)
|
|
83
|
+
actions: extractBlockActions(props, jsonLd, opts, platform, meta)
|
|
83
84
|
};
|
|
84
85
|
};
|
|
@@ -2,6 +2,7 @@ import { extractDownloadUrl } from '../detail';
|
|
|
2
2
|
import { extractPreview, extractProvider } from '@atlaskit/linking-common/extractors';
|
|
3
3
|
import { PreviewAction } from '../../../view/BlockCard';
|
|
4
4
|
import { CardDisplay } from '../../../constants';
|
|
5
|
+
import { extractIsSupportTheming } from '../../common/meta/extractIsSupportTheming';
|
|
5
6
|
const getMetadataFromJsonLd = (jsonLd, platform) => {
|
|
6
7
|
const download = extractDownloadUrl(jsonLd);
|
|
7
8
|
const provider = extractProvider(jsonLd);
|
|
@@ -44,7 +45,8 @@ export const extractPreviewAction = ({
|
|
|
44
45
|
platform,
|
|
45
46
|
origin,
|
|
46
47
|
source = 'block',
|
|
47
|
-
analytics
|
|
48
|
+
analytics,
|
|
49
|
+
meta
|
|
48
50
|
}) => {
|
|
49
51
|
// Extract metadata from view props & raw JSON-LD.
|
|
50
52
|
const metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
|
|
@@ -67,7 +69,8 @@ export const extractPreviewAction = ({
|
|
|
67
69
|
},
|
|
68
70
|
onViewActionClick: () => {
|
|
69
71
|
handleInvoke(getInvokeOpts(key, 'ViewAction'));
|
|
70
|
-
}
|
|
72
|
+
},
|
|
73
|
+
isSupportTheming: extractIsSupportTheming(meta)
|
|
71
74
|
});
|
|
72
75
|
// Setup props to go through proper Redux 'invocation' flow
|
|
73
76
|
// for analytics, further state management if required in future.
|
|
@@ -10,4 +10,7 @@ export const JIRA_INCIDENT = 'JiraIncident';
|
|
|
10
10
|
export const JIRA_SERVICE_REQUEST = 'JiraServiceRequest';
|
|
11
11
|
export const JIRA_CHANGE = 'JiraChange';
|
|
12
12
|
export const JIRA_PROBLEM = 'JiraProblem';
|
|
13
|
-
export const JIRA_CUSTOM_TASK_TYPE = 'JiraCustomTaskType';
|
|
13
|
+
export const JIRA_CUSTOM_TASK_TYPE = 'JiraCustomTaskType';
|
|
14
|
+
|
|
15
|
+
//List of provider keys that support theme modes for the embedded content.
|
|
16
|
+
export const PROVIDER_KEYS_WITH_THEMING = ['jira-object-provider', 'confluence-object-provider', 'watermelon-object-provider'];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { extractLink, extractTitle, extractProvider, extractPreview } from '@atlaskit/linking-common/extractors';
|
|
2
2
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
3
|
+
import { extractIsSupportTheming } from '../common/meta/extractIsSupportTheming';
|
|
3
4
|
const extractEmbedPreview = (jsonLd, platform, iframeUrlType) => {
|
|
4
5
|
const preview = extractPreview(jsonLd, platform, iframeUrlType);
|
|
5
6
|
if (preview && preview.src) {
|
|
@@ -9,12 +10,11 @@ const extractEmbedPreview = (jsonLd, platform, iframeUrlType) => {
|
|
|
9
10
|
};
|
|
10
11
|
}
|
|
11
12
|
};
|
|
12
|
-
export const extractEmbedProps = (jsonLd, meta, platform, iframeUrlType) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
13
|
+
export const extractEmbedProps = (jsonLd, meta, platform, iframeUrlType) => ({
|
|
14
|
+
link: extractLink(jsonLd) || '',
|
|
15
|
+
title: extractTitle(jsonLd),
|
|
16
|
+
context: extractProvider(jsonLd),
|
|
17
|
+
preview: extractEmbedPreview(jsonLd, platform, iframeUrlType),
|
|
18
|
+
isTrusted: extractIsTrusted(meta),
|
|
19
|
+
isSupportTheming: extractIsSupportTheming(meta)
|
|
20
|
+
});
|
|
@@ -2,9 +2,11 @@ import { extractDownloadUrl } from '../../common/detail';
|
|
|
2
2
|
import { extractPreview as extractPreviewData } from '@atlaskit/linking-common';
|
|
3
3
|
import { extractLink, extractProvider, extractTitle } from '@atlaskit/linking-common/extractors';
|
|
4
4
|
import { extractLinkIcon } from '../icon';
|
|
5
|
+
import { extractIsSupportTheming } from '../../common/meta/extractIsSupportTheming';
|
|
5
6
|
export const extractPreviewAction = response => {
|
|
6
7
|
var _extractPreviewData;
|
|
7
8
|
const data = response.data;
|
|
9
|
+
const meta = response.meta;
|
|
8
10
|
const src = (_extractPreviewData = extractPreviewData(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
|
|
9
11
|
if (src) {
|
|
10
12
|
var _extractProvider;
|
|
@@ -14,7 +16,8 @@ export const extractPreviewAction = response => {
|
|
|
14
16
|
src,
|
|
15
17
|
title: extractTitle(data),
|
|
16
18
|
linkIcon: extractLinkIcon(response),
|
|
17
|
-
url: extractLink(data)
|
|
19
|
+
url: extractLink(data),
|
|
20
|
+
isSupportTheming: extractIsSupportTheming(meta)
|
|
18
21
|
};
|
|
19
22
|
}
|
|
20
23
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -39,7 +39,8 @@ export const ResolvedView = ({
|
|
|
39
39
|
lozenge,
|
|
40
40
|
details = [],
|
|
41
41
|
testId = 'block-card-resolved-view',
|
|
42
|
-
showActions = true
|
|
42
|
+
showActions = true,
|
|
43
|
+
isSupportTheming
|
|
43
44
|
}) => {
|
|
44
45
|
const resolvedMetadata = details.length > 0 ? jsx(MetadataList, {
|
|
45
46
|
testId: testId ? `${testId}-meta` : undefined,
|
|
@@ -5,6 +5,7 @@ import LinkGlyph from '@atlaskit/icon/glyph/link';
|
|
|
5
5
|
import { ExpandedFrame } from '../components/ExpandedFrame';
|
|
6
6
|
import { ImageIcon } from '../components/ImageIcon';
|
|
7
7
|
import { Frame } from '../components/Frame';
|
|
8
|
+
import { useThemeObserver } from '@atlaskit/tokens';
|
|
8
9
|
export const EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(({
|
|
9
10
|
link,
|
|
10
11
|
context,
|
|
@@ -18,7 +19,8 @@ export const EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(({
|
|
|
18
19
|
testId = 'embed-card-resolved-view',
|
|
19
20
|
inheritDimensions,
|
|
20
21
|
onIframeDwell,
|
|
21
|
-
onIframeFocus
|
|
22
|
+
onIframeFocus,
|
|
23
|
+
isSupportTheming
|
|
22
24
|
}, embedIframeRef) => {
|
|
23
25
|
const iconFromContext = context === null || context === void 0 ? void 0 : context.icon;
|
|
24
26
|
const src = typeof iconFromContext === 'string' ? iconFromContext : undefined;
|
|
@@ -37,6 +39,13 @@ export const EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(({
|
|
|
37
39
|
default: linkGlyph
|
|
38
40
|
});
|
|
39
41
|
}, [src, linkGlyph, iconFromContext]);
|
|
42
|
+
const {
|
|
43
|
+
colorMode
|
|
44
|
+
} = useThemeObserver();
|
|
45
|
+
let previewUrl = preview === null || preview === void 0 ? void 0 : preview.src;
|
|
46
|
+
if (previewUrl && isSupportTheming && colorMode) {
|
|
47
|
+
previewUrl = `${previewUrl}${previewUrl.includes('?') ? '&' : '?'}themeMode=${colorMode}`;
|
|
48
|
+
}
|
|
40
49
|
return jsx(ExpandedFrame, {
|
|
41
50
|
isSelected: isSelected,
|
|
42
51
|
isFrameVisible: isFrameVisible,
|
|
@@ -48,7 +57,7 @@ export const EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(({
|
|
|
48
57
|
onClick: onClick,
|
|
49
58
|
inheritDimensions: inheritDimensions
|
|
50
59
|
}, jsx(Frame, {
|
|
51
|
-
url:
|
|
60
|
+
url: previewUrl,
|
|
52
61
|
isTrusted: isTrusted,
|
|
53
62
|
testId: testId,
|
|
54
63
|
ref: embedIframeRef,
|
|
@@ -6,6 +6,7 @@ import EmbedContent from './components/embed-content';
|
|
|
6
6
|
import { EmbedModalSize } from './types';
|
|
7
7
|
import withErrorBoundary from './components/error-boundary';
|
|
8
8
|
import withAnalytics from './components/analytics';
|
|
9
|
+
import { useThemeObserver } from '@atlaskit/tokens';
|
|
9
10
|
const toSize = width => width === MAX_MODAL_SIZE ? EmbedModalSize.Large : EmbedModalSize.Small;
|
|
10
11
|
const toWidth = size => size === EmbedModalSize.Large ? MAX_MODAL_SIZE : MIN_MODAL_SIZE;
|
|
11
12
|
const EmbedModal = ({
|
|
@@ -24,7 +25,8 @@ const EmbedModal = ({
|
|
|
24
25
|
src,
|
|
25
26
|
testId = 'smart-embed-preview-modal',
|
|
26
27
|
title,
|
|
27
|
-
url
|
|
28
|
+
url,
|
|
29
|
+
isSupportTheming
|
|
28
30
|
}) => {
|
|
29
31
|
const defaultWidth = toWidth(size);
|
|
30
32
|
const [isOpen, setIsOpen] = useState(showModal);
|
|
@@ -57,6 +59,13 @@ const EmbedModal = ({
|
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
61
|
}, [onResize, width]);
|
|
62
|
+
const {
|
|
63
|
+
colorMode
|
|
64
|
+
} = useThemeObserver();
|
|
65
|
+
let previewUrl = src;
|
|
66
|
+
if (previewUrl && isSupportTheming && colorMode) {
|
|
67
|
+
previewUrl = `${previewUrl}${previewUrl.includes('?') ? '&' : '?'}themeMode=${colorMode}`;
|
|
68
|
+
}
|
|
60
69
|
return /*#__PURE__*/React.createElement(ModalTransition, null, isOpen && /*#__PURE__*/React.createElement(ModalDialog, {
|
|
61
70
|
height: "100%",
|
|
62
71
|
onClose: handleOnClose,
|
|
@@ -78,7 +87,7 @@ const EmbedModal = ({
|
|
|
78
87
|
}), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(EmbedContent, {
|
|
79
88
|
isTrusted: isTrusted,
|
|
80
89
|
name: iframeName,
|
|
81
|
-
src:
|
|
90
|
+
src: previewUrl,
|
|
82
91
|
testId: testId
|
|
83
92
|
}))));
|
|
84
93
|
};
|
|
@@ -17,7 +17,8 @@ const PreviewAction = props => {
|
|
|
17
17
|
url,
|
|
18
18
|
title,
|
|
19
19
|
providerName,
|
|
20
|
-
downloadUrl
|
|
20
|
+
downloadUrl,
|
|
21
|
+
isSupportTheming
|
|
21
22
|
} = props;
|
|
22
23
|
const defaultAnalytics = useSmartLinkAnalytics(url, () => {});
|
|
23
24
|
const analytics = useFlexibleUiAnalyticsContext() || defaultAnalytics;
|
|
@@ -38,7 +39,8 @@ const PreviewAction = props => {
|
|
|
38
39
|
title,
|
|
39
40
|
url,
|
|
40
41
|
analytics,
|
|
41
|
-
origin: 'smartLinkCard'
|
|
42
|
+
origin: 'smartLinkCard',
|
|
43
|
+
isSupportTheming
|
|
42
44
|
});
|
|
43
45
|
const action = {
|
|
44
46
|
...props,
|
|
@@ -28,14 +28,15 @@ var extractBlockDetails = function extractBlockDetails(jsonLd) {
|
|
|
28
28
|
return !!detail;
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
-
export var extractBlockActions = function extractBlockActions(props, jsonLd, opts, platform) {
|
|
31
|
+
export var extractBlockActions = function extractBlockActions(props, jsonLd, opts, platform, meta) {
|
|
32
32
|
if (opts) {
|
|
33
33
|
var handleInvoke = opts.handleInvoke;
|
|
34
34
|
var actions = extractActions(jsonLd, handleInvoke);
|
|
35
35
|
var previewAction = extractPreviewAction(_objectSpread(_objectSpread({}, opts), {}, {
|
|
36
36
|
viewProps: props,
|
|
37
37
|
jsonLd: jsonLd,
|
|
38
|
-
platform: platform
|
|
38
|
+
platform: platform,
|
|
39
|
+
meta: meta
|
|
39
40
|
}));
|
|
40
41
|
|
|
41
42
|
// The previewAction should always be the last action
|
|
@@ -82,6 +83,6 @@ export var extractBlockProps = function extractBlockProps(jsonLd, meta, opts, re
|
|
|
82
83
|
isTrusted: extractIsTrusted(meta)
|
|
83
84
|
};
|
|
84
85
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
85
|
-
actions: extractBlockActions(props, jsonLd, opts, platform)
|
|
86
|
+
actions: extractBlockActions(props, jsonLd, opts, platform, meta)
|
|
86
87
|
});
|
|
87
88
|
};
|
|
@@ -5,6 +5,7 @@ import { extractDownloadUrl } from '../detail';
|
|
|
5
5
|
import { extractPreview, extractProvider } from '@atlaskit/linking-common/extractors';
|
|
6
6
|
import { PreviewAction } from '../../../view/BlockCard';
|
|
7
7
|
import { CardDisplay } from '../../../constants';
|
|
8
|
+
import { extractIsSupportTheming } from '../../common/meta/extractIsSupportTheming';
|
|
8
9
|
var getMetadataFromJsonLd = function getMetadataFromJsonLd(jsonLd, platform) {
|
|
9
10
|
var download = extractDownloadUrl(jsonLd);
|
|
10
11
|
var provider = extractProvider(jsonLd);
|
|
@@ -55,7 +56,8 @@ export var extractPreviewAction = function extractPreviewAction(_ref) {
|
|
|
55
56
|
origin = _ref.origin,
|
|
56
57
|
_ref$source = _ref.source,
|
|
57
58
|
source = _ref$source === void 0 ? 'block' : _ref$source,
|
|
58
|
-
analytics = _ref.analytics
|
|
59
|
+
analytics = _ref.analytics,
|
|
60
|
+
meta = _ref.meta;
|
|
59
61
|
// Extract metadata from view props & raw JSON-LD.
|
|
60
62
|
var metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
|
|
61
63
|
var metadataFromViewProps = getMetadataFromResolvedProps(viewProps);
|
|
@@ -73,7 +75,8 @@ export var extractPreviewAction = function extractPreviewAction(_ref) {
|
|
|
73
75
|
},
|
|
74
76
|
onViewActionClick: function onViewActionClick() {
|
|
75
77
|
handleInvoke(getInvokeOpts(key, 'ViewAction'));
|
|
76
|
-
}
|
|
78
|
+
},
|
|
79
|
+
isSupportTheming: extractIsSupportTheming(meta)
|
|
77
80
|
}));
|
|
78
81
|
// Setup props to go through proper Redux 'invocation' flow
|
|
79
82
|
// for analytics, further state management if required in future.
|
|
@@ -10,4 +10,7 @@ export var JIRA_INCIDENT = 'JiraIncident';
|
|
|
10
10
|
export var JIRA_SERVICE_REQUEST = 'JiraServiceRequest';
|
|
11
11
|
export var JIRA_CHANGE = 'JiraChange';
|
|
12
12
|
export var JIRA_PROBLEM = 'JiraProblem';
|
|
13
|
-
export var JIRA_CUSTOM_TASK_TYPE = 'JiraCustomTaskType';
|
|
13
|
+
export var JIRA_CUSTOM_TASK_TYPE = 'JiraCustomTaskType';
|
|
14
|
+
|
|
15
|
+
//List of provider keys that support theme modes for the embedded content.
|
|
16
|
+
export var PROVIDER_KEYS_WITH_THEMING = ['jira-object-provider', 'confluence-object-provider', 'watermelon-object-provider'];
|
|
@@ -3,6 +3,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import { extractLink, extractTitle, extractProvider, extractPreview } from '@atlaskit/linking-common/extractors';
|
|
5
5
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
6
|
+
import { extractIsSupportTheming } from '../common/meta/extractIsSupportTheming';
|
|
6
7
|
var extractEmbedPreview = function extractEmbedPreview(jsonLd, platform, iframeUrlType) {
|
|
7
8
|
var preview = extractPreview(jsonLd, platform, iframeUrlType);
|
|
8
9
|
if (preview && preview.src) {
|
|
@@ -17,6 +18,7 @@ export var extractEmbedProps = function extractEmbedProps(jsonLd, meta, platform
|
|
|
17
18
|
title: extractTitle(jsonLd),
|
|
18
19
|
context: extractProvider(jsonLd),
|
|
19
20
|
preview: extractEmbedPreview(jsonLd, platform, iframeUrlType),
|
|
20
|
-
isTrusted: extractIsTrusted(meta)
|
|
21
|
+
isTrusted: extractIsTrusted(meta),
|
|
22
|
+
isSupportTheming: extractIsSupportTheming(meta)
|
|
21
23
|
};
|
|
22
24
|
};
|
|
@@ -2,9 +2,11 @@ import { extractDownloadUrl } from '../../common/detail';
|
|
|
2
2
|
import { extractPreview as extractPreviewData } from '@atlaskit/linking-common';
|
|
3
3
|
import { extractLink, extractProvider, extractTitle } from '@atlaskit/linking-common/extractors';
|
|
4
4
|
import { extractLinkIcon } from '../icon';
|
|
5
|
+
import { extractIsSupportTheming } from '../../common/meta/extractIsSupportTheming';
|
|
5
6
|
export var extractPreviewAction = function extractPreviewAction(response) {
|
|
6
7
|
var _extractPreviewData;
|
|
7
8
|
var data = response.data;
|
|
9
|
+
var meta = response.meta;
|
|
8
10
|
var src = (_extractPreviewData = extractPreviewData(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
|
|
9
11
|
if (src) {
|
|
10
12
|
var _extractProvider;
|
|
@@ -14,7 +16,8 @@ export var extractPreviewAction = function extractPreviewAction(response) {
|
|
|
14
16
|
src: src,
|
|
15
17
|
title: extractTitle(data),
|
|
16
18
|
linkIcon: extractLinkIcon(response),
|
|
17
|
-
url: extractLink(data)
|
|
19
|
+
url: extractLink(data),
|
|
20
|
+
isSupportTheming: extractIsSupportTheming(meta)
|
|
18
21
|
};
|
|
19
22
|
}
|
|
20
23
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -53,7 +53,8 @@ export var ResolvedView = function ResolvedView(_ref) {
|
|
|
53
53
|
_ref$testId = _ref.testId,
|
|
54
54
|
testId = _ref$testId === void 0 ? 'block-card-resolved-view' : _ref$testId,
|
|
55
55
|
_ref$showActions = _ref.showActions,
|
|
56
|
-
showActions = _ref$showActions === void 0 ? true : _ref$showActions
|
|
56
|
+
showActions = _ref$showActions === void 0 ? true : _ref$showActions,
|
|
57
|
+
isSupportTheming = _ref.isSupportTheming;
|
|
57
58
|
var resolvedMetadata = details.length > 0 ? jsx(MetadataList, {
|
|
58
59
|
testId: testId ? "".concat(testId, "-meta") : undefined,
|
|
59
60
|
items: details
|
|
@@ -5,6 +5,7 @@ import LinkGlyph from '@atlaskit/icon/glyph/link';
|
|
|
5
5
|
import { ExpandedFrame } from '../components/ExpandedFrame';
|
|
6
6
|
import { ImageIcon } from '../components/ImageIcon';
|
|
7
7
|
import { Frame } from '../components/Frame';
|
|
8
|
+
import { useThemeObserver } from '@atlaskit/tokens';
|
|
8
9
|
export var EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(function (_ref, embedIframeRef) {
|
|
9
10
|
var link = _ref.link,
|
|
10
11
|
context = _ref.context,
|
|
@@ -19,7 +20,8 @@ export var EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(function (_ref,
|
|
|
19
20
|
testId = _ref$testId === void 0 ? 'embed-card-resolved-view' : _ref$testId,
|
|
20
21
|
inheritDimensions = _ref.inheritDimensions,
|
|
21
22
|
onIframeDwell = _ref.onIframeDwell,
|
|
22
|
-
onIframeFocus = _ref.onIframeFocus
|
|
23
|
+
onIframeFocus = _ref.onIframeFocus,
|
|
24
|
+
isSupportTheming = _ref.isSupportTheming;
|
|
23
25
|
var iconFromContext = context === null || context === void 0 ? void 0 : context.icon;
|
|
24
26
|
var src = typeof iconFromContext === 'string' ? iconFromContext : undefined;
|
|
25
27
|
var text = title || (context === null || context === void 0 ? void 0 : context.text);
|
|
@@ -39,6 +41,12 @@ export var EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(function (_ref,
|
|
|
39
41
|
default: linkGlyph
|
|
40
42
|
});
|
|
41
43
|
}, [src, linkGlyph, iconFromContext]);
|
|
44
|
+
var _useThemeObserver = useThemeObserver(),
|
|
45
|
+
colorMode = _useThemeObserver.colorMode;
|
|
46
|
+
var previewUrl = preview === null || preview === void 0 ? void 0 : preview.src;
|
|
47
|
+
if (previewUrl && isSupportTheming && colorMode) {
|
|
48
|
+
previewUrl = "".concat(previewUrl).concat(previewUrl.includes('?') ? '&' : '?', "themeMode=").concat(colorMode);
|
|
49
|
+
}
|
|
42
50
|
return jsx(ExpandedFrame, {
|
|
43
51
|
isSelected: isSelected,
|
|
44
52
|
isFrameVisible: isFrameVisible,
|
|
@@ -50,7 +58,7 @@ export var EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(function (_ref,
|
|
|
50
58
|
onClick: onClick,
|
|
51
59
|
inheritDimensions: inheritDimensions
|
|
52
60
|
}, jsx(Frame, {
|
|
53
|
-
url:
|
|
61
|
+
url: previewUrl,
|
|
54
62
|
isTrusted: isTrusted,
|
|
55
63
|
testId: testId,
|
|
56
64
|
ref: embedIframeRef,
|
|
@@ -7,6 +7,7 @@ import EmbedContent from './components/embed-content';
|
|
|
7
7
|
import { EmbedModalSize } from './types';
|
|
8
8
|
import withErrorBoundary from './components/error-boundary';
|
|
9
9
|
import withAnalytics from './components/analytics';
|
|
10
|
+
import { useThemeObserver } from '@atlaskit/tokens';
|
|
10
11
|
var toSize = function toSize(width) {
|
|
11
12
|
return width === MAX_MODAL_SIZE ? EmbedModalSize.Large : EmbedModalSize.Small;
|
|
12
13
|
};
|
|
@@ -32,7 +33,8 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
32
33
|
_ref$testId = _ref.testId,
|
|
33
34
|
testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
|
|
34
35
|
title = _ref.title,
|
|
35
|
-
url = _ref.url
|
|
36
|
+
url = _ref.url,
|
|
37
|
+
isSupportTheming = _ref.isSupportTheming;
|
|
36
38
|
var defaultWidth = toWidth(size);
|
|
37
39
|
var _useState = useState(showModal),
|
|
38
40
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -72,6 +74,12 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
72
74
|
});
|
|
73
75
|
}
|
|
74
76
|
}, [onResize, width]);
|
|
77
|
+
var _useThemeObserver = useThemeObserver(),
|
|
78
|
+
colorMode = _useThemeObserver.colorMode;
|
|
79
|
+
var previewUrl = src;
|
|
80
|
+
if (previewUrl && isSupportTheming && colorMode) {
|
|
81
|
+
previewUrl = "".concat(previewUrl).concat(previewUrl.includes('?') ? '&' : '?', "themeMode=").concat(colorMode);
|
|
82
|
+
}
|
|
75
83
|
return /*#__PURE__*/React.createElement(ModalTransition, null, isOpen && /*#__PURE__*/React.createElement(ModalDialog, {
|
|
76
84
|
height: "100%",
|
|
77
85
|
onClose: handleOnClose,
|
|
@@ -93,7 +101,7 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
93
101
|
}), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(EmbedContent, {
|
|
94
102
|
isTrusted: isTrusted,
|
|
95
103
|
name: iframeName,
|
|
96
|
-
src:
|
|
104
|
+
src: previewUrl,
|
|
97
105
|
testId: testId
|
|
98
106
|
}))));
|
|
99
107
|
};
|
|
@@ -23,7 +23,8 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
23
23
|
url = props.url,
|
|
24
24
|
title = props.title,
|
|
25
25
|
providerName = props.providerName,
|
|
26
|
-
downloadUrl = props.downloadUrl
|
|
26
|
+
downloadUrl = props.downloadUrl,
|
|
27
|
+
isSupportTheming = props.isSupportTheming;
|
|
27
28
|
var defaultAnalytics = useSmartLinkAnalytics(url, function () {});
|
|
28
29
|
var analytics = useFlexibleUiAnalyticsContext() || defaultAnalytics;
|
|
29
30
|
var EmbedIcon = {
|
|
@@ -44,7 +45,8 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
44
45
|
title: title,
|
|
45
46
|
url: url,
|
|
46
47
|
analytics: analytics,
|
|
47
|
-
origin: 'smartLinkCard'
|
|
48
|
+
origin: 'smartLinkCard',
|
|
49
|
+
isSupportTheming: isSupportTheming
|
|
48
50
|
});
|
|
49
51
|
};
|
|
50
52
|
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -4,6 +4,6 @@ import { LinkPerson } from '@atlaskit/linking-common/extractors';
|
|
|
4
4
|
import { ExtractBlockOpts } from './types';
|
|
5
5
|
import { BlockCardResolvedViewProps } from '../../view/BlockCard';
|
|
6
6
|
import { ActionProps } from '../../view/BlockCard/components/Action';
|
|
7
|
-
export declare const extractBlockActions: (props: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, opts?: ExtractBlockOpts | undefined, platform?: JsonLd.Primitives.Platforms | undefined) => ActionProps[];
|
|
7
|
+
export declare const extractBlockActions: (props: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, opts?: ExtractBlockOpts | undefined, platform?: JsonLd.Primitives.Platforms | undefined, meta?: JsonLd.Meta.BaseMeta | undefined) => ActionProps[];
|
|
8
8
|
export declare const extractBlockUsers: (jsonLd: JsonLd.Data.BaseData) => LinkPerson[] | undefined;
|
|
9
9
|
export declare const extractBlockProps: (jsonLd: JsonLd.Data.BaseData, meta?: JsonLd.Meta.BaseMeta | undefined, opts?: ExtractBlockOpts | undefined, renderers?: CardProviderRenderers | undefined, platform?: JsonLd.Primitives.Platforms | undefined) => BlockCardResolvedViewProps;
|
|
@@ -2,8 +2,9 @@ import { JsonLd } from 'json-ld-types';
|
|
|
2
2
|
import { CardPlatform } from '../../../view/Card/types';
|
|
3
3
|
import { BlockCardResolvedViewProps } from '../../../view/BlockCard';
|
|
4
4
|
import { ExtractBlockOpts } from '../../block/types';
|
|
5
|
-
export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source, analytics, }: ExtractBlockOpts & {
|
|
5
|
+
export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source, analytics, meta, }: ExtractBlockOpts & {
|
|
6
6
|
viewProps: BlockCardResolvedViewProps;
|
|
7
7
|
jsonLd: JsonLd.Data.BaseData;
|
|
8
8
|
platform?: JsonLd.Primitives.Platforms | undefined;
|
|
9
|
+
meta?: JsonLd.Meta.BaseMeta | undefined;
|
|
9
10
|
}) => import("../../../view/BlockCard/components/Action").ActionProps | undefined;
|
|
@@ -10,3 +10,4 @@ export declare const JIRA_SERVICE_REQUEST = "JiraServiceRequest";
|
|
|
10
10
|
export declare const JIRA_CHANGE = "JiraChange";
|
|
11
11
|
export declare const JIRA_PROBLEM = "JiraProblem";
|
|
12
12
|
export declare const JIRA_CUSTOM_TASK_TYPE = "JiraCustomTaskType";
|
|
13
|
+
export declare const PROVIDER_KEYS_WITH_THEMING: string[];
|
|
@@ -25,6 +25,7 @@ declare type PreviewInfo = {
|
|
|
25
25
|
onOpenFailed?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
26
26
|
analytics: AnalyticsFacade;
|
|
27
27
|
origin?: AnalyticsOrigin;
|
|
28
|
+
isSupportTheming?: boolean;
|
|
28
29
|
};
|
|
29
30
|
declare const _default: ({ details, ...rest }: PreviewInfo) => ActionProps;
|
|
30
31
|
export default _default;
|
|
@@ -28,7 +28,9 @@ export interface ResolvedViewProps {
|
|
|
28
28
|
showActions?: boolean;
|
|
29
29
|
titlePrefix?: React.ReactNode;
|
|
30
30
|
isTrusted?: boolean;
|
|
31
|
+
/** It determines whether a link source supports different design theme modes */
|
|
32
|
+
isSupportTheming?: boolean;
|
|
31
33
|
}
|
|
32
34
|
export declare const blockCardResolvedViewClassName = "block-card-resolved-view";
|
|
33
35
|
export declare const blockCardResolvedViewByClassName = "block-card-resolved-view-by";
|
|
34
|
-
export declare const ResolvedView: ({ icon, actions, thumbnail, context, title, titleTextColor, titlePrefix, isSelected, users, handleAvatarClick, handleMoreAvatarsClick, onClick, link, byline, lozenge, details, testId, showActions, }: ResolvedViewProps) => jsx.JSX.Element;
|
|
36
|
+
export declare const ResolvedView: ({ icon, actions, thumbnail, context, title, titleTextColor, titlePrefix, isSelected, users, handleAvatarClick, handleMoreAvatarsClick, onClick, link, byline, lozenge, details, testId, showActions, isSupportTheming, }: ResolvedViewProps) => jsx.JSX.Element;
|
|
@@ -24,6 +24,7 @@ export interface EmbedCardResolvedViewProps {
|
|
|
24
24
|
onClick?: (evt: React.MouseEvent) => void;
|
|
25
25
|
/** For testing purposes only. */
|
|
26
26
|
testId?: string;
|
|
27
|
+
isSupportTheming?: boolean;
|
|
27
28
|
inheritDimensions?: boolean;
|
|
28
29
|
/** Optional callback for when user dwells cursor over iframe - for analytics **/
|
|
29
30
|
onIframeDwell?: (dwellTime: number, dwellPercentVisible: number) => void;
|
|
@@ -5,6 +5,7 @@ declare const _default: React.FC<{
|
|
|
5
5
|
icon?: import("../common/Icon").IconProps | undefined;
|
|
6
6
|
iframeName: string;
|
|
7
7
|
isTrusted?: boolean | undefined;
|
|
8
|
+
isSupportTheming?: boolean | undefined;
|
|
8
9
|
onClose: (context: import("./types").EmbedModalContext) => void;
|
|
9
10
|
onDownloadActionClick?: (() => void) | undefined;
|
|
10
11
|
onOpen?: ((context: import("./types").EmbedModalContext) => void) | undefined;
|
|
@@ -14,6 +14,7 @@ export declare type EmbedModalProps = {
|
|
|
14
14
|
icon?: IconProps;
|
|
15
15
|
iframeName: string;
|
|
16
16
|
isTrusted?: boolean;
|
|
17
|
+
isSupportTheming?: boolean;
|
|
17
18
|
onClose: (context: EmbedModalContext) => void;
|
|
18
19
|
onDownloadActionClick?: () => void;
|
|
19
20
|
onOpen?: (context: EmbedModalContext) => void;
|