@atlaskit/smart-card 32.7.0 → 32.7.1
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 +7 -0
- package/analytics.spec.yaml +63 -9
- package/dist/cjs/common/analytics/types.js +5 -0
- package/dist/cjs/extractors/action/extract-invoke-copy-link-action.js +53 -0
- package/dist/cjs/extractors/action/extract-invoke-download-action.js +57 -0
- package/dist/cjs/extractors/action/extract-invoke-preview-action.js +78 -0
- package/dist/cjs/extractors/action/extract-invoke-view-action.js +60 -0
- package/dist/cjs/extractors/action/extractDownloadActionProps.js +4 -0
- package/dist/cjs/extractors/action/extractPreviewActionProps.js +4 -0
- package/dist/cjs/extractors/action/extractViewActionProps.js +4 -0
- package/dist/cjs/extractors/action/types.js +5 -0
- package/dist/cjs/extractors/flexible/actions/extract-copy-link-action.js +12 -1
- package/dist/cjs/extractors/flexible/actions/extract-download-action.js +12 -1
- package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +12 -1
- package/dist/cjs/extractors/flexible/actions/extract-view-action.js +3 -0
- package/dist/cjs/extractors/flexible/actions/index.js +40 -3
- package/dist/cjs/extractors/flexible/extract-state.js +19 -5
- package/dist/cjs/extractors/flexible/index.js +22 -8
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +56 -17
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +22 -3
- package/dist/cjs/utils/analytics/LinkAnalyticsContext.js +7 -2
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/mocks.js +4 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +1 -0
- package/dist/cjs/view/BlockCard/views/flexible/unresolved-view/index.js +1 -0
- package/dist/cjs/view/CardWithUrl/component.js +1 -0
- package/dist/cjs/view/EmbedModal/index.js +72 -51
- package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +65 -32
- package/dist/cjs/view/FlexibleCard/components/actions/download-action/index.js +36 -28
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +40 -32
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +13 -6
- package/dist/cjs/view/FlexibleCard/components/utils.js +4 -0
- package/dist/cjs/view/FlexibleCard/index.js +11 -1
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/common/analytics/types.js +1 -0
- package/dist/es2019/extractors/action/extract-invoke-copy-link-action.js +29 -0
- package/dist/es2019/extractors/action/extract-invoke-download-action.js +31 -0
- package/dist/es2019/extractors/action/extract-invoke-preview-action.js +57 -0
- package/dist/es2019/extractors/action/extract-invoke-view-action.js +34 -0
- package/dist/es2019/extractors/action/extractDownloadActionProps.js +5 -0
- package/dist/es2019/extractors/action/extractPreviewActionProps.js +5 -0
- package/dist/es2019/extractors/action/extractViewActionProps.js +5 -0
- package/dist/es2019/extractors/action/types.js +1 -0
- package/dist/es2019/extractors/flexible/actions/extract-copy-link-action.js +11 -0
- package/dist/es2019/extractors/flexible/actions/extract-download-action.js +12 -0
- package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +12 -0
- package/dist/es2019/extractors/flexible/actions/extract-view-action.js +4 -0
- package/dist/es2019/extractors/flexible/actions/index.js +48 -3
- package/dist/es2019/extractors/flexible/extract-state.js +17 -5
- package/dist/es2019/extractors/flexible/index.js +17 -6
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +91 -43
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +21 -3
- package/dist/es2019/utils/analytics/LinkAnalyticsContext.js +3 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/mocks.js +4 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +1 -0
- package/dist/es2019/view/BlockCard/views/flexible/unresolved-view/index.js +1 -0
- package/dist/es2019/view/CardWithUrl/component.js +1 -0
- package/dist/es2019/view/EmbedModal/index.js +41 -20
- package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +31 -16
- package/dist/es2019/view/FlexibleCard/components/actions/download-action/index.js +20 -12
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +25 -17
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +14 -7
- package/dist/es2019/view/FlexibleCard/components/utils.js +4 -0
- package/dist/es2019/view/FlexibleCard/index.js +12 -1
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/common/analytics/types.js +1 -0
- package/dist/esm/extractors/action/extract-invoke-copy-link-action.js +46 -0
- package/dist/esm/extractors/action/extract-invoke-download-action.js +50 -0
- package/dist/esm/extractors/action/extract-invoke-preview-action.js +71 -0
- package/dist/esm/extractors/action/extract-invoke-view-action.js +53 -0
- package/dist/esm/extractors/action/extractDownloadActionProps.js +5 -0
- package/dist/esm/extractors/action/extractPreviewActionProps.js +5 -0
- package/dist/esm/extractors/action/extractViewActionProps.js +5 -0
- package/dist/esm/extractors/action/types.js +1 -0
- package/dist/esm/extractors/flexible/actions/extract-copy-link-action.js +11 -0
- package/dist/esm/extractors/flexible/actions/extract-download-action.js +12 -0
- package/dist/esm/extractors/flexible/actions/extract-preview-action.js +12 -0
- package/dist/esm/extractors/flexible/actions/extract-view-action.js +4 -0
- package/dist/esm/extractors/flexible/actions/index.js +42 -5
- package/dist/esm/extractors/flexible/extract-state.js +19 -5
- package/dist/esm/extractors/flexible/index.js +19 -8
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +56 -17
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +22 -3
- package/dist/esm/utils/analytics/LinkAnalyticsContext.js +7 -2
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/mocks.js +4 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +1 -0
- package/dist/esm/view/BlockCard/views/flexible/unresolved-view/index.js +1 -0
- package/dist/esm/view/CardWithUrl/component.js +1 -0
- package/dist/esm/view/EmbedModal/index.js +73 -52
- package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +65 -32
- package/dist/esm/view/FlexibleCard/components/actions/download-action/index.js +36 -28
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +40 -32
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +13 -6
- package/dist/esm/view/FlexibleCard/components/utils.js +4 -0
- package/dist/esm/view/FlexibleCard/index.js +11 -1
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -0
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/common/analytics/generated/analytics.types.d.ts +63 -2
- package/dist/types/common/analytics/types.d.ts +2 -0
- package/dist/types/extractors/action/extract-invoke-copy-link-action.d.ts +3 -0
- package/dist/types/extractors/action/extract-invoke-download-action.d.ts +3 -0
- package/dist/types/extractors/action/extract-invoke-preview-action.d.ts +11 -0
- package/dist/types/extractors/action/extract-invoke-view-action.d.ts +3 -0
- package/dist/types/extractors/action/extractDownloadActionProps.d.ts +4 -0
- package/dist/types/extractors/action/extractPreviewActionProps.d.ts +5 -1
- package/dist/types/extractors/action/extractViewActionProps.d.ts +4 -0
- package/dist/types/extractors/action/types.d.ts +9 -0
- package/dist/types/extractors/flexible/actions/extract-copy-link-action.d.ts +6 -0
- package/dist/types/extractors/flexible/actions/extract-download-action.d.ts +6 -0
- package/dist/types/extractors/flexible/actions/extract-preview-action.d.ts +6 -0
- package/dist/types/extractors/flexible/actions/extract-view-action.d.ts +3 -0
- package/dist/types/extractors/flexible/actions/index.d.ts +21 -4
- package/dist/types/extractors/flexible/extract-state.d.ts +5 -2
- package/dist/types/extractors/flexible/index.d.ts +1 -1
- package/dist/types/state/flexible-ui-context/types.d.ts +9 -3
- package/dist/types/state/hooks/use-invoke/types.d.ts +7 -1
- package/dist/types/state/hooks/use-invoke-client-action/index.d.ts +2 -2
- package/dist/types/state/hooks/use-invoke-client-action/types.d.ts +24 -2
- package/dist/types/state/hooks/use-resolve/index.d.ts +1 -0
- package/dist/types/view/EmbedModal/index.d.ts +4 -0
- package/dist/types/view/EmbedModal/types.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/types.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/utils.d.ts +3 -0
- package/dist/types/view/FlexibleCard/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/types.d.ts +12 -3
- package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +63 -2
- package/dist/types-ts4.5/common/analytics/types.d.ts +2 -0
- package/dist/types-ts4.5/extractors/action/extract-invoke-copy-link-action.d.ts +3 -0
- package/dist/types-ts4.5/extractors/action/extract-invoke-download-action.d.ts +3 -0
- package/dist/types-ts4.5/extractors/action/extract-invoke-preview-action.d.ts +11 -0
- package/dist/types-ts4.5/extractors/action/extract-invoke-view-action.d.ts +3 -0
- package/dist/types-ts4.5/extractors/action/extractDownloadActionProps.d.ts +4 -0
- package/dist/types-ts4.5/extractors/action/extractPreviewActionProps.d.ts +5 -1
- package/dist/types-ts4.5/extractors/action/extractViewActionProps.d.ts +4 -0
- package/dist/types-ts4.5/extractors/action/types.d.ts +9 -0
- package/dist/types-ts4.5/extractors/flexible/actions/extract-copy-link-action.d.ts +6 -0
- package/dist/types-ts4.5/extractors/flexible/actions/extract-download-action.d.ts +6 -0
- package/dist/types-ts4.5/extractors/flexible/actions/extract-preview-action.d.ts +6 -0
- package/dist/types-ts4.5/extractors/flexible/actions/extract-view-action.d.ts +3 -0
- package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +21 -4
- package/dist/types-ts4.5/extractors/flexible/extract-state.d.ts +5 -2
- package/dist/types-ts4.5/extractors/flexible/index.d.ts +1 -1
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +9 -3
- package/dist/types-ts4.5/state/hooks/use-invoke/types.d.ts +7 -1
- package/dist/types-ts4.5/state/hooks/use-invoke-client-action/index.d.ts +2 -2
- package/dist/types-ts4.5/state/hooks/use-invoke-client-action/types.d.ts +24 -2
- package/dist/types-ts4.5/state/hooks/use-resolve/index.d.ts +1 -0
- package/dist/types-ts4.5/view/EmbedModal/index.d.ts +8 -0
- package/dist/types-ts4.5/view/EmbedModal/types.d.ts +7 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/types.d.ts +6 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +3 -0
- package/dist/types-ts4.5/view/FlexibleCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +12 -3
- package/package.json +4 -1
|
@@ -2,6 +2,10 @@ import { extractLink } from '@atlaskit/link-extractors';
|
|
|
2
2
|
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
3
3
|
import { CardAction } from '../../../view/Card/types';
|
|
4
4
|
import { getActionsFromJsonLd } from '../../common/actions/extractActions';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
8
|
+
*/
|
|
5
9
|
export var extractViewAction = function extractViewAction(data, actionOptions) {
|
|
6
10
|
if (!canShowAction(CardAction.ViewAction, actionOptions)) {
|
|
7
11
|
return;
|
|
@@ -5,15 +5,52 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
5
5
|
import { ActionName, InternalActionName } from '../../../constants';
|
|
6
6
|
import { extractAISummaryAction } from './extract-ai-summary-action';
|
|
7
7
|
import { extractAutomationAction } from './extract-automation-action';
|
|
8
|
-
import { extractCopyLinkAction } from './extract-copy-link-action';
|
|
9
|
-
import { extractDownloadAction } from './extract-download-action';
|
|
8
|
+
import { extractCopyLinkAction, extractCopyLinkClientAction } from './extract-copy-link-action';
|
|
9
|
+
import { extractDownloadAction, extractDownloadClientAction } from './extract-download-action';
|
|
10
10
|
import extractFollowAction from './extract-follow-action';
|
|
11
|
-
import { extractPreviewAction } from './extract-preview-action';
|
|
11
|
+
import { extractPreviewAction, extractPreviewClientAction } from './extract-preview-action';
|
|
12
12
|
import { extractViewRelatedLinksAction } from './extract-view-related-links-action';
|
|
13
|
-
var
|
|
13
|
+
export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref) {
|
|
14
14
|
var _objectSpread2;
|
|
15
|
+
var actionOptions = _ref.actionOptions,
|
|
16
|
+
aiSummaryConfig = _ref.aiSummaryConfig,
|
|
17
|
+
appearance = _ref.appearance,
|
|
18
|
+
fireEvent = _ref.fireEvent,
|
|
19
|
+
id = _ref.id,
|
|
20
|
+
origin = _ref.origin,
|
|
21
|
+
response = _ref.response,
|
|
22
|
+
url = _ref.url;
|
|
23
|
+
var action = _objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, ActionName.CopyLinkAction, extractCopyLinkClientAction({
|
|
24
|
+
actionOptions: actionOptions,
|
|
25
|
+
appearance: appearance,
|
|
26
|
+
id: id,
|
|
27
|
+
response: response
|
|
28
|
+
})), _defineProperty(_objectSpread2, ActionName.DownloadAction, extractDownloadClientAction({
|
|
29
|
+
actionOptions: actionOptions,
|
|
30
|
+
appearance: appearance,
|
|
31
|
+
id: id,
|
|
32
|
+
response: response
|
|
33
|
+
})), _defineProperty(_objectSpread2, ActionName.FollowAction, extractFollowAction(response, actionOptions, id)), _defineProperty(_objectSpread2, ActionName.PreviewAction, extractPreviewClientAction({
|
|
34
|
+
actionOptions: actionOptions,
|
|
35
|
+
appearance: appearance,
|
|
36
|
+
fireEvent: fireEvent,
|
|
37
|
+
id: id,
|
|
38
|
+
origin: origin,
|
|
39
|
+
response: response
|
|
40
|
+
})), _defineProperty(_objectSpread2, ActionName.AutomationAction, extractAutomationAction(response)), _defineProperty(_objectSpread2, InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), _objectSpread2), fg('platform-smart-card-view-related-urls-action') ? _defineProperty({}, InternalActionName.ViewRelatedLinksAction, extractViewRelatedLinksAction(response)) : {});
|
|
41
|
+
return Object.values(action).some(function (value) {
|
|
42
|
+
return Boolean(value);
|
|
43
|
+
}) ? action : undefined;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
48
|
+
* Replaced with extractFlexibleCardActions()
|
|
49
|
+
*/
|
|
50
|
+
var extractActions = function extractActions(response, url, actionOptions, id, aiSummaryConfig) {
|
|
51
|
+
var _objectSpread3;
|
|
15
52
|
var data = response.data;
|
|
16
|
-
var action = _objectSpread((
|
|
53
|
+
var action = _objectSpread((_objectSpread3 = {}, _defineProperty(_objectSpread3, ActionName.CopyLinkAction, extractCopyLinkAction(data, actionOptions)), _defineProperty(_objectSpread3, ActionName.DownloadAction, extractDownloadAction(data, actionOptions)), _defineProperty(_objectSpread3, ActionName.FollowAction, extractFollowAction(response, actionOptions, id)), _defineProperty(_objectSpread3, ActionName.PreviewAction, extractPreviewAction(response, actionOptions)), _defineProperty(_objectSpread3, ActionName.AutomationAction, extractAutomationAction(response)), _defineProperty(_objectSpread3, InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), _objectSpread3), fg('platform-smart-card-view-related-urls-action') ? _defineProperty({}, InternalActionName.ViewRelatedLinksAction, extractViewRelatedLinksAction(response)) : {});
|
|
17
54
|
return Object.values(action).some(function (value) {
|
|
18
55
|
return Boolean(value);
|
|
19
56
|
}) ? action : undefined;
|
|
@@ -2,9 +2,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { extractLink } from '@atlaskit/link-extractors';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { getExtensionKey } from '../../state/helpers';
|
|
6
7
|
import { canShowAction } from '../../utils/actions/can-show-action';
|
|
7
8
|
import { CardAction } from '../../view/Card/types';
|
|
9
|
+
import { extractInvokePreviewAction } from '../action/extract-invoke-preview-action';
|
|
8
10
|
import { extractLozenge } from '../common/lozenge';
|
|
9
11
|
import { extractPreviewAction } from './actions/extract-preview-action';
|
|
10
12
|
import extractServerAction from './extract-server-action';
|
|
@@ -21,7 +23,7 @@ var toInvokeRequest = function toInvokeRequest(extensionKey, resourceIdentifiers
|
|
|
21
23
|
details: details
|
|
22
24
|
};
|
|
23
25
|
};
|
|
24
|
-
var extractAction = function extractAction(response, id) {
|
|
26
|
+
var extractAction = function extractAction(response, id, actionOptions, appearance, origin, fireEvent, resolve) {
|
|
25
27
|
var _action$dataRetrieval, _action$dataUpdateAct;
|
|
26
28
|
var extensionKey = getExtensionKey(response);
|
|
27
29
|
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
@@ -37,11 +39,23 @@ var extractAction = function extractAction(response, id) {
|
|
|
37
39
|
}
|
|
38
40
|
var read = toInvokeRequest(extensionKey, action.resourceIdentifiers, (_action$dataRetrieval = action.dataRetrievalAction) === null || _action$dataRetrieval === void 0 ? void 0 : _action$dataRetrieval.name);
|
|
39
41
|
var url = extractLink(data);
|
|
40
|
-
var previewData = response ? extractPreviewAction(response) : null;
|
|
42
|
+
var previewData = !fg('platform-smart-card-migrate-embed-modal-analytics') ? response ? extractPreviewAction(response) : null : undefined;
|
|
43
|
+
var invokePreviewAction = response && fg('platform-smart-card-migrate-embed-modal-analytics') ? extractInvokePreviewAction({
|
|
44
|
+
actionOptions: actionOptions,
|
|
45
|
+
appearance: appearance,
|
|
46
|
+
fireEvent: fireEvent,
|
|
47
|
+
id: id,
|
|
48
|
+
onClose: resolve ? function () {
|
|
49
|
+
return url && resolve(url, true);
|
|
50
|
+
} : undefined,
|
|
51
|
+
origin: origin,
|
|
52
|
+
response: response
|
|
53
|
+
}) : undefined;
|
|
41
54
|
var details = {
|
|
42
55
|
id: id,
|
|
43
56
|
url: url,
|
|
44
|
-
previewData: previewData
|
|
57
|
+
previewData: previewData,
|
|
58
|
+
invokePreviewAction: invokePreviewAction
|
|
45
59
|
};
|
|
46
60
|
var update = toInvokeRequest(extensionKey, action.resourceIdentifiers, (_action$dataUpdateAct = action.dataUpdateAction) === null || _action$dataUpdateAct === void 0 ? void 0 : _action$dataUpdateAct.name, details);
|
|
47
61
|
return read || update ? {
|
|
@@ -49,7 +63,7 @@ var extractAction = function extractAction(response, id) {
|
|
|
49
63
|
update: update
|
|
50
64
|
} : undefined;
|
|
51
65
|
};
|
|
52
|
-
var extractState = function extractState(response, actionOptions, id) {
|
|
66
|
+
var extractState = function extractState(response, actionOptions, id, appearance, origin, fireEvent, resolve) {
|
|
53
67
|
if (!response || !response.data) {
|
|
54
68
|
return;
|
|
55
69
|
}
|
|
@@ -60,7 +74,7 @@ var extractState = function extractState(response, actionOptions, id) {
|
|
|
60
74
|
if (!canShowAction(CardAction.ChangeStatusAction, actionOptions)) {
|
|
61
75
|
return lozenge;
|
|
62
76
|
}
|
|
63
|
-
var action = extractAction(response, id);
|
|
77
|
+
var action = extractAction(response, id, actionOptions, appearance, origin, fireEvent, resolve);
|
|
64
78
|
return _objectSpread(_objectSpread({}, lozenge), {}, {
|
|
65
79
|
action: action
|
|
66
80
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
var _excluded = ["id", "renderers", "actionOptions", "response", "aiSummaryConfig"];
|
|
2
|
+
var _excluded = ["appearance", "fireEvent", "id", "origin", "renderers", "resolve", "actionOptions", "response", "aiSummaryConfig"];
|
|
3
3
|
import { extractAri, extractDateCreated, extractDateUpdated, extractLink, extractPersonCreatedBy, extractPersonOwnedBy, extractTitle } from '@atlaskit/link-extractors';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { extractSummary } from '../common/primitives';
|
|
5
|
-
import extractActions from './actions';
|
|
6
|
-
import { extractViewAction } from './actions/extract-view-action';
|
|
6
|
+
import extractActions, { extractFlexibleCardActions } from './actions';
|
|
7
7
|
import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
8
8
|
import extractPreview from './extract-preview';
|
|
9
9
|
import extractPriority from './extract-priority';
|
|
@@ -14,8 +14,12 @@ import { extractLatestCommit } from './latest-commit';
|
|
|
14
14
|
import { extractAssignedTo, extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractDueOn, extractLocation, extractModifiedBy, extractOwnedBy, extractPersonAssignedToAsArray, extractProgrammingLanguage, extractReactCount, extractReadTime, extractSentOn, extractSourceBranch, extractStoryPoints, extractSubscriberCount, extractSubTasksProgress, extractTargetBranch, extractViewCount, extractVoteCount } from './utils';
|
|
15
15
|
var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
16
16
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
17
|
-
var
|
|
17
|
+
var appearance = _ref.appearance,
|
|
18
|
+
fireEvent = _ref.fireEvent,
|
|
19
|
+
id = _ref.id,
|
|
20
|
+
origin = _ref.origin,
|
|
18
21
|
renderers = _ref.renderers,
|
|
22
|
+
resolve = _ref.resolve,
|
|
19
23
|
actionOptions = _ref.actionOptions,
|
|
20
24
|
response = _ref.response,
|
|
21
25
|
aiSummaryConfig = _ref.aiSummaryConfig,
|
|
@@ -26,8 +30,16 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
26
30
|
var data = response.data;
|
|
27
31
|
var url = extractLink(data);
|
|
28
32
|
return {
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
actions: fg('platform-smart-card-migrate-embed-modal-analytics') ? extractFlexibleCardActions({
|
|
34
|
+
actionOptions: actionOptions,
|
|
35
|
+
aiSummaryConfig: aiSummaryConfig,
|
|
36
|
+
appearance: appearance,
|
|
37
|
+
fireEvent: fireEvent,
|
|
38
|
+
id: id,
|
|
39
|
+
origin: origin,
|
|
40
|
+
response: response,
|
|
41
|
+
url: props.url // Use the original URL in edge cases, such as short links for AI summary and copy link actions.
|
|
42
|
+
}) : extractActions(response, props.url, actionOptions, id, aiSummaryConfig),
|
|
31
43
|
assignedToGroup: extractPersonAssignedToAsArray(data),
|
|
32
44
|
attachmentCount: extractAttachmentCount(data),
|
|
33
45
|
authorGroup: extractPersonCreatedBy(data),
|
|
@@ -43,7 +55,6 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
43
55
|
assignedTo: extractAssignedTo(data),
|
|
44
56
|
createdOn: extractDateCreated(data),
|
|
45
57
|
dueOn: extractDueOn(data),
|
|
46
|
-
viewAction: extractViewAction(data, actionOptions),
|
|
47
58
|
latestCommit: extractLatestCommit(data),
|
|
48
59
|
linkIcon: extractLinkIcon(response, renderers),
|
|
49
60
|
location: extractLocation(data),
|
|
@@ -58,7 +69,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
58
69
|
snippet: extractSummary(data) || undefined,
|
|
59
70
|
// Explicitly set here to remove an empty string
|
|
60
71
|
sourceBranch: extractSourceBranch(data),
|
|
61
|
-
state: extractState(response, actionOptions, id),
|
|
72
|
+
state: extractState(response, actionOptions, id, appearance, origin, fireEvent, resolve),
|
|
62
73
|
subscriberCount: extractSubscriberCount(data),
|
|
63
74
|
subTasksProgress: extractSubTasksProgress(data),
|
|
64
75
|
storyPoints: extractStoryPoints(data),
|
|
@@ -2,6 +2,8 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import uuid from 'uuid';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
5
7
|
import * as measure from '../../../utils/performance';
|
|
6
8
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from '../../analytics';
|
|
7
9
|
var ACTION_EXPERIENCE_NAME = 'smart-link-action-invocation';
|
|
@@ -10,14 +12,18 @@ var ACTION_EXPERIENCE_NAME = 'smart-link-action-invocation';
|
|
|
10
12
|
* Invoke client action such as preview, download and open link
|
|
11
13
|
*/
|
|
12
14
|
var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
13
|
-
var analytics = _ref.analytics
|
|
15
|
+
var analytics = _ref.analytics,
|
|
16
|
+
fireEventProp = _ref.fireEvent;
|
|
17
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
18
|
+
defaultFireEvent = _useAnalyticsEvents.fireEvent;
|
|
19
|
+
var fireEvent = fireEventProp !== null && fireEventProp !== void 0 ? fireEventProp : defaultFireEvent;
|
|
14
20
|
return useCallback( /*#__PURE__*/function () {
|
|
15
21
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
16
|
-
var actionType, actionFn, extensionKey, display, experienceId, markName, result, reason;
|
|
22
|
+
var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, _ref2$resourceType, resourceType, experienceId, markName, result, _measure$getMeasure$d, _measure$getMeasure, reason, _measure$getMeasure$d2, _measure$getMeasure2;
|
|
17
23
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18
24
|
while (1) switch (_context.prev = _context.next) {
|
|
19
25
|
case 0:
|
|
20
|
-
actionType = _ref2.actionType, actionFn = _ref2.actionFn, extensionKey = _ref2.extensionKey, display = _ref2.display;
|
|
26
|
+
actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
|
|
21
27
|
experienceId = uuid(); // Begin performance instrumentation.
|
|
22
28
|
markName = "".concat(experienceId, "-").concat(actionType);
|
|
23
29
|
measure.mark(markName, 'pending');
|
|
@@ -31,10 +37,20 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
31
37
|
});
|
|
32
38
|
|
|
33
39
|
// Begin analytics instrumentation.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
if (actionSubjectId && fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
41
|
+
fireEvent("ui.button.clicked.".concat(actionSubjectId), {
|
|
42
|
+
actionType: actionType !== null && actionType !== void 0 ? actionType : null,
|
|
43
|
+
definitionId: definitionId,
|
|
44
|
+
display: display !== null && display !== void 0 ? display : null,
|
|
45
|
+
id: id !== null && id !== void 0 ? id : experienceId,
|
|
46
|
+
resourceType: resourceType
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
analytics === null || analytics === void 0 || analytics.ui.actionClickedEvent({
|
|
50
|
+
actionType: actionType,
|
|
51
|
+
display: display
|
|
52
|
+
});
|
|
53
|
+
}
|
|
38
54
|
|
|
39
55
|
// Invoke action
|
|
40
56
|
_context.next = 9;
|
|
@@ -43,10 +59,21 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
43
59
|
result = _context.sent;
|
|
44
60
|
measure.mark(markName, 'resolved');
|
|
45
61
|
succeedUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
63
|
+
fireEvent('operational.smartLinkAction.resolved', {
|
|
64
|
+
actionType: actionType !== null && actionType !== void 0 ? actionType : null,
|
|
65
|
+
definitionId: definitionId,
|
|
66
|
+
display: display !== null && display !== void 0 ? display : null,
|
|
67
|
+
duration: (_measure$getMeasure$d = (_measure$getMeasure = measure.getMeasure(markName, 'resolved')) === null || _measure$getMeasure === void 0 ? void 0 : _measure$getMeasure.duration) !== null && _measure$getMeasure$d !== void 0 ? _measure$getMeasure$d : null,
|
|
68
|
+
id: id !== null && id !== void 0 ? id : experienceId,
|
|
69
|
+
resourceType: resourceType
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
analytics === null || analytics === void 0 || analytics.operational.invokeSucceededEvent({
|
|
73
|
+
actionType: actionType,
|
|
74
|
+
display: display
|
|
75
|
+
});
|
|
76
|
+
}
|
|
50
77
|
return _context.abrupt("return", result);
|
|
51
78
|
case 16:
|
|
52
79
|
_context.prev = 16;
|
|
@@ -54,11 +81,23 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
54
81
|
measure.mark(markName, 'errored');
|
|
55
82
|
failUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
|
|
56
83
|
reason = typeof _context.t0 === 'string' ? _context.t0 : _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
84
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
85
|
+
fireEvent('operational.smartLinkAction.unresolved', {
|
|
86
|
+
actionType: actionType !== null && actionType !== void 0 ? actionType : null,
|
|
87
|
+
definitionId: definitionId,
|
|
88
|
+
display: display !== null && display !== void 0 ? display : null,
|
|
89
|
+
duration: (_measure$getMeasure$d2 = (_measure$getMeasure2 = measure.getMeasure(markName, 'errored')) === null || _measure$getMeasure2 === void 0 ? void 0 : _measure$getMeasure2.duration) !== null && _measure$getMeasure$d2 !== void 0 ? _measure$getMeasure$d2 : null,
|
|
90
|
+
id: id !== null && id !== void 0 ? id : experienceId,
|
|
91
|
+
reason: reason,
|
|
92
|
+
resourceType: resourceType
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
analytics === null || analytics === void 0 || analytics.operational.invokeFailedEvent({
|
|
96
|
+
actionType: actionType,
|
|
97
|
+
display: display,
|
|
98
|
+
reason: reason
|
|
99
|
+
});
|
|
100
|
+
}
|
|
62
101
|
case 22:
|
|
63
102
|
case "end":
|
|
64
103
|
return _context.stop();
|
|
@@ -68,6 +107,6 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
68
107
|
return function (_x) {
|
|
69
108
|
return _ref3.apply(this, arguments);
|
|
70
109
|
};
|
|
71
|
-
}(), [analytics === null || analytics === void 0 ? void 0 : analytics.operational, analytics === null || analytics === void 0 ? void 0 : analytics.ui]);
|
|
110
|
+
}(), [analytics === null || analytics === void 0 ? void 0 : analytics.operational, analytics === null || analytics === void 0 ? void 0 : analytics.ui, fireEvent]);
|
|
72
111
|
};
|
|
73
112
|
export default useInvokeClientAction;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import { useMemo } from 'react';
|
|
2
5
|
import uuid from 'uuid';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
8
|
+
import { extractInvokeDownloadAction } from '../../extractors/action/extract-invoke-download-action';
|
|
9
|
+
import { extractInvokePreviewAction } from '../../extractors/action/extract-invoke-preview-action';
|
|
10
|
+
import { extractInvokeViewAction } from '../../extractors/action/extract-invoke-view-action';
|
|
3
11
|
import { extractDownloadActionProps } from '../../extractors/action/extractDownloadActionProps';
|
|
4
12
|
import { extractPreviewActionProps } from '../../extractors/action/extractPreviewActionProps';
|
|
5
13
|
import { extractViewActionProps } from '../../extractors/action/extractViewActionProps';
|
|
@@ -19,6 +27,8 @@ export function useSmartLinkActions(_ref) {
|
|
|
19
27
|
}, []);
|
|
20
28
|
var linkState = useLinkState(url);
|
|
21
29
|
var linkAnalytics = useLinkAnalytics(url, id);
|
|
30
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
31
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
22
32
|
var invokeClientAction = useInvokeClientAction({
|
|
23
33
|
analytics: linkAnalytics
|
|
24
34
|
});
|
|
@@ -33,15 +43,24 @@ export function useSmartLinkActions(_ref) {
|
|
|
33
43
|
actionOptions: actionOptions
|
|
34
44
|
};
|
|
35
45
|
var actions = [];
|
|
36
|
-
var
|
|
46
|
+
var invokeParam = {
|
|
47
|
+
actionOptions: actionOptions,
|
|
48
|
+
appearance: appearance,
|
|
49
|
+
id: id,
|
|
50
|
+
response: linkState.details
|
|
51
|
+
};
|
|
52
|
+
var downloadActionProps = fg('platform-smart-card-migrate-embed-modal-analytics') ? extractInvokeDownloadAction(invokeParam) : extractDownloadActionProps(opts);
|
|
37
53
|
if (downloadActionProps) {
|
|
38
54
|
actions.push(toAction(downloadActionProps, invokeClientAction, messages.download, 'download-content'));
|
|
39
55
|
}
|
|
40
|
-
var viewActionProps = extractViewActionProps(opts);
|
|
56
|
+
var viewActionProps = fg('platform-smart-card-migrate-embed-modal-analytics') ? extractInvokeViewAction(invokeParam) : extractViewActionProps(opts);
|
|
41
57
|
if (viewActionProps) {
|
|
42
58
|
actions.push(toAction(viewActionProps, invokeClientAction, messages.view, 'view-content'));
|
|
43
59
|
}
|
|
44
|
-
var previewActionProps =
|
|
60
|
+
var previewActionProps = fg('platform-smart-card-migrate-embed-modal-analytics') ? extractInvokePreviewAction(_objectSpread(_objectSpread({}, invokeParam), {}, {
|
|
61
|
+
fireEvent: fireEvent,
|
|
62
|
+
origin: origin
|
|
63
|
+
})) : extractPreviewActionProps(opts);
|
|
45
64
|
if (previewActionProps) {
|
|
46
65
|
actions.push(toAction(previewActionProps, invokeClientAction, messages.preview_improved, 'preview-content'));
|
|
47
66
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import React from 'react';
|
|
2
5
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { context } from './analytics';
|
|
3
8
|
/**
|
|
4
9
|
* Provides an analytics context to supply attributes to events based on a URL
|
|
5
10
|
*/
|
|
@@ -12,11 +17,11 @@ export var LinkAnalyticsContext = function LinkAnalyticsContext(_ref) {
|
|
|
12
17
|
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
13
18
|
data: {
|
|
14
19
|
source: source,
|
|
15
|
-
attributes: {
|
|
20
|
+
attributes: _objectSpread(_objectSpread({}, fg('platform-smart-card-migrate-embed-modal-analytics') ? context : {}), {}, {
|
|
16
21
|
displayCategory: displayCategory,
|
|
17
22
|
display: display,
|
|
18
23
|
id: id
|
|
19
|
-
}
|
|
24
|
+
})
|
|
20
25
|
}
|
|
21
26
|
}, children);
|
|
22
27
|
};
|
|
@@ -10,7 +10,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
10
10
|
export var context = {
|
|
11
11
|
componentName: 'smart-cards',
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "32.7.
|
|
13
|
+
packageVersion: "32.7.1"
|
|
14
14
|
};
|
|
15
15
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
16
16
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
package/dist/esm/utils/mocks.js
CHANGED
|
@@ -28,7 +28,10 @@ export var mockByUrl = function mockByUrl(url) {
|
|
|
28
28
|
access: 'granted',
|
|
29
29
|
auth: [],
|
|
30
30
|
definitionId: 'd1',
|
|
31
|
-
key: 'object-provider'
|
|
31
|
+
key: 'object-provider',
|
|
32
|
+
resourceType: 'object-resource',
|
|
33
|
+
subproduct: 'object-subproduct',
|
|
34
|
+
product: 'object-product'
|
|
32
35
|
},
|
|
33
36
|
data: {
|
|
34
37
|
'@context': {
|
|
@@ -198,6 +198,7 @@ function Component(_ref) {
|
|
|
198
198
|
cardState: cardState,
|
|
199
199
|
onAuthorize: services.length && handleAuthorize || undefined,
|
|
200
200
|
onClick: handleClickWrapper,
|
|
201
|
+
origin: "smartLinkCard",
|
|
201
202
|
renderers: renderers,
|
|
202
203
|
ui: ui,
|
|
203
204
|
showHoverPreview: showHoverPreview,
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
5
|
import React, { useCallback, useRef, useState } from 'react';
|
|
5
6
|
import ModalDialog, { ModalBody, ModalTransition } from '@atlaskit/modal-dialog';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
8
|
import { useThemeObserver } from '@atlaskit/tokens';
|
|
7
|
-
import { ActionName, CardDisplay } from '../../constants';
|
|
9
|
+
import { ActionName, CardDisplay, SmartLinkSize } from '../../constants';
|
|
8
10
|
import useInvokeClientAction from '../../state/hooks/use-invoke-client-action';
|
|
9
11
|
import { downloadUrl, getPreviewUrlWithTheme, openUrl } from '../../utils';
|
|
12
|
+
import Icon from '../FlexibleCard/components/elements/icon';
|
|
10
13
|
import withAnalytics from './components/analytics';
|
|
11
14
|
import EmbedContent from './components/embed-content';
|
|
12
15
|
import withErrorBoundary from './components/error-boundary';
|
|
@@ -22,12 +25,15 @@ var toWidth = function toWidth(size) {
|
|
|
22
25
|
var EmbedModal = function EmbedModal(_ref) {
|
|
23
26
|
var analytics = _ref.analytics,
|
|
24
27
|
download = _ref.download,
|
|
28
|
+
invokeDownloadAction = _ref.invokeDownloadAction,
|
|
25
29
|
extensionKey = _ref.extensionKey,
|
|
30
|
+
fireEvent = _ref.fireEvent,
|
|
26
31
|
icon = _ref.icon,
|
|
27
32
|
iframeName = _ref.iframeName,
|
|
28
33
|
isSupportTheming = _ref.isSupportTheming,
|
|
29
34
|
_ref$isTrusted = _ref.isTrusted,
|
|
30
35
|
isTrusted = _ref$isTrusted === void 0 ? false : _ref$isTrusted,
|
|
36
|
+
linkIcon = _ref.linkIcon,
|
|
31
37
|
onClose = _ref.onClose,
|
|
32
38
|
onOpen = _ref.onOpen,
|
|
33
39
|
onResize = _ref.onResize,
|
|
@@ -39,7 +45,8 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
39
45
|
_ref$testId = _ref.testId,
|
|
40
46
|
testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
|
|
41
47
|
title = _ref.title,
|
|
42
|
-
url = _ref.url
|
|
48
|
+
url = _ref.url,
|
|
49
|
+
invokeViewAction = _ref.invokeViewAction;
|
|
43
50
|
var defaultWidth = toWidth(size);
|
|
44
51
|
var _useState = useState(showModal),
|
|
45
52
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -51,7 +58,8 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
51
58
|
setWidth = _useState4[1];
|
|
52
59
|
var openAt = useRef();
|
|
53
60
|
var invoke = useInvokeClientAction({
|
|
54
|
-
analytics: analytics
|
|
61
|
+
analytics: analytics,
|
|
62
|
+
fireEvent: fireEvent
|
|
55
63
|
});
|
|
56
64
|
var handleOnOpenComplete = useCallback(function () {
|
|
57
65
|
openAt.current = Date.now();
|
|
@@ -85,53 +93,61 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
85
93
|
var themeState = useThemeObserver();
|
|
86
94
|
var previewUrl = src;
|
|
87
95
|
var handleOnViewActionClick = useCallback(function () {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
96
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
97
|
+
invokeViewAction && invoke(invokeViewAction);
|
|
98
|
+
} else {
|
|
99
|
+
invoke({
|
|
100
|
+
actionType: 'ViewAction',
|
|
101
|
+
actionFn: function () {
|
|
102
|
+
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
103
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
104
|
+
while (1) switch (_context.prev = _context.next) {
|
|
105
|
+
case 0:
|
|
106
|
+
return _context.abrupt("return", openUrl(url));
|
|
107
|
+
case 1:
|
|
108
|
+
case "end":
|
|
109
|
+
return _context.stop();
|
|
110
|
+
}
|
|
111
|
+
}, _callee);
|
|
112
|
+
}));
|
|
113
|
+
function actionFn() {
|
|
114
|
+
return _actionFn.apply(this, arguments);
|
|
115
|
+
}
|
|
116
|
+
return actionFn;
|
|
117
|
+
}(),
|
|
118
|
+
display: CardDisplay.EmbedPreview,
|
|
119
|
+
extensionKey: extensionKey
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}, [extensionKey, invoke, url, invokeViewAction]);
|
|
111
123
|
var handleOnDownloadActionClick = useCallback(function () {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
124
|
+
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
125
|
+
invokeDownloadAction && invoke(invokeDownloadAction);
|
|
126
|
+
} else {
|
|
127
|
+
invoke({
|
|
128
|
+
actionType: ActionName.DownloadAction,
|
|
129
|
+
actionFn: function () {
|
|
130
|
+
var _actionFn2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
131
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
132
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
133
|
+
case 0:
|
|
134
|
+
return _context2.abrupt("return", downloadUrl(download));
|
|
135
|
+
case 1:
|
|
136
|
+
case "end":
|
|
137
|
+
return _context2.stop();
|
|
138
|
+
}
|
|
139
|
+
}, _callee2);
|
|
140
|
+
}));
|
|
141
|
+
function actionFn() {
|
|
142
|
+
return _actionFn2.apply(this, arguments);
|
|
143
|
+
}
|
|
144
|
+
return actionFn;
|
|
145
|
+
}(),
|
|
146
|
+
display: CardDisplay.EmbedPreview,
|
|
147
|
+
extensionKey: extensionKey
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}, [download, invokeDownloadAction, extensionKey, invoke]);
|
|
135
151
|
if (previewUrl && isSupportTheming) {
|
|
136
152
|
previewUrl = getPreviewUrlWithTheme(previewUrl, themeState);
|
|
137
153
|
}
|
|
@@ -143,10 +159,15 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
143
159
|
testId: testId,
|
|
144
160
|
width: width
|
|
145
161
|
}, /*#__PURE__*/React.createElement(LinkInfo, {
|
|
146
|
-
icon:
|
|
162
|
+
icon: fg('platform-smart-card-migrate-embed-modal-analytics') ? linkIcon ? {
|
|
163
|
+
icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
|
|
164
|
+
size: SmartLinkSize.Large
|
|
165
|
+
})),
|
|
166
|
+
isFlexibleUi: true
|
|
167
|
+
} : undefined : icon,
|
|
147
168
|
providerName: providerName,
|
|
148
|
-
onViewButtonClick: url ? handleOnViewActionClick : undefined,
|
|
149
|
-
onDownloadButtonClick: download ? handleOnDownloadActionClick : undefined,
|
|
169
|
+
onViewButtonClick: fg('platform-smart-card-migrate-embed-modal-analytics') ? invokeViewAction ? handleOnViewActionClick : undefined : url ? handleOnViewActionClick : undefined,
|
|
170
|
+
onDownloadButtonClick: fg('platform-smart-card-migrate-embed-modal-analytics') ? invokeDownloadAction ? handleOnDownloadActionClick : undefined : download ? handleOnDownloadActionClick : undefined,
|
|
150
171
|
onResizeButtonClick: handleOnResizeClick,
|
|
151
172
|
size: width,
|
|
152
173
|
title: title,
|