@atlaskit/smart-card 45.21.0 → 45.21.3
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 +36 -0
- package/dist/cjs/extractors/action/extract-invoke-view-action.js +2 -8
- package/dist/cjs/extractors/flexible/actions/index.js +2 -3
- package/dist/cjs/extractors/flexible/extract-state.js +3 -4
- package/dist/cjs/extractors/flexible/index.js +3 -4
- package/dist/cjs/state/hooks/use-destination-url/index.js +6 -11
- package/dist/cjs/state/hooks/use-smart-link-cross-product-url-wrapper/index.js +49 -10
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +5 -6
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +62 -111
- package/dist/cjs/view/FlexibleCard/index.js +2 -3
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +16 -23
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/action/extract-invoke-view-action.js +3 -7
- package/dist/es2019/extractors/flexible/actions/index.js +1 -3
- package/dist/es2019/extractors/flexible/extract-state.js +2 -4
- package/dist/es2019/extractors/flexible/index.js +2 -4
- package/dist/es2019/state/hooks/use-destination-url/index.js +4 -7
- package/dist/es2019/state/hooks/use-smart-link-cross-product-url-wrapper/index.js +47 -5
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +5 -7
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +64 -113
- package/dist/es2019/view/FlexibleCard/index.js +3 -4
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +16 -20
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/action/extract-invoke-view-action.js +2 -8
- package/dist/esm/extractors/flexible/actions/index.js +2 -3
- package/dist/esm/extractors/flexible/extract-state.js +3 -4
- package/dist/esm/extractors/flexible/index.js +3 -4
- package/dist/esm/state/hooks/use-destination-url/index.js +4 -9
- package/dist/esm/state/hooks/use-smart-link-cross-product-url-wrapper/index.js +47 -9
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +6 -7
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +63 -112
- package/dist/esm/view/FlexibleCard/index.js +3 -4
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +17 -24
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/hooks/use-destination-url/index.d.ts +18 -1
- package/dist/types/state/hooks/use-smart-link-cross-product-url-wrapper/index.d.ts +5 -2
- package/package.json +3 -5
- package/dist/cjs/state/hooks/use-smart-link-cross-product-url-wrapper/useSmartLinkCrossProductUrlWrapper.js +0 -54
- package/dist/es2019/state/hooks/use-smart-link-cross-product-url-wrapper/useSmartLinkCrossProductUrlWrapper.js +0 -47
- package/dist/esm/state/hooks/use-smart-link-cross-product-url-wrapper/useSmartLinkCrossProductUrlWrapper.js +0 -47
- package/dist/types/state/hooks/use-smart-link-cross-product-url-wrapper/useSmartLinkCrossProductUrlWrapper.d.ts +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 45.21.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 45.21.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 45.21.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`b94131fcee276`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b94131fcee276) -
|
|
20
|
+
Removes the `platform_smartlink_xpc_url_wrapping` feature gate and makes cross-product URL
|
|
21
|
+
wrapping for Smart Links permanent, on for all consumers.
|
|
22
|
+
|
|
23
|
+
What this behavior does: when a resolved Smart Link points to a first-party Atlassian destination
|
|
24
|
+
(e.g. a Jira issue, Confluence page), the URL used for navigation — via click, "Open link", or any
|
|
25
|
+
other destination-URL usage — now has a short-lived interaction-session query parameter (`xpis`)
|
|
26
|
+
appended automatically. This lets the destination product attribute the visit back to the product
|
|
27
|
+
and surface the link was opened from, powering cross-product usage analytics. It has no effect on:
|
|
28
|
+
- third-party (non-Atlassian) links,
|
|
29
|
+
- links that are not yet resolved,
|
|
30
|
+
- URLs that already contain the parameter.
|
|
31
|
+
|
|
32
|
+
No API shape changes: this only affects the resolved value returned by existing Smart Link
|
|
33
|
+
URL/navigation behavior (e.g. `Card`, `useSmartLinkDestinationUrl`, inline/block/embed card
|
|
34
|
+
click-through, and datasource table link cells). No new props, exports, or configuration are
|
|
35
|
+
introduced, and no action is required from consumers.
|
|
36
|
+
|
|
37
|
+
- Updated dependencies
|
|
38
|
+
|
|
3
39
|
## 45.21.0
|
|
4
40
|
|
|
5
41
|
### Minor Changes
|
|
@@ -8,7 +8,6 @@ exports.extractInvokeViewAction = void 0;
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _extractLink = require("@atlaskit/link-extractors/extract-link");
|
|
11
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
12
11
|
var _constants = require("../../constants");
|
|
13
12
|
var _getDefinitionId = require("../../state/getDefinitionId");
|
|
14
13
|
var _getExtensionKey = require("../../state/getExtensionKey");
|
|
@@ -37,19 +36,14 @@ var extractInvokeViewAction = exports.extractInvokeViewAction = function extract
|
|
|
37
36
|
return {
|
|
38
37
|
actionFn: function () {
|
|
39
38
|
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
40
|
-
var _transformUrl
|
|
39
|
+
var _transformUrl;
|
|
40
|
+
var destinationUrl;
|
|
41
41
|
return _regenerator.default.wrap(function (_context) {
|
|
42
42
|
while (1) switch (_context.prev = _context.next) {
|
|
43
43
|
case 0:
|
|
44
|
-
if (!(0, _fg.fg)('platform_smartlink_xpc_url_wrapping')) {
|
|
45
|
-
_context.next = 1;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
44
|
destinationUrl = (_transformUrl = transformUrl === null || transformUrl === void 0 ? void 0 : transformUrl(url)) !== null && _transformUrl !== void 0 ? _transformUrl : url;
|
|
49
45
|
return _context.abrupt("return", (0, _openUrl.openUrl)(destinationUrl));
|
|
50
46
|
case 1:
|
|
51
|
-
return _context.abrupt("return", (0, _openUrl.openUrl)(url));
|
|
52
|
-
case 2:
|
|
53
47
|
case "end":
|
|
54
48
|
return _context.stop();
|
|
55
49
|
}
|
|
@@ -54,10 +54,9 @@ var extractFlexibleCardActions = exports.extractFlexibleCardActions = function e
|
|
|
54
54
|
}, (0, _fg.fg)('preview_panel_unit_check') ? {
|
|
55
55
|
isPreviewRestricted: isPreviewRestricted
|
|
56
56
|
} : undefined), {}, {
|
|
57
|
-
openPreviewPanel: openPreviewPanel
|
|
58
|
-
}, (0, _fg.fg)('platform_smartlink_xpc_url_wrapping') ? {
|
|
57
|
+
openPreviewPanel: openPreviewPanel,
|
|
59
58
|
transformUrl: transformUrl
|
|
60
|
-
}
|
|
59
|
+
}))), _constants.ActionName.AutomationAction, (0, _extractAutomationAction.extractAutomationAction)(response)), _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), _constants.ActionName.RovoChatAction, (0, _extractRovoChatAction.default)({
|
|
61
60
|
actionOptions: actionOptions,
|
|
62
61
|
appearance: appearance,
|
|
63
62
|
id: id,
|
|
@@ -62,10 +62,9 @@ var extractAction = function extractAction(response, id, actionOptions, appearan
|
|
|
62
62
|
}, (0, _fg.fg)('preview_panel_unit_check') ? {
|
|
63
63
|
isPreviewRestricted: isPreviewRestricted
|
|
64
64
|
} : undefined), {}, {
|
|
65
|
-
openPreviewPanel: openPreviewPanel
|
|
66
|
-
}, (0, _fg.fg)('platform_smartlink_xpc_url_wrapping') ? {
|
|
65
|
+
openPreviewPanel: openPreviewPanel,
|
|
67
66
|
transformUrl: transformUrl
|
|
68
|
-
}
|
|
67
|
+
}))) === null || _extractInvokePreview === void 0 ? void 0 : _extractInvokePreview.invokeAction : undefined;
|
|
69
68
|
var details = {
|
|
70
69
|
id: id,
|
|
71
70
|
url: url,
|
|
@@ -88,7 +87,7 @@ var extractState = function extractState(response, actionOptions, id, appearance
|
|
|
88
87
|
if (!(0, _canShowAction.canShowAction)(_constants.CardAction.ChangeStatusAction, actionOptions)) {
|
|
89
88
|
return lozenge;
|
|
90
89
|
}
|
|
91
|
-
var action = extractAction(response, id, actionOptions, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel,
|
|
90
|
+
var action = extractAction(response, id, actionOptions, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel, transformUrl, (0, _fg.fg)('preview_panel_unit_check') ? isPreviewRestricted : undefined);
|
|
92
91
|
return _objectSpread(_objectSpread({}, lozenge), {}, {
|
|
93
92
|
action: action
|
|
94
93
|
});
|
|
@@ -100,10 +100,9 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
100
100
|
}, (0, _fg.fg)('preview_panel_unit_check') ? {
|
|
101
101
|
isPreviewRestricted: isPreviewRestricted
|
|
102
102
|
} : undefined), {}, {
|
|
103
|
-
openPreviewPanel: openPreviewPanel
|
|
104
|
-
}, (0, _fg.fg)('platform_smartlink_xpc_url_wrapping') ? {
|
|
103
|
+
openPreviewPanel: openPreviewPanel,
|
|
105
104
|
transformUrl: transformUrl
|
|
106
|
-
}
|
|
105
|
+
})),
|
|
107
106
|
appliedToComponentsCount: (0, _extractAppliedToComponentsCount.extractAppliedToComponentsCount)(data),
|
|
108
107
|
assignedToGroup: (0, _extractPersonAssignedToAsArray.extractPersonAssignedToAsArray)(data),
|
|
109
108
|
attachmentCount: (0, _extractAttachmentCount.extractAttachmentCount)(data),
|
|
@@ -135,7 +134,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
135
134
|
snippet: (0, _extractSmartLinkSummary.extractSmartLinkSummary)(response) || undefined,
|
|
136
135
|
// Explicitly set here to remove an empty string
|
|
137
136
|
sourceBranch: (0, _extractSourceBranch.extractSourceBranch)(data),
|
|
138
|
-
state: (0, _extractState.default)(response, actionOptions, id, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel,
|
|
137
|
+
state: (0, _extractState.default)(response, actionOptions, id, appearance, origin, fireEvent, resolve, isPreviewPanelAvailable, openPreviewPanel, transformUrl, (0, _fg.fg)('preview_panel_unit_check') ? isPreviewRestricted : undefined),
|
|
139
138
|
subscriberCount: (0, _extractSubscriberCount.extractSubscriberCount)(data),
|
|
140
139
|
subTasksProgress: (0, _extractSubTasksProgress.extractSubTasksProgress)(data),
|
|
141
140
|
storyPoints: (0, _extractStoryPoints.extractStoryPoints)(data),
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useSmartLinkDestinationUrl =
|
|
7
|
-
var
|
|
8
|
-
var _getClickUrl = require("../../getClickUrl");
|
|
6
|
+
exports.useSmartLinkDestinationUrl = void 0;
|
|
7
|
+
var _helpers = require("../../helpers");
|
|
9
8
|
var _store = require("../../store");
|
|
10
|
-
var _useSmartLinkCrossProductUrlWrapper = require("../use-smart-link-cross-product-url-wrapper
|
|
9
|
+
var _useSmartLinkCrossProductUrlWrapper = require("../use-smart-link-cross-product-url-wrapper");
|
|
11
10
|
/**
|
|
12
11
|
* Returns the resolved destination URL for a Smart Link, with cross-product analytics
|
|
13
|
-
* parameters appended when
|
|
12
|
+
* parameters appended when applicable.
|
|
14
13
|
*
|
|
15
14
|
* This is the same URL that SmartCard would navigate to when clicked. Use this as an `href`
|
|
16
15
|
* wherever you render a link to a Smart Link URL outside of the SmartCard component itself
|
|
@@ -18,7 +17,6 @@ var _useSmartLinkCrossProductUrlWrapper = require("../use-smart-link-cross-produ
|
|
|
18
17
|
*
|
|
19
18
|
* Falls back to the raw `url` when:
|
|
20
19
|
* - The link has not yet resolved
|
|
21
|
-
* - The feature gate is disabled
|
|
22
20
|
* - The link is not a first-party Atlassian link
|
|
23
21
|
*
|
|
24
22
|
* @example
|
|
@@ -26,16 +24,13 @@ var _useSmartLinkCrossProductUrlWrapper = require("../use-smart-link-cross-produ
|
|
|
26
24
|
*
|
|
27
25
|
* Use as <a href={href} target="_blank">Open link</a>
|
|
28
26
|
*/
|
|
29
|
-
var
|
|
27
|
+
var useDestinationUrl = exports.useSmartLinkDestinationUrl = function useDestinationUrl(url) {
|
|
30
28
|
var state = (0, _store.useSmartCardState)(url);
|
|
31
29
|
var appendCrossProductAnalyticsParams = (0, _useSmartLinkCrossProductUrlWrapper.useSmartLinkCrossProductUrlWrapper)({
|
|
32
30
|
details: state.details
|
|
33
31
|
});
|
|
34
|
-
var resolvedUrl = (0,
|
|
32
|
+
var resolvedUrl = (0, _helpers.getClickUrl)(url, state.details);
|
|
35
33
|
return appendCrossProductAnalyticsParams(resolvedUrl);
|
|
36
34
|
};
|
|
37
|
-
var useDestinationUrl = exports.useSmartLinkDestinationUrl = exports.useDestinationUrl = (0, _functionWithFg.functionWithFG)('platform_smartlink_xpc_url_wrapping', useDestinationUrlImplementation, function (url) {
|
|
38
|
-
return url;
|
|
39
|
-
});
|
|
40
35
|
|
|
41
36
|
// Public API aliases preserved from an eliminated entry-point (volt-migrate-package).
|
|
@@ -1,15 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
var
|
|
7
|
+
exports.useSmartLinkCrossProductUrlWrapper = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _useCrossProductUrlWrapper = require("@atlaskit/analytics-cross-product/useCrossProductUrlWrapper");
|
|
11
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
12
|
+
var _constants = require("./constants");
|
|
13
|
+
var _getIsFirstPartyLink = require("./getIsFirstPartyLink");
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
var useSmartLinkCrossProductUrlWrapper = exports.useSmartLinkCrossProductUrlWrapper = function useSmartLinkCrossProductUrlWrapper(_ref) {
|
|
17
|
+
var _effectiveProduct$toL;
|
|
18
|
+
var details = _ref.details;
|
|
19
|
+
var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
|
|
20
|
+
product = _useSmartLinkContext.product,
|
|
21
|
+
bridgeProduct = _useSmartLinkContext.bridgeProduct,
|
|
22
|
+
xpcProduct = _useSmartLinkContext.xpcProduct,
|
|
23
|
+
xpcSubProduct = _useSmartLinkContext.xpcSubProduct;
|
|
24
|
+
// xpcProduct takes precedence over product — it identifies the host product for XPC analytics
|
|
25
|
+
// without affecting link resolution (which uses the `product` prop separately).
|
|
26
|
+
var effectiveProduct = xpcProduct !== null && xpcProduct !== void 0 ? xpcProduct : product;
|
|
27
|
+
var effectiveBridge = bridgeProduct !== null && bridgeProduct !== void 0 ? bridgeProduct : _constants.XPC_CONSTANTS.SMART_LINKS_XPC_BRIDGE;
|
|
28
|
+
var effectiveProductForWrapper = (_effectiveProduct$toL = effectiveProduct === null || effectiveProduct === void 0 ? void 0 : effectiveProduct.toLowerCase()) !== null && _effectiveProduct$toL !== void 0 ? _effectiveProduct$toL : 'unknown';
|
|
29
|
+
var wrapUrl = (0, _useCrossProductUrlWrapper.useCrossProductUrlWrapper)(_objectSpread({
|
|
30
|
+
bridge: effectiveBridge,
|
|
31
|
+
product: effectiveProductForWrapper
|
|
32
|
+
}, xpcSubProduct ? {
|
|
33
|
+
subProduct: xpcSubProduct
|
|
34
|
+
} : {}));
|
|
35
|
+
return (0, _react.useCallback)(function (url) {
|
|
36
|
+
if (typeof window === 'undefined' || !(0, _getIsFirstPartyLink.getIsFirstPartyLink)(details) || !effectiveProduct) {
|
|
37
|
+
return url;
|
|
38
|
+
}
|
|
39
|
+
var parsedUrl;
|
|
40
|
+
try {
|
|
41
|
+
parsedUrl = new URL(url);
|
|
42
|
+
} catch (_unused) {
|
|
43
|
+
return url;
|
|
44
|
+
}
|
|
45
|
+
if (parsedUrl.searchParams.has(_constants.XPC_CONSTANTS.QUERY_PARAM)) {
|
|
46
|
+
return url;
|
|
47
|
+
}
|
|
48
|
+
return wrapUrl(url);
|
|
49
|
+
},
|
|
50
|
+
// Keep bridge/subproduct in the dependency array so consumers that memoize this callback
|
|
51
|
+
// refresh when mini-modal context updates from smartLinks to rovo-chat.
|
|
52
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
|
+
[details, effectiveBridge, effectiveProduct, wrapUrl, xpcSubProduct]);
|
|
54
|
+
};
|
|
@@ -44,7 +44,7 @@ function useSmartLinkActions(_ref) {
|
|
|
44
44
|
fireEvent: fireEvent
|
|
45
45
|
});
|
|
46
46
|
var resolve = (0, _useResolve.default)();
|
|
47
|
-
var appendCrossProductAnalyticsParams = (0, _useSmartLinkCrossProductUrlWrapper.
|
|
47
|
+
var appendCrossProductAnalyticsParams = (0, _useSmartLinkCrossProductUrlWrapper.useSmartLinkCrossProductUrlWrapper)({
|
|
48
48
|
details: linkState.details
|
|
49
49
|
});
|
|
50
50
|
if ((0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test') && prefetch && !linkState.details) {
|
|
@@ -64,12 +64,12 @@ function useSmartLinkActions(_ref) {
|
|
|
64
64
|
if (downloadActionProps) {
|
|
65
65
|
actions.push((0, _toAction.toAction)(downloadActionProps, invokeClientAction, _messages.messages.download, 'download-content'));
|
|
66
66
|
}
|
|
67
|
-
var viewActionProps = (0,
|
|
67
|
+
var viewActionProps = (0, _extractInvokeViewAction.extractInvokeViewAction)(_objectSpread(_objectSpread({}, invokeParam), {}, {
|
|
68
68
|
transformUrl: function transformUrl() {
|
|
69
69
|
var destinationUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : url;
|
|
70
70
|
return appendCrossProductAnalyticsParams(destinationUrl);
|
|
71
71
|
}
|
|
72
|
-
}))
|
|
72
|
+
}));
|
|
73
73
|
if (viewActionProps) {
|
|
74
74
|
actions.push((0, _toAction.toAction)(viewActionProps, invokeClientAction, _messages.messages.view, 'view-content'));
|
|
75
75
|
}
|
|
@@ -80,13 +80,12 @@ function useSmartLinkActions(_ref) {
|
|
|
80
80
|
}, (0, _fg.fg)('preview_panel_unit_check') ? {
|
|
81
81
|
isPreviewRestricted: isPreviewRestricted
|
|
82
82
|
} : undefined), {}, {
|
|
83
|
-
openPreviewPanel: openPreviewPanel
|
|
84
|
-
}, (0, _fg.fg)('platform_smartlink_xpc_url_wrapping') ? {
|
|
83
|
+
openPreviewPanel: openPreviewPanel,
|
|
85
84
|
transformUrl: function transformUrl() {
|
|
86
85
|
var destinationUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : url;
|
|
87
86
|
return appendCrossProductAnalyticsParams(destinationUrl);
|
|
88
87
|
}
|
|
89
|
-
}
|
|
88
|
+
}));
|
|
90
89
|
if (previewActionProps) {
|
|
91
90
|
actions.push((0, _toAction.toAction)(previewActionProps.invokeAction, invokeClientAction, _messages.messages.preview_improved, 'preview-content'));
|
|
92
91
|
}
|
|
@@ -24,7 +24,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
24
24
|
var context = exports.context = {
|
|
25
25
|
componentName: 'smart-cards',
|
|
26
26
|
packageName: "@atlaskit/smart-card" || '',
|
|
27
|
-
packageVersion: "45.
|
|
27
|
+
packageVersion: "45.21.2" || ''
|
|
28
28
|
};
|
|
29
29
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
30
30
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -110,7 +110,7 @@ function Component(_ref) {
|
|
|
110
110
|
var services = (0, _getServices.getServices)(state.details);
|
|
111
111
|
var thirdPartyARI = (0, _getThirdPartyARI.getThirdPartyARI)(state.details);
|
|
112
112
|
var firstPartyIdentifier = (0, _getFirstPartyIdentifier.getFirstPartyIdentifier)();
|
|
113
|
-
var appendCrossProductAnalyticsParams = (0, _useSmartLinkCrossProductUrlWrapper.
|
|
113
|
+
var appendCrossProductAnalyticsParams = (0, _useSmartLinkCrossProductUrlWrapper.useSmartLinkCrossProductUrlWrapper)({
|
|
114
114
|
details: state.details
|
|
115
115
|
});
|
|
116
116
|
var actionOptions = (0, _combineActionOptions.combineActionOptions)({
|
|
@@ -147,126 +147,79 @@ function Component(_ref) {
|
|
|
147
147
|
// please reach out to the 3P Workflows Team via Slack in #help-3p-connector-workflow
|
|
148
148
|
fire3PClickEvent === null || fire3PClickEvent === void 0 || fire3PClickEvent();
|
|
149
149
|
}
|
|
150
|
-
if ((0, _fg.fg)('platform_smartlink_xpc_url_wrapping')) {
|
|
151
|
-
// FIXME: InlineCard, BlockCard and EmbedCard call event.preventDefault() internally
|
|
152
|
-
// before the event bubbles up to this handler. This forces us to snapshot
|
|
153
|
-
// event.defaultPrevented before calling onClick to detect whether the consumer
|
|
154
|
-
// specifically prevented navigation. Ideally those components should not call
|
|
155
|
-
// preventDefault so this workaround can be removed.
|
|
156
|
-
var isEventDefaultPrevented = event.defaultPrevented;
|
|
157
|
-
var canOpenPreviewPanel = !isModifierKeyPressed && ari && name && openPreviewPanel && (isPreviewPanelAvailable === null || isPreviewPanelAvailable === void 0 ? void 0 : isPreviewPanelAvailable({
|
|
158
|
-
ari: ari
|
|
159
|
-
})) && !disablePreviewPanel;
|
|
160
150
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
iconUrl: (0, _getObjectIconUrl.getObjectIconUrl)(state.details),
|
|
171
|
-
panelData: {
|
|
172
|
-
embedUrl: (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test') ? (_extractSmartLinkEmbe = (0, _extractSmartLinkEmbed.extractSmartLinkEmbed)(state.details)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src : undefined
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
(0, _fireLinkClickedEvent.fireLinkClickedEvent)(createAnalyticsEvent)(event, {
|
|
176
|
-
attributes: {
|
|
177
|
-
clickOutcome: 'previewPanel'
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
var destinationUrl = getDestinationUrl();
|
|
183
|
-
(0, _updateAnchorHref.updateAnchorHref)(event, destinationUrl);
|
|
151
|
+
// FIXME: InlineCard, BlockCard and EmbedCard call event.preventDefault() internally
|
|
152
|
+
// before the event bubbles up to this handler. This forces us to snapshot
|
|
153
|
+
// event.defaultPrevented before calling onClick to detect whether the consumer
|
|
154
|
+
// specifically prevented navigation. Ideally those components should not call
|
|
155
|
+
// preventDefault so this workaround can be removed.
|
|
156
|
+
var isEventDefaultPrevented = event.defaultPrevented;
|
|
157
|
+
var canOpenPreviewPanel = !isModifierKeyPressed && ari && name && openPreviewPanel && (isPreviewPanelAvailable === null || isPreviewPanelAvailable === void 0 ? void 0 : isPreviewPanelAvailable({
|
|
158
|
+
ari: ari
|
|
159
|
+
})) && !disablePreviewPanel;
|
|
184
160
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
var
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
161
|
+
// Preview panel takes priority over link navigation when available.
|
|
162
|
+
if (canOpenPreviewPanel) {
|
|
163
|
+
var _extractSmartLinkEmbe;
|
|
164
|
+
event.preventDefault();
|
|
165
|
+
event.stopPropagation();
|
|
166
|
+
openPreviewPanel({
|
|
191
167
|
url: url,
|
|
192
|
-
|
|
168
|
+
ari: ari,
|
|
169
|
+
name: name,
|
|
170
|
+
iconUrl: (0, _getObjectIconUrl.getObjectIconUrl)(state.details),
|
|
171
|
+
panelData: {
|
|
172
|
+
embedUrl: (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test') ? (_extractSmartLinkEmbe = (0, _extractSmartLinkEmbed.extractSmartLinkEmbed)(state.details)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src : undefined
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
(0, _fireLinkClickedEvent.fireLinkClickedEvent)(createAnalyticsEvent)(event, {
|
|
176
|
+
attributes: {
|
|
177
|
+
clickOutcome: 'previewPanel'
|
|
178
|
+
}
|
|
193
179
|
});
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
var destinationUrl = getDestinationUrl();
|
|
183
|
+
(0, _updateAnchorHref.updateAnchorHref)(event, destinationUrl);
|
|
194
184
|
|
|
195
|
-
|
|
196
|
-
|
|
185
|
+
// For FlexibleCard, read target from the clicked anchor element (e.g. _blank for links
|
|
186
|
+
// rendered with explicit target). For classic cards, default to _self
|
|
187
|
+
var _getAnchorAttributesF = (0, _getAnchorAttributesFromEvent.getAnchorAttributesFromEvent)(event),
|
|
188
|
+
anchorTarget = _getAnchorAttributesF.target;
|
|
189
|
+
var target = (0, _isSpecialEvent.isSpecialEvent)(event) ? '_blank' : isFlexibleUi ? anchorTarget : '_self';
|
|
190
|
+
onClick === null || onClick === void 0 || onClick(event, {
|
|
191
|
+
url: url,
|
|
192
|
+
destinationUrl: destinationUrl
|
|
193
|
+
});
|
|
197
194
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
// FlexibleCard's anchor is prevented from native navigation, so this handler always
|
|
201
|
-
// opens the link for FlexibleCard unless the consumer's onClick called preventDefault.
|
|
202
|
-
var shouldOpenLink = isFlexibleUi || !onClick;
|
|
203
|
-
var doOpenLink = shouldOpenLink && !consumerPreventedNavigation;
|
|
204
|
-
if (doOpenLink) {
|
|
205
|
-
event.preventDefault();
|
|
206
|
-
window.open(destinationUrl, target);
|
|
207
|
-
}
|
|
195
|
+
// Check if the event is prevented via onClick callback
|
|
196
|
+
var consumerPreventedNavigation = event.defaultPrevented && !isEventDefaultPrevented;
|
|
208
197
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if (!isModifierKeyPressed && ari && name && openPreviewPanel && isPreviewPanelAvailable !== null && isPreviewPanelAvailable !== void 0 && isPreviewPanelAvailable({
|
|
220
|
-
ari: ari
|
|
221
|
-
}) && !disablePreviewPanel) {
|
|
222
|
-
var _extractSmartLinkEmbe2;
|
|
223
|
-
event.preventDefault();
|
|
224
|
-
event.stopPropagation();
|
|
225
|
-
openPreviewPanel({
|
|
226
|
-
url: url,
|
|
227
|
-
ari: ari,
|
|
228
|
-
name: name,
|
|
229
|
-
iconUrl: (0, _getObjectIconUrl.getObjectIconUrl)(state.details),
|
|
230
|
-
panelData: {
|
|
231
|
-
embedUrl: (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test') ? (_extractSmartLinkEmbe2 = (0, _extractSmartLinkEmbed.extractSmartLinkEmbed)(state.details)) === null || _extractSmartLinkEmbe2 === void 0 ? void 0 : _extractSmartLinkEmbe2.src : undefined
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
(0, _fireLinkClickedEvent.fireLinkClickedEvent)(createAnalyticsEvent)(event, {
|
|
235
|
-
attributes: {
|
|
236
|
-
clickOutcome: 'previewPanel'
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
return;
|
|
240
|
-
} else if (!onClick && !isFlexibleUi) {
|
|
241
|
-
var clickUrl = (0, _getClickUrl2.getClickUrl)(url, state.details);
|
|
198
|
+
// Classic cards (InlineCard, BlockCard, EmbedCard) rely on their own anchor navigation
|
|
199
|
+
// when onClick is provided, so this handler should not open the link for them.
|
|
200
|
+
// FlexibleCard's anchor is prevented from native navigation, so this handler always
|
|
201
|
+
// opens the link for FlexibleCard unless the consumer's onClick called preventDefault.
|
|
202
|
+
var shouldOpenLink = isFlexibleUi || !onClick;
|
|
203
|
+
var doOpenLink = shouldOpenLink && !consumerPreventedNavigation;
|
|
204
|
+
if (doOpenLink) {
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
window.open(destinationUrl, target);
|
|
207
|
+
}
|
|
242
208
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
window.open(clickUrl, _target);
|
|
249
|
-
(0, _fireLinkClickedEvent.fireLinkClickedEvent)(createAnalyticsEvent)(event, {
|
|
250
|
-
attributes: {
|
|
251
|
-
clickOutcome: _target === '_blank' ? 'clickThroughNewTabOrWindow' : 'clickThrough'
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
} else {
|
|
255
|
-
if (onClick) {
|
|
256
|
-
onClick(event);
|
|
257
|
-
}
|
|
258
|
-
(0, _fireLinkClickedEvent.fireLinkClickedEvent)(createAnalyticsEvent)(event);
|
|
209
|
+
// Only set clickOutcome when this handler actually opened the link.
|
|
210
|
+
// If a parent onClick handled navigation, fire a generic click event instead.
|
|
211
|
+
(0, _fireLinkClickedEvent.fireLinkClickedEvent)(createAnalyticsEvent)(event, doOpenLink ? {
|
|
212
|
+
attributes: {
|
|
213
|
+
clickOutcome: target === '_blank' ? 'clickThroughNewTabOrWindow' : 'clickThrough'
|
|
259
214
|
}
|
|
260
|
-
}
|
|
215
|
+
} : undefined);
|
|
261
216
|
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, getDestinationUrl, onClick, url, state.details, ari, name, fire3PClickEvent, shouldFire3PClickEvent, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, disablePreviewPanel]);
|
|
262
217
|
|
|
263
218
|
// Middle-click handler to trigger fire3PClickEvent on middle-clicks.
|
|
264
219
|
// Scope is limited to 3P click analytics.
|
|
265
220
|
var handleFrameAuxClick = (0, _react.useCallback)(function (event) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
(0, _updateAnchorHref.updateAnchorHref)(event, destinationUrl);
|
|
269
|
-
}
|
|
221
|
+
var destinationUrl = getDestinationUrl();
|
|
222
|
+
(0, _updateAnchorHref.updateAnchorHref)(event, destinationUrl);
|
|
270
223
|
|
|
271
224
|
// isAuxClick filters Windows right-clicks (button === 2) that also fire onAuxClick.
|
|
272
225
|
if ((0, _isAuxClick.isAuxClick)(event) && shouldFire3PClickEvent) {
|
|
@@ -279,10 +232,8 @@ function Component(_ref) {
|
|
|
279
232
|
// Right-click handler to trigger fire3PClickEvent on right-clicks.
|
|
280
233
|
// Scope is limited to 3P click analytics.
|
|
281
234
|
var handleFrameContextMenu = (0, _react.useCallback)(function (event) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
(0, _updateAnchorHref.updateAnchorHref)(event, destinationUrl);
|
|
285
|
-
}
|
|
235
|
+
var destinationUrl = getDestinationUrl();
|
|
236
|
+
(0, _updateAnchorHref.updateAnchorHref)(event, destinationUrl);
|
|
286
237
|
if (shouldFire3PClickEvent) {
|
|
287
238
|
fire3PClickEvent === null || fire3PClickEvent === void 0 || fire3PClickEvent({
|
|
288
239
|
isContextMenu: true
|
|
@@ -69,14 +69,13 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
69
69
|
var cardType = cardState.status,
|
|
70
70
|
details = cardState.details;
|
|
71
71
|
var status = cardType;
|
|
72
|
-
var appendCrossProductAnalyticsParams = (0, _useSmartLinkCrossProductUrlWrapper.
|
|
72
|
+
var appendCrossProductAnalyticsParams = (0, _useSmartLinkCrossProductUrlWrapper.useSmartLinkCrossProductUrlWrapper)({
|
|
73
73
|
details: details
|
|
74
74
|
});
|
|
75
|
-
var
|
|
75
|
+
var transformUrl = (0, _react.useCallback)(function () {
|
|
76
76
|
var destinationUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : url;
|
|
77
77
|
return appendCrossProductAnalyticsParams(destinationUrl);
|
|
78
78
|
}, [appendCrossProductAnalyticsParams, url]);
|
|
79
|
-
var transformUrl = (0, _fg.fg)('platform_smartlink_xpc_url_wrapping') ? transformUrlCallback : undefined;
|
|
80
79
|
|
|
81
80
|
// if we have placeholder state it means we can internally use it
|
|
82
81
|
// as temporary resolved data until the actual data comes back as one of the final statuses
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.hoverCardClassName = exports.default = void 0;
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
10
|
var _AnalyticsContext = _interopRequireDefault(require("@atlaskit/analytics-next/AnalyticsContext"));
|
|
12
11
|
var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents");
|
|
@@ -38,8 +37,6 @@ var _resolving = _interopRequireDefault(require("./views/resolving"));
|
|
|
38
37
|
var _unauthorised = _interopRequireDefault(require("./views/unauthorised"));
|
|
39
38
|
var _RovoUnauthorisedView = _interopRequireDefault(require("./views/unauthorised/RovoUnauthorisedView"));
|
|
40
39
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
41
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
42
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
43
40
|
var hoverCardClassName = exports.hoverCardClassName = 'smart-links-hover-preview';
|
|
44
41
|
var useIsResolvedView = function useIsResolvedView(_ref) {
|
|
45
42
|
var _hoverPreviewOptions$;
|
|
@@ -99,7 +96,7 @@ var HoverCardContent = function HoverCardContent(_ref4) {
|
|
|
99
96
|
product = _useSmartLinkContext.product;
|
|
100
97
|
var isAISummaryEnabled = (0, _getIsAiSummaryEnabled.getIsAISummaryEnabled)(isAdminHubAIEnabled, cardState.details);
|
|
101
98
|
var services = (0, _getServices.getServices)(linkState.details);
|
|
102
|
-
var appendCrossProductAnalyticsParams = (0, _useSmartLinkCrossProductUrlWrapper.
|
|
99
|
+
var appendCrossProductAnalyticsParams = (0, _useSmartLinkCrossProductUrlWrapper.useSmartLinkCrossProductUrlWrapper)({
|
|
103
100
|
details: linkState.details
|
|
104
101
|
});
|
|
105
102
|
var statusRef = (0, _react.useRef)(linkStatus);
|
|
@@ -163,19 +160,17 @@ var HoverCardContent = function HoverCardContent(_ref4) {
|
|
|
163
160
|
(0, _updateAnchorHref.updateAnchorHref)(event, destinationUrl);
|
|
164
161
|
}, [getDestinationUrl]);
|
|
165
162
|
var onClick = (0, _react.useCallback)(function (event) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
window.open(destinationUrl, target);
|
|
178
|
-
}
|
|
163
|
+
// Prevent the anchor's native navigation so we can open the destination URL
|
|
164
|
+
// with cross-product analytics query parameters appended.
|
|
165
|
+
// The cross-product params are client-only and cannot be rendered
|
|
166
|
+
// server-side. Falls back to the original `url` prop if the event target is
|
|
167
|
+
// not an anchor element.
|
|
168
|
+
event.preventDefault();
|
|
169
|
+
var _getAnchorAttributesF = (0, _getAnchorAttributesFromEvent.getAnchorAttributesFromEvent)(event),
|
|
170
|
+
target = _getAnchorAttributesF.target;
|
|
171
|
+
var destinationUrl = getDestinationUrl();
|
|
172
|
+
(0, _updateAnchorHref.updateAnchorHref)(event, destinationUrl);
|
|
173
|
+
window.open(destinationUrl, target);
|
|
179
174
|
var isModifierKeyPressed = (0, _isSpecialEvent.isSpecialEvent)(event);
|
|
180
175
|
fireEvent('ui.smartLink.clicked.titleGoToLink', {
|
|
181
176
|
id: id,
|
|
@@ -198,14 +193,12 @@ var HoverCardContent = function HoverCardContent(_ref4) {
|
|
|
198
193
|
};
|
|
199
194
|
var uiOptions = _styled.flexibleUiOptions;
|
|
200
195
|
uiOptions.enableSnippetRenderer = true;
|
|
201
|
-
var flexibleCardProps =
|
|
196
|
+
var flexibleCardProps = {
|
|
202
197
|
appearance: _constants.CardDisplay.HoverCardPreview,
|
|
203
198
|
cardState: cardState,
|
|
204
|
-
onClick: onClick
|
|
205
|
-
}, (0, _fg.fg)('platform_smartlink_xpc_url_wrapping') ? {
|
|
199
|
+
onClick: onClick,
|
|
206
200
|
onAuxClick: onAuxClick,
|
|
207
|
-
onContextMenu: onContextMenu
|
|
208
|
-
} : undefined), {}, {
|
|
201
|
+
onContextMenu: onContextMenu,
|
|
209
202
|
onResolve: onResolve,
|
|
210
203
|
origin: 'smartLinkPreviewHoverCard',
|
|
211
204
|
renderers: renderers,
|
|
@@ -213,7 +206,7 @@ var HoverCardContent = function HoverCardContent(_ref4) {
|
|
|
213
206
|
ui: uiOptions,
|
|
214
207
|
url: url,
|
|
215
208
|
children: null
|
|
216
|
-
}
|
|
209
|
+
};
|
|
217
210
|
var onClickStopPropagation = (0, _react.useCallback)(function (e) {
|
|
218
211
|
return e.stopPropagation();
|
|
219
212
|
}, []);
|
|
@@ -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.21.2",
|
|
23
23
|
componentName: 'linkUrl'
|
|
24
24
|
};
|
|
25
25
|
var LinkUrl = function LinkUrl(_ref) {
|