@atlaskit/smart-card 26.25.0 → 26.26.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 +6 -0
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +3 -0
- package/dist/cjs/state/hooks/use-invoke/utils.js +23 -0
- package/dist/cjs/utils/analytics/analytics.js +28 -7
- package/dist/cjs/utils/mocks.js +7 -2
- package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +32 -15
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +2 -4
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +3 -2
- package/dist/es2019/state/hooks/use-invoke/utils.js +13 -0
- package/dist/es2019/utils/analytics/analytics.js +65 -32
- package/dist/es2019/utils/mocks.js +7 -2
- package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +19 -1
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +1 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +4 -1
- package/dist/esm/state/hooks/use-invoke/utils.js +15 -0
- package/dist/esm/utils/analytics/analytics.js +23 -5
- package/dist/esm/utils/mocks.js +7 -2
- package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +32 -15
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +1 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
- package/dist/types/state/hooks/use-invoke/utils.d.ts +4 -0
- package/dist/types/state/hooks/useSmartLink.d.ts +1 -0
- package/dist/types/utils/analytics/analytics.d.ts +4 -1
- package/dist/types/utils/analytics/types.d.ts +4 -0
- package/dist/types/utils/mocks.d.ts +1 -0
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
- package/dist/types-ts4.5/state/hooks/use-invoke/utils.d.ts +4 -0
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +1 -0
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +4 -1
- package/dist/types-ts4.5/utils/analytics/types.d.ts +4 -0
- package/dist/types-ts4.5/utils/mocks.d.ts +1 -0
- package/package.json +2 -2
- package/report.api.md +8 -0
- package/tmp/api-report-tmp.d.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -513,6 +513,9 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
513
513
|
*/
|
|
514
514
|
smartLinkLozengeActionErrorOpenPreviewClickedEvent: function smartLinkLozengeActionErrorOpenPreviewClickedEvent() {
|
|
515
515
|
return dispatchAnalytics(applyCommonAttributes((0, _analytics.uiSmartLinkStatusOpenPreviewButtonClicked)(), commonAttributes));
|
|
516
|
+
},
|
|
517
|
+
smartLinkServerActionClickedEvent: function smartLinkServerActionClickedEvent(props) {
|
|
518
|
+
return dispatchAnalytics(applyCommonAttributes((0, _analytics2.uiServerActionClicked)(props), commonAttributes));
|
|
516
519
|
}
|
|
517
520
|
};
|
|
518
521
|
}, [dispatchAnalytics, commonAttributes, defaultId, extractedExtensionKey]);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isInvokeCustomError = exports.getInvokeFailureReason = void 0;
|
|
7
|
+
var _analytics = require("../../../utils/analytics/analytics");
|
|
8
|
+
var getInvokeFailureReason = function getInvokeFailureReason(err) {
|
|
9
|
+
if (!isInvokeCustomError(err)) {
|
|
10
|
+
return _analytics.TrackQuickActionFailureReason.UnknownError;
|
|
11
|
+
}
|
|
12
|
+
switch (err === null || err === void 0 ? void 0 : err.errorCode) {
|
|
13
|
+
case 403:
|
|
14
|
+
return _analytics.TrackQuickActionFailureReason.PermissionError;
|
|
15
|
+
default:
|
|
16
|
+
return _analytics.TrackQuickActionFailureReason.UnknownError;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.getInvokeFailureReason = getInvokeFailureReason;
|
|
20
|
+
var isInvokeCustomError = function isInvokeCustomError(err) {
|
|
21
|
+
return (err === null || err === void 0 ? void 0 : err.message) !== undefined && (err === null || err === void 0 ? void 0 : err.errorCode) !== undefined;
|
|
22
|
+
};
|
|
23
|
+
exports.isInvokeCustomError = isInvokeCustomError;
|
|
@@ -4,16 +4,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.unresolvedEvent = exports.uiSmartLinkStatusOpenPreviewButtonClicked = exports.uiSmartLinkStatusLozengeButtonClicked = exports.uiSmartLinkStatusListItemButtonClicked = exports.uiRenderSuccessEvent = exports.uiRenderFailedEvent = exports.uiLearnMoreLinkClickedEvent = exports.uiIframeFocusedEvent = exports.uiIframeDwelledEvent = exports.uiHoverCardViewedEvent = exports.uiHoverCardOpenLinkClickedEvent = exports.uiHoverCardDismissedEvent = exports.uiClosedAuthEvent = exports.uiCardClickedEvent = exports.uiAuthEvent = exports.uiAuthAlternateAccountEvent = exports.uiActionClickedEvent = exports.trackSmartLinkQuickActionSuccess = exports.trackSmartLinkQuickActionStarted = exports.trackSmartLinkQuickActionFailed = exports.trackHoverCardResolutionStarted = exports.trackAppAccountConnected = exports.trackAppAccountAuthStarted = exports.screenAuthPopupEvent = exports.resolvedEvent = exports.invokeSucceededEvent = exports.invokeFailedEvent = exports.fireSmartLinkEvent = exports.context = exports.connectSucceededEvent = exports.connectFailedEvent = exports.chunkloadFailedEvent = exports.TrackQuickActionType = exports.TrackQuickActionFailureReason = exports.SmartLinkEvents = exports.ANALYTICS_CHANNEL = void 0;
|
|
7
|
+
exports.unresolvedEvent = exports.uiSmartLinkStatusOpenPreviewButtonClicked = exports.uiSmartLinkStatusLozengeButtonClicked = exports.uiSmartLinkStatusListItemButtonClicked = exports.uiServerActionClicked = exports.uiRenderSuccessEvent = exports.uiRenderFailedEvent = exports.uiLearnMoreLinkClickedEvent = exports.uiIframeFocusedEvent = exports.uiIframeDwelledEvent = exports.uiHoverCardViewedEvent = exports.uiHoverCardOpenLinkClickedEvent = exports.uiHoverCardDismissedEvent = exports.uiClosedAuthEvent = exports.uiCardClickedEvent = exports.uiAuthEvent = exports.uiAuthAlternateAccountEvent = exports.uiActionClickedEvent = exports.trackSmartLinkQuickActionSuccess = exports.trackSmartLinkQuickActionStarted = exports.trackSmartLinkQuickActionFailed = exports.trackHoverCardResolutionStarted = exports.trackAppAccountConnected = exports.trackAppAccountAuthStarted = exports.screenAuthPopupEvent = exports.resolvedEvent = exports.invokeSucceededEvent = exports.invokeFailedEvent = exports.fireSmartLinkEvent = exports.context = exports.connectSucceededEvent = exports.connectFailedEvent = exports.chunkloadFailedEvent = exports.TrackQuickActionType = exports.TrackQuickActionFailureReason = exports.SmartLinkEvents = exports.SmartLinkActionTypeUiEventMapper = exports.SmartLinkActionTypeTrackingEventMapper = exports.ANALYTICS_CHANNEL = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _performance = require("../performance");
|
|
13
|
+
var _linkingTypes = require("@atlaskit/linking-types");
|
|
13
14
|
var _excluded = ["smartLinkActionType"],
|
|
14
15
|
_excluded2 = ["smartLinkActionType"],
|
|
15
16
|
_excluded3 = ["smartLinkActionType"],
|
|
16
17
|
_excluded4 = ["display"];
|
|
18
|
+
var _SmartLinkActionTypeT, _SmartLinkActionTypeU;
|
|
17
19
|
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; }
|
|
18
20
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
21
|
var ANALYTICS_CHANNEL = 'media';
|
|
@@ -21,7 +23,7 @@ exports.ANALYTICS_CHANNEL = ANALYTICS_CHANNEL;
|
|
|
21
23
|
var context = {
|
|
22
24
|
componentName: 'smart-cards',
|
|
23
25
|
packageName: "@atlaskit/smart-card",
|
|
24
|
-
packageVersion: "26.
|
|
26
|
+
packageVersion: "26.26.0"
|
|
25
27
|
};
|
|
26
28
|
exports.context = context;
|
|
27
29
|
var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
@@ -36,6 +38,10 @@ var TrackQuickActionFailureReason = /*#__PURE__*/function (TrackQuickActionFailu
|
|
|
36
38
|
return TrackQuickActionFailureReason;
|
|
37
39
|
}({});
|
|
38
40
|
exports.TrackQuickActionFailureReason = TrackQuickActionFailureReason;
|
|
41
|
+
var SmartLinkActionTypeTrackingEventMapper = (_SmartLinkActionTypeT = {}, (0, _defineProperty2.default)(_SmartLinkActionTypeT, _linkingTypes.SmartLinkActionType.FollowEntityAction, 'Follow'), (0, _defineProperty2.default)(_SmartLinkActionTypeT, _linkingTypes.SmartLinkActionType.StatusUpdateAction, 'StatusUpdate'), (0, _defineProperty2.default)(_SmartLinkActionTypeT, _linkingTypes.SmartLinkActionType.UnfollowEntityAction, 'Unfollow'), _SmartLinkActionTypeT);
|
|
42
|
+
exports.SmartLinkActionTypeTrackingEventMapper = SmartLinkActionTypeTrackingEventMapper;
|
|
43
|
+
var SmartLinkActionTypeUiEventMapper = (_SmartLinkActionTypeU = {}, (0, _defineProperty2.default)(_SmartLinkActionTypeU, _linkingTypes.SmartLinkActionType.FollowEntityAction, 'smartLinkFollowButton'), (0, _defineProperty2.default)(_SmartLinkActionTypeU, _linkingTypes.SmartLinkActionType.UnfollowEntityAction, 'smartLinkFollowButton'), _SmartLinkActionTypeU);
|
|
44
|
+
exports.SmartLinkActionTypeUiEventMapper = SmartLinkActionTypeUiEventMapper;
|
|
39
45
|
var uiActionSubjectIds = {
|
|
40
46
|
DownloadAction: 'downloadDocument',
|
|
41
47
|
PreviewAction: 'invokePreviewScreen',
|
|
@@ -255,6 +261,7 @@ var trackAppAccountAuthStarted = function trackAppAccountAuthStarted(_ref7) {
|
|
|
255
261
|
};
|
|
256
262
|
exports.trackAppAccountAuthStarted = trackAppAccountAuthStarted;
|
|
257
263
|
var trackSmartLinkQuickActionStarted = function trackSmartLinkQuickActionStarted(_ref8) {
|
|
264
|
+
var _SmartLinkActionTypeT2;
|
|
258
265
|
var smartLinkActionType = _ref8.smartLinkActionType,
|
|
259
266
|
attributes = (0, _objectWithoutProperties2.default)(_ref8, _excluded);
|
|
260
267
|
return {
|
|
@@ -262,12 +269,13 @@ var trackSmartLinkQuickActionStarted = function trackSmartLinkQuickActionStarted
|
|
|
262
269
|
actionSubject: 'smartLinkQuickAction',
|
|
263
270
|
eventType: 'track',
|
|
264
271
|
attributes: _objectSpread(_objectSpread(_objectSpread({}, context), attributes), {}, {
|
|
265
|
-
smartLinkActionType: smartLinkActionType
|
|
272
|
+
smartLinkActionType: (_SmartLinkActionTypeT2 = SmartLinkActionTypeTrackingEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeT2 !== void 0 ? _SmartLinkActionTypeT2 : smartLinkActionType
|
|
266
273
|
})
|
|
267
274
|
};
|
|
268
275
|
};
|
|
269
276
|
exports.trackSmartLinkQuickActionStarted = trackSmartLinkQuickActionStarted;
|
|
270
277
|
var trackSmartLinkQuickActionSuccess = function trackSmartLinkQuickActionSuccess(_ref9) {
|
|
278
|
+
var _SmartLinkActionTypeT3;
|
|
271
279
|
var smartLinkActionType = _ref9.smartLinkActionType,
|
|
272
280
|
attributes = (0, _objectWithoutProperties2.default)(_ref9, _excluded2);
|
|
273
281
|
return {
|
|
@@ -275,12 +283,13 @@ var trackSmartLinkQuickActionSuccess = function trackSmartLinkQuickActionSuccess
|
|
|
275
283
|
actionSubject: 'smartLinkQuickAction',
|
|
276
284
|
eventType: 'track',
|
|
277
285
|
attributes: _objectSpread(_objectSpread(_objectSpread({}, context), attributes), {}, {
|
|
278
|
-
smartLinkActionType: smartLinkActionType
|
|
286
|
+
smartLinkActionType: (_SmartLinkActionTypeT3 = SmartLinkActionTypeTrackingEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeT3 !== void 0 ? _SmartLinkActionTypeT3 : smartLinkActionType
|
|
279
287
|
})
|
|
280
288
|
};
|
|
281
289
|
};
|
|
282
290
|
exports.trackSmartLinkQuickActionSuccess = trackSmartLinkQuickActionSuccess;
|
|
283
291
|
var trackSmartLinkQuickActionFailed = function trackSmartLinkQuickActionFailed(_ref10) {
|
|
292
|
+
var _SmartLinkActionTypeT4;
|
|
284
293
|
var smartLinkActionType = _ref10.smartLinkActionType,
|
|
285
294
|
attributes = (0, _objectWithoutProperties2.default)(_ref10, _excluded3);
|
|
286
295
|
return {
|
|
@@ -288,7 +297,7 @@ var trackSmartLinkQuickActionFailed = function trackSmartLinkQuickActionFailed(_
|
|
|
288
297
|
actionSubject: 'smartLinkQuickAction',
|
|
289
298
|
eventType: 'track',
|
|
290
299
|
attributes: _objectSpread(_objectSpread(_objectSpread({}, context), attributes), {}, {
|
|
291
|
-
smartLinkActionType: smartLinkActionType
|
|
300
|
+
smartLinkActionType: (_SmartLinkActionTypeT4 = SmartLinkActionTypeTrackingEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeT4 !== void 0 ? _SmartLinkActionTypeT4 : smartLinkActionType
|
|
292
301
|
})
|
|
293
302
|
};
|
|
294
303
|
};
|
|
@@ -706,4 +715,16 @@ var uiSmartLinkStatusOpenPreviewButtonClicked = function uiSmartLinkStatusOpenPr
|
|
|
706
715
|
attributes: _objectSpread({}, context)
|
|
707
716
|
};
|
|
708
717
|
};
|
|
709
|
-
exports.uiSmartLinkStatusOpenPreviewButtonClicked = uiSmartLinkStatusOpenPreviewButtonClicked;
|
|
718
|
+
exports.uiSmartLinkStatusOpenPreviewButtonClicked = uiSmartLinkStatusOpenPreviewButtonClicked;
|
|
719
|
+
var uiServerActionClicked = function uiServerActionClicked(_ref26) {
|
|
720
|
+
var _SmartLinkActionTypeU2;
|
|
721
|
+
var smartLinkActionType = _ref26.smartLinkActionType;
|
|
722
|
+
return {
|
|
723
|
+
action: 'clicked',
|
|
724
|
+
actionSubject: 'button',
|
|
725
|
+
actionSubjectId: (_SmartLinkActionTypeU2 = SmartLinkActionTypeUiEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeU2 !== void 0 ? _SmartLinkActionTypeU2 : smartLinkActionType,
|
|
726
|
+
eventType: 'ui',
|
|
727
|
+
attributes: _objectSpread({}, context)
|
|
728
|
+
};
|
|
729
|
+
};
|
|
730
|
+
exports.uiServerActionClicked = uiServerActionClicked;
|
package/dist/cjs/utils/mocks.js
CHANGED
|
@@ -308,13 +308,18 @@ var mockAnalytics = {
|
|
|
308
308
|
buttonClickedEvent: function buttonClickedEvent() {},
|
|
309
309
|
modalClosedEvent: function modalClosedEvent() {},
|
|
310
310
|
renderSuccessEvent: function renderSuccessEvent() {},
|
|
311
|
-
renderFailedEvent: function renderFailedEvent() {}
|
|
311
|
+
renderFailedEvent: function renderFailedEvent() {},
|
|
312
|
+
smartLinkServerActionClickedEvent: function smartLinkServerActionClickedEvent() {}
|
|
312
313
|
},
|
|
313
314
|
operational: {
|
|
314
315
|
invokeSucceededEvent: function invokeSucceededEvent() {},
|
|
315
316
|
invokeFailedEvent: function invokeFailedEvent() {}
|
|
316
317
|
},
|
|
317
|
-
track: {
|
|
318
|
+
track: {
|
|
319
|
+
smartLinkQuickActionFailed: function smartLinkQuickActionFailed() {},
|
|
320
|
+
smartLinkQuickActionStarted: function smartLinkQuickActionStarted() {},
|
|
321
|
+
smartLinkQuickActionSuccess: function smartLinkQuickActionSuccess() {}
|
|
322
|
+
},
|
|
318
323
|
screen: {
|
|
319
324
|
modalViewedEvent: function modalViewedEvent() {}
|
|
320
325
|
}
|
|
@@ -13,9 +13,11 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
13
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
var _useInvoke = _interopRequireDefault(require("../../../../../../state/hooks/use-invoke"));
|
|
16
|
+
var _utils = require("../../../../../../state/hooks/use-invoke/utils");
|
|
16
17
|
var _useResolve = _interopRequireDefault(require("../../../../../../state/hooks/use-resolve"));
|
|
17
18
|
var _createInvokeRequest = _interopRequireDefault(require("../../../../../../utils/actions/create-invoke-request"));
|
|
18
19
|
var _index = _interopRequireDefault(require("../index"));
|
|
20
|
+
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
19
21
|
var _excluded = ["action", "onClick"];
|
|
20
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -27,46 +29,61 @@ var ServerAction = function ServerAction(_ref) {
|
|
|
27
29
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
28
30
|
isLoading = _useState2[0],
|
|
29
31
|
setIsLoading = _useState2[1];
|
|
32
|
+
var analytics = (0, _flexibleUiContext.useFlexibleUiAnalyticsContext)();
|
|
30
33
|
var invoke = (0, _useInvoke.default)();
|
|
31
34
|
var reload = (0, _useResolve.default)();
|
|
32
35
|
var handleClick = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
33
|
-
var request;
|
|
36
|
+
var _action$action, smartLinkActionType, request;
|
|
34
37
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
35
38
|
while (1) switch (_context.prev = _context.next) {
|
|
36
39
|
case 0:
|
|
37
40
|
if (!action) {
|
|
38
|
-
_context.next =
|
|
41
|
+
_context.next = 21;
|
|
39
42
|
break;
|
|
40
43
|
}
|
|
41
|
-
|
|
44
|
+
smartLinkActionType = (_action$action = action.action) === null || _action$action === void 0 ? void 0 : _action$action.actionType;
|
|
45
|
+
_context.prev = 2;
|
|
42
46
|
setIsLoading(true);
|
|
47
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkServerActionClickedEvent({
|
|
48
|
+
smartLinkActionType: smartLinkActionType
|
|
49
|
+
});
|
|
50
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionStarted({
|
|
51
|
+
smartLinkActionType: smartLinkActionType
|
|
52
|
+
});
|
|
43
53
|
request = (0, _createInvokeRequest.default)(action);
|
|
44
|
-
_context.next =
|
|
54
|
+
_context.next = 9;
|
|
45
55
|
return invoke(request);
|
|
46
|
-
case
|
|
56
|
+
case 9:
|
|
57
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionSuccess({
|
|
58
|
+
smartLinkActionType: smartLinkActionType
|
|
59
|
+
});
|
|
47
60
|
if (!(action.reload && action.reload.url)) {
|
|
48
|
-
_context.next =
|
|
61
|
+
_context.next = 13;
|
|
49
62
|
break;
|
|
50
63
|
}
|
|
51
|
-
_context.next =
|
|
64
|
+
_context.next = 13;
|
|
52
65
|
return reload(action.reload.url, true, undefined, action.reload.id);
|
|
53
|
-
case
|
|
66
|
+
case 13:
|
|
54
67
|
setIsLoading(false);
|
|
55
68
|
if (onClick) {
|
|
56
69
|
onClick();
|
|
57
70
|
}
|
|
58
|
-
_context.next =
|
|
71
|
+
_context.next = 21;
|
|
59
72
|
break;
|
|
60
|
-
case
|
|
61
|
-
_context.prev =
|
|
62
|
-
_context.t0 = _context["catch"](
|
|
73
|
+
case 17:
|
|
74
|
+
_context.prev = 17;
|
|
75
|
+
_context.t0 = _context["catch"](2);
|
|
63
76
|
setIsLoading(false);
|
|
64
|
-
|
|
77
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed({
|
|
78
|
+
smartLinkActionType: smartLinkActionType,
|
|
79
|
+
reason: (0, _utils.getInvokeFailureReason)(_context.t0)
|
|
80
|
+
});
|
|
81
|
+
case 21:
|
|
65
82
|
case "end":
|
|
66
83
|
return _context.stop();
|
|
67
84
|
}
|
|
68
|
-
}, _callee, null, [[
|
|
69
|
-
})), [action, invoke, onClick, reload]);
|
|
85
|
+
}, _callee, null, [[2, 17]]);
|
|
86
|
+
})), [action, analytics === null || analytics === void 0 ? void 0 : analytics.track, analytics === null || analytics === void 0 ? void 0 : analytics.ui, invoke, onClick, reload]);
|
|
70
87
|
return /*#__PURE__*/_react.default.createElement(_index.default, (0, _extends2.default)({}, props, {
|
|
71
88
|
isLoading: isLoading,
|
|
72
89
|
onClick: handleClick
|
|
@@ -23,6 +23,7 @@ var _extractLozengeActionItems = _interopRequireDefault(require("../../../../../
|
|
|
23
23
|
var _createStatusUpdateRequest = _interopRequireDefault(require("../../../../../../utils/actions/create-status-update-request"));
|
|
24
24
|
var _useResolve = _interopRequireDefault(require("../../../../../../state/hooks/use-resolve"));
|
|
25
25
|
var _types = require("./lozenge-action-error/types");
|
|
26
|
+
var _utils = require("../../../../../../state/hooks/use-invoke/utils");
|
|
26
27
|
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
27
28
|
var _analytics = require("../../../../../../utils/analytics/analytics");
|
|
28
29
|
var _lozengeActionAnalytics = require("./lozenge-action-analytics");
|
|
@@ -37,9 +38,6 @@ var validateItems = function validateItems() {
|
|
|
37
38
|
return item.text !== text;
|
|
38
39
|
});
|
|
39
40
|
};
|
|
40
|
-
var isInvokeCustomError = function isInvokeCustomError(err) {
|
|
41
|
-
return err.message !== undefined && err.errorCode !== undefined;
|
|
42
|
-
};
|
|
43
41
|
var LozengeAction = function LozengeAction(_ref) {
|
|
44
42
|
var _action$update;
|
|
45
43
|
var action = _ref.action,
|
|
@@ -199,7 +197,7 @@ var LozengeAction = function LozengeAction(_ref) {
|
|
|
199
197
|
_context2.prev = 19;
|
|
200
198
|
_context2.t0 = _context2["catch"](0);
|
|
201
199
|
setIsLoading(false);
|
|
202
|
-
if (isInvokeCustomError(_context2.t0)) {
|
|
200
|
+
if ((0, _utils.isInvokeCustomError)(_context2.t0)) {
|
|
203
201
|
setErrorMessage(_context2.t0.message);
|
|
204
202
|
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(_lozengeActionAnalytics.validationUpdateErrorAnalyticsPayload);
|
|
205
203
|
} else {
|
|
@@ -18,7 +18,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
18
18
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
19
19
|
var PACKAGE_DATA = {
|
|
20
20
|
packageName: "@atlaskit/smart-card",
|
|
21
|
-
packageVersion: "26.
|
|
21
|
+
packageVersion: "26.26.0",
|
|
22
22
|
componentName: 'linkUrl'
|
|
23
23
|
};
|
|
24
24
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -4,7 +4,7 @@ import { chunkloadFailedEvent, connectFailedEvent, connectSucceededEvent, contex
|
|
|
4
4
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
5
5
|
import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getStatusDetails, getSubproduct } from '../helpers';
|
|
6
6
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
|
-
import { trackHoverCardResolutionStarted, trackSmartLinkQuickActionFailed, trackSmartLinkQuickActionStarted, trackSmartLinkQuickActionSuccess, uiIframeDwelledEvent, uiIframeFocusedEvent } from '../../utils/analytics/analytics';
|
|
7
|
+
import { trackHoverCardResolutionStarted, trackSmartLinkQuickActionFailed, trackSmartLinkQuickActionStarted, trackSmartLinkQuickActionSuccess, uiIframeDwelledEvent, uiIframeFocusedEvent, uiServerActionClicked } from '../../utils/analytics/analytics';
|
|
8
8
|
import { useDispatchAnalytics } from './useDispatchAnalytics';
|
|
9
9
|
const applyCommonAttributes = (event, commonAttributes) => {
|
|
10
10
|
if (event && event.attributes) {
|
|
@@ -488,7 +488,8 @@ export const useSmartLinkAnalytics = (url, _dispatchAnalytics, id, defaultLocati
|
|
|
488
488
|
/**
|
|
489
489
|
* Fires an event that represent a click was performed on a Status Lozenge open preview button
|
|
490
490
|
*/
|
|
491
|
-
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => dispatchAnalytics(applyCommonAttributes(uiSmartLinkStatusOpenPreviewButtonClicked(), commonAttributes))
|
|
491
|
+
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => dispatchAnalytics(applyCommonAttributes(uiSmartLinkStatusOpenPreviewButtonClicked(), commonAttributes)),
|
|
492
|
+
smartLinkServerActionClickedEvent: props => dispatchAnalytics(applyCommonAttributes(uiServerActionClicked(props), commonAttributes))
|
|
492
493
|
}), [dispatchAnalytics, commonAttributes, defaultId, extractedExtensionKey]);
|
|
493
494
|
|
|
494
495
|
/** Contains all operational analytics events */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TrackQuickActionFailureReason } from '../../../utils/analytics/analytics';
|
|
2
|
+
export const getInvokeFailureReason = err => {
|
|
3
|
+
if (!isInvokeCustomError(err)) {
|
|
4
|
+
return TrackQuickActionFailureReason.UnknownError;
|
|
5
|
+
}
|
|
6
|
+
switch (err === null || err === void 0 ? void 0 : err.errorCode) {
|
|
7
|
+
case 403:
|
|
8
|
+
return TrackQuickActionFailureReason.PermissionError;
|
|
9
|
+
default:
|
|
10
|
+
return TrackQuickActionFailureReason.UnknownError;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export const isInvokeCustomError = err => (err === null || err === void 0 ? void 0 : err.message) !== undefined && (err === null || err === void 0 ? void 0 : err.errorCode) !== undefined;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { getMeasure } from '../performance';
|
|
2
|
+
import { SmartLinkActionType } from '@atlaskit/linking-types';
|
|
2
3
|
export const ANALYTICS_CHANNEL = 'media';
|
|
3
4
|
export const context = {
|
|
4
5
|
componentName: 'smart-cards',
|
|
5
6
|
packageName: "@atlaskit/smart-card",
|
|
6
|
-
packageVersion: "26.
|
|
7
|
+
packageVersion: "26.26.0"
|
|
7
8
|
};
|
|
8
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
9
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -15,6 +16,15 @@ export let TrackQuickActionFailureReason = /*#__PURE__*/function (TrackQuickActi
|
|
|
15
16
|
TrackQuickActionFailureReason["UnknownError"] = "UnknownError";
|
|
16
17
|
return TrackQuickActionFailureReason;
|
|
17
18
|
}({});
|
|
19
|
+
export const SmartLinkActionTypeTrackingEventMapper = {
|
|
20
|
+
[SmartLinkActionType.FollowEntityAction]: 'Follow',
|
|
21
|
+
[SmartLinkActionType.StatusUpdateAction]: 'StatusUpdate',
|
|
22
|
+
[SmartLinkActionType.UnfollowEntityAction]: 'Unfollow'
|
|
23
|
+
};
|
|
24
|
+
export const SmartLinkActionTypeUiEventMapper = {
|
|
25
|
+
[SmartLinkActionType.FollowEntityAction]: 'smartLinkFollowButton',
|
|
26
|
+
[SmartLinkActionType.UnfollowEntityAction]: 'smartLinkFollowButton'
|
|
27
|
+
};
|
|
18
28
|
const uiActionSubjectIds = {
|
|
19
29
|
DownloadAction: 'downloadDocument',
|
|
20
30
|
PreviewAction: 'invokePreviewScreen',
|
|
@@ -229,42 +239,51 @@ export const trackAppAccountAuthStarted = ({
|
|
|
229
239
|
export const trackSmartLinkQuickActionStarted = ({
|
|
230
240
|
smartLinkActionType,
|
|
231
241
|
...attributes
|
|
232
|
-
}) =>
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
+
}) => {
|
|
243
|
+
var _SmartLinkActionTypeT;
|
|
244
|
+
return {
|
|
245
|
+
action: 'started',
|
|
246
|
+
actionSubject: 'smartLinkQuickAction',
|
|
247
|
+
eventType: 'track',
|
|
248
|
+
attributes: {
|
|
249
|
+
...context,
|
|
250
|
+
...attributes,
|
|
251
|
+
smartLinkActionType: (_SmartLinkActionTypeT = SmartLinkActionTypeTrackingEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeT !== void 0 ? _SmartLinkActionTypeT : smartLinkActionType
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
};
|
|
242
255
|
export const trackSmartLinkQuickActionSuccess = ({
|
|
243
256
|
smartLinkActionType,
|
|
244
257
|
...attributes
|
|
245
|
-
}) =>
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
258
|
+
}) => {
|
|
259
|
+
var _SmartLinkActionTypeT2;
|
|
260
|
+
return {
|
|
261
|
+
action: 'success',
|
|
262
|
+
actionSubject: 'smartLinkQuickAction',
|
|
263
|
+
eventType: 'track',
|
|
264
|
+
attributes: {
|
|
265
|
+
...context,
|
|
266
|
+
...attributes,
|
|
267
|
+
smartLinkActionType: (_SmartLinkActionTypeT2 = SmartLinkActionTypeTrackingEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeT2 !== void 0 ? _SmartLinkActionTypeT2 : smartLinkActionType
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
};
|
|
255
271
|
export const trackSmartLinkQuickActionFailed = ({
|
|
256
272
|
smartLinkActionType,
|
|
257
273
|
...attributes
|
|
258
|
-
}) =>
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
274
|
+
}) => {
|
|
275
|
+
var _SmartLinkActionTypeT3;
|
|
276
|
+
return {
|
|
277
|
+
action: 'failed',
|
|
278
|
+
actionSubject: 'smartLinkQuickAction',
|
|
279
|
+
eventType: 'track',
|
|
280
|
+
attributes: {
|
|
281
|
+
...context,
|
|
282
|
+
...attributes,
|
|
283
|
+
smartLinkActionType: (_SmartLinkActionTypeT3 = SmartLinkActionTypeTrackingEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeT3 !== void 0 ? _SmartLinkActionTypeT3 : smartLinkActionType
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
};
|
|
268
287
|
export const trackHoverCardResolutionStarted = ({
|
|
269
288
|
display,
|
|
270
289
|
...attributes
|
|
@@ -660,4 +679,18 @@ export const uiSmartLinkStatusOpenPreviewButtonClicked = () => ({
|
|
|
660
679
|
attributes: {
|
|
661
680
|
...context
|
|
662
681
|
}
|
|
663
|
-
});
|
|
682
|
+
});
|
|
683
|
+
export const uiServerActionClicked = ({
|
|
684
|
+
smartLinkActionType
|
|
685
|
+
}) => {
|
|
686
|
+
var _SmartLinkActionTypeU;
|
|
687
|
+
return {
|
|
688
|
+
action: 'clicked',
|
|
689
|
+
actionSubject: 'button',
|
|
690
|
+
actionSubjectId: (_SmartLinkActionTypeU = SmartLinkActionTypeUiEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeU !== void 0 ? _SmartLinkActionTypeU : smartLinkActionType,
|
|
691
|
+
eventType: 'ui',
|
|
692
|
+
attributes: {
|
|
693
|
+
...context
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
};
|
|
@@ -212,13 +212,18 @@ export const mockAnalytics = {
|
|
|
212
212
|
buttonClickedEvent: () => {},
|
|
213
213
|
modalClosedEvent: () => {},
|
|
214
214
|
renderSuccessEvent: () => {},
|
|
215
|
-
renderFailedEvent: () => {}
|
|
215
|
+
renderFailedEvent: () => {},
|
|
216
|
+
smartLinkServerActionClickedEvent: () => {}
|
|
216
217
|
},
|
|
217
218
|
operational: {
|
|
218
219
|
invokeSucceededEvent: () => {},
|
|
219
220
|
invokeFailedEvent: () => {}
|
|
220
221
|
},
|
|
221
|
-
track: {
|
|
222
|
+
track: {
|
|
223
|
+
smartLinkQuickActionFailed: () => {},
|
|
224
|
+
smartLinkQuickActionStarted: () => {},
|
|
225
|
+
smartLinkQuickActionSuccess: () => {}
|
|
226
|
+
},
|
|
222
227
|
screen: {
|
|
223
228
|
modalViewedEvent: () => {}
|
|
224
229
|
}
|
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
3
|
import useInvoke from '../../../../../../state/hooks/use-invoke';
|
|
4
|
+
import { getInvokeFailureReason } from '../../../../../../state/hooks/use-invoke/utils';
|
|
4
5
|
import useResolve from '../../../../../../state/hooks/use-resolve';
|
|
5
6
|
import createInvokeRequest from '../../../../../../utils/actions/create-invoke-request';
|
|
6
7
|
import Action from '../index';
|
|
8
|
+
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
7
9
|
const ServerAction = ({
|
|
8
10
|
action,
|
|
9
11
|
onClick,
|
|
10
12
|
...props
|
|
11
13
|
}) => {
|
|
12
14
|
const [isLoading, setIsLoading] = useState(false);
|
|
15
|
+
const analytics = useFlexibleUiAnalyticsContext();
|
|
13
16
|
const invoke = useInvoke();
|
|
14
17
|
const reload = useResolve();
|
|
15
18
|
const handleClick = useCallback(async () => {
|
|
16
19
|
if (action) {
|
|
20
|
+
var _action$action;
|
|
21
|
+
const smartLinkActionType = (_action$action = action.action) === null || _action$action === void 0 ? void 0 : _action$action.actionType;
|
|
17
22
|
try {
|
|
18
23
|
setIsLoading(true);
|
|
24
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkServerActionClickedEvent({
|
|
25
|
+
smartLinkActionType
|
|
26
|
+
});
|
|
27
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionStarted({
|
|
28
|
+
smartLinkActionType
|
|
29
|
+
});
|
|
19
30
|
const request = createInvokeRequest(action);
|
|
20
31
|
await invoke(request);
|
|
32
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionSuccess({
|
|
33
|
+
smartLinkActionType
|
|
34
|
+
});
|
|
21
35
|
if (action.reload && action.reload.url) {
|
|
22
36
|
await reload(action.reload.url, true, undefined, action.reload.id);
|
|
23
37
|
}
|
|
@@ -27,9 +41,13 @@ const ServerAction = ({
|
|
|
27
41
|
}
|
|
28
42
|
} catch (err) {
|
|
29
43
|
setIsLoading(false);
|
|
44
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed({
|
|
45
|
+
smartLinkActionType,
|
|
46
|
+
reason: getInvokeFailureReason(err)
|
|
47
|
+
});
|
|
30
48
|
}
|
|
31
49
|
}
|
|
32
|
-
}, [action, invoke, onClick, reload]);
|
|
50
|
+
}, [action, analytics === null || analytics === void 0 ? void 0 : analytics.track, analytics === null || analytics === void 0 ? void 0 : analytics.ui, invoke, onClick, reload]);
|
|
33
51
|
return /*#__PURE__*/React.createElement(Action, _extends({}, props, {
|
|
34
52
|
isLoading: isLoading,
|
|
35
53
|
onClick: handleClick
|
|
@@ -13,13 +13,13 @@ import extractLozengeActionItems from '../../../../../../extractors/action/extra
|
|
|
13
13
|
import createStatusUpdateRequest from '../../../../../../utils/actions/create-status-update-request';
|
|
14
14
|
import useResolve from '../../../../../../state/hooks/use-resolve';
|
|
15
15
|
import { LozengeActionErrorMessages } from './lozenge-action-error/types';
|
|
16
|
+
import { isInvokeCustomError } from '../../../../../../state/hooks/use-invoke/utils';
|
|
16
17
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
17
18
|
import { TrackQuickActionType } from '../../../../../../utils/analytics/analytics';
|
|
18
19
|
import { permissionLoadErrorAnalyticsPayload, unknownLoadErrorAnalyticsPayload, unknownUpdateErrorAnalyticsPayload, validationUpdateErrorAnalyticsPayload } from './lozenge-action-analytics';
|
|
19
20
|
const validateItems = (items = [], text) => {
|
|
20
21
|
return items.filter(item => item.text !== text);
|
|
21
22
|
};
|
|
22
|
-
const isInvokeCustomError = err => err.message !== undefined && err.errorCode !== undefined;
|
|
23
23
|
const LozengeAction = ({
|
|
24
24
|
action,
|
|
25
25
|
appearance,
|
|
@@ -8,7 +8,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
8
8
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
const PACKAGE_DATA = {
|
|
10
10
|
packageName: "@atlaskit/smart-card",
|
|
11
|
-
packageVersion: "26.
|
|
11
|
+
packageVersion: "26.26.0",
|
|
12
12
|
componentName: 'linkUrl'
|
|
13
13
|
};
|
|
14
14
|
const Link = withLinkClickedEvent('a');
|
|
@@ -8,7 +8,7 @@ import { chunkloadFailedEvent as _chunkloadFailedEvent, connectFailedEvent as _c
|
|
|
8
8
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
9
9
|
import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getStatusDetails, getSubproduct } from '../helpers';
|
|
10
10
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
11
|
-
import { trackHoverCardResolutionStarted, trackSmartLinkQuickActionFailed, trackSmartLinkQuickActionStarted, trackSmartLinkQuickActionSuccess, uiIframeDwelledEvent, uiIframeFocusedEvent } from '../../utils/analytics/analytics';
|
|
11
|
+
import { trackHoverCardResolutionStarted, trackSmartLinkQuickActionFailed, trackSmartLinkQuickActionStarted, trackSmartLinkQuickActionSuccess, uiIframeDwelledEvent, uiIframeFocusedEvent, uiServerActionClicked } from '../../utils/analytics/analytics';
|
|
12
12
|
import { useDispatchAnalytics } from './useDispatchAnalytics';
|
|
13
13
|
var applyCommonAttributes = function applyCommonAttributes(event, commonAttributes) {
|
|
14
14
|
if (event && event.attributes) {
|
|
@@ -506,6 +506,9 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
|
|
|
506
506
|
*/
|
|
507
507
|
smartLinkLozengeActionErrorOpenPreviewClickedEvent: function smartLinkLozengeActionErrorOpenPreviewClickedEvent() {
|
|
508
508
|
return dispatchAnalytics(applyCommonAttributes(uiSmartLinkStatusOpenPreviewButtonClicked(), commonAttributes));
|
|
509
|
+
},
|
|
510
|
+
smartLinkServerActionClickedEvent: function smartLinkServerActionClickedEvent(props) {
|
|
511
|
+
return dispatchAnalytics(applyCommonAttributes(uiServerActionClicked(props), commonAttributes));
|
|
509
512
|
}
|
|
510
513
|
};
|
|
511
514
|
}, [dispatchAnalytics, commonAttributes, defaultId, extractedExtensionKey]);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TrackQuickActionFailureReason } from '../../../utils/analytics/analytics';
|
|
2
|
+
export var getInvokeFailureReason = function getInvokeFailureReason(err) {
|
|
3
|
+
if (!isInvokeCustomError(err)) {
|
|
4
|
+
return TrackQuickActionFailureReason.UnknownError;
|
|
5
|
+
}
|
|
6
|
+
switch (err === null || err === void 0 ? void 0 : err.errorCode) {
|
|
7
|
+
case 403:
|
|
8
|
+
return TrackQuickActionFailureReason.PermissionError;
|
|
9
|
+
default:
|
|
10
|
+
return TrackQuickActionFailureReason.UnknownError;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export var isInvokeCustomError = function isInvokeCustomError(err) {
|
|
14
|
+
return (err === null || err === void 0 ? void 0 : err.message) !== undefined && (err === null || err === void 0 ? void 0 : err.errorCode) !== undefined;
|
|
15
|
+
};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
var _excluded = ["smartLinkActionType"],
|
|
6
6
|
_excluded2 = ["smartLinkActionType"],
|
|
7
7
|
_excluded3 = ["smartLinkActionType"],
|
|
8
8
|
_excluded4 = ["display"];
|
|
9
|
+
var _SmartLinkActionTypeT, _SmartLinkActionTypeU;
|
|
9
10
|
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; }
|
|
10
11
|
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; }
|
|
11
12
|
import { getMeasure } from '../performance';
|
|
13
|
+
import { SmartLinkActionType } from '@atlaskit/linking-types';
|
|
12
14
|
export var ANALYTICS_CHANNEL = 'media';
|
|
13
15
|
export var context = {
|
|
14
16
|
componentName: 'smart-cards',
|
|
15
17
|
packageName: "@atlaskit/smart-card",
|
|
16
|
-
packageVersion: "26.
|
|
18
|
+
packageVersion: "26.26.0"
|
|
17
19
|
};
|
|
18
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
19
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -25,6 +27,8 @@ export var TrackQuickActionFailureReason = /*#__PURE__*/function (TrackQuickActi
|
|
|
25
27
|
TrackQuickActionFailureReason["UnknownError"] = "UnknownError";
|
|
26
28
|
return TrackQuickActionFailureReason;
|
|
27
29
|
}({});
|
|
30
|
+
export var SmartLinkActionTypeTrackingEventMapper = (_SmartLinkActionTypeT = {}, _defineProperty(_SmartLinkActionTypeT, SmartLinkActionType.FollowEntityAction, 'Follow'), _defineProperty(_SmartLinkActionTypeT, SmartLinkActionType.StatusUpdateAction, 'StatusUpdate'), _defineProperty(_SmartLinkActionTypeT, SmartLinkActionType.UnfollowEntityAction, 'Unfollow'), _SmartLinkActionTypeT);
|
|
31
|
+
export var SmartLinkActionTypeUiEventMapper = (_SmartLinkActionTypeU = {}, _defineProperty(_SmartLinkActionTypeU, SmartLinkActionType.FollowEntityAction, 'smartLinkFollowButton'), _defineProperty(_SmartLinkActionTypeU, SmartLinkActionType.UnfollowEntityAction, 'smartLinkFollowButton'), _SmartLinkActionTypeU);
|
|
28
32
|
var uiActionSubjectIds = {
|
|
29
33
|
DownloadAction: 'downloadDocument',
|
|
30
34
|
PreviewAction: 'invokePreviewScreen',
|
|
@@ -234,6 +238,7 @@ export var trackAppAccountAuthStarted = function trackAppAccountAuthStarted(_ref
|
|
|
234
238
|
};
|
|
235
239
|
};
|
|
236
240
|
export var trackSmartLinkQuickActionStarted = function trackSmartLinkQuickActionStarted(_ref8) {
|
|
241
|
+
var _SmartLinkActionTypeT2;
|
|
237
242
|
var smartLinkActionType = _ref8.smartLinkActionType,
|
|
238
243
|
attributes = _objectWithoutProperties(_ref8, _excluded);
|
|
239
244
|
return {
|
|
@@ -241,11 +246,12 @@ export var trackSmartLinkQuickActionStarted = function trackSmartLinkQuickAction
|
|
|
241
246
|
actionSubject: 'smartLinkQuickAction',
|
|
242
247
|
eventType: 'track',
|
|
243
248
|
attributes: _objectSpread(_objectSpread(_objectSpread({}, context), attributes), {}, {
|
|
244
|
-
smartLinkActionType: smartLinkActionType
|
|
249
|
+
smartLinkActionType: (_SmartLinkActionTypeT2 = SmartLinkActionTypeTrackingEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeT2 !== void 0 ? _SmartLinkActionTypeT2 : smartLinkActionType
|
|
245
250
|
})
|
|
246
251
|
};
|
|
247
252
|
};
|
|
248
253
|
export var trackSmartLinkQuickActionSuccess = function trackSmartLinkQuickActionSuccess(_ref9) {
|
|
254
|
+
var _SmartLinkActionTypeT3;
|
|
249
255
|
var smartLinkActionType = _ref9.smartLinkActionType,
|
|
250
256
|
attributes = _objectWithoutProperties(_ref9, _excluded2);
|
|
251
257
|
return {
|
|
@@ -253,11 +259,12 @@ export var trackSmartLinkQuickActionSuccess = function trackSmartLinkQuickAction
|
|
|
253
259
|
actionSubject: 'smartLinkQuickAction',
|
|
254
260
|
eventType: 'track',
|
|
255
261
|
attributes: _objectSpread(_objectSpread(_objectSpread({}, context), attributes), {}, {
|
|
256
|
-
smartLinkActionType: smartLinkActionType
|
|
262
|
+
smartLinkActionType: (_SmartLinkActionTypeT3 = SmartLinkActionTypeTrackingEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeT3 !== void 0 ? _SmartLinkActionTypeT3 : smartLinkActionType
|
|
257
263
|
})
|
|
258
264
|
};
|
|
259
265
|
};
|
|
260
266
|
export var trackSmartLinkQuickActionFailed = function trackSmartLinkQuickActionFailed(_ref10) {
|
|
267
|
+
var _SmartLinkActionTypeT4;
|
|
261
268
|
var smartLinkActionType = _ref10.smartLinkActionType,
|
|
262
269
|
attributes = _objectWithoutProperties(_ref10, _excluded3);
|
|
263
270
|
return {
|
|
@@ -265,7 +272,7 @@ export var trackSmartLinkQuickActionFailed = function trackSmartLinkQuickActionF
|
|
|
265
272
|
actionSubject: 'smartLinkQuickAction',
|
|
266
273
|
eventType: 'track',
|
|
267
274
|
attributes: _objectSpread(_objectSpread(_objectSpread({}, context), attributes), {}, {
|
|
268
|
-
smartLinkActionType: smartLinkActionType
|
|
275
|
+
smartLinkActionType: (_SmartLinkActionTypeT4 = SmartLinkActionTypeTrackingEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeT4 !== void 0 ? _SmartLinkActionTypeT4 : smartLinkActionType
|
|
269
276
|
})
|
|
270
277
|
};
|
|
271
278
|
};
|
|
@@ -663,4 +670,15 @@ export var uiSmartLinkStatusOpenPreviewButtonClicked = function uiSmartLinkStatu
|
|
|
663
670
|
eventType: 'ui',
|
|
664
671
|
attributes: _objectSpread({}, context)
|
|
665
672
|
};
|
|
673
|
+
};
|
|
674
|
+
export var uiServerActionClicked = function uiServerActionClicked(_ref26) {
|
|
675
|
+
var _SmartLinkActionTypeU2;
|
|
676
|
+
var smartLinkActionType = _ref26.smartLinkActionType;
|
|
677
|
+
return {
|
|
678
|
+
action: 'clicked',
|
|
679
|
+
actionSubject: 'button',
|
|
680
|
+
actionSubjectId: (_SmartLinkActionTypeU2 = SmartLinkActionTypeUiEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeU2 !== void 0 ? _SmartLinkActionTypeU2 : smartLinkActionType,
|
|
681
|
+
eventType: 'ui',
|
|
682
|
+
attributes: _objectSpread({}, context)
|
|
683
|
+
};
|
|
666
684
|
};
|
package/dist/esm/utils/mocks.js
CHANGED
|
@@ -295,13 +295,18 @@ export var mockAnalytics = {
|
|
|
295
295
|
buttonClickedEvent: function buttonClickedEvent() {},
|
|
296
296
|
modalClosedEvent: function modalClosedEvent() {},
|
|
297
297
|
renderSuccessEvent: function renderSuccessEvent() {},
|
|
298
|
-
renderFailedEvent: function renderFailedEvent() {}
|
|
298
|
+
renderFailedEvent: function renderFailedEvent() {},
|
|
299
|
+
smartLinkServerActionClickedEvent: function smartLinkServerActionClickedEvent() {}
|
|
299
300
|
},
|
|
300
301
|
operational: {
|
|
301
302
|
invokeSucceededEvent: function invokeSucceededEvent() {},
|
|
302
303
|
invokeFailedEvent: function invokeFailedEvent() {}
|
|
303
304
|
},
|
|
304
|
-
track: {
|
|
305
|
+
track: {
|
|
306
|
+
smartLinkQuickActionFailed: function smartLinkQuickActionFailed() {},
|
|
307
|
+
smartLinkQuickActionStarted: function smartLinkQuickActionStarted() {},
|
|
308
|
+
smartLinkQuickActionSuccess: function smartLinkQuickActionSuccess() {}
|
|
309
|
+
},
|
|
305
310
|
screen: {
|
|
306
311
|
modalViewedEvent: function modalViewedEvent() {}
|
|
307
312
|
}
|
|
@@ -6,9 +6,11 @@ var _excluded = ["action", "onClick"];
|
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
7
|
import React, { useCallback, useState } from 'react';
|
|
8
8
|
import useInvoke from '../../../../../../state/hooks/use-invoke';
|
|
9
|
+
import { getInvokeFailureReason } from '../../../../../../state/hooks/use-invoke/utils';
|
|
9
10
|
import useResolve from '../../../../../../state/hooks/use-resolve';
|
|
10
11
|
import createInvokeRequest from '../../../../../../utils/actions/create-invoke-request';
|
|
11
12
|
import Action from '../index';
|
|
13
|
+
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
12
14
|
var ServerAction = function ServerAction(_ref) {
|
|
13
15
|
var action = _ref.action,
|
|
14
16
|
onClick = _ref.onClick,
|
|
@@ -17,46 +19,61 @@ var ServerAction = function ServerAction(_ref) {
|
|
|
17
19
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
20
|
isLoading = _useState2[0],
|
|
19
21
|
setIsLoading = _useState2[1];
|
|
22
|
+
var analytics = useFlexibleUiAnalyticsContext();
|
|
20
23
|
var invoke = useInvoke();
|
|
21
24
|
var reload = useResolve();
|
|
22
25
|
var handleClick = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
23
|
-
var request;
|
|
26
|
+
var _action$action, smartLinkActionType, request;
|
|
24
27
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
25
28
|
while (1) switch (_context.prev = _context.next) {
|
|
26
29
|
case 0:
|
|
27
30
|
if (!action) {
|
|
28
|
-
_context.next =
|
|
31
|
+
_context.next = 21;
|
|
29
32
|
break;
|
|
30
33
|
}
|
|
31
|
-
|
|
34
|
+
smartLinkActionType = (_action$action = action.action) === null || _action$action === void 0 ? void 0 : _action$action.actionType;
|
|
35
|
+
_context.prev = 2;
|
|
32
36
|
setIsLoading(true);
|
|
37
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkServerActionClickedEvent({
|
|
38
|
+
smartLinkActionType: smartLinkActionType
|
|
39
|
+
});
|
|
40
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionStarted({
|
|
41
|
+
smartLinkActionType: smartLinkActionType
|
|
42
|
+
});
|
|
33
43
|
request = createInvokeRequest(action);
|
|
34
|
-
_context.next =
|
|
44
|
+
_context.next = 9;
|
|
35
45
|
return invoke(request);
|
|
36
|
-
case
|
|
46
|
+
case 9:
|
|
47
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionSuccess({
|
|
48
|
+
smartLinkActionType: smartLinkActionType
|
|
49
|
+
});
|
|
37
50
|
if (!(action.reload && action.reload.url)) {
|
|
38
|
-
_context.next =
|
|
51
|
+
_context.next = 13;
|
|
39
52
|
break;
|
|
40
53
|
}
|
|
41
|
-
_context.next =
|
|
54
|
+
_context.next = 13;
|
|
42
55
|
return reload(action.reload.url, true, undefined, action.reload.id);
|
|
43
|
-
case
|
|
56
|
+
case 13:
|
|
44
57
|
setIsLoading(false);
|
|
45
58
|
if (onClick) {
|
|
46
59
|
onClick();
|
|
47
60
|
}
|
|
48
|
-
_context.next =
|
|
61
|
+
_context.next = 21;
|
|
49
62
|
break;
|
|
50
|
-
case
|
|
51
|
-
_context.prev =
|
|
52
|
-
_context.t0 = _context["catch"](
|
|
63
|
+
case 17:
|
|
64
|
+
_context.prev = 17;
|
|
65
|
+
_context.t0 = _context["catch"](2);
|
|
53
66
|
setIsLoading(false);
|
|
54
|
-
|
|
67
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed({
|
|
68
|
+
smartLinkActionType: smartLinkActionType,
|
|
69
|
+
reason: getInvokeFailureReason(_context.t0)
|
|
70
|
+
});
|
|
71
|
+
case 21:
|
|
55
72
|
case "end":
|
|
56
73
|
return _context.stop();
|
|
57
74
|
}
|
|
58
|
-
}, _callee, null, [[
|
|
59
|
-
})), [action, invoke, onClick, reload]);
|
|
75
|
+
}, _callee, null, [[2, 17]]);
|
|
76
|
+
})), [action, analytics === null || analytics === void 0 ? void 0 : analytics.track, analytics === null || analytics === void 0 ? void 0 : analytics.ui, invoke, onClick, reload]);
|
|
60
77
|
return /*#__PURE__*/React.createElement(Action, _extends({}, props, {
|
|
61
78
|
isLoading: isLoading,
|
|
62
79
|
onClick: handleClick
|
|
@@ -16,6 +16,7 @@ import extractLozengeActionItems from '../../../../../../extractors/action/extra
|
|
|
16
16
|
import createStatusUpdateRequest from '../../../../../../utils/actions/create-status-update-request';
|
|
17
17
|
import useResolve from '../../../../../../state/hooks/use-resolve';
|
|
18
18
|
import { LozengeActionErrorMessages } from './lozenge-action-error/types';
|
|
19
|
+
import { isInvokeCustomError } from '../../../../../../state/hooks/use-invoke/utils';
|
|
19
20
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
20
21
|
import { TrackQuickActionType } from '../../../../../../utils/analytics/analytics';
|
|
21
22
|
import { permissionLoadErrorAnalyticsPayload, unknownLoadErrorAnalyticsPayload, unknownUpdateErrorAnalyticsPayload, validationUpdateErrorAnalyticsPayload } from './lozenge-action-analytics';
|
|
@@ -26,9 +27,6 @@ var validateItems = function validateItems() {
|
|
|
26
27
|
return item.text !== text;
|
|
27
28
|
});
|
|
28
29
|
};
|
|
29
|
-
var isInvokeCustomError = function isInvokeCustomError(err) {
|
|
30
|
-
return err.message !== undefined && err.errorCode !== undefined;
|
|
31
|
-
};
|
|
32
30
|
var LozengeAction = function LozengeAction(_ref) {
|
|
33
31
|
var _action$update;
|
|
34
32
|
var action = _ref.action,
|
|
@@ -11,7 +11,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
11
11
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
var PACKAGE_DATA = {
|
|
13
13
|
packageName: "@atlaskit/smart-card",
|
|
14
|
-
packageVersion: "26.
|
|
14
|
+
packageVersion: "26.26.0",
|
|
15
15
|
componentName: 'linkUrl'
|
|
16
16
|
};
|
|
17
17
|
var Link = withLinkClickedEvent('a');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnalyticsHandler, AnalyticsName, AnalyticsPayload } from '../../utils/types';
|
|
2
|
-
import { CommonEventProps, ConnectFailedEventProps, ConnectSucceededEventProps, InstrumentEventProps, InvokeFailedEventProps, InvokeSucceededEventProps, ScreenAuthPopupEventProps, TrackAppAccountConnectedProps, UiActionClickedEventProps, UiAuthAlternateAccountEventProps, UiAuthEventProps, UiCardClickedEventProps, UiClosedAuthEventProps, UiHoverCardDismissedEventProps, UiHoverCardOpenLinkClickedEventProps, UiHoverCardViewedEventProps, UiIframeDwelledEventProps, UiIframeFocusedEventProps, UiRenderFailedEventProps, UiRenderSuccessEventProps } from '../../utils/analytics/types';
|
|
2
|
+
import { CommonEventProps, ConnectFailedEventProps, ConnectSucceededEventProps, InstrumentEventProps, InvokeFailedEventProps, InvokeSucceededEventProps, ScreenAuthPopupEventProps, TrackAppAccountConnectedProps, UiActionClickedEventProps, UiAuthAlternateAccountEventProps, UiAuthEventProps, UiCardClickedEventProps, UiClosedAuthEventProps, UiHoverCardDismissedEventProps, UiHoverCardOpenLinkClickedEventProps, UiHoverCardViewedEventProps, UiIframeDwelledEventProps, UiIframeFocusedEventProps, UiRenderFailedEventProps, UiRenderSuccessEventProps, UiServerActionClickedEventProps } from '../../utils/analytics/types';
|
|
3
3
|
import { TrackQuickActionFailureReason, TrackQuickActionType } from '../../utils/analytics/analytics';
|
|
4
4
|
import { SmartLinkActionType } from '@atlaskit/linking-types';
|
|
5
5
|
/**
|
|
@@ -172,6 +172,7 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
|
|
|
172
172
|
* Fires an event that represent a click was performed on a Status Lozenge open preview button
|
|
173
173
|
*/
|
|
174
174
|
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => void;
|
|
175
|
+
smartLinkServerActionClickedEvent: (props: UiServerActionClickedEventProps) => void;
|
|
175
176
|
};
|
|
176
177
|
operational: {
|
|
177
178
|
/**
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { InvokeError } from '@atlaskit/linking-types';
|
|
2
|
+
import { TrackQuickActionFailureReason } from '../../../utils/analytics/analytics';
|
|
3
|
+
export declare const getInvokeFailureReason: (err: InvokeError | Error) => TrackQuickActionFailureReason.PermissionError | TrackQuickActionFailureReason.UnknownError;
|
|
4
|
+
export declare const isInvokeCustomError: (err: InvokeError | Error) => err is InvokeError;
|
|
@@ -38,6 +38,7 @@ dispatchAnalytics?: AnalyticsHandler): {
|
|
|
38
38
|
smartLinkLozengeActionClickedEvent: () => void;
|
|
39
39
|
smartLinkLozengeActionListItemClickedEvent: () => void;
|
|
40
40
|
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => void;
|
|
41
|
+
smartLinkServerActionClickedEvent: (props: import("../../utils/analytics/types").UiServerActionClickedEventProps) => void;
|
|
41
42
|
};
|
|
42
43
|
operational: {
|
|
43
44
|
invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").InvokeSucceededEventProps) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
2
|
import { AnalyticsPayload } from '../types';
|
|
3
3
|
import { CardInnerAppearance } from '../../view/Card/types';
|
|
4
|
-
import { CommonEventProps, ConnectFailedEventProps, ConnectSucceededEventProps, InvokeFailedEventProps, InvokeSucceededEventProps, ResolvedEventProps, ScreenAuthPopupEventProps, TrackAppAccountConnectedProps, UiActionClickedEventProps, UiAuthAlternateAccountEventProps, UiAuthEventProps, UiCardClickedEventProps, UiClosedAuthEventProps, UiHoverCardDismissedEventProps, UiHoverCardOpenLinkClickedEventProps, UiHoverCardViewedEventProps, UiIframeDwelledEventProps, UiIframeFocusedEventProps, UiRenderFailedEventProps, UiRenderSuccessEventProps, UnresolvedEventProps } from './types';
|
|
4
|
+
import { CommonEventProps, ConnectFailedEventProps, ConnectSucceededEventProps, InvokeFailedEventProps, InvokeSucceededEventProps, ResolvedEventProps, ScreenAuthPopupEventProps, TrackAppAccountConnectedProps, UiActionClickedEventProps, UiAuthAlternateAccountEventProps, UiAuthEventProps, UiCardClickedEventProps, UiClosedAuthEventProps, UiHoverCardDismissedEventProps, UiHoverCardOpenLinkClickedEventProps, UiHoverCardViewedEventProps, UiIframeDwelledEventProps, UiIframeFocusedEventProps, UiRenderFailedEventProps, UiRenderSuccessEventProps, UiServerActionClickedEventProps, UnresolvedEventProps } from './types';
|
|
5
5
|
import { SmartLinkActionType } from '@atlaskit/linking-types';
|
|
6
6
|
export declare const ANALYTICS_CHANNEL = "media";
|
|
7
7
|
export declare const context: {
|
|
@@ -17,6 +17,8 @@ export declare enum TrackQuickActionFailureReason {
|
|
|
17
17
|
ValidationError = "ValidationError",
|
|
18
18
|
UnknownError = "UnknownError"
|
|
19
19
|
}
|
|
20
|
+
export declare const SmartLinkActionTypeTrackingEventMapper: Record<string, string>;
|
|
21
|
+
export declare const SmartLinkActionTypeUiEventMapper: Record<string, string>;
|
|
20
22
|
export declare class SmartLinkEvents {
|
|
21
23
|
insertSmartLink(url: string, type: CardInnerAppearance, createAnalyticsEvent?: CreateUIAnalyticsEvent): void;
|
|
22
24
|
}
|
|
@@ -57,3 +59,4 @@ export declare const chunkloadFailedEvent: ({ display, error, errorInfo, extensi
|
|
|
57
59
|
export declare const uiSmartLinkStatusLozengeButtonClicked: () => AnalyticsPayload;
|
|
58
60
|
export declare const uiSmartLinkStatusListItemButtonClicked: () => AnalyticsPayload;
|
|
59
61
|
export declare const uiSmartLinkStatusOpenPreviewButtonClicked: () => AnalyticsPayload;
|
|
62
|
+
export declare const uiServerActionClicked: ({ smartLinkActionType, }: UiServerActionClickedEventProps) => AnalyticsPayload;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { APIError, CardType } from '@atlaskit/linking-common';
|
|
2
|
+
import { SmartLinkActionType } from '@atlaskit/linking-types';
|
|
2
3
|
import { PreviewDisplay, PreviewInvokeMethod } from '../../view/HoverCard/types';
|
|
3
4
|
import { ErrorInfo } from 'react';
|
|
4
5
|
import { CardInnerAppearance } from '../../view/Card/types';
|
|
@@ -74,6 +75,9 @@ export type UiActionClickedEventProps = CommonEventProps & {
|
|
|
74
75
|
actionType: string;
|
|
75
76
|
invokeType?: InvokeType;
|
|
76
77
|
};
|
|
78
|
+
export type UiServerActionClickedEventProps = CommonEventProps & {
|
|
79
|
+
smartLinkActionType: SmartLinkActionType;
|
|
80
|
+
};
|
|
77
81
|
export type ScreenAuthPopupEventProps = CommonEventProps;
|
|
78
82
|
export type UiClosedAuthEventProps = CommonEventProps & {
|
|
79
83
|
display: CardInnerAppearance;
|
|
@@ -63,6 +63,7 @@ export declare const mockAnalytics: {
|
|
|
63
63
|
smartLinkLozengeActionClickedEvent: () => void;
|
|
64
64
|
smartLinkLozengeActionListItemClickedEvent: () => void;
|
|
65
65
|
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => void;
|
|
66
|
+
smartLinkServerActionClickedEvent: (props: import("./analytics/types").UiServerActionClickedEventProps) => void;
|
|
66
67
|
};
|
|
67
68
|
operational: {
|
|
68
69
|
invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").InvokeSucceededEventProps) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnalyticsHandler, AnalyticsName, AnalyticsPayload } from '../../utils/types';
|
|
2
|
-
import { CommonEventProps, ConnectFailedEventProps, ConnectSucceededEventProps, InstrumentEventProps, InvokeFailedEventProps, InvokeSucceededEventProps, ScreenAuthPopupEventProps, TrackAppAccountConnectedProps, UiActionClickedEventProps, UiAuthAlternateAccountEventProps, UiAuthEventProps, UiCardClickedEventProps, UiClosedAuthEventProps, UiHoverCardDismissedEventProps, UiHoverCardOpenLinkClickedEventProps, UiHoverCardViewedEventProps, UiIframeDwelledEventProps, UiIframeFocusedEventProps, UiRenderFailedEventProps, UiRenderSuccessEventProps } from '../../utils/analytics/types';
|
|
2
|
+
import { CommonEventProps, ConnectFailedEventProps, ConnectSucceededEventProps, InstrumentEventProps, InvokeFailedEventProps, InvokeSucceededEventProps, ScreenAuthPopupEventProps, TrackAppAccountConnectedProps, UiActionClickedEventProps, UiAuthAlternateAccountEventProps, UiAuthEventProps, UiCardClickedEventProps, UiClosedAuthEventProps, UiHoverCardDismissedEventProps, UiHoverCardOpenLinkClickedEventProps, UiHoverCardViewedEventProps, UiIframeDwelledEventProps, UiIframeFocusedEventProps, UiRenderFailedEventProps, UiRenderSuccessEventProps, UiServerActionClickedEventProps } from '../../utils/analytics/types';
|
|
3
3
|
import { TrackQuickActionFailureReason, TrackQuickActionType } from '../../utils/analytics/analytics';
|
|
4
4
|
import { SmartLinkActionType } from '@atlaskit/linking-types';
|
|
5
5
|
/**
|
|
@@ -172,6 +172,7 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
|
|
|
172
172
|
* Fires an event that represent a click was performed on a Status Lozenge open preview button
|
|
173
173
|
*/
|
|
174
174
|
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => void;
|
|
175
|
+
smartLinkServerActionClickedEvent: (props: UiServerActionClickedEventProps) => void;
|
|
175
176
|
};
|
|
176
177
|
operational: {
|
|
177
178
|
/**
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { InvokeError } from '@atlaskit/linking-types';
|
|
2
|
+
import { TrackQuickActionFailureReason } from '../../../utils/analytics/analytics';
|
|
3
|
+
export declare const getInvokeFailureReason: (err: InvokeError | Error) => TrackQuickActionFailureReason.PermissionError | TrackQuickActionFailureReason.UnknownError;
|
|
4
|
+
export declare const isInvokeCustomError: (err: InvokeError | Error) => err is InvokeError;
|
|
@@ -38,6 +38,7 @@ dispatchAnalytics?: AnalyticsHandler): {
|
|
|
38
38
|
smartLinkLozengeActionClickedEvent: () => void;
|
|
39
39
|
smartLinkLozengeActionListItemClickedEvent: () => void;
|
|
40
40
|
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => void;
|
|
41
|
+
smartLinkServerActionClickedEvent: (props: import("../../utils/analytics/types").UiServerActionClickedEventProps) => void;
|
|
41
42
|
};
|
|
42
43
|
operational: {
|
|
43
44
|
invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").InvokeSucceededEventProps) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
2
|
import { AnalyticsPayload } from '../types';
|
|
3
3
|
import { CardInnerAppearance } from '../../view/Card/types';
|
|
4
|
-
import { CommonEventProps, ConnectFailedEventProps, ConnectSucceededEventProps, InvokeFailedEventProps, InvokeSucceededEventProps, ResolvedEventProps, ScreenAuthPopupEventProps, TrackAppAccountConnectedProps, UiActionClickedEventProps, UiAuthAlternateAccountEventProps, UiAuthEventProps, UiCardClickedEventProps, UiClosedAuthEventProps, UiHoverCardDismissedEventProps, UiHoverCardOpenLinkClickedEventProps, UiHoverCardViewedEventProps, UiIframeDwelledEventProps, UiIframeFocusedEventProps, UiRenderFailedEventProps, UiRenderSuccessEventProps, UnresolvedEventProps } from './types';
|
|
4
|
+
import { CommonEventProps, ConnectFailedEventProps, ConnectSucceededEventProps, InvokeFailedEventProps, InvokeSucceededEventProps, ResolvedEventProps, ScreenAuthPopupEventProps, TrackAppAccountConnectedProps, UiActionClickedEventProps, UiAuthAlternateAccountEventProps, UiAuthEventProps, UiCardClickedEventProps, UiClosedAuthEventProps, UiHoverCardDismissedEventProps, UiHoverCardOpenLinkClickedEventProps, UiHoverCardViewedEventProps, UiIframeDwelledEventProps, UiIframeFocusedEventProps, UiRenderFailedEventProps, UiRenderSuccessEventProps, UiServerActionClickedEventProps, UnresolvedEventProps } from './types';
|
|
5
5
|
import { SmartLinkActionType } from '@atlaskit/linking-types';
|
|
6
6
|
export declare const ANALYTICS_CHANNEL = "media";
|
|
7
7
|
export declare const context: {
|
|
@@ -17,6 +17,8 @@ export declare enum TrackQuickActionFailureReason {
|
|
|
17
17
|
ValidationError = "ValidationError",
|
|
18
18
|
UnknownError = "UnknownError"
|
|
19
19
|
}
|
|
20
|
+
export declare const SmartLinkActionTypeTrackingEventMapper: Record<string, string>;
|
|
21
|
+
export declare const SmartLinkActionTypeUiEventMapper: Record<string, string>;
|
|
20
22
|
export declare class SmartLinkEvents {
|
|
21
23
|
insertSmartLink(url: string, type: CardInnerAppearance, createAnalyticsEvent?: CreateUIAnalyticsEvent): void;
|
|
22
24
|
}
|
|
@@ -57,3 +59,4 @@ export declare const chunkloadFailedEvent: ({ display, error, errorInfo, extensi
|
|
|
57
59
|
export declare const uiSmartLinkStatusLozengeButtonClicked: () => AnalyticsPayload;
|
|
58
60
|
export declare const uiSmartLinkStatusListItemButtonClicked: () => AnalyticsPayload;
|
|
59
61
|
export declare const uiSmartLinkStatusOpenPreviewButtonClicked: () => AnalyticsPayload;
|
|
62
|
+
export declare const uiServerActionClicked: ({ smartLinkActionType, }: UiServerActionClickedEventProps) => AnalyticsPayload;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { APIError, CardType } from '@atlaskit/linking-common';
|
|
2
|
+
import { SmartLinkActionType } from '@atlaskit/linking-types';
|
|
2
3
|
import { PreviewDisplay, PreviewInvokeMethod } from '../../view/HoverCard/types';
|
|
3
4
|
import { ErrorInfo } from 'react';
|
|
4
5
|
import { CardInnerAppearance } from '../../view/Card/types';
|
|
@@ -74,6 +75,9 @@ export type UiActionClickedEventProps = CommonEventProps & {
|
|
|
74
75
|
actionType: string;
|
|
75
76
|
invokeType?: InvokeType;
|
|
76
77
|
};
|
|
78
|
+
export type UiServerActionClickedEventProps = CommonEventProps & {
|
|
79
|
+
smartLinkActionType: SmartLinkActionType;
|
|
80
|
+
};
|
|
77
81
|
export type ScreenAuthPopupEventProps = CommonEventProps;
|
|
78
82
|
export type UiClosedAuthEventProps = CommonEventProps & {
|
|
79
83
|
display: CardInnerAppearance;
|
|
@@ -63,6 +63,7 @@ export declare const mockAnalytics: {
|
|
|
63
63
|
smartLinkLozengeActionClickedEvent: () => void;
|
|
64
64
|
smartLinkLozengeActionListItemClickedEvent: () => void;
|
|
65
65
|
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => void;
|
|
66
|
+
smartLinkServerActionClickedEvent: (props: import("./analytics/types").UiServerActionClickedEventProps) => void;
|
|
66
67
|
};
|
|
67
68
|
operational: {
|
|
68
69
|
invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").InvokeSucceededEventProps) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.26.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/link-analytics": "^8.2.0",
|
|
39
39
|
"@atlaskit/link-client-extension": "^1.6.0",
|
|
40
40
|
"@atlaskit/link-extractors": "^1.1.0",
|
|
41
|
-
"@atlaskit/linking-common": "^4.
|
|
41
|
+
"@atlaskit/linking-common": "^4.8.0",
|
|
42
42
|
"@atlaskit/linking-types": "^8.3.0",
|
|
43
43
|
"@atlaskit/logo": "^13.14.0",
|
|
44
44
|
"@atlaskit/lozenge": "^11.4.0",
|
package/report.api.md
CHANGED
|
@@ -1066,6 +1066,11 @@ type UiRenderSuccessEventProps = CommonEventProps & {
|
|
|
1066
1066
|
status: CardType;
|
|
1067
1067
|
};
|
|
1068
1068
|
|
|
1069
|
+
// @public (undocumented)
|
|
1070
|
+
type UiServerActionClickedEventProps = CommonEventProps & {
|
|
1071
|
+
smartLinkActionType: SmartLinkActionType;
|
|
1072
|
+
};
|
|
1073
|
+
|
|
1069
1074
|
// @public @deprecated
|
|
1070
1075
|
export const useSmartLinkAnalytics: (
|
|
1071
1076
|
url: string,
|
|
@@ -1218,6 +1223,9 @@ export const useSmartLinkAnalytics: (
|
|
|
1218
1223
|
smartLinkLozengeActionClickedEvent: () => void;
|
|
1219
1224
|
smartLinkLozengeActionListItemClickedEvent: () => void;
|
|
1220
1225
|
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => void;
|
|
1226
|
+
smartLinkServerActionClickedEvent: (
|
|
1227
|
+
props: UiServerActionClickedEventProps,
|
|
1228
|
+
) => void;
|
|
1221
1229
|
};
|
|
1222
1230
|
operational: {
|
|
1223
1231
|
invokeSucceededEvent: ({
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -914,6 +914,11 @@ type UiRenderSuccessEventProps = CommonEventProps & {
|
|
|
914
914
|
status: CardType;
|
|
915
915
|
};
|
|
916
916
|
|
|
917
|
+
// @public (undocumented)
|
|
918
|
+
type UiServerActionClickedEventProps = CommonEventProps & {
|
|
919
|
+
smartLinkActionType: SmartLinkActionType;
|
|
920
|
+
};
|
|
921
|
+
|
|
917
922
|
// @public @deprecated
|
|
918
923
|
export const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: AnalyticsHandler, id?: string, defaultLocation?: string) => {
|
|
919
924
|
ui: {
|
|
@@ -939,6 +944,7 @@ export const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: Analytics
|
|
|
939
944
|
smartLinkLozengeActionClickedEvent: () => void;
|
|
940
945
|
smartLinkLozengeActionListItemClickedEvent: () => void;
|
|
941
946
|
smartLinkLozengeActionErrorOpenPreviewClickedEvent: () => void;
|
|
947
|
+
smartLinkServerActionClickedEvent: (props: UiServerActionClickedEventProps) => void;
|
|
942
948
|
};
|
|
943
949
|
operational: {
|
|
944
950
|
invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeSucceededEventProps) => void;
|