@atlaskit/smart-card 33.0.0 → 33.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/extractors/flexible/actions/extract-copy-link-action.js +1 -20
- package/dist/cjs/extractors/flexible/actions/extract-download-action.js +1 -23
- package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +1 -34
- package/dist/cjs/extractors/flexible/actions/index.js +2 -15
- package/dist/cjs/extractors/flexible/extract-state.js +1 -5
- package/dist/cjs/extractors/flexible/index.js +3 -7
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +18 -190
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +4 -18
- package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +12 -28
- package/dist/cjs/view/CardWithUrl/loader.js +10 -24
- package/dist/cjs/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/cjs/view/EmbedModal/index.js +8 -65
- package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +26 -63
- package/dist/cjs/view/FlexibleCard/components/actions/download-action/index.js +4 -40
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +4 -47
- package/dist/cjs/view/FlexibleCard/components/container/index.js +1 -4
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +10 -26
- package/dist/cjs/view/FlexibleCard/components/utils.js +1 -28
- package/dist/cjs/view/FlexibleCard/index.js +0 -3
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/cjs/view/HoverCard/index.js +10 -22
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +1 -4
- package/dist/cjs/view/InlineCard/index.js +0 -3
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/actions/extract-copy-link-action.js +0 -19
- package/dist/es2019/extractors/flexible/actions/extract-download-action.js +0 -21
- package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +0 -34
- package/dist/es2019/extractors/flexible/actions/index.js +4 -23
- package/dist/es2019/extractors/flexible/extract-state.js +1 -5
- package/dist/es2019/extractors/flexible/index.js +3 -4
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +2 -172
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +4 -18
- package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +3 -40
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +13 -29
- package/dist/es2019/view/CardWithUrl/loader.js +11 -25
- package/dist/es2019/view/EmbedModal/components/analytics/index.js +39 -88
- package/dist/es2019/view/EmbedModal/index.js +10 -33
- package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +11 -32
- package/dist/es2019/view/FlexibleCard/components/actions/download-action/index.js +4 -22
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +4 -27
- package/dist/es2019/view/FlexibleCard/components/container/index.js +1 -3
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +6 -24
- package/dist/es2019/view/FlexibleCard/components/utils.js +0 -25
- package/dist/es2019/view/FlexibleCard/index.js +0 -3
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +12 -25
- package/dist/es2019/view/HoverCard/index.js +11 -23
- package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +1 -3
- package/dist/es2019/view/InlineCard/index.js +0 -3
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/actions/extract-copy-link-action.js +0 -19
- package/dist/esm/extractors/flexible/actions/extract-download-action.js +0 -23
- package/dist/esm/extractors/flexible/actions/extract-preview-action.js +0 -34
- package/dist/esm/extractors/flexible/actions/index.js +4 -17
- package/dist/esm/extractors/flexible/extract-state.js +1 -5
- package/dist/esm/extractors/flexible/index.js +3 -4
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +19 -191
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +4 -18
- package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +13 -29
- package/dist/esm/view/CardWithUrl/loader.js +10 -24
- package/dist/esm/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/esm/view/EmbedModal/index.js +10 -67
- package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +26 -63
- package/dist/esm/view/FlexibleCard/components/actions/download-action/index.js +4 -40
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +4 -47
- package/dist/esm/view/FlexibleCard/components/container/index.js +1 -4
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +6 -26
- package/dist/esm/view/FlexibleCard/components/utils.js +0 -27
- package/dist/esm/view/FlexibleCard/index.js +0 -3
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/esm/view/HoverCard/index.js +10 -22
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +1 -4
- package/dist/esm/view/InlineCard/index.js +0 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/extractors/flexible/actions/extract-copy-link-action.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/extract-download-action.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/extract-preview-action.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/index.d.ts +0 -6
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -60
- package/dist/types/state/flexible-ui-context/types.d.ts +4 -19
- package/dist/types/state/hooks/use-invoke/types.d.ts +0 -6
- package/dist/types/state/hooks/use-invoke-client-action/index.d.ts +1 -1
- package/dist/types/state/hooks/useSmartLink.d.ts +1 -16
- package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types/utils/mocks.d.ts +1 -16
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/Card/types.d.ts +0 -5
- package/dist/types/view/CardWithUrl/types.d.ts +0 -4
- package/dist/types/view/EmbedModal/index.d.ts +0 -2
- package/dist/types/view/EmbedModal/types.d.ts +0 -3
- package/dist/types/view/FlexibleCard/components/container/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/container/types.d.ts +1 -1
- 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 +0 -6
- package/dist/types/view/FlexibleCard/components/utils.d.ts +0 -6
- package/dist/types/view/FlexibleCard/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/types.d.ts +0 -6
- package/dist/types/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +1 -6
- package/dist/types/view/InlineCard/index.d.ts +1 -1
- package/dist/types/view/InlineCard/types.d.ts +0 -4
- package/dist/types-ts4.5/extractors/flexible/actions/extract-copy-link-action.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/extract-download-action.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/extract-preview-action.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +0 -6
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +2 -60
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +4 -19
- package/dist/types-ts4.5/state/hooks/use-invoke/types.d.ts +0 -6
- package/dist/types-ts4.5/state/hooks/use-invoke-client-action/index.d.ts +1 -1
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +1 -16
- package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types-ts4.5/utils/mocks.d.ts +1 -16
- package/dist/types-ts4.5/view/Card/index.d.ts +1 -1
- package/dist/types-ts4.5/view/Card/types.d.ts +0 -5
- package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +0 -4
- package/dist/types-ts4.5/view/EmbedModal/index.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedModal/types.d.ts +0 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/container/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/container/types.d.ts +1 -1
- 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 +0 -6
- package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +0 -6
- package/dist/types-ts4.5/view/FlexibleCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +0 -6
- package/dist/types-ts4.5/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types-ts4.5/view/InlineCard/UnauthorisedView/index.d.ts +1 -6
- package/dist/types-ts4.5/view/InlineCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/InlineCard/types.d.ts +0 -4
- package/package.json +2 -8
- package/dist/cjs/extractors/action/extractDownloadActionProps.js +0 -32
- package/dist/cjs/extractors/action/extractPreviewActionProps.js +0 -47
- package/dist/cjs/extractors/action/extractViewActionProps.js +0 -31
- package/dist/cjs/extractors/flexible/actions/extract-view-action.js +0 -27
- package/dist/es2019/extractors/action/extractDownloadActionProps.js +0 -24
- package/dist/es2019/extractors/action/extractPreviewActionProps.js +0 -36
- package/dist/es2019/extractors/action/extractViewActionProps.js +0 -23
- package/dist/es2019/extractors/flexible/actions/extract-view-action.js +0 -20
- package/dist/esm/extractors/action/extractDownloadActionProps.js +0 -27
- package/dist/esm/extractors/action/extractPreviewActionProps.js +0 -41
- package/dist/esm/extractors/action/extractViewActionProps.js +0 -26
- package/dist/esm/extractors/flexible/actions/extract-view-action.js +0 -22
- package/dist/types/extractors/action/extractDownloadActionProps.d.ts +0 -7
- package/dist/types/extractors/action/extractPreviewActionProps.d.ts +0 -7
- package/dist/types/extractors/action/extractViewActionProps.d.ts +0 -7
- package/dist/types/extractors/flexible/actions/extract-view-action.d.ts +0 -7
- package/dist/types/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
- package/dist/types-ts4.5/extractors/action/extractDownloadActionProps.d.ts +0 -7
- package/dist/types-ts4.5/extractors/action/extractPreviewActionProps.d.ts +0 -7
- package/dist/types-ts4.5/extractors/action/extractViewActionProps.d.ts +0 -7
- package/dist/types-ts4.5/extractors/flexible/actions/extract-view-action.d.ts +0 -7
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
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; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
2
|
import { useMemo } from 'react';
|
|
6
3
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
4
|
import { getUrl } from '@atlaskit/linking-common';
|
|
8
|
-
import {
|
|
5
|
+
import { invokeFailedEvent as _invokeFailedEvent, invokeSucceededEvent as _invokeSucceededEvent } from '../../utils/analytics';
|
|
9
6
|
import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getStatusDetails, getSubproduct } from '../helpers';
|
|
10
|
-
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
11
7
|
import { useDispatchAnalytics } from './useDispatchAnalytics';
|
|
12
8
|
var applyCommonAttributes = function applyCommonAttributes(event, commonAttributes) {
|
|
13
9
|
if (event && event.attributes) {
|
|
@@ -61,174 +57,26 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
61
57
|
};
|
|
62
58
|
}, [defaultId, extractedDefinitionId, extractedExtensionKey, extractedResourceType, extractedSubproduct, extractedProduct, defaultLocation, extractedStatusDetails]);
|
|
63
59
|
|
|
64
|
-
/** Contains all
|
|
65
|
-
var
|
|
60
|
+
/** Contains all operational analytics events */
|
|
61
|
+
var operational = useMemo(function () {
|
|
66
62
|
return {
|
|
67
63
|
/**
|
|
68
|
-
* This fires an event that represents
|
|
69
|
-
* click a button.
|
|
70
|
-
* @param data A partial analytics event payload
|
|
71
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
72
|
-
*/
|
|
73
|
-
buttonClickedEvent: function buttonClickedEvent(data) {
|
|
74
|
-
return dispatchAnalytics(applyCommonAttributes({
|
|
75
|
-
action: 'clicked',
|
|
76
|
-
actionSubject: 'button',
|
|
77
|
-
actionSubjectId: data.actionSubjectId,
|
|
78
|
-
attributes: _objectSpread(_objectSpread({}, context), data.attributes),
|
|
79
|
-
eventType: 'ui'
|
|
80
|
-
}, commonAttributes));
|
|
81
|
-
},
|
|
82
|
-
/**
|
|
83
|
-
* This fires an event that represents when a user clicks on a Smart Link action.
|
|
84
|
-
* Note: This also starts the UFO smart-link-action-invocation experience.
|
|
64
|
+
* This fires an event that represents an action being successfully invoked.
|
|
85
65
|
* @param id The unique ID for this Smart Link.
|
|
86
66
|
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
87
|
-
* @param actionType The type of
|
|
67
|
+
* @param actionType The type of action invoked, e.g. PreviewAction
|
|
88
68
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
89
|
-
* @returns
|
|
90
69
|
*/
|
|
91
|
-
|
|
70
|
+
invokeSucceededEvent: function invokeSucceededEvent(_ref) {
|
|
92
71
|
var id = _ref.id,
|
|
93
72
|
actionType = _ref.actionType,
|
|
94
73
|
display = _ref.display,
|
|
95
|
-
|
|
74
|
+
extensionKey = _ref.extensionKey,
|
|
96
75
|
definitionId = _ref.definitionId,
|
|
97
76
|
resourceType = _ref.resourceType,
|
|
98
77
|
destinationProduct = _ref.destinationProduct,
|
|
99
78
|
destinationSubproduct = _ref.destinationSubproduct,
|
|
100
79
|
location = _ref.location;
|
|
101
|
-
var extensionKey = overrideExtensionKey !== null && overrideExtensionKey !== void 0 ? overrideExtensionKey : extractedExtensionKey;
|
|
102
|
-
dispatchAnalytics(applyCommonAttributes(uiActionClickedEvent({
|
|
103
|
-
id: id !== null && id !== void 0 ? id : defaultId,
|
|
104
|
-
actionType: actionType,
|
|
105
|
-
display: display,
|
|
106
|
-
extensionKey: extensionKey,
|
|
107
|
-
definitionId: definitionId,
|
|
108
|
-
resourceType: resourceType,
|
|
109
|
-
destinationProduct: destinationProduct,
|
|
110
|
-
destinationSubproduct: destinationSubproduct,
|
|
111
|
-
location: location
|
|
112
|
-
}), commonAttributes));
|
|
113
|
-
},
|
|
114
|
-
/**
|
|
115
|
-
* This fires an event that represents when a user close a modal.
|
|
116
|
-
* @param data A partial analytics event payload
|
|
117
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
118
|
-
*/
|
|
119
|
-
modalClosedEvent: function modalClosedEvent(data) {
|
|
120
|
-
return dispatchAnalytics(applyCommonAttributes({
|
|
121
|
-
action: 'closed',
|
|
122
|
-
actionSubject: 'modal',
|
|
123
|
-
actionSubjectId: data.actionSubjectId,
|
|
124
|
-
attributes: _objectSpread(_objectSpread({}, context), data.attributes),
|
|
125
|
-
eventType: 'ui'
|
|
126
|
-
}, commonAttributes));
|
|
127
|
-
},
|
|
128
|
-
/**
|
|
129
|
-
* This fires an event that represents when a Smart Link was rendered successfully.
|
|
130
|
-
* Note: this fires even if the Smart Link request errored out.
|
|
131
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
132
|
-
* @param id The unique ID for this Smart Link.
|
|
133
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
134
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
135
|
-
* @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
|
|
136
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
137
|
-
*/
|
|
138
|
-
renderSuccessEvent: function renderSuccessEvent(_ref2) {
|
|
139
|
-
var display = _ref2.display,
|
|
140
|
-
status = _ref2.status,
|
|
141
|
-
id = _ref2.id,
|
|
142
|
-
extensionKey = _ref2.extensionKey,
|
|
143
|
-
definitionId = _ref2.definitionId,
|
|
144
|
-
resourceType = _ref2.resourceType,
|
|
145
|
-
destinationProduct = _ref2.destinationProduct,
|
|
146
|
-
destinationSubproduct = _ref2.destinationSubproduct,
|
|
147
|
-
location = _ref2.location,
|
|
148
|
-
_ref2$canBeDatasource = _ref2.canBeDatasource,
|
|
149
|
-
canBeDatasource = _ref2$canBeDatasource === void 0 ? false : _ref2$canBeDatasource;
|
|
150
|
-
var experienceId = id ? id : defaultId;
|
|
151
|
-
succeedUfoExperience('smart-link-rendered', experienceId, {
|
|
152
|
-
extensionKey: extensionKey,
|
|
153
|
-
display: display
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// UFO will disregard this if authentication experience has not yet been started
|
|
157
|
-
succeedUfoExperience('smart-link-authenticated', experienceId, {
|
|
158
|
-
display: display
|
|
159
|
-
});
|
|
160
|
-
dispatchAnalytics(applyCommonAttributes(uiRenderSuccessEvent({
|
|
161
|
-
display: display,
|
|
162
|
-
status: status,
|
|
163
|
-
extensionKey: extensionKey,
|
|
164
|
-
definitionId: definitionId,
|
|
165
|
-
resourceType: resourceType,
|
|
166
|
-
destinationProduct: destinationProduct,
|
|
167
|
-
destinationSubproduct: destinationSubproduct,
|
|
168
|
-
location: location,
|
|
169
|
-
canBeDatasource: canBeDatasource
|
|
170
|
-
}), commonAttributes));
|
|
171
|
-
},
|
|
172
|
-
/**
|
|
173
|
-
* This fires an event that represents when a Smart Link renders unsuccessfuly.
|
|
174
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
175
|
-
* @param id The unique ID for this Smart Link.
|
|
176
|
-
* @param error: An error representing why the Smart Link render failed.
|
|
177
|
-
* @param errorInfo: Additional details about the error including the stack trace.
|
|
178
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
179
|
-
*/
|
|
180
|
-
renderFailedEvent: function renderFailedEvent(_ref3) {
|
|
181
|
-
var display = _ref3.display,
|
|
182
|
-
id = _ref3.id,
|
|
183
|
-
error = _ref3.error,
|
|
184
|
-
errorInfo = _ref3.errorInfo,
|
|
185
|
-
extensionKey = _ref3.extensionKey,
|
|
186
|
-
definitionId = _ref3.definitionId,
|
|
187
|
-
resourceType = _ref3.resourceType,
|
|
188
|
-
destinationProduct = _ref3.destinationProduct,
|
|
189
|
-
destinationSubproduct = _ref3.destinationSubproduct,
|
|
190
|
-
location = _ref3.location;
|
|
191
|
-
var experienceId = id ? id : defaultId;
|
|
192
|
-
// Start and fail the smart-link-rendered experience. If it has already
|
|
193
|
-
// been started nothing happens.
|
|
194
|
-
startUfoExperience('smart-link-rendered', experienceId);
|
|
195
|
-
failUfoExperience('smart-link-rendered', experienceId);
|
|
196
|
-
failUfoExperience('smart-link-authenticated', experienceId);
|
|
197
|
-
dispatchAnalytics(applyCommonAttributes(uiRenderFailedEvent({
|
|
198
|
-
display: display,
|
|
199
|
-
error: error,
|
|
200
|
-
errorInfo: errorInfo,
|
|
201
|
-
extensionKey: extensionKey,
|
|
202
|
-
definitionId: definitionId,
|
|
203
|
-
resourceType: resourceType,
|
|
204
|
-
destinationProduct: destinationProduct,
|
|
205
|
-
destinationSubproduct: destinationSubproduct,
|
|
206
|
-
location: location
|
|
207
|
-
}), commonAttributes));
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
}, [dispatchAnalytics, commonAttributes, defaultId, extractedExtensionKey]);
|
|
211
|
-
|
|
212
|
-
/** Contains all operational analytics events */
|
|
213
|
-
var operational = useMemo(function () {
|
|
214
|
-
return {
|
|
215
|
-
/**
|
|
216
|
-
* This fires an event that represents an action being successfully invoked.
|
|
217
|
-
* @param id The unique ID for this Smart Link.
|
|
218
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
219
|
-
* @param actionType The type of action invoked, e.g. PreviewAction
|
|
220
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
221
|
-
*/
|
|
222
|
-
invokeSucceededEvent: function invokeSucceededEvent(_ref4) {
|
|
223
|
-
var id = _ref4.id,
|
|
224
|
-
actionType = _ref4.actionType,
|
|
225
|
-
display = _ref4.display,
|
|
226
|
-
extensionKey = _ref4.extensionKey,
|
|
227
|
-
definitionId = _ref4.definitionId,
|
|
228
|
-
resourceType = _ref4.resourceType,
|
|
229
|
-
destinationProduct = _ref4.destinationProduct,
|
|
230
|
-
destinationSubproduct = _ref4.destinationSubproduct,
|
|
231
|
-
location = _ref4.location;
|
|
232
80
|
dispatchAnalytics(applyCommonAttributes(_invokeSucceededEvent({
|
|
233
81
|
id: id !== null && id !== void 0 ? id : defaultId,
|
|
234
82
|
actionType: actionType,
|
|
@@ -249,17 +97,17 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
249
97
|
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
250
98
|
* @param reason The reason the invocation failed.
|
|
251
99
|
*/
|
|
252
|
-
invokeFailedEvent: function invokeFailedEvent(
|
|
253
|
-
var id =
|
|
254
|
-
actionType =
|
|
255
|
-
display =
|
|
256
|
-
reason =
|
|
257
|
-
extensionKey =
|
|
258
|
-
definitionId =
|
|
259
|
-
resourceType =
|
|
260
|
-
destinationProduct =
|
|
261
|
-
destinationSubproduct =
|
|
262
|
-
location =
|
|
100
|
+
invokeFailedEvent: function invokeFailedEvent(_ref2) {
|
|
101
|
+
var id = _ref2.id,
|
|
102
|
+
actionType = _ref2.actionType,
|
|
103
|
+
display = _ref2.display,
|
|
104
|
+
reason = _ref2.reason,
|
|
105
|
+
extensionKey = _ref2.extensionKey,
|
|
106
|
+
definitionId = _ref2.definitionId,
|
|
107
|
+
resourceType = _ref2.resourceType,
|
|
108
|
+
destinationProduct = _ref2.destinationProduct,
|
|
109
|
+
destinationSubproduct = _ref2.destinationSubproduct,
|
|
110
|
+
location = _ref2.location;
|
|
263
111
|
dispatchAnalytics(applyCommonAttributes(_invokeFailedEvent({
|
|
264
112
|
id: id !== null && id !== void 0 ? id : defaultId,
|
|
265
113
|
actionType: actionType,
|
|
@@ -275,30 +123,10 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
|
|
|
275
123
|
}
|
|
276
124
|
};
|
|
277
125
|
}, [defaultId, commonAttributes, dispatchAnalytics]);
|
|
278
|
-
|
|
279
|
-
/** Contains all screen analytics events */
|
|
280
|
-
var screen = useMemo(function () {
|
|
281
|
-
return {
|
|
282
|
-
/**
|
|
283
|
-
* This fires an event that represents when a user view a modal.
|
|
284
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
285
|
-
*/
|
|
286
|
-
modalViewedEvent: function modalViewedEvent(data) {
|
|
287
|
-
return dispatchAnalytics(applyCommonAttributes({
|
|
288
|
-
action: 'viewed',
|
|
289
|
-
actionSubject: data.name,
|
|
290
|
-
attributes: _objectSpread(_objectSpread({}, context), data.attributes),
|
|
291
|
-
eventType: 'screen',
|
|
292
|
-
name: data.name
|
|
293
|
-
}, commonAttributes));
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
}, [commonAttributes, dispatchAnalytics]);
|
|
297
126
|
return useMemo(function () {
|
|
298
127
|
return {
|
|
299
|
-
ui: ui,
|
|
300
128
|
operational: operational,
|
|
301
129
|
screen: screen
|
|
302
130
|
};
|
|
303
|
-
}, [
|
|
131
|
+
}, [operational]);
|
|
304
132
|
};
|
|
@@ -2,7 +2,6 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import uuid from 'uuid';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
7
6
|
import * as measure from '../../../utils/performance';
|
|
8
7
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from '../../analytics';
|
|
@@ -12,14 +11,13 @@ var ACTION_EXPERIENCE_NAME = 'smart-link-action-invocation';
|
|
|
12
11
|
* Invoke client action such as preview, download and open link
|
|
13
12
|
*/
|
|
14
13
|
var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
15
|
-
var
|
|
16
|
-
fireEventProp = _ref.fireEvent;
|
|
14
|
+
var fireEventProp = _ref.fireEvent;
|
|
17
15
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
18
16
|
defaultFireEvent = _useAnalyticsEvents.fireEvent;
|
|
19
17
|
var fireEvent = fireEventProp !== null && fireEventProp !== void 0 ? fireEventProp : defaultFireEvent;
|
|
20
18
|
return useCallback( /*#__PURE__*/function () {
|
|
21
19
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
22
|
-
var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, _ref2$resourceType, resourceType, experienceId, markName,
|
|
20
|
+
var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, _ref2$resourceType, resourceType, experienceId, markName, _measure$getMeasure$d, _measure$getMeasure, result, _measure$getMeasure$d2, _measure$getMeasure2, reason;
|
|
23
21
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
24
22
|
while (1) switch (_context.prev = _context.next) {
|
|
25
23
|
case 0:
|
|
@@ -37,7 +35,7 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
37
35
|
});
|
|
38
36
|
|
|
39
37
|
// Begin analytics instrumentation.
|
|
40
|
-
if (actionSubjectId
|
|
38
|
+
if (actionSubjectId !== undefined) {
|
|
41
39
|
fireEvent("ui.button.clicked.".concat(actionSubjectId), {
|
|
42
40
|
actionType: actionType !== null && actionType !== void 0 ? actionType : null,
|
|
43
41
|
definitionId: definitionId,
|
|
@@ -45,13 +43,7 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
45
43
|
id: id !== null && id !== void 0 ? id : experienceId,
|
|
46
44
|
resourceType: resourceType
|
|
47
45
|
});
|
|
48
|
-
} else {
|
|
49
|
-
analytics === null || analytics === void 0 || analytics.ui.actionClickedEvent({
|
|
50
|
-
actionType: actionType,
|
|
51
|
-
display: display
|
|
52
|
-
});
|
|
53
46
|
}
|
|
54
|
-
|
|
55
47
|
// Invoke action
|
|
56
48
|
_context.next = 9;
|
|
57
49
|
return actionFn();
|
|
@@ -59,21 +51,14 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
59
51
|
result = _context.sent;
|
|
60
52
|
measure.mark(markName, 'resolved');
|
|
61
53
|
succeedUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
71
|
-
} else {
|
|
72
|
-
analytics === null || analytics === void 0 || analytics.operational.invokeSucceededEvent({
|
|
73
|
-
actionType: actionType,
|
|
74
|
-
display: display
|
|
75
|
-
});
|
|
76
|
-
}
|
|
54
|
+
fireEvent('operational.smartLinkAction.resolved', {
|
|
55
|
+
actionType: actionType !== null && actionType !== void 0 ? actionType : null,
|
|
56
|
+
definitionId: definitionId,
|
|
57
|
+
display: display !== null && display !== void 0 ? display : null,
|
|
58
|
+
duration: (_measure$getMeasure$d = (_measure$getMeasure = measure.getMeasure(markName, 'resolved')) === null || _measure$getMeasure === void 0 ? void 0 : _measure$getMeasure.duration) !== null && _measure$getMeasure$d !== void 0 ? _measure$getMeasure$d : null,
|
|
59
|
+
id: id !== null && id !== void 0 ? id : experienceId,
|
|
60
|
+
resourceType: resourceType
|
|
61
|
+
});
|
|
77
62
|
return _context.abrupt("return", result);
|
|
78
63
|
case 16:
|
|
79
64
|
_context.prev = 16;
|
|
@@ -81,23 +66,15 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
81
66
|
measure.mark(markName, 'errored');
|
|
82
67
|
failUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
|
|
83
68
|
reason = typeof _context.t0 === 'string' ? _context.t0 : _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
analytics === null || analytics === void 0 || analytics.operational.invokeFailedEvent({
|
|
96
|
-
actionType: actionType,
|
|
97
|
-
display: display,
|
|
98
|
-
reason: reason
|
|
99
|
-
});
|
|
100
|
-
}
|
|
69
|
+
fireEvent('operational.smartLinkAction.unresolved', {
|
|
70
|
+
actionType: actionType !== null && actionType !== void 0 ? actionType : null,
|
|
71
|
+
definitionId: definitionId,
|
|
72
|
+
display: display !== null && display !== void 0 ? display : null,
|
|
73
|
+
duration: (_measure$getMeasure$d2 = (_measure$getMeasure2 = measure.getMeasure(markName, 'errored')) === null || _measure$getMeasure2 === void 0 ? void 0 : _measure$getMeasure2.duration) !== null && _measure$getMeasure$d2 !== void 0 ? _measure$getMeasure$d2 : null,
|
|
74
|
+
id: id !== null && id !== void 0 ? id : experienceId,
|
|
75
|
+
reason: reason,
|
|
76
|
+
resourceType: resourceType
|
|
77
|
+
});
|
|
101
78
|
case 22:
|
|
102
79
|
case "end":
|
|
103
80
|
return _context.stop();
|
|
@@ -107,6 +84,6 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
107
84
|
return function (_x) {
|
|
108
85
|
return _ref3.apply(this, arguments);
|
|
109
86
|
};
|
|
110
|
-
}(), [
|
|
87
|
+
}(), [fireEvent]);
|
|
111
88
|
};
|
|
112
89
|
export default useInvokeClientAction;
|
|
@@ -3,18 +3,13 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import uuid from 'uuid';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
8
7
|
import { extractInvokeDownloadAction } from '../../extractors/action/extract-invoke-download-action';
|
|
9
8
|
import { extractInvokePreviewAction } from '../../extractors/action/extract-invoke-preview-action';
|
|
10
9
|
import { extractInvokeViewAction } from '../../extractors/action/extract-invoke-view-action';
|
|
11
|
-
import { extractDownloadActionProps } from '../../extractors/action/extractDownloadActionProps';
|
|
12
|
-
import { extractPreviewActionProps } from '../../extractors/action/extractPreviewActionProps';
|
|
13
|
-
import { extractViewActionProps } from '../../extractors/action/extractViewActionProps';
|
|
14
10
|
import { messages } from '../../messages';
|
|
15
11
|
import { toAction } from '../../utils/actions/to-action';
|
|
16
12
|
import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
|
|
17
|
-
import { getExtensionKey } from '../helpers';
|
|
18
13
|
import useInvokeClientAction from '../hooks/use-invoke-client-action';
|
|
19
14
|
import { useSmartCardState as useLinkState } from '../store';
|
|
20
15
|
export function useSmartLinkActions(_ref) {
|
|
@@ -33,15 +28,6 @@ export function useSmartLinkActions(_ref) {
|
|
|
33
28
|
analytics: linkAnalytics
|
|
34
29
|
});
|
|
35
30
|
if (linkState.details && !(actionOptions !== null && actionOptions !== void 0 && actionOptions.hide)) {
|
|
36
|
-
var opts = {
|
|
37
|
-
response: linkState.details,
|
|
38
|
-
handleInvoke: invokeClientAction,
|
|
39
|
-
analytics: linkAnalytics,
|
|
40
|
-
origin: origin,
|
|
41
|
-
extensionKey: getExtensionKey(linkState.details),
|
|
42
|
-
source: appearance,
|
|
43
|
-
actionOptions: actionOptions
|
|
44
|
-
};
|
|
45
31
|
var actions = [];
|
|
46
32
|
var invokeParam = {
|
|
47
33
|
actionOptions: actionOptions,
|
|
@@ -49,18 +35,18 @@ export function useSmartLinkActions(_ref) {
|
|
|
49
35
|
id: id,
|
|
50
36
|
response: linkState.details
|
|
51
37
|
};
|
|
52
|
-
var downloadActionProps =
|
|
38
|
+
var downloadActionProps = extractInvokeDownloadAction(invokeParam);
|
|
53
39
|
if (downloadActionProps) {
|
|
54
40
|
actions.push(toAction(downloadActionProps, invokeClientAction, messages.download, 'download-content'));
|
|
55
41
|
}
|
|
56
|
-
var viewActionProps =
|
|
42
|
+
var viewActionProps = extractInvokeViewAction(invokeParam);
|
|
57
43
|
if (viewActionProps) {
|
|
58
44
|
actions.push(toAction(viewActionProps, invokeClientAction, messages.view, 'view-content'));
|
|
59
45
|
}
|
|
60
|
-
var previewActionProps =
|
|
46
|
+
var previewActionProps = extractInvokePreviewAction(_objectSpread(_objectSpread({}, invokeParam), {}, {
|
|
61
47
|
fireEvent: fireEvent,
|
|
62
48
|
origin: origin
|
|
63
|
-
}))
|
|
49
|
+
}));
|
|
64
50
|
if (previewActionProps) {
|
|
65
51
|
actions.push(toAction(previewActionProps, invokeClientAction, messages.preview_improved, 'preview-content'));
|
|
66
52
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -7,10 +6,8 @@ import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
|
7
6
|
import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
|
|
8
7
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
9
8
|
import { getUrl } from '@atlaskit/linking-common';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
9
|
import { useSmartCardState as useSmartLinkState } from '../../state/store';
|
|
12
10
|
import { context } from './analytics';
|
|
13
|
-
import { LinkAnalyticsContext } from './LinkAnalyticsContext';
|
|
14
11
|
var getExtendedResolvedAttributes = function getExtendedResolvedAttributes(linkDetails, details, linkStatus) {
|
|
15
12
|
var _details$meta$definit, _details$meta, _details$meta$resourc, _details$meta2;
|
|
16
13
|
return _objectSpread({
|
|
@@ -49,14 +46,14 @@ export var useSmartLinkAnalyticsContext = function useSmartLinkAnalyticsContext(
|
|
|
49
46
|
store = _useSmartLinkContext.store;
|
|
50
47
|
var state = store ? getUrl(store, url) : undefined;
|
|
51
48
|
return useMemo(function () {
|
|
52
|
-
return
|
|
49
|
+
return getSmartLinkAnalyticsContext({
|
|
53
50
|
display: display,
|
|
54
51
|
id: id,
|
|
55
52
|
response: state === null || state === void 0 ? void 0 : state.details,
|
|
56
53
|
source: source,
|
|
57
54
|
status: state === null || state === void 0 ? void 0 : state.status,
|
|
58
55
|
url: url
|
|
59
|
-
})
|
|
56
|
+
});
|
|
60
57
|
}, [display, id, source, state === null || state === void 0 ? void 0 : state.details, state === null || state === void 0 ? void 0 : state.status, url]);
|
|
61
58
|
};
|
|
62
59
|
|
|
@@ -64,7 +61,7 @@ export var useSmartLinkAnalyticsContext = function useSmartLinkAnalyticsContext(
|
|
|
64
61
|
* Provides an analytics context to supply attributes to events based on a URL
|
|
65
62
|
* and the link state in the store
|
|
66
63
|
*/
|
|
67
|
-
var
|
|
64
|
+
export var SmartLinkAnalyticsContext = function SmartLinkAnalyticsContext(_ref3) {
|
|
68
65
|
var children = _ref3.children,
|
|
69
66
|
display = _ref3.display,
|
|
70
67
|
id = _ref3.id,
|
|
@@ -84,35 +81,4 @@ var ExtendedSmartLinkAnalyticsContext = function ExtendedSmartLinkAnalyticsConte
|
|
|
84
81
|
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
85
82
|
data: data
|
|
86
83
|
}, children);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Provides an analytics context to supply attributes to events based on a URL
|
|
91
|
-
* and the link state in the store
|
|
92
|
-
*/
|
|
93
|
-
var LegacySmartLinkAnalyticsContext = function LegacySmartLinkAnalyticsContext(props) {
|
|
94
|
-
var children = props.children,
|
|
95
|
-
url = props.url,
|
|
96
|
-
display = props.display;
|
|
97
|
-
var _useSmartLinkState2 = useSmartLinkState(url),
|
|
98
|
-
details = _useSmartLinkState2.details,
|
|
99
|
-
status = _useSmartLinkState2.status;
|
|
100
|
-
var attributes = getResolvedAttributes({
|
|
101
|
-
url: url
|
|
102
|
-
}, details, status);
|
|
103
|
-
return /*#__PURE__*/React.createElement(LinkAnalyticsContext, _extends({}, props, {
|
|
104
|
-
display: display
|
|
105
|
-
}), /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
106
|
-
data: {
|
|
107
|
-
attributes: attributes
|
|
108
|
-
}
|
|
109
|
-
}, children));
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Provides an analytics context to supply attributes to events based on a URL
|
|
114
|
-
* and the link state in the store
|
|
115
|
-
*/
|
|
116
|
-
export var SmartLinkAnalyticsContext = function SmartLinkAnalyticsContext(props) {
|
|
117
|
-
return fg('platform-smart-card-migrate-embed-modal-analytics') ? /*#__PURE__*/React.createElement(ExtendedSmartLinkAnalyticsContext, props) : /*#__PURE__*/React.createElement(LegacySmartLinkAnalyticsContext, props);
|
|
118
84
|
};
|
|
@@ -8,7 +8,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
8
8
|
export var context = {
|
|
9
9
|
componentName: 'smart-cards',
|
|
10
10
|
packageName: "@atlaskit/smart-card",
|
|
11
|
-
packageVersion: "33.
|
|
11
|
+
packageVersion: "33.2.0"
|
|
12
12
|
};
|
|
13
13
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
14
14
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
2
2
|
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
5
4
|
import { CardDisplay } from '../../constants';
|
|
6
5
|
import { useSmartLink } from '../../state';
|
|
7
6
|
import { succeedUfoExperience } from '../../state/analytics';
|
|
8
|
-
import {
|
|
7
|
+
import { getClickUrl, getDefinitionId, getExtensionKey, getResourceType, getServices, isFinalState } from '../../state/helpers';
|
|
9
8
|
import { SmartLinkModalProvider } from '../../state/modal';
|
|
10
9
|
import { isSpecialEvent } from '../../utils';
|
|
11
10
|
import { combineActionOptions } from '../../utils/actions/combine-action-options';
|
|
@@ -38,7 +37,6 @@ function Component(_ref) {
|
|
|
38
37
|
children = _ref.children,
|
|
39
38
|
showHoverPreview = _ref.showHoverPreview,
|
|
40
39
|
hoverPreviewOptions = _ref.hoverPreviewOptions,
|
|
41
|
-
showAuthTooltip = _ref.showAuthTooltip,
|
|
42
40
|
analyticsEvents = _ref.analyticsEvents,
|
|
43
41
|
removeTextHighlightingFromTitle = _ref.removeTextHighlightingFromTitle,
|
|
44
42
|
resolvingPlaceholder = _ref.resolvingPlaceholder,
|
|
@@ -61,7 +59,6 @@ function Component(_ref) {
|
|
|
61
59
|
var extensionKey = getExtensionKey(state.details);
|
|
62
60
|
var resourceType = getResourceType(state.details);
|
|
63
61
|
var services = getServices(state.details);
|
|
64
|
-
var canBeDatasource = getCanBeDatasource(state.details);
|
|
65
62
|
var isFlexibleUi = useMemo(function () {
|
|
66
63
|
return isFlexibleUiCard(children);
|
|
67
64
|
}, [children]);
|
|
@@ -142,31 +139,20 @@ function Component(_ref) {
|
|
|
142
139
|
// - the unresolved states: viz. forbidden, not_found, unauthorized, errored.
|
|
143
140
|
useEffect(function () {
|
|
144
141
|
if (isFinalState(state.status)) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
});
|
|
142
|
+
succeedUfoExperience('smart-link-rendered', id || 'NULL', {
|
|
143
|
+
extensionKey: extensionKey,
|
|
144
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
145
|
+
});
|
|
150
146
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
} else {
|
|
159
|
-
analytics.ui.renderSuccessEvent({
|
|
160
|
-
display: isFlexibleUi ? 'flexible' : appearance,
|
|
161
|
-
status: state.status,
|
|
162
|
-
id: id,
|
|
163
|
-
definitionId: definitionId,
|
|
164
|
-
extensionKey: extensionKey,
|
|
165
|
-
canBeDatasource: canBeDatasource
|
|
166
|
-
});
|
|
167
|
-
}
|
|
147
|
+
// UFO will disregard this if authentication experience has not yet been started
|
|
148
|
+
succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
|
|
149
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
150
|
+
});
|
|
151
|
+
fireEvent('ui.smartLink.renderSuccess', {
|
|
152
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
153
|
+
});
|
|
168
154
|
}
|
|
169
|
-
}, [
|
|
155
|
+
}, [appearance, extensionKey, fireEvent, id, isFlexibleUi, state.status]);
|
|
170
156
|
var onIframeDwell = useCallback(function (dwellTime, dwellPercentVisible) {
|
|
171
157
|
fireEvent('ui.smartLinkIframe.dwelled', {
|
|
172
158
|
id: id,
|
|
@@ -204,7 +190,6 @@ function Component(_ref) {
|
|
|
204
190
|
ui: ui,
|
|
205
191
|
showHoverPreview: showHoverPreview,
|
|
206
192
|
hoverPreviewOptions: hoverPreviewOptions,
|
|
207
|
-
showAuthTooltip: fg('platform_deprecate-showauthtooltip-smart-card') ? undefined : showAuthTooltip,
|
|
208
193
|
actionOptions: actionOptions,
|
|
209
194
|
url: url,
|
|
210
195
|
testId: testId,
|
|
@@ -236,7 +221,6 @@ function Component(_ref) {
|
|
|
236
221
|
inlinePreloaderStyle: inlinePreloaderStyle,
|
|
237
222
|
showHoverPreview: showHoverPreview,
|
|
238
223
|
hoverPreviewOptions: hoverPreviewOptions,
|
|
239
|
-
showAuthTooltip: fg('platform_deprecate-showauthtooltip-smart-card') ? undefined : showAuthTooltip,
|
|
240
224
|
actionOptions: actionOptions,
|
|
241
225
|
removeTextHighlightingFromTitle: removeTextHighlightingFromTitle,
|
|
242
226
|
resolvingPlaceholder: resolvingPlaceholder,
|