@atlaskit/smart-card 26.24.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 +16 -0
- package/dist/cjs/extractors/block/index.js +1 -1
- package/dist/cjs/extractors/common/actions/extractActions.js +3 -31
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +10 -15
- package/dist/cjs/state/hooks/use-invoke/utils.js +23 -0
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +20 -14
- package/dist/cjs/utils/analytics/analytics.js +28 -7
- package/dist/cjs/utils/mocks.js +7 -2
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +3 -45
- package/dist/cjs/view/FlexibleCard/components/actions/action/download-action/index.js +33 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +41 -15
- package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +32 -15
- package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/index.js +33 -1
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +2 -4
- package/dist/cjs/view/FlexibleCard/components/utils.js +9 -20
- package/dist/cjs/view/FlexibleCard/index.js +14 -1
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/block/index.js +2 -2
- package/dist/es2019/extractors/common/actions/extractActions.js +2 -23
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +10 -17
- package/dist/es2019/state/hooks/use-invoke/utils.js +13 -0
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +14 -8
- package/dist/es2019/utils/analytics/analytics.js +65 -32
- package/dist/es2019/utils/mocks.js +7 -2
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -42
- package/dist/es2019/view/FlexibleCard/components/actions/action/download-action/index.js +15 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +18 -7
- package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +19 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/index.js +15 -1
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/utils.js +3 -17
- package/dist/es2019/view/FlexibleCard/index.js +11 -1
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/block/index.js +2 -2
- package/dist/esm/extractors/common/actions/extractActions.js +2 -30
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +11 -16
- package/dist/esm/state/hooks/use-invoke/utils.js +15 -0
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +20 -14
- package/dist/esm/utils/analytics/analytics.js +23 -5
- package/dist/esm/utils/mocks.js +7 -2
- package/dist/esm/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -46
- package/dist/esm/view/FlexibleCard/components/actions/action/download-action/index.js +33 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +41 -15
- package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +32 -15
- package/dist/esm/view/FlexibleCard/components/actions/action/view-action/index.js +33 -1
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +1 -3
- package/dist/esm/view/FlexibleCard/components/utils.js +9 -20
- package/dist/esm/view/FlexibleCard/index.js +14 -1
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/extractors/common/__mocks__/jsonld.d.ts +0 -1
- package/dist/types/extractors/common/actions/extractActions.d.ts +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +6 -5
- package/dist/types/state/flexible-ui-context/index.d.ts +3 -119
- package/dist/types/state/flexible-ui-context/types.d.ts +6 -0
- package/dist/types/state/hooks/use-invoke/utils.d.ts +4 -0
- package/dist/types/state/hooks/useSmartLink.d.ts +4 -3
- package/dist/types/utils/analytics/analytics.d.ts +4 -1
- package/dist/types/utils/analytics/types.d.ts +7 -3
- package/dist/types/utils/mocks.d.ts +4 -3
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/utils.d.ts +2 -63
- package/dist/types/view/FlexibleCard/types.d.ts +2 -3
- package/dist/types-ts4.5/extractors/common/__mocks__/jsonld.d.ts +0 -1
- package/dist/types-ts4.5/extractors/common/actions/extractActions.d.ts +1 -1
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +6 -5
- package/dist/types-ts4.5/state/flexible-ui-context/index.d.ts +3 -119
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +6 -0
- package/dist/types-ts4.5/state/hooks/use-invoke/utils.d.ts +4 -0
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +4 -3
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +4 -1
- package/dist/types-ts4.5/utils/analytics/types.d.ts +7 -3
- package/dist/types-ts4.5/utils/mocks.d.ts +4 -3
- package/dist/types-ts4.5/view/Card/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +2 -63
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +2 -3
- package/package.json +2 -2
- package/report.api.md +14 -6
- package/tmp/api-report-tmp.d.ts +12 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.26.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`d3e04f50bbc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d3e04f50bbc) - Add follow action analytics (behind feature flag)
|
|
8
|
+
|
|
9
|
+
## 26.25.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`dc3345f4b47`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dc3345f4b47) - Refactor flexible card to use client action hook. (Minor due to the change to the deprecated hook.)
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`2c8b781fd3a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2c8b781fd3a) - cleanup: remove server actions from actions extractor
|
|
18
|
+
|
|
3
19
|
## 26.24.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -38,7 +38,7 @@ var extractBlockDetails = function extractBlockDetails(jsonLd) {
|
|
|
38
38
|
var extractBlockActions = function extractBlockActions(props, jsonLd, opts, platform, meta) {
|
|
39
39
|
if (opts) {
|
|
40
40
|
var handleInvoke = opts.handleInvoke;
|
|
41
|
-
var actions = (0, _extractActions.
|
|
41
|
+
var actions = (0, _extractActions.extractClientActions)(jsonLd, handleInvoke);
|
|
42
42
|
var previewAction = (0, _extractPreviewAction.extractPreviewAction)(_objectSpread(_objectSpread({}, opts), {}, {
|
|
43
43
|
viewProps: props,
|
|
44
44
|
jsonLd: jsonLd,
|
|
@@ -4,9 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.extractClientActions = extractClientActions;
|
|
8
8
|
exports.getActionsFromJsonLd = void 0;
|
|
9
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
10
|
var _ViewAction = require("../../../view/BlockCard/actions/ViewAction");
|
|
12
11
|
var _DownloadAction = require("../../../view/BlockCard/actions/DownloadAction");
|
|
@@ -45,27 +44,6 @@ var getClientActionProps = function getClientActionProps(jsonLd, action, handler
|
|
|
45
44
|
}
|
|
46
45
|
});
|
|
47
46
|
};
|
|
48
|
-
var getServerActionProps = function getServerActionProps(jsonLd, action, handler) {
|
|
49
|
-
var id = action['@id'] || action['@type'];
|
|
50
|
-
var data = {
|
|
51
|
-
type: 'server',
|
|
52
|
-
key: action.identifier,
|
|
53
|
-
action: {
|
|
54
|
-
type: action['@type'],
|
|
55
|
-
payload: {
|
|
56
|
-
id: id,
|
|
57
|
-
context: jsonLd.context
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
return {
|
|
62
|
-
id: id,
|
|
63
|
-
text: action.name,
|
|
64
|
-
promise: function promise() {
|
|
65
|
-
return handler(data);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
47
|
var getActionsFromJsonLd = function getActionsFromJsonLd(jsonLd) {
|
|
70
48
|
var actions = jsonLd && jsonLd['schema:potentialAction'];
|
|
71
49
|
if (!actions) {
|
|
@@ -77,17 +55,11 @@ var getActionsFromJsonLd = function getActionsFromJsonLd(jsonLd) {
|
|
|
77
55
|
return actions;
|
|
78
56
|
};
|
|
79
57
|
exports.getActionsFromJsonLd = getActionsFromJsonLd;
|
|
80
|
-
function
|
|
58
|
+
function extractClientActions(jsonLd, handler) {
|
|
81
59
|
var actions = getActionsFromJsonLd(jsonLd);
|
|
82
60
|
var clientActions = actions.filter(isClientAction);
|
|
83
|
-
var serverActions = actions.filter(function (action) {
|
|
84
|
-
return !isClientAction(action);
|
|
85
|
-
});
|
|
86
61
|
var clientActionImpls = clientActions.map(function (action) {
|
|
87
62
|
return getClientActionProps(jsonLd, action, handler);
|
|
88
63
|
});
|
|
89
|
-
|
|
90
|
-
return getServerActionProps(jsonLd, action, handler);
|
|
91
|
-
});
|
|
92
|
-
return [].concat((0, _toConsumableArray2.default)(clientActionImpls), (0, _toConsumableArray2.default)(serverActionImpls));
|
|
64
|
+
return clientActionImpls;
|
|
93
65
|
}
|
|
@@ -254,11 +254,11 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
254
254
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
255
255
|
* @param actionType The type of the action that was clicked, e.g. PreviewAction
|
|
256
256
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
257
|
-
* @param invokeType
|
|
257
|
+
* @param invokeType @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
|
|
258
258
|
* @returns
|
|
259
259
|
*/
|
|
260
260
|
actionClickedEvent: function actionClickedEvent(_ref6) {
|
|
261
|
-
var
|
|
261
|
+
var id = _ref6.id,
|
|
262
262
|
actionType = _ref6.actionType,
|
|
263
263
|
display = _ref6.display,
|
|
264
264
|
invokeType = _ref6.invokeType,
|
|
@@ -269,14 +269,8 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
269
269
|
destinationSubproduct = _ref6.destinationSubproduct,
|
|
270
270
|
location = _ref6.location;
|
|
271
271
|
var extensionKey = overrideExtensionKey !== null && overrideExtensionKey !== void 0 ? overrideExtensionKey : extractedExtensionKey;
|
|
272
|
-
(0, _ufoExperiences.startUfoExperience)('smart-link-action-invocation', experienceId, {
|
|
273
|
-
actionType: actionType,
|
|
274
|
-
display: display,
|
|
275
|
-
extensionKey: extensionKey,
|
|
276
|
-
invokeType: invokeType
|
|
277
|
-
});
|
|
278
272
|
dispatchAnalytics(applyCommonAttributes((0, _analytics.uiActionClickedEvent)({
|
|
279
|
-
id: defaultId,
|
|
273
|
+
id: id !== null && id !== void 0 ? id : defaultId,
|
|
280
274
|
actionType: actionType,
|
|
281
275
|
display: display,
|
|
282
276
|
extensionKey: extensionKey,
|
|
@@ -519,6 +513,9 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
519
513
|
*/
|
|
520
514
|
smartLinkLozengeActionErrorOpenPreviewClickedEvent: function smartLinkLozengeActionErrorOpenPreviewClickedEvent() {
|
|
521
515
|
return dispatchAnalytics(applyCommonAttributes((0, _analytics.uiSmartLinkStatusOpenPreviewButtonClicked)(), commonAttributes));
|
|
516
|
+
},
|
|
517
|
+
smartLinkServerActionClickedEvent: function smartLinkServerActionClickedEvent(props) {
|
|
518
|
+
return dispatchAnalytics(applyCommonAttributes((0, _analytics2.uiServerActionClicked)(props), commonAttributes));
|
|
522
519
|
}
|
|
523
520
|
};
|
|
524
521
|
}, [dispatchAnalytics, commonAttributes, defaultId, extractedExtensionKey]);
|
|
@@ -534,7 +531,7 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
534
531
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
535
532
|
*/
|
|
536
533
|
invokeSucceededEvent: function invokeSucceededEvent(_ref13) {
|
|
537
|
-
var
|
|
534
|
+
var id = _ref13.id,
|
|
538
535
|
actionType = _ref13.actionType,
|
|
539
536
|
display = _ref13.display,
|
|
540
537
|
extensionKey = _ref13.extensionKey,
|
|
@@ -543,9 +540,8 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
543
540
|
destinationProduct = _ref13.destinationProduct,
|
|
544
541
|
destinationSubproduct = _ref13.destinationSubproduct,
|
|
545
542
|
location = _ref13.location;
|
|
546
|
-
(0, _ufoExperiences.succeedUfoExperience)('smart-link-action-invocation', experienceId);
|
|
547
543
|
dispatchAnalytics(applyCommonAttributes((0, _analytics.invokeSucceededEvent)({
|
|
548
|
-
id: defaultId,
|
|
544
|
+
id: id !== null && id !== void 0 ? id : defaultId,
|
|
549
545
|
actionType: actionType,
|
|
550
546
|
display: display,
|
|
551
547
|
extensionKey: extensionKey,
|
|
@@ -565,7 +561,7 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
565
561
|
* @param reason The reason the invocation failed.
|
|
566
562
|
*/
|
|
567
563
|
invokeFailedEvent: function invokeFailedEvent(_ref14) {
|
|
568
|
-
var
|
|
564
|
+
var id = _ref14.id,
|
|
569
565
|
actionType = _ref14.actionType,
|
|
570
566
|
display = _ref14.display,
|
|
571
567
|
reason = _ref14.reason,
|
|
@@ -575,9 +571,8 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatchAnalyti
|
|
|
575
571
|
destinationProduct = _ref14.destinationProduct,
|
|
576
572
|
destinationSubproduct = _ref14.destinationSubproduct,
|
|
577
573
|
location = _ref14.location;
|
|
578
|
-
(0, _ufoExperiences.failUfoExperience)('smart-link-action-invocation', experienceId);
|
|
579
574
|
dispatchAnalytics(applyCommonAttributes((0, _analytics.invokeFailedEvent)({
|
|
580
|
-
id: defaultId,
|
|
575
|
+
id: id !== null && id !== void 0 ? id : defaultId,
|
|
581
576
|
actionType: actionType,
|
|
582
577
|
display: display,
|
|
583
578
|
reason: reason,
|
|
@@ -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;
|
|
@@ -11,8 +11,11 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
11
11
|
var _react = require("react");
|
|
12
12
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
13
13
|
var measure = _interopRequireWildcard(require("../../../utils/performance"));
|
|
14
|
+
var _analytics = require("../../analytics");
|
|
14
15
|
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); }
|
|
15
16
|
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; }
|
|
17
|
+
var ACTION_EXPERIENCE_NAME = 'smart-link-action-invocation';
|
|
18
|
+
|
|
16
19
|
/**
|
|
17
20
|
* Invoke client action such as preview, download and open link
|
|
18
21
|
*/
|
|
@@ -29,45 +32,48 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
29
32
|
markName = "".concat(experienceId, "-").concat(actionType);
|
|
30
33
|
measure.mark(markName, 'pending');
|
|
31
34
|
_context.prev = 4;
|
|
32
|
-
// Begin
|
|
33
|
-
|
|
34
|
-
id: experienceId,
|
|
35
|
-
extensionKey: extensionKey,
|
|
35
|
+
// Begin UFO experience
|
|
36
|
+
(0, _analytics.startUfoExperience)(ACTION_EXPERIENCE_NAME, experienceId, {
|
|
36
37
|
actionType: actionType,
|
|
37
38
|
display: display,
|
|
39
|
+
extensionKey: extensionKey,
|
|
38
40
|
invokeType: 'client'
|
|
39
41
|
});
|
|
40
42
|
|
|
43
|
+
// Begin analytics instrumentation.
|
|
44
|
+
analytics === null || analytics === void 0 ? void 0 : analytics.ui.actionClickedEvent({
|
|
45
|
+
actionType: actionType,
|
|
46
|
+
display: display
|
|
47
|
+
});
|
|
48
|
+
|
|
41
49
|
// Invoke action
|
|
42
|
-
_context.next =
|
|
50
|
+
_context.next = 9;
|
|
43
51
|
return actionFn();
|
|
44
|
-
case
|
|
52
|
+
case 9:
|
|
45
53
|
result = _context.sent;
|
|
46
54
|
measure.mark(markName, 'resolved');
|
|
55
|
+
(0, _analytics.succeedUfoExperience)(ACTION_EXPERIENCE_NAME, experienceId);
|
|
47
56
|
analytics === null || analytics === void 0 ? void 0 : analytics.operational.invokeSucceededEvent({
|
|
48
|
-
id: experienceId,
|
|
49
|
-
extensionKey: extensionKey,
|
|
50
57
|
actionType: actionType,
|
|
51
58
|
display: display
|
|
52
59
|
});
|
|
53
60
|
return _context.abrupt("return", result);
|
|
54
|
-
case
|
|
55
|
-
_context.prev =
|
|
61
|
+
case 16:
|
|
62
|
+
_context.prev = 16;
|
|
56
63
|
_context.t0 = _context["catch"](4);
|
|
57
64
|
measure.mark(markName, 'errored');
|
|
65
|
+
(0, _analytics.failUfoExperience)(ACTION_EXPERIENCE_NAME, experienceId);
|
|
58
66
|
reason = typeof _context.t0 === 'string' ? _context.t0 : _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message;
|
|
59
67
|
analytics === null || analytics === void 0 ? void 0 : analytics.operational.invokeFailedEvent({
|
|
60
|
-
id: experienceId,
|
|
61
|
-
extensionKey: extensionKey,
|
|
62
68
|
actionType: actionType,
|
|
63
69
|
display: display,
|
|
64
70
|
reason: reason
|
|
65
71
|
});
|
|
66
|
-
case
|
|
72
|
+
case 22:
|
|
67
73
|
case "end":
|
|
68
74
|
return _context.stop();
|
|
69
75
|
}
|
|
70
|
-
}, _callee, null, [[4,
|
|
76
|
+
}, _callee, null, [[4, 16]]);
|
|
71
77
|
}));
|
|
72
78
|
return function (_x) {
|
|
73
79
|
return _ref3.apply(this, arguments);
|
|
@@ -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
|
}
|
|
@@ -41,6 +41,7 @@ var FlexibleErroredView = function FlexibleErroredView(_ref) {
|
|
|
41
41
|
return onAuthorize ? [(0, _RetryAction.RetryAction)(onAuthorize)] : [];
|
|
42
42
|
}, [onAuthorize]);
|
|
43
43
|
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, {
|
|
44
|
+
appearance: "block",
|
|
44
45
|
cardState: cardState,
|
|
45
46
|
onAuthorize: onAuthorize,
|
|
46
47
|
onClick: onClick,
|
|
@@ -14,7 +14,6 @@ var _titleBlock = _interopRequireDefault(require("../../../FlexibleCard/componen
|
|
|
14
14
|
var _blocks = require("../../../FlexibleCard/components/blocks");
|
|
15
15
|
var _styled = require("./styled");
|
|
16
16
|
var _constants = require("../../../../constants");
|
|
17
|
-
var _uuid = _interopRequireDefault(require("uuid"));
|
|
18
17
|
var _utils = require("./utils");
|
|
19
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
19
|
var _withFlexibleUIBlockCardStyle = require("./utils/withFlexibleUIBlockCardStyle");
|
|
@@ -45,11 +44,6 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
45
44
|
(0, _react.useEffect)(function () {
|
|
46
45
|
setIsPreviewBlockErrored(false);
|
|
47
46
|
}, [url, cardState]);
|
|
48
|
-
var _useState3 = (0, _react.useState)(function () {
|
|
49
|
-
return id ? id : (0, _uuid.default)();
|
|
50
|
-
}),
|
|
51
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 1),
|
|
52
|
-
analyticsId = _useState4[0];
|
|
53
47
|
var _ref2 = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? (0, _utils.getSimulatedBetterMetadata)(cardState.details) : (0, _utils.getSimulatedMetadata)(cardState.details),
|
|
54
48
|
titleMetadata = _ref2.titleMetadata,
|
|
55
49
|
topMetadata = _ref2.topMetadata,
|
|
@@ -96,49 +90,13 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
96
90
|
}, {
|
|
97
91
|
actions: [{
|
|
98
92
|
name: _constants.ActionName.PreviewAction,
|
|
99
|
-
hideIcon: true
|
|
100
|
-
onClick: function onClick() {
|
|
101
|
-
analytics.ui.actionClickedEvent({
|
|
102
|
-
id: analyticsId,
|
|
103
|
-
actionType: 'PreviewAction',
|
|
104
|
-
display: _constants.CardDisplay.Block
|
|
105
|
-
});
|
|
106
|
-
analytics.operational.invokeSucceededEvent({
|
|
107
|
-
id: analyticsId,
|
|
108
|
-
actionType: 'PreviewAction',
|
|
109
|
-
display: _constants.CardDisplay.Block
|
|
110
|
-
});
|
|
111
|
-
}
|
|
93
|
+
hideIcon: true
|
|
112
94
|
}, {
|
|
113
95
|
name: _constants.ActionName.ViewAction,
|
|
114
|
-
hideIcon: true
|
|
115
|
-
onClick: function onClick() {
|
|
116
|
-
analytics.ui.actionClickedEvent({
|
|
117
|
-
id: analyticsId,
|
|
118
|
-
actionType: 'ViewAction',
|
|
119
|
-
display: _constants.CardDisplay.Block
|
|
120
|
-
});
|
|
121
|
-
analytics.operational.invokeSucceededEvent({
|
|
122
|
-
id: analyticsId,
|
|
123
|
-
actionType: 'ViewAction',
|
|
124
|
-
display: _constants.CardDisplay.Block
|
|
125
|
-
});
|
|
126
|
-
}
|
|
96
|
+
hideIcon: true
|
|
127
97
|
}, {
|
|
128
98
|
name: _constants.ActionName.DownloadAction,
|
|
129
|
-
hideIcon: true
|
|
130
|
-
onClick: function onClick() {
|
|
131
|
-
analytics.ui.actionClickedEvent({
|
|
132
|
-
id: analyticsId,
|
|
133
|
-
actionType: 'DownloadAction',
|
|
134
|
-
display: _constants.CardDisplay.Block
|
|
135
|
-
});
|
|
136
|
-
analytics.operational.invokeSucceededEvent({
|
|
137
|
-
id: analyticsId,
|
|
138
|
-
actionType: 'DownloadAction',
|
|
139
|
-
display: _constants.CardDisplay.Block
|
|
140
|
-
});
|
|
141
|
-
}
|
|
99
|
+
hideIcon: true
|
|
142
100
|
}]
|
|
143
101
|
})));
|
|
144
102
|
};
|
|
@@ -5,11 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
var _index = _interopRequireDefault(require("../index"));
|
|
12
14
|
var _utils = require("../../../../../../utils");
|
|
15
|
+
var _constants = require("../../../../../../constants");
|
|
16
|
+
var _useInvokeClientAction = _interopRequireDefault(require("../../../../../../state/hooks/use-invoke-client-action"));
|
|
17
|
+
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
13
18
|
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; }
|
|
14
19
|
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; }
|
|
15
20
|
var DownloadAction = function DownloadAction(props) {
|
|
@@ -19,10 +24,37 @@ var DownloadAction = function DownloadAction(props) {
|
|
|
19
24
|
_onClick = props.onClick,
|
|
20
25
|
testId = props.testId,
|
|
21
26
|
url = props.url;
|
|
27
|
+
var analytics = (0, _flexibleUiContext.useFlexibleUiAnalyticsContext)();
|
|
28
|
+
var invoke = (0, _useInvokeClientAction.default)({
|
|
29
|
+
analytics: analytics
|
|
30
|
+
});
|
|
22
31
|
if (downloadUrl && url) {
|
|
23
32
|
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
24
33
|
onClick: function onClick() {
|
|
25
|
-
(
|
|
34
|
+
invoke({
|
|
35
|
+
actionType: _constants.ActionName.DownloadAction,
|
|
36
|
+
actionFn: function () {
|
|
37
|
+
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
38
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
39
|
+
while (1) switch (_context.prev = _context.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
return _context.abrupt("return", (0, _utils.downloadUrl)(downloadUrl));
|
|
42
|
+
case 1:
|
|
43
|
+
case "end":
|
|
44
|
+
return _context.stop();
|
|
45
|
+
}
|
|
46
|
+
}, _callee);
|
|
47
|
+
}));
|
|
48
|
+
function actionFn() {
|
|
49
|
+
return _actionFn.apply(this, arguments);
|
|
50
|
+
}
|
|
51
|
+
return actionFn;
|
|
52
|
+
}(),
|
|
53
|
+
// These values have already been set in analytics context.
|
|
54
|
+
// We only pass these here for ufo experience.
|
|
55
|
+
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
56
|
+
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
57
|
+
});
|
|
26
58
|
if (_onClick) {
|
|
27
59
|
_onClick();
|
|
28
60
|
}
|
|
@@ -5,15 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
var _index = _interopRequireDefault(require("../index"));
|
|
12
14
|
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
13
|
-
var _state = require("../../../../../../state");
|
|
14
15
|
var _reactIntlNext = require("react-intl-next");
|
|
15
16
|
var _messages = require("../../../../../../messages");
|
|
16
17
|
var _utils = require("../../../utils");
|
|
18
|
+
var _useInvokeClientAction = _interopRequireDefault(require("../../../../../../state/hooks/use-invoke-client-action"));
|
|
19
|
+
var _constants = require("../../../../../../constants");
|
|
17
20
|
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
21
|
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
22
|
var PreviewAction = function PreviewAction(props) {
|
|
@@ -28,23 +31,46 @@ var PreviewAction = function PreviewAction(props) {
|
|
|
28
31
|
providerName = props.providerName,
|
|
29
32
|
downloadUrl = props.downloadUrl,
|
|
30
33
|
isSupportTheming = props.isSupportTheming;
|
|
31
|
-
var
|
|
32
|
-
var
|
|
34
|
+
var analytics = (0, _flexibleUiContext.useFlexibleUiAnalyticsContext)();
|
|
35
|
+
var invoke = (0, _useInvokeClientAction.default)({
|
|
36
|
+
analytics: analytics
|
|
37
|
+
});
|
|
33
38
|
if (src && url) {
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
var actionFn = /*#__PURE__*/function () {
|
|
40
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
41
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
42
|
+
while (1) switch (_context.prev = _context.next) {
|
|
43
|
+
case 0:
|
|
44
|
+
return _context.abrupt("return", (0, _utils.openEmbedModalWithFlexibleUiIcon)({
|
|
45
|
+
download: downloadUrl,
|
|
46
|
+
title: title,
|
|
47
|
+
providerName: providerName,
|
|
48
|
+
isSupportTheming: isSupportTheming,
|
|
49
|
+
analytics: analytics,
|
|
50
|
+
linkIcon: linkIcon,
|
|
51
|
+
src: src,
|
|
52
|
+
url: url
|
|
53
|
+
}));
|
|
54
|
+
case 1:
|
|
55
|
+
case "end":
|
|
56
|
+
return _context.stop();
|
|
57
|
+
}
|
|
58
|
+
}, _callee);
|
|
59
|
+
}));
|
|
60
|
+
return function actionFn() {
|
|
61
|
+
return _ref.apply(this, arguments);
|
|
62
|
+
};
|
|
63
|
+
}();
|
|
45
64
|
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
46
65
|
onClick: function onClick() {
|
|
47
|
-
|
|
66
|
+
invoke({
|
|
67
|
+
actionType: _constants.ActionName.PreviewAction,
|
|
68
|
+
actionFn: actionFn,
|
|
69
|
+
// These values have already been set in analytics context.
|
|
70
|
+
// We only pass these here for ufo experience.
|
|
71
|
+
display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
|
|
72
|
+
extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
|
|
73
|
+
});
|
|
48
74
|
if (_onClick) {
|
|
49
75
|
_onClick();
|
|
50
76
|
}
|