@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,304 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
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
|
-
import { useMemo } from 'react';
|
|
6
|
-
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
|
-
import { getUrl } from '@atlaskit/linking-common';
|
|
8
|
-
import { context, invokeFailedEvent as _invokeFailedEvent, invokeSucceededEvent as _invokeSucceededEvent, uiActionClickedEvent, uiRenderFailedEvent, uiRenderSuccessEvent } from '../../utils/analytics';
|
|
9
|
-
import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getStatusDetails, getSubproduct } from '../helpers';
|
|
10
|
-
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
11
|
-
import { useDispatchAnalytics } from './useDispatchAnalytics';
|
|
12
|
-
var applyCommonAttributes = function applyCommonAttributes(event, commonAttributes) {
|
|
13
|
-
if (event && event.attributes) {
|
|
14
|
-
for (var _i = 0, _Object$entries = Object.entries(commonAttributes); _i < _Object$entries.length; _i++) {
|
|
15
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
16
|
-
key = _Object$entries$_i[0],
|
|
17
|
-
value = _Object$entries$_i[1];
|
|
18
|
-
if (event.attributes[key] === undefined) {
|
|
19
|
-
event.attributes[key] = value;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return event;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* This hook provides usage of Smart Link analytics outside of the Card component.
|
|
28
|
-
* Can be provided to Card via the analyticsEvents prop to change the analytics events.
|
|
29
|
-
*
|
|
30
|
-
* @param url URL of the link
|
|
31
|
-
* @param id fallback id of the events sent if no id is available
|
|
32
|
-
* @param defaultLocation location attribute to be used
|
|
33
|
-
* @returns
|
|
34
|
-
*/
|
|
35
|
-
export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defaultLocation) {
|
|
36
|
-
var _useDispatchAnalytics = useDispatchAnalytics(),
|
|
37
|
-
dispatchAnalytics = _useDispatchAnalytics.dispatchAnalytics;
|
|
38
|
-
var defaultId = id || 'NULL';
|
|
39
|
-
// We don't want to trigger a re-render by using useSmartCardState
|
|
40
|
-
var _useSmartLinkContext = useSmartLinkContext(),
|
|
41
|
-
store = _useSmartLinkContext.store;
|
|
42
|
-
var state = store ? getUrl(store, url) : undefined;
|
|
43
|
-
var details = state ? state.details : undefined;
|
|
44
|
-
var extractedDefinitionId = getDefinitionId(details);
|
|
45
|
-
var extractedExtensionKey = getExtensionKey(details);
|
|
46
|
-
var extractedResourceType = getResourceType(details);
|
|
47
|
-
var extractedSubproduct = getSubproduct(details);
|
|
48
|
-
var extractedProduct = getProduct(details);
|
|
49
|
-
var extractedStatusDetails = getStatusDetails(details);
|
|
50
|
-
var commonAttributes = useMemo(function () {
|
|
51
|
-
return {
|
|
52
|
-
id: defaultId,
|
|
53
|
-
definitionId: extractedDefinitionId,
|
|
54
|
-
extensionKey: extractedExtensionKey,
|
|
55
|
-
resourceType: extractedResourceType,
|
|
56
|
-
destinationObjectType: extractedResourceType,
|
|
57
|
-
destinationSubproduct: extractedSubproduct,
|
|
58
|
-
destinationProduct: extractedProduct,
|
|
59
|
-
location: defaultLocation,
|
|
60
|
-
statusDetails: extractedStatusDetails
|
|
61
|
-
};
|
|
62
|
-
}, [defaultId, extractedDefinitionId, extractedExtensionKey, extractedResourceType, extractedSubproduct, extractedProduct, defaultLocation, extractedStatusDetails]);
|
|
63
|
-
|
|
64
|
-
/** Contains all ui analytics events */
|
|
65
|
-
var ui = useMemo(function () {
|
|
66
|
-
return {
|
|
67
|
-
/**
|
|
68
|
-
* This fires an event that represents when a user
|
|
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.
|
|
85
|
-
* @param id The unique ID for this Smart Link.
|
|
86
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
87
|
-
* @param actionType The type of the action that was clicked, e.g. PreviewAction
|
|
88
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
89
|
-
* @returns
|
|
90
|
-
*/
|
|
91
|
-
actionClickedEvent: function actionClickedEvent(_ref) {
|
|
92
|
-
var id = _ref.id,
|
|
93
|
-
actionType = _ref.actionType,
|
|
94
|
-
display = _ref.display,
|
|
95
|
-
overrideExtensionKey = _ref.extensionKey,
|
|
96
|
-
definitionId = _ref.definitionId,
|
|
97
|
-
resourceType = _ref.resourceType,
|
|
98
|
-
destinationProduct = _ref.destinationProduct,
|
|
99
|
-
destinationSubproduct = _ref.destinationSubproduct,
|
|
100
|
-
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
|
-
dispatchAnalytics(applyCommonAttributes(_invokeSucceededEvent({
|
|
233
|
-
id: id !== null && id !== void 0 ? id : defaultId,
|
|
234
|
-
actionType: actionType,
|
|
235
|
-
display: display,
|
|
236
|
-
extensionKey: extensionKey,
|
|
237
|
-
definitionId: definitionId,
|
|
238
|
-
resourceType: resourceType,
|
|
239
|
-
destinationProduct: destinationProduct,
|
|
240
|
-
destinationSubproduct: destinationSubproduct,
|
|
241
|
-
location: location
|
|
242
|
-
}), commonAttributes));
|
|
243
|
-
},
|
|
244
|
-
/**
|
|
245
|
-
* This fires an event that represents an action being unsuccessfully invoked.
|
|
246
|
-
* @param id The unique ID for this Smart Link.
|
|
247
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
248
|
-
* @param actionType The type of action invoked, e.g. PreviewAction
|
|
249
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
250
|
-
* @param reason The reason the invocation failed.
|
|
251
|
-
*/
|
|
252
|
-
invokeFailedEvent: function invokeFailedEvent(_ref5) {
|
|
253
|
-
var id = _ref5.id,
|
|
254
|
-
actionType = _ref5.actionType,
|
|
255
|
-
display = _ref5.display,
|
|
256
|
-
reason = _ref5.reason,
|
|
257
|
-
extensionKey = _ref5.extensionKey,
|
|
258
|
-
definitionId = _ref5.definitionId,
|
|
259
|
-
resourceType = _ref5.resourceType,
|
|
260
|
-
destinationProduct = _ref5.destinationProduct,
|
|
261
|
-
destinationSubproduct = _ref5.destinationSubproduct,
|
|
262
|
-
location = _ref5.location;
|
|
263
|
-
dispatchAnalytics(applyCommonAttributes(_invokeFailedEvent({
|
|
264
|
-
id: id !== null && id !== void 0 ? id : defaultId,
|
|
265
|
-
actionType: actionType,
|
|
266
|
-
display: display,
|
|
267
|
-
reason: reason,
|
|
268
|
-
extensionKey: extensionKey,
|
|
269
|
-
definitionId: definitionId,
|
|
270
|
-
resourceType: resourceType,
|
|
271
|
-
destinationProduct: destinationProduct,
|
|
272
|
-
destinationSubproduct: destinationSubproduct,
|
|
273
|
-
location: location
|
|
274
|
-
}), commonAttributes));
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
}, [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
|
-
return useMemo(function () {
|
|
298
|
-
return {
|
|
299
|
-
ui: ui,
|
|
300
|
-
operational: operational,
|
|
301
|
-
screen: screen
|
|
302
|
-
};
|
|
303
|
-
}, [ui, operational, screen]);
|
|
304
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type InvokeClientActionProps } from '../../state/hooks/use-invoke-client-action/types';
|
|
2
|
-
import { type ExtractActionsProps } from '../common/actions/types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
5
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-download-action.ts
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractDownloadActionProps: ({ response, actionOptions, extensionKey, source, }: ExtractActionsProps) => InvokeClientActionProps | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type InvokeClientActionProps } from '../../state/hooks/use-invoke-client-action/types';
|
|
2
|
-
import { type ExtractActionsProps } from '../common/actions/types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
5
|
-
* Replaced with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-preview-action.ts
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractPreviewActionProps: ({ response, analytics, extensionKey, source, actionOptions, origin, }: ExtractActionsProps) => InvokeClientActionProps | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type InvokeClientActionProps } from '../../state/hooks/use-invoke-client-action/types';
|
|
2
|
-
import { type ExtractActionsProps } from '../common/actions/types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
5
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-view-action.ts
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractViewActionProps: ({ response, actionOptions, extensionKey, source, }: ExtractActionsProps) => InvokeClientActionProps | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type JsonLd } from 'json-ld-types';
|
|
2
|
-
import { type ViewActionData } from '../../../state/flexible-ui-context/types';
|
|
3
|
-
import { type CardActionOptions } from '../../../view/Card/types';
|
|
4
|
-
/**
|
|
5
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractViewAction: (data: JsonLd.Data.BaseData, actionOptions?: CardActionOptions) => ViewActionData | undefined;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { type InvokeFailedEventProps, type InvokeSucceededEventProps, type UiActionClickedEventProps, type UiRenderFailedEventProps, type UiRenderSuccessEventProps } from '../../utils/analytics/types';
|
|
2
|
-
import { type AnalyticsName, type AnalyticsPayload } from '../../utils/types';
|
|
3
|
-
/**
|
|
4
|
-
* This hook provides usage of Smart Link analytics outside of the Card component.
|
|
5
|
-
* Can be provided to Card via the analyticsEvents prop to change the analytics events.
|
|
6
|
-
*
|
|
7
|
-
* @param url URL of the link
|
|
8
|
-
* @param id fallback id of the events sent if no id is available
|
|
9
|
-
* @param defaultLocation location attribute to be used
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
export declare const useSmartLinkAnalytics: (url: string, id?: string, defaultLocation?: string) => {
|
|
13
|
-
ui: {
|
|
14
|
-
/**
|
|
15
|
-
* This fires an event that represents when a user
|
|
16
|
-
* click a button.
|
|
17
|
-
* @param data A partial analytics event payload
|
|
18
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
19
|
-
*/
|
|
20
|
-
buttonClickedEvent: (data: Partial<AnalyticsPayload> & {
|
|
21
|
-
actionSubjectId: Required<string>;
|
|
22
|
-
}) => void;
|
|
23
|
-
/**
|
|
24
|
-
* This fires an event that represents when a user clicks on a Smart Link action.
|
|
25
|
-
* Note: This also starts the UFO smart-link-action-invocation experience.
|
|
26
|
-
* @param id The unique ID for this Smart Link.
|
|
27
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
28
|
-
* @param actionType The type of the action that was clicked, e.g. PreviewAction
|
|
29
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
actionClickedEvent: ({ id, actionType, display, extensionKey: overrideExtensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiActionClickedEventProps) => void;
|
|
33
|
-
/**
|
|
34
|
-
* This fires an event that represents when a user close a modal.
|
|
35
|
-
* @param data A partial analytics event payload
|
|
36
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
37
|
-
*/
|
|
38
|
-
modalClosedEvent: (data: Partial<AnalyticsPayload> & {
|
|
39
|
-
actionSubjectId: Required<string>;
|
|
40
|
-
}) => void;
|
|
41
|
-
/**
|
|
42
|
-
* This fires an event that represents when a Smart Link was rendered successfully.
|
|
43
|
-
* Note: this fires even if the Smart Link request errored out.
|
|
44
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
45
|
-
* @param id The unique ID for this Smart Link.
|
|
46
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
47
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
48
|
-
* @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
|
|
49
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
50
|
-
*/
|
|
51
|
-
renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: UiRenderSuccessEventProps) => void;
|
|
52
|
-
/**
|
|
53
|
-
* This fires an event that represents when a Smart Link renders unsuccessfuly.
|
|
54
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
55
|
-
* @param id The unique ID for this Smart Link.
|
|
56
|
-
* @param error: An error representing why the Smart Link render failed.
|
|
57
|
-
* @param errorInfo: Additional details about the error including the stack trace.
|
|
58
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
59
|
-
*/
|
|
60
|
-
renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => void;
|
|
61
|
-
};
|
|
62
|
-
operational: {
|
|
63
|
-
/**
|
|
64
|
-
* This fires an event that represents an action being successfully invoked.
|
|
65
|
-
* @param id The unique ID for this Smart Link.
|
|
66
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
67
|
-
* @param actionType The type of action invoked, e.g. PreviewAction
|
|
68
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
69
|
-
*/
|
|
70
|
-
invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeSucceededEventProps) => void;
|
|
71
|
-
/**
|
|
72
|
-
* This fires an event that represents an action being unsuccessfully invoked.
|
|
73
|
-
* @param id The unique ID for this Smart Link.
|
|
74
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
75
|
-
* @param actionType The type of action invoked, e.g. PreviewAction
|
|
76
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
77
|
-
* @param reason The reason the invocation failed.
|
|
78
|
-
*/
|
|
79
|
-
invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeFailedEventProps) => void;
|
|
80
|
-
};
|
|
81
|
-
screen: {
|
|
82
|
-
/**
|
|
83
|
-
* This fires an event that represents when a user view a modal.
|
|
84
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
85
|
-
*/
|
|
86
|
-
modalViewedEvent: (data: Partial<AnalyticsPayload> & {
|
|
87
|
-
name: Extract<AnalyticsName, 'embedPreviewModal'>;
|
|
88
|
-
}) => void;
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
export type AnalyticsFacade = ReturnType<typeof useSmartLinkAnalytics>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type InvokeClientActionProps } from '../../state/hooks/use-invoke-client-action/types';
|
|
2
|
-
import { type ExtractActionsProps } from '../common/actions/types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
5
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-download-action.ts
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractDownloadActionProps: ({ response, actionOptions, extensionKey, source, }: ExtractActionsProps) => InvokeClientActionProps | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type InvokeClientActionProps } from '../../state/hooks/use-invoke-client-action/types';
|
|
2
|
-
import { type ExtractActionsProps } from '../common/actions/types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
5
|
-
* Replaced with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-preview-action.ts
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractPreviewActionProps: ({ response, analytics, extensionKey, source, actionOptions, origin, }: ExtractActionsProps) => InvokeClientActionProps | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type InvokeClientActionProps } from '../../state/hooks/use-invoke-client-action/types';
|
|
2
|
-
import { type ExtractActionsProps } from '../common/actions/types';
|
|
3
|
-
/**
|
|
4
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
5
|
-
* Replace with platform/packages/linking-platform/smart-card/src/extractors/action/extract-invoke-view-action.ts
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractViewActionProps: ({ response, actionOptions, extensionKey, source, }: ExtractActionsProps) => InvokeClientActionProps | undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type JsonLd } from 'json-ld-types';
|
|
2
|
-
import { type ViewActionData } from '../../../state/flexible-ui-context/types';
|
|
3
|
-
import { type CardActionOptions } from '../../../view/Card/types';
|
|
4
|
-
/**
|
|
5
|
-
* TODO: Remove on cleanup of platform-smart-card-migrate-embed-modal-analytics
|
|
6
|
-
*/
|
|
7
|
-
export declare const extractViewAction: (data: JsonLd.Data.BaseData, actionOptions?: CardActionOptions) => ViewActionData | undefined;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { type InvokeFailedEventProps, type InvokeSucceededEventProps, type UiActionClickedEventProps, type UiRenderFailedEventProps, type UiRenderSuccessEventProps } from '../../utils/analytics/types';
|
|
2
|
-
import { type AnalyticsName, type AnalyticsPayload } from '../../utils/types';
|
|
3
|
-
/**
|
|
4
|
-
* This hook provides usage of Smart Link analytics outside of the Card component.
|
|
5
|
-
* Can be provided to Card via the analyticsEvents prop to change the analytics events.
|
|
6
|
-
*
|
|
7
|
-
* @param url URL of the link
|
|
8
|
-
* @param id fallback id of the events sent if no id is available
|
|
9
|
-
* @param defaultLocation location attribute to be used
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
export declare const useSmartLinkAnalytics: (url: string, id?: string, defaultLocation?: string) => {
|
|
13
|
-
ui: {
|
|
14
|
-
/**
|
|
15
|
-
* This fires an event that represents when a user
|
|
16
|
-
* click a button.
|
|
17
|
-
* @param data A partial analytics event payload
|
|
18
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
19
|
-
*/
|
|
20
|
-
buttonClickedEvent: (data: Partial<AnalyticsPayload> & {
|
|
21
|
-
actionSubjectId: Required<string>;
|
|
22
|
-
}) => void;
|
|
23
|
-
/**
|
|
24
|
-
* This fires an event that represents when a user clicks on a Smart Link action.
|
|
25
|
-
* Note: This also starts the UFO smart-link-action-invocation experience.
|
|
26
|
-
* @param id The unique ID for this Smart Link.
|
|
27
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
28
|
-
* @param actionType The type of the action that was clicked, e.g. PreviewAction
|
|
29
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
actionClickedEvent: ({ id, actionType, display, extensionKey: overrideExtensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiActionClickedEventProps) => void;
|
|
33
|
-
/**
|
|
34
|
-
* This fires an event that represents when a user close a modal.
|
|
35
|
-
* @param data A partial analytics event payload
|
|
36
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
37
|
-
*/
|
|
38
|
-
modalClosedEvent: (data: Partial<AnalyticsPayload> & {
|
|
39
|
-
actionSubjectId: Required<string>;
|
|
40
|
-
}) => void;
|
|
41
|
-
/**
|
|
42
|
-
* This fires an event that represents when a Smart Link was rendered successfully.
|
|
43
|
-
* Note: this fires even if the Smart Link request errored out.
|
|
44
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
45
|
-
* @param id The unique ID for this Smart Link.
|
|
46
|
-
* @param definitionId The definitionId of the Smart Link resolver invoked.
|
|
47
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
48
|
-
* @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
|
|
49
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
50
|
-
*/
|
|
51
|
-
renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: UiRenderSuccessEventProps) => void;
|
|
52
|
-
/**
|
|
53
|
-
* This fires an event that represents when a Smart Link renders unsuccessfuly.
|
|
54
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
55
|
-
* @param id The unique ID for this Smart Link.
|
|
56
|
-
* @param error: An error representing why the Smart Link render failed.
|
|
57
|
-
* @param errorInfo: Additional details about the error including the stack trace.
|
|
58
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
59
|
-
*/
|
|
60
|
-
renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => void;
|
|
61
|
-
};
|
|
62
|
-
operational: {
|
|
63
|
-
/**
|
|
64
|
-
* This fires an event that represents an action being successfully invoked.
|
|
65
|
-
* @param id The unique ID for this Smart Link.
|
|
66
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
67
|
-
* @param actionType The type of action invoked, e.g. PreviewAction
|
|
68
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
69
|
-
*/
|
|
70
|
-
invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeSucceededEventProps) => void;
|
|
71
|
-
/**
|
|
72
|
-
* This fires an event that represents an action being unsuccessfully invoked.
|
|
73
|
-
* @param id The unique ID for this Smart Link.
|
|
74
|
-
* @param extensionKey The extensionKey of the Smart Link resovler invoked.
|
|
75
|
-
* @param actionType The type of action invoked, e.g. PreviewAction
|
|
76
|
-
* @param display Whether the card was an Inline, Block, Embed or Flexible UI.
|
|
77
|
-
* @param reason The reason the invocation failed.
|
|
78
|
-
*/
|
|
79
|
-
invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeFailedEventProps) => void;
|
|
80
|
-
};
|
|
81
|
-
screen: {
|
|
82
|
-
/**
|
|
83
|
-
* This fires an event that represents when a user view a modal.
|
|
84
|
-
* @deprecated consider removing when cleaning up FF platform-smart-card-migrate-embed-modal-analytics
|
|
85
|
-
*/
|
|
86
|
-
modalViewedEvent: (data: Partial<AnalyticsPayload> & {
|
|
87
|
-
name: Extract<AnalyticsName, 'embedPreviewModal'>;
|
|
88
|
-
}) => void;
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
export type AnalyticsFacade = ReturnType<typeof useSmartLinkAnalytics>;
|