@atlaskit/smart-card 44.26.0 → 44.26.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 +11 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +30 -9
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +2 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +30 -9
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +6 -0
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +30 -9
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +2 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 44.26.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`299e30381fd33`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/299e30381fd33) -
|
|
8
|
+
Update anchor href with cross-product analytics
|
|
9
|
+
- [`6d0485dce81c4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6d0485dce81c4) -
|
|
10
|
+
Internal: updated to the new `@atlaskit/top-layer` `Popover`/`Dialog` behaviour where the host
|
|
11
|
+
element unmounts after the exit animation completes. No consumer action required.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 44.26.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
11
11
|
var context = exports.context = {
|
|
12
12
|
componentName: 'smart-cards',
|
|
13
13
|
packageName: "@atlaskit/smart-card" || '',
|
|
14
|
-
packageVersion: "44.
|
|
14
|
+
packageVersion: "44.26.0" || ''
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -112,6 +112,21 @@ function Component(_ref) {
|
|
|
112
112
|
|
|
113
113
|
// Shared scope guard for all 3P-click handlers.
|
|
114
114
|
var shouldFire3PClickEvent = thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix) && (0, _helpers.getClickUrl)(url, state.details) === url && fire3PClickEvent && (0, _platformFeatureFlags.fg)('platform_smartlink_3pclick_analytics');
|
|
115
|
+
var getDestinationUrl = (0, _react.useCallback)(function () {
|
|
116
|
+
var _getClickUrl, _appendCrossProductAn;
|
|
117
|
+
var preferredUrl = (_getClickUrl = (0, _helpers.getClickUrl)(url, state.details)) !== null && _getClickUrl !== void 0 ? _getClickUrl : url;
|
|
118
|
+
return (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
|
|
119
|
+
}, [appendCrossProductAnalyticsParams, state.details, url]);
|
|
120
|
+
var updateAnchorHref = (0, _react.useCallback)(function (event, destinationUrl) {
|
|
121
|
+
if (!(event.currentTarget instanceof HTMLAnchorElement)) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// FIXME: destinationUrl should be rendered in the DOM anchor href instead of derived at click time
|
|
126
|
+
// href is only defined when currentTarget is an anchor element.
|
|
127
|
+
// Update the anchor href so the browser context menu uses the decorated URL.
|
|
128
|
+
event.currentTarget.href = destinationUrl;
|
|
129
|
+
}, []);
|
|
115
130
|
|
|
116
131
|
// Setup UI handlers.
|
|
117
132
|
var handleClickWrapper = (0, _react.useCallback)(function (event) {
|
|
@@ -131,7 +146,6 @@ function Component(_ref) {
|
|
|
131
146
|
exposure: true
|
|
132
147
|
});
|
|
133
148
|
if ((0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping')) {
|
|
134
|
-
var _appendCrossProductAn;
|
|
135
149
|
// FIXME: InlineCard, BlockCard and EmbedCard call event.preventDefault() internally
|
|
136
150
|
// before the event bubbles up to this handler. This forces us to snapshot
|
|
137
151
|
// event.defaultPrevented before calling onClick to detect whether the consumer
|
|
@@ -163,16 +177,14 @@ function Component(_ref) {
|
|
|
163
177
|
});
|
|
164
178
|
return;
|
|
165
179
|
}
|
|
180
|
+
var destinationUrl = getDestinationUrl();
|
|
181
|
+
updateAnchorHref(event, destinationUrl);
|
|
166
182
|
|
|
167
183
|
// For FlexibleCard, read target from the clicked anchor element (e.g. _blank for links
|
|
168
184
|
// rendered with explicit target). For classic cards, default to _self
|
|
169
185
|
var _getAnchorAttributesF = (0, _clickHelpers.getAnchorAttributesFromEvent)(event),
|
|
170
186
|
anchorTarget = _getAnchorAttributesF.target;
|
|
171
187
|
var target = (0, _utils.isSpecialEvent)(event) ? '_blank' : isFlexibleUi ? anchorTarget : '_self';
|
|
172
|
-
|
|
173
|
-
// FIXME: preferredUrl should be rendered in the DOM anchor href instead of derived at click time
|
|
174
|
-
var preferredUrl = (0, _helpers.getClickUrl)(url, state.details);
|
|
175
|
-
var destinationUrl = (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
|
|
176
188
|
onClick === null || onClick === void 0 || onClick(event, {
|
|
177
189
|
url: url,
|
|
178
190
|
destinationUrl: destinationUrl
|
|
@@ -244,7 +256,7 @@ function Component(_ref) {
|
|
|
244
256
|
(0, _click.fireLinkClickedEvent)(createAnalyticsEvent)(event);
|
|
245
257
|
}
|
|
246
258
|
}
|
|
247
|
-
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, onClick, url,
|
|
259
|
+
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, getDestinationUrl, onClick, url, updateAnchorHref, state.details, ari, name, fire3PClickEvent, shouldFire3PClickEvent, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, disablePreviewPanel]);
|
|
248
260
|
|
|
249
261
|
// Exposure fires once per eligible mount; click-time reads use no-exposure variant.
|
|
250
262
|
(0, _react.useEffect)(function () {
|
|
@@ -256,23 +268,32 @@ function Component(_ref) {
|
|
|
256
268
|
// Middle-click handler to trigger fire3PClickEvent on middle-clicks.
|
|
257
269
|
// Scope is limited to 3P click analytics to keep the experiment focused.
|
|
258
270
|
var handleFrameAuxClick = (0, _react.useCallback)(function (event) {
|
|
271
|
+
if ((0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping')) {
|
|
272
|
+
var destinationUrl = getDestinationUrl();
|
|
273
|
+
updateAnchorHref(event, destinationUrl);
|
|
274
|
+
}
|
|
275
|
+
|
|
259
276
|
// isAuxClick filters Windows right-clicks (button === 2) that also fire onAuxClick.
|
|
260
277
|
if ((0, _clickHelpers.isAuxClick)(event) && shouldFire3PClickEvent && (0, _expValEqualsNoExposure.expValEqualsNoExposure)(TRACK_NON_PRIMARY_3P_CLICKS_EXPERIMENT, 'isEnabled', true)) {
|
|
261
278
|
fire3PClickEvent === null || fire3PClickEvent === void 0 || fire3PClickEvent({
|
|
262
279
|
isAuxClick: true
|
|
263
280
|
});
|
|
264
281
|
}
|
|
265
|
-
}, [fire3PClickEvent, shouldFire3PClickEvent]);
|
|
282
|
+
}, [fire3PClickEvent, getDestinationUrl, shouldFire3PClickEvent, updateAnchorHref]);
|
|
266
283
|
|
|
267
284
|
// Right-click handler to trigger fire3PClickEvent on right-clicks.
|
|
268
285
|
// Scope is limited to 3P click analytics to keep the experiment focused.
|
|
269
|
-
var handleFrameContextMenu = (0, _react.useCallback)(function (
|
|
286
|
+
var handleFrameContextMenu = (0, _react.useCallback)(function (event) {
|
|
287
|
+
if ((0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping')) {
|
|
288
|
+
var destinationUrl = getDestinationUrl();
|
|
289
|
+
updateAnchorHref(event, destinationUrl);
|
|
290
|
+
}
|
|
270
291
|
if (shouldFire3PClickEvent && (0, _expValEqualsNoExposure.expValEqualsNoExposure)(TRACK_NON_PRIMARY_3P_CLICKS_EXPERIMENT, 'isEnabled', true)) {
|
|
271
292
|
fire3PClickEvent === null || fire3PClickEvent === void 0 || fire3PClickEvent({
|
|
272
293
|
isContextMenu: true
|
|
273
294
|
});
|
|
274
295
|
}
|
|
275
|
-
}, [fire3PClickEvent, shouldFire3PClickEvent]);
|
|
296
|
+
}, [fire3PClickEvent, getDestinationUrl, shouldFire3PClickEvent, updateAnchorHref]);
|
|
276
297
|
var reload = actions.reload;
|
|
277
298
|
var handleAuthorize = (0, _react.useCallback)(function () {
|
|
278
299
|
return actions.authorize(appearance);
|
|
@@ -22,7 +22,7 @@ var _SmartLinkAnalyticsContext = require("../../../utils/analytics/SmartLinkAnal
|
|
|
22
22
|
var _CustomPopupContainer = require("../components/CustomPopupContainer");
|
|
23
23
|
var _HoverCardContent = _interopRequireDefault(require("../components/HoverCardContent"));
|
|
24
24
|
var _styled = require("../styled");
|
|
25
|
-
var _excluded = ["aria-haspopup", "aria-expanded"];
|
|
25
|
+
var _excluded = ["aria-haspopup", "aria-expanded", "aria-controls"];
|
|
26
26
|
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); }
|
|
27
27
|
var HOVER_CARD_SOURCE = exports.HOVER_CARD_SOURCE = 'smartLinkPreviewHoverCard';
|
|
28
28
|
var HOVER_CARD_TRIGGER_WRAPPER = 'hover-card-trigger-wrapper';
|
|
@@ -240,6 +240,7 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
|
|
|
240
240
|
var trigger = (0, _react.useCallback)(function (_ref3) {
|
|
241
241
|
var _ariaHasPopup = _ref3['aria-haspopup'],
|
|
242
242
|
_ariaExpanded = _ref3['aria-expanded'],
|
|
243
|
+
_ariaControls = _ref3['aria-controls'],
|
|
243
244
|
triggerProps = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
|
|
244
245
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
245
246
|
ref: parentSpan
|
|
@@ -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: "44.
|
|
22
|
+
packageVersion: "44.26.0",
|
|
23
23
|
componentName: 'linkUrl'
|
|
24
24
|
};
|
|
25
25
|
var LinkUrl = function LinkUrl(_ref) {
|
|
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
2
2
|
export const context = {
|
|
3
3
|
componentName: 'smart-cards',
|
|
4
4
|
packageName: "@atlaskit/smart-card" || '',
|
|
5
|
-
packageVersion: "44.
|
|
5
|
+
packageVersion: "44.26.0" || ''
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -102,6 +102,21 @@ function Component({
|
|
|
102
102
|
|
|
103
103
|
// Shared scope guard for all 3P-click handlers.
|
|
104
104
|
const shouldFire3PClickEvent = thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix) && getClickUrl(url, state.details) === url && fire3PClickEvent && fg('platform_smartlink_3pclick_analytics');
|
|
105
|
+
const getDestinationUrl = useCallback(() => {
|
|
106
|
+
var _getClickUrl, _appendCrossProductAn;
|
|
107
|
+
const preferredUrl = (_getClickUrl = getClickUrl(url, state.details)) !== null && _getClickUrl !== void 0 ? _getClickUrl : url;
|
|
108
|
+
return (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
|
|
109
|
+
}, [appendCrossProductAnalyticsParams, state.details, url]);
|
|
110
|
+
const updateAnchorHref = useCallback((event, destinationUrl) => {
|
|
111
|
+
if (!(event.currentTarget instanceof HTMLAnchorElement)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// FIXME: destinationUrl should be rendered in the DOM anchor href instead of derived at click time
|
|
116
|
+
// href is only defined when currentTarget is an anchor element.
|
|
117
|
+
// Update the anchor href so the browser context menu uses the decorated URL.
|
|
118
|
+
event.currentTarget.href = destinationUrl;
|
|
119
|
+
}, []);
|
|
105
120
|
|
|
106
121
|
// Setup UI handlers.
|
|
107
122
|
const handleClickWrapper = useCallback(event => {
|
|
@@ -121,7 +136,6 @@ function Component({
|
|
|
121
136
|
exposure: true
|
|
122
137
|
});
|
|
123
138
|
if (fg('platform_smartlink_xpc_url_wrapping')) {
|
|
124
|
-
var _appendCrossProductAn;
|
|
125
139
|
// FIXME: InlineCard, BlockCard and EmbedCard call event.preventDefault() internally
|
|
126
140
|
// before the event bubbles up to this handler. This forces us to snapshot
|
|
127
141
|
// event.defaultPrevented before calling onClick to detect whether the consumer
|
|
@@ -153,6 +167,8 @@ function Component({
|
|
|
153
167
|
});
|
|
154
168
|
return;
|
|
155
169
|
}
|
|
170
|
+
const destinationUrl = getDestinationUrl();
|
|
171
|
+
updateAnchorHref(event, destinationUrl);
|
|
156
172
|
|
|
157
173
|
// For FlexibleCard, read target from the clicked anchor element (e.g. _blank for links
|
|
158
174
|
// rendered with explicit target). For classic cards, default to _self
|
|
@@ -160,10 +176,6 @@ function Component({
|
|
|
160
176
|
target: anchorTarget
|
|
161
177
|
} = getAnchorAttributesFromEvent(event);
|
|
162
178
|
const target = isSpecialEvent(event) ? '_blank' : isFlexibleUi ? anchorTarget : '_self';
|
|
163
|
-
|
|
164
|
-
// FIXME: preferredUrl should be rendered in the DOM anchor href instead of derived at click time
|
|
165
|
-
const preferredUrl = getClickUrl(url, state.details);
|
|
166
|
-
const destinationUrl = (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
|
|
167
179
|
onClick === null || onClick === void 0 ? void 0 : onClick(event, {
|
|
168
180
|
url,
|
|
169
181
|
destinationUrl
|
|
@@ -235,7 +247,7 @@ function Component({
|
|
|
235
247
|
fireLinkClickedEvent(createAnalyticsEvent)(event);
|
|
236
248
|
}
|
|
237
249
|
}
|
|
238
|
-
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, onClick, url,
|
|
250
|
+
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, getDestinationUrl, onClick, url, updateAnchorHref, state.details, ari, name, fire3PClickEvent, shouldFire3PClickEvent, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, disablePreviewPanel]);
|
|
239
251
|
|
|
240
252
|
// Exposure fires once per eligible mount; click-time reads use no-exposure variant.
|
|
241
253
|
useEffect(() => {
|
|
@@ -247,23 +259,32 @@ function Component({
|
|
|
247
259
|
// Middle-click handler to trigger fire3PClickEvent on middle-clicks.
|
|
248
260
|
// Scope is limited to 3P click analytics to keep the experiment focused.
|
|
249
261
|
const handleFrameAuxClick = useCallback(event => {
|
|
262
|
+
if (fg('platform_smartlink_xpc_url_wrapping')) {
|
|
263
|
+
const destinationUrl = getDestinationUrl();
|
|
264
|
+
updateAnchorHref(event, destinationUrl);
|
|
265
|
+
}
|
|
266
|
+
|
|
250
267
|
// isAuxClick filters Windows right-clicks (button === 2) that also fire onAuxClick.
|
|
251
268
|
if (isAuxClick(event) && shouldFire3PClickEvent && expValEqualsNoExposure(TRACK_NON_PRIMARY_3P_CLICKS_EXPERIMENT, 'isEnabled', true)) {
|
|
252
269
|
fire3PClickEvent === null || fire3PClickEvent === void 0 ? void 0 : fire3PClickEvent({
|
|
253
270
|
isAuxClick: true
|
|
254
271
|
});
|
|
255
272
|
}
|
|
256
|
-
}, [fire3PClickEvent, shouldFire3PClickEvent]);
|
|
273
|
+
}, [fire3PClickEvent, getDestinationUrl, shouldFire3PClickEvent, updateAnchorHref]);
|
|
257
274
|
|
|
258
275
|
// Right-click handler to trigger fire3PClickEvent on right-clicks.
|
|
259
276
|
// Scope is limited to 3P click analytics to keep the experiment focused.
|
|
260
|
-
const handleFrameContextMenu = useCallback(
|
|
277
|
+
const handleFrameContextMenu = useCallback(event => {
|
|
278
|
+
if (fg('platform_smartlink_xpc_url_wrapping')) {
|
|
279
|
+
const destinationUrl = getDestinationUrl();
|
|
280
|
+
updateAnchorHref(event, destinationUrl);
|
|
281
|
+
}
|
|
261
282
|
if (shouldFire3PClickEvent && expValEqualsNoExposure(TRACK_NON_PRIMARY_3P_CLICKS_EXPERIMENT, 'isEnabled', true)) {
|
|
262
283
|
fire3PClickEvent === null || fire3PClickEvent === void 0 ? void 0 : fire3PClickEvent({
|
|
263
284
|
isContextMenu: true
|
|
264
285
|
});
|
|
265
286
|
}
|
|
266
|
-
}, [fire3PClickEvent, shouldFire3PClickEvent]);
|
|
287
|
+
}, [fire3PClickEvent, getDestinationUrl, shouldFire3PClickEvent, updateAnchorHref]);
|
|
267
288
|
const {
|
|
268
289
|
reload
|
|
269
290
|
} = actions;
|
|
@@ -214,6 +214,12 @@ export const HoverCardComponent = ({
|
|
|
214
214
|
const trigger = useCallback(({
|
|
215
215
|
'aria-haspopup': _ariaHasPopup,
|
|
216
216
|
'aria-expanded': _ariaExpanded,
|
|
217
|
+
// `aria-controls` is also stripped because the trigger wrapper renders
|
|
218
|
+
// with `role="none"`. axe's `aria-valid-attr-value` rule flags any
|
|
219
|
+
// `aria-controls` value sitting on a presentational element, since the
|
|
220
|
+
// element has no semantic role to control. Removing the attribute
|
|
221
|
+
// keeps the trigger semantically inert without losing functionality.
|
|
222
|
+
'aria-controls': _ariaControls,
|
|
217
223
|
...triggerProps
|
|
218
224
|
}) => /*#__PURE__*/React.createElement("span", {
|
|
219
225
|
ref: parentSpan
|
|
@@ -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: "44.
|
|
12
|
+
packageVersion: "44.26.0",
|
|
13
13
|
componentName: 'linkUrl'
|
|
14
14
|
};
|
|
15
15
|
const LinkUrl = ({
|
|
@@ -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: "44.
|
|
7
|
+
packageVersion: "44.26.0" || ''
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -103,6 +103,21 @@ function Component(_ref) {
|
|
|
103
103
|
|
|
104
104
|
// Shared scope guard for all 3P-click handlers.
|
|
105
105
|
var shouldFire3PClickEvent = thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix) && getClickUrl(url, state.details) === url && fire3PClickEvent && fg('platform_smartlink_3pclick_analytics');
|
|
106
|
+
var getDestinationUrl = useCallback(function () {
|
|
107
|
+
var _getClickUrl, _appendCrossProductAn;
|
|
108
|
+
var preferredUrl = (_getClickUrl = getClickUrl(url, state.details)) !== null && _getClickUrl !== void 0 ? _getClickUrl : url;
|
|
109
|
+
return (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
|
|
110
|
+
}, [appendCrossProductAnalyticsParams, state.details, url]);
|
|
111
|
+
var updateAnchorHref = useCallback(function (event, destinationUrl) {
|
|
112
|
+
if (!(event.currentTarget instanceof HTMLAnchorElement)) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// FIXME: destinationUrl should be rendered in the DOM anchor href instead of derived at click time
|
|
117
|
+
// href is only defined when currentTarget is an anchor element.
|
|
118
|
+
// Update the anchor href so the browser context menu uses the decorated URL.
|
|
119
|
+
event.currentTarget.href = destinationUrl;
|
|
120
|
+
}, []);
|
|
106
121
|
|
|
107
122
|
// Setup UI handlers.
|
|
108
123
|
var handleClickWrapper = useCallback(function (event) {
|
|
@@ -122,7 +137,6 @@ function Component(_ref) {
|
|
|
122
137
|
exposure: true
|
|
123
138
|
});
|
|
124
139
|
if (fg('platform_smartlink_xpc_url_wrapping')) {
|
|
125
|
-
var _appendCrossProductAn;
|
|
126
140
|
// FIXME: InlineCard, BlockCard and EmbedCard call event.preventDefault() internally
|
|
127
141
|
// before the event bubbles up to this handler. This forces us to snapshot
|
|
128
142
|
// event.defaultPrevented before calling onClick to detect whether the consumer
|
|
@@ -154,16 +168,14 @@ function Component(_ref) {
|
|
|
154
168
|
});
|
|
155
169
|
return;
|
|
156
170
|
}
|
|
171
|
+
var destinationUrl = getDestinationUrl();
|
|
172
|
+
updateAnchorHref(event, destinationUrl);
|
|
157
173
|
|
|
158
174
|
// For FlexibleCard, read target from the clicked anchor element (e.g. _blank for links
|
|
159
175
|
// rendered with explicit target). For classic cards, default to _self
|
|
160
176
|
var _getAnchorAttributesF = getAnchorAttributesFromEvent(event),
|
|
161
177
|
anchorTarget = _getAnchorAttributesF.target;
|
|
162
178
|
var target = isSpecialEvent(event) ? '_blank' : isFlexibleUi ? anchorTarget : '_self';
|
|
163
|
-
|
|
164
|
-
// FIXME: preferredUrl should be rendered in the DOM anchor href instead of derived at click time
|
|
165
|
-
var preferredUrl = getClickUrl(url, state.details);
|
|
166
|
-
var destinationUrl = (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
|
|
167
179
|
onClick === null || onClick === void 0 || onClick(event, {
|
|
168
180
|
url: url,
|
|
169
181
|
destinationUrl: destinationUrl
|
|
@@ -235,7 +247,7 @@ function Component(_ref) {
|
|
|
235
247
|
fireLinkClickedEvent(createAnalyticsEvent)(event);
|
|
236
248
|
}
|
|
237
249
|
}
|
|
238
|
-
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, onClick, url,
|
|
250
|
+
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, getDestinationUrl, onClick, url, updateAnchorHref, state.details, ari, name, fire3PClickEvent, shouldFire3PClickEvent, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, disablePreviewPanel]);
|
|
239
251
|
|
|
240
252
|
// Exposure fires once per eligible mount; click-time reads use no-exposure variant.
|
|
241
253
|
useEffect(function () {
|
|
@@ -247,23 +259,32 @@ function Component(_ref) {
|
|
|
247
259
|
// Middle-click handler to trigger fire3PClickEvent on middle-clicks.
|
|
248
260
|
// Scope is limited to 3P click analytics to keep the experiment focused.
|
|
249
261
|
var handleFrameAuxClick = useCallback(function (event) {
|
|
262
|
+
if (fg('platform_smartlink_xpc_url_wrapping')) {
|
|
263
|
+
var destinationUrl = getDestinationUrl();
|
|
264
|
+
updateAnchorHref(event, destinationUrl);
|
|
265
|
+
}
|
|
266
|
+
|
|
250
267
|
// isAuxClick filters Windows right-clicks (button === 2) that also fire onAuxClick.
|
|
251
268
|
if (isAuxClick(event) && shouldFire3PClickEvent && expValEqualsNoExposure(TRACK_NON_PRIMARY_3P_CLICKS_EXPERIMENT, 'isEnabled', true)) {
|
|
252
269
|
fire3PClickEvent === null || fire3PClickEvent === void 0 || fire3PClickEvent({
|
|
253
270
|
isAuxClick: true
|
|
254
271
|
});
|
|
255
272
|
}
|
|
256
|
-
}, [fire3PClickEvent, shouldFire3PClickEvent]);
|
|
273
|
+
}, [fire3PClickEvent, getDestinationUrl, shouldFire3PClickEvent, updateAnchorHref]);
|
|
257
274
|
|
|
258
275
|
// Right-click handler to trigger fire3PClickEvent on right-clicks.
|
|
259
276
|
// Scope is limited to 3P click analytics to keep the experiment focused.
|
|
260
|
-
var handleFrameContextMenu = useCallback(function (
|
|
277
|
+
var handleFrameContextMenu = useCallback(function (event) {
|
|
278
|
+
if (fg('platform_smartlink_xpc_url_wrapping')) {
|
|
279
|
+
var destinationUrl = getDestinationUrl();
|
|
280
|
+
updateAnchorHref(event, destinationUrl);
|
|
281
|
+
}
|
|
261
282
|
if (shouldFire3PClickEvent && expValEqualsNoExposure(TRACK_NON_PRIMARY_3P_CLICKS_EXPERIMENT, 'isEnabled', true)) {
|
|
262
283
|
fire3PClickEvent === null || fire3PClickEvent === void 0 || fire3PClickEvent({
|
|
263
284
|
isContextMenu: true
|
|
264
285
|
});
|
|
265
286
|
}
|
|
266
|
-
}, [fire3PClickEvent, shouldFire3PClickEvent]);
|
|
287
|
+
}, [fire3PClickEvent, getDestinationUrl, shouldFire3PClickEvent, updateAnchorHref]);
|
|
267
288
|
var reload = actions.reload;
|
|
268
289
|
var handleAuthorize = useCallback(function () {
|
|
269
290
|
return actions.authorize(appearance);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
var _excluded = ["aria-haspopup", "aria-expanded"];
|
|
4
|
+
var _excluded = ["aria-haspopup", "aria-expanded", "aria-controls"];
|
|
5
5
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import Popup from '@atlaskit/popup';
|
|
@@ -231,6 +231,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
231
231
|
var trigger = useCallback(function (_ref3) {
|
|
232
232
|
var _ariaHasPopup = _ref3['aria-haspopup'],
|
|
233
233
|
_ariaExpanded = _ref3['aria-expanded'],
|
|
234
|
+
_ariaControls = _ref3['aria-controls'],
|
|
234
235
|
triggerProps = _objectWithoutProperties(_ref3, _excluded);
|
|
235
236
|
return /*#__PURE__*/React.createElement("span", {
|
|
236
237
|
ref: parentSpan
|
|
@@ -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: "44.
|
|
15
|
+
packageVersion: "44.26.0",
|
|
16
16
|
componentName: 'linkUrl'
|
|
17
17
|
};
|
|
18
18
|
var LinkUrl = function LinkUrl(_ref) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "44.26.
|
|
3
|
+
"version": "44.26.1",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"ak-postbuild": "ls -d dist/* | xargs -n 1 copyfiles -u 1 -V src/**/*.{svg,png}"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@atlaskit/adf-utils": "^19.
|
|
38
|
+
"@atlaskit/adf-utils": "^19.33.0",
|
|
39
39
|
"@atlaskit/afm-i18n-platform-linking-platform-smart-card": "2.6.0",
|
|
40
40
|
"@atlaskit/analytics-cross-product": "^1.2.0",
|
|
41
41
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@atlaskit/textfield": "^8.3.0",
|
|
88
88
|
"@atlaskit/theme": "^25.0.0",
|
|
89
89
|
"@atlaskit/tile": "^1.1.0",
|
|
90
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
90
|
+
"@atlaskit/tmp-editor-statsig": "^95.0.0",
|
|
91
91
|
"@atlaskit/tokens": "^13.3.0",
|
|
92
92
|
"@atlaskit/tooltip": "^22.6.0",
|
|
93
93
|
"@atlaskit/ufo": "^0.5.0",
|