@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,11 +1,10 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
2
2
|
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
5
4
|
import { CardDisplay } from '../../constants';
|
|
6
5
|
import { useSmartLink } from '../../state';
|
|
7
6
|
import { succeedUfoExperience } from '../../state/analytics';
|
|
8
|
-
import {
|
|
7
|
+
import { getClickUrl, getDefinitionId, getExtensionKey, getResourceType, getServices, isFinalState } from '../../state/helpers';
|
|
9
8
|
import { SmartLinkModalProvider } from '../../state/modal';
|
|
10
9
|
import { isSpecialEvent } from '../../utils';
|
|
11
10
|
import { combineActionOptions } from '../../utils/actions/combine-action-options';
|
|
@@ -38,7 +37,6 @@ function Component(_ref) {
|
|
|
38
37
|
children = _ref.children,
|
|
39
38
|
showHoverPreview = _ref.showHoverPreview,
|
|
40
39
|
hoverPreviewOptions = _ref.hoverPreviewOptions,
|
|
41
|
-
analyticsEvents = _ref.analyticsEvents,
|
|
42
40
|
removeTextHighlightingFromTitle = _ref.removeTextHighlightingFromTitle,
|
|
43
41
|
resolvingPlaceholder = _ref.resolvingPlaceholder,
|
|
44
42
|
truncateInline = _ref.truncateInline;
|
|
@@ -51,16 +49,13 @@ function Component(_ref) {
|
|
|
51
49
|
var _useSmartLink = useSmartLink(id, url),
|
|
52
50
|
state = _useSmartLink.state,
|
|
53
51
|
actions = _useSmartLink.actions,
|
|
54
|
-
defaultAnalytics = _useSmartLink.analytics,
|
|
55
52
|
config = _useSmartLink.config,
|
|
56
53
|
renderers = _useSmartLink.renderers,
|
|
57
54
|
error = _useSmartLink.error;
|
|
58
|
-
var analytics = analyticsEvents || defaultAnalytics;
|
|
59
55
|
var definitionId = getDefinitionId(state.details);
|
|
60
56
|
var extensionKey = getExtensionKey(state.details);
|
|
61
57
|
var resourceType = getResourceType(state.details);
|
|
62
58
|
var services = getServices(state.details);
|
|
63
|
-
var canBeDatasource = getCanBeDatasource(state.details);
|
|
64
59
|
var isFlexibleUi = useMemo(function () {
|
|
65
60
|
return isFlexibleUiCard(children);
|
|
66
61
|
}, [children]);
|
|
@@ -141,31 +136,20 @@ function Component(_ref) {
|
|
|
141
136
|
// - the unresolved states: viz. forbidden, not_found, unauthorized, errored.
|
|
142
137
|
useEffect(function () {
|
|
143
138
|
if (isFinalState(state.status)) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
});
|
|
139
|
+
succeedUfoExperience('smart-link-rendered', id || 'NULL', {
|
|
140
|
+
extensionKey: extensionKey,
|
|
141
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
142
|
+
});
|
|
149
143
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
} else {
|
|
158
|
-
analytics.ui.renderSuccessEvent({
|
|
159
|
-
display: isFlexibleUi ? 'flexible' : appearance,
|
|
160
|
-
status: state.status,
|
|
161
|
-
id: id,
|
|
162
|
-
definitionId: definitionId,
|
|
163
|
-
extensionKey: extensionKey,
|
|
164
|
-
canBeDatasource: canBeDatasource
|
|
165
|
-
});
|
|
166
|
-
}
|
|
144
|
+
// UFO will disregard this if authentication experience has not yet been started
|
|
145
|
+
succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
|
|
146
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
147
|
+
});
|
|
148
|
+
fireEvent('ui.smartLink.renderSuccess', {
|
|
149
|
+
display: isFlexibleUi ? 'flexible' : appearance
|
|
150
|
+
});
|
|
167
151
|
}
|
|
168
|
-
}, [
|
|
152
|
+
}, [appearance, extensionKey, fireEvent, id, isFlexibleUi, state.status]);
|
|
169
153
|
var onIframeDwell = useCallback(function (dwellTime, dwellPercentVisible) {
|
|
170
154
|
fireEvent('ui.smartLinkIframe.dwelled', {
|
|
171
155
|
id: id,
|
|
@@ -207,8 +191,7 @@ function Component(_ref) {
|
|
|
207
191
|
url: url,
|
|
208
192
|
testId: testId,
|
|
209
193
|
onResolve: onResolve,
|
|
210
|
-
onError: onError
|
|
211
|
-
analytics: analytics
|
|
194
|
+
onError: onError
|
|
212
195
|
}, children);
|
|
213
196
|
}
|
|
214
197
|
|
|
@@ -219,7 +202,6 @@ function Component(_ref) {
|
|
|
219
202
|
switch (appearance) {
|
|
220
203
|
case 'inline':
|
|
221
204
|
return /*#__PURE__*/React.createElement(InlineCard, {
|
|
222
|
-
analytics: analytics,
|
|
223
205
|
id: id,
|
|
224
206
|
url: url,
|
|
225
207
|
renderers: renderers,
|
|
@@ -248,7 +230,6 @@ function Component(_ref) {
|
|
|
248
230
|
cardState: state,
|
|
249
231
|
handleAuthorize: services.length && handleAuthorize || undefined,
|
|
250
232
|
handleFrameClick: handleClickWrapper,
|
|
251
|
-
analytics: analytics,
|
|
252
233
|
isSelected: isSelected,
|
|
253
234
|
onResolve: onResolve,
|
|
254
235
|
onError: onError,
|
|
@@ -266,7 +247,6 @@ function Component(_ref) {
|
|
|
266
247
|
handleErrorRetry: handleRetry,
|
|
267
248
|
handleFrameClick: handleClickWrapper,
|
|
268
249
|
handleInvoke: handleInvoke,
|
|
269
|
-
analytics: analytics,
|
|
270
250
|
isSelected: isSelected,
|
|
271
251
|
frameStyle: frameStyle,
|
|
272
252
|
platform: platform,
|
|
@@ -6,9 +6,7 @@ import React, { lazy, Suspense, useCallback, useEffect, useState } from 'react';
|
|
|
6
6
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
7
7
|
import { di } from 'react-magnetic-di';
|
|
8
8
|
import uuid from 'uuid';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
|
|
11
|
-
import { useSmartLinkAnalytics } from '../../state';
|
|
12
10
|
import { failUfoExperience, startUfoExperience } from '../../state/analytics';
|
|
13
11
|
import { importWithRetry } from '../../utils';
|
|
14
12
|
import { useSmartLinkAnalyticsContext } from '../../utils/analytics/SmartLinkAnalyticsContext';
|
|
@@ -60,7 +58,6 @@ export function CardWithURLRenderer(props) {
|
|
|
60
58
|
removeTextHighlightingFromTitle = props.removeTextHighlightingFromTitle,
|
|
61
59
|
resolvingPlaceholder = props.resolvingPlaceholder,
|
|
62
60
|
truncateInline = props.truncateInline;
|
|
63
|
-
var analytics = useSmartLinkAnalytics(url !== null && url !== void 0 ? url : '', id);
|
|
64
61
|
var isFlexibleUi = isFlexibleUiCard(children);
|
|
65
62
|
var analyticsContext = useSmartLinkAnalyticsContext({
|
|
66
63
|
display: isFlexibleUi ? 'flexible' : appearance,
|
|
@@ -85,31 +82,22 @@ export function CardWithURLRenderer(props) {
|
|
|
85
82
|
definitionId: null
|
|
86
83
|
}));
|
|
87
84
|
} else if (error.name !== 'APIError') {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}));
|
|
98
|
-
} else {
|
|
99
|
-
analytics.ui.renderFailedEvent({
|
|
100
|
-
display: isFlexibleUi ? 'flexible' : appearance,
|
|
101
|
-
id: id,
|
|
102
|
-
error: error,
|
|
103
|
-
errorInfo: errorInfo
|
|
104
|
-
});
|
|
105
|
-
}
|
|
85
|
+
startUfoExperience('smart-link-rendered', id || 'NULL');
|
|
86
|
+
failUfoExperience('smart-link-rendered', id || 'NULL');
|
|
87
|
+
failUfoExperience('smart-link-authenticated', id || 'NULL');
|
|
88
|
+
fireEvent('ui.smartLink.renderFailed', _objectSpread(_objectSpread({}, analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes), {}, {
|
|
89
|
+
display: isFlexibleUi ? 'flexible' : appearance,
|
|
90
|
+
id: id !== null && id !== void 0 ? id : null,
|
|
91
|
+
error: error,
|
|
92
|
+
errorInfo: errorInfo
|
|
93
|
+
}));
|
|
106
94
|
}
|
|
107
95
|
onError && onError({
|
|
108
96
|
status: 'errored',
|
|
109
97
|
url: url !== null && url !== void 0 ? url : '',
|
|
110
98
|
err: error
|
|
111
99
|
});
|
|
112
|
-
}, [
|
|
100
|
+
}, [analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes, appearance, fireEvent, id, isFlexibleUi, onError, url]);
|
|
113
101
|
if (!url) {
|
|
114
102
|
throw new Error('@atlaskit/smart-card: url property is missing.');
|
|
115
103
|
}
|
|
@@ -20,7 +20,6 @@ export var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef)
|
|
|
20
20
|
handleAuthorize = _ref.handleAuthorize,
|
|
21
21
|
handleErrorRetry = _ref.handleErrorRetry,
|
|
22
22
|
handleFrameClick = _ref.handleFrameClick,
|
|
23
|
-
analytics = _ref.analytics,
|
|
24
23
|
isSelected = _ref.isSelected,
|
|
25
24
|
frameStyle = _ref.frameStyle,
|
|
26
25
|
platform = _ref.platform,
|
|
@@ -52,7 +51,6 @@ export var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef)
|
|
|
52
51
|
onResolve: onResolve,
|
|
53
52
|
renderers: renderers,
|
|
54
53
|
actionOptions: actionOptions,
|
|
55
|
-
analytics: analytics,
|
|
56
54
|
testId: testId ? "".concat(testId, "-resolving-view") : 'embed-card-resolving-view'
|
|
57
55
|
});
|
|
58
56
|
case 'resolved':
|
|
@@ -93,7 +91,6 @@ export var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef)
|
|
|
93
91
|
onResolve: onResolve,
|
|
94
92
|
renderers: renderers,
|
|
95
93
|
actionOptions: actionOptions,
|
|
96
|
-
analytics: analytics,
|
|
97
94
|
testId: testId
|
|
98
95
|
});
|
|
99
96
|
}
|
|
@@ -106,7 +103,6 @@ export var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef)
|
|
|
106
103
|
}
|
|
107
104
|
var unauthorisedViewProps = extractEmbedProps(data, meta, platform);
|
|
108
105
|
return /*#__PURE__*/React.createElement(UnauthorizedView, {
|
|
109
|
-
analytics: analytics,
|
|
110
106
|
context: unauthorisedViewProps.context,
|
|
111
107
|
extensionKey: extensionKey,
|
|
112
108
|
frameStyle: frameStyle,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["
|
|
3
|
+
var _excluded = ["context", "extensionKey", "isProductIntegrationSupported", "onAuthorize", "testId"];
|
|
4
4
|
import React, { useCallback, useMemo } from 'react';
|
|
5
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
6
6
|
import Button from '@atlaskit/button';
|
|
@@ -11,8 +11,7 @@ import UnresolvedView from '../unresolved-view';
|
|
|
11
11
|
import { UnauthorizedSVG } from './unauthorized-svg';
|
|
12
12
|
var UnauthorizedView = function UnauthorizedView(_ref) {
|
|
13
13
|
var _context$image;
|
|
14
|
-
var
|
|
15
|
-
context = _ref.context,
|
|
14
|
+
var context = _ref.context,
|
|
16
15
|
extensionKey = _ref.extensionKey,
|
|
17
16
|
isProductIntegrationSupported = _ref.isProductIntegrationSupported,
|
|
18
17
|
onAuthorize = _ref.onAuthorize,
|
|
@@ -44,7 +43,6 @@ var UnauthorizedView = function UnauthorizedView(_ref) {
|
|
|
44
43
|
values: _values
|
|
45
44
|
})),
|
|
46
45
|
description: /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
|
|
47
|
-
analytics: analytics,
|
|
48
46
|
providerName: context === null || context === void 0 ? void 0 : context.text,
|
|
49
47
|
isProductIntegrationSupported: isProductIntegrationSupported,
|
|
50
48
|
testId: testId
|
|
@@ -81,7 +79,7 @@ var UnauthorizedView = function UnauthorizedView(_ref) {
|
|
|
81
79
|
title: /*#__PURE__*/React.createElement(FormattedMessage, messages.unauthorised_account_name_no_provider),
|
|
82
80
|
description: /*#__PURE__*/React.createElement(FormattedMessage, messages.unauthorised_account_description_no_provider)
|
|
83
81
|
};
|
|
84
|
-
}, [
|
|
82
|
+
}, [context === null || context === void 0 ? void 0 : context.text, handleOnAuthorizeClick, isProductIntegrationSupported, onAuthorize, testId]);
|
|
85
83
|
return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, unresolvedViewProps, content, {
|
|
86
84
|
icon: context === null || context === void 0 ? void 0 : context.icon,
|
|
87
85
|
image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : /*#__PURE__*/React.createElement(UnauthorizedSVG, null),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { CardDisplay } from '../../../../constants';
|
|
5
4
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from '../../../../state/analytics';
|
|
6
5
|
import { EmbedModalSize } from '../../types';
|
|
@@ -9,8 +8,7 @@ var getResizeFrom = function getResizeFrom(size) {
|
|
|
9
8
|
};
|
|
10
9
|
var withAnalytics = function withAnalytics(Component) {
|
|
11
10
|
return function (props) {
|
|
12
|
-
var
|
|
13
|
-
fireEvent = props.fireEvent,
|
|
11
|
+
var fireEvent = props.fireEvent,
|
|
14
12
|
extensionKey = props.extensionKey,
|
|
15
13
|
id = props.id,
|
|
16
14
|
onClose = props.onClose,
|
|
@@ -19,108 +17,61 @@ var withAnalytics = function withAnalytics(Component) {
|
|
|
19
17
|
onResize = props.onResize,
|
|
20
18
|
origin = props.origin;
|
|
21
19
|
var handleOnOpen = useCallback(function (context) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
attributes: {
|
|
31
|
-
origin: origin,
|
|
32
|
-
size: context.size
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
|
|
37
|
-
succeedUfoExperience('smart-link-rendered', id || 'NULL', {
|
|
38
|
-
extensionKey: extensionKey,
|
|
39
|
-
display: CardDisplay.EmbedPreview
|
|
40
|
-
});
|
|
20
|
+
fireEvent === null || fireEvent === void 0 || fireEvent('screen.embedPreviewModal.viewed', {
|
|
21
|
+
origin: origin !== null && origin !== void 0 ? origin : null,
|
|
22
|
+
size: context.size
|
|
23
|
+
});
|
|
24
|
+
succeedUfoExperience('smart-link-rendered', id || 'NULL', {
|
|
25
|
+
extensionKey: extensionKey,
|
|
26
|
+
display: CardDisplay.EmbedPreview
|
|
27
|
+
});
|
|
41
28
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} else {
|
|
50
|
-
analytics === null || analytics === void 0 || analytics.ui.renderSuccessEvent({
|
|
51
|
-
status: 'resolved',
|
|
52
|
-
display: CardDisplay.EmbedPreview
|
|
53
|
-
});
|
|
54
|
-
}
|
|
29
|
+
// UFO will disregard this if authentication experience has not yet been started
|
|
30
|
+
succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
|
|
31
|
+
display: CardDisplay.EmbedPreview
|
|
32
|
+
});
|
|
33
|
+
fireEvent === null || fireEvent === void 0 || fireEvent('ui.smartLink.renderSuccess', {
|
|
34
|
+
display: CardDisplay.EmbedPreview
|
|
35
|
+
});
|
|
55
36
|
if (onOpen) {
|
|
56
37
|
onOpen(context);
|
|
57
38
|
}
|
|
58
|
-
}, [
|
|
39
|
+
}, [fireEvent, extensionKey, id, onOpen, origin]);
|
|
59
40
|
var handleOnOpenFailed = useCallback(function (error, errorInfo) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
} else {
|
|
71
|
-
analytics === null || analytics === void 0 || analytics.ui.renderFailedEvent({
|
|
72
|
-
display: CardDisplay.EmbedPreview,
|
|
73
|
-
error: error,
|
|
74
|
-
errorInfo: errorInfo
|
|
75
|
-
});
|
|
76
|
-
}
|
|
41
|
+
startUfoExperience('smart-link-rendered', id || 'NULL');
|
|
42
|
+
failUfoExperience('smart-link-rendered', id || 'NULL');
|
|
43
|
+
failUfoExperience('smart-link-authenticated', id || 'NULL');
|
|
44
|
+
fireEvent === null || fireEvent === void 0 || fireEvent('ui.smartLink.renderFailed', {
|
|
45
|
+
display: CardDisplay.EmbedPreview,
|
|
46
|
+
error: error,
|
|
47
|
+
errorInfo: errorInfo,
|
|
48
|
+
id: id !== null && id !== void 0 ? id : null
|
|
49
|
+
});
|
|
77
50
|
if (onOpenFailed) {
|
|
78
51
|
onOpenFailed(error, errorInfo);
|
|
79
52
|
}
|
|
80
|
-
}, [
|
|
53
|
+
}, [fireEvent, id, onOpenFailed]);
|
|
81
54
|
var handleOnClose = useCallback(function (context) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
});
|
|
89
|
-
} else {
|
|
90
|
-
analytics === null || analytics === void 0 || analytics.ui.modalClosedEvent({
|
|
91
|
-
actionSubjectId: 'embedPreview',
|
|
92
|
-
attributes: {
|
|
93
|
-
origin: origin,
|
|
94
|
-
previewTime: context.duration,
|
|
95
|
-
size: context.size
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
55
|
+
var _context$duration;
|
|
56
|
+
fireEvent === null || fireEvent === void 0 || fireEvent('ui.modal.closed.embedPreview', {
|
|
57
|
+
origin: origin !== null && origin !== void 0 ? origin : null,
|
|
58
|
+
previewTime: (_context$duration = context.duration) !== null && _context$duration !== void 0 ? _context$duration : null,
|
|
59
|
+
size: context.size
|
|
60
|
+
});
|
|
99
61
|
if (onClose) {
|
|
100
62
|
onClose(context);
|
|
101
63
|
}
|
|
102
|
-
}, [
|
|
64
|
+
}, [fireEvent, onClose, origin]);
|
|
103
65
|
var handleOnResize = useCallback(function (context) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
} else {
|
|
111
|
-
analytics === null || analytics === void 0 || analytics.ui.buttonClickedEvent({
|
|
112
|
-
actionSubjectId: 'embedPreviewResize',
|
|
113
|
-
attributes: {
|
|
114
|
-
newSize: context.size,
|
|
115
|
-
origin: origin,
|
|
116
|
-
previousSize: getResizeFrom(context.size)
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
66
|
+
fireEvent === null || fireEvent === void 0 || fireEvent('ui.button.clicked.embedPreviewResize', {
|
|
67
|
+
newSize: context.size,
|
|
68
|
+
origin: origin !== null && origin !== void 0 ? origin : null,
|
|
69
|
+
previousSize: getResizeFrom(context.size)
|
|
70
|
+
});
|
|
120
71
|
if (onResize) {
|
|
121
72
|
onResize(context);
|
|
122
73
|
}
|
|
123
|
-
}, [
|
|
74
|
+
}, [fireEvent, onResize, origin]);
|
|
124
75
|
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
125
76
|
onClose: handleOnClose,
|
|
126
77
|
onOpen: handleOnOpen,
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
3
|
import React, { useCallback, useRef, useState } from 'react';
|
|
6
4
|
import ModalDialog, { ModalBody, ModalTransition } from '@atlaskit/modal-dialog';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
5
|
import { useThemeObserver } from '@atlaskit/tokens';
|
|
9
|
-
import {
|
|
6
|
+
import { SmartLinkSize } from '../../constants';
|
|
10
7
|
import useInvokeClientAction from '../../state/hooks/use-invoke-client-action';
|
|
11
|
-
import {
|
|
8
|
+
import { getPreviewUrlWithTheme } from '../../utils';
|
|
12
9
|
import Icon from '../FlexibleCard/components/elements/icon';
|
|
13
10
|
import withAnalytics from './components/analytics';
|
|
14
11
|
import EmbedContent from './components/embed-content';
|
|
@@ -23,12 +20,8 @@ var toWidth = function toWidth(size) {
|
|
|
23
20
|
return size === EmbedModalSize.Large ? MAX_MODAL_SIZE : MIN_MODAL_SIZE;
|
|
24
21
|
};
|
|
25
22
|
var EmbedModal = function EmbedModal(_ref) {
|
|
26
|
-
var
|
|
27
|
-
download = _ref.download,
|
|
28
|
-
invokeDownloadAction = _ref.invokeDownloadAction,
|
|
29
|
-
extensionKey = _ref.extensionKey,
|
|
23
|
+
var invokeDownloadAction = _ref.invokeDownloadAction,
|
|
30
24
|
fireEvent = _ref.fireEvent,
|
|
31
|
-
icon = _ref.icon,
|
|
32
25
|
iframeName = _ref.iframeName,
|
|
33
26
|
isSupportTheming = _ref.isSupportTheming,
|
|
34
27
|
_ref$isTrusted = _ref.isTrusted,
|
|
@@ -45,7 +38,6 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
45
38
|
_ref$testId = _ref.testId,
|
|
46
39
|
testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
|
|
47
40
|
title = _ref.title,
|
|
48
|
-
url = _ref.url,
|
|
49
41
|
invokeViewAction = _ref.invokeViewAction;
|
|
50
42
|
var defaultWidth = toWidth(size);
|
|
51
43
|
var _useState = useState(showModal),
|
|
@@ -58,7 +50,6 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
58
50
|
setWidth = _useState4[1];
|
|
59
51
|
var openAt = useRef();
|
|
60
52
|
var invoke = useInvokeClientAction({
|
|
61
|
-
analytics: analytics,
|
|
62
53
|
fireEvent: fireEvent
|
|
63
54
|
});
|
|
64
55
|
var handleOnOpenComplete = useCallback(function () {
|
|
@@ -93,61 +84,11 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
93
84
|
var themeState = useThemeObserver();
|
|
94
85
|
var previewUrl = src;
|
|
95
86
|
var handleOnViewActionClick = useCallback(function () {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} else {
|
|
99
|
-
invoke({
|
|
100
|
-
actionType: 'ViewAction',
|
|
101
|
-
actionFn: function () {
|
|
102
|
-
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
103
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
104
|
-
while (1) switch (_context.prev = _context.next) {
|
|
105
|
-
case 0:
|
|
106
|
-
return _context.abrupt("return", openUrl(url));
|
|
107
|
-
case 1:
|
|
108
|
-
case "end":
|
|
109
|
-
return _context.stop();
|
|
110
|
-
}
|
|
111
|
-
}, _callee);
|
|
112
|
-
}));
|
|
113
|
-
function actionFn() {
|
|
114
|
-
return _actionFn.apply(this, arguments);
|
|
115
|
-
}
|
|
116
|
-
return actionFn;
|
|
117
|
-
}(),
|
|
118
|
-
display: CardDisplay.EmbedPreview,
|
|
119
|
-
extensionKey: extensionKey
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}, [extensionKey, invoke, url, invokeViewAction]);
|
|
87
|
+
invokeViewAction && invoke(invokeViewAction);
|
|
88
|
+
}, [invoke, invokeViewAction]);
|
|
123
89
|
var handleOnDownloadActionClick = useCallback(function () {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} else {
|
|
127
|
-
invoke({
|
|
128
|
-
actionType: ActionName.DownloadAction,
|
|
129
|
-
actionFn: function () {
|
|
130
|
-
var _actionFn2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
131
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
132
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
133
|
-
case 0:
|
|
134
|
-
return _context2.abrupt("return", downloadUrl(download));
|
|
135
|
-
case 1:
|
|
136
|
-
case "end":
|
|
137
|
-
return _context2.stop();
|
|
138
|
-
}
|
|
139
|
-
}, _callee2);
|
|
140
|
-
}));
|
|
141
|
-
function actionFn() {
|
|
142
|
-
return _actionFn2.apply(this, arguments);
|
|
143
|
-
}
|
|
144
|
-
return actionFn;
|
|
145
|
-
}(),
|
|
146
|
-
display: CardDisplay.EmbedPreview,
|
|
147
|
-
extensionKey: extensionKey
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}, [download, invokeDownloadAction, extensionKey, invoke]);
|
|
90
|
+
invokeDownloadAction && invoke(invokeDownloadAction);
|
|
91
|
+
}, [invokeDownloadAction, invoke]);
|
|
151
92
|
if (previewUrl && isSupportTheming) {
|
|
152
93
|
previewUrl = getPreviewUrlWithTheme(previewUrl, themeState);
|
|
153
94
|
}
|
|
@@ -159,15 +100,15 @@ var EmbedModal = function EmbedModal(_ref) {
|
|
|
159
100
|
testId: testId,
|
|
160
101
|
width: width
|
|
161
102
|
}, /*#__PURE__*/React.createElement(LinkInfo, {
|
|
162
|
-
icon:
|
|
103
|
+
icon: linkIcon && {
|
|
163
104
|
icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
|
|
164
105
|
size: SmartLinkSize.Large
|
|
165
106
|
})),
|
|
166
107
|
isFlexibleUi: true
|
|
167
|
-
}
|
|
108
|
+
},
|
|
168
109
|
providerName: providerName,
|
|
169
|
-
onViewButtonClick:
|
|
170
|
-
onDownloadButtonClick:
|
|
110
|
+
onViewButtonClick: invokeViewAction ? handleOnViewActionClick : undefined,
|
|
111
|
+
onDownloadButtonClick: invokeDownloadAction ? handleOnDownloadActionClick : undefined,
|
|
171
112
|
onResizeButtonClick: handleOnResizeClick,
|
|
172
113
|
size: width,
|
|
173
114
|
title: title,
|