@atlaskit/smart-card 21.2.0 → 22.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/cjs/extractors/block/index.js +6 -7
  3. package/dist/cjs/extractors/common/actions/extractPreviewAction.js +16 -19
  4. package/dist/cjs/state/actions/index.js +54 -10
  5. package/dist/cjs/state/analytics/types.js +5 -0
  6. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +429 -109
  7. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +5 -3
  8. package/dist/cjs/utils/analytics/analytics.js +241 -74
  9. package/dist/cjs/utils/analytics/index.js +32 -5
  10. package/dist/cjs/utils/mocks.js +28 -2
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/cjs/view/BlockCard/actions/PreviewAction.js +2 -2
  13. package/dist/cjs/view/BlockCard/index.js +6 -5
  14. package/dist/cjs/view/CardWithUrl/component.js +27 -5
  15. package/dist/cjs/view/CardWithUrl/loader.js +6 -1
  16. package/dist/cjs/view/EmbedCard/index.js +3 -2
  17. package/dist/cjs/view/EmbedModal/components/analytics/index.js +100 -0
  18. package/dist/cjs/view/EmbedModal/components/analytics/types.js +5 -0
  19. package/dist/cjs/view/EmbedModal/components/size-experiment/index.js +5 -10
  20. package/dist/cjs/view/EmbedModal/index.js +54 -15
  21. package/dist/cjs/view/EmbedModal/types.js +9 -1
  22. package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +17 -3
  23. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +5 -2
  24. package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +4 -2
  25. package/dist/cjs/view/FlexibleCard/components/common/loading-skeleton/index.js +1 -2
  26. package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +5 -2
  27. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +11 -3
  28. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +36 -8
  29. package/dist/cjs/view/HoverCard/components/SnippetOrPreview.js +74 -0
  30. package/dist/cjs/view/HoverCard/index.js +6 -1
  31. package/dist/cjs/view/HoverCard/styled.js +11 -3
  32. package/dist/cjs/view/common/Modal.js +29 -4
  33. package/dist/cjs/view/common/ModalHeader.js +3 -2
  34. package/dist/es2019/extractors/block/index.js +6 -7
  35. package/dist/es2019/extractors/common/actions/extractPreviewAction.js +16 -10
  36. package/dist/es2019/state/actions/index.js +54 -10
  37. package/dist/es2019/state/analytics/types.js +1 -0
  38. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +424 -41
  39. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +5 -3
  40. package/dist/es2019/utils/analytics/analytics.js +254 -79
  41. package/dist/es2019/utils/analytics/index.js +32 -4
  42. package/dist/es2019/utils/mocks.js +26 -1
  43. package/dist/es2019/version.json +1 -1
  44. package/dist/es2019/view/BlockCard/actions/PreviewAction.js +3 -3
  45. package/dist/es2019/view/BlockCard/index.js +5 -4
  46. package/dist/es2019/view/CardWithUrl/component.js +27 -5
  47. package/dist/es2019/view/CardWithUrl/loader.js +6 -1
  48. package/dist/es2019/view/EmbedCard/index.js +3 -2
  49. package/dist/es2019/view/EmbedModal/components/analytics/index.js +80 -0
  50. package/dist/es2019/view/EmbedModal/components/analytics/types.js +1 -0
  51. package/dist/es2019/view/EmbedModal/components/size-experiment/index.js +5 -9
  52. package/dist/es2019/view/EmbedModal/index.js +46 -13
  53. package/dist/es2019/view/EmbedModal/types.js +6 -1
  54. package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +17 -7
  55. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +4 -1
  56. package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +4 -2
  57. package/dist/es2019/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -3
  58. package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +5 -2
  59. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +11 -3
  60. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +36 -10
  61. package/dist/es2019/view/HoverCard/components/SnippetOrPreview.js +42 -0
  62. package/dist/es2019/view/HoverCard/index.js +6 -1
  63. package/dist/es2019/view/HoverCard/styled.js +8 -0
  64. package/dist/es2019/view/common/Modal.js +27 -6
  65. package/dist/es2019/view/common/ModalHeader.js +3 -2
  66. package/dist/esm/extractors/block/index.js +6 -7
  67. package/dist/esm/extractors/common/actions/extractPreviewAction.js +17 -19
  68. package/dist/esm/state/actions/index.js +54 -10
  69. package/dist/esm/state/analytics/types.js +1 -0
  70. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +428 -111
  71. package/dist/esm/state/hooks-external/useSmartLinkActions.js +5 -3
  72. package/dist/esm/utils/analytics/analytics.js +241 -74
  73. package/dist/esm/utils/analytics/index.js +31 -4
  74. package/dist/esm/utils/mocks.js +25 -0
  75. package/dist/esm/version.json +1 -1
  76. package/dist/esm/view/BlockCard/actions/PreviewAction.js +3 -3
  77. package/dist/esm/view/BlockCard/index.js +5 -4
  78. package/dist/esm/view/CardWithUrl/component.js +27 -5
  79. package/dist/esm/view/CardWithUrl/loader.js +6 -1
  80. package/dist/esm/view/EmbedCard/index.js +3 -2
  81. package/dist/esm/view/EmbedModal/components/analytics/index.js +82 -0
  82. package/dist/esm/view/EmbedModal/components/analytics/types.js +1 -0
  83. package/dist/esm/view/EmbedModal/components/size-experiment/index.js +5 -10
  84. package/dist/esm/view/EmbedModal/index.js +52 -15
  85. package/dist/esm/view/EmbedModal/types.js +6 -1
  86. package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +11 -3
  87. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +5 -2
  88. package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +4 -2
  89. package/dist/esm/view/FlexibleCard/components/common/loading-skeleton/index.js +1 -2
  90. package/dist/esm/view/FlexibleCard/components/elements/media/index.js +5 -2
  91. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +11 -3
  92. package/dist/esm/view/HoverCard/components/HoverCardContent.js +36 -10
  93. package/dist/esm/view/HoverCard/components/SnippetOrPreview.js +53 -0
  94. package/dist/esm/view/HoverCard/index.js +6 -1
  95. package/dist/esm/view/HoverCard/styled.js +6 -2
  96. package/dist/esm/view/common/Modal.js +28 -6
  97. package/dist/esm/view/common/ModalHeader.js +3 -2
  98. package/dist/types/extractors/block/types.d.ts +4 -2
  99. package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +7 -5
  100. package/dist/types/state/analytics/types.d.ts +9 -0
  101. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +41 -24
  102. package/dist/types/state/hooks/useSmartLink.d.ts +26 -18
  103. package/dist/types/state/hooks-external/useSmartLinkActions.d.ts +6 -2
  104. package/dist/types/utils/analytics/analytics.d.ts +19 -21
  105. package/dist/types/utils/analytics/index.d.ts +2 -2
  106. package/dist/types/utils/analytics/types.d.ts +91 -0
  107. package/dist/types/utils/mocks.d.ts +48 -0
  108. package/dist/types/utils/types.d.ts +3 -1
  109. package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +4 -0
  110. package/dist/types/view/BlockCard/index.d.ts +2 -2
  111. package/dist/types/view/BlockCard/types.d.ts +4 -4
  112. package/dist/types/view/Card/index.d.ts +1 -1
  113. package/dist/types/view/EmbedCard/types.d.ts +2 -2
  114. package/dist/types/view/EmbedModal/components/analytics/index.d.ts +5 -0
  115. package/dist/types/view/EmbedModal/components/analytics/types.d.ts +6 -0
  116. package/dist/types/view/EmbedModal/components/size-experiment/index.d.ts +4 -3
  117. package/dist/types/view/EmbedModal/index.d.ts +3 -1
  118. package/dist/types/view/EmbedModal/types.d.ts +14 -4
  119. package/dist/types/view/FlexibleCard/components/blocks/preview-block/types.d.ts +7 -1
  120. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +15 -0
  121. package/dist/types/view/FlexibleCard/components/common/image-icon/types.d.ts +1 -0
  122. package/dist/types/view/FlexibleCard/components/elements/media/types.d.ts +5 -0
  123. package/dist/types/view/HoverCard/components/SnippetOrPreview.d.ts +4 -0
  124. package/dist/types/view/HoverCard/styled.d.ts +2 -0
  125. package/dist/types/view/HoverCard/types.d.ts +5 -0
  126. package/dist/types/view/common/Modal.d.ts +6 -8
  127. package/package.json +1 -1
  128. package/report.api.md +324 -108
@@ -1,9 +1,32 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+
6
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
+
1
8
  import { useMemo } from 'react';
2
9
  import { getUrl } from '@atlaskit/linking-common';
3
- import { uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, uiRenderSuccessEvent, uiRenderFailedEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, invokeSucceededEvent as _invokeSucceededEvent, invokeFailedEvent as _invokeFailedEvent, connectSucceededEvent as _connectSucceededEvent, connectFailedEvent as _connectFailedEvent, trackAppAccountConnected, screenAuthPopupEvent, instrumentEvent } from '../../utils/analytics';
10
+ import { connectFailedEvent as _connectFailedEvent, connectSucceededEvent as _connectSucceededEvent, context, instrumentEvent, invokeFailedEvent as _invokeFailedEvent, invokeSucceededEvent as _invokeSucceededEvent, screenAuthPopupEvent, trackAppAccountConnected, uiActionClickedEvent, uiAuthAlternateAccountEvent, uiAuthEvent, uiCardClickedEvent, uiClosedAuthEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, uiHoverCardViewedEvent, uiRenderFailedEvent, uiRenderSuccessEvent } from '../../utils/analytics';
4
11
  import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
5
- import { getDefinitionId, getExtensionKey, getResourceType, getSubproduct, getProduct } from '../helpers';
12
+ import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getSubproduct } from '../helpers';
6
13
  import { useSmartLinkContext } from '@atlaskit/link-provider';
14
+
15
+ var applyCommonAttributes = function applyCommonAttributes(event, commonAttributes) {
16
+ if (event && event.attributes) {
17
+ for (var _i = 0, _Object$entries = Object.entries(commonAttributes); _i < _Object$entries.length; _i++) {
18
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
19
+ key = _Object$entries$_i[0],
20
+ value = _Object$entries$_i[1];
21
+
22
+ if (event.attributes[key] === undefined) {
23
+ event.attributes[key] = value;
24
+ }
25
+ }
26
+ }
27
+
28
+ return event;
29
+ };
7
30
  /**
8
31
  * This hook provides usage of Smart Link analytics outside of the Card component.
9
32
  * Can be provided to Card via the analyticsEvents prop to change the analytics events.
@@ -14,6 +37,7 @@ import { useSmartLinkContext } from '@atlaskit/link-provider';
14
37
  * @returns
15
38
  */
16
39
 
40
+
17
41
  export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchAnalytics, id, defaultLocation) {
18
42
  var defaultId = id || 'NULL'; // We don't want to trigger a re-render by using useSmartCardState
19
43
 
@@ -27,6 +51,17 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
27
51
  var extractedResourceType = getResourceType(details);
28
52
  var extractedSubproduct = getSubproduct(details);
29
53
  var extractedProduct = getProduct(details);
54
+ var commonAttributes = useMemo(function () {
55
+ return {
56
+ id: defaultId,
57
+ definitionId: extractedDefinitionId,
58
+ extensionKey: extractedExtensionKey,
59
+ resourceType: extractedResourceType,
60
+ destinationSubproduct: extractedSubproduct,
61
+ destinationProduct: extractedProduct,
62
+ location: defaultLocation
63
+ };
64
+ }, [defaultId, extractedDefinitionId, extractedExtensionKey, extractedResourceType, extractedSubproduct, extractedProduct, defaultLocation]);
30
65
  /** Contains all ui analytics events */
31
66
 
32
67
  var ui = useMemo(function () {
@@ -39,10 +74,23 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
39
74
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
40
75
  * @returns
41
76
  */
42
- authEvent: function authEvent(display) {
43
- var definitionId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : extractedDefinitionId;
44
- var extensionKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : extractedExtensionKey;
45
- return dispatchAnalytics(uiAuthEvent(display, definitionId, extensionKey));
77
+ authEvent: function authEvent(_ref) {
78
+ var display = _ref.display,
79
+ extensionKey = _ref.extensionKey,
80
+ definitionId = _ref.definitionId,
81
+ resourceType = _ref.resourceType,
82
+ destinationProduct = _ref.destinationProduct,
83
+ destinationSubproduct = _ref.destinationSubproduct,
84
+ location = _ref.location;
85
+ return dispatchAnalytics(applyCommonAttributes(uiAuthEvent({
86
+ display: display,
87
+ extensionKey: extensionKey,
88
+ definitionId: definitionId,
89
+ resourceType: resourceType,
90
+ destinationProduct: destinationProduct,
91
+ destinationSubproduct: destinationSubproduct,
92
+ location: location
93
+ }), commonAttributes));
46
94
  },
47
95
 
48
96
  /**
@@ -53,10 +101,38 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
53
101
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
54
102
  * @returns
55
103
  */
56
- authAlternateAccountEvent: function authAlternateAccountEvent(display) {
57
- var definitionId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : extractedDefinitionId;
58
- var extensionKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : extractedExtensionKey;
59
- return dispatchAnalytics(uiAuthAlternateAccountEvent(display, definitionId, extensionKey));
104
+ authAlternateAccountEvent: function authAlternateAccountEvent(_ref2) {
105
+ var display = _ref2.display,
106
+ extensionKey = _ref2.extensionKey,
107
+ definitionId = _ref2.definitionId,
108
+ resourceType = _ref2.resourceType,
109
+ destinationProduct = _ref2.destinationProduct,
110
+ destinationSubproduct = _ref2.destinationSubproduct,
111
+ location = _ref2.location;
112
+ return dispatchAnalytics(applyCommonAttributes(uiAuthAlternateAccountEvent({
113
+ display: display,
114
+ extensionKey: extensionKey,
115
+ definitionId: definitionId,
116
+ resourceType: resourceType,
117
+ destinationProduct: destinationProduct,
118
+ destinationSubproduct: destinationSubproduct,
119
+ location: location
120
+ }), commonAttributes));
121
+ },
122
+
123
+ /**
124
+ * This fires an event that represents when a user
125
+ * click a button.
126
+ * @param data A partial analytics event payload
127
+ */
128
+ buttonClickedEvent: function buttonClickedEvent(data) {
129
+ return dispatchAnalytics(applyCommonAttributes({
130
+ action: 'clicked',
131
+ actionSubject: 'button',
132
+ actionSubjectId: data.actionSubjectId,
133
+ attributes: _objectSpread(_objectSpread({}, context), data.attributes),
134
+ eventType: 'ui'
135
+ }, commonAttributes));
60
136
  },
61
137
 
62
138
  /**
@@ -71,18 +147,29 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
71
147
  * @param destinationProduct The product the Smart Link is linked to.
72
148
  * @returns
73
149
  */
74
- cardClickedEvent: function cardClickedEvent() {
75
- var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
76
- var display = arguments.length > 1 ? arguments[1] : undefined;
77
- var status = arguments.length > 2 ? arguments[2] : undefined;
78
- var definitionId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : extractedDefinitionId;
79
- var extensionKey = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : extractedExtensionKey;
80
- var isModifierKeyPressed = arguments.length > 5 ? arguments[5] : undefined;
81
- var location = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : defaultLocation;
82
- var destinationProduct = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : extractedProduct;
83
- var destinationSubproduct = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : extractedSubproduct;
84
- var actionSubjectId = arguments.length > 9 ? arguments[9] : undefined;
85
- return dispatchAnalytics(uiCardClickedEvent(id, display, status, definitionId, extensionKey, isModifierKeyPressed, location, destinationProduct, destinationSubproduct, actionSubjectId));
150
+ cardClickedEvent: function cardClickedEvent(_ref3) {
151
+ var id = _ref3.id,
152
+ display = _ref3.display,
153
+ status = _ref3.status,
154
+ definitionId = _ref3.definitionId,
155
+ extensionKey = _ref3.extensionKey,
156
+ isModifierKeyPressed = _ref3.isModifierKeyPressed,
157
+ location = _ref3.location,
158
+ destinationProduct = _ref3.destinationProduct,
159
+ destinationSubproduct = _ref3.destinationSubproduct,
160
+ actionSubjectId = _ref3.actionSubjectId;
161
+ return dispatchAnalytics(applyCommonAttributes(uiCardClickedEvent({
162
+ id: id,
163
+ display: display,
164
+ status: status,
165
+ definitionId: definitionId,
166
+ extensionKey: extensionKey,
167
+ isModifierKeyPressed: isModifierKeyPressed,
168
+ location: location,
169
+ destinationProduct: destinationProduct,
170
+ destinationSubproduct: destinationSubproduct,
171
+ actionSubjectId: actionSubjectId
172
+ }), commonAttributes));
86
173
  },
87
174
 
88
175
  /**
@@ -95,19 +182,34 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
95
182
  * @param invokeType Whether the action invoked made a call to a server.
96
183
  * @returns
97
184
  */
98
- actionClickedEvent: function actionClickedEvent() {
99
- var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
100
- var extensionKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : extractedExtensionKey;
101
- var actionType = arguments.length > 2 ? arguments[2] : undefined;
102
- var display = arguments.length > 3 ? arguments[3] : undefined;
103
- var invokeType = arguments.length > 4 ? arguments[4] : undefined;
185
+ actionClickedEvent: function actionClickedEvent(_ref4) {
186
+ var id = _ref4.id,
187
+ actionType = _ref4.actionType,
188
+ display = _ref4.display,
189
+ invokeType = _ref4.invokeType,
190
+ extensionKey = _ref4.extensionKey,
191
+ definitionId = _ref4.definitionId,
192
+ resourceType = _ref4.resourceType,
193
+ destinationProduct = _ref4.destinationProduct,
194
+ destinationSubproduct = _ref4.destinationSubproduct,
195
+ location = _ref4.location;
104
196
  startUfoExperience('smart-link-action-invocation', id, {
105
197
  actionType: actionType,
106
198
  display: display,
107
199
  extensionKey: extensionKey,
108
200
  invokeType: invokeType
109
201
  });
110
- dispatchAnalytics(uiActionClickedEvent(id, actionType, extensionKey, display));
202
+ dispatchAnalytics(applyCommonAttributes(uiActionClickedEvent({
203
+ id: id,
204
+ actionType: actionType,
205
+ display: display,
206
+ extensionKey: extensionKey,
207
+ definitionId: definitionId,
208
+ resourceType: resourceType,
209
+ destinationProduct: destinationProduct,
210
+ destinationSubproduct: destinationSubproduct,
211
+ location: location
212
+ }), commonAttributes));
111
213
  },
112
214
 
113
215
  /**
@@ -118,11 +220,24 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
118
220
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
119
221
  * @param previewInvokeMethod How the preview was triggered.
120
222
  */
121
- hoverCardOpenLinkClickedEvent: function hoverCardOpenLinkClickedEvent(previewDisplay) {
122
- var definitionId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : extractedDefinitionId;
123
- var extensionKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : extractedExtensionKey;
124
- var previewInvokeMethod = arguments.length > 3 ? arguments[3] : undefined;
125
- dispatchAnalytics(uiHoverCardOpenLinkClickedEvent(defaultId, previewDisplay, definitionId, extensionKey, previewInvokeMethod));
223
+ hoverCardOpenLinkClickedEvent: function hoverCardOpenLinkClickedEvent(_ref5) {
224
+ var previewDisplay = _ref5.previewDisplay,
225
+ definitionId = _ref5.definitionId,
226
+ extensionKey = _ref5.extensionKey,
227
+ destinationProduct = _ref5.destinationProduct,
228
+ destinationSubproduct = _ref5.destinationSubproduct,
229
+ location = _ref5.location,
230
+ previewInvokeMethod = _ref5.previewInvokeMethod;
231
+ dispatchAnalytics(applyCommonAttributes(uiHoverCardOpenLinkClickedEvent({
232
+ id: defaultId,
233
+ previewDisplay: previewDisplay,
234
+ definitionId: definitionId,
235
+ extensionKey: extensionKey,
236
+ destinationProduct: destinationProduct,
237
+ destinationSubproduct: destinationSubproduct,
238
+ location: location,
239
+ previewInvokeMethod: previewInvokeMethod
240
+ }), commonAttributes));
126
241
  },
127
242
 
128
243
  /**
@@ -132,10 +247,37 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
132
247
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
133
248
  * @returns
134
249
  */
135
- closedAuthEvent: function closedAuthEvent(display) {
136
- var definitionId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : extractedDefinitionId;
137
- var extensionKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : extractedExtensionKey;
138
- return dispatchAnalytics(uiClosedAuthEvent(display, definitionId, extensionKey));
250
+ closedAuthEvent: function closedAuthEvent(_ref6) {
251
+ var display = _ref6.display,
252
+ extensionKey = _ref6.extensionKey,
253
+ definitionId = _ref6.definitionId,
254
+ resourceType = _ref6.resourceType,
255
+ destinationProduct = _ref6.destinationProduct,
256
+ destinationSubproduct = _ref6.destinationSubproduct,
257
+ location = _ref6.location;
258
+ return dispatchAnalytics(applyCommonAttributes(uiClosedAuthEvent({
259
+ display: display,
260
+ extensionKey: extensionKey,
261
+ definitionId: definitionId,
262
+ resourceType: resourceType,
263
+ destinationProduct: destinationProduct,
264
+ destinationSubproduct: destinationSubproduct,
265
+ location: location
266
+ }), commonAttributes));
267
+ },
268
+
269
+ /**
270
+ * This fires an event that represents when a user close a modal.
271
+ * @param data A partial analytics event payload
272
+ */
273
+ modalClosedEvent: function modalClosedEvent(data) {
274
+ return dispatchAnalytics(applyCommonAttributes({
275
+ action: 'closed',
276
+ actionSubject: 'modal',
277
+ actionSubjectId: data.actionSubjectId,
278
+ attributes: _objectSpread(_objectSpread({}, context), data.attributes),
279
+ eventType: 'ui'
280
+ }, commonAttributes));
139
281
  },
140
282
 
141
283
  /**
@@ -146,19 +288,35 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
146
288
  * @param definitionId The definitionId of the Smart Link resolver invoked.
147
289
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
148
290
  */
149
- renderSuccessEvent: function renderSuccessEvent(display, status) {
150
- var id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultId;
151
- var definitionId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : extractedDefinitionId;
152
- var extensionKey = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : extractedExtensionKey;
153
- succeedUfoExperience('smart-link-rendered', id, {
291
+ renderSuccessEvent: function renderSuccessEvent(_ref7) {
292
+ var display = _ref7.display,
293
+ status = _ref7.status,
294
+ id = _ref7.id,
295
+ extensionKey = _ref7.extensionKey,
296
+ definitionId = _ref7.definitionId,
297
+ resourceType = _ref7.resourceType,
298
+ destinationProduct = _ref7.destinationProduct,
299
+ destinationSubproduct = _ref7.destinationSubproduct,
300
+ location = _ref7.location;
301
+ var experienceId = id ? id : defaultId;
302
+ succeedUfoExperience('smart-link-rendered', experienceId, {
154
303
  extensionKey: extensionKey,
155
304
  display: display
156
305
  }); // UFO will disregard this if authentication experience has not yet been started
157
306
 
158
- succeedUfoExperience('smart-link-authenticated', id, {
307
+ succeedUfoExperience('smart-link-authenticated', experienceId, {
159
308
  display: display
160
309
  });
161
- dispatchAnalytics(uiRenderSuccessEvent(display, status, definitionId, extensionKey));
310
+ dispatchAnalytics(applyCommonAttributes(uiRenderSuccessEvent({
311
+ display: display,
312
+ status: status,
313
+ extensionKey: extensionKey,
314
+ definitionId: definitionId,
315
+ resourceType: resourceType,
316
+ destinationProduct: destinationProduct,
317
+ destinationSubproduct: destinationSubproduct,
318
+ location: location
319
+ }), commonAttributes));
162
320
  },
163
321
 
164
322
  /**
@@ -168,16 +326,34 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
168
326
  * @param error: An error representing why the Smart Link render failed.
169
327
  * @param errorInfo: Additional details about the error including the stack trace.
170
328
  */
171
- renderFailedEvent: function renderFailedEvent(display) {
172
- var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultId;
173
- var error = arguments.length > 2 ? arguments[2] : undefined;
174
- var errorInfo = arguments.length > 3 ? arguments[3] : undefined;
175
- // Start and fail the smart-link-rendered experience. If it has already
329
+ renderFailedEvent: function renderFailedEvent(_ref8) {
330
+ var display = _ref8.display,
331
+ id = _ref8.id,
332
+ error = _ref8.error,
333
+ errorInfo = _ref8.errorInfo,
334
+ extensionKey = _ref8.extensionKey,
335
+ definitionId = _ref8.definitionId,
336
+ resourceType = _ref8.resourceType,
337
+ destinationProduct = _ref8.destinationProduct,
338
+ destinationSubproduct = _ref8.destinationSubproduct,
339
+ location = _ref8.location;
340
+ var experienceId = id ? id : defaultId; // Start and fail the smart-link-rendered experience. If it has already
176
341
  // been started nothing happens.
177
- startUfoExperience('smart-link-rendered', id);
178
- failUfoExperience('smart-link-rendered', id);
179
- failUfoExperience('smart-link-authenticated', id);
180
- dispatchAnalytics(uiRenderFailedEvent(display, error, errorInfo));
342
+
343
+ startUfoExperience('smart-link-rendered', experienceId);
344
+ failUfoExperience('smart-link-rendered', experienceId);
345
+ failUfoExperience('smart-link-authenticated', experienceId);
346
+ dispatchAnalytics(applyCommonAttributes(uiRenderFailedEvent({
347
+ display: display,
348
+ error: error,
349
+ errorInfo: errorInfo,
350
+ extensionKey: extensionKey,
351
+ definitionId: definitionId,
352
+ resourceType: resourceType,
353
+ destinationProduct: destinationProduct,
354
+ destinationSubproduct: destinationSubproduct,
355
+ location: location
356
+ }), commonAttributes));
181
357
  },
182
358
 
183
359
  /**
@@ -188,11 +364,27 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
188
364
  * @param previewInvokeMethod How the preview was triggered.
189
365
  * @returns
190
366
  */
191
- hoverCardViewedEvent: function hoverCardViewedEvent(previewDisplay, previewInvokeMethod) {
192
- var id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultId;
193
- var definitionId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : extractedDefinitionId;
194
- var extensionKey = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : extractedExtensionKey;
195
- return dispatchAnalytics(uiHoverCardViewedEvent(id, previewDisplay, definitionId, extensionKey, previewInvokeMethod));
367
+ hoverCardViewedEvent: function hoverCardViewedEvent(_ref9) {
368
+ var previewDisplay = _ref9.previewDisplay,
369
+ previewInvokeMethod = _ref9.previewInvokeMethod,
370
+ id = _ref9.id,
371
+ extensionKey = _ref9.extensionKey,
372
+ definitionId = _ref9.definitionId,
373
+ resourceType = _ref9.resourceType,
374
+ destinationProduct = _ref9.destinationProduct,
375
+ destinationSubproduct = _ref9.destinationSubproduct,
376
+ location = _ref9.location;
377
+ return dispatchAnalytics(applyCommonAttributes(uiHoverCardViewedEvent({
378
+ id: id,
379
+ previewDisplay: previewDisplay,
380
+ extensionKey: extensionKey,
381
+ definitionId: definitionId,
382
+ resourceType: resourceType,
383
+ destinationProduct: destinationProduct,
384
+ destinationSubproduct: destinationSubproduct,
385
+ location: location,
386
+ previewInvokeMethod: previewInvokeMethod
387
+ }), commonAttributes));
196
388
  },
197
389
 
198
390
  /**
@@ -204,14 +396,32 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
204
396
  * @param previewInvokeMethod How the preview was triggered.
205
397
  * @returns
206
398
  */
207
- hoverCardDismissedEvent: function hoverCardDismissedEvent(previewDisplay, hoverTime, previewInvokeMethod) {
208
- var id = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : defaultId;
209
- var definitionId = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : extractedDefinitionId;
210
- var extensionKey = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : extractedExtensionKey;
211
- return dispatchAnalytics(uiHoverCardDismissedEvent(id, previewDisplay, hoverTime, definitionId, extensionKey, previewInvokeMethod));
399
+ hoverCardDismissedEvent: function hoverCardDismissedEvent(_ref10) {
400
+ var id = _ref10.id,
401
+ previewDisplay = _ref10.previewDisplay,
402
+ hoverTime = _ref10.hoverTime,
403
+ previewInvokeMethod = _ref10.previewInvokeMethod,
404
+ extensionKey = _ref10.extensionKey,
405
+ definitionId = _ref10.definitionId,
406
+ resourceType = _ref10.resourceType,
407
+ destinationProduct = _ref10.destinationProduct,
408
+ destinationSubproduct = _ref10.destinationSubproduct,
409
+ location = _ref10.location;
410
+ return dispatchAnalytics(applyCommonAttributes(uiHoverCardDismissedEvent({
411
+ previewDisplay: previewDisplay,
412
+ id: id,
413
+ hoverTime: hoverTime,
414
+ extensionKey: extensionKey,
415
+ definitionId: definitionId,
416
+ resourceType: resourceType,
417
+ destinationProduct: destinationProduct,
418
+ destinationSubproduct: destinationSubproduct,
419
+ location: location,
420
+ previewInvokeMethod: previewInvokeMethod
421
+ }), commonAttributes));
212
422
  }
213
423
  };
214
- }, [extractedDefinitionId, extractedExtensionKey, dispatchAnalytics, defaultId, defaultLocation, extractedProduct, extractedSubproduct]);
424
+ }, [defaultId, commonAttributes, dispatchAnalytics]);
215
425
  /** Contains all operational analytics events */
216
426
 
217
427
  var operational = useMemo(function () {
@@ -223,13 +433,28 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
223
433
  * @param actionType The type of action invoked, e.g. PreviewAction
224
434
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
225
435
  */
226
- invokeSucceededEvent: function invokeSucceededEvent() {
227
- var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
228
- var extensionKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : extractedExtensionKey;
229
- var actionType = arguments.length > 2 ? arguments[2] : undefined;
230
- var display = arguments.length > 3 ? arguments[3] : undefined;
436
+ invokeSucceededEvent: function invokeSucceededEvent(_ref11) {
437
+ var id = _ref11.id,
438
+ actionType = _ref11.actionType,
439
+ display = _ref11.display,
440
+ extensionKey = _ref11.extensionKey,
441
+ definitionId = _ref11.definitionId,
442
+ resourceType = _ref11.resourceType,
443
+ destinationProduct = _ref11.destinationProduct,
444
+ destinationSubproduct = _ref11.destinationSubproduct,
445
+ location = _ref11.location;
231
446
  succeedUfoExperience('smart-link-action-invocation', id);
232
- dispatchAnalytics(_invokeSucceededEvent(id, actionType, display, extensionKey));
447
+ dispatchAnalytics(applyCommonAttributes(_invokeSucceededEvent({
448
+ id: id,
449
+ actionType: actionType,
450
+ display: display,
451
+ extensionKey: extensionKey,
452
+ definitionId: definitionId,
453
+ resourceType: resourceType,
454
+ destinationProduct: destinationProduct,
455
+ destinationSubproduct: destinationSubproduct,
456
+ location: location
457
+ }), commonAttributes));
233
458
  },
234
459
 
235
460
  /**
@@ -240,14 +465,30 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
240
465
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
241
466
  * @param reason The reason the invocation failed.
242
467
  */
243
- invokeFailedEvent: function invokeFailedEvent() {
244
- var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
245
- var providerKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : extractedExtensionKey;
246
- var actionType = arguments.length > 2 ? arguments[2] : undefined;
247
- var display = arguments.length > 3 ? arguments[3] : undefined;
248
- var reason = arguments.length > 4 ? arguments[4] : undefined;
468
+ invokeFailedEvent: function invokeFailedEvent(_ref12) {
469
+ var id = _ref12.id,
470
+ actionType = _ref12.actionType,
471
+ display = _ref12.display,
472
+ reason = _ref12.reason,
473
+ extensionKey = _ref12.extensionKey,
474
+ definitionId = _ref12.definitionId,
475
+ resourceType = _ref12.resourceType,
476
+ destinationProduct = _ref12.destinationProduct,
477
+ destinationSubproduct = _ref12.destinationSubproduct,
478
+ location = _ref12.location;
249
479
  failUfoExperience('smart-link-action-invocation', id);
250
- dispatchAnalytics(_invokeFailedEvent(id, actionType, display, reason, providerKey));
480
+ dispatchAnalytics(applyCommonAttributes(_invokeFailedEvent({
481
+ id: id,
482
+ actionType: actionType,
483
+ display: display,
484
+ reason: reason,
485
+ extensionKey: extensionKey,
486
+ definitionId: definitionId,
487
+ resourceType: resourceType,
488
+ destinationProduct: destinationProduct,
489
+ destinationSubproduct: destinationSubproduct,
490
+ location: location
491
+ }), commonAttributes));
251
492
  },
252
493
 
253
494
  /**
@@ -256,15 +497,28 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
256
497
  * @param definitionId The definitionId of the Smart Link resolver invoked.
257
498
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
258
499
  */
259
- connectSucceededEvent: function connectSucceededEvent() {
260
- var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
261
- var definitionId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : extractedDefinitionId;
262
- var extensionKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : extractedExtensionKey;
263
- startUfoExperience('smart-link-authenticated', id, {
500
+ connectSucceededEvent: function connectSucceededEvent(_ref13) {
501
+ var id = _ref13.id,
502
+ extensionKey = _ref13.extensionKey,
503
+ definitionId = _ref13.definitionId,
504
+ resourceType = _ref13.resourceType,
505
+ destinationProduct = _ref13.destinationProduct,
506
+ destinationSubproduct = _ref13.destinationSubproduct,
507
+ location = _ref13.location;
508
+ var experienceId = id ? id : defaultId;
509
+ startUfoExperience('smart-link-authenticated', experienceId, {
264
510
  extensionKey: extensionKey,
265
511
  status: 'success'
266
512
  });
267
- dispatchAnalytics(_connectSucceededEvent(definitionId, extensionKey));
513
+ dispatchAnalytics(applyCommonAttributes(_connectSucceededEvent(_objectSpread(_objectSpread({}, commonAttributes), {}, {
514
+ id: experienceId,
515
+ extensionKey: extensionKey,
516
+ definitionId: definitionId,
517
+ resourceType: resourceType,
518
+ destinationProduct: destinationProduct,
519
+ destinationSubproduct: destinationSubproduct,
520
+ location: location
521
+ })), commonAttributes));
268
522
  },
269
523
 
270
524
  /**
@@ -274,16 +528,30 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
274
528
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
275
529
  * @param reason The reason why the Smart Link connect account failed.
276
530
  */
277
- connectFailedEvent: function connectFailedEvent() {
278
- var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
279
- var definitionId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : extractedDefinitionId;
280
- var extensionKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : extractedExtensionKey;
281
- var reason = arguments.length > 3 ? arguments[3] : undefined;
282
- startUfoExperience('smart-link-authenticated', id, {
531
+ connectFailedEvent: function connectFailedEvent(_ref14) {
532
+ var id = _ref14.id,
533
+ reason = _ref14.reason,
534
+ extensionKey = _ref14.extensionKey,
535
+ definitionId = _ref14.definitionId,
536
+ resourceType = _ref14.resourceType,
537
+ destinationProduct = _ref14.destinationProduct,
538
+ destinationSubproduct = _ref14.destinationSubproduct,
539
+ location = _ref14.location;
540
+ var experienceId = id ? id : defaultId;
541
+ startUfoExperience('smart-link-authenticated', experienceId, {
283
542
  extensionKey: extensionKey,
284
543
  status: reason
285
544
  });
286
- dispatchAnalytics(_connectFailedEvent(definitionId, extensionKey, reason));
545
+ dispatchAnalytics(applyCommonAttributes(_connectFailedEvent(_objectSpread(_objectSpread({}, commonAttributes), {}, {
546
+ id: experienceId,
547
+ reason: reason,
548
+ extensionKey: extensionKey,
549
+ definitionId: definitionId,
550
+ resourceType: resourceType,
551
+ destinationProduct: destinationProduct,
552
+ destinationSubproduct: destinationSubproduct,
553
+ location: location
554
+ })), commonAttributes));
287
555
  },
288
556
 
289
557
  /**
@@ -295,21 +563,34 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
295
563
  * @param resourceType The type of resource that was invoked. This is provider specific (e.g. File, PullRequest).
296
564
  * @param error An error representing why the Smart Link request failed.
297
565
  */
298
- instrument: function instrument() {
299
- var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
300
- var status = arguments.length > 1 ? arguments[1] : undefined;
301
- var definitionId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : extractedDefinitionId;
302
- var extensionKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : extractedExtensionKey;
303
- var resourceType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : extractedResourceType;
304
- var error = arguments.length > 5 ? arguments[5] : undefined;
305
- var event = instrumentEvent(id, status, definitionId, extensionKey, resourceType, error);
566
+ instrument: function instrument(_ref15) {
567
+ var id = _ref15.id,
568
+ status = _ref15.status,
569
+ extensionKey = _ref15.extensionKey,
570
+ definitionId = _ref15.definitionId,
571
+ resourceType = _ref15.resourceType,
572
+ destinationProduct = _ref15.destinationProduct,
573
+ destinationSubproduct = _ref15.destinationSubproduct,
574
+ location = _ref15.location,
575
+ error = _ref15.error;
576
+ var event = instrumentEvent(_objectSpread(_objectSpread({}, commonAttributes), {}, {
577
+ id: id,
578
+ status: status,
579
+ extensionKey: extensionKey,
580
+ definitionId: definitionId,
581
+ resourceType: resourceType,
582
+ destinationProduct: destinationProduct,
583
+ destinationSubproduct: destinationSubproduct,
584
+ location: location,
585
+ error: error
586
+ }));
306
587
 
307
588
  if (event) {
308
- dispatchAnalytics(event);
589
+ dispatchAnalytics(applyCommonAttributes(event, commonAttributes));
309
590
  }
310
591
  }
311
592
  };
312
- }, [defaultId, extractedResourceType, extractedDefinitionId, extractedExtensionKey, dispatchAnalytics]);
593
+ }, [defaultId, commonAttributes, dispatchAnalytics]);
313
594
  /** Contains all track analytics events */
314
595
 
315
596
  var track = useMemo(function () {
@@ -320,13 +601,24 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
320
601
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
321
602
  * @returns
322
603
  */
323
- appAccountConnected: function appAccountConnected() {
324
- var definitionId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : extractedDefinitionId;
325
- var extensionKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : extractedExtensionKey;
326
- return dispatchAnalytics(trackAppAccountConnected(definitionId, extensionKey));
604
+ appAccountConnected: function appAccountConnected(_ref16) {
605
+ var extensionKey = _ref16.extensionKey,
606
+ definitionId = _ref16.definitionId,
607
+ resourceType = _ref16.resourceType,
608
+ destinationProduct = _ref16.destinationProduct,
609
+ destinationSubproduct = _ref16.destinationSubproduct,
610
+ location = _ref16.location;
611
+ return dispatchAnalytics(applyCommonAttributes(trackAppAccountConnected(_objectSpread(_objectSpread({}, commonAttributes), {}, {
612
+ extensionKey: extensionKey,
613
+ definitionId: definitionId,
614
+ resourceType: resourceType,
615
+ destinationProduct: destinationProduct,
616
+ destinationSubproduct: destinationSubproduct,
617
+ location: location
618
+ })), commonAttributes));
327
619
  }
328
620
  };
329
- }, [extractedDefinitionId, extractedExtensionKey, dispatchAnalytics]);
621
+ }, [commonAttributes, dispatchAnalytics]);
330
622
  /** Contains all screen analytics events */
331
623
 
332
624
  var screen = useMemo(function () {
@@ -337,13 +629,38 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchA
337
629
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
338
630
  * @returns
339
631
  */
340
- authPopupEvent: function authPopupEvent() {
341
- var definitionId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : extractedDefinitionId;
342
- var extensionKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : extractedExtensionKey;
343
- return dispatchAnalytics(screenAuthPopupEvent(definitionId, extensionKey));
632
+ authPopupEvent: function authPopupEvent(_ref17) {
633
+ var extensionKey = _ref17.extensionKey,
634
+ definitionId = _ref17.definitionId,
635
+ resourceType = _ref17.resourceType,
636
+ destinationProduct = _ref17.destinationProduct,
637
+ destinationSubproduct = _ref17.destinationSubproduct,
638
+ location = _ref17.location;
639
+ return dispatchAnalytics(applyCommonAttributes(screenAuthPopupEvent(_objectSpread(_objectSpread({}, commonAttributes), {}, {
640
+ extensionKey: extensionKey,
641
+ definitionId: definitionId,
642
+ resourceType: resourceType,
643
+ destinationProduct: destinationProduct,
644
+ destinationSubproduct: destinationSubproduct,
645
+ location: location
646
+ })), commonAttributes));
647
+ },
648
+
649
+ /**
650
+ * This fires an event that represents when a user view a modal.
651
+ * @param data A partial analytics event payload
652
+ */
653
+ modalViewedEvent: function modalViewedEvent(data) {
654
+ return dispatchAnalytics(applyCommonAttributes({
655
+ action: 'viewed',
656
+ actionSubject: data.name,
657
+ attributes: _objectSpread(_objectSpread({}, context), data.attributes),
658
+ eventType: 'screen',
659
+ name: data.name
660
+ }, commonAttributes));
344
661
  }
345
662
  };
346
- }, [extractedDefinitionId, extractedExtensionKey, dispatchAnalytics]);
663
+ }, [commonAttributes, dispatchAnalytics]);
347
664
  return useMemo(function () {
348
665
  return {
349
666
  ui: ui,