@atlaskit/smart-card 23.1.1 → 23.1.3

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 (61) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/extractors/common/actions/extractPreviewAction.js +0 -2
  3. package/dist/cjs/state/actions/index.js +4 -2
  4. package/dist/cjs/state/hooks/useSmartLink.js +7 -1
  5. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +2 -12
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/cjs/view/BlockCard/actions/PreviewAction.js +1 -5
  8. package/dist/cjs/view/BlockCard/index.js +0 -10
  9. package/dist/cjs/view/CardWithUrl/component.js +1 -1
  10. package/dist/cjs/view/EmbedModal/index.js +2 -4
  11. package/dist/es2019/extractors/common/actions/extractPreviewAction.js +0 -2
  12. package/dist/es2019/state/actions/index.js +4 -3
  13. package/dist/es2019/state/hooks/useSmartLink.js +5 -1
  14. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +2 -11
  15. package/dist/es2019/version.json +1 -1
  16. package/dist/es2019/view/BlockCard/actions/PreviewAction.js +0 -4
  17. package/dist/es2019/view/BlockCard/index.js +0 -9
  18. package/dist/es2019/view/CardWithUrl/component.js +1 -1
  19. package/dist/es2019/view/EmbedModal/index.js +2 -3
  20. package/dist/esm/extractors/common/actions/extractPreviewAction.js +0 -2
  21. package/dist/esm/state/actions/index.js +4 -3
  22. package/dist/esm/state/hooks/useSmartLink.js +6 -1
  23. package/dist/esm/state/hooks-external/useSmartLinkActions.js +2 -11
  24. package/dist/esm/version.json +1 -1
  25. package/dist/esm/view/BlockCard/actions/PreviewAction.js +1 -5
  26. package/dist/esm/view/BlockCard/index.js +0 -9
  27. package/dist/esm/view/CardWithUrl/component.js +1 -1
  28. package/dist/esm/view/EmbedModal/index.js +2 -3
  29. package/dist/types/extractors/block/types.d.ts +0 -2
  30. package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +1 -1
  31. package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +0 -2
  32. package/dist/types/view/Card/index.d.ts +1 -1
  33. package/dist/types/view/EmbedModal/index.d.ts +1 -3
  34. package/dist/types/view/EmbedModal/types.d.ts +1 -4
  35. package/dist/types-ts4.0/extractors/block/types.d.ts +0 -2
  36. package/dist/types-ts4.0/extractors/common/actions/extractPreviewAction.d.ts +1 -1
  37. package/dist/types-ts4.0/view/BlockCard/actions/PreviewAction.d.ts +0 -2
  38. package/dist/types-ts4.0/view/Card/index.d.ts +1 -1
  39. package/dist/types-ts4.0/view/EmbedModal/index.d.ts +1 -3
  40. package/dist/types-ts4.0/view/EmbedModal/types.d.ts +1 -4
  41. package/package.json +9 -9
  42. package/dist/cjs/view/EmbedModal/components/size-experiment/index.js +0 -36
  43. package/dist/cjs/view/EmbedModal/components/size-experiment/types.js +0 -5
  44. package/dist/cjs/view/common/Modal.js +0 -158
  45. package/dist/cjs/view/common/ModalHeader.js +0 -114
  46. package/dist/es2019/view/EmbedModal/components/size-experiment/index.js +0 -24
  47. package/dist/es2019/view/EmbedModal/components/size-experiment/types.js +0 -1
  48. package/dist/es2019/view/common/Modal.js +0 -115
  49. package/dist/es2019/view/common/ModalHeader.js +0 -88
  50. package/dist/esm/view/EmbedModal/components/size-experiment/index.js +0 -23
  51. package/dist/esm/view/EmbedModal/components/size-experiment/types.js +0 -1
  52. package/dist/esm/view/common/Modal.js +0 -148
  53. package/dist/esm/view/common/ModalHeader.js +0 -89
  54. package/dist/types/view/EmbedModal/components/size-experiment/index.d.ts +0 -7
  55. package/dist/types/view/EmbedModal/components/size-experiment/types.d.ts +0 -4
  56. package/dist/types/view/common/Modal.d.ts +0 -26
  57. package/dist/types/view/common/ModalHeader.d.ts +0 -19
  58. package/dist/types-ts4.0/view/EmbedModal/components/size-experiment/index.d.ts +0 -7
  59. package/dist/types-ts4.0/view/EmbedModal/components/size-experiment/types.d.ts +0 -4
  60. package/dist/types-ts4.0/view/common/Modal.d.ts +0 -26
  61. package/dist/types-ts4.0/view/common/ModalHeader.d.ts +0 -19
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 23.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`558e0af2263`](https://bitbucket.org/atlassian/atlassian-frontend/commits/558e0af2263) - Embed Preview: Clean up experiment
8
+
9
+ ## 23.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`5bdea3e4375`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5bdea3e4375) - Re register card when redux store is recreated
14
+
3
15
  ## 23.1.1
4
16
 
5
17
  ### Patch Changes
@@ -72,7 +72,6 @@ var extractPreviewAction = function extractPreviewAction(_ref) {
72
72
  origin = _ref.origin,
73
73
  _ref$source = _ref.source,
74
74
  source = _ref$source === void 0 ? 'block' : _ref$source,
75
- featureFlags = _ref.featureFlags,
76
75
  analytics = _ref.analytics;
77
76
  // Extract metadata from view props & raw JSON-LD.
78
77
  var metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
@@ -87,7 +86,6 @@ var extractPreviewAction = function extractPreviewAction(_ref) {
87
86
  var previewAction = (0, _BlockCard.PreviewAction)(_objectSpread(_objectSpread({}, metadata), {}, {
88
87
  analytics: analytics,
89
88
  origin: origin,
90
- featureFlags: featureFlags,
91
89
  testId: testId,
92
90
  onDownloadActionClick: function onDownloadActionClick() {
93
91
  handleInvoke(getInvokeOpts(key, 'DownloadAction'));
@@ -31,6 +31,8 @@ var _jsonld = require("../../utils/jsonld");
31
31
 
32
32
  var _analytics = require("../analytics");
33
33
 
34
+ var _constants2 = require("../../constants");
35
+
34
36
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
37
 
36
38
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -45,7 +47,7 @@ var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
45
47
  dispatch = store.dispatch;
46
48
 
47
49
  var _ref = getState()[url] || {
48
- status: 'pending',
50
+ status: _constants2.SmartLinkStatus.Pending,
49
51
  details: undefined
50
52
  },
51
53
  details = _ref.details,
@@ -178,7 +180,7 @@ var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
178
180
  })), [url, hasData, connections.client, handleResolvedLinkResponse, handleResolvedLinkError, id]);
179
181
  var register = (0, _react.useCallback)(function () {
180
182
  if (!details) {
181
- dispatch((0, _linkingCommon.cardAction)(_linkingCommon.ACTION_PENDING, {
183
+ dispatch((0, _linkingCommon.cardAction)(_linkingCommon.ACTION_RESOLVING, {
182
184
  url: url
183
185
  }));
184
186
  setMetadataStatus('pending');
@@ -21,8 +21,14 @@ var _analytics = require("../analytics");
21
21
 
22
22
  var _renderers = require("../renderers");
23
23
 
24
+ var _linkProvider = require("@atlaskit/link-provider");
25
+
24
26
  function useSmartLink(id, url, dispatchAnalytics) {
25
27
  var state = (0, _store.useSmartCardState)(url);
28
+
29
+ var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
30
+ store = _useSmartLinkContext.store;
31
+
26
32
  var analytics = (0, _analytics.useSmartLinkAnalytics)(url, dispatchAnalytics, id);
27
33
  var actions = (0, _actions.useSmartCardActions)(id, url, analytics);
28
34
  var config = (0, _config.useSmartLinkConfig)();
@@ -42,7 +48,7 @@ function useSmartLink(id, url, dispatchAnalytics) {
42
48
  // eslint-disable-next-line react-hooks/exhaustive-deps
43
49
 
44
50
 
45
- (0, _react.useEffect)(register, [url]); // Provide the state and card actions to consumers.
51
+ (0, _react.useEffect)(register, [url, store]); // Provide the state and card actions to consumers.
46
52
 
47
53
  return {
48
54
  state: state,
@@ -13,8 +13,6 @@ var _react = require("react");
13
13
 
14
14
  var _uuid = _interopRequireDefault(require("uuid"));
15
15
 
16
- var _linkProvider = require("@atlaskit/link-provider");
17
-
18
16
  var _block = require("../../extractors/block");
19
17
 
20
18
  var _actions = require("../actions");
@@ -43,21 +41,13 @@ function useSmartLinkActions(_ref) {
43
41
 
44
42
  var linkState = (0, _store.useSmartCardState)(url);
45
43
  var linkAnalytics = (0, _analytics.useSmartLinkAnalytics)(url, analyticsHandler, id);
46
- var linkActions = (0, _actions.useSmartCardActions)(id, url, linkAnalytics); // Actions do not have access to the react tree, so we need to obtain
47
- // feature flags here where we still can access SmartLinkContext context
48
- // and pass the flags down to the extractor. See PreviewAction.tsx for details.
49
-
50
- var embedModalSize = (0, _linkProvider.useFeatureFlag)('embedModalSize');
44
+ var linkActions = (0, _actions.useSmartCardActions)(id, url, linkAnalytics);
51
45
  (0, _react.useEffect)(function () {
52
46
  if (!linkState.details) {
53
47
  return;
54
48
  }
55
49
 
56
- var featureFlags = {
57
- embedModalSize: embedModalSize
58
- };
59
50
  var cardProperties = (0, _block.extractBlockProps)(linkState.details.data, linkState.details.meta, {
60
- featureFlags: featureFlags,
61
51
  handleInvoke: function handleInvoke(opts) {
62
52
  return linkActions.invoke(opts, appearance);
63
53
  },
@@ -79,6 +69,6 @@ function useSmartLinkActions(_ref) {
79
69
  };
80
70
  });
81
71
  setActions(cardActions);
82
- }, [linkState, linkActions, linkAnalytics, appearance, platform, embedModalSize, origin]);
72
+ }, [linkState, linkActions, linkAnalytics, appearance, platform, origin]);
83
73
  return actions;
84
74
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.1.1",
3
+ "version": "23.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -119,13 +119,9 @@ var _default = function _default(_ref2) {
119
119
  return previewFunction(_objectSpread({
120
120
  popupMountPointId: 'twp-editor-preview-iframe',
121
121
  providerName: 'Preview',
122
- closeLabel: 'Close Preview',
123
122
  showModal: true,
124
123
  iframeName: 'twp-editor-preview-iframe',
125
- onClose: function onClose() {},
126
- metadata: {
127
- items: details || []
128
- }
124
+ onClose: function onClose() {}
129
125
  }, rest));
130
126
  }
131
127
  };
@@ -91,8 +91,6 @@ var _ForbiddenView = require("./views/ForbiddenView");
91
91
 
92
92
  var _ErroredView = require("./views/ErroredView");
93
93
 
94
- var _linkProvider = require("@atlaskit/link-provider");
95
-
96
94
  var _PreviewAction = _interopRequireDefault(require("./actions/PreviewAction"));
97
95
 
98
96
  var BlockCard = function BlockCard(_ref) {
@@ -115,19 +113,11 @@ var BlockCard = function BlockCard(_ref) {
115
113
  showActions = _ref.showActions,
116
114
  platform = _ref.platform,
117
115
  analytics = _ref.analytics;
118
- // Actions do not have access to the react tree, so we need to obtain
119
- // feature flags here where we still can access SmartLinkContext context
120
- // and pass the flags down to the extractor. See PreviewAction.tsx for details.
121
- var embedModalSize = (0, _linkProvider.useFeatureFlag)('embedModalSize');
122
- var featureFlags = {
123
- embedModalSize: embedModalSize
124
- };
125
116
  var data = details && details.data || (0, _jsonld.getEmptyJsonLd)();
126
117
  var meta = details && details.meta;
127
118
  var extractorOpts = {
128
119
  analytics: analytics,
129
120
  origin: 'smartLinkCard',
130
- featureFlags: featureFlags,
131
121
  handleInvoke: handleInvoke,
132
122
  extensionKey: (0, _helpers.getExtensionKey)(details)
133
123
  };
@@ -121,7 +121,7 @@ function CardWithUrlContent(_ref) {
121
121
  (0, _react.useEffect)(function () {
122
122
  measure.mark(id, state.status);
123
123
 
124
- if (state.status !== 'pending') {
124
+ if (state.status !== 'pending' && state.status !== 'resolving') {
125
125
  measure.create(id, state.status);
126
126
  analytics.operational.instrument({
127
127
  id: id,
@@ -25,8 +25,6 @@ var _types = require("./types");
25
25
 
26
26
  var _errorBoundary = _interopRequireDefault(require("./components/error-boundary"));
27
27
 
28
- var _sizeExperiment = _interopRequireDefault(require("./components/size-experiment"));
29
-
30
28
  var _analytics = _interopRequireDefault(require("./components/analytics"));
31
29
 
32
30
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -55,7 +53,7 @@ var EmbedModal = function EmbedModal(_ref) {
55
53
  providerName = _ref.providerName,
56
54
  showModal = _ref.showModal,
57
55
  _ref$size = _ref.size,
58
- size = _ref$size === void 0 ? _types.EmbedModalSize.Small : _ref$size,
56
+ size = _ref$size === void 0 ? _types.EmbedModalSize.Large : _ref$size,
59
57
  src = _ref.src,
60
58
  _ref$testId = _ref.testId,
61
59
  testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
@@ -131,6 +129,6 @@ var EmbedModal = function EmbedModal(_ref) {
131
129
  }))));
132
130
  };
133
131
 
134
- var _default = (0, _sizeExperiment.default)((0, _analytics.default)((0, _errorBoundary.default)(EmbedModal)));
132
+ var _default = (0, _analytics.default)((0, _errorBoundary.default)(EmbedModal));
135
133
 
136
134
  exports.default = _default;
@@ -47,7 +47,6 @@ export const extractPreviewAction = ({
47
47
  platform,
48
48
  origin,
49
49
  source = 'block',
50
- featureFlags,
51
50
  analytics
52
51
  }) => {
53
52
  // Extract metadata from view props & raw JSON-LD.
@@ -63,7 +62,6 @@ export const extractPreviewAction = ({
63
62
  const previewAction = PreviewAction({ ...metadata,
64
63
  analytics,
65
64
  origin,
66
- featureFlags,
67
65
  testId,
68
66
  onDownloadActionClick: () => {
69
67
  handleInvoke(getInvokeOpts(key, 'DownloadAction'));
@@ -1,12 +1,13 @@
1
1
  import { useMemo, useCallback } from 'react';
2
2
  import { auth } from '@atlaskit/outbound-auth-flow-client';
3
3
  import { useSmartLinkContext } from '@atlaskit/link-provider';
4
- import { ACTION_PENDING, ACTION_RESOLVED, ACTION_ERROR, ACTION_ERROR_FALLBACK, ACTION_RELOADING, ACTION_UPDATE_METADATA_STATUS, cardAction, APIError } from '@atlaskit/linking-common';
4
+ import { ACTION_RESOLVED, ACTION_ERROR, ACTION_ERROR_FALLBACK, ACTION_RELOADING, ACTION_UPDATE_METADATA_STATUS, cardAction, APIError, ACTION_RESOLVING } from '@atlaskit/linking-common';
5
5
  import { getDefinitionId, getByDefinitionId, getServices, getStatus, getExtensionKey } from '../helpers';
6
6
  import { ERROR_MESSAGE_OAUTH, ERROR_MESSAGE_FATAL, ERROR_MESSAGE_METADATA } from './constants';
7
7
  import * as measure from '../../utils/performance';
8
8
  import { getUnauthorizedJsonLd } from '../../utils/jsonld';
9
9
  import { addMetadataToExperience } from '../analytics';
10
+ import { SmartLinkStatus } from '../../constants';
10
11
  export const useSmartCardActions = (id, url, analytics) => {
11
12
  const {
12
13
  store,
@@ -22,7 +23,7 @@ export const useSmartCardActions = (id, url, analytics) => {
22
23
  status,
23
24
  metadataStatus
24
25
  } = getState()[url] || {
25
- status: 'pending',
26
+ status: SmartLinkStatus.Pending,
26
27
  details: undefined
27
28
  };
28
29
  const hasAuthFlowSupported = config.authFlow !== 'disabled';
@@ -125,7 +126,7 @@ export const useSmartCardActions = (id, url, analytics) => {
125
126
  }, [url, hasData, connections.client, handleResolvedLinkResponse, handleResolvedLinkError, id]);
126
127
  const register = useCallback(() => {
127
128
  if (!details) {
128
- dispatch(cardAction(ACTION_PENDING, {
129
+ dispatch(cardAction(ACTION_RESOLVING, {
129
130
  url
130
131
  }));
131
132
  setMetadataStatus('pending');
@@ -4,8 +4,12 @@ import { useSmartCardActions as useSmartLinkActions } from '../actions';
4
4
  import { useSmartLinkConfig } from '../config';
5
5
  import { useSmartLinkAnalytics } from '../analytics';
6
6
  import { useSmartLinkRenderers } from '../renderers';
7
+ import { useSmartLinkContext } from '@atlaskit/link-provider';
7
8
  export function useSmartLink(id, url, dispatchAnalytics) {
8
9
  const state = useSmartLinkState(url);
10
+ const {
11
+ store
12
+ } = useSmartLinkContext();
9
13
  const analytics = useSmartLinkAnalytics(url, dispatchAnalytics, id);
10
14
  const actions = useSmartLinkActions(id, url, analytics);
11
15
  const config = useSmartLinkConfig();
@@ -19,7 +23,7 @@ export function useSmartLink(id, url, dispatchAnalytics) {
19
23
  // eslint-disable-next-line react-hooks/exhaustive-deps
20
24
 
21
25
 
22
- useEffect(register, [url]); // Provide the state and card actions to consumers.
26
+ useEffect(register, [url, store]); // Provide the state and card actions to consumers.
23
27
 
24
28
  return {
25
29
  state,
@@ -1,6 +1,5 @@
1
1
  import { useEffect, useMemo, useState } from 'react';
2
2
  import uuid from 'uuid';
3
- import { useFeatureFlag } from '@atlaskit/link-provider';
4
3
  import { extractBlockProps as extractCardProps } from '../../extractors/block';
5
4
  import { useSmartCardActions as useLinkActions } from '../actions';
6
5
  import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
@@ -17,21 +16,13 @@ export function useSmartLinkActions({
17
16
  const [actions, setActions] = useState([]);
18
17
  const linkState = useLinkState(url);
19
18
  const linkAnalytics = useLinkAnalytics(url, analyticsHandler, id);
20
- const linkActions = useLinkActions(id, url, linkAnalytics); // Actions do not have access to the react tree, so we need to obtain
21
- // feature flags here where we still can access SmartLinkContext context
22
- // and pass the flags down to the extractor. See PreviewAction.tsx for details.
23
-
24
- const embedModalSize = useFeatureFlag('embedModalSize');
19
+ const linkActions = useLinkActions(id, url, linkAnalytics);
25
20
  useEffect(() => {
26
21
  if (!linkState.details) {
27
22
  return;
28
23
  }
29
24
 
30
- const featureFlags = {
31
- embedModalSize
32
- };
33
25
  const cardProperties = extractCardProps(linkState.details.data, linkState.details.meta, {
34
- featureFlags,
35
26
  handleInvoke: opts => linkActions.invoke(opts, appearance),
36
27
  analytics: linkAnalytics,
37
28
  origin,
@@ -49,6 +40,6 @@ export function useSmartLinkActions({
49
40
  invoke: action.promise
50
41
  }));
51
42
  setActions(cardActions);
52
- }, [linkState, linkActions, linkAnalytics, appearance, platform, embedModalSize, origin]);
43
+ }, [linkState, linkActions, linkAnalytics, appearance, platform, origin]);
53
44
  return actions;
54
45
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.1.1",
3
+ "version": "23.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -58,13 +58,9 @@ export default (({
58
58
  promise: () => previewFunction({
59
59
  popupMountPointId: 'twp-editor-preview-iframe',
60
60
  providerName: 'Preview',
61
- closeLabel: 'Close Preview',
62
61
  showModal: true,
63
62
  iframeName: 'twp-editor-preview-iframe',
64
63
  onClose: () => {},
65
- metadata: {
66
- items: details || []
67
- },
68
64
  ...rest
69
65
  })
70
66
  }));
@@ -13,7 +13,6 @@ import { ResolvingView as BlockCardResolvingView } from './views/ResolvingView';
13
13
  import { UnauthorizedView as BlockCardUnauthorisedView } from './views/UnauthorizedView';
14
14
  import { ForbiddenView as BlockCardForbiddenView } from './views/ForbiddenView';
15
15
  import { ErroredView as BlockCardErroredView } from './views/ErroredView';
16
- import { useFeatureFlag } from '@atlaskit/link-provider';
17
16
  export { default as PreviewAction } from './actions/PreviewAction';
18
17
  export { ForbiddenAction, AuthorizeAction, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardErroredView, BlockCardNotFoundView };
19
18
  export const BlockCard = ({
@@ -38,19 +37,11 @@ export const BlockCard = ({
38
37
  }) => {
39
38
  var _details$meta, _forbiddenViewProps$c;
40
39
 
41
- // Actions do not have access to the react tree, so we need to obtain
42
- // feature flags here where we still can access SmartLinkContext context
43
- // and pass the flags down to the extractor. See PreviewAction.tsx for details.
44
- const embedModalSize = useFeatureFlag('embedModalSize');
45
- const featureFlags = {
46
- embedModalSize
47
- };
48
40
  const data = details && details.data || getEmptyJsonLd();
49
41
  const meta = details && details.meta;
50
42
  const extractorOpts = {
51
43
  analytics,
52
44
  origin: 'smartLinkCard',
53
- featureFlags,
54
45
  handleInvoke,
55
46
  extensionKey: getExtensionKey(details)
56
47
  };
@@ -88,7 +88,7 @@ export function CardWithUrlContent({
88
88
  useEffect(() => {
89
89
  measure.mark(id, state.status);
90
90
 
91
- if (state.status !== 'pending') {
91
+ if (state.status !== 'pending' && state.status !== 'resolving') {
92
92
  measure.create(id, state.status);
93
93
  analytics.operational.instrument({
94
94
  id,
@@ -5,7 +5,6 @@ import { MAX_MODAL_SIZE, MIN_MODAL_SIZE } from './constants';
5
5
  import EmbedContent from './components/embed-content';
6
6
  import { EmbedModalSize } from './types';
7
7
  import withErrorBoundary from './components/error-boundary';
8
- import withSizeExperiment from './components/size-experiment';
9
8
  import withAnalytics from './components/analytics';
10
9
 
11
10
  const toSize = width => width === MAX_MODAL_SIZE ? EmbedModalSize.Large : EmbedModalSize.Small;
@@ -24,7 +23,7 @@ const EmbedModal = ({
24
23
  onViewActionClick,
25
24
  providerName,
26
25
  showModal,
27
- size = EmbedModalSize.Small,
26
+ size = EmbedModalSize.Large,
28
27
  src,
29
28
  testId = 'smart-embed-preview-modal',
30
29
  title,
@@ -89,4 +88,4 @@ const EmbedModal = ({
89
88
  }))));
90
89
  };
91
90
 
92
- export default withSizeExperiment(withAnalytics(withErrorBoundary(EmbedModal)));
91
+ export default withAnalytics(withErrorBoundary(EmbedModal));
@@ -61,7 +61,6 @@ export var extractPreviewAction = function extractPreviewAction(_ref) {
61
61
  origin = _ref.origin,
62
62
  _ref$source = _ref.source,
63
63
  source = _ref$source === void 0 ? 'block' : _ref$source,
64
- featureFlags = _ref.featureFlags,
65
64
  analytics = _ref.analytics;
66
65
  // Extract metadata from view props & raw JSON-LD.
67
66
  var metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
@@ -76,7 +75,6 @@ export var extractPreviewAction = function extractPreviewAction(_ref) {
76
75
  var previewAction = PreviewAction(_objectSpread(_objectSpread({}, metadata), {}, {
77
76
  analytics: analytics,
78
77
  origin: origin,
79
- featureFlags: featureFlags,
80
78
  testId: testId,
81
79
  onDownloadActionClick: function onDownloadActionClick() {
82
80
  handleInvoke(getInvokeOpts(key, 'DownloadAction'));
@@ -3,12 +3,13 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { useMemo, useCallback } from 'react';
4
4
  import { auth } from '@atlaskit/outbound-auth-flow-client';
5
5
  import { useSmartLinkContext } from '@atlaskit/link-provider';
6
- import { ACTION_PENDING, ACTION_RESOLVED, ACTION_ERROR, ACTION_ERROR_FALLBACK, ACTION_RELOADING, ACTION_UPDATE_METADATA_STATUS, cardAction, APIError } from '@atlaskit/linking-common';
6
+ import { ACTION_RESOLVED, ACTION_ERROR, ACTION_ERROR_FALLBACK, ACTION_RELOADING, ACTION_UPDATE_METADATA_STATUS, cardAction, APIError, ACTION_RESOLVING } from '@atlaskit/linking-common';
7
7
  import { getDefinitionId, getByDefinitionId, getServices, getStatus, getExtensionKey } from '../helpers';
8
8
  import { ERROR_MESSAGE_OAUTH, ERROR_MESSAGE_FATAL, ERROR_MESSAGE_METADATA } from './constants';
9
9
  import * as measure from '../../utils/performance';
10
10
  import { getUnauthorizedJsonLd } from '../../utils/jsonld';
11
11
  import { addMetadataToExperience } from '../analytics';
12
+ import { SmartLinkStatus } from '../../constants';
12
13
  export var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
13
14
  var _useSmartLinkContext = useSmartLinkContext(),
14
15
  store = _useSmartLinkContext.store,
@@ -19,7 +20,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
19
20
  dispatch = store.dispatch;
20
21
 
21
22
  var _ref = getState()[url] || {
22
- status: 'pending',
23
+ status: SmartLinkStatus.Pending,
23
24
  details: undefined
24
25
  },
25
26
  details = _ref.details,
@@ -152,7 +153,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
152
153
  })), [url, hasData, connections.client, handleResolvedLinkResponse, handleResolvedLinkError, id]);
153
154
  var register = useCallback(function () {
154
155
  if (!details) {
155
- dispatch(cardAction(ACTION_PENDING, {
156
+ dispatch(cardAction(ACTION_RESOLVING, {
156
157
  url: url
157
158
  }));
158
159
  setMetadataStatus('pending');
@@ -5,8 +5,13 @@ import { useSmartCardActions as useSmartLinkActions } from '../actions';
5
5
  import { useSmartLinkConfig } from '../config';
6
6
  import { useSmartLinkAnalytics } from '../analytics';
7
7
  import { useSmartLinkRenderers } from '../renderers';
8
+ import { useSmartLinkContext } from '@atlaskit/link-provider';
8
9
  export function useSmartLink(id, url, dispatchAnalytics) {
9
10
  var state = useSmartLinkState(url);
11
+
12
+ var _useSmartLinkContext = useSmartLinkContext(),
13
+ store = _useSmartLinkContext.store;
14
+
10
15
  var analytics = useSmartLinkAnalytics(url, dispatchAnalytics, id);
11
16
  var actions = useSmartLinkActions(id, url, analytics);
12
17
  var config = useSmartLinkConfig();
@@ -26,7 +31,7 @@ export function useSmartLink(id, url, dispatchAnalytics) {
26
31
  // eslint-disable-next-line react-hooks/exhaustive-deps
27
32
 
28
33
 
29
- useEffect(register, [url]); // Provide the state and card actions to consumers.
34
+ useEffect(register, [url, store]); // Provide the state and card actions to consumers.
30
35
 
31
36
  return {
32
37
  state: state,
@@ -1,7 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { useEffect, useMemo, useState } from 'react';
3
3
  import uuid from 'uuid';
4
- import { useFeatureFlag } from '@atlaskit/link-provider';
5
4
  import { extractBlockProps as extractCardProps } from '../../extractors/block';
6
5
  import { useSmartCardActions as useLinkActions } from '../actions';
7
6
  import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
@@ -25,21 +24,13 @@ export function useSmartLinkActions(_ref) {
25
24
 
26
25
  var linkState = useLinkState(url);
27
26
  var linkAnalytics = useLinkAnalytics(url, analyticsHandler, id);
28
- var linkActions = useLinkActions(id, url, linkAnalytics); // Actions do not have access to the react tree, so we need to obtain
29
- // feature flags here where we still can access SmartLinkContext context
30
- // and pass the flags down to the extractor. See PreviewAction.tsx for details.
31
-
32
- var embedModalSize = useFeatureFlag('embedModalSize');
27
+ var linkActions = useLinkActions(id, url, linkAnalytics);
33
28
  useEffect(function () {
34
29
  if (!linkState.details) {
35
30
  return;
36
31
  }
37
32
 
38
- var featureFlags = {
39
- embedModalSize: embedModalSize
40
- };
41
33
  var cardProperties = extractCardProps(linkState.details.data, linkState.details.meta, {
42
- featureFlags: featureFlags,
43
34
  handleInvoke: function handleInvoke(opts) {
44
35
  return linkActions.invoke(opts, appearance);
45
36
  },
@@ -61,6 +52,6 @@ export function useSmartLinkActions(_ref) {
61
52
  };
62
53
  });
63
54
  setActions(cardActions);
64
- }, [linkState, linkActions, linkAnalytics, appearance, platform, embedModalSize, origin]);
55
+ }, [linkState, linkActions, linkAnalytics, appearance, platform, origin]);
65
56
  return actions;
66
57
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.1.1",
3
+ "version": "23.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -92,13 +92,9 @@ export default (function (_ref2) {
92
92
  return previewFunction(_objectSpread({
93
93
  popupMountPointId: 'twp-editor-preview-iframe',
94
94
  providerName: 'Preview',
95
- closeLabel: 'Close Preview',
96
95
  showModal: true,
97
96
  iframeName: 'twp-editor-preview-iframe',
98
- onClose: function onClose() {},
99
- metadata: {
100
- items: details || []
101
- }
97
+ onClose: function onClose() {}
102
98
  }, rest));
103
99
  }
104
100
  };
@@ -13,7 +13,6 @@ import { ResolvingView as BlockCardResolvingView } from './views/ResolvingView';
13
13
  import { UnauthorizedView as BlockCardUnauthorisedView } from './views/UnauthorizedView';
14
14
  import { ForbiddenView as BlockCardForbiddenView } from './views/ForbiddenView';
15
15
  import { ErroredView as BlockCardErroredView } from './views/ErroredView';
16
- import { useFeatureFlag } from '@atlaskit/link-provider';
17
16
  export { default as PreviewAction } from './actions/PreviewAction';
18
17
  export { ForbiddenAction, AuthorizeAction, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardErroredView, BlockCardNotFoundView };
19
18
  export var BlockCard = function BlockCard(_ref) {
@@ -36,19 +35,11 @@ export var BlockCard = function BlockCard(_ref) {
36
35
  showActions = _ref.showActions,
37
36
  platform = _ref.platform,
38
37
  analytics = _ref.analytics;
39
- // Actions do not have access to the react tree, so we need to obtain
40
- // feature flags here where we still can access SmartLinkContext context
41
- // and pass the flags down to the extractor. See PreviewAction.tsx for details.
42
- var embedModalSize = useFeatureFlag('embedModalSize');
43
- var featureFlags = {
44
- embedModalSize: embedModalSize
45
- };
46
38
  var data = details && details.data || getEmptyJsonLd();
47
39
  var meta = details && details.meta;
48
40
  var extractorOpts = {
49
41
  analytics: analytics,
50
42
  origin: 'smartLinkCard',
51
- featureFlags: featureFlags,
52
43
  handleInvoke: handleInvoke,
53
44
  extensionKey: getExtensionKey(details)
54
45
  };
@@ -94,7 +94,7 @@ export function CardWithUrlContent(_ref) {
94
94
  useEffect(function () {
95
95
  measure.mark(id, state.status);
96
96
 
97
- if (state.status !== 'pending') {
97
+ if (state.status !== 'pending' && state.status !== 'resolving') {
98
98
  measure.create(id, state.status);
99
99
  analytics.operational.instrument({
100
100
  id: id,
@@ -6,7 +6,6 @@ import { MAX_MODAL_SIZE, MIN_MODAL_SIZE } from './constants';
6
6
  import EmbedContent from './components/embed-content';
7
7
  import { EmbedModalSize } from './types';
8
8
  import withErrorBoundary from './components/error-boundary';
9
- import withSizeExperiment from './components/size-experiment';
10
9
  import withAnalytics from './components/analytics';
11
10
 
12
11
  var toSize = function toSize(width) {
@@ -31,7 +30,7 @@ var EmbedModal = function EmbedModal(_ref) {
31
30
  providerName = _ref.providerName,
32
31
  showModal = _ref.showModal,
33
32
  _ref$size = _ref.size,
34
- size = _ref$size === void 0 ? EmbedModalSize.Small : _ref$size,
33
+ size = _ref$size === void 0 ? EmbedModalSize.Large : _ref$size,
35
34
  src = _ref.src,
36
35
  _ref$testId = _ref.testId,
37
36
  testId = _ref$testId === void 0 ? 'smart-embed-preview-modal' : _ref$testId,
@@ -107,4 +106,4 @@ var EmbedModal = function EmbedModal(_ref) {
107
106
  }))));
108
107
  };
109
108
 
110
- export default withSizeExperiment(withAnalytics(withErrorBoundary(EmbedModal)));
109
+ export default withAnalytics(withErrorBoundary(EmbedModal));
@@ -1,4 +1,3 @@
1
- import { LinkingPlatformFeatureFlags } from '@atlaskit/linking-common';
2
1
  import { InvokeHandler } from '../../model/invoke-handler';
3
2
  import { AnalyticsFacade } from '../../state/analytics';
4
3
  import { CardInnerAppearance } from '../../view/Card/types';
@@ -8,7 +7,6 @@ export interface ExtractBlockOpts {
8
7
  analytics: AnalyticsFacade;
9
8
  origin?: AnalyticsOrigin;
10
9
  extensionKey?: string;
11
- featureFlags?: Partial<LinkingPlatformFeatureFlags>;
12
10
  source?: CardInnerAppearance;
13
11
  testId?: string;
14
12
  }
@@ -2,7 +2,7 @@ import { JsonLd } from 'json-ld-types';
2
2
  import { CardPlatform } from '../../../view/Card/types';
3
3
  import { BlockCardResolvedViewProps } from '../../../view/BlockCard';
4
4
  import { ExtractBlockOpts } from '../../block/types';
5
- export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source, featureFlags, analytics, }: ExtractBlockOpts & {
5
+ export declare const extractPreviewAction: ({ extensionKey, viewProps, jsonLd, handleInvoke, testId, platform, origin, source, analytics, }: ExtractBlockOpts & {
6
6
  viewProps: BlockCardResolvedViewProps;
7
7
  jsonLd: JsonLd.Data.BaseData;
8
8
  platform?: JsonLd.Primitives.Platforms | undefined;