@atlaskit/smart-card 43.12.0 → 43.12.2
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 +16 -0
- package/dist/cjs/utils/analytics/click.js +69 -4
- package/dist/cjs/view/EmbedCard/views/not-found-view/not-found-svg/index.js +5 -1
- package/dist/es2019/utils/analytics/click.js +66 -3
- package/dist/es2019/view/EmbedCard/views/not-found-view/not-found-svg/index.js +5 -1
- package/dist/esm/utils/analytics/click.js +68 -3
- package/dist/esm/view/EmbedCard/views/not-found-view/not-found-svg/index.js +5 -1
- package/dist/types/utils/analytics/click.d.ts +2 -0
- package/dist/types/utils/analytics/types.d.ts +5 -0
- package/dist/types-ts4.5/utils/analytics/click.d.ts +2 -0
- package/dist/types-ts4.5/utils/analytics/types.d.ts +5 -0
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 43.12.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`62db1dbb5e93b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/62db1dbb5e93b) -
|
|
8
|
+
Add shortlinks to link clicked events. Only for updating metrics. Experiment here -
|
|
9
|
+
smart_link_confluence_short_link_analytics.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 43.12.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`7ae944d7f3cd6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7ae944d7f3cd6) -
|
|
17
|
+
NAVX-2825 Fixing no-literal-string-in-jsx violations in linking platform
|
|
18
|
+
|
|
3
19
|
## 43.12.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -4,12 +4,14 @@ 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.createLinkClickedPayload = exports.buttonMap = void 0;
|
|
7
|
+
exports.getKeys = exports.fireLinkClickedEvent = exports.createLinkClickedPayloadOld = exports.createLinkClickedPayloadNew = 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");
|
|
13
15
|
var _useLinkClicked = require("../../state/analytics/useLinkClicked");
|
|
14
16
|
var _analytics = require("./analytics");
|
|
15
17
|
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; }
|
|
@@ -78,7 +80,7 @@ function getLinkClickOutcome(e, clickType) {
|
|
|
78
80
|
}
|
|
79
81
|
return 'unknown';
|
|
80
82
|
}
|
|
81
|
-
var
|
|
83
|
+
var linkClickedEventOld = function linkClickedEventOld(_ref) {
|
|
82
84
|
var clickType = _ref.clickType,
|
|
83
85
|
clickOutcome = _ref.clickOutcome,
|
|
84
86
|
keysHeld = _ref.keysHeld,
|
|
@@ -95,7 +97,26 @@ var linkClickedEvent = function linkClickedEvent(_ref) {
|
|
|
95
97
|
}
|
|
96
98
|
};
|
|
97
99
|
};
|
|
98
|
-
var
|
|
100
|
+
var linkClickedEventWithShortLink = function linkClickedEventWithShortLink(_ref2) {
|
|
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) {
|
|
99
120
|
// Through the `detail` property, we're able to determine if the event is (most likely) triggered via keyboard
|
|
100
121
|
// https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
101
122
|
var isKeyboard = event.nativeEvent.detail === 0;
|
|
@@ -106,7 +127,7 @@ var createLinkClickedPayload = exports.createLinkClickedPayload = function creat
|
|
|
106
127
|
var clickOutcome = getLinkClickOutcome(event, clickType);
|
|
107
128
|
var keysHeld = getKeys(event);
|
|
108
129
|
var defaultPrevented = event.defaultPrevented;
|
|
109
|
-
var linkClickedEventResult =
|
|
130
|
+
var linkClickedEventResult = linkClickedEventOld({
|
|
110
131
|
clickType: clickType,
|
|
111
132
|
clickOutcome: clickOutcome,
|
|
112
133
|
keysHeld: keysHeld,
|
|
@@ -126,6 +147,50 @@ var createLinkClickedPayload = exports.createLinkClickedPayload = function creat
|
|
|
126
147
|
return linkClickedEventResult;
|
|
127
148
|
}
|
|
128
149
|
};
|
|
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);
|
|
129
194
|
var fireLinkClickedEvent = exports.fireLinkClickedEvent = function fireLinkClickedEvent(createAnalyticsEvent) {
|
|
130
195
|
return function (event) {
|
|
131
196
|
var overrides = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.NotFoundSVG = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
11
|
var NotFoundSVG = exports.NotFoundSVG = function NotFoundSVG() {
|
|
10
12
|
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
11
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -44,7 +46,9 @@ var NotFoundSVG = exports.NotFoundSVG = function NotFoundSVG() {
|
|
|
44
46
|
offset: "0.69",
|
|
45
47
|
stopColor: "#fff",
|
|
46
48
|
stopOpacity: "0.1"
|
|
47
|
-
}))), /*#__PURE__*/_react.default.createElement("title", null,
|
|
49
|
+
}))), /*#__PURE__*/_react.default.createElement("title", null, (0, _platformFeatureFlags.fg)('navx-2825-eslint-translation-fix-linking-platform') ? /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, {
|
|
50
|
+
defaultMessage: "Search error"
|
|
51
|
+
}) : "Search error"), /*#__PURE__*/_react.default.createElement("g", {
|
|
48
52
|
id: "Layer_2",
|
|
49
53
|
"data-name": "Layer 2"
|
|
50
54
|
}, /*#__PURE__*/_react.default.createElement("g", {
|
|
@@ -1,5 +1,7 @@
|
|
|
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';
|
|
3
5
|
import { useLinkClicked, useMouseDownEvent } from '../../state/analytics/useLinkClicked';
|
|
4
6
|
import { ANALYTICS_CHANNEL } from './analytics';
|
|
5
7
|
export const buttonMap = new Map([[undefined, 'none'], [0, 'left'], [1, 'middle'], [2, 'right']]);
|
|
@@ -65,7 +67,7 @@ export function getLinkClickOutcome(e, clickType) {
|
|
|
65
67
|
}
|
|
66
68
|
return 'unknown';
|
|
67
69
|
}
|
|
68
|
-
const
|
|
70
|
+
const linkClickedEventOld = ({
|
|
69
71
|
clickType,
|
|
70
72
|
clickOutcome,
|
|
71
73
|
keysHeld,
|
|
@@ -81,7 +83,25 @@ const linkClickedEvent = ({
|
|
|
81
83
|
defaultPrevented
|
|
82
84
|
}
|
|
83
85
|
});
|
|
84
|
-
|
|
86
|
+
const linkClickedEventWithShortLink = ({
|
|
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 => {
|
|
85
105
|
// Through the `detail` property, we're able to determine if the event is (most likely) triggered via keyboard
|
|
86
106
|
// https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
87
107
|
const isKeyboard = event.nativeEvent.detail === 0;
|
|
@@ -92,7 +112,7 @@ export const createLinkClickedPayload = event => {
|
|
|
92
112
|
const clickOutcome = getLinkClickOutcome(event, clickType);
|
|
93
113
|
const keysHeld = getKeys(event);
|
|
94
114
|
const defaultPrevented = event.defaultPrevented;
|
|
95
|
-
const linkClickedEventResult =
|
|
115
|
+
const linkClickedEventResult = linkClickedEventOld({
|
|
96
116
|
clickType,
|
|
97
117
|
clickOutcome,
|
|
98
118
|
keysHeld,
|
|
@@ -113,6 +133,49 @@ export const createLinkClickedPayload = event => {
|
|
|
113
133
|
return linkClickedEventResult;
|
|
114
134
|
}
|
|
115
135
|
};
|
|
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);
|
|
116
179
|
export const fireLinkClickedEvent = createAnalyticsEvent => (event, overrides = {}) => {
|
|
117
180
|
const payload = createLinkClickedPayload(event);
|
|
118
181
|
if (payload) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
4
|
export const NotFoundSVG = () => /*#__PURE__*/React.createElement("svg", {
|
|
3
5
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4
6
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
@@ -36,7 +38,9 @@ export const NotFoundSVG = () => /*#__PURE__*/React.createElement("svg", {
|
|
|
36
38
|
offset: "0.69",
|
|
37
39
|
stopColor: "#fff",
|
|
38
40
|
stopOpacity: "0.1"
|
|
39
|
-
}))), /*#__PURE__*/React.createElement("title", null,
|
|
41
|
+
}))), /*#__PURE__*/React.createElement("title", null, fg('navx-2825-eslint-translation-fix-linking-platform') ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
42
|
+
defaultMessage: "Search error"
|
|
43
|
+
}) : "Search error"), /*#__PURE__*/React.createElement("g", {
|
|
40
44
|
id: "Layer_2",
|
|
41
45
|
"data-name": "Layer 2"
|
|
42
46
|
}, /*#__PURE__*/React.createElement("g", {
|
|
@@ -3,6 +3,8 @@ 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';
|
|
6
8
|
import { useLinkClicked, useMouseDownEvent } from '../../state/analytics/useLinkClicked';
|
|
7
9
|
import { ANALYTICS_CHANNEL } from './analytics';
|
|
8
10
|
export var buttonMap = new Map([[undefined, 'none'], [0, 'left'], [1, 'middle'], [2, 'right']]);
|
|
@@ -69,7 +71,7 @@ export function getLinkClickOutcome(e, clickType) {
|
|
|
69
71
|
}
|
|
70
72
|
return 'unknown';
|
|
71
73
|
}
|
|
72
|
-
var
|
|
74
|
+
var linkClickedEventOld = function linkClickedEventOld(_ref) {
|
|
73
75
|
var clickType = _ref.clickType,
|
|
74
76
|
clickOutcome = _ref.clickOutcome,
|
|
75
77
|
keysHeld = _ref.keysHeld,
|
|
@@ -86,7 +88,26 @@ var linkClickedEvent = function linkClickedEvent(_ref) {
|
|
|
86
88
|
}
|
|
87
89
|
};
|
|
88
90
|
};
|
|
89
|
-
|
|
91
|
+
var linkClickedEventWithShortLink = function linkClickedEventWithShortLink(_ref2) {
|
|
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) {
|
|
90
111
|
// Through the `detail` property, we're able to determine if the event is (most likely) triggered via keyboard
|
|
91
112
|
// https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
|
|
92
113
|
var isKeyboard = event.nativeEvent.detail === 0;
|
|
@@ -97,7 +118,7 @@ export var createLinkClickedPayload = function createLinkClickedPayload(event) {
|
|
|
97
118
|
var clickOutcome = getLinkClickOutcome(event, clickType);
|
|
98
119
|
var keysHeld = getKeys(event);
|
|
99
120
|
var defaultPrevented = event.defaultPrevented;
|
|
100
|
-
var linkClickedEventResult =
|
|
121
|
+
var linkClickedEventResult = linkClickedEventOld({
|
|
101
122
|
clickType: clickType,
|
|
102
123
|
clickOutcome: clickOutcome,
|
|
103
124
|
keysHeld: keysHeld,
|
|
@@ -117,6 +138,50 @@ export var createLinkClickedPayload = function createLinkClickedPayload(event) {
|
|
|
117
138
|
return linkClickedEventResult;
|
|
118
139
|
}
|
|
119
140
|
};
|
|
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);
|
|
120
185
|
export var fireLinkClickedEvent = function fireLinkClickedEvent(createAnalyticsEvent) {
|
|
121
186
|
return function (event) {
|
|
122
187
|
var overrides = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
4
|
export var NotFoundSVG = function NotFoundSVG() {
|
|
3
5
|
return /*#__PURE__*/React.createElement("svg", {
|
|
4
6
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -37,7 +39,9 @@ export var NotFoundSVG = function NotFoundSVG() {
|
|
|
37
39
|
offset: "0.69",
|
|
38
40
|
stopColor: "#fff",
|
|
39
41
|
stopOpacity: "0.1"
|
|
40
|
-
}))), /*#__PURE__*/React.createElement("title", null,
|
|
42
|
+
}))), /*#__PURE__*/React.createElement("title", null, fg('navx-2825-eslint-translation-fix-linking-platform') ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
43
|
+
defaultMessage: "Search error"
|
|
44
|
+
}) : "Search error"), /*#__PURE__*/React.createElement("g", {
|
|
41
45
|
id: "Layer_2",
|
|
42
46
|
"data-name": "Layer 2"
|
|
43
47
|
}, /*#__PURE__*/React.createElement("g", {
|
|
@@ -7,6 +7,8 @@ import { type ClickOutcome, type ClickType, type UiLinkClickedEventProps } from
|
|
|
7
7
|
export declare const buttonMap: Map<number | undefined, "left" | "right" | "none" | "middle">;
|
|
8
8
|
export declare const getKeys: (e: React.MouseEvent) => ("shift" | "meta" | "alt" | "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;
|
|
10
12
|
export declare const createLinkClickedPayload: (event: React.MouseEvent) => AnalyticsPayload | undefined;
|
|
11
13
|
type DeepPartial<T> = T extends object ? {
|
|
12
14
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
@@ -21,4 +21,9 @@ 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;
|
|
24
29
|
};
|
|
@@ -7,6 +7,8 @@ import { type ClickOutcome, type ClickType, type UiLinkClickedEventProps } from
|
|
|
7
7
|
export declare const buttonMap: Map<number | undefined, "left" | "right" | "none" | "middle">;
|
|
8
8
|
export declare const getKeys: (e: React.MouseEvent) => ("shift" | "meta" | "alt" | "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;
|
|
10
12
|
export declare const createLinkClickedPayload: (event: React.MouseEvent) => AnalyticsPayload | undefined;
|
|
11
13
|
type DeepPartial<T> = T extends object ? {
|
|
12
14
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
@@ -21,4 +21,9 @@ 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;
|
|
24
29
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "43.12.
|
|
3
|
+
"version": "43.12.2",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@atlaskit/textarea": "^8.1.0",
|
|
72
72
|
"@atlaskit/textfield": "^8.1.0",
|
|
73
73
|
"@atlaskit/theme": "^21.0.0",
|
|
74
|
-
"@atlaskit/tmp-editor-statsig": "^14.
|
|
74
|
+
"@atlaskit/tmp-editor-statsig": "^14.3.0",
|
|
75
75
|
"@atlaskit/tokens": "^8.4.0",
|
|
76
76
|
"@atlaskit/tooltip": "^20.10.0",
|
|
77
77
|
"@atlaskit/ufo": "^0.4.0",
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"@atlassian/analytics-tooling": "workspace:^",
|
|
107
107
|
"@atlassian/feature-flags-test-utils": "^1.0.0",
|
|
108
108
|
"@atlassian/gemini": "^1.23.0",
|
|
109
|
+
"@atlassian/testing-library": "^0.4.0",
|
|
109
110
|
"@testing-library/dom": "^10.1.0",
|
|
110
111
|
"@testing-library/jest-dom": "^6.4.5",
|
|
111
112
|
"@testing-library/react": "^13.4.0",
|
|
@@ -250,6 +251,9 @@
|
|
|
250
251
|
},
|
|
251
252
|
"smart-link-custom-hover-card-content": {
|
|
252
253
|
"type": "boolean"
|
|
254
|
+
},
|
|
255
|
+
"navx-2825-eslint-translation-fix-linking-platform": {
|
|
256
|
+
"type": "boolean"
|
|
253
257
|
}
|
|
254
258
|
},
|
|
255
259
|
"compassUnitTestMetricSourceId": "ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:metric-source/c5751cc6-3513-4070-9deb-af31e86aed34/f74ef1bc-7240-4aac-9dc8-9dc43b502089"
|