@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.
Files changed (160) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/analytics.spec.yaml +63 -9
  3. package/dist/cjs/common/analytics/types.js +5 -0
  4. package/dist/cjs/extractors/action/extract-invoke-copy-link-action.js +53 -0
  5. package/dist/cjs/extractors/action/extract-invoke-download-action.js +57 -0
  6. package/dist/cjs/extractors/action/extract-invoke-preview-action.js +78 -0
  7. package/dist/cjs/extractors/action/extract-invoke-view-action.js +60 -0
  8. package/dist/cjs/extractors/action/extractDownloadActionProps.js +4 -0
  9. package/dist/cjs/extractors/action/extractPreviewActionProps.js +4 -0
  10. package/dist/cjs/extractors/action/extractViewActionProps.js +4 -0
  11. package/dist/cjs/extractors/action/types.js +5 -0
  12. package/dist/cjs/extractors/flexible/actions/extract-copy-link-action.js +12 -1
  13. package/dist/cjs/extractors/flexible/actions/extract-download-action.js +12 -1
  14. package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +12 -1
  15. package/dist/cjs/extractors/flexible/actions/extract-view-action.js +3 -0
  16. package/dist/cjs/extractors/flexible/actions/index.js +40 -3
  17. package/dist/cjs/extractors/flexible/extract-state.js +19 -5
  18. package/dist/cjs/extractors/flexible/index.js +22 -8
  19. package/dist/cjs/state/hooks/use-invoke-client-action/index.js +56 -17
  20. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +22 -3
  21. package/dist/cjs/utils/analytics/LinkAnalyticsContext.js +7 -2
  22. package/dist/cjs/utils/analytics/analytics.js +1 -1
  23. package/dist/cjs/utils/mocks.js +4 -1
  24. package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +1 -0
  25. package/dist/cjs/view/BlockCard/views/flexible/unresolved-view/index.js +1 -0
  26. package/dist/cjs/view/CardWithUrl/component.js +1 -0
  27. package/dist/cjs/view/EmbedModal/index.js +72 -51
  28. package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +65 -32
  29. package/dist/cjs/view/FlexibleCard/components/actions/download-action/index.js +36 -28
  30. package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +40 -32
  31. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +13 -6
  32. package/dist/cjs/view/FlexibleCard/components/utils.js +4 -0
  33. package/dist/cjs/view/FlexibleCard/index.js +11 -1
  34. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -0
  35. package/dist/cjs/view/LinkUrl/index.js +1 -1
  36. package/dist/es2019/common/analytics/types.js +1 -0
  37. package/dist/es2019/extractors/action/extract-invoke-copy-link-action.js +29 -0
  38. package/dist/es2019/extractors/action/extract-invoke-download-action.js +31 -0
  39. package/dist/es2019/extractors/action/extract-invoke-preview-action.js +57 -0
  40. package/dist/es2019/extractors/action/extract-invoke-view-action.js +34 -0
  41. package/dist/es2019/extractors/action/extractDownloadActionProps.js +5 -0
  42. package/dist/es2019/extractors/action/extractPreviewActionProps.js +5 -0
  43. package/dist/es2019/extractors/action/extractViewActionProps.js +5 -0
  44. package/dist/es2019/extractors/action/types.js +1 -0
  45. package/dist/es2019/extractors/flexible/actions/extract-copy-link-action.js +11 -0
  46. package/dist/es2019/extractors/flexible/actions/extract-download-action.js +12 -0
  47. package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +12 -0
  48. package/dist/es2019/extractors/flexible/actions/extract-view-action.js +4 -0
  49. package/dist/es2019/extractors/flexible/actions/index.js +48 -3
  50. package/dist/es2019/extractors/flexible/extract-state.js +17 -5
  51. package/dist/es2019/extractors/flexible/index.js +17 -6
  52. package/dist/es2019/state/hooks/use-invoke-client-action/index.js +91 -43
  53. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +21 -3
  54. package/dist/es2019/utils/analytics/LinkAnalyticsContext.js +3 -0
  55. package/dist/es2019/utils/analytics/analytics.js +1 -1
  56. package/dist/es2019/utils/mocks.js +4 -1
  57. package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +1 -0
  58. package/dist/es2019/view/BlockCard/views/flexible/unresolved-view/index.js +1 -0
  59. package/dist/es2019/view/CardWithUrl/component.js +1 -0
  60. package/dist/es2019/view/EmbedModal/index.js +41 -20
  61. package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +31 -16
  62. package/dist/es2019/view/FlexibleCard/components/actions/download-action/index.js +20 -12
  63. package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +25 -17
  64. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +14 -7
  65. package/dist/es2019/view/FlexibleCard/components/utils.js +4 -0
  66. package/dist/es2019/view/FlexibleCard/index.js +12 -1
  67. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -0
  68. package/dist/es2019/view/LinkUrl/index.js +1 -1
  69. package/dist/esm/common/analytics/types.js +1 -0
  70. package/dist/esm/extractors/action/extract-invoke-copy-link-action.js +46 -0
  71. package/dist/esm/extractors/action/extract-invoke-download-action.js +50 -0
  72. package/dist/esm/extractors/action/extract-invoke-preview-action.js +71 -0
  73. package/dist/esm/extractors/action/extract-invoke-view-action.js +53 -0
  74. package/dist/esm/extractors/action/extractDownloadActionProps.js +5 -0
  75. package/dist/esm/extractors/action/extractPreviewActionProps.js +5 -0
  76. package/dist/esm/extractors/action/extractViewActionProps.js +5 -0
  77. package/dist/esm/extractors/action/types.js +1 -0
  78. package/dist/esm/extractors/flexible/actions/extract-copy-link-action.js +11 -0
  79. package/dist/esm/extractors/flexible/actions/extract-download-action.js +12 -0
  80. package/dist/esm/extractors/flexible/actions/extract-preview-action.js +12 -0
  81. package/dist/esm/extractors/flexible/actions/extract-view-action.js +4 -0
  82. package/dist/esm/extractors/flexible/actions/index.js +42 -5
  83. package/dist/esm/extractors/flexible/extract-state.js +19 -5
  84. package/dist/esm/extractors/flexible/index.js +19 -8
  85. package/dist/esm/state/hooks/use-invoke-client-action/index.js +56 -17
  86. package/dist/esm/state/hooks-external/useSmartLinkActions.js +22 -3
  87. package/dist/esm/utils/analytics/LinkAnalyticsContext.js +7 -2
  88. package/dist/esm/utils/analytics/analytics.js +1 -1
  89. package/dist/esm/utils/mocks.js +4 -1
  90. package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +1 -0
  91. package/dist/esm/view/BlockCard/views/flexible/unresolved-view/index.js +1 -0
  92. package/dist/esm/view/CardWithUrl/component.js +1 -0
  93. package/dist/esm/view/EmbedModal/index.js +73 -52
  94. package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +65 -32
  95. package/dist/esm/view/FlexibleCard/components/actions/download-action/index.js +36 -28
  96. package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +40 -32
  97. package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +13 -6
  98. package/dist/esm/view/FlexibleCard/components/utils.js +4 -0
  99. package/dist/esm/view/FlexibleCard/index.js +11 -1
  100. package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -0
  101. package/dist/esm/view/LinkUrl/index.js +1 -1
  102. package/dist/types/common/analytics/generated/analytics.types.d.ts +63 -2
  103. package/dist/types/common/analytics/types.d.ts +2 -0
  104. package/dist/types/extractors/action/extract-invoke-copy-link-action.d.ts +3 -0
  105. package/dist/types/extractors/action/extract-invoke-download-action.d.ts +3 -0
  106. package/dist/types/extractors/action/extract-invoke-preview-action.d.ts +11 -0
  107. package/dist/types/extractors/action/extract-invoke-view-action.d.ts +3 -0
  108. package/dist/types/extractors/action/extractDownloadActionProps.d.ts +4 -0
  109. package/dist/types/extractors/action/extractPreviewActionProps.d.ts +5 -1
  110. package/dist/types/extractors/action/extractViewActionProps.d.ts +4 -0
  111. package/dist/types/extractors/action/types.d.ts +9 -0
  112. package/dist/types/extractors/flexible/actions/extract-copy-link-action.d.ts +6 -0
  113. package/dist/types/extractors/flexible/actions/extract-download-action.d.ts +6 -0
  114. package/dist/types/extractors/flexible/actions/extract-preview-action.d.ts +6 -0
  115. package/dist/types/extractors/flexible/actions/extract-view-action.d.ts +3 -0
  116. package/dist/types/extractors/flexible/actions/index.d.ts +21 -4
  117. package/dist/types/extractors/flexible/extract-state.d.ts +5 -2
  118. package/dist/types/extractors/flexible/index.d.ts +1 -1
  119. package/dist/types/state/flexible-ui-context/types.d.ts +9 -3
  120. package/dist/types/state/hooks/use-invoke/types.d.ts +7 -1
  121. package/dist/types/state/hooks/use-invoke-client-action/index.d.ts +2 -2
  122. package/dist/types/state/hooks/use-invoke-client-action/types.d.ts +24 -2
  123. package/dist/types/state/hooks/use-resolve/index.d.ts +1 -0
  124. package/dist/types/view/EmbedModal/index.d.ts +4 -0
  125. package/dist/types/view/EmbedModal/types.d.ts +7 -0
  126. package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.d.ts +1 -1
  127. package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/types.d.ts +6 -0
  128. package/dist/types/view/FlexibleCard/components/utils.d.ts +3 -0
  129. package/dist/types/view/FlexibleCard/index.d.ts +1 -1
  130. package/dist/types/view/FlexibleCard/types.d.ts +12 -3
  131. package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +63 -2
  132. package/dist/types-ts4.5/common/analytics/types.d.ts +2 -0
  133. package/dist/types-ts4.5/extractors/action/extract-invoke-copy-link-action.d.ts +3 -0
  134. package/dist/types-ts4.5/extractors/action/extract-invoke-download-action.d.ts +3 -0
  135. package/dist/types-ts4.5/extractors/action/extract-invoke-preview-action.d.ts +11 -0
  136. package/dist/types-ts4.5/extractors/action/extract-invoke-view-action.d.ts +3 -0
  137. package/dist/types-ts4.5/extractors/action/extractDownloadActionProps.d.ts +4 -0
  138. package/dist/types-ts4.5/extractors/action/extractPreviewActionProps.d.ts +5 -1
  139. package/dist/types-ts4.5/extractors/action/extractViewActionProps.d.ts +4 -0
  140. package/dist/types-ts4.5/extractors/action/types.d.ts +9 -0
  141. package/dist/types-ts4.5/extractors/flexible/actions/extract-copy-link-action.d.ts +6 -0
  142. package/dist/types-ts4.5/extractors/flexible/actions/extract-download-action.d.ts +6 -0
  143. package/dist/types-ts4.5/extractors/flexible/actions/extract-preview-action.d.ts +6 -0
  144. package/dist/types-ts4.5/extractors/flexible/actions/extract-view-action.d.ts +3 -0
  145. package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +21 -4
  146. package/dist/types-ts4.5/extractors/flexible/extract-state.d.ts +5 -2
  147. package/dist/types-ts4.5/extractors/flexible/index.d.ts +1 -1
  148. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +9 -3
  149. package/dist/types-ts4.5/state/hooks/use-invoke/types.d.ts +7 -1
  150. package/dist/types-ts4.5/state/hooks/use-invoke-client-action/index.d.ts +2 -2
  151. package/dist/types-ts4.5/state/hooks/use-invoke-client-action/types.d.ts +24 -2
  152. package/dist/types-ts4.5/state/hooks/use-resolve/index.d.ts +1 -0
  153. package/dist/types-ts4.5/view/EmbedModal/index.d.ts +8 -0
  154. package/dist/types-ts4.5/view/EmbedModal/types.d.ts +7 -0
  155. package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.d.ts +1 -1
  156. package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/types.d.ts +6 -0
  157. package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +3 -0
  158. package/dist/types-ts4.5/view/FlexibleCard/index.d.ts +1 -1
  159. package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +12 -3
  160. 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
@@ -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,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -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,
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -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 extractActions = function extractActions(response, url, actionOptions, id, aiSummaryConfig) {
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((_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.CopyLinkAction, (0, _extractCopyLinkAction.extractCopyLinkAction)(data, actionOptions)), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.DownloadAction, (0, _extractDownloadAction.extractDownloadAction)(data, actionOptions)), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), (0, _defineProperty2.default)(_objectSpread2, _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewAction)(response, actionOptions)), (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)) : {});
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
  });