@atlaskit/smart-card 33.1.0 → 33.3.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 +16 -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/actions/index.js +2 -4
- package/dist/cjs/state/analytics/index.js +1 -8
- package/dist/cjs/state/flexible-ui-context/index.js +1 -10
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/cjs/state/hooks/useSmartLink.js +1 -4
- package/dist/cjs/state/hooks-external/useSmartLinkActions.js +5 -21
- package/dist/cjs/state/hooks-external/useSmartLinkReload.js +1 -3
- package/dist/cjs/state/index.js +1 -8
- package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/cjs/utils/analytics/analytics.js +2 -144
- package/dist/cjs/utils/analytics/index.js +0 -30
- package/dist/cjs/utils/analytics/types.js +1 -5
- package/dist/cjs/utils/mocks.js +1 -23
- package/dist/cjs/view/BlockCard/index.js +1 -3
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +1 -3
- package/dist/cjs/view/BlockCard/views/UnauthorisedView.js +2 -4
- package/dist/cjs/view/CardWithUrl/component.js +13 -33
- package/dist/cjs/view/CardWithUrl/loader.js +10 -22
- package/dist/cjs/view/EmbedCard/index.js +0 -4
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/index.js +3 -5
- package/dist/cjs/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/cjs/view/EmbedModal/index.js +9 -68
- package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +27 -67
- package/dist/cjs/view/FlexibleCard/components/actions/download-action/index.js +5 -44
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +5 -51
- 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 +3 -17
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +1 -3
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -8
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +3 -5
- package/dist/cjs/view/HoverCard/index.js +10 -22
- package/dist/cjs/view/InlineCard/index.js +1 -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/actions/index.js +2 -4
- package/dist/es2019/state/analytics/index.js +1 -2
- package/dist/es2019/state/flexible-ui-context/index.js +0 -7
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/es2019/state/hooks/useSmartLink.js +1 -4
- package/dist/es2019/state/hooks-external/useSmartLinkActions.js +5 -21
- package/dist/es2019/state/hooks-external/useSmartLinkReload.js +1 -3
- package/dist/es2019/state/index.js +1 -2
- package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +3 -40
- package/dist/es2019/utils/analytics/analytics.js +2 -145
- package/dist/es2019/utils/analytics/index.js +1 -1
- package/dist/es2019/utils/analytics/types.js +0 -1
- package/dist/es2019/utils/mocks.js +1 -23
- package/dist/es2019/view/BlockCard/index.js +1 -3
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +1 -3
- package/dist/es2019/view/BlockCard/views/UnauthorisedView.js +1 -3
- package/dist/es2019/view/CardWithUrl/component.js +14 -34
- package/dist/es2019/view/CardWithUrl/loader.js +11 -23
- package/dist/es2019/view/EmbedCard/index.js +0 -4
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/index.js +1 -3
- package/dist/es2019/view/EmbedModal/components/analytics/index.js +39 -88
- package/dist/es2019/view/EmbedModal/index.js +10 -35
- package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +13 -37
- package/dist/es2019/view/FlexibleCard/components/actions/download-action/index.js +6 -27
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +6 -32
- 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 +3 -15
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +1 -3
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -8
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +12 -25
- package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +2 -4
- package/dist/es2019/view/HoverCard/index.js +11 -23
- package/dist/es2019/view/InlineCard/index.js +0 -2
- 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/actions/index.js +2 -4
- package/dist/esm/state/analytics/index.js +1 -2
- package/dist/esm/state/flexible-ui-context/index.js +0 -9
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +21 -44
- package/dist/esm/state/hooks/useSmartLink.js +1 -4
- package/dist/esm/state/hooks-external/useSmartLinkActions.js +5 -21
- package/dist/esm/state/hooks-external/useSmartLinkReload.js +1 -3
- package/dist/esm/state/index.js +1 -2
- package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
- package/dist/esm/utils/analytics/analytics.js +1 -143
- package/dist/esm/utils/analytics/index.js +1 -1
- package/dist/esm/utils/analytics/types.js +0 -1
- package/dist/esm/utils/mocks.js +0 -22
- package/dist/esm/view/BlockCard/index.js +1 -3
- package/dist/esm/view/BlockCard/views/ResolvedView.js +1 -3
- package/dist/esm/view/BlockCard/views/UnauthorisedView.js +2 -4
- package/dist/esm/view/CardWithUrl/component.js +14 -34
- package/dist/esm/view/CardWithUrl/loader.js +10 -22
- package/dist/esm/view/EmbedCard/index.js +0 -4
- package/dist/esm/view/EmbedCard/views/unauthorized-view/index.js +3 -5
- package/dist/esm/view/EmbedModal/components/analytics/index.js +40 -89
- package/dist/esm/view/EmbedModal/index.js +11 -70
- package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +28 -68
- package/dist/esm/view/FlexibleCard/components/actions/download-action/index.js +6 -45
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +6 -52
- 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 +4 -18
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +1 -3
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -8
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +13 -30
- package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +3 -5
- package/dist/esm/view/HoverCard/index.js +10 -22
- package/dist/esm/view/InlineCard/index.js +1 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/extractors/common/actions/types.d.ts +0 -2
- 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/actions/index.d.ts +1 -2
- package/dist/types/state/analytics/index.d.ts +0 -2
- package/dist/types/state/flexible-ui-context/index.d.ts +1 -7
- package/dist/types/state/flexible-ui-context/types.d.ts +4 -25
- 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/use-invoke-client-action/types.d.ts +0 -6
- package/dist/types/state/hooks/useSmartLink.d.ts +0 -22
- package/dist/types/state/index.d.ts +0 -1
- package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types/utils/analytics/analytics.d.ts +0 -6
- package/dist/types/utils/analytics/index.d.ts +1 -1
- package/dist/types/utils/analytics/types.d.ts +0 -42
- package/dist/types/utils/mocks.d.ts +0 -22
- package/dist/types/view/BlockCard/index.d.ts +1 -1
- package/dist/types/view/BlockCard/types.d.ts +0 -2
- package/dist/types/view/BlockCard/views/types.d.ts +1 -1
- package/dist/types/view/CardWithUrl/types.d.ts +0 -2
- package/dist/types/view/EmbedCard/types.d.ts +0 -2
- package/dist/types/view/EmbedCard/views/unauthorized-view/index.d.ts +1 -1
- package/dist/types/view/EmbedCard/views/unauthorized-view/types.d.ts +0 -2
- package/dist/types/view/EmbedModal/components/analytics/types.d.ts +0 -2
- 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/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/HoverCardContent.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/resolved/types.d.ts +0 -2
- package/dist/types/view/HoverCard/components/views/unauthorised/index.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/unauthorised/types.d.ts +0 -5
- package/dist/types/view/HoverCard/types.d.ts +0 -3
- package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +0 -3
- package/dist/types/view/InlineCard/index.d.ts +1 -1
- package/dist/types/view/InlineCard/types.d.ts +0 -2
- package/dist/types/view/common/UnauthorisedViewContent.d.ts +0 -6
- package/dist/types-ts4.5/extractors/common/actions/types.d.ts +0 -2
- 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/actions/index.d.ts +1 -2
- package/dist/types-ts4.5/state/analytics/index.d.ts +0 -2
- package/dist/types-ts4.5/state/flexible-ui-context/index.d.ts +1 -7
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +4 -25
- 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/use-invoke-client-action/types.d.ts +0 -6
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +0 -22
- package/dist/types-ts4.5/state/index.d.ts +0 -1
- package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +0 -6
- package/dist/types-ts4.5/utils/analytics/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/analytics/types.d.ts +0 -42
- package/dist/types-ts4.5/utils/mocks.d.ts +0 -22
- package/dist/types-ts4.5/view/BlockCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/BlockCard/types.d.ts +0 -2
- package/dist/types-ts4.5/view/BlockCard/views/types.d.ts +1 -1
- package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedCard/types.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/index.d.ts +1 -1
- package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/types.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedModal/components/analytics/types.d.ts +0 -2
- 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/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/HoverCardContent.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/HoverCard/components/views/resolved/types.d.ts +0 -2
- package/dist/types-ts4.5/view/HoverCard/components/views/unauthorised/index.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/unauthorised/types.d.ts +0 -5
- package/dist/types-ts4.5/view/HoverCard/types.d.ts +0 -3
- package/dist/types-ts4.5/view/InlineCard/UnauthorisedView/index.d.ts +0 -3
- package/dist/types-ts4.5/view/InlineCard/index.d.ts +1 -1
- package/dist/types-ts4.5/view/InlineCard/types.d.ts +0 -2
- package/dist/types-ts4.5/view/common/UnauthorisedViewContent.d.ts +0 -6
- package/package.json +1 -4
- 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/cjs/state/analytics/useSmartLinkAnalytics.js +0 -311
- 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/es2019/state/analytics/useSmartLinkAnalytics.js +0 -296
- 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/esm/state/analytics/useSmartLinkAnalytics.js +0 -304
- 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/state/analytics/useSmartLinkAnalytics.d.ts +0 -91
- package/dist/types/utils/analytics/__mocks__/analytics.d.ts +0 -2
- 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/state/analytics/useSmartLinkAnalytics.d.ts +0 -91
- package/dist/types-ts4.5/utils/analytics/__mocks__/analytics.d.ts +0 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["appearance", "fireEvent", "id", "origin", "renderers", "resolve", "actionOptions", "response", "aiSummaryConfig"];
|
|
3
3
|
import { extractAri, extractDateCreated, extractDateUpdated, extractLink, extractPersonCreatedBy, extractPersonOwnedBy, extractTitle } from '@atlaskit/link-extractors';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { extractSummary } from '../common/primitives';
|
|
6
|
-
import
|
|
5
|
+
import { extractFlexibleCardActions } from './actions';
|
|
7
6
|
import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
8
7
|
import extractPreview from './extract-preview';
|
|
9
8
|
import extractPriority from './extract-priority';
|
|
@@ -30,7 +29,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
30
29
|
var data = response.data;
|
|
31
30
|
var url = extractLink(data);
|
|
32
31
|
return {
|
|
33
|
-
actions:
|
|
32
|
+
actions: extractFlexibleCardActions({
|
|
34
33
|
actionOptions: actionOptions,
|
|
35
34
|
aiSummaryConfig: aiSummaryConfig,
|
|
36
35
|
appearance: appearance,
|
|
@@ -39,7 +38,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
39
38
|
origin: origin,
|
|
40
39
|
response: response,
|
|
41
40
|
url: props.url // Use the original URL in edge cases, such as short links for AI summary and copy link actions.
|
|
42
|
-
})
|
|
41
|
+
}),
|
|
43
42
|
assignedToGroup: extractPersonAssignedToAsArray(data),
|
|
44
43
|
attachmentCount: extractAttachmentCount(data),
|
|
45
44
|
authorGroup: extractPersonCreatedBy(data),
|
|
@@ -10,11 +10,9 @@ import { startUfoExperience } from '../analytics';
|
|
|
10
10
|
import { getByDefinitionId, getDefinitionId, getExtensionKey, getServices } from '../helpers';
|
|
11
11
|
import useInvokeClientAction from '../hooks/use-invoke-client-action';
|
|
12
12
|
import useResolve from '../hooks/use-resolve';
|
|
13
|
-
export var useSmartCardActions = function useSmartCardActions(id, url
|
|
13
|
+
export var useSmartCardActions = function useSmartCardActions(id, url) {
|
|
14
14
|
var resolveUrl = useResolve();
|
|
15
|
-
var invokeClientAction = useInvokeClientAction({
|
|
16
|
-
analytics: analytics
|
|
17
|
-
});
|
|
15
|
+
var invokeClientAction = useInvokeClientAction({});
|
|
18
16
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
19
17
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
20
18
|
var _useSmartLinkContext = useSmartLinkContext(),
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { startUfoExperience, succeedUfoExperience, failUfoExperience, addMetadataToExperience } from './ufoExperiences';
|
|
2
|
-
export { useSmartLinkAnalytics } from './useSmartLinkAnalytics';
|
|
1
|
+
export { startUfoExperience, succeedUfoExperience, failUfoExperience, addMetadataToExperience } from './ufoExperiences';
|
|
@@ -8,15 +8,6 @@ export var useFlexibleUiContext = function useFlexibleUiContext() {
|
|
|
8
8
|
return useContext(FlexibleUiContext);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
13
|
-
* underlying elements.
|
|
14
|
-
*/
|
|
15
|
-
export var FlexibleUiAnalyticsContext = /*#__PURE__*/createContext(undefined);
|
|
16
|
-
export var useFlexibleUiAnalyticsContext = function useFlexibleUiAnalyticsContext() {
|
|
17
|
-
return useContext(FlexibleUiAnalyticsContext);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
11
|
/**
|
|
21
12
|
* This provides the ui options that will be used by Smart Links Flexible UI
|
|
22
13
|
* to render its underlying elements.
|
|
@@ -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;
|
|
@@ -2,7 +2,6 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
4
4
|
import { useSmartCardActions as useSmartLinkActions } from '../actions';
|
|
5
|
-
import { useSmartLinkAnalytics } from '../analytics';
|
|
6
5
|
import { useSmartLinkConfig } from '../config';
|
|
7
6
|
import { useSmartLinkRenderers } from '../renderers';
|
|
8
7
|
import { useSmartCardState as useSmartLinkState } from '../store';
|
|
@@ -10,8 +9,7 @@ export function useSmartLink(id, url) {
|
|
|
10
9
|
var state = useSmartLinkState(url);
|
|
11
10
|
var _useSmartLinkContext = useSmartLinkContext(),
|
|
12
11
|
store = _useSmartLinkContext.store;
|
|
13
|
-
var
|
|
14
|
-
var actions = useSmartLinkActions(id, url, analytics);
|
|
12
|
+
var actions = useSmartLinkActions(id, url);
|
|
15
13
|
var config = useSmartLinkConfig();
|
|
16
14
|
var renderers = useSmartLinkRenderers();
|
|
17
15
|
|
|
@@ -35,7 +33,6 @@ export function useSmartLink(id, url) {
|
|
|
35
33
|
state: state,
|
|
36
34
|
actions: actions,
|
|
37
35
|
config: config,
|
|
38
|
-
analytics: analytics,
|
|
39
36
|
renderers: renderers,
|
|
40
37
|
error: error
|
|
41
38
|
};
|
|
@@ -3,18 +3,12 @@ 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
|
-
import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
|
|
17
|
-
import { getExtensionKey } from '../helpers';
|
|
18
12
|
import useInvokeClientAction from '../hooks/use-invoke-client-action';
|
|
19
13
|
import { useSmartCardState as useLinkState } from '../store';
|
|
20
14
|
export function useSmartLinkActions(_ref) {
|
|
@@ -26,22 +20,12 @@ export function useSmartLinkActions(_ref) {
|
|
|
26
20
|
return uuid();
|
|
27
21
|
}, []);
|
|
28
22
|
var linkState = useLinkState(url);
|
|
29
|
-
var linkAnalytics = useLinkAnalytics(url, id);
|
|
30
23
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
31
24
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
32
25
|
var invokeClientAction = useInvokeClientAction({
|
|
33
|
-
|
|
26
|
+
fireEvent: fireEvent
|
|
34
27
|
});
|
|
35
28
|
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
29
|
var actions = [];
|
|
46
30
|
var invokeParam = {
|
|
47
31
|
actionOptions: actionOptions,
|
|
@@ -49,18 +33,18 @@ export function useSmartLinkActions(_ref) {
|
|
|
49
33
|
id: id,
|
|
50
34
|
response: linkState.details
|
|
51
35
|
};
|
|
52
|
-
var downloadActionProps =
|
|
36
|
+
var downloadActionProps = extractInvokeDownloadAction(invokeParam);
|
|
53
37
|
if (downloadActionProps) {
|
|
54
38
|
actions.push(toAction(downloadActionProps, invokeClientAction, messages.download, 'download-content'));
|
|
55
39
|
}
|
|
56
|
-
var viewActionProps =
|
|
40
|
+
var viewActionProps = extractInvokeViewAction(invokeParam);
|
|
57
41
|
if (viewActionProps) {
|
|
58
42
|
actions.push(toAction(viewActionProps, invokeClientAction, messages.view, 'view-content'));
|
|
59
43
|
}
|
|
60
|
-
var previewActionProps =
|
|
44
|
+
var previewActionProps = extractInvokePreviewAction(_objectSpread(_objectSpread({}, invokeParam), {}, {
|
|
61
45
|
fireEvent: fireEvent,
|
|
62
46
|
origin: origin
|
|
63
|
-
}))
|
|
47
|
+
}));
|
|
64
48
|
if (previewActionProps) {
|
|
65
49
|
actions.push(toAction(previewActionProps, invokeClientAction, messages.preview_improved, 'preview-content'));
|
|
66
50
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import uuid from 'uuid';
|
|
3
3
|
import { useSmartCardActions as useLinkActions } from '../actions';
|
|
4
|
-
import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
|
|
5
4
|
/**
|
|
6
5
|
* Exposes a programmatic way to reload the data being used to render a Smart Link.
|
|
7
6
|
* @param
|
|
@@ -12,7 +11,6 @@ export function useSmartLinkReload(_ref) {
|
|
|
12
11
|
var id = useMemo(function () {
|
|
13
12
|
return uuid();
|
|
14
13
|
}, []);
|
|
15
|
-
var
|
|
16
|
-
var linkActions = useLinkActions(id, url, linkAnalytics);
|
|
14
|
+
var linkActions = useLinkActions(id, url);
|
|
17
15
|
return linkActions.reload;
|
|
18
16
|
}
|
package/dist/esm/state/index.js
CHANGED
|
@@ -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
|
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
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; }
|
|
5
|
-
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; }
|
|
6
|
-
import { getMeasure } from '../performance';
|
|
7
3
|
export var ANALYTICS_CHANNEL = 'media';
|
|
8
4
|
export var context = {
|
|
9
5
|
componentName: 'smart-cards',
|
|
10
6
|
packageName: "@atlaskit/smart-card",
|
|
11
|
-
packageVersion: "33.
|
|
7
|
+
packageVersion: "33.3.0"
|
|
12
8
|
};
|
|
13
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
14
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -20,12 +16,6 @@ export var TrackQuickActionFailureReason = /*#__PURE__*/function (TrackQuickActi
|
|
|
20
16
|
TrackQuickActionFailureReason["UnknownError"] = "UnknownError";
|
|
21
17
|
return TrackQuickActionFailureReason;
|
|
22
18
|
}({});
|
|
23
|
-
var uiActionSubjectIds = {
|
|
24
|
-
DownloadAction: 'downloadDocument',
|
|
25
|
-
PreviewAction: 'invokePreviewScreen',
|
|
26
|
-
ViewAction: 'shortcutGoToLink',
|
|
27
|
-
StatusAction: 'issueStatusUpdate'
|
|
28
|
-
};
|
|
29
19
|
export var SmartLinkEvents = /*#__PURE__*/function () {
|
|
30
20
|
function SmartLinkEvents() {
|
|
31
21
|
_classCallCheck(this, SmartLinkEvents);
|
|
@@ -51,136 +41,4 @@ export var fireSmartLinkEvent = function fireSmartLinkEvent(payload, createAnaly
|
|
|
51
41
|
if (createAnalyticsEvent) {
|
|
52
42
|
createAnalyticsEvent(payload).fire(ANALYTICS_CHANNEL);
|
|
53
43
|
}
|
|
54
|
-
};
|
|
55
|
-
export var invokeSucceededEvent = function invokeSucceededEvent(_ref) {
|
|
56
|
-
var id = _ref.id,
|
|
57
|
-
actionType = _ref.actionType,
|
|
58
|
-
display = _ref.display,
|
|
59
|
-
extensionKey = _ref.extensionKey,
|
|
60
|
-
definitionId = _ref.definitionId,
|
|
61
|
-
destinationProduct = _ref.destinationProduct,
|
|
62
|
-
destinationSubproduct = _ref.destinationSubproduct,
|
|
63
|
-
location = _ref.location;
|
|
64
|
-
var measure = id ? getMeasure(id, 'resolved') : undefined;
|
|
65
|
-
return {
|
|
66
|
-
action: 'resolved',
|
|
67
|
-
actionSubject: 'smartLinkAction',
|
|
68
|
-
eventType: 'operational',
|
|
69
|
-
attributes: _objectSpread(_objectSpread({}, context), {}, {
|
|
70
|
-
id: id,
|
|
71
|
-
actionType: actionType,
|
|
72
|
-
display: display,
|
|
73
|
-
definitionId: definitionId,
|
|
74
|
-
destinationProduct: destinationProduct,
|
|
75
|
-
destinationSubproduct: destinationSubproduct,
|
|
76
|
-
location: location,
|
|
77
|
-
extensionKey: extensionKey,
|
|
78
|
-
duration: measure === null || measure === void 0 ? void 0 : measure.duration
|
|
79
|
-
})
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
export var invokeFailedEvent = function invokeFailedEvent(_ref2) {
|
|
83
|
-
var id = _ref2.id,
|
|
84
|
-
actionType = _ref2.actionType,
|
|
85
|
-
display = _ref2.display,
|
|
86
|
-
reason = _ref2.reason,
|
|
87
|
-
extensionKey = _ref2.extensionKey,
|
|
88
|
-
definitionId = _ref2.definitionId,
|
|
89
|
-
destinationProduct = _ref2.destinationProduct,
|
|
90
|
-
destinationSubproduct = _ref2.destinationSubproduct,
|
|
91
|
-
location = _ref2.location;
|
|
92
|
-
var measure = id ? getMeasure(id, 'errored') : undefined;
|
|
93
|
-
return {
|
|
94
|
-
action: 'unresolved',
|
|
95
|
-
actionSubject: 'smartLinkAction',
|
|
96
|
-
eventType: 'operational',
|
|
97
|
-
attributes: _objectSpread(_objectSpread({}, context), {}, {
|
|
98
|
-
id: id,
|
|
99
|
-
actionType: actionType,
|
|
100
|
-
display: display,
|
|
101
|
-
extensionKey: extensionKey,
|
|
102
|
-
definitionId: definitionId,
|
|
103
|
-
destinationProduct: destinationProduct,
|
|
104
|
-
destinationSubproduct: destinationSubproduct,
|
|
105
|
-
location: location,
|
|
106
|
-
duration: measure === null || measure === void 0 ? void 0 : measure.duration,
|
|
107
|
-
reason: reason
|
|
108
|
-
})
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
export var uiActionClickedEvent = function uiActionClickedEvent(_ref3) {
|
|
112
|
-
var id = _ref3.id,
|
|
113
|
-
actionType = _ref3.actionType,
|
|
114
|
-
extensionKey = _ref3.extensionKey,
|
|
115
|
-
display = _ref3.display,
|
|
116
|
-
definitionId = _ref3.definitionId,
|
|
117
|
-
destinationProduct = _ref3.destinationProduct,
|
|
118
|
-
destinationSubproduct = _ref3.destinationSubproduct,
|
|
119
|
-
location = _ref3.location;
|
|
120
|
-
return {
|
|
121
|
-
action: 'clicked',
|
|
122
|
-
actionSubject: 'button',
|
|
123
|
-
actionSubjectId: uiActionSubjectIds[actionType],
|
|
124
|
-
eventType: 'ui',
|
|
125
|
-
attributes: _objectSpread(_objectSpread({}, context), {}, {
|
|
126
|
-
id: id,
|
|
127
|
-
display: display,
|
|
128
|
-
actionType: actionType,
|
|
129
|
-
extensionKey: extensionKey,
|
|
130
|
-
definitionId: definitionId,
|
|
131
|
-
destinationProduct: destinationProduct,
|
|
132
|
-
destinationSubproduct: destinationSubproduct,
|
|
133
|
-
location: location
|
|
134
|
-
})
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
export var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref4) {
|
|
138
|
-
var display = _ref4.display,
|
|
139
|
-
status = _ref4.status,
|
|
140
|
-
extensionKey = _ref4.extensionKey,
|
|
141
|
-
definitionId = _ref4.definitionId,
|
|
142
|
-
destinationProduct = _ref4.destinationProduct,
|
|
143
|
-
destinationSubproduct = _ref4.destinationSubproduct,
|
|
144
|
-
location = _ref4.location,
|
|
145
|
-
canBeDatasource = _ref4.canBeDatasource;
|
|
146
|
-
return {
|
|
147
|
-
action: 'renderSuccess',
|
|
148
|
-
actionSubject: 'smartLink',
|
|
149
|
-
eventType: 'ui',
|
|
150
|
-
attributes: _objectSpread(_objectSpread({}, context), {}, {
|
|
151
|
-
status: status,
|
|
152
|
-
extensionKey: extensionKey,
|
|
153
|
-
definitionId: definitionId,
|
|
154
|
-
destinationProduct: destinationProduct,
|
|
155
|
-
destinationSubproduct: destinationSubproduct,
|
|
156
|
-
location: location,
|
|
157
|
-
display: display,
|
|
158
|
-
canBeDatasource: canBeDatasource
|
|
159
|
-
})
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
export var uiRenderFailedEvent = function uiRenderFailedEvent(_ref5) {
|
|
163
|
-
var display = _ref5.display,
|
|
164
|
-
error = _ref5.error,
|
|
165
|
-
errorInfo = _ref5.errorInfo,
|
|
166
|
-
extensionKey = _ref5.extensionKey,
|
|
167
|
-
definitionId = _ref5.definitionId,
|
|
168
|
-
destinationProduct = _ref5.destinationProduct,
|
|
169
|
-
destinationSubproduct = _ref5.destinationSubproduct,
|
|
170
|
-
location = _ref5.location;
|
|
171
|
-
return {
|
|
172
|
-
actionSubject: 'smartLink',
|
|
173
|
-
action: 'renderFailed',
|
|
174
|
-
eventType: 'ui',
|
|
175
|
-
attributes: _objectSpread(_objectSpread({}, context), {}, {
|
|
176
|
-
error: error,
|
|
177
|
-
errorInfo: errorInfo,
|
|
178
|
-
display: display,
|
|
179
|
-
extensionKey: extensionKey,
|
|
180
|
-
definitionId: definitionId,
|
|
181
|
-
destinationProduct: destinationProduct,
|
|
182
|
-
destinationSubproduct: destinationSubproduct,
|
|
183
|
-
location: location
|
|
184
|
-
})
|
|
185
|
-
};
|
|
186
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent
|
|
1
|
+
export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent } from './analytics';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/esm/utils/mocks.js
CHANGED
|
@@ -303,26 +303,4 @@ export var waitFor = function waitFor() {
|
|
|
303
303
|
return new Promise(function (res) {
|
|
304
304
|
return setTimeout(res, time);
|
|
305
305
|
});
|
|
306
|
-
};
|
|
307
|
-
export var mockAnalytics = {
|
|
308
|
-
ui: {
|
|
309
|
-
actionClickedEvent: function actionClickedEvent() {},
|
|
310
|
-
buttonClickedEvent: function buttonClickedEvent() {},
|
|
311
|
-
modalClosedEvent: function modalClosedEvent() {},
|
|
312
|
-
renderSuccessEvent: function renderSuccessEvent() {},
|
|
313
|
-
renderFailedEvent: function renderFailedEvent() {},
|
|
314
|
-
smartLinkServerActionClickedEvent: function smartLinkServerActionClickedEvent() {}
|
|
315
|
-
},
|
|
316
|
-
operational: {
|
|
317
|
-
invokeSucceededEvent: function invokeSucceededEvent() {},
|
|
318
|
-
invokeFailedEvent: function invokeFailedEvent() {}
|
|
319
|
-
},
|
|
320
|
-
track: {
|
|
321
|
-
smartLinkQuickActionFailed: function smartLinkQuickActionFailed() {},
|
|
322
|
-
smartLinkQuickActionStarted: function smartLinkQuickActionStarted() {},
|
|
323
|
-
smartLinkQuickActionSuccess: function smartLinkQuickActionSuccess() {}
|
|
324
|
-
},
|
|
325
|
-
screen: {
|
|
326
|
-
modalViewedEvent: function modalViewedEvent() {}
|
|
327
|
-
}
|
|
328
306
|
};
|
|
@@ -19,7 +19,6 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
19
19
|
onResolve = _ref.onResolve,
|
|
20
20
|
onError = _ref.onError,
|
|
21
21
|
testId = _ref.testId,
|
|
22
|
-
analytics = _ref.analytics,
|
|
23
22
|
actionOptions = _ref.actionOptions;
|
|
24
23
|
var status = cardState.status;
|
|
25
24
|
var blockCardProps = {
|
|
@@ -33,8 +32,7 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
33
32
|
onError: onError,
|
|
34
33
|
onResolve: onResolve,
|
|
35
34
|
renderers: renderers,
|
|
36
|
-
actionOptions: actionOptions
|
|
37
|
-
analytics: analytics
|
|
35
|
+
actionOptions: actionOptions
|
|
38
36
|
};
|
|
39
37
|
switch (status) {
|
|
40
38
|
case 'pending':
|
|
@@ -21,8 +21,7 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
21
21
|
actionOptions = _ref.actionOptions,
|
|
22
22
|
_ref$testId = _ref.testId,
|
|
23
23
|
testId = _ref$testId === void 0 ? 'smart-block-resolved-view' : _ref$testId,
|
|
24
|
-
url = _ref.url
|
|
25
|
-
analytics = _ref.analytics;
|
|
24
|
+
url = _ref.url;
|
|
26
25
|
var _useState = useState(false),
|
|
27
26
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
27
|
isPreviewBlockErrored = _useState2[0],
|
|
@@ -47,7 +46,6 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
47
46
|
}];
|
|
48
47
|
}, []);
|
|
49
48
|
return /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
50
|
-
analytics: analytics,
|
|
51
49
|
appearance: "block",
|
|
52
50
|
cardState: cardState,
|
|
53
51
|
onClick: onClick,
|
|
@@ -36,8 +36,7 @@ var UnauthorisedView = function UnauthorisedView(_ref) {
|
|
|
36
36
|
var _ref$testId = _ref.testId,
|
|
37
37
|
testId = _ref$testId === void 0 ? 'smart-block-unauthorized-view' : _ref$testId,
|
|
38
38
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
39
|
-
var
|
|
40
|
-
cardState = props.cardState,
|
|
39
|
+
var cardState = props.cardState,
|
|
41
40
|
onAuthorize = props.onAuthorize;
|
|
42
41
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
43
42
|
var providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
@@ -54,14 +53,13 @@ var UnauthorisedView = function UnauthorisedView(_ref) {
|
|
|
54
53
|
return onAuthorize ? jsx(UnauthorisedViewContent, {
|
|
55
54
|
providerName: providerName,
|
|
56
55
|
isProductIntegrationSupported: isProductIntegrationSupported,
|
|
57
|
-
analytics: analytics,
|
|
58
56
|
testId: testId
|
|
59
57
|
}) : jsx(FormattedMessage, _extends({}, messages[providerName ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider'], {
|
|
60
58
|
values: {
|
|
61
59
|
context: providerName
|
|
62
60
|
}
|
|
63
61
|
}));
|
|
64
|
-
}, [
|
|
62
|
+
}, [isProductIntegrationSupported, onAuthorize, providerName, testId]);
|
|
65
63
|
var actions = useMemo(function () {
|
|
66
64
|
return onAuthorize ? [AuthorizeAction(handleAuthorize, providerName)] : [];
|
|
67
65
|
}, [handleAuthorize, onAuthorize, providerName]);
|