@atlaskit/smart-card 32.6.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 +19 -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 +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 32.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6b8061fe8600e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b8061fe8600e) -
|
|
8
|
+
Refactoring invoke client actions and analytics
|
|
9
|
+
|
|
10
|
+
## 32.7.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [#175432](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/175432)
|
|
15
|
+
[`ae52ae7c25a20`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ae52ae7c25a20) -
|
|
16
|
+
Migrate to new icons behind feature flag.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 32.6.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/analytics.spec.yaml
CHANGED
|
@@ -14,10 +14,6 @@ context:
|
|
|
14
14
|
type: string
|
|
15
15
|
required: false
|
|
16
16
|
description: The provider identifier of the resolver that was used to resolve the link
|
|
17
|
-
resourceType:
|
|
18
|
-
required: false
|
|
19
|
-
type: string
|
|
20
|
-
description: Type of resource the link is pointing to
|
|
21
17
|
destinationObjectType:
|
|
22
18
|
type: string
|
|
23
19
|
required: false
|
|
@@ -121,10 +117,6 @@ context:
|
|
|
121
117
|
required: false
|
|
122
118
|
type: string
|
|
123
119
|
description: Where the Smart Link is currently rendered
|
|
124
|
-
resourceType:
|
|
125
|
-
required: false
|
|
126
|
-
type: string
|
|
127
|
-
description: Type of resource the link is pointing to
|
|
128
120
|
|
|
129
121
|
attributes:
|
|
130
122
|
AiInteractionAttributes: &AiInteractionAttributes
|
|
@@ -158,8 +150,48 @@ attributes:
|
|
|
158
150
|
'StatusUpdate',
|
|
159
151
|
]
|
|
160
152
|
description: The type of action being invoked
|
|
161
|
-
|
|
153
|
+
ClientActionAttributes: &ClientActionAttributes
|
|
154
|
+
actionType:
|
|
155
|
+
required: false
|
|
156
|
+
type: string
|
|
157
|
+
description: The type of action being invoked.
|
|
158
|
+
id:
|
|
159
|
+
required: false
|
|
160
|
+
type: string
|
|
161
|
+
description: The unique ID for this Smart Link.
|
|
162
|
+
definitionId:
|
|
163
|
+
type: string
|
|
164
|
+
required: false
|
|
165
|
+
description: The definitionId of the Smart Link resolver invoked.
|
|
166
|
+
display:
|
|
167
|
+
required: false
|
|
168
|
+
type: [ 'inline', 'block', 'embed', 'embedPreview', 'flexible', 'hoverCardPreview' ]
|
|
169
|
+
description: Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
170
|
+
resourceType:
|
|
171
|
+
required: false
|
|
172
|
+
type: string
|
|
173
|
+
description: Type of resource the link is pointing to
|
|
162
174
|
events:
|
|
175
|
+
- button clicked (copyLink):
|
|
176
|
+
type: ui
|
|
177
|
+
description: Fired when an copy link is clicked
|
|
178
|
+
attributes:
|
|
179
|
+
<<: [*PackageMetaDataContext, *ResolvedContext, *ClientActionAttributes]
|
|
180
|
+
- button clicked (downloadDocument):
|
|
181
|
+
type: ui
|
|
182
|
+
description: Fired when an download is clicked
|
|
183
|
+
attributes:
|
|
184
|
+
<<: [*PackageMetaDataContext, *ResolvedContext, *ClientActionAttributes ]
|
|
185
|
+
- button clicked (invokePreviewScreen):
|
|
186
|
+
type: ui
|
|
187
|
+
description: Fired when an preview is clicked
|
|
188
|
+
attributes:
|
|
189
|
+
<<: [ *PackageMetaDataContext, *ResolvedContext, *ClientActionAttributes ]
|
|
190
|
+
- button clicked (shortcutGoToLink):
|
|
191
|
+
type: ui
|
|
192
|
+
description: Fired when an view link is clicked
|
|
193
|
+
attributes:
|
|
194
|
+
<<: [*PackageMetaDataContext, *ResolvedContext, *ClientActionAttributes ]
|
|
163
195
|
- button clicked (aiSummary):
|
|
164
196
|
type: ui
|
|
165
197
|
description: fired when an ai summary is clicked
|
|
@@ -444,6 +476,28 @@ events:
|
|
|
444
476
|
required: true
|
|
445
477
|
description: Additional details about the error including the stack trace.
|
|
446
478
|
type: object
|
|
479
|
+
- smartLinkAction resolved:
|
|
480
|
+
type: operational
|
|
481
|
+
description: Fires an event when a Smart Link action is successfully resolved.
|
|
482
|
+
attributes:
|
|
483
|
+
<<: [*PackageMetaDataContext, *ResolvedContext, *ClientActionAttributes]
|
|
484
|
+
duration:
|
|
485
|
+
required: false
|
|
486
|
+
type: number
|
|
487
|
+
description: Total time the action take to complete its invocation
|
|
488
|
+
- smartLinkAction unresolved:
|
|
489
|
+
type: operational
|
|
490
|
+
description: Fires an event when a Smart Link action is failed to resolved.
|
|
491
|
+
attributes:
|
|
492
|
+
<<: [*PackageMetaDataContext, *ResolvedContext, *ClientActionAttributes]
|
|
493
|
+
duration:
|
|
494
|
+
required: false
|
|
495
|
+
type: number
|
|
496
|
+
description: Total time the action take to complete its invocation
|
|
497
|
+
reason:
|
|
498
|
+
required: false
|
|
499
|
+
type: string
|
|
500
|
+
description: Failure reason
|
|
447
501
|
- smartLink clicked:
|
|
448
502
|
type: ui
|
|
449
503
|
description: fires an event that represents when a user clicks on a Smart Link.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.extractInvokeCopyLinkAction = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
11
|
+
var _index = require("../../index");
|
|
12
|
+
var _helpers = require("../../state/helpers");
|
|
13
|
+
var _canShowAction = require("../../utils/actions/can-show-action");
|
|
14
|
+
var extractInvokeCopyLinkAction = exports.extractInvokeCopyLinkAction = function extractInvokeCopyLinkAction(_ref) {
|
|
15
|
+
var actionOptions = _ref.actionOptions,
|
|
16
|
+
appearance = _ref.appearance,
|
|
17
|
+
id = _ref.id,
|
|
18
|
+
response = _ref.response;
|
|
19
|
+
if (!(0, _canShowAction.canShowAction)(_index.CardAction.CopyLinkAction, actionOptions)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
var data = response.data;
|
|
23
|
+
var url = (0, _linkExtractors.extractLink)(data);
|
|
24
|
+
if (!url) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
actionFn: function () {
|
|
29
|
+
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
30
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
31
|
+
while (1) switch (_context.prev = _context.next) {
|
|
32
|
+
case 0:
|
|
33
|
+
return _context.abrupt("return", navigator.clipboard.writeText(url));
|
|
34
|
+
case 1:
|
|
35
|
+
case "end":
|
|
36
|
+
return _context.stop();
|
|
37
|
+
}
|
|
38
|
+
}, _callee);
|
|
39
|
+
}));
|
|
40
|
+
function actionFn() {
|
|
41
|
+
return _actionFn.apply(this, arguments);
|
|
42
|
+
}
|
|
43
|
+
return actionFn;
|
|
44
|
+
}(),
|
|
45
|
+
actionSubjectId: 'copyLink',
|
|
46
|
+
actionType: _index.ActionName.CopyLinkAction,
|
|
47
|
+
definitionId: (0, _helpers.getDefinitionId)(response),
|
|
48
|
+
display: appearance,
|
|
49
|
+
extensionKey: (0, _helpers.getExtensionKey)(response),
|
|
50
|
+
id: id,
|
|
51
|
+
resourceType: (0, _helpers.getResourceType)(response)
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.extractInvokeDownloadAction = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _index = require("../../index");
|
|
11
|
+
var _helpers = require("../../state/helpers");
|
|
12
|
+
var _utils = require("../../utils");
|
|
13
|
+
var _canShowAction = require("../../utils/actions/can-show-action");
|
|
14
|
+
var _extractActions = require("../common/actions/extractActions");
|
|
15
|
+
var _detail = require("../common/detail");
|
|
16
|
+
var extractInvokeDownloadAction = exports.extractInvokeDownloadAction = function extractInvokeDownloadAction(_ref) {
|
|
17
|
+
var actionOptions = _ref.actionOptions,
|
|
18
|
+
appearance = _ref.appearance,
|
|
19
|
+
id = _ref.id,
|
|
20
|
+
response = _ref.response;
|
|
21
|
+
if (!(0, _canShowAction.canShowAction)(_index.CardAction.DownloadAction, actionOptions)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
var data = response.data;
|
|
25
|
+
var downloadActionExists = (0, _extractActions.getActionsFromJsonLd)(data).find(function (action) {
|
|
26
|
+
return action['@type'] === 'DownloadAction';
|
|
27
|
+
});
|
|
28
|
+
if (downloadActionExists) {
|
|
29
|
+
var downloadUrl = (0, _detail.extractDownloadUrl)(data);
|
|
30
|
+
return {
|
|
31
|
+
actionFn: function () {
|
|
32
|
+
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
33
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
34
|
+
while (1) switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
return _context.abrupt("return", (0, _utils.downloadUrl)(downloadUrl));
|
|
37
|
+
case 1:
|
|
38
|
+
case "end":
|
|
39
|
+
return _context.stop();
|
|
40
|
+
}
|
|
41
|
+
}, _callee);
|
|
42
|
+
}));
|
|
43
|
+
function actionFn() {
|
|
44
|
+
return _actionFn.apply(this, arguments);
|
|
45
|
+
}
|
|
46
|
+
return actionFn;
|
|
47
|
+
}(),
|
|
48
|
+
actionSubjectId: 'downloadDocument',
|
|
49
|
+
actionType: _index.ActionName.DownloadAction,
|
|
50
|
+
definitionId: (0, _helpers.getDefinitionId)(response),
|
|
51
|
+
display: appearance,
|
|
52
|
+
extensionKey: (0, _helpers.getExtensionKey)(response),
|
|
53
|
+
id: id,
|
|
54
|
+
resourceType: (0, _helpers.getResourceType)(response)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.extractInvokePreviewAction = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
11
|
+
var _index = require("../../index");
|
|
12
|
+
var _helpers = require("../../state/helpers");
|
|
13
|
+
var _canShowAction = require("../../utils/actions/can-show-action");
|
|
14
|
+
var _utils = require("../../view/EmbedModal/utils");
|
|
15
|
+
var _extractIsSupportTheming = require("../common/meta/extractIsSupportTheming");
|
|
16
|
+
var _extractIsTrusted = require("../common/meta/extractIsTrusted");
|
|
17
|
+
var _icon = require("../flexible/icon");
|
|
18
|
+
var _extractInvokeDownloadAction = require("./extract-invoke-download-action");
|
|
19
|
+
var _extractInvokeViewAction = require("./extract-invoke-view-action");
|
|
20
|
+
var extractInvokePreviewAction = exports.extractInvokePreviewAction = function extractInvokePreviewAction(param) {
|
|
21
|
+
var _extractPreviewData;
|
|
22
|
+
var actionOptions = param.actionOptions,
|
|
23
|
+
display = param.appearance,
|
|
24
|
+
fireEvent = param.fireEvent,
|
|
25
|
+
onClose = param.onClose,
|
|
26
|
+
id = param.id,
|
|
27
|
+
origin = param.origin,
|
|
28
|
+
response = param.response;
|
|
29
|
+
if (!(0, _canShowAction.canShowAction)(_index.CardAction.PreviewAction, actionOptions)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
var data = response.data;
|
|
33
|
+
var meta = response.meta;
|
|
34
|
+
var src = (_extractPreviewData = (0, _linkExtractors.extractPreview)(data, 'web')) === null || _extractPreviewData === void 0 ? void 0 : _extractPreviewData.src;
|
|
35
|
+
if (src) {
|
|
36
|
+
var url = (0, _linkExtractors.extractLink)(data);
|
|
37
|
+
return {
|
|
38
|
+
actionFn: function () {
|
|
39
|
+
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
40
|
+
var _extractProvider;
|
|
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.openEmbedModal)({
|
|
45
|
+
fireEvent: fireEvent,
|
|
46
|
+
invokeDownloadAction: (0, _extractInvokeDownloadAction.extractInvokeDownloadAction)(param),
|
|
47
|
+
isSupportTheming: (0, _extractIsSupportTheming.extractIsSupportTheming)(meta),
|
|
48
|
+
isTrusted: (0, _extractIsTrusted.extractIsTrusted)(meta),
|
|
49
|
+
linkIcon: (0, _icon.extractLinkIcon)(response),
|
|
50
|
+
providerName: (_extractProvider = (0, _linkExtractors.extractProvider)(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text,
|
|
51
|
+
onClose: onClose,
|
|
52
|
+
origin: origin,
|
|
53
|
+
src: src,
|
|
54
|
+
title: (0, _linkExtractors.extractTitle)(data),
|
|
55
|
+
url: url,
|
|
56
|
+
invokeViewAction: (0, _extractInvokeViewAction.extractInvokeViewAction)(param, true)
|
|
57
|
+
}));
|
|
58
|
+
case 1:
|
|
59
|
+
case "end":
|
|
60
|
+
return _context.stop();
|
|
61
|
+
}
|
|
62
|
+
}, _callee);
|
|
63
|
+
}));
|
|
64
|
+
function actionFn() {
|
|
65
|
+
return _actionFn.apply(this, arguments);
|
|
66
|
+
}
|
|
67
|
+
return actionFn;
|
|
68
|
+
}(),
|
|
69
|
+
actionSubjectId: 'invokePreviewScreen',
|
|
70
|
+
actionType: _index.ActionName.PreviewAction,
|
|
71
|
+
definitionId: (0, _helpers.getDefinitionId)(response),
|
|
72
|
+
display: display,
|
|
73
|
+
extensionKey: (0, _helpers.getExtensionKey)(response),
|
|
74
|
+
id: id,
|
|
75
|
+
resourceType: (0, _helpers.getResourceType)(response)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.extractInvokeViewAction = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
11
|
+
var _index = require("../../index");
|
|
12
|
+
var _helpers = require("../../state/helpers");
|
|
13
|
+
var _utils = require("../../utils");
|
|
14
|
+
var _canShowAction = require("../../utils/actions/can-show-action");
|
|
15
|
+
var _extractActions = require("../common/actions/extractActions");
|
|
16
|
+
var extractInvokeViewAction = exports.extractInvokeViewAction = function extractInvokeViewAction(_ref, force) {
|
|
17
|
+
var actionOptions = _ref.actionOptions,
|
|
18
|
+
appearance = _ref.appearance,
|
|
19
|
+
id = _ref.id,
|
|
20
|
+
response = _ref.response;
|
|
21
|
+
if (!(0, _canShowAction.canShowAction)(_index.CardAction.ViewAction, actionOptions)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
var data = response.data;
|
|
25
|
+
if (!data) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
var url = (0, _linkExtractors.extractLink)(data);
|
|
29
|
+
var viewActionExists = (0, _extractActions.getActionsFromJsonLd)(data).find(function (action) {
|
|
30
|
+
return action['@type'] === 'ViewAction';
|
|
31
|
+
});
|
|
32
|
+
if (url && (viewActionExists || force)) {
|
|
33
|
+
return {
|
|
34
|
+
actionFn: function () {
|
|
35
|
+
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
36
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
37
|
+
while (1) switch (_context.prev = _context.next) {
|
|
38
|
+
case 0:
|
|
39
|
+
return _context.abrupt("return", (0, _utils.openUrl)(url));
|
|
40
|
+
case 1:
|
|
41
|
+
case "end":
|
|
42
|
+
return _context.stop();
|
|
43
|
+
}
|
|
44
|
+
}, _callee);
|
|
45
|
+
}));
|
|
46
|
+
function actionFn() {
|
|
47
|
+
return _actionFn.apply(this, arguments);
|
|
48
|
+
}
|
|
49
|
+
return actionFn;
|
|
50
|
+
}(),
|
|
51
|
+
actionSubjectId: 'shortcutGoToLink',
|
|
52
|
+
actionType: 'ViewAction',
|
|
53
|
+
definitionId: (0, _helpers.getDefinitionId)(response),
|
|
54
|
+
display: appearance,
|
|
55
|
+
extensionKey: (0, _helpers.getExtensionKey)(response),
|
|
56
|
+
id: id,
|
|
57
|
+
resourceType: (0, _helpers.getResourceType)(response)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
};
|
|
@@ -7,6 +7,10 @@ exports.extractDownloadActionProps = void 0;
|
|
|
7
7
|
var _constants = require("../../constants");
|
|
8
8
|
var _utils = require("../../utils");
|
|
9
9
|
var _extractDownloadAction = require("../flexible/actions/extract-download-action");
|
|
10
|
+
/**
|
|
11
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
12
|
+
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-download-action.ts
|
|
13
|
+
*/
|
|
10
14
|
var extractDownloadActionProps = exports.extractDownloadActionProps = function extractDownloadActionProps(_ref) {
|
|
11
15
|
var response = _ref.response,
|
|
12
16
|
actionOptions = _ref.actionOptions,
|
|
@@ -11,6 +11,10 @@ var _utils = require("../../view/EmbedModal/utils");
|
|
|
11
11
|
var _extractPreviewAction = require("../flexible/actions/extract-preview-action");
|
|
12
12
|
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; }
|
|
13
13
|
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; }
|
|
14
|
+
/**
|
|
15
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
16
|
+
* Replaced with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-preview-action.ts
|
|
17
|
+
*/
|
|
14
18
|
var extractPreviewActionProps = exports.extractPreviewActionProps = function extractPreviewActionProps(_ref) {
|
|
15
19
|
var response = _ref.response,
|
|
16
20
|
analytics = _ref.analytics,
|
|
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.extractViewActionProps = void 0;
|
|
7
7
|
var _utils = require("../../utils");
|
|
8
8
|
var _extractViewAction = require("../flexible/actions/extract-view-action");
|
|
9
|
+
/**
|
|
10
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
11
|
+
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-view-action.ts
|
|
12
|
+
*/
|
|
9
13
|
var extractViewActionProps = exports.extractViewActionProps = function extractViewActionProps(_ref) {
|
|
10
14
|
var response = _ref.response,
|
|
11
15
|
actionOptions = _ref.actionOptions,
|
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.extractCopyLinkAction = void 0;
|
|
6
|
+
exports.extractCopyLinkClientAction = exports.extractCopyLinkAction = void 0;
|
|
7
7
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
8
8
|
var _canShowAction = require("../../../utils/actions/can-show-action");
|
|
9
9
|
var _types = require("../../../view/Card/types");
|
|
10
|
+
var _extractInvokeCopyLinkAction = require("../../action/extract-invoke-copy-link-action");
|
|
11
|
+
/**
|
|
12
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
13
|
+
* Replaced with extractCopyLinkClientAction()
|
|
14
|
+
*/
|
|
10
15
|
var extractCopyLinkAction = exports.extractCopyLinkAction = function extractCopyLinkAction(data, actionOptions) {
|
|
11
16
|
if (!(0, _canShowAction.canShowAction)(_types.CardAction.CopyLinkAction, actionOptions)) {
|
|
12
17
|
return;
|
|
@@ -18,4 +23,10 @@ var extractCopyLinkAction = exports.extractCopyLinkAction = function extractCopy
|
|
|
18
23
|
return {
|
|
19
24
|
url: url
|
|
20
25
|
};
|
|
26
|
+
};
|
|
27
|
+
var extractCopyLinkClientAction = exports.extractCopyLinkClientAction = function extractCopyLinkClientAction(param) {
|
|
28
|
+
var invokeAction = (0, _extractInvokeCopyLinkAction.extractInvokeCopyLinkAction)(param);
|
|
29
|
+
return invokeAction ? {
|
|
30
|
+
invokeAction: invokeAction
|
|
31
|
+
} : undefined;
|
|
21
32
|
};
|
|
@@ -3,11 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.extractDownloadAction = void 0;
|
|
6
|
+
exports.extractDownloadClientAction = exports.extractDownloadAction = void 0;
|
|
7
7
|
var _canShowAction = require("../../../utils/actions/can-show-action");
|
|
8
8
|
var _types = require("../../../view/Card/types");
|
|
9
|
+
var _extractInvokeDownloadAction = require("../../action/extract-invoke-download-action");
|
|
9
10
|
var _extractActions = require("../../common/actions/extractActions");
|
|
10
11
|
var _detail = require("../../common/detail");
|
|
12
|
+
/**
|
|
13
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
14
|
+
* Replaced with extractDownloadClientAction()
|
|
15
|
+
*/
|
|
11
16
|
var extractDownloadAction = exports.extractDownloadAction = function extractDownloadAction(data, actionOptions) {
|
|
12
17
|
if (!(0, _canShowAction.canShowAction)(_types.CardAction.DownloadAction, actionOptions)) {
|
|
13
18
|
return;
|
|
@@ -21,4 +26,10 @@ var extractDownloadAction = exports.extractDownloadAction = function extractDown
|
|
|
21
26
|
};
|
|
22
27
|
}
|
|
23
28
|
return;
|
|
29
|
+
};
|
|
30
|
+
var extractDownloadClientAction = exports.extractDownloadClientAction = function extractDownloadClientAction(param) {
|
|
31
|
+
var invokeAction = (0, _extractInvokeDownloadAction.extractInvokeDownloadAction)(param);
|
|
32
|
+
return invokeAction ? {
|
|
33
|
+
invokeAction: invokeAction
|
|
34
|
+
} : undefined;
|
|
24
35
|
};
|
|
@@ -3,14 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.extractPreviewAction = void 0;
|
|
6
|
+
exports.extractPreviewClientAction = exports.extractPreviewAction = void 0;
|
|
7
7
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
8
8
|
var _canShowAction = require("../../../utils/actions/can-show-action");
|
|
9
9
|
var _types = require("../../../view/Card/types");
|
|
10
|
+
var _extractInvokePreviewAction = require("../../action/extract-invoke-preview-action");
|
|
10
11
|
var _detail = require("../../common/detail");
|
|
11
12
|
var _extractIsSupportTheming = require("../../common/meta/extractIsSupportTheming");
|
|
12
13
|
var _extractIsTrusted = require("../../common/meta/extractIsTrusted");
|
|
13
14
|
var _icon = require("../icon");
|
|
15
|
+
/**
|
|
16
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
17
|
+
* Replaced with extractPreviewClientAction()
|
|
18
|
+
*/
|
|
14
19
|
var extractPreviewAction = exports.extractPreviewAction = function extractPreviewAction(response, actionOptions) {
|
|
15
20
|
var _extractPreviewData;
|
|
16
21
|
if (!(0, _canShowAction.canShowAction)(_types.CardAction.PreviewAction, actionOptions)) {
|
|
@@ -32,4 +37,10 @@ var extractPreviewAction = exports.extractPreviewAction = function extractPrevie
|
|
|
32
37
|
isTrusted: (0, _extractIsTrusted.extractIsTrusted)(meta)
|
|
33
38
|
};
|
|
34
39
|
}
|
|
40
|
+
};
|
|
41
|
+
var extractPreviewClientAction = exports.extractPreviewClientAction = function extractPreviewClientAction(param) {
|
|
42
|
+
var invokeAction = (0, _extractInvokePreviewAction.extractInvokePreviewAction)(param);
|
|
43
|
+
return invokeAction ? {
|
|
44
|
+
invokeAction: invokeAction
|
|
45
|
+
} : undefined;
|
|
35
46
|
};
|
|
@@ -8,6 +8,9 @@ var _linkExtractors = require("@atlaskit/link-extractors");
|
|
|
8
8
|
var _canShowAction = require("../../../utils/actions/can-show-action");
|
|
9
9
|
var _types = require("../../../view/Card/types");
|
|
10
10
|
var _extractActions = require("../../common/actions/extractActions");
|
|
11
|
+
/**
|
|
12
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
13
|
+
*/
|
|
11
14
|
var extractViewAction = exports.extractViewAction = function extractViewAction(data, actionOptions) {
|
|
12
15
|
if (!(0, _canShowAction.canShowAction)(_types.CardAction.ViewAction, actionOptions)) {
|
|
13
16
|
return;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default = void 0;
|
|
7
|
+
exports.extractFlexibleCardActions = exports.default = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
10
|
var _constants = require("../../../constants");
|
|
@@ -17,10 +17,47 @@ var _extractPreviewAction = require("./extract-preview-action");
|
|
|
17
17
|
var _extractViewRelatedLinksAction = require("./extract-view-related-links-action");
|
|
18
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; }
|
|
19
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; }
|
|
20
|
-
var
|
|
20
|
+
var extractFlexibleCardActions = exports.extractFlexibleCardActions = function extractFlexibleCardActions(_ref) {
|
|
21
21
|
var _objectSpread2;
|
|
22
|
+
var actionOptions = _ref.actionOptions,
|
|
23
|
+
aiSummaryConfig = _ref.aiSummaryConfig,
|
|
24
|
+
appearance = _ref.appearance,
|
|
25
|
+
fireEvent = _ref.fireEvent,
|
|
26
|
+
id = _ref.id,
|
|
27
|
+
origin = _ref.origin,
|
|
28
|
+
response = _ref.response,
|
|
29
|
+
url = _ref.url;
|
|
30
|
+
var action = _objectSpread((_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.CopyLinkAction, (0, _extractCopyLinkAction.extractCopyLinkClientAction)({
|
|
31
|
+
actionOptions: actionOptions,
|
|
32
|
+
appearance: appearance,
|
|
33
|
+
id: id,
|
|
34
|
+
response: response
|
|
35
|
+
})), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.DownloadAction, (0, _extractDownloadAction.extractDownloadClientAction)({
|
|
36
|
+
actionOptions: actionOptions,
|
|
37
|
+
appearance: appearance,
|
|
38
|
+
id: id,
|
|
39
|
+
response: response
|
|
40
|
+
})), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewClientAction)({
|
|
41
|
+
actionOptions: actionOptions,
|
|
42
|
+
appearance: appearance,
|
|
43
|
+
fireEvent: fireEvent,
|
|
44
|
+
id: id,
|
|
45
|
+
origin: origin,
|
|
46
|
+
response: response
|
|
47
|
+
})), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.AutomationAction, (0, _extractAutomationAction.extractAutomationAction)(response)), (0, _defineProperty2.default)(_objectSpread2, _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), _objectSpread2), (0, _platformFeatureFlags.fg)('platform-smart-card-view-related-urls-action') ? (0, _defineProperty2.default)({}, _constants.InternalActionName.ViewRelatedLinksAction, (0, _extractViewRelatedLinksAction.extractViewRelatedLinksAction)(response)) : {});
|
|
48
|
+
return Object.values(action).some(function (value) {
|
|
49
|
+
return Boolean(value);
|
|
50
|
+
}) ? action : undefined;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
55
|
+
* Replaced with extractFlexibleCardActions()
|
|
56
|
+
*/
|
|
57
|
+
var extractActions = function extractActions(response, url, actionOptions, id, aiSummaryConfig) {
|
|
58
|
+
var _objectSpread3;
|
|
22
59
|
var data = response.data;
|
|
23
|
-
var action = _objectSpread((
|
|
60
|
+
var action = _objectSpread((_objectSpread3 = {}, (0, _defineProperty2.default)(_objectSpread3, _constants.ActionName.CopyLinkAction, (0, _extractCopyLinkAction.extractCopyLinkAction)(data, actionOptions)), (0, _defineProperty2.default)(_objectSpread3, _constants.ActionName.DownloadAction, (0, _extractDownloadAction.extractDownloadAction)(data, actionOptions)), (0, _defineProperty2.default)(_objectSpread3, _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), (0, _defineProperty2.default)(_objectSpread3, _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewAction)(response, actionOptions)), (0, _defineProperty2.default)(_objectSpread3, _constants.ActionName.AutomationAction, (0, _extractAutomationAction.extractAutomationAction)(response)), (0, _defineProperty2.default)(_objectSpread3, _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), _objectSpread3), (0, _platformFeatureFlags.fg)('platform-smart-card-view-related-urls-action') ? (0, _defineProperty2.default)({}, _constants.InternalActionName.ViewRelatedLinksAction, (0, _extractViewRelatedLinksAction.extractViewRelatedLinksAction)(response)) : {});
|
|
24
61
|
return Object.values(action).some(function (value) {
|
|
25
62
|
return Boolean(value);
|
|
26
63
|
}) ? action : undefined;
|
|
@@ -7,9 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _helpers = require("../../state/helpers");
|
|
11
12
|
var _canShowAction = require("../../utils/actions/can-show-action");
|
|
12
13
|
var _types = require("../../view/Card/types");
|
|
14
|
+
var _extractInvokePreviewAction = require("../action/extract-invoke-preview-action");
|
|
13
15
|
var _lozenge = require("../common/lozenge");
|
|
14
16
|
var _extractPreviewAction = require("./actions/extract-preview-action");
|
|
15
17
|
var _extractServerAction = _interopRequireDefault(require("./extract-server-action"));
|
|
@@ -28,7 +30,7 @@ var toInvokeRequest = function toInvokeRequest(extensionKey, resourceIdentifiers
|
|
|
28
30
|
details: details
|
|
29
31
|
};
|
|
30
32
|
};
|
|
31
|
-
var extractAction = function extractAction(response, id) {
|
|
33
|
+
var extractAction = function extractAction(response, id, actionOptions, appearance, origin, fireEvent, resolve) {
|
|
32
34
|
var _action$dataRetrieval, _action$dataUpdateAct;
|
|
33
35
|
var extensionKey = (0, _helpers.getExtensionKey)(response);
|
|
34
36
|
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
@@ -44,11 +46,23 @@ var extractAction = function extractAction(response, id) {
|
|
|
44
46
|
}
|
|
45
47
|
var read = toInvokeRequest(extensionKey, action.resourceIdentifiers, (_action$dataRetrieval = action.dataRetrievalAction) === null || _action$dataRetrieval === void 0 ? void 0 : _action$dataRetrieval.name);
|
|
46
48
|
var url = (0, _linkExtractors.extractLink)(data);
|
|
47
|
-
var previewData = response ? (0, _extractPreviewAction.extractPreviewAction)(response) : null;
|
|
49
|
+
var previewData = !(0, _platformFeatureFlags.fg)('platform-smart-card-migrate-embed-modal-analytics') ? response ? (0, _extractPreviewAction.extractPreviewAction)(response) : null : undefined;
|
|
50
|
+
var invokePreviewAction = response && (0, _platformFeatureFlags.fg)('platform-smart-card-migrate-embed-modal-analytics') ? (0, _extractInvokePreviewAction.extractInvokePreviewAction)({
|
|
51
|
+
actionOptions: actionOptions,
|
|
52
|
+
appearance: appearance,
|
|
53
|
+
fireEvent: fireEvent,
|
|
54
|
+
id: id,
|
|
55
|
+
onClose: resolve ? function () {
|
|
56
|
+
return url && resolve(url, true);
|
|
57
|
+
} : undefined,
|
|
58
|
+
origin: origin,
|
|
59
|
+
response: response
|
|
60
|
+
}) : undefined;
|
|
48
61
|
var details = {
|
|
49
62
|
id: id,
|
|
50
63
|
url: url,
|
|
51
|
-
previewData: previewData
|
|
64
|
+
previewData: previewData,
|
|
65
|
+
invokePreviewAction: invokePreviewAction
|
|
52
66
|
};
|
|
53
67
|
var update = toInvokeRequest(extensionKey, action.resourceIdentifiers, (_action$dataUpdateAct = action.dataUpdateAction) === null || _action$dataUpdateAct === void 0 ? void 0 : _action$dataUpdateAct.name, details);
|
|
54
68
|
return read || update ? {
|
|
@@ -56,7 +70,7 @@ var extractAction = function extractAction(response, id) {
|
|
|
56
70
|
update: update
|
|
57
71
|
} : undefined;
|
|
58
72
|
};
|
|
59
|
-
var extractState = function extractState(response, actionOptions, id) {
|
|
73
|
+
var extractState = function extractState(response, actionOptions, id, appearance, origin, fireEvent, resolve) {
|
|
60
74
|
if (!response || !response.data) {
|
|
61
75
|
return;
|
|
62
76
|
}
|
|
@@ -67,7 +81,7 @@ var extractState = function extractState(response, actionOptions, id) {
|
|
|
67
81
|
if (!(0, _canShowAction.canShowAction)(_types.CardAction.ChangeStatusAction, actionOptions)) {
|
|
68
82
|
return lozenge;
|
|
69
83
|
}
|
|
70
|
-
var action = extractAction(response, id);
|
|
84
|
+
var action = extractAction(response, id, actionOptions, appearance, origin, fireEvent, resolve);
|
|
71
85
|
return _objectSpread(_objectSpread({}, lozenge), {}, {
|
|
72
86
|
action: action
|
|
73
87
|
});
|