@atlaskit/smart-card 30.2.5 → 30.2.7
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 +14 -0
- package/analytics.spec.yaml +81 -0
- package/dist/cjs/state/actions/index.js +15 -5
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +6 -0
- package/dist/cjs/utils/analytics/analytics.js +33 -1
- package/dist/cjs/utils/analytics/click.js +16 -2
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +12 -4
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/index.js +12 -4
- package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +34 -11
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +44 -12
- package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +12 -4
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +75 -9
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/state/actions/index.js +16 -5
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +6 -0
- package/dist/es2019/utils/analytics/analytics.js +33 -1
- package/dist/es2019/utils/analytics/click.js +19 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +13 -4
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/index.js +13 -4
- package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +35 -11
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +45 -12
- package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +13 -4
- package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +69 -3
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/state/actions/index.js +15 -5
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +6 -0
- package/dist/esm/utils/analytics/analytics.js +33 -1
- package/dist/esm/utils/analytics/click.js +16 -2
- package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +12 -4
- package/dist/esm/view/EmbedCard/views/unauthorized-view/index.js +12 -4
- package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +34 -11
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +44 -12
- package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +12 -4
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +75 -9
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/common/analytics/generated/analytics.types.d.ts +39 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +6 -0
- package/dist/types/utils/analytics/analytics.d.ts +24 -0
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +1 -6
- package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +39 -1
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +6 -0
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +24 -0
- package/dist/types-ts4.5/view/Card/index.d.ts +1 -1
- package/dist/types-ts4.5/view/InlineCard/UnauthorisedView/index.d.ts +1 -6
- package/package.json +5 -2
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.InlineCardUnauthorizedView = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
10
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
@@ -13,11 +12,14 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
13
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
var _reactIntlNext = require("react-intl-next");
|
|
18
18
|
var _button = _interopRequireDefault(require("@atlaskit/button"));
|
|
19
19
|
var _lockFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/lock-filled"));
|
|
20
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
21
|
var _colors = require("@atlaskit/theme/colors");
|
|
22
|
+
var _useAnalyticsEvents2 = require("../../../common/analytics/generated/use-analytics-events");
|
|
21
23
|
var _messages = require("../../../messages");
|
|
22
24
|
var _HoverCard = require("../../HoverCard");
|
|
23
25
|
var _Frame = require("../Frame");
|
|
@@ -32,12 +34,69 @@ var FallbackUnauthorizedIcon = /*#__PURE__*/_react.default.createElement(_Icon.A
|
|
|
32
34
|
size: "small",
|
|
33
35
|
primaryColor: "var(--ds-icon-danger, ".concat(_colors.R400, ")")
|
|
34
36
|
}));
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
var InlineCardUnauthorizedViewNew = function InlineCardUnauthorizedViewNew(_ref) {
|
|
38
|
+
var url = _ref.url,
|
|
39
|
+
id = _ref.id,
|
|
40
|
+
icon = _ref.icon,
|
|
41
|
+
onAuthorise = _ref.onAuthorise,
|
|
42
|
+
onClick = _ref.onClick,
|
|
43
|
+
isSelected = _ref.isSelected,
|
|
44
|
+
_ref$testId = _ref.testId,
|
|
45
|
+
testId = _ref$testId === void 0 ? 'inline-card-unauthorized-view' : _ref$testId,
|
|
46
|
+
_ref$showAuthTooltip = _ref.showAuthTooltip,
|
|
47
|
+
showAuthTooltip = _ref$showAuthTooltip === void 0 ? false : _ref$showAuthTooltip,
|
|
48
|
+
truncateInline = _ref.truncateInline,
|
|
49
|
+
context = _ref.context;
|
|
50
|
+
var frameRef = _react.default.useRef(null);
|
|
51
|
+
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
52
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
53
|
+
var handleConnectAccount = _react.default.useCallback(function (event) {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
event.stopPropagation();
|
|
56
|
+
if (onAuthorise) {
|
|
57
|
+
fireEvent('track.applicationAccount.authStarted', {});
|
|
58
|
+
onAuthorise();
|
|
59
|
+
}
|
|
60
|
+
}, [fireEvent, onAuthorise]);
|
|
61
|
+
var renderActionButton = _react.default.useCallback(function () {
|
|
62
|
+
var ActionButton = (0, _withFrameStyleControl.default)(_button.default, frameRef);
|
|
63
|
+
return onAuthorise ? /*#__PURE__*/_react.default.createElement(ActionButton, {
|
|
64
|
+
spacing: "none",
|
|
65
|
+
component: _styled.IconStyledButton,
|
|
66
|
+
onClick: handleConnectAccount,
|
|
67
|
+
testId: "button-connect-account"
|
|
68
|
+
}, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages.connect_link_account_card_name, {
|
|
69
|
+
values: {
|
|
70
|
+
context: context
|
|
71
|
+
}
|
|
72
|
+
}))) : undefined;
|
|
73
|
+
}, [handleConnectAccount, onAuthorise, context]);
|
|
74
|
+
var inlineCardUnauthenticatedView = /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
|
|
75
|
+
testId: testId,
|
|
76
|
+
isSelected: isSelected,
|
|
77
|
+
ref: frameRef,
|
|
78
|
+
truncateInline: truncateInline
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement(_IconAndTitleLayout.IconAndTitleLayout, {
|
|
80
|
+
icon: icon ? icon : FallbackUnauthorizedIcon,
|
|
81
|
+
title: url,
|
|
82
|
+
link: url,
|
|
83
|
+
onClick: onClick,
|
|
84
|
+
titleColor: "var(--ds-text-subtle, ".concat(_colors.N500, ")")
|
|
85
|
+
}), renderActionButton());
|
|
86
|
+
if (onAuthorise && showAuthTooltip) {
|
|
87
|
+
return /*#__PURE__*/_react.default.createElement(_HoverCard.HoverCard, {
|
|
88
|
+
url: url,
|
|
89
|
+
id: id
|
|
90
|
+
}, inlineCardUnauthenticatedView);
|
|
91
|
+
}
|
|
92
|
+
return inlineCardUnauthenticatedView;
|
|
93
|
+
};
|
|
94
|
+
var InlineCardUnauthorizedViewOld = /*#__PURE__*/function (_React$Component) {
|
|
95
|
+
(0, _inherits2.default)(InlineCardUnauthorizedViewOld, _React$Component);
|
|
96
|
+
var _super = _createSuper(InlineCardUnauthorizedViewOld);
|
|
97
|
+
function InlineCardUnauthorizedViewOld() {
|
|
39
98
|
var _this;
|
|
40
|
-
(0, _classCallCheck2.default)(this,
|
|
99
|
+
(0, _classCallCheck2.default)(this, InlineCardUnauthorizedViewOld);
|
|
41
100
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
42
101
|
args[_key] = arguments[_key];
|
|
43
102
|
}
|
|
@@ -75,7 +134,7 @@ var InlineCardUnauthorizedView = exports.InlineCardUnauthorizedView = /*#__PURE_
|
|
|
75
134
|
});
|
|
76
135
|
return _this;
|
|
77
136
|
}
|
|
78
|
-
(0, _createClass2.default)(
|
|
137
|
+
(0, _createClass2.default)(InlineCardUnauthorizedViewOld, [{
|
|
79
138
|
key: "render",
|
|
80
139
|
value: function render() {
|
|
81
140
|
var _this$props3 = this.props,
|
|
@@ -110,5 +169,12 @@ var InlineCardUnauthorizedView = exports.InlineCardUnauthorizedView = /*#__PURE_
|
|
|
110
169
|
return inlineCardUnauthenticatedView;
|
|
111
170
|
}
|
|
112
171
|
}]);
|
|
113
|
-
return
|
|
114
|
-
}(_react.default.Component);
|
|
172
|
+
return InlineCardUnauthorizedViewOld;
|
|
173
|
+
}(_react.default.Component);
|
|
174
|
+
var InlineCardUnauthorizedView = exports.InlineCardUnauthorizedView = function InlineCardUnauthorizedView(props) {
|
|
175
|
+
if ((0, _platformFeatureFlags.fg)('smart-card-migrate-track-analytics')) {
|
|
176
|
+
return /*#__PURE__*/_react.default.createElement(InlineCardUnauthorizedViewNew, props);
|
|
177
|
+
} else {
|
|
178
|
+
return /*#__PURE__*/_react.default.createElement(InlineCardUnauthorizedViewOld, props);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
17
17
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
18
18
|
var PACKAGE_DATA = {
|
|
19
19
|
packageName: "@atlaskit/smart-card",
|
|
20
|
-
packageVersion: "30.2.
|
|
20
|
+
packageVersion: "30.2.7",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -2,6 +2,8 @@ import { useCallback, useMemo } from 'react';
|
|
|
2
2
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
3
3
|
import { ACTION_RESOLVING, ACTION_UPDATE_METADATA_STATUS, cardAction } from '@atlaskit/linking-common';
|
|
4
4
|
import { auth } from '@atlaskit/outbound-auth-flow-client';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
5
7
|
import { SmartLinkStatus } from '../../constants';
|
|
6
8
|
import { getByDefinitionId, getDefinitionId, getExtensionKey, getServices } from '../helpers';
|
|
7
9
|
import useInvokeClientAction from '../hooks/use-invoke-client-action';
|
|
@@ -11,6 +13,9 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
11
13
|
const invokeClientAction = useInvokeClientAction({
|
|
12
14
|
analytics
|
|
13
15
|
});
|
|
16
|
+
const {
|
|
17
|
+
fireEvent
|
|
18
|
+
} = useAnalyticsEvents();
|
|
14
19
|
const {
|
|
15
20
|
store
|
|
16
21
|
} = useSmartLinkContext();
|
|
@@ -101,10 +106,16 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
101
106
|
extensionKey
|
|
102
107
|
});
|
|
103
108
|
auth(services[0].url).then(() => {
|
|
104
|
-
analytics
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
110
|
+
fireEvent('track.applicationAccount.connected', {
|
|
111
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
|
|
112
|
+
});
|
|
113
|
+
} else {
|
|
114
|
+
analytics.track.appAccountConnected({
|
|
115
|
+
definitionId,
|
|
116
|
+
extensionKey
|
|
117
|
+
});
|
|
118
|
+
}
|
|
108
119
|
analytics.operational.connectSucceededEvent({
|
|
109
120
|
id,
|
|
110
121
|
definitionId,
|
|
@@ -128,7 +139,7 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
128
139
|
reload();
|
|
129
140
|
});
|
|
130
141
|
}
|
|
131
|
-
}, [getSmartLinkState, analytics.ui, analytics.screen, analytics.track, analytics.operational, id, reload]);
|
|
142
|
+
}, [getSmartLinkState, analytics.ui, analytics.screen, analytics.track, analytics.operational, id, reload, fireEvent]);
|
|
132
143
|
const invoke = useCallback(async (opts, appearance) => {
|
|
133
144
|
const {
|
|
134
145
|
key,
|
|
@@ -695,6 +695,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
695
695
|
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
696
696
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
697
697
|
* @returns
|
|
698
|
+
* @deprecated
|
|
698
699
|
*/
|
|
699
700
|
appAccountConnected: ({
|
|
700
701
|
extensionKey,
|
|
@@ -717,6 +718,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
717
718
|
* @param location a location where the Smart Link auth action was initiated.
|
|
718
719
|
* @param extensionKey The extensionKey of the Smart Link resolver invoked.
|
|
719
720
|
* @returns
|
|
721
|
+
* @deprecated
|
|
720
722
|
*/
|
|
721
723
|
appAccountAuthStarted: ({
|
|
722
724
|
extensionKey,
|
|
@@ -728,6 +730,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
728
730
|
}), commonAttributes)),
|
|
729
731
|
/**
|
|
730
732
|
* This fires a tracking event before an action invoke api call is made
|
|
733
|
+
* @deprecated
|
|
731
734
|
*/
|
|
732
735
|
smartLinkQuickActionStarted: props => dispatchAnalytics(applyCommonAttributes(trackSmartLinkQuickActionStarted({
|
|
733
736
|
...commonAttributes,
|
|
@@ -735,6 +738,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
735
738
|
}), commonAttributes)),
|
|
736
739
|
/**
|
|
737
740
|
* This fires a tracking event after an action invoke api call is successful
|
|
741
|
+
* @deprecated
|
|
738
742
|
*/
|
|
739
743
|
smartLinkQuickActionSuccess: props => dispatchAnalytics(applyCommonAttributes(trackSmartLinkQuickActionSuccess({
|
|
740
744
|
...commonAttributes,
|
|
@@ -742,6 +746,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
742
746
|
}), commonAttributes)),
|
|
743
747
|
/**
|
|
744
748
|
* This fires a tracking event after an action invoke api call has failed
|
|
749
|
+
* @deprecated
|
|
745
750
|
*/
|
|
746
751
|
smartLinkQuickActionFailed: props => dispatchAnalytics(applyCommonAttributes(trackSmartLinkQuickActionFailed({
|
|
747
752
|
...commonAttributes,
|
|
@@ -749,6 +754,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
|
|
|
749
754
|
}), commonAttributes)),
|
|
750
755
|
/**
|
|
751
756
|
* Fires a track event when we call loadMetadata() to get information for a hover card
|
|
757
|
+
* @deprecated
|
|
752
758
|
*/
|
|
753
759
|
hoverCardResolutionStarted: () => dispatchAnalytics(applyCommonAttributes(trackHoverCardResolutionStarted({
|
|
754
760
|
display: 'hoverCardPreview',
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "30.2.
|
|
7
|
+
packageVersion: "30.2.7"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -204,6 +204,10 @@ export const connectFailedEvent = ({
|
|
|
204
204
|
location
|
|
205
205
|
}
|
|
206
206
|
});
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @deprecated
|
|
210
|
+
*/
|
|
207
211
|
export const trackAppAccountConnected = ({
|
|
208
212
|
definitionId,
|
|
209
213
|
extensionKey,
|
|
@@ -223,6 +227,10 @@ export const trackAppAccountConnected = ({
|
|
|
223
227
|
location
|
|
224
228
|
}
|
|
225
229
|
});
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @deprecated
|
|
233
|
+
*/
|
|
226
234
|
export const trackAppAccountAuthStarted = ({
|
|
227
235
|
extensionKey,
|
|
228
236
|
location
|
|
@@ -236,6 +244,10 @@ export const trackAppAccountAuthStarted = ({
|
|
|
236
244
|
location
|
|
237
245
|
}
|
|
238
246
|
});
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @deprecated
|
|
250
|
+
*/
|
|
239
251
|
export const trackSmartLinkQuickActionStarted = ({
|
|
240
252
|
smartLinkActionType,
|
|
241
253
|
...attributes
|
|
@@ -252,6 +264,10 @@ export const trackSmartLinkQuickActionStarted = ({
|
|
|
252
264
|
}
|
|
253
265
|
};
|
|
254
266
|
};
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @deprecated
|
|
270
|
+
*/
|
|
255
271
|
export const trackSmartLinkQuickActionSuccess = ({
|
|
256
272
|
smartLinkActionType,
|
|
257
273
|
...attributes
|
|
@@ -268,6 +284,10 @@ export const trackSmartLinkQuickActionSuccess = ({
|
|
|
268
284
|
}
|
|
269
285
|
};
|
|
270
286
|
};
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @deprecated
|
|
290
|
+
*/
|
|
271
291
|
export const trackSmartLinkQuickActionFailed = ({
|
|
272
292
|
smartLinkActionType,
|
|
273
293
|
...attributes
|
|
@@ -284,6 +304,10 @@ export const trackSmartLinkQuickActionFailed = ({
|
|
|
284
304
|
}
|
|
285
305
|
};
|
|
286
306
|
};
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* @deprecated
|
|
310
|
+
*/
|
|
287
311
|
export const trackHoverCardResolutionStarted = ({
|
|
288
312
|
display,
|
|
289
313
|
...attributes
|
|
@@ -370,6 +394,10 @@ export const uiCardClickedEvent = ({
|
|
|
370
394
|
destinationSubproduct
|
|
371
395
|
}
|
|
372
396
|
});
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* @deprecated
|
|
400
|
+
*/
|
|
373
401
|
export const uiIframeDwelledEvent = ({
|
|
374
402
|
id,
|
|
375
403
|
display,
|
|
@@ -399,6 +427,10 @@ export const uiIframeDwelledEvent = ({
|
|
|
399
427
|
dwellPercentVisible
|
|
400
428
|
}
|
|
401
429
|
});
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* @deprecated
|
|
433
|
+
*/
|
|
402
434
|
export const uiIframeFocusedEvent = ({
|
|
403
435
|
id,
|
|
404
436
|
display,
|
|
@@ -92,12 +92,26 @@ export const createLinkClickedPayload = event => {
|
|
|
92
92
|
const clickOutcome = getLinkClickOutcome(event, clickType);
|
|
93
93
|
const keysHeld = getKeys(event);
|
|
94
94
|
const defaultPrevented = event.defaultPrevented;
|
|
95
|
-
|
|
95
|
+
const linkClickedEventResult = linkClickedEvent({
|
|
96
96
|
clickType,
|
|
97
97
|
clickOutcome,
|
|
98
98
|
keysHeld,
|
|
99
99
|
defaultPrevented
|
|
100
100
|
});
|
|
101
|
+
|
|
102
|
+
// if the current target is an anchor tag, we can get the href from it and use that as the url being navigated too.
|
|
103
|
+
if (event.currentTarget instanceof HTMLAnchorElement) {
|
|
104
|
+
const url = event.currentTarget.href;
|
|
105
|
+
return {
|
|
106
|
+
...linkClickedEventResult,
|
|
107
|
+
nonPrivacySafeAttributes: {
|
|
108
|
+
url
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
} else {
|
|
112
|
+
// We can't get the href from the event target, so dont include the url or any non privacy safe attributes
|
|
113
|
+
return linkClickedEventResult;
|
|
114
|
+
}
|
|
101
115
|
};
|
|
102
116
|
export const fireLinkClickedEvent = createAnalyticsEvent => (event, overrides = {}) => {
|
|
103
117
|
const payload = createLinkClickedPayload(event);
|
|
@@ -108,6 +122,10 @@ export const fireLinkClickedEvent = createAnalyticsEvent => (event, overrides =
|
|
|
108
122
|
attributes: {
|
|
109
123
|
...payload.attributes,
|
|
110
124
|
...(overrides === null || overrides === void 0 ? void 0 : overrides.attributes)
|
|
125
|
+
},
|
|
126
|
+
nonPrivacySafeAttributes: {
|
|
127
|
+
...payload.nonPrivacySafeAttributes,
|
|
128
|
+
...(overrides === null || overrides === void 0 ? void 0 : overrides.nonPrivacySafeAttributes)
|
|
111
129
|
}
|
|
112
130
|
}).fire(ANALYTICS_CHANNEL);
|
|
113
131
|
}
|
|
@@ -9,6 +9,8 @@ import { useCallback, useMemo } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { FormattedMessage } from 'react-intl-next';
|
|
11
11
|
import { extractProvider } from '@atlaskit/link-extractors';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { useAnalyticsEvents } from '../../../../common/analytics/generated/use-analytics-events';
|
|
12
14
|
import { messages } from '../../../../messages';
|
|
13
15
|
import { getExtensionKey, hasAuthScopeOverrides } from '../../../../state/helpers';
|
|
14
16
|
import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
|
|
@@ -42,14 +44,21 @@ const FlexibleUnauthorisedView = ({
|
|
|
42
44
|
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
43
45
|
const providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
44
46
|
const isProductIntegrationSupported = hasAuthScopeOverrides(cardState === null || cardState === void 0 ? void 0 : cardState.details);
|
|
47
|
+
const {
|
|
48
|
+
fireEvent
|
|
49
|
+
} = useAnalyticsEvents();
|
|
45
50
|
const handleAuthorize = useCallback(() => {
|
|
46
51
|
if (onAuthorize) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
52
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
53
|
+
fireEvent('track.applicationAccount.authStarted', {});
|
|
54
|
+
} else {
|
|
55
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.appAccountAuthStarted({
|
|
56
|
+
extensionKey
|
|
57
|
+
});
|
|
58
|
+
}
|
|
50
59
|
onAuthorize();
|
|
51
60
|
}
|
|
52
|
-
}, [onAuthorize, extensionKey, analytics === null || analytics === void 0 ? void 0 : analytics.track]);
|
|
61
|
+
}, [onAuthorize, extensionKey, analytics === null || analytics === void 0 ? void 0 : analytics.track, fireEvent]);
|
|
53
62
|
const content = useMemo(() => onAuthorize ? jsx(UnauthorisedViewContent, {
|
|
54
63
|
providerName: providerName,
|
|
55
64
|
isProductIntegrationSupported: isProductIntegrationSupported,
|
|
@@ -2,6 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback, useMemo } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import Button from '@atlaskit/button';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { useAnalyticsEvents } from '../../../../common/analytics/generated/use-analytics-events';
|
|
5
7
|
import { messages } from '../../../../messages';
|
|
6
8
|
import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
|
|
7
9
|
import UnresolvedView from '../unresolved-view';
|
|
@@ -16,14 +18,21 @@ const UnauthorizedView = ({
|
|
|
16
18
|
...unresolvedViewProps
|
|
17
19
|
}) => {
|
|
18
20
|
var _context$image;
|
|
21
|
+
const {
|
|
22
|
+
fireEvent
|
|
23
|
+
} = useAnalyticsEvents();
|
|
19
24
|
const handleOnAuthorizeClick = useCallback(() => {
|
|
20
25
|
if (onAuthorize) {
|
|
21
|
-
analytics
|
|
22
|
-
|
|
23
|
-
}
|
|
26
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
27
|
+
fireEvent('track.applicationAccount.authStarted', {});
|
|
28
|
+
} else {
|
|
29
|
+
analytics.track.appAccountAuthStarted({
|
|
30
|
+
extensionKey
|
|
31
|
+
});
|
|
32
|
+
}
|
|
24
33
|
onAuthorize();
|
|
25
34
|
}
|
|
26
|
-
}, [onAuthorize, analytics.track, extensionKey]);
|
|
35
|
+
}, [onAuthorize, analytics.track, extensionKey, fireEvent]);
|
|
27
36
|
const content = useMemo(() => {
|
|
28
37
|
if (onAuthorize) {
|
|
29
38
|
var _context$text;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { useAnalyticsEvents } from '../../../../../../common/analytics/generated/use-analytics-events';
|
|
3
5
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
4
6
|
import useInvoke from '../../../../../../state/hooks/use-invoke';
|
|
5
7
|
import { getInvokeFailureReason } from '../../../../../../state/hooks/use-invoke/utils';
|
|
@@ -16,6 +18,9 @@ const ServerAction = ({
|
|
|
16
18
|
const analytics = useFlexibleUiAnalyticsContext();
|
|
17
19
|
const invoke = useInvoke();
|
|
18
20
|
const reload = useResolve();
|
|
21
|
+
const {
|
|
22
|
+
fireEvent
|
|
23
|
+
} = useAnalyticsEvents();
|
|
19
24
|
const handleClick = useCallback(async () => {
|
|
20
25
|
if (action) {
|
|
21
26
|
var _action$action;
|
|
@@ -25,14 +30,26 @@ const ServerAction = ({
|
|
|
25
30
|
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkServerActionClickedEvent({
|
|
26
31
|
smartLinkActionType
|
|
27
32
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
34
|
+
fireEvent('track.smartLinkQuickAction.started', {
|
|
35
|
+
smartLinkActionType
|
|
36
|
+
});
|
|
37
|
+
} else {
|
|
38
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionStarted({
|
|
39
|
+
smartLinkActionType
|
|
40
|
+
});
|
|
41
|
+
}
|
|
31
42
|
const request = createInvokeRequest(action);
|
|
32
43
|
await invoke(request);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
44
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
45
|
+
fireEvent('track.smartLinkQuickAction.success', {
|
|
46
|
+
smartLinkActionType
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionSuccess({
|
|
50
|
+
smartLinkActionType
|
|
51
|
+
});
|
|
52
|
+
}
|
|
36
53
|
if (action.reload && action.reload.url) {
|
|
37
54
|
await reload(action.reload.url, true, undefined, action.reload.id);
|
|
38
55
|
}
|
|
@@ -42,14 +59,21 @@ const ServerAction = ({
|
|
|
42
59
|
}
|
|
43
60
|
} catch (err) {
|
|
44
61
|
setIsLoading(false);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
62
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
63
|
+
fireEvent('track.smartLinkQuickAction.failed', {
|
|
64
|
+
smartLinkActionType,
|
|
65
|
+
reason: getInvokeFailureReason(err)
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed({
|
|
69
|
+
smartLinkActionType,
|
|
70
|
+
reason: getInvokeFailureReason(err)
|
|
71
|
+
});
|
|
72
|
+
}
|
|
49
73
|
onErrorCallback === null || onErrorCallback === void 0 ? void 0 : onErrorCallback();
|
|
50
74
|
}
|
|
51
75
|
}
|
|
52
|
-
}, [action, analytics === null || analytics === void 0 ? void 0 : analytics.track, analytics === null || analytics === void 0 ? void 0 : analytics.ui, invoke, onClick, onErrorCallback, reload]);
|
|
76
|
+
}, [action, analytics === null || analytics === void 0 ? void 0 : analytics.track, analytics === null || analytics === void 0 ? void 0 : analytics.ui, invoke, onClick, onErrorCallback, reload, fireEvent]);
|
|
53
77
|
return /*#__PURE__*/React.createElement(Action, _extends({}, props, {
|
|
54
78
|
isLoading: isLoading,
|
|
55
79
|
onClick: handleClick
|
|
@@ -8,6 +8,8 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
10
|
import DropdownMenu from '@atlaskit/dropdown-menu';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
import { useAnalyticsEvents } from '../../../../../../common/analytics/generated/use-analytics-events';
|
|
11
13
|
import extractLozengeActionItems from '../../../../../../extractors/action/extract-lozenge-action-items';
|
|
12
14
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
13
15
|
import useInvoke from '../../../../../../state/hooks/use-invoke';
|
|
@@ -45,6 +47,9 @@ const LozengeAction = ({
|
|
|
45
47
|
//TODO EDM-6583 Replace usage of useFlexibleUiAnalyticsContext with linking platform analytics context from find team.
|
|
46
48
|
const analytics = useFlexibleUiAnalyticsContext();
|
|
47
49
|
const invoke = useInvoke();
|
|
50
|
+
const {
|
|
51
|
+
fireEvent
|
|
52
|
+
} = useAnalyticsEvents();
|
|
48
53
|
useEffect(() => {
|
|
49
54
|
setSelected({
|
|
50
55
|
text,
|
|
@@ -60,9 +65,15 @@ const LozengeAction = ({
|
|
|
60
65
|
setIsOpen(args.isOpen);
|
|
61
66
|
if (args.isOpen) {
|
|
62
67
|
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkLozengeActionClickedEvent();
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
69
|
+
fireEvent('track.smartLinkQuickAction.started', {
|
|
70
|
+
smartLinkActionType: TrackQuickActionType.StatusUpdate
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionStarted({
|
|
74
|
+
smartLinkActionType: TrackQuickActionType.StatusUpdate
|
|
75
|
+
});
|
|
76
|
+
}
|
|
66
77
|
if (!isLoaded && action !== null && action !== void 0 && action.read) {
|
|
67
78
|
try {
|
|
68
79
|
setIsLoading(true);
|
|
@@ -71,14 +82,22 @@ const LozengeAction = ({
|
|
|
71
82
|
setItems(validItems);
|
|
72
83
|
setIsLoaded(true);
|
|
73
84
|
if ((validItems === null || validItems === void 0 ? void 0 : validItems.length) === 0) {
|
|
74
|
-
|
|
85
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
86
|
+
fireEvent('track.smartLinkQuickAction.failed', permissionLoadErrorAnalyticsPayload);
|
|
87
|
+
} else {
|
|
88
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(permissionLoadErrorAnalyticsPayload);
|
|
89
|
+
}
|
|
75
90
|
setErrorMessage(LozengeActionErrorMessages.noData);
|
|
76
91
|
setIsLoaded(false);
|
|
77
92
|
}
|
|
78
93
|
} catch (err) {
|
|
79
94
|
setErrorMessage(LozengeActionErrorMessages.unknown);
|
|
80
95
|
setIsLoaded(false);
|
|
81
|
-
|
|
96
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
97
|
+
fireEvent('track.smartLinkQuickAction.failed', unknownLoadErrorAnalyticsPayload);
|
|
98
|
+
} else {
|
|
99
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(unknownLoadErrorAnalyticsPayload);
|
|
100
|
+
}
|
|
82
101
|
} finally {
|
|
83
102
|
setIsLoading(false);
|
|
84
103
|
}
|
|
@@ -87,7 +106,7 @@ const LozengeAction = ({
|
|
|
87
106
|
if (!args.isOpen) {
|
|
88
107
|
setErrorMessage(undefined);
|
|
89
108
|
}
|
|
90
|
-
}, [action.read, analytics, invoke, isLoaded, text]);
|
|
109
|
+
}, [action.read, analytics, invoke, isLoaded, text, fireEvent]);
|
|
91
110
|
const trigger = useCallback(props => jsx(LozengeActionTrigger, _extends({}, props, {
|
|
92
111
|
appearance: selected.appearance,
|
|
93
112
|
isOpen: isOpen,
|
|
@@ -110,9 +129,15 @@ const LozengeAction = ({
|
|
|
110
129
|
setIsLoaded(false);
|
|
111
130
|
setIsOpen(false);
|
|
112
131
|
setItems([]);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
132
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
133
|
+
fireEvent('track.smartLinkQuickAction.success', {
|
|
134
|
+
smartLinkActionType: TrackQuickActionType.StatusUpdate
|
|
135
|
+
});
|
|
136
|
+
} else {
|
|
137
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionSuccess({
|
|
138
|
+
smartLinkActionType: TrackQuickActionType.StatusUpdate
|
|
139
|
+
});
|
|
140
|
+
}
|
|
116
141
|
if (url) {
|
|
117
142
|
await reload(url, true, undefined, linkId);
|
|
118
143
|
}
|
|
@@ -121,13 +146,21 @@ const LozengeAction = ({
|
|
|
121
146
|
setIsLoading(false);
|
|
122
147
|
if (isInvokeCustomError(err)) {
|
|
123
148
|
setErrorMessage(err.message);
|
|
124
|
-
|
|
149
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
150
|
+
fireEvent('track.smartLinkQuickAction.failed', validationUpdateErrorAnalyticsPayload);
|
|
151
|
+
} else {
|
|
152
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(validationUpdateErrorAnalyticsPayload);
|
|
153
|
+
}
|
|
125
154
|
} else {
|
|
126
155
|
setErrorMessage(LozengeActionErrorMessages.updateFailed);
|
|
127
|
-
|
|
156
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
157
|
+
fireEvent('track.smartLinkQuickAction.failed', unknownUpdateErrorAnalyticsPayload);
|
|
158
|
+
} else {
|
|
159
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(unknownUpdateErrorAnalyticsPayload);
|
|
160
|
+
}
|
|
128
161
|
}
|
|
129
162
|
}
|
|
130
|
-
}, [action === null || action === void 0 ? void 0 : action.update, analytics, invoke, linkId, reload, url]);
|
|
163
|
+
}, [action === null || action === void 0 ? void 0 : action.update, analytics, invoke, linkId, reload, url, fireEvent]);
|
|
131
164
|
const dropdownItemGroup = useMemo(() => {
|
|
132
165
|
if (errorMessage) {
|
|
133
166
|
return jsx(LozengeActionError, {
|
|
@@ -2,6 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback, useMemo } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import { extractProvider } from '@atlaskit/link-extractors';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
5
7
|
import { ActionName, CardDisplay } from '../../../../../constants';
|
|
6
8
|
import { messages } from '../../../../../messages';
|
|
7
9
|
import { useSmartCardActions } from '../../../../../state/actions';
|
|
@@ -30,14 +32,21 @@ const HoverCardUnauthorisedView = ({
|
|
|
30
32
|
const {
|
|
31
33
|
authorize
|
|
32
34
|
} = useSmartCardActions(id, url, analytics);
|
|
35
|
+
const {
|
|
36
|
+
fireEvent
|
|
37
|
+
} = useAnalyticsEvents();
|
|
33
38
|
const handleAuthorize = useCallback(() => {
|
|
34
39
|
if (authorize) {
|
|
35
|
-
analytics
|
|
36
|
-
|
|
37
|
-
}
|
|
40
|
+
if (fg('smart-card-migrate-track-analytics')) {
|
|
41
|
+
fireEvent('track.applicationAccount.authStarted', {});
|
|
42
|
+
} else {
|
|
43
|
+
analytics.track.appAccountAuthStarted({
|
|
44
|
+
extensionKey
|
|
45
|
+
});
|
|
46
|
+
}
|
|
38
47
|
authorize(CardDisplay.HoverCardPreview);
|
|
39
48
|
}
|
|
40
|
-
}, [authorize, extensionKey, analytics.track]);
|
|
49
|
+
}, [authorize, extensionKey, analytics.track, fireEvent]);
|
|
41
50
|
const actions = useMemo(() => [{
|
|
42
51
|
name: ActionName.CustomAction,
|
|
43
52
|
content: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_action, {
|