@atlaskit/smart-card 33.1.0 → 33.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/extractors/flexible/actions/extract-copy-link-action.js +1 -20
  3. package/dist/cjs/extractors/flexible/actions/extract-download-action.js +1 -23
  4. package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +1 -34
  5. package/dist/cjs/extractors/flexible/actions/index.js +2 -15
  6. package/dist/cjs/extractors/flexible/extract-state.js +1 -5
  7. package/dist/cjs/extractors/flexible/index.js +3 -7
  8. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +18 -190
  9. package/dist/cjs/state/hooks/use-invoke-client-action/index.js +21 -44
  10. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +4 -18
  11. package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
  12. package/dist/cjs/utils/analytics/analytics.js +1 -1
  13. package/dist/cjs/view/CardWithUrl/component.js +12 -25
  14. package/dist/cjs/view/CardWithUrl/loader.js +10 -22
  15. package/dist/cjs/view/EmbedModal/components/analytics/index.js +40 -89
  16. package/dist/cjs/view/EmbedModal/index.js +8 -65
  17. package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +26 -63
  18. package/dist/cjs/view/FlexibleCard/components/actions/download-action/index.js +4 -40
  19. package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +4 -47
  20. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
  21. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +10 -26
  22. package/dist/cjs/view/FlexibleCard/components/utils.js +1 -28
  23. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +13 -30
  24. package/dist/cjs/view/HoverCard/index.js +10 -22
  25. package/dist/cjs/view/LinkUrl/index.js +1 -1
  26. package/dist/es2019/extractors/flexible/actions/extract-copy-link-action.js +0 -19
  27. package/dist/es2019/extractors/flexible/actions/extract-download-action.js +0 -21
  28. package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +0 -34
  29. package/dist/es2019/extractors/flexible/actions/index.js +4 -23
  30. package/dist/es2019/extractors/flexible/extract-state.js +1 -5
  31. package/dist/es2019/extractors/flexible/index.js +3 -4
  32. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +2 -172
  33. package/dist/es2019/state/hooks/use-invoke-client-action/index.js +21 -44
  34. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +4 -18
  35. package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +3 -40
  36. package/dist/es2019/utils/analytics/analytics.js +1 -1
  37. package/dist/es2019/view/CardWithUrl/component.js +13 -26
  38. package/dist/es2019/view/CardWithUrl/loader.js +11 -23
  39. package/dist/es2019/view/EmbedModal/components/analytics/index.js +39 -88
  40. package/dist/es2019/view/EmbedModal/index.js +10 -33
  41. package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +11 -32
  42. package/dist/es2019/view/FlexibleCard/components/actions/download-action/index.js +4 -22
  43. package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +4 -27
  44. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
  45. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +6 -24
  46. package/dist/es2019/view/FlexibleCard/components/utils.js +0 -25
  47. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +12 -25
  48. package/dist/es2019/view/HoverCard/index.js +11 -23
  49. package/dist/es2019/view/LinkUrl/index.js +1 -1
  50. package/dist/esm/extractors/flexible/actions/extract-copy-link-action.js +0 -19
  51. package/dist/esm/extractors/flexible/actions/extract-download-action.js +0 -23
  52. package/dist/esm/extractors/flexible/actions/extract-preview-action.js +0 -34
  53. package/dist/esm/extractors/flexible/actions/index.js +4 -17
  54. package/dist/esm/extractors/flexible/extract-state.js +1 -5
  55. package/dist/esm/extractors/flexible/index.js +3 -4
  56. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +19 -191
  57. package/dist/esm/state/hooks/use-invoke-client-action/index.js +21 -44
  58. package/dist/esm/state/hooks-external/useSmartLinkActions.js +4 -18
  59. package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +3 -37
  60. package/dist/esm/utils/analytics/analytics.js +1 -1
  61. package/dist/esm/view/CardWithUrl/component.js +13 -26
  62. package/dist/esm/view/CardWithUrl/loader.js +10 -22
  63. package/dist/esm/view/EmbedModal/components/analytics/index.js +40 -89
  64. package/dist/esm/view/EmbedModal/index.js +10 -67
  65. package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +26 -63
  66. package/dist/esm/view/FlexibleCard/components/actions/download-action/index.js +4 -40
  67. package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +4 -47
  68. package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +3 -3
  69. package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.js +6 -26
  70. package/dist/esm/view/FlexibleCard/components/utils.js +0 -27
  71. package/dist/esm/view/HoverCard/components/views/resolved/index.js +13 -30
  72. package/dist/esm/view/HoverCard/index.js +10 -22
  73. package/dist/esm/view/LinkUrl/index.js +1 -1
  74. package/dist/types/extractors/flexible/actions/extract-copy-link-action.d.ts +0 -7
  75. package/dist/types/extractors/flexible/actions/extract-download-action.d.ts +0 -7
  76. package/dist/types/extractors/flexible/actions/extract-preview-action.d.ts +0 -7
  77. package/dist/types/extractors/flexible/actions/index.d.ts +0 -6
  78. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -60
  79. package/dist/types/state/flexible-ui-context/types.d.ts +4 -19
  80. package/dist/types/state/hooks/use-invoke/types.d.ts +0 -6
  81. package/dist/types/state/hooks/use-invoke-client-action/index.d.ts +1 -1
  82. package/dist/types/state/hooks/useSmartLink.d.ts +1 -16
  83. package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
  84. package/dist/types/utils/mocks.d.ts +1 -16
  85. package/dist/types/view/EmbedModal/index.d.ts +0 -2
  86. package/dist/types/view/EmbedModal/types.d.ts +0 -3
  87. package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.d.ts +1 -1
  88. package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/types.d.ts +0 -6
  89. package/dist/types/view/FlexibleCard/components/utils.d.ts +0 -6
  90. package/dist/types/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
  91. package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +1 -1
  92. package/dist/types-ts4.5/extractors/flexible/actions/extract-copy-link-action.d.ts +0 -7
  93. package/dist/types-ts4.5/extractors/flexible/actions/extract-download-action.d.ts +0 -7
  94. package/dist/types-ts4.5/extractors/flexible/actions/extract-preview-action.d.ts +0 -7
  95. package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +0 -6
  96. package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +2 -60
  97. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +4 -19
  98. package/dist/types-ts4.5/state/hooks/use-invoke/types.d.ts +0 -6
  99. package/dist/types-ts4.5/state/hooks/use-invoke-client-action/index.d.ts +1 -1
  100. package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +1 -16
  101. package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -1
  102. package/dist/types-ts4.5/utils/mocks.d.ts +1 -16
  103. package/dist/types-ts4.5/view/EmbedModal/index.d.ts +0 -2
  104. package/dist/types-ts4.5/view/EmbedModal/types.d.ts +0 -3
  105. package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/index.d.ts +1 -1
  106. package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-error/types.d.ts +0 -6
  107. package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +0 -6
  108. package/dist/types-ts4.5/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
  109. package/dist/types-ts4.5/view/HoverCard/components/views/resolved/index.d.ts +1 -1
  110. package/package.json +1 -4
  111. package/dist/cjs/extractors/action/extractDownloadActionProps.js +0 -32
  112. package/dist/cjs/extractors/action/extractPreviewActionProps.js +0 -47
  113. package/dist/cjs/extractors/action/extractViewActionProps.js +0 -31
  114. package/dist/cjs/extractors/flexible/actions/extract-view-action.js +0 -27
  115. package/dist/es2019/extractors/action/extractDownloadActionProps.js +0 -24
  116. package/dist/es2019/extractors/action/extractPreviewActionProps.js +0 -36
  117. package/dist/es2019/extractors/action/extractViewActionProps.js +0 -23
  118. package/dist/es2019/extractors/flexible/actions/extract-view-action.js +0 -20
  119. package/dist/esm/extractors/action/extractDownloadActionProps.js +0 -27
  120. package/dist/esm/extractors/action/extractPreviewActionProps.js +0 -41
  121. package/dist/esm/extractors/action/extractViewActionProps.js +0 -26
  122. package/dist/esm/extractors/flexible/actions/extract-view-action.js +0 -22
  123. package/dist/types/extractors/action/extractDownloadActionProps.d.ts +0 -7
  124. package/dist/types/extractors/action/extractPreviewActionProps.d.ts +0 -7
  125. package/dist/types/extractors/action/extractViewActionProps.d.ts +0 -7
  126. package/dist/types/extractors/flexible/actions/extract-view-action.d.ts +0 -7
  127. package/dist/types/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
  128. package/dist/types-ts4.5/extractors/action/extractDownloadActionProps.d.ts +0 -7
  129. package/dist/types-ts4.5/extractors/action/extractPreviewActionProps.d.ts +0 -7
  130. package/dist/types-ts4.5/extractors/action/extractViewActionProps.d.ts +0 -7
  131. package/dist/types-ts4.5/extractors/flexible/actions/extract-view-action.d.ts +0 -7
  132. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +0 -3
@@ -3,18 +3,13 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { useMemo } from 'react';
5
5
  import uuid from 'uuid';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
8
7
  import { extractInvokeDownloadAction } from '../../extractors/action/extract-invoke-download-action';
9
8
  import { extractInvokePreviewAction } from '../../extractors/action/extract-invoke-preview-action';
10
9
  import { extractInvokeViewAction } from '../../extractors/action/extract-invoke-view-action';
11
- import { extractDownloadActionProps } from '../../extractors/action/extractDownloadActionProps';
12
- import { extractPreviewActionProps } from '../../extractors/action/extractPreviewActionProps';
13
- import { extractViewActionProps } from '../../extractors/action/extractViewActionProps';
14
10
  import { messages } from '../../messages';
15
11
  import { toAction } from '../../utils/actions/to-action';
16
12
  import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
17
- import { getExtensionKey } from '../helpers';
18
13
  import useInvokeClientAction from '../hooks/use-invoke-client-action';
19
14
  import { useSmartCardState as useLinkState } from '../store';
20
15
  export function useSmartLinkActions(_ref) {
@@ -33,15 +28,6 @@ export function useSmartLinkActions(_ref) {
33
28
  analytics: linkAnalytics
34
29
  });
35
30
  if (linkState.details && !(actionOptions !== null && actionOptions !== void 0 && actionOptions.hide)) {
36
- var opts = {
37
- response: linkState.details,
38
- handleInvoke: invokeClientAction,
39
- analytics: linkAnalytics,
40
- origin: origin,
41
- extensionKey: getExtensionKey(linkState.details),
42
- source: appearance,
43
- actionOptions: actionOptions
44
- };
45
31
  var actions = [];
46
32
  var invokeParam = {
47
33
  actionOptions: actionOptions,
@@ -49,18 +35,18 @@ export function useSmartLinkActions(_ref) {
49
35
  id: id,
50
36
  response: linkState.details
51
37
  };
52
- var downloadActionProps = fg('platform-smart-card-migrate-embed-modal-analytics') ? extractInvokeDownloadAction(invokeParam) : extractDownloadActionProps(opts);
38
+ var downloadActionProps = extractInvokeDownloadAction(invokeParam);
53
39
  if (downloadActionProps) {
54
40
  actions.push(toAction(downloadActionProps, invokeClientAction, messages.download, 'download-content'));
55
41
  }
56
- var viewActionProps = fg('platform-smart-card-migrate-embed-modal-analytics') ? extractInvokeViewAction(invokeParam) : extractViewActionProps(opts);
42
+ var viewActionProps = extractInvokeViewAction(invokeParam);
57
43
  if (viewActionProps) {
58
44
  actions.push(toAction(viewActionProps, invokeClientAction, messages.view, 'view-content'));
59
45
  }
60
- var previewActionProps = fg('platform-smart-card-migrate-embed-modal-analytics') ? extractInvokePreviewAction(_objectSpread(_objectSpread({}, invokeParam), {}, {
46
+ var previewActionProps = extractInvokePreviewAction(_objectSpread(_objectSpread({}, invokeParam), {}, {
61
47
  fireEvent: fireEvent,
62
48
  origin: origin
63
- })) : extractPreviewActionProps(opts);
49
+ }));
64
50
  if (previewActionProps) {
65
51
  actions.push(toAction(previewActionProps, invokeClientAction, messages.preview_improved, 'preview-content'));
66
52
  }
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -7,10 +6,8 @@ import { AnalyticsContext } from '@atlaskit/analytics-next';
7
6
  import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
8
7
  import { useSmartLinkContext } from '@atlaskit/link-provider';
9
8
  import { getUrl } from '@atlaskit/linking-common';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
9
  import { useSmartCardState as useSmartLinkState } from '../../state/store';
12
10
  import { context } from './analytics';
13
- import { LinkAnalyticsContext } from './LinkAnalyticsContext';
14
11
  var getExtendedResolvedAttributes = function getExtendedResolvedAttributes(linkDetails, details, linkStatus) {
15
12
  var _details$meta$definit, _details$meta, _details$meta$resourc, _details$meta2;
16
13
  return _objectSpread({
@@ -49,14 +46,14 @@ export var useSmartLinkAnalyticsContext = function useSmartLinkAnalyticsContext(
49
46
  store = _useSmartLinkContext.store;
50
47
  var state = store ? getUrl(store, url) : undefined;
51
48
  return useMemo(function () {
52
- return fg('platform-smart-card-migrate-embed-modal-analytics') ? getSmartLinkAnalyticsContext({
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 ExtendedSmartLinkAnalyticsContext = function ExtendedSmartLinkAnalyticsContext(_ref3) {
64
+ export var SmartLinkAnalyticsContext = function SmartLinkAnalyticsContext(_ref3) {
68
65
  var children = _ref3.children,
69
66
  display = _ref3.display,
70
67
  id = _ref3.id,
@@ -84,35 +81,4 @@ var ExtendedSmartLinkAnalyticsContext = function ExtendedSmartLinkAnalyticsConte
84
81
  return /*#__PURE__*/React.createElement(AnalyticsContext, {
85
82
  data: data
86
83
  }, children);
87
- };
88
-
89
- /**
90
- * Provides an analytics context to supply attributes to events based on a URL
91
- * and the link state in the store
92
- */
93
- var LegacySmartLinkAnalyticsContext = function LegacySmartLinkAnalyticsContext(props) {
94
- var children = props.children,
95
- url = props.url,
96
- display = props.display;
97
- var _useSmartLinkState2 = useSmartLinkState(url),
98
- details = _useSmartLinkState2.details,
99
- status = _useSmartLinkState2.status;
100
- var attributes = getResolvedAttributes({
101
- url: url
102
- }, details, status);
103
- return /*#__PURE__*/React.createElement(LinkAnalyticsContext, _extends({}, props, {
104
- display: display
105
- }), /*#__PURE__*/React.createElement(AnalyticsContext, {
106
- data: {
107
- attributes: attributes
108
- }
109
- }, children));
110
- };
111
-
112
- /**
113
- * Provides an analytics context to supply attributes to events based on a URL
114
- * and the link state in the store
115
- */
116
- export var SmartLinkAnalyticsContext = function SmartLinkAnalyticsContext(props) {
117
- return fg('platform-smart-card-migrate-embed-modal-analytics') ? /*#__PURE__*/React.createElement(ExtendedSmartLinkAnalyticsContext, props) : /*#__PURE__*/React.createElement(LegacySmartLinkAnalyticsContext, props);
118
84
  };
@@ -8,7 +8,7 @@ export var ANALYTICS_CHANNEL = 'media';
8
8
  export var context = {
9
9
  componentName: 'smart-cards',
10
10
  packageName: "@atlaskit/smart-card",
11
- packageVersion: "33.1.0"
11
+ packageVersion: "33.2.0"
12
12
  };
13
13
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
14
14
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,11 +1,10 @@
1
1
  import React, { useCallback, useEffect, useMemo } from 'react';
2
2
  import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
5
4
  import { CardDisplay } from '../../constants';
6
5
  import { useSmartLink } from '../../state';
7
6
  import { succeedUfoExperience } from '../../state/analytics';
8
- import { getCanBeDatasource, getClickUrl, getDefinitionId, getExtensionKey, getResourceType, getServices, isFinalState } from '../../state/helpers';
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';
@@ -60,7 +59,6 @@ function Component(_ref) {
60
59
  var extensionKey = getExtensionKey(state.details);
61
60
  var resourceType = getResourceType(state.details);
62
61
  var services = getServices(state.details);
63
- var canBeDatasource = getCanBeDatasource(state.details);
64
62
  var isFlexibleUi = useMemo(function () {
65
63
  return isFlexibleUiCard(children);
66
64
  }, [children]);
@@ -141,31 +139,20 @@ function Component(_ref) {
141
139
  // - the unresolved states: viz. forbidden, not_found, unauthorized, errored.
142
140
  useEffect(function () {
143
141
  if (isFinalState(state.status)) {
144
- if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
145
- succeedUfoExperience('smart-link-rendered', id || 'NULL', {
146
- extensionKey: extensionKey,
147
- display: isFlexibleUi ? 'flexible' : appearance
148
- });
142
+ succeedUfoExperience('smart-link-rendered', id || 'NULL', {
143
+ extensionKey: extensionKey,
144
+ display: isFlexibleUi ? 'flexible' : appearance
145
+ });
149
146
 
150
- // UFO will disregard this if authentication experience has not yet been started
151
- succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
152
- display: isFlexibleUi ? 'flexible' : appearance
153
- });
154
- fireEvent('ui.smartLink.renderSuccess', {
155
- display: isFlexibleUi ? 'flexible' : appearance
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
- }
147
+ // UFO will disregard this if authentication experience has not yet been started
148
+ succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
149
+ display: isFlexibleUi ? 'flexible' : appearance
150
+ });
151
+ fireEvent('ui.smartLink.renderSuccess', {
152
+ display: isFlexibleUi ? 'flexible' : appearance
153
+ });
167
154
  }
168
- }, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource, fireEvent]);
155
+ }, [appearance, extensionKey, fireEvent, id, isFlexibleUi, state.status]);
169
156
  var onIframeDwell = useCallback(function (dwellTime, dwellPercentVisible) {
170
157
  fireEvent('ui.smartLinkIframe.dwelled', {
171
158
  id: id,
@@ -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
- if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
89
- startUfoExperience('smart-link-rendered', id || 'NULL');
90
- failUfoExperience('smart-link-rendered', id || 'NULL');
91
- failUfoExperience('smart-link-authenticated', id || 'NULL');
92
- fireEvent('ui.smartLink.renderFailed', _objectSpread(_objectSpread({}, analyticsContext === null || analyticsContext === void 0 ? void 0 : analyticsContext.attributes), {}, {
93
- display: isFlexibleUi ? 'flexible' : appearance,
94
- id: id !== null && id !== void 0 ? id : null,
95
- error: error,
96
- errorInfo: errorInfo
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
- }, [analytics.ui, analyticsContext, appearance, id, onError, url, isFlexibleUi, fireEvent]);
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
  }
@@ -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 analytics = props.analytics,
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
- if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
23
- fireEvent === null || fireEvent === void 0 || fireEvent('screen.embedPreviewModal.viewed', {
24
- origin: origin !== null && origin !== void 0 ? origin : null,
25
- size: context.size
26
- });
27
- } else {
28
- analytics === null || analytics === void 0 || analytics.screen.modalViewedEvent({
29
- name: 'embedPreviewModal',
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
- // UFO will disregard this if authentication experience has not yet been started
43
- succeedUfoExperience('smart-link-authenticated', id || 'NULL', {
44
- display: CardDisplay.EmbedPreview
45
- });
46
- fireEvent === null || fireEvent === void 0 || fireEvent('ui.smartLink.renderSuccess', {
47
- display: CardDisplay.EmbedPreview
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
- }, [analytics === null || analytics === void 0 ? void 0 : analytics.screen, analytics === null || analytics === void 0 ? void 0 : analytics.ui, fireEvent, extensionKey, id, onOpen, origin]);
39
+ }, [fireEvent, extensionKey, id, onOpen, origin]);
59
40
  var handleOnOpenFailed = useCallback(function (error, errorInfo) {
60
- if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
61
- startUfoExperience('smart-link-rendered', id || 'NULL');
62
- failUfoExperience('smart-link-rendered', id || 'NULL');
63
- failUfoExperience('smart-link-authenticated', id || 'NULL');
64
- fireEvent === null || fireEvent === void 0 || fireEvent('ui.smartLink.renderFailed', {
65
- display: CardDisplay.EmbedPreview,
66
- error: error,
67
- errorInfo: errorInfo,
68
- id: id !== null && id !== void 0 ? id : null
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
- }, [analytics === null || analytics === void 0 ? void 0 : analytics.ui, fireEvent, id, onOpenFailed]);
53
+ }, [fireEvent, id, onOpenFailed]);
81
54
  var handleOnClose = useCallback(function (context) {
82
- if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
83
- var _context$duration;
84
- fireEvent === null || fireEvent === void 0 || fireEvent('ui.modal.closed.embedPreview', {
85
- origin: origin !== null && origin !== void 0 ? origin : null,
86
- previewTime: (_context$duration = context.duration) !== null && _context$duration !== void 0 ? _context$duration : null,
87
- size: context.size
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
- }, [analytics === null || analytics === void 0 ? void 0 : analytics.ui, fireEvent, onClose, origin]);
64
+ }, [fireEvent, onClose, origin]);
103
65
  var handleOnResize = useCallback(function (context) {
104
- if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
105
- fireEvent === null || fireEvent === void 0 || fireEvent('ui.button.clicked.embedPreviewResize', {
106
- newSize: context.size,
107
- origin: origin !== null && origin !== void 0 ? origin : null,
108
- previousSize: getResizeFrom(context.size)
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
- }, [analytics === null || analytics === void 0 ? void 0 : analytics.ui, fireEvent, onResize, origin]);
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 { ActionName, CardDisplay, SmartLinkSize } from '../../constants';
6
+ import { SmartLinkSize } from '../../constants';
10
7
  import useInvokeClientAction from '../../state/hooks/use-invoke-client-action';
11
- import { downloadUrl, getPreviewUrlWithTheme, openUrl } from '../../utils';
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';
@@ -24,11 +21,8 @@ var toWidth = function toWidth(size) {
24
21
  };
25
22
  var EmbedModal = function EmbedModal(_ref) {
26
23
  var analytics = _ref.analytics,
27
- download = _ref.download,
28
24
  invokeDownloadAction = _ref.invokeDownloadAction,
29
- extensionKey = _ref.extensionKey,
30
25
  fireEvent = _ref.fireEvent,
31
- icon = _ref.icon,
32
26
  iframeName = _ref.iframeName,
33
27
  isSupportTheming = _ref.isSupportTheming,
34
28
  _ref$isTrusted = _ref.isTrusted,
@@ -45,7 +39,6 @@ var EmbedModal = function EmbedModal(_ref) {
45
39
  _ref$testId = _ref.testId,
46
40
  testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
47
41
  title = _ref.title,
48
- url = _ref.url,
49
42
  invokeViewAction = _ref.invokeViewAction;
50
43
  var defaultWidth = toWidth(size);
51
44
  var _useState = useState(showModal),
@@ -93,61 +86,11 @@ var EmbedModal = function EmbedModal(_ref) {
93
86
  var themeState = useThemeObserver();
94
87
  var previewUrl = src;
95
88
  var handleOnViewActionClick = useCallback(function () {
96
- if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
97
- invokeViewAction && invoke(invokeViewAction);
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]);
89
+ invokeViewAction && invoke(invokeViewAction);
90
+ }, [invoke, invokeViewAction]);
123
91
  var handleOnDownloadActionClick = useCallback(function () {
124
- if (fg('platform-smart-card-migrate-embed-modal-analytics')) {
125
- invokeDownloadAction && invoke(invokeDownloadAction);
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]);
92
+ invokeDownloadAction && invoke(invokeDownloadAction);
93
+ }, [invokeDownloadAction, invoke]);
151
94
  if (previewUrl && isSupportTheming) {
152
95
  previewUrl = getPreviewUrlWithTheme(previewUrl, themeState);
153
96
  }
@@ -159,15 +102,15 @@ var EmbedModal = function EmbedModal(_ref) {
159
102
  testId: testId,
160
103
  width: width
161
104
  }, /*#__PURE__*/React.createElement(LinkInfo, {
162
- icon: fg('platform-smart-card-migrate-embed-modal-analytics') ? linkIcon ? {
105
+ icon: linkIcon && {
163
106
  icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
164
107
  size: SmartLinkSize.Large
165
108
  })),
166
109
  isFlexibleUi: true
167
- } : undefined : icon,
110
+ },
168
111
  providerName: providerName,
169
- onViewButtonClick: fg('platform-smart-card-migrate-embed-modal-analytics') ? invokeViewAction ? handleOnViewActionClick : undefined : url ? handleOnViewActionClick : undefined,
170
- onDownloadButtonClick: fg('platform-smart-card-migrate-embed-modal-analytics') ? invokeDownloadAction ? handleOnDownloadActionClick : undefined : download ? handleOnDownloadActionClick : undefined,
112
+ onViewButtonClick: invokeViewAction ? handleOnViewActionClick : undefined,
113
+ onDownloadButtonClick: invokeDownloadAction ? handleOnDownloadActionClick : undefined,
171
114
  onResizeButtonClick: handleOnResizeClick,
172
115
  size: width,
173
116
  title: title,