@atlaskit/smart-card 45.24.7 → 45.25.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 +18 -0
- package/dist/cjs/extractors/common/meta/extractIsSupportProductContext.js +10 -0
- package/dist/cjs/extractors/constants.js +5 -2
- package/dist/cjs/extractors/embed/index.js +2 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/get-preview-url-with-theme.js +21 -8
- package/dist/cjs/view/EmbedCard/views/ResolvedView.js +11 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/common/meta/extractIsSupportProductContext.js +4 -0
- package/dist/es2019/extractors/constants.js +4 -1
- package/dist/es2019/extractors/embed/index.js +2 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/get-preview-url-with-theme.js +20 -9
- package/dist/es2019/view/EmbedCard/views/ResolvedView.js +13 -3
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/common/meta/extractIsSupportProductContext.js +4 -0
- package/dist/esm/extractors/constants.js +4 -1
- package/dist/esm/extractors/embed/index.js +2 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/get-preview-url-with-theme.js +19 -7
- package/dist/esm/view/EmbedCard/views/ResolvedView.js +12 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/extractors/common/meta/extractIsSupportProductContext.d.ts +2 -0
- package/dist/types/extractors/constants.d.ts +1 -0
- package/dist/types/utils/get-preview-url-with-theme.d.ts +6 -0
- package/dist/types/view/EmbedCard/views/ResolvedView.d.ts +2 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 45.25.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 45.25.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`ddf9deb4c8100`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ddf9deb4c8100) -
|
|
14
|
+
Add host product context support to Smart Link embed URLs (gated by
|
|
15
|
+
platform_avp_smartlink_embed_product_context).
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 45.24.7
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.extractIsSupportProductContext = void 0;
|
|
7
|
+
var _constants = require("../../constants");
|
|
8
|
+
var extractIsSupportProductContext = exports.extractIsSupportProductContext = function extractIsSupportProductContext(meta) {
|
|
9
|
+
return Boolean((meta === null || meta === void 0 ? void 0 : meta.key) && _constants.PROVIDER_KEYS_WITH_HOSTPRODUCT_CONTEXT.includes(meta.key));
|
|
10
|
+
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
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;
|
|
6
|
+
exports.PROVIDER_KEYS_WITH_THEMING = exports.PROVIDER_KEYS_WITH_HOSTPRODUCT_CONTEXT = 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 = exports.CONFLUENCE_GENERATOR_ID = 'https://www.atlassian.com/#Confluence';
|
|
8
8
|
var JIRA_GENERATOR_ID = exports.JIRA_GENERATOR_ID = 'https://www.atlassian.com/#Jira';
|
|
9
9
|
// To support icons for all Jira task types.
|
|
@@ -19,4 +19,7 @@ var JIRA_PROBLEM = exports.JIRA_PROBLEM = 'JiraProblem';
|
|
|
19
19
|
var JIRA_CUSTOM_TASK_TYPE = exports.JIRA_CUSTOM_TASK_TYPE = 'JiraCustomTaskType';
|
|
20
20
|
|
|
21
21
|
//List of provider keys that support theme modes for the embedded content.
|
|
22
|
-
var PROVIDER_KEYS_WITH_THEMING = exports.PROVIDER_KEYS_WITH_THEMING = ['jira-object-provider', 'confluence-object-provider', 'watermelon-object-provider', 'legion-object-provider', '
|
|
22
|
+
var PROVIDER_KEYS_WITH_THEMING = exports.PROVIDER_KEYS_WITH_THEMING = ['jira-object-provider', 'confluence-object-provider', 'watermelon-object-provider', 'legion-object-provider', 'avpplatform-object-provider'];
|
|
23
|
+
|
|
24
|
+
// List of provider keys that receive the product hosting the embedded content.
|
|
25
|
+
var PROVIDER_KEYS_WITH_HOSTPRODUCT_CONTEXT = exports.PROVIDER_KEYS_WITH_HOSTPRODUCT_CONTEXT = ['avpplatform-object-provider'];
|
|
@@ -9,6 +9,7 @@ var _extractSmartLinkTitle = require("@atlaskit/link-extractors/extract-smart-li
|
|
|
9
9
|
var _extractSmartLinkUrl = require("@atlaskit/link-extractors/extract-smart-link-url");
|
|
10
10
|
var _extractType = require("@atlaskit/link-extractors/extract-type");
|
|
11
11
|
var _getEmptyJsonLd = require("../../utils/get-empty-json-ld");
|
|
12
|
+
var _extractIsSupportProductContext = require("../common/meta/extractIsSupportProductContext");
|
|
12
13
|
var _extractIsSupportTheming = require("../common/meta/extractIsSupportTheming");
|
|
13
14
|
var _extractIsTrusted = require("../common/meta/extractIsTrusted");
|
|
14
15
|
var _extractSmartLinkContext = require("./extract-smart-link-context");
|
|
@@ -21,6 +22,7 @@ var extractEmbedProps = exports.extractEmbedProps = function extractEmbedProps(r
|
|
|
21
22
|
context: (0, _extractSmartLinkContext.extractSmartLinkContext)(response),
|
|
22
23
|
preview: (0, _extractSmartLinkEmbed.extractSmartLinkEmbed)(response, iframeUrlType),
|
|
23
24
|
isTrusted: (0, _extractIsTrusted.extractIsTrusted)(meta),
|
|
25
|
+
isSupportProductContext: (0, _extractIsSupportProductContext.extractIsSupportProductContext)(meta),
|
|
24
26
|
isSupportTheming: (0, _extractIsSupportTheming.extractIsSupportTheming)(meta),
|
|
25
27
|
type: (0, _extractType.extractType)(jsonLd)
|
|
26
28
|
};
|
|
@@ -25,7 +25,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
25
25
|
var context = exports.context = {
|
|
26
26
|
componentName: 'smart-cards',
|
|
27
27
|
packageName: "@atlaskit/smart-card" || '',
|
|
28
|
-
packageVersion: "45.
|
|
28
|
+
packageVersion: "45.25.0" || ''
|
|
29
29
|
};
|
|
30
30
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
31
31
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -3,19 +3,32 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getPreviewUrlWithTheme = void 0;
|
|
6
|
+
exports.getPreviewUrlWithTheme = exports.getPreviewUrlWithEmbedContext = void 0;
|
|
7
7
|
var _themeObjectToString = require("@atlaskit/tokens/theme-object-to-string");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @param themeState
|
|
12
|
-
*/
|
|
13
|
-
var getPreviewUrlWithTheme = exports.getPreviewUrlWithTheme = function getPreviewUrlWithTheme(previewUrl, themeState) {
|
|
8
|
+
var getPreviewUrlWithEmbedContext = exports.getPreviewUrlWithEmbedContext = function getPreviewUrlWithEmbedContext(previewUrl, _ref) {
|
|
9
|
+
var hostProduct = _ref.hostProduct,
|
|
10
|
+
themeState = _ref.themeState;
|
|
14
11
|
try {
|
|
15
12
|
var url = new URL(previewUrl);
|
|
16
|
-
|
|
13
|
+
if (themeState) {
|
|
14
|
+
url.searchParams.append('themeState', (0, _themeObjectToString.themeObjectToString)(themeState));
|
|
15
|
+
}
|
|
16
|
+
if (hostProduct) {
|
|
17
|
+
url.searchParams.set('hostProduct', hostProduct);
|
|
18
|
+
}
|
|
17
19
|
return url.href;
|
|
18
20
|
} catch (_unused) {
|
|
19
21
|
return previewUrl;
|
|
20
22
|
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Append a theme to the URL if it exists
|
|
27
|
+
* @param previewUrl
|
|
28
|
+
* @param themeState
|
|
29
|
+
*/
|
|
30
|
+
var getPreviewUrlWithTheme = exports.getPreviewUrlWithTheme = function getPreviewUrlWithTheme(previewUrl, themeState) {
|
|
31
|
+
return getPreviewUrlWithEmbedContext(previewUrl, {
|
|
32
|
+
themeState: themeState
|
|
33
|
+
});
|
|
21
34
|
};
|
|
@@ -13,7 +13,9 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
var _reactLoadable = _interopRequireDefault(require("react-loadable"));
|
|
15
15
|
var _link = _interopRequireDefault(require("@atlaskit/icon/core/link"));
|
|
16
|
+
var _useSmartLinkContext2 = require("@atlaskit/link-provider/use-smart-link-context");
|
|
16
17
|
var _componentWithFg = require("@atlaskit/platform-feature-flags-react/component-with-fg");
|
|
18
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
17
19
|
var _useThemeObserver = require("@atlaskit/tokens/use-theme-observer");
|
|
18
20
|
var _constants = require("../../../constants");
|
|
19
21
|
var _extractRovoChatAction = _interopRequireDefault(require("../../../extractors/flexible/actions/extract-rovo-chat-action"));
|
|
@@ -117,6 +119,7 @@ var EmbedCardResolvedView = exports.EmbedCardResolvedView = /*#__PURE__*/_react.
|
|
|
117
119
|
onIframeFocus = _ref3.onIframeFocus,
|
|
118
120
|
onIframeMouseEnter = _ref3.onIframeMouseEnter,
|
|
119
121
|
onIframeMouseLeave = _ref3.onIframeMouseLeave,
|
|
122
|
+
isSupportProductContext = _ref3.isSupportProductContext,
|
|
120
123
|
isSupportTheming = _ref3.isSupportTheming,
|
|
121
124
|
type = _ref3.type,
|
|
122
125
|
CompetitorPrompt = _ref3.CompetitorPrompt,
|
|
@@ -150,9 +153,15 @@ var EmbedCardResolvedView = exports.EmbedCardResolvedView = /*#__PURE__*/_react.
|
|
|
150
153
|
embedIframeRef: embedIframeRef
|
|
151
154
|
});
|
|
152
155
|
var themeState = (0, _useThemeObserver.useThemeObserver)();
|
|
156
|
+
var _useSmartLinkContext = (0, _useSmartLinkContext2.useSmartLinkContext)(),
|
|
157
|
+
product = _useSmartLinkContext.product;
|
|
153
158
|
var previewUrl = preview === null || preview === void 0 ? void 0 : preview.src;
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
var hostProduct = (0, _fg.fg)('platform_avp_smartlink_embed_product_context') && isSupportProductContext ? product : undefined;
|
|
160
|
+
if (previewUrl && (isSupportTheming || hostProduct)) {
|
|
161
|
+
previewUrl = (0, _getPreviewUrlWithTheme.getPreviewUrlWithEmbedContext)(previewUrl, {
|
|
162
|
+
hostProduct: hostProduct,
|
|
163
|
+
themeState: isSupportTheming ? themeState : undefined
|
|
164
|
+
});
|
|
156
165
|
}
|
|
157
166
|
var _React$useState = _react.default.useState(false),
|
|
158
167
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
@@ -19,7 +19,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
19
19
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
20
20
|
var PACKAGE_DATA = {
|
|
21
21
|
packageName: "@atlaskit/smart-card",
|
|
22
|
-
packageVersion: "45.
|
|
22
|
+
packageVersion: "45.25.0",
|
|
23
23
|
componentName: 'linkUrl'
|
|
24
24
|
};
|
|
25
25
|
var LinkUrl = function LinkUrl(_ref) {
|
|
@@ -13,4 +13,7 @@ export const JIRA_PROBLEM = 'JiraProblem';
|
|
|
13
13
|
export const JIRA_CUSTOM_TASK_TYPE = 'JiraCustomTaskType';
|
|
14
14
|
|
|
15
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', 'legion-object-provider', '
|
|
16
|
+
export const PROVIDER_KEYS_WITH_THEMING = ['jira-object-provider', 'confluence-object-provider', 'watermelon-object-provider', 'legion-object-provider', 'avpplatform-object-provider'];
|
|
17
|
+
|
|
18
|
+
// List of provider keys that receive the product hosting the embedded content.
|
|
19
|
+
export const PROVIDER_KEYS_WITH_HOSTPRODUCT_CONTEXT = ['avpplatform-object-provider'];
|
|
@@ -3,6 +3,7 @@ import { extractSmartLinkTitle } from '@atlaskit/link-extractors/extract-smart-l
|
|
|
3
3
|
import { extractSmartLinkUrl } from '@atlaskit/link-extractors/extract-smart-link-url';
|
|
4
4
|
import { extractType } from '@atlaskit/link-extractors/extract-type';
|
|
5
5
|
import { getEmptyJsonLd } from '../../utils/get-empty-json-ld';
|
|
6
|
+
import { extractIsSupportProductContext } from '../common/meta/extractIsSupportProductContext';
|
|
6
7
|
import { extractIsSupportTheming } from '../common/meta/extractIsSupportTheming';
|
|
7
8
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
8
9
|
import { extractSmartLinkContext } from './extract-smart-link-context';
|
|
@@ -15,6 +16,7 @@ export const extractEmbedProps = (response, _platform, iframeUrlType) => {
|
|
|
15
16
|
context: extractSmartLinkContext(response),
|
|
16
17
|
preview: extractSmartLinkEmbed(response, iframeUrlType),
|
|
17
18
|
isTrusted: extractIsTrusted(meta),
|
|
19
|
+
isSupportProductContext: extractIsSupportProductContext(meta),
|
|
18
20
|
isSupportTheming: extractIsSupportTheming(meta),
|
|
19
21
|
type: extractType(jsonLd)
|
|
20
22
|
};
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card" || '',
|
|
7
|
-
packageVersion: "45.
|
|
7
|
+
packageVersion: "45.25.0" || ''
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { themeObjectToString } from '@atlaskit/tokens/theme-object-to-string';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* @param themeState
|
|
7
|
-
*/
|
|
8
|
-
export const getPreviewUrlWithTheme = (previewUrl, themeState) => {
|
|
2
|
+
export const getPreviewUrlWithEmbedContext = (previewUrl, {
|
|
3
|
+
hostProduct,
|
|
4
|
+
themeState
|
|
5
|
+
}) => {
|
|
9
6
|
try {
|
|
10
7
|
const url = new URL(previewUrl);
|
|
11
|
-
|
|
8
|
+
if (themeState) {
|
|
9
|
+
url.searchParams.append('themeState', themeObjectToString(themeState));
|
|
10
|
+
}
|
|
11
|
+
if (hostProduct) {
|
|
12
|
+
url.searchParams.set('hostProduct', hostProduct);
|
|
13
|
+
}
|
|
12
14
|
return url.href;
|
|
13
15
|
} catch {
|
|
14
16
|
return previewUrl;
|
|
15
17
|
}
|
|
16
|
-
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Append a theme to the URL if it exists
|
|
22
|
+
* @param previewUrl
|
|
23
|
+
* @param themeState
|
|
24
|
+
*/
|
|
25
|
+
export const getPreviewUrlWithTheme = (previewUrl, themeState) => getPreviewUrlWithEmbedContext(previewUrl, {
|
|
26
|
+
themeState
|
|
27
|
+
});
|
|
@@ -4,14 +4,16 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import Loadable from 'react-loadable';
|
|
6
6
|
import LinkGlyph from '@atlaskit/icon/core/link';
|
|
7
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
7
8
|
import { componentWithFG } from '@atlaskit/platform-feature-flags-react/component-with-fg';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
10
|
import { useThemeObserver } from '@atlaskit/tokens/use-theme-observer';
|
|
9
11
|
import { CardDisplay } from '../../../constants';
|
|
10
12
|
import extractRovoChatAction from '../../../extractors/flexible/actions/extract-rovo-chat-action';
|
|
11
13
|
import { getExtensionKey } from '../../../state/getExtensionKey';
|
|
12
14
|
import useEmbedRovoActionsFooterExperiment from '../../../state/hooks/use-embed-rovo-actions-footer-experiment';
|
|
13
15
|
import useRovoConfig from '../../../state/hooks/use-rovo-config';
|
|
14
|
-
import {
|
|
16
|
+
import { getPreviewUrlWithEmbedContext } from '../../../utils/get-preview-url-with-theme';
|
|
15
17
|
import { isProfileType } from '../../../utils/is-profile-type';
|
|
16
18
|
import { getRovoPostAuthPromptKeys } from '../../common/rovo-post-auth-prompts';
|
|
17
19
|
import { ExpandedFrame } from '../components/ExpandedFrame';
|
|
@@ -96,6 +98,7 @@ export const EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(({
|
|
|
96
98
|
onIframeFocus,
|
|
97
99
|
onIframeMouseEnter,
|
|
98
100
|
onIframeMouseLeave,
|
|
101
|
+
isSupportProductContext,
|
|
99
102
|
isSupportTheming,
|
|
100
103
|
type,
|
|
101
104
|
CompetitorPrompt,
|
|
@@ -128,9 +131,16 @@ export const EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(({
|
|
|
128
131
|
embedIframeRef
|
|
129
132
|
});
|
|
130
133
|
const themeState = useThemeObserver();
|
|
134
|
+
const {
|
|
135
|
+
product
|
|
136
|
+
} = useSmartLinkContext();
|
|
131
137
|
let previewUrl = preview === null || preview === void 0 ? void 0 : preview.src;
|
|
132
|
-
|
|
133
|
-
|
|
138
|
+
const hostProduct = fg('platform_avp_smartlink_embed_product_context') && isSupportProductContext ? product : undefined;
|
|
139
|
+
if (previewUrl && (isSupportTheming || hostProduct)) {
|
|
140
|
+
previewUrl = getPreviewUrlWithEmbedContext(previewUrl, {
|
|
141
|
+
hostProduct,
|
|
142
|
+
themeState: isSupportTheming ? themeState : undefined
|
|
143
|
+
});
|
|
134
144
|
}
|
|
135
145
|
const [isMouseOver, setMouseOver] = React.useState(false);
|
|
136
146
|
const frame = /*#__PURE__*/React.createElement(Frame, {
|
|
@@ -9,7 +9,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
9
9
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
10
10
|
const PACKAGE_DATA = {
|
|
11
11
|
packageName: "@atlaskit/smart-card",
|
|
12
|
-
packageVersion: "45.
|
|
12
|
+
packageVersion: "45.25.0",
|
|
13
13
|
componentName: 'linkUrl'
|
|
14
14
|
};
|
|
15
15
|
const LinkUrl = ({
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PROVIDER_KEYS_WITH_HOSTPRODUCT_CONTEXT } from '../../constants';
|
|
2
|
+
export var extractIsSupportProductContext = function extractIsSupportProductContext(meta) {
|
|
3
|
+
return Boolean((meta === null || meta === void 0 ? void 0 : meta.key) && PROVIDER_KEYS_WITH_HOSTPRODUCT_CONTEXT.includes(meta.key));
|
|
4
|
+
};
|
|
@@ -13,4 +13,7 @@ export var JIRA_PROBLEM = 'JiraProblem';
|
|
|
13
13
|
export var JIRA_CUSTOM_TASK_TYPE = 'JiraCustomTaskType';
|
|
14
14
|
|
|
15
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', 'legion-object-provider', '
|
|
16
|
+
export var PROVIDER_KEYS_WITH_THEMING = ['jira-object-provider', 'confluence-object-provider', 'watermelon-object-provider', 'legion-object-provider', 'avpplatform-object-provider'];
|
|
17
|
+
|
|
18
|
+
// List of provider keys that receive the product hosting the embedded content.
|
|
19
|
+
export var PROVIDER_KEYS_WITH_HOSTPRODUCT_CONTEXT = ['avpplatform-object-provider'];
|
|
@@ -3,6 +3,7 @@ import { extractSmartLinkTitle } from '@atlaskit/link-extractors/extract-smart-l
|
|
|
3
3
|
import { extractSmartLinkUrl } from '@atlaskit/link-extractors/extract-smart-link-url';
|
|
4
4
|
import { extractType } from '@atlaskit/link-extractors/extract-type';
|
|
5
5
|
import { getEmptyJsonLd } from '../../utils/get-empty-json-ld';
|
|
6
|
+
import { extractIsSupportProductContext } from '../common/meta/extractIsSupportProductContext';
|
|
6
7
|
import { extractIsSupportTheming } from '../common/meta/extractIsSupportTheming';
|
|
7
8
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
8
9
|
import { extractSmartLinkContext } from './extract-smart-link-context';
|
|
@@ -15,6 +16,7 @@ export var extractEmbedProps = function extractEmbedProps(response, _platform, i
|
|
|
15
16
|
context: extractSmartLinkContext(response),
|
|
16
17
|
preview: extractSmartLinkEmbed(response, iframeUrlType),
|
|
17
18
|
isTrusted: extractIsTrusted(meta),
|
|
19
|
+
isSupportProductContext: extractIsSupportProductContext(meta),
|
|
18
20
|
isSupportTheming: extractIsSupportTheming(meta),
|
|
19
21
|
type: extractType(jsonLd)
|
|
20
22
|
};
|
|
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export var context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card" || '',
|
|
7
|
-
packageVersion: "45.
|
|
7
|
+
packageVersion: "45.25.0" || ''
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { themeObjectToString } from '@atlaskit/tokens/theme-object-to-string';
|
|
2
|
+
export var getPreviewUrlWithEmbedContext = function getPreviewUrlWithEmbedContext(previewUrl, _ref) {
|
|
3
|
+
var hostProduct = _ref.hostProduct,
|
|
4
|
+
themeState = _ref.themeState;
|
|
5
|
+
try {
|
|
6
|
+
var url = new URL(previewUrl);
|
|
7
|
+
if (themeState) {
|
|
8
|
+
url.searchParams.append('themeState', themeObjectToString(themeState));
|
|
9
|
+
}
|
|
10
|
+
if (hostProduct) {
|
|
11
|
+
url.searchParams.set('hostProduct', hostProduct);
|
|
12
|
+
}
|
|
13
|
+
return url.href;
|
|
14
|
+
} catch (_unused) {
|
|
15
|
+
return previewUrl;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
2
18
|
|
|
3
19
|
/**
|
|
4
20
|
* Append a theme to the URL if it exists
|
|
@@ -6,11 +22,7 @@ import { themeObjectToString } from '@atlaskit/tokens/theme-object-to-string';
|
|
|
6
22
|
* @param themeState
|
|
7
23
|
*/
|
|
8
24
|
export var getPreviewUrlWithTheme = function getPreviewUrlWithTheme(previewUrl, themeState) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return url.href;
|
|
13
|
-
} catch (_unused) {
|
|
14
|
-
return previewUrl;
|
|
15
|
-
}
|
|
25
|
+
return getPreviewUrlWithEmbedContext(previewUrl, {
|
|
26
|
+
themeState: themeState
|
|
27
|
+
});
|
|
16
28
|
};
|
|
@@ -5,14 +5,16 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import Loadable from 'react-loadable';
|
|
7
7
|
import LinkGlyph from '@atlaskit/icon/core/link';
|
|
8
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
8
9
|
import { componentWithFG } from '@atlaskit/platform-feature-flags-react/component-with-fg';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
11
|
import { useThemeObserver } from '@atlaskit/tokens/use-theme-observer';
|
|
10
12
|
import { CardDisplay } from '../../../constants';
|
|
11
13
|
import extractRovoChatAction from '../../../extractors/flexible/actions/extract-rovo-chat-action';
|
|
12
14
|
import { getExtensionKey } from '../../../state/getExtensionKey';
|
|
13
15
|
import useEmbedRovoActionsFooterExperiment from '../../../state/hooks/use-embed-rovo-actions-footer-experiment';
|
|
14
16
|
import useRovoConfig from '../../../state/hooks/use-rovo-config';
|
|
15
|
-
import {
|
|
17
|
+
import { getPreviewUrlWithEmbedContext } from '../../../utils/get-preview-url-with-theme';
|
|
16
18
|
import { isProfileType } from '../../../utils/is-profile-type';
|
|
17
19
|
import { getRovoPostAuthPromptKeys } from '../../common/rovo-post-auth-prompts';
|
|
18
20
|
import { ExpandedFrame } from '../components/ExpandedFrame';
|
|
@@ -106,6 +108,7 @@ export var EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(function (_ref3
|
|
|
106
108
|
onIframeFocus = _ref3.onIframeFocus,
|
|
107
109
|
onIframeMouseEnter = _ref3.onIframeMouseEnter,
|
|
108
110
|
onIframeMouseLeave = _ref3.onIframeMouseLeave,
|
|
111
|
+
isSupportProductContext = _ref3.isSupportProductContext,
|
|
109
112
|
isSupportTheming = _ref3.isSupportTheming,
|
|
110
113
|
type = _ref3.type,
|
|
111
114
|
CompetitorPrompt = _ref3.CompetitorPrompt,
|
|
@@ -139,9 +142,15 @@ export var EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(function (_ref3
|
|
|
139
142
|
embedIframeRef: embedIframeRef
|
|
140
143
|
});
|
|
141
144
|
var themeState = useThemeObserver();
|
|
145
|
+
var _useSmartLinkContext = useSmartLinkContext(),
|
|
146
|
+
product = _useSmartLinkContext.product;
|
|
142
147
|
var previewUrl = preview === null || preview === void 0 ? void 0 : preview.src;
|
|
143
|
-
|
|
144
|
-
|
|
148
|
+
var hostProduct = fg('platform_avp_smartlink_embed_product_context') && isSupportProductContext ? product : undefined;
|
|
149
|
+
if (previewUrl && (isSupportTheming || hostProduct)) {
|
|
150
|
+
previewUrl = getPreviewUrlWithEmbedContext(previewUrl, {
|
|
151
|
+
hostProduct: hostProduct,
|
|
152
|
+
themeState: isSupportTheming ? themeState : undefined
|
|
153
|
+
});
|
|
145
154
|
}
|
|
146
155
|
var _React$useState = React.useState(false),
|
|
147
156
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
12
12
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
13
13
|
var PACKAGE_DATA = {
|
|
14
14
|
packageName: "@atlaskit/smart-card",
|
|
15
|
-
packageVersion: "45.
|
|
15
|
+
packageVersion: "45.25.0",
|
|
16
16
|
componentName: 'linkUrl'
|
|
17
17
|
};
|
|
18
18
|
var LinkUrl = function LinkUrl(_ref) {
|
|
@@ -11,3 +11,4 @@ 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
13
|
export declare const PROVIDER_KEYS_WITH_THEMING: string[];
|
|
14
|
+
export declare const PROVIDER_KEYS_WITH_HOSTPRODUCT_CONTEXT: string[];
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { ActiveThemeState } from '@atlaskit/tokens/theme-config';
|
|
2
|
+
type EmbedContext = {
|
|
3
|
+
hostProduct?: string;
|
|
4
|
+
themeState?: Partial<ActiveThemeState>;
|
|
5
|
+
};
|
|
6
|
+
export declare const getPreviewUrlWithEmbedContext: (previewUrl: string, { hostProduct, themeState }: EmbedContext) => string;
|
|
2
7
|
/**
|
|
3
8
|
* Append a theme to the URL if it exists
|
|
4
9
|
* @param previewUrl
|
|
5
10
|
* @param themeState
|
|
6
11
|
*/
|
|
7
12
|
export declare const getPreviewUrlWithTheme: (previewUrl: string, themeState: Partial<ActiveThemeState>) => string;
|
|
13
|
+
export {};
|
|
@@ -25,6 +25,8 @@ export interface EmbedCardResolvedViewProps {
|
|
|
25
25
|
inheritDimensions?: boolean;
|
|
26
26
|
/** A flag that determines whether the card is selected in edit mode. */
|
|
27
27
|
isSelected?: boolean;
|
|
28
|
+
/** Whether the link source receives the hosting product in its iframe URL. */
|
|
29
|
+
isSupportProductContext?: boolean;
|
|
28
30
|
isSupportTheming?: boolean;
|
|
29
31
|
/** A flag that determines whether link source can be trusted in iframe **/
|
|
30
32
|
isTrusted?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "45.
|
|
3
|
+
"version": "45.25.1",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@atlaskit/avatar-group": "^14.3.0",
|
|
48
48
|
"@atlaskit/badge": "^21.2.0",
|
|
49
49
|
"@atlaskit/browser-apis": "^1.2.0",
|
|
50
|
-
"@atlaskit/button": "^25.
|
|
50
|
+
"@atlaskit/button": "^25.4.0",
|
|
51
51
|
"@atlaskit/checkbox": "^19.2.0",
|
|
52
52
|
"@atlaskit/css": "^1.1.0",
|
|
53
53
|
"@atlaskit/dropdown-menu": "^18.3.0",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@atlaskit/textfield": "^10.2.0",
|
|
94
94
|
"@atlaskit/theme": "^28.2.0",
|
|
95
95
|
"@atlaskit/tile": "^4.1.0",
|
|
96
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
96
|
+
"@atlaskit/tmp-editor-statsig": "^202.0.0",
|
|
97
97
|
"@atlaskit/tokens": "^18.2.0",
|
|
98
98
|
"@atlaskit/tooltip": "^24.3.0",
|
|
99
99
|
"@atlaskit/ufo": "^1.2.0",
|
|
@@ -175,6 +175,9 @@
|
|
|
175
175
|
"platform_bandicoots-smartlink-unresolved-error-key": {
|
|
176
176
|
"type": "boolean"
|
|
177
177
|
},
|
|
178
|
+
"platform_avp_smartlink_embed_product_context": {
|
|
179
|
+
"type": "boolean"
|
|
180
|
+
},
|
|
178
181
|
"platform-smart-card-shift-key": {
|
|
179
182
|
"type": "boolean"
|
|
180
183
|
},
|