@atlaskit/smart-card 45.11.2 → 45.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/analytics/click.js +4 -69
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/analytics/click.js +3 -66
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/analytics/click.js +3 -68
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/utils/analytics/click.d.ts +0 -2
- package/dist/types/utils/analytics/types.d.ts +0 -5
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 45.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`103ecc1edeedc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/103ecc1edeedc) -
|
|
8
|
+
Remove Confluence short link metadata from smart link clicked analytics payloads.
|
|
9
|
+
|
|
10
|
+
This removes the temporary `isConfluenceShortLink` field that was added to support an
|
|
11
|
+
investigation into Confluence short link usage. The investigation is complete, and the smart link
|
|
12
|
+
clicked analytics payload now returns to its previous shape.
|
|
13
|
+
|
|
14
|
+
This also removes the temporary `smart_link_confluence_short_link_analytics` experiment from
|
|
15
|
+
`editorExperimentsConfig` and the generated experiment key types. Consumers that checked this
|
|
16
|
+
temporary experiment can remove that branch.
|
|
17
|
+
|
|
18
|
+
Before:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
if (expValEquals('smart_link_confluence_short_link_analytics', 'cohort', 'test')) {
|
|
22
|
+
trackLinkClicked({ isConfluenceShortLink });
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
After:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
trackLinkClicked();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Before:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const { isConfluenceShortLink, ...payload } = event;
|
|
36
|
+
sendAnalytics(payload, { isShortLink: isConfluenceShortLink });
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
After:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
sendAnalytics(event);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- Updated dependencies
|
|
48
|
+
|
|
3
49
|
## 45.11.2
|
|
4
50
|
|
|
5
51
|
### Patch 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: "45.11.
|
|
14
|
+
packageVersion: "45.11.2" || ''
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -4,14 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.getKeys = exports.fireLinkClickedEvent = exports.
|
|
7
|
+
exports.getKeys = exports.fireLinkClickedEvent = exports.createLinkClickedPayload = exports.buttonMap = void 0;
|
|
8
8
|
exports.getLinkClickOutcome = getLinkClickOutcome;
|
|
9
9
|
exports.withLinkClickedEvent = withLinkClickedEvent;
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _userAgent = require("@atlaskit/linking-common/user-agent");
|
|
13
|
-
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
14
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
13
|
var _useLinkClicked = require("../../state/analytics/useLinkClicked");
|
|
16
14
|
var _analytics = require("./analytics");
|
|
17
15
|
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; }
|
|
@@ -80,7 +78,7 @@ function getLinkClickOutcome(e, clickType) {
|
|
|
80
78
|
}
|
|
81
79
|
return 'unknown';
|
|
82
80
|
}
|
|
83
|
-
var
|
|
81
|
+
var linkClickedEvent = function linkClickedEvent(_ref) {
|
|
84
82
|
var clickType = _ref.clickType,
|
|
85
83
|
clickOutcome = _ref.clickOutcome,
|
|
86
84
|
keysHeld = _ref.keysHeld,
|
|
@@ -97,26 +95,7 @@ var linkClickedEventOld = function linkClickedEventOld(_ref) {
|
|
|
97
95
|
}
|
|
98
96
|
};
|
|
99
97
|
};
|
|
100
|
-
var
|
|
101
|
-
var clickType = _ref2.clickType,
|
|
102
|
-
clickOutcome = _ref2.clickOutcome,
|
|
103
|
-
keysHeld = _ref2.keysHeld,
|
|
104
|
-
defaultPrevented = _ref2.defaultPrevented,
|
|
105
|
-
isConfluenceShortLink = _ref2.isConfluenceShortLink;
|
|
106
|
-
return {
|
|
107
|
-
action: 'clicked',
|
|
108
|
-
actionSubject: 'link',
|
|
109
|
-
eventType: 'ui',
|
|
110
|
-
attributes: {
|
|
111
|
-
clickType: clickType,
|
|
112
|
-
clickOutcome: clickOutcome,
|
|
113
|
-
keysHeld: keysHeld,
|
|
114
|
-
defaultPrevented: defaultPrevented,
|
|
115
|
-
isConfluenceShortLink: isConfluenceShortLink
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
var createLinkClickedPayloadOld = exports.createLinkClickedPayloadOld = function createLinkClickedPayloadOld(event) {
|
|
98
|
+
var createLinkClickedPayload = exports.createLinkClickedPayload = function createLinkClickedPayload(event) {
|
|
120
99
|
// Through the `detail` property, we're able to determine if the event is (most likely) triggered via keyboard
|
|
121
100
|
// https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
122
101
|
var isKeyboard = event.nativeEvent.detail === 0;
|
|
@@ -127,7 +106,7 @@ var createLinkClickedPayloadOld = exports.createLinkClickedPayloadOld = function
|
|
|
127
106
|
var clickOutcome = getLinkClickOutcome(event, clickType);
|
|
128
107
|
var keysHeld = getKeys(event);
|
|
129
108
|
var defaultPrevented = event.defaultPrevented;
|
|
130
|
-
var linkClickedEventResult =
|
|
109
|
+
var linkClickedEventResult = linkClickedEvent({
|
|
131
110
|
clickType: clickType,
|
|
132
111
|
clickOutcome: clickOutcome,
|
|
133
112
|
keysHeld: keysHeld,
|
|
@@ -147,50 +126,6 @@ var createLinkClickedPayloadOld = exports.createLinkClickedPayloadOld = function
|
|
|
147
126
|
return linkClickedEventResult;
|
|
148
127
|
}
|
|
149
128
|
};
|
|
150
|
-
var createLinkClickedPayloadNew = exports.createLinkClickedPayloadNew = function createLinkClickedPayloadNew(event) {
|
|
151
|
-
// Through the `detail` property, we're able to determine if the event is (most likely) triggered via keyboard
|
|
152
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
153
|
-
var isKeyboard = event.nativeEvent.detail === 0;
|
|
154
|
-
var clickType = isKeyboard ? 'keyboard' : buttonMap.get(event.button);
|
|
155
|
-
if (!clickType) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
var clickOutcome = getLinkClickOutcome(event, clickType);
|
|
159
|
-
var keysHeld = getKeys(event);
|
|
160
|
-
var defaultPrevented = event.defaultPrevented;
|
|
161
|
-
|
|
162
|
-
// Check if the URL is a Confluence shortLink (contains "/l/cp/")
|
|
163
|
-
var isConfluenceShortLink = false;
|
|
164
|
-
if (event.currentTarget instanceof HTMLAnchorElement) {
|
|
165
|
-
var url = event.currentTarget.href;
|
|
166
|
-
isConfluenceShortLink = url.includes('/l/cp/');
|
|
167
|
-
}
|
|
168
|
-
var linkClickedEventResult = linkClickedEventWithShortLink({
|
|
169
|
-
clickType: clickType,
|
|
170
|
-
clickOutcome: clickOutcome,
|
|
171
|
-
keysHeld: keysHeld,
|
|
172
|
-
defaultPrevented: defaultPrevented,
|
|
173
|
-
isConfluenceShortLink: isConfluenceShortLink
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
// if the current target is an anchor tag, we can get the href from it and use that as the url being navigated too.
|
|
177
|
-
if (event.currentTarget instanceof HTMLAnchorElement) {
|
|
178
|
-
var _url = event.currentTarget.href;
|
|
179
|
-
return _objectSpread(_objectSpread({}, linkClickedEventResult), {}, {
|
|
180
|
-
nonPrivacySafeAttributes: {
|
|
181
|
-
url: _url
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
} else {
|
|
185
|
-
// We can't get the href from the event target, so dont include the url or any non privacy safe attributes
|
|
186
|
-
return linkClickedEventResult;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
var createLinkClickedPayload = exports.createLinkClickedPayload = (0, _platformFeatureFlagsReact.functionWithCondition)(function () {
|
|
190
|
-
return (0, _expValEquals.expValEquals)('smart_link_confluence_short_link_analytics', 'cohort', 'test');
|
|
191
|
-
},
|
|
192
|
-
// 12/17/2025: Clean up this feature gate once it's out in prod for 2 weeks - https://product-fabric.atlassian.net/browse/CCPERMS-5030
|
|
193
|
-
createLinkClickedPayloadNew, createLinkClickedPayloadOld);
|
|
194
129
|
var fireLinkClickedEvent = exports.fireLinkClickedEvent = function fireLinkClickedEvent(createAnalyticsEvent) {
|
|
195
130
|
return function (event) {
|
|
196
131
|
var overrides = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -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.11.
|
|
22
|
+
packageVersion: "45.11.2",
|
|
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: "45.11.
|
|
5
|
+
packageVersion: "45.11.2" || ''
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { browser } from '@atlaskit/linking-common/user-agent';
|
|
3
|
-
import { functionWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
4
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
3
|
import { useLinkClicked, useMouseDownEvent } from '../../state/analytics/useLinkClicked';
|
|
6
4
|
import { ANALYTICS_CHANNEL } from './analytics';
|
|
7
5
|
export const buttonMap = new Map([[undefined, 'none'], [0, 'left'], [1, 'middle'], [2, 'right']]);
|
|
@@ -67,7 +65,7 @@ export function getLinkClickOutcome(e, clickType) {
|
|
|
67
65
|
}
|
|
68
66
|
return 'unknown';
|
|
69
67
|
}
|
|
70
|
-
const
|
|
68
|
+
const linkClickedEvent = ({
|
|
71
69
|
clickType,
|
|
72
70
|
clickOutcome,
|
|
73
71
|
keysHeld,
|
|
@@ -83,25 +81,7 @@ const linkClickedEventOld = ({
|
|
|
83
81
|
defaultPrevented
|
|
84
82
|
}
|
|
85
83
|
});
|
|
86
|
-
const
|
|
87
|
-
clickType,
|
|
88
|
-
clickOutcome,
|
|
89
|
-
keysHeld,
|
|
90
|
-
defaultPrevented,
|
|
91
|
-
isConfluenceShortLink
|
|
92
|
-
}) => ({
|
|
93
|
-
action: 'clicked',
|
|
94
|
-
actionSubject: 'link',
|
|
95
|
-
eventType: 'ui',
|
|
96
|
-
attributes: {
|
|
97
|
-
clickType,
|
|
98
|
-
clickOutcome,
|
|
99
|
-
keysHeld,
|
|
100
|
-
defaultPrevented,
|
|
101
|
-
isConfluenceShortLink
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
export const createLinkClickedPayloadOld = event => {
|
|
84
|
+
export const createLinkClickedPayload = event => {
|
|
105
85
|
// Through the `detail` property, we're able to determine if the event is (most likely) triggered via keyboard
|
|
106
86
|
// https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
107
87
|
const isKeyboard = event.nativeEvent.detail === 0;
|
|
@@ -112,7 +92,7 @@ export const createLinkClickedPayloadOld = event => {
|
|
|
112
92
|
const clickOutcome = getLinkClickOutcome(event, clickType);
|
|
113
93
|
const keysHeld = getKeys(event);
|
|
114
94
|
const defaultPrevented = event.defaultPrevented;
|
|
115
|
-
const linkClickedEventResult =
|
|
95
|
+
const linkClickedEventResult = linkClickedEvent({
|
|
116
96
|
clickType,
|
|
117
97
|
clickOutcome,
|
|
118
98
|
keysHeld,
|
|
@@ -133,49 +113,6 @@ export const createLinkClickedPayloadOld = event => {
|
|
|
133
113
|
return linkClickedEventResult;
|
|
134
114
|
}
|
|
135
115
|
};
|
|
136
|
-
export const createLinkClickedPayloadNew = event => {
|
|
137
|
-
// Through the `detail` property, we're able to determine if the event is (most likely) triggered via keyboard
|
|
138
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
139
|
-
const isKeyboard = event.nativeEvent.detail === 0;
|
|
140
|
-
const clickType = isKeyboard ? 'keyboard' : buttonMap.get(event.button);
|
|
141
|
-
if (!clickType) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
const clickOutcome = getLinkClickOutcome(event, clickType);
|
|
145
|
-
const keysHeld = getKeys(event);
|
|
146
|
-
const defaultPrevented = event.defaultPrevented;
|
|
147
|
-
|
|
148
|
-
// Check if the URL is a Confluence shortLink (contains "/l/cp/")
|
|
149
|
-
let isConfluenceShortLink = false;
|
|
150
|
-
if (event.currentTarget instanceof HTMLAnchorElement) {
|
|
151
|
-
const url = event.currentTarget.href;
|
|
152
|
-
isConfluenceShortLink = url.includes('/l/cp/');
|
|
153
|
-
}
|
|
154
|
-
const linkClickedEventResult = linkClickedEventWithShortLink({
|
|
155
|
-
clickType,
|
|
156
|
-
clickOutcome,
|
|
157
|
-
keysHeld,
|
|
158
|
-
defaultPrevented,
|
|
159
|
-
isConfluenceShortLink
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
// if the current target is an anchor tag, we can get the href from it and use that as the url being navigated too.
|
|
163
|
-
if (event.currentTarget instanceof HTMLAnchorElement) {
|
|
164
|
-
const url = event.currentTarget.href;
|
|
165
|
-
return {
|
|
166
|
-
...linkClickedEventResult,
|
|
167
|
-
nonPrivacySafeAttributes: {
|
|
168
|
-
url
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
} else {
|
|
172
|
-
// We can't get the href from the event target, so dont include the url or any non privacy safe attributes
|
|
173
|
-
return linkClickedEventResult;
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
export const createLinkClickedPayload = functionWithCondition(() => expValEquals('smart_link_confluence_short_link_analytics', 'cohort', 'test'),
|
|
177
|
-
// 12/17/2025: Clean up this feature gate once it's out in prod for 2 weeks - https://product-fabric.atlassian.net/browse/CCPERMS-5030
|
|
178
|
-
createLinkClickedPayloadNew, createLinkClickedPayloadOld);
|
|
179
116
|
export const fireLinkClickedEvent = createAnalyticsEvent => (event, overrides = {}) => {
|
|
180
117
|
const payload = createLinkClickedPayload(event);
|
|
181
118
|
if (payload) {
|
|
@@ -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.11.
|
|
12
|
+
packageVersion: "45.11.2",
|
|
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: "45.11.
|
|
7
|
+
packageVersion: "45.11.2" || ''
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -3,8 +3,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { browser } from '@atlaskit/linking-common/user-agent';
|
|
6
|
-
import { functionWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
7
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
6
|
import { useLinkClicked, useMouseDownEvent } from '../../state/analytics/useLinkClicked';
|
|
9
7
|
import { ANALYTICS_CHANNEL } from './analytics';
|
|
10
8
|
export var buttonMap = new Map([[undefined, 'none'], [0, 'left'], [1, 'middle'], [2, 'right']]);
|
|
@@ -71,7 +69,7 @@ export function getLinkClickOutcome(e, clickType) {
|
|
|
71
69
|
}
|
|
72
70
|
return 'unknown';
|
|
73
71
|
}
|
|
74
|
-
var
|
|
72
|
+
var linkClickedEvent = function linkClickedEvent(_ref) {
|
|
75
73
|
var clickType = _ref.clickType,
|
|
76
74
|
clickOutcome = _ref.clickOutcome,
|
|
77
75
|
keysHeld = _ref.keysHeld,
|
|
@@ -88,26 +86,7 @@ var linkClickedEventOld = function linkClickedEventOld(_ref) {
|
|
|
88
86
|
}
|
|
89
87
|
};
|
|
90
88
|
};
|
|
91
|
-
var
|
|
92
|
-
var clickType = _ref2.clickType,
|
|
93
|
-
clickOutcome = _ref2.clickOutcome,
|
|
94
|
-
keysHeld = _ref2.keysHeld,
|
|
95
|
-
defaultPrevented = _ref2.defaultPrevented,
|
|
96
|
-
isConfluenceShortLink = _ref2.isConfluenceShortLink;
|
|
97
|
-
return {
|
|
98
|
-
action: 'clicked',
|
|
99
|
-
actionSubject: 'link',
|
|
100
|
-
eventType: 'ui',
|
|
101
|
-
attributes: {
|
|
102
|
-
clickType: clickType,
|
|
103
|
-
clickOutcome: clickOutcome,
|
|
104
|
-
keysHeld: keysHeld,
|
|
105
|
-
defaultPrevented: defaultPrevented,
|
|
106
|
-
isConfluenceShortLink: isConfluenceShortLink
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
export var createLinkClickedPayloadOld = function createLinkClickedPayloadOld(event) {
|
|
89
|
+
export var createLinkClickedPayload = function createLinkClickedPayload(event) {
|
|
111
90
|
// Through the `detail` property, we're able to determine if the event is (most likely) triggered via keyboard
|
|
112
91
|
// https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
113
92
|
var isKeyboard = event.nativeEvent.detail === 0;
|
|
@@ -118,7 +97,7 @@ export var createLinkClickedPayloadOld = function createLinkClickedPayloadOld(ev
|
|
|
118
97
|
var clickOutcome = getLinkClickOutcome(event, clickType);
|
|
119
98
|
var keysHeld = getKeys(event);
|
|
120
99
|
var defaultPrevented = event.defaultPrevented;
|
|
121
|
-
var linkClickedEventResult =
|
|
100
|
+
var linkClickedEventResult = linkClickedEvent({
|
|
122
101
|
clickType: clickType,
|
|
123
102
|
clickOutcome: clickOutcome,
|
|
124
103
|
keysHeld: keysHeld,
|
|
@@ -138,50 +117,6 @@ export var createLinkClickedPayloadOld = function createLinkClickedPayloadOld(ev
|
|
|
138
117
|
return linkClickedEventResult;
|
|
139
118
|
}
|
|
140
119
|
};
|
|
141
|
-
export var createLinkClickedPayloadNew = function createLinkClickedPayloadNew(event) {
|
|
142
|
-
// Through the `detail` property, we're able to determine if the event is (most likely) triggered via keyboard
|
|
143
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
144
|
-
var isKeyboard = event.nativeEvent.detail === 0;
|
|
145
|
-
var clickType = isKeyboard ? 'keyboard' : buttonMap.get(event.button);
|
|
146
|
-
if (!clickType) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
var clickOutcome = getLinkClickOutcome(event, clickType);
|
|
150
|
-
var keysHeld = getKeys(event);
|
|
151
|
-
var defaultPrevented = event.defaultPrevented;
|
|
152
|
-
|
|
153
|
-
// Check if the URL is a Confluence shortLink (contains "/l/cp/")
|
|
154
|
-
var isConfluenceShortLink = false;
|
|
155
|
-
if (event.currentTarget instanceof HTMLAnchorElement) {
|
|
156
|
-
var url = event.currentTarget.href;
|
|
157
|
-
isConfluenceShortLink = url.includes('/l/cp/');
|
|
158
|
-
}
|
|
159
|
-
var linkClickedEventResult = linkClickedEventWithShortLink({
|
|
160
|
-
clickType: clickType,
|
|
161
|
-
clickOutcome: clickOutcome,
|
|
162
|
-
keysHeld: keysHeld,
|
|
163
|
-
defaultPrevented: defaultPrevented,
|
|
164
|
-
isConfluenceShortLink: isConfluenceShortLink
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
// if the current target is an anchor tag, we can get the href from it and use that as the url being navigated too.
|
|
168
|
-
if (event.currentTarget instanceof HTMLAnchorElement) {
|
|
169
|
-
var _url = event.currentTarget.href;
|
|
170
|
-
return _objectSpread(_objectSpread({}, linkClickedEventResult), {}, {
|
|
171
|
-
nonPrivacySafeAttributes: {
|
|
172
|
-
url: _url
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
} else {
|
|
176
|
-
// We can't get the href from the event target, so dont include the url or any non privacy safe attributes
|
|
177
|
-
return linkClickedEventResult;
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
export var createLinkClickedPayload = functionWithCondition(function () {
|
|
181
|
-
return expValEquals('smart_link_confluence_short_link_analytics', 'cohort', 'test');
|
|
182
|
-
},
|
|
183
|
-
// 12/17/2025: Clean up this feature gate once it's out in prod for 2 weeks - https://product-fabric.atlassian.net/browse/CCPERMS-5030
|
|
184
|
-
createLinkClickedPayloadNew, createLinkClickedPayloadOld);
|
|
185
120
|
export var fireLinkClickedEvent = function fireLinkClickedEvent(createAnalyticsEvent) {
|
|
186
121
|
return function (event) {
|
|
187
122
|
var overrides = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -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.11.
|
|
15
|
+
packageVersion: "45.11.2",
|
|
16
16
|
componentName: 'linkUrl'
|
|
17
17
|
};
|
|
18
18
|
var LinkUrl = function LinkUrl(_ref) {
|
|
@@ -7,8 +7,6 @@ import { type ClickOutcome, type ClickType, type UiLinkClickedEventProps } from
|
|
|
7
7
|
export declare const buttonMap: Map<number | undefined, 'middle' | 'none' | 'left' | 'right'>;
|
|
8
8
|
export declare const getKeys: (e: React.MouseEvent) => ("meta" | "alt" | "shift" | "ctrl")[];
|
|
9
9
|
export declare function getLinkClickOutcome(e: React.MouseEvent, clickType: ClickType): ClickOutcome;
|
|
10
|
-
export declare const createLinkClickedPayloadOld: (event: React.MouseEvent) => AnalyticsPayload | undefined;
|
|
11
|
-
export declare const createLinkClickedPayloadNew: (event: React.MouseEvent) => AnalyticsPayload | undefined;
|
|
12
10
|
export declare const createLinkClickedPayload: (event: React.MouseEvent) => AnalyticsPayload | undefined;
|
|
13
11
|
type DeepPartial<T> = T extends object ? {
|
|
14
12
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
@@ -21,9 +21,4 @@ export type UiLinkClickedEventProps = {
|
|
|
21
21
|
* The keys held by the user at the time of clicking the link (which influence `clickOutcome`)
|
|
22
22
|
*/
|
|
23
23
|
keysHeld: ('alt' | 'ctrl' | 'meta' | 'shift')[];
|
|
24
|
-
/**
|
|
25
|
-
* Whether the clicked URL is a Confluence shortLink (contains "/l/cp")
|
|
26
|
-
* Only included when the experiment is enabled
|
|
27
|
-
*/
|
|
28
|
-
isConfluenceShortLink?: boolean;
|
|
29
24
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "45.
|
|
3
|
+
"version": "45.12.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -83,13 +83,13 @@
|
|
|
83
83
|
"@atlaskit/section-message": "^9.2.0",
|
|
84
84
|
"@atlaskit/select": "^22.5.0",
|
|
85
85
|
"@atlaskit/spinner": "^20.1.0",
|
|
86
|
-
"@atlaskit/tag": "^15.
|
|
86
|
+
"@atlaskit/tag": "^15.4.0",
|
|
87
87
|
"@atlaskit/textarea": "^9.1.0",
|
|
88
88
|
"@atlaskit/textfield": "^9.1.0",
|
|
89
89
|
"@atlaskit/theme": "^26.1.0",
|
|
90
90
|
"@atlaskit/tile": "^2.3.0",
|
|
91
|
-
"@atlaskit/tmp-editor-statsig": "^132.
|
|
92
|
-
"@atlaskit/tokens": "^16.
|
|
91
|
+
"@atlaskit/tmp-editor-statsig": "^132.3.0",
|
|
92
|
+
"@atlaskit/tokens": "^16.3.0",
|
|
93
93
|
"@atlaskit/tooltip": "^23.1.0",
|
|
94
94
|
"@atlaskit/ufo": "^1.0.0",
|
|
95
95
|
"@atlaskit/width-detector": "^6.2.0",
|