@atlaskit/editor-plugin-card 0.12.2 → 0.13.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 (54) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/common/hooks/useLinkUpgradeDiscoverability.js +56 -0
  3. package/dist/cjs/common/local-storage.js +4 -1
  4. package/dist/cjs/common/pulse/index.js +8 -4
  5. package/dist/cjs/nodeviews/inlineCard.js +26 -4
  6. package/dist/cjs/nodeviews/inlineCardWithAwareness.js +83 -33
  7. package/dist/cjs/plugin.js +4 -2
  8. package/dist/cjs/pm-plugins/main.js +33 -4
  9. package/dist/cjs/ui/InlineCardOverlay/index.js +2 -1
  10. package/dist/cjs/ui/LinkToolbarAppearance.js +5 -4
  11. package/dist/cjs/utils.js +13 -1
  12. package/dist/es2019/common/hooks/useLinkUpgradeDiscoverability.js +44 -0
  13. package/dist/es2019/common/local-storage.js +3 -0
  14. package/dist/es2019/common/pulse/index.js +7 -4
  15. package/dist/es2019/nodeviews/inlineCard.js +26 -4
  16. package/dist/es2019/nodeviews/inlineCardWithAwareness.js +58 -13
  17. package/dist/es2019/plugin.js +4 -2
  18. package/dist/es2019/pm-plugins/main.js +33 -4
  19. package/dist/es2019/ui/InlineCardOverlay/index.js +2 -1
  20. package/dist/es2019/ui/LinkToolbarAppearance.js +4 -3
  21. package/dist/es2019/utils.js +9 -1
  22. package/dist/esm/common/hooks/useLinkUpgradeDiscoverability.js +49 -0
  23. package/dist/esm/common/local-storage.js +3 -0
  24. package/dist/esm/common/pulse/index.js +8 -4
  25. package/dist/esm/nodeviews/inlineCard.js +26 -4
  26. package/dist/esm/nodeviews/inlineCardWithAwareness.js +82 -30
  27. package/dist/esm/plugin.js +4 -2
  28. package/dist/esm/pm-plugins/main.js +33 -4
  29. package/dist/esm/ui/InlineCardOverlay/index.js +2 -1
  30. package/dist/esm/ui/LinkToolbarAppearance.js +5 -4
  31. package/dist/esm/utils.js +12 -0
  32. package/dist/types/common/hooks/useLinkUpgradeDiscoverability.d.ts +17 -0
  33. package/dist/types/common/local-storage.d.ts +3 -0
  34. package/dist/types/common/pulse/index.d.ts +7 -1
  35. package/dist/types/nodeviews/genericCard.d.ts +5 -2
  36. package/dist/types/nodeviews/inlineCard.d.ts +8 -2
  37. package/dist/types/nodeviews/inlineCardWithAwareness.d.ts +3 -2
  38. package/dist/types/pm-plugins/util/state.d.ts +4 -0
  39. package/dist/types/types.d.ts +11 -7
  40. package/dist/types/ui/LinkToolbarAppearance.d.ts +1 -1
  41. package/dist/types/utils.d.ts +5 -3
  42. package/dist/types-ts4.5/common/hooks/useLinkUpgradeDiscoverability.d.ts +17 -0
  43. package/dist/types-ts4.5/common/local-storage.d.ts +3 -0
  44. package/dist/types-ts4.5/common/pulse/index.d.ts +7 -1
  45. package/dist/types-ts4.5/nodeviews/genericCard.d.ts +5 -2
  46. package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +8 -2
  47. package/dist/types-ts4.5/nodeviews/inlineCardWithAwareness.d.ts +3 -2
  48. package/dist/types-ts4.5/pm-plugins/util/state.d.ts +4 -0
  49. package/dist/types-ts4.5/types.d.ts +11 -7
  50. package/dist/types-ts4.5/ui/LinkToolbarAppearance.d.ts +1 -1
  51. package/dist/types-ts4.5/utils.d.ts +5 -3
  52. package/package.json +4 -4
  53. package/report.api.md +9 -5
  54. package/tmp/api-report-tmp.d.ts +9 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#42692](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42692) [`755bedc2db1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/755bedc2db1) - [ux] Added functionality for Inline Card pulse that should surface only on the first inserted link of the day.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
3
13
  ## 0.12.2
4
14
 
5
15
  ### Patch Changes
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _react = require("react");
10
+ var _localStorage = require("../local-storage");
11
+ var useLinkUpgradeDiscoverability = function useLinkUpgradeDiscoverability(_ref) {
12
+ var _cardContext$store, _pluginInjectionApi$c2;
13
+ var url = _ref.url,
14
+ linkPosition = _ref.linkPosition,
15
+ cardContext = _ref.cardContext,
16
+ pluginInjectionApi = _ref.pluginInjectionApi,
17
+ isPulseEnabled = _ref.isPulseEnabled,
18
+ isOverlayEnabled = _ref.isOverlayEnabled;
19
+ var _useState = (0, _react.useState)(cardContext === null || cardContext === void 0 || (_cardContext$store = cardContext.store) === null || _cardContext$store === void 0 ? void 0 : _cardContext$store.getState()[url]),
20
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
21
+ urlState = _useState2[0],
22
+ setUrlState = _useState2[1];
23
+ (0, _react.useEffect)(function () {
24
+ var _cardContext$store2;
25
+ var unsubscribe = cardContext === null || cardContext === void 0 || (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 ? void 0 : _cardContext$store2.subscribe(function () {
26
+ var _cardContext$store3;
27
+ setUrlState(cardContext === null || cardContext === void 0 || (_cardContext$store3 = cardContext.store) === null || _cardContext$store3 === void 0 ? void 0 : _cardContext$store3.getState()[url]);
28
+ });
29
+ return function () {
30
+ if (unsubscribe) {
31
+ unsubscribe();
32
+ }
33
+ };
34
+ }, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.store, url]);
35
+ var canBeUpgradedToEmbed = (0, _react.useMemo)(function () {
36
+ var _cardContext$extracto;
37
+ var isResolved = (urlState === null || urlState === void 0 ? void 0 : urlState.status) === 'resolved';
38
+ return isResolved && !!(cardContext !== null && cardContext !== void 0 && (_cardContext$extracto = cardContext.extractors) !== null && _cardContext$extracto !== void 0 && _cardContext$extracto.getPreview(url, 'web'));
39
+ }, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.extractors, url, urlState === null || urlState === void 0 ? void 0 : urlState.status]);
40
+ var shouldShowLinkPulse = (0, _react.useMemo)(function () {
41
+ var _pluginInjectionApi$c;
42
+ var isKeyDiscovered = (0, _localStorage.isLocalStorageKeyDiscovered)(_localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
43
+ var awarenessCandidatePosition = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.inlineCardAwarenessCandidatePosition;
44
+ return isPulseEnabled && !isKeyDiscovered && linkPosition === awarenessCandidatePosition && canBeUpgradedToEmbed;
45
+ }, [canBeUpgradedToEmbed, isPulseEnabled, linkPosition, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.sharedState]);
46
+ var shouldShowLinkOverlay = (urlState === null || urlState === void 0 ? void 0 : urlState.status) === 'resolved' && isOverlayEnabled;
47
+ var shouldShowToolbarPulse = (0, _react.useMemo)(function () {
48
+ return isPulseEnabled && !(0, _localStorage.isLocalStorageKeyDiscovered)(_localStorage.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR) && canBeUpgradedToEmbed;
49
+ }, [canBeUpgradedToEmbed, isPulseEnabled]);
50
+ return {
51
+ shouldShowToolbarPulse: shouldShowToolbarPulse,
52
+ shouldShowLinkPulse: shouldShowLinkPulse,
53
+ shouldShowLinkOverlay: shouldShowLinkOverlay
54
+ };
55
+ };
56
+ var _default = exports.default = useLinkUpgradeDiscoverability;
@@ -3,10 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.markLocalStorageKeyDiscovered = exports.isLocalStorageKeyDiscovered = exports.LOCAL_STORAGE_DISCOVERED_KEY = exports.LOCAL_STORAGE_CLIENT_KEY = void 0;
6
+ exports.markLocalStorageKeyDiscovered = exports.isLocalStorageKeyDiscovered = exports.ONE_DAY_IN_MILLISECONDS = exports.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = exports.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = exports.LOCAL_STORAGE_DISCOVERED_KEY = exports.LOCAL_STORAGE_CLIENT_KEY = void 0;
7
7
  var _frontendUtilities = require("@atlaskit/frontend-utilities");
8
8
  var LOCAL_STORAGE_CLIENT_KEY = exports.LOCAL_STORAGE_CLIENT_KEY = '@atlaskit/editor-plugin-card';
9
9
  var LOCAL_STORAGE_DISCOVERED_KEY = exports.LOCAL_STORAGE_DISCOVERED_KEY = 'discovered';
10
+ var LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = exports.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
11
+ var LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = exports.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = 'link-toolbar-button-group';
12
+ var ONE_DAY_IN_MILLISECONDS = exports.ONE_DAY_IN_MILLISECONDS = 86400000;
10
13
  var storageClient = new _frontendUtilities.StorageClient(LOCAL_STORAGE_CLIENT_KEY);
11
14
  var isLocalStorageKeyDiscovered = exports.isLocalStorageKeyDiscovered = function isLocalStorageKeyDiscovered(key) {
12
15
  var localStorageValue = storageClient.getItem(key);
@@ -14,16 +14,20 @@ var DiscoveryPulse = exports.DiscoveryPulse = function DiscoveryPulse(_ref) {
14
14
  var children = _ref.children,
15
15
  localStorageKey = _ref.localStorageKey,
16
16
  isDiscovered = _ref.isDiscovered,
17
- localStorageKeyExpirationInMs = _ref.localStorageKeyExpirationInMs;
17
+ localStorageKeyExpirationInMs = _ref.localStorageKeyExpirationInMs,
18
+ _ref$discoveryMode = _ref.discoveryMode,
19
+ discoveryMode = _ref$discoveryMode === void 0 ? 'iteration' : _ref$discoveryMode;
18
20
  var discovered = isDiscovered || (0, _localStorage.isLocalStorageKeyDiscovered)(localStorageKey);
19
21
  var onDiscovery = (0, _react.useCallback)(function () {
20
22
  if (!discovered) {
21
23
  (0, _localStorage.markLocalStorageKeyDiscovered)(localStorageKey, localStorageKeyExpirationInMs);
22
24
  }
23
25
  }, [discovered, localStorageKey, localStorageKeyExpirationInMs]);
24
- return /*#__PURE__*/_react.default.createElement(_linkingCommon.Pulse, {
25
- onAnimationIteration: onDiscovery,
26
+ var pulseProps = {
27
+ onAnimationStart: discoveryMode === 'start' ? onDiscovery : undefined,
28
+ onAnimationIteration: discoveryMode === 'iteration' ? onDiscovery : undefined,
26
29
  isDiscovered: discovered
27
- }, children);
30
+ };
31
+ return /*#__PURE__*/_react.default.createElement(_linkingCommon.Pulse, pulseProps, children);
28
32
  };
29
33
  var _default = exports.default = _linkingCommon.Pulse;
@@ -20,6 +20,7 @@ var _ui = require("@atlaskit/editor-common/ui");
20
20
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
21
  var _smartCard = require("@atlaskit/smart-card");
22
22
  var _actions = require("../pm-plugins/actions");
23
+ var _utils = require("../utils");
23
24
  var _genericCard = require("./genericCard");
24
25
  var _inlineCardWithAwareness = require("./inlineCardWithAwareness");
25
26
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -123,13 +124,34 @@ function InlineCardNodeView(props) {
123
124
  node = props.node,
124
125
  view = props.view,
125
126
  getPos = props.getPos,
126
- showServerActions = props.showServerActions;
127
- var WrappedCard = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.inline-switcher') ? WrappedInlineCardWithAwareness : WrappedInlineCard;
128
- return /*#__PURE__*/_react.default.createElement(WrappedCard, {
127
+ showServerActions = props.showServerActions,
128
+ allowEmbeds = props.allowEmbeds,
129
+ allowBlockCards = props.allowBlockCards,
130
+ enableInlineUpgradeFeatures = props.enableInlineUpgradeFeatures,
131
+ pluginInjectionApi = props.pluginInjectionApi;
132
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.inline-switcher')) {
133
+ return /*#__PURE__*/_react.default.createElement(WrappedInlineCard, {
134
+ node: node,
135
+ view: view,
136
+ getPos: getPos,
137
+ showServerActions: showServerActions,
138
+ useAlternativePreloader: useAlternativePreloader
139
+ });
140
+ }
141
+ var editorState = view.state;
142
+ var linkPosition = getPos && typeof getPos() === 'number' ? getPos() : undefined;
143
+ var canBeUpgradedToEmbed = !!linkPosition && allowEmbeds ? (0, _utils.isEmbedSupportedAtPosition)(linkPosition, editorState, 'inline') : false;
144
+ var canBeUpgradedToBlock = !!linkPosition && allowBlockCards ? (0, _utils.isBlockSupportedAtPosition)(linkPosition, editorState, 'inline') : false;
145
+ var isPulseEnabled = enableInlineUpgradeFeatures && canBeUpgradedToEmbed;
146
+ var isOverlayEnabled = enableInlineUpgradeFeatures && (canBeUpgradedToEmbed || canBeUpgradedToBlock);
147
+ return /*#__PURE__*/_react.default.createElement(WrappedInlineCardWithAwareness, {
129
148
  node: node,
130
149
  view: view,
131
150
  getPos: getPos,
132
151
  showServerActions: showServerActions,
133
- useAlternativePreloader: useAlternativePreloader
152
+ useAlternativePreloader: useAlternativePreloader,
153
+ isOverlayEnabled: isOverlayEnabled,
154
+ isPulseEnabled: isPulseEnabled,
155
+ pluginInjectionApi: pluginInjectionApi
134
156
  });
135
157
  }
@@ -1,30 +1,41 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.InlineCardWithAwareness = void 0;
9
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = _interopRequireWildcard(require("react"));
9
+ var _react = require("react");
10
+ var _react2 = require("@emotion/react");
11
11
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
12
12
  var _ui = require("@atlaskit/editor-common/ui");
13
13
  var _smartCard = require("@atlaskit/smart-card");
14
+ var _useLinkUpgradeDiscoverability = _interopRequireDefault(require("../common/hooks/useLinkUpgradeDiscoverability"));
15
+ var _localStorage = require("../common/local-storage");
16
+ var _pulse = require("../common/pulse");
14
17
  var _actions = require("../pm-plugins/actions");
15
18
  var _InlineCardOverlay = _interopRequireDefault(require("../ui/InlineCardOverlay"));
16
- 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); }
17
- 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; }
19
+ /** @jsx jsx */
20
+
21
+ // editor adds a standard line-height that is bigger than an inline smart link
22
+ // due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
23
+ var loaderWrapperStyles = (0, _react2.css)({
24
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
25
+ '.loader-wrapper': {
26
+ lineHeight: 'normal'
27
+ }
28
+ });
18
29
  var InlineCard = function InlineCard(_ref) {
19
30
  var node = _ref.node,
20
31
  cardContext = _ref.cardContext,
21
32
  showServerActions = _ref.showServerActions,
22
33
  useAlternativePreloader = _ref.useAlternativePreloader,
23
34
  view = _ref.view,
24
- getPos = _ref.getPos;
25
- var scrollContainer = (0, _react.useMemo)(function () {
26
- return (0, _ui.findOverflowScrollParent)(view.dom) || undefined;
27
- }, [view.dom]);
35
+ getPos = _ref.getPos,
36
+ isOverlayEnabled = _ref.isOverlayEnabled,
37
+ isPulseEnabled = _ref.isPulseEnabled,
38
+ pluginInjectionApi = _ref.pluginInjectionApi;
28
39
  var _node$attrs = node.attrs,
29
40
  url = _node$attrs.url,
30
41
  data = _node$attrs.data;
@@ -35,7 +46,25 @@ var InlineCard = function InlineCard(_ref) {
35
46
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
36
47
  isOverlayVisible = _useState2[0],
37
48
  setIsOverlayVisible = _useState2[1];
38
- var onClick = function onClick() {};
49
+ var linkPosition = (0, _react.useMemo)(function () {
50
+ if (!getPos || typeof getPos === 'boolean') {
51
+ return undefined;
52
+ }
53
+ var pos = getPos();
54
+ return typeof pos === 'number' ? pos : undefined;
55
+ }, [getPos]);
56
+ var _useLinkUpgradeDiscov = (0, _useLinkUpgradeDiscoverability.default)({
57
+ url: url,
58
+ linkPosition: linkPosition || -1,
59
+ cardContext: cardContext === null || cardContext === void 0 ? void 0 : cardContext.value,
60
+ pluginInjectionApi: pluginInjectionApi,
61
+ isOverlayEnabled: isOverlayEnabled,
62
+ isPulseEnabled: isPulseEnabled
63
+ }),
64
+ shouldShowLinkPulse = _useLinkUpgradeDiscov.shouldShowLinkPulse;
65
+ var scrollContainer = (0, _react.useMemo)(function () {
66
+ return (0, _ui.findOverflowScrollParent)(view.dom) || undefined;
67
+ }, [view.dom]);
39
68
  var onResolve = (0, _react.useCallback)(function (data) {
40
69
  if (!getPos || typeof getPos === 'boolean') {
41
70
  return;
@@ -67,32 +96,53 @@ var InlineCard = function InlineCard(_ref) {
67
96
  url: url
68
97
  });
69
98
  }, [onResolve]);
70
- var card = /*#__PURE__*/_react.default.createElement("span", {
71
- className: "card",
72
- onMouseEnter: function onMouseEnter() {
73
- return setIsOverlayVisible(true);
74
- },
75
- onMouseLeave: function onMouseLeave() {
76
- return setIsOverlayVisible(false);
77
- }
78
- }, /*#__PURE__*/_react.default.createElement(_InlineCardOverlay.default, {
79
- isVisible: isOverlayVisible,
80
- url: url
81
- }, /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
82
- key: url,
83
- url: url,
84
- data: data,
85
- appearance: "inline",
86
- onClick: onClick,
87
- container: scrollContainer,
88
- onResolve: onResolve,
89
- onError: onError,
90
- inlinePreloaderStyle: useAlternativePreloader ? 'on-right-without-skeleton' : undefined,
91
- showServerActions: showServerActions
92
- })));
99
+ var innerCard = (0, _react.useMemo)(function () {
100
+ return (0, _react2.jsx)(_InlineCardOverlay.default, {
101
+ isVisible: isOverlayVisible,
102
+ url: url
103
+ }, (0, _react2.jsx)(_smartCard.Card, {
104
+ key: url,
105
+ url: url,
106
+ data: data,
107
+ appearance: "inline",
108
+ onClick: function onClick() {},
109
+ container: scrollContainer,
110
+ onResolve: onResolve,
111
+ onError: onError,
112
+ inlinePreloaderStyle: useAlternativePreloader ? 'on-right-without-skeleton' : undefined,
113
+ showServerActions: showServerActions
114
+ }));
115
+ }, [data, isOverlayVisible, onError, onResolve, scrollContainer, showServerActions, url, useAlternativePreloader]);
116
+
117
+ // TODO: add proper show/hide conditions for overlay in EDM-8239
118
+ var card = (0, _react.useMemo)(function () {
119
+ return shouldShowLinkPulse ? (0, _react2.jsx)("span", {
120
+ onMouseEnter: function onMouseEnter() {
121
+ return setIsOverlayVisible(true);
122
+ },
123
+ onMouseLeave: function onMouseLeave() {
124
+ return setIsOverlayVisible(false);
125
+ },
126
+ css: loaderWrapperStyles,
127
+ className: "card"
128
+ }, (0, _react2.jsx)(_pulse.DiscoveryPulse, {
129
+ localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
130
+ localStorageKeyExpirationInMs: _localStorage.ONE_DAY_IN_MILLISECONDS,
131
+ discoveryMode: 'start'
132
+ }, innerCard)) : (0, _react2.jsx)("span", {
133
+ onMouseEnter: function onMouseEnter() {
134
+ return setIsOverlayVisible(true);
135
+ },
136
+ onMouseLeave: function onMouseLeave() {
137
+ return setIsOverlayVisible(false);
138
+ },
139
+ className: "card"
140
+ }, innerCard);
141
+ }, [innerCard, shouldShowLinkPulse]);
142
+
93
143
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
94
144
  // otherwise if we got data, we can render the card directly since it doesn't need the Provider
95
- return cardContext && cardContext.value ? /*#__PURE__*/_react.default.createElement(cardContext.Provider, {
145
+ return cardContext && cardContext.value ? (0, _react2.jsx)(cardContext.Provider, {
96
146
  value: cardContext.value
97
147
  }, card) : data ? card : null;
98
148
  };
@@ -61,13 +61,14 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
61
61
  return nodes;
62
62
  },
63
63
  pmPlugins: function pmPlugins() {
64
- var _options$allowBlockCa, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme, _options$allowDatasou;
64
+ var _options$allowBlockCa, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme, _options$allowDatasou, _options$showUpgradeD;
65
65
  var allowBlockCards = (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
66
66
  var allowResizing = (_options$allowResizin = options.allowResizing) !== null && _options$allowResizin !== void 0 ? _options$allowResizin : true;
67
67
  var useAlternativePreloader = (_options$useAlternati = options.useAlternativePreloader) !== null && _options$useAlternati !== void 0 ? _options$useAlternati : true;
68
68
  var allowWrapping = (_options$allowWrappin = options.allowWrapping) !== null && _options$allowWrappin !== void 0 ? _options$allowWrappin : true;
69
69
  var allowAlignment = (_options$allowAlignme = options.allowAlignment) !== null && _options$allowAlignme !== void 0 ? _options$allowAlignme : true;
70
70
  var allowDatasource = (_options$allowDatasou = options.allowDatasource) !== null && _options$allowDatasou !== void 0 ? _options$allowDatasou : false;
71
+ var showUpgradeDiscoverability = (_options$showUpgradeD = options.showUpgradeDiscoverability) !== null && _options$showUpgradeD !== void 0 ? _options$showUpgradeD : true;
71
72
  var plugins = [{
72
73
  name: 'card',
73
74
  plugin: (0, _main.createPlugin)(_objectSpread(_objectSpread({}, options), {}, {
@@ -77,7 +78,8 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
77
78
  allowWrapping: allowWrapping,
78
79
  allowAlignment: allowAlignment,
79
80
  allowDatasource: allowDatasource,
80
- cardPluginEvents: cardPluginEvents
81
+ cardPluginEvents: cardPluginEvents,
82
+ showUpgradeDiscoverability: showUpgradeDiscoverability
81
83
  }), api)
82
84
  }, {
83
85
  name: 'cardHyperlink',
@@ -19,16 +19,20 @@ var _styles = require("@atlaskit/editor-common/styles");
19
19
  var _utils = require("@atlaskit/editor-common/utils");
20
20
  var _state = require("@atlaskit/editor-prosemirror/state");
21
21
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
22
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
23
  var _eventsFromTr = require("../analytics/events-from-tr");
24
+ var _localStorage = require("../common/local-storage");
23
25
  var _blockCard = require("../nodeviews/blockCard");
24
26
  var _datasource = require("../nodeviews/datasource");
25
27
  var _embedCard = require("../nodeviews/embedCard");
26
28
  var _inlineCard = require("../nodeviews/inlineCard");
29
+ var _utils3 = require("../utils");
27
30
  var _actions = require("./actions");
28
31
  var _pluginKey = require("./plugin-key");
29
32
  var _reducers = _interopRequireDefault(require("./reducers"));
30
33
  var _resolve = require("./util/resolve");
31
34
  var _state2 = require("./util/state");
35
+ var LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
32
36
  var createPlugin = exports.createPlugin = function createPlugin(options, pluginInjectionApi) {
33
37
  return function (pmPluginFactoryParams) {
34
38
  var editorAppearance = options.editorAppearance,
@@ -37,13 +41,21 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
37
41
  useAlternativePreloader = options.useAlternativePreloader,
38
42
  fullWidthMode = options.fullWidthMode,
39
43
  showServerActions = options.showServerActions,
40
- cardPluginEvents = options.cardPluginEvents;
44
+ cardPluginEvents = options.cardPluginEvents,
45
+ showUpgradeDiscoverability = options.showUpgradeDiscoverability,
46
+ allowEmbeds = options.allowEmbeds,
47
+ allowBlockCards = options.allowBlockCards;
48
+ var enableInlineUpgradeFeatures = !!showUpgradeDiscoverability && platform !== 'mobile';
41
49
  var inlineCardViewProducer = (0, _reactNodeView.getInlineNodeViewProducer)({
42
50
  pmPluginFactoryParams: pmPluginFactoryParams,
43
51
  Component: _inlineCard.InlineCardNodeView,
44
52
  extraComponentProps: {
45
53
  useAlternativePreloader: useAlternativePreloader,
46
- showServerActions: showServerActions
54
+ showServerActions: showServerActions,
55
+ enableInlineUpgradeFeatures: enableInlineUpgradeFeatures,
56
+ allowEmbeds: allowEmbeds,
57
+ allowBlockCards: allowBlockCards,
58
+ pluginInjectionApi: pluginInjectionApi
47
59
  }
48
60
  });
49
61
  return new _safePlugin.SafePlugin({
@@ -63,6 +75,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
63
75
  };
64
76
  },
65
77
  apply: function apply(tr, pluginState, prevEditorState) {
78
+ var _pluginState$requests;
66
79
  // Update all the positions of outstanding requests and
67
80
  // cards in the plugin state.
68
81
  var pluginStateWithUpdatedPos = (0, _state2.getPluginStateWithUpdatedPos)(pluginState, tr);
@@ -73,10 +86,26 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
73
86
  var events = (0, _eventsFromTr.eventsFromTransaction)(tr, prevEditorState);
74
87
  cardPluginEvents.push.apply(cardPluginEvents, (0, _toConsumableArray2.default)(events));
75
88
  }
76
- if (meta) {
89
+ if (!meta) {
90
+ return pluginStateWithUpdatedPos;
91
+ }
92
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.inline-switcher')) {
77
93
  return (0, _reducers.default)(pluginStateWithUpdatedPos, meta);
78
94
  }
79
- return pluginStateWithUpdatedPos;
95
+ var newState = (0, _reducers.default)(pluginStateWithUpdatedPos, meta);
96
+
97
+ // the code below is related to the "Inline Switcher" project, for more information pls see EDM-7984
98
+ var isSingleInlineLink = (pluginState === null || pluginState === void 0 || (_pluginState$requests = pluginState.requests) === null || _pluginState$requests === void 0 ? void 0 : _pluginState$requests.length) === 1 && pluginState.requests[0].appearance === 'inline';
99
+ var isSmartLinkPulseDiscovered = (0, _localStorage.isLocalStorageKeyDiscovered)(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
100
+ if (meta.type !== 'RESOLVE' || !enableInlineUpgradeFeatures || isSmartLinkPulseDiscovered || !isSingleInlineLink) {
101
+ return newState;
102
+ }
103
+ var linkPosition = pluginState.requests[0].pos;
104
+ var canBeUpgradedToEmbed = allowEmbeds && (0, _utils3.isEmbedSupportedAtPosition)(linkPosition, prevEditorState, 'inline');
105
+ if (canBeUpgradedToEmbed) {
106
+ newState.inlineCardAwarenessCandidatePosition = linkPosition;
107
+ }
108
+ return newState;
80
109
  }
81
110
  },
82
111
  view: function view(_view) {
@@ -22,7 +22,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
22
22
  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) { (0, _defineProperty2.default)(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; } /** @jsx jsx */
23
23
  var PADDING_IN_PX = 2;
24
24
  var containerStyles = (0, _react2.css)({
25
- position: 'relative'
25
+ position: 'relative',
26
+ lineHeight: 'normal'
26
27
  });
27
28
  var linkStyles = (0, _react2.css)({
28
29
  color: "var(--ds-text, #172B4D)",
@@ -20,6 +20,7 @@ var _card = require("@atlaskit/editor-common/card");
20
20
  var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
21
21
  var _utils = require("@atlaskit/editor-common/utils");
22
22
  var _model = require("@atlaskit/editor-prosemirror/model");
23
+ var _localStorage = require("../common/local-storage");
23
24
  var _pulse = require("../common/pulse");
24
25
  var _toolbar = require("../toolbar");
25
26
  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); }
@@ -52,8 +53,8 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = /*#__PURE__*/functio
52
53
  platform = _this$props.platform,
53
54
  editorAnalyticsApi = _this$props.editorAnalyticsApi,
54
55
  cardActions = _this$props.cardActions,
55
- _this$props$showInlin = _this$props.showInlineUpgradeDiscoverability,
56
- showInlineUpgradeDiscoverability = _this$props$showInlin === void 0 ? false : _this$props$showInlin;
56
+ _this$props$showUpgra = _this$props.showUpgradeDiscoverability,
57
+ showUpgradeDiscoverability = _this$props$showUpgra === void 0 ? false : _this$props$showUpgra;
57
58
  var preview = allowEmbeds && cardContext && url && cardContext.extractors.getPreview(url, platform);
58
59
  var defaultCommand = function defaultCommand() {
59
60
  return false;
@@ -114,7 +115,7 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = /*#__PURE__*/functio
114
115
  options.push(embedOption);
115
116
  }
116
117
  var LinkToolbarButtons = /*#__PURE__*/_react.default.createElement(_card.LinkToolbarButtonGroup, {
117
- key: "link-toolbar-button-group",
118
+ key: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR,
118
119
  options: options.map(function (option) {
119
120
  return (0, _card.getButtonGroupOption)(intl, dispatchCommand, _objectSpread(_objectSpread({}, option), {}, {
120
121
  onClick: (0, _card.commandWithMetadata)(option.onClick, {
@@ -125,7 +126,7 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = /*#__PURE__*/functio
125
126
  });
126
127
  var status = url ? cardContext === null || cardContext === void 0 || (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 || (_cardContext$store2 = _cardContext$store2.getState()[url]) === null || _cardContext$store2 === void 0 ? void 0 : _cardContext$store2.status : '';
127
128
  var embedEnabled = embedOption ? !embedOption.disabled : false;
128
- if ((0, _toolbar.shouldRenderToolbarPulse)(embedEnabled, currentAppearance !== null && currentAppearance !== void 0 ? currentAppearance : '', status !== null && status !== void 0 ? status : '', showInlineUpgradeDiscoverability)) {
129
+ if ((0, _toolbar.shouldRenderToolbarPulse)(embedEnabled, currentAppearance !== null && currentAppearance !== void 0 ? currentAppearance : '', status !== null && status !== void 0 ? status : '', showUpgradeDiscoverability)) {
129
130
  return (
130
131
  /*#__PURE__*/
131
132
  // This div is necessary because the toolbar uses :first-child to add margins and can't add margins to the pulse element
package/dist/cjs/utils.js CHANGED
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.titleUrlPairFromNode = exports.selectedCardAppearance = exports.mergeCardInfo = exports.findCardInfo = exports.displayInfoForCard = exports.appearanceForNodeType = void 0;
6
+ exports.titleUrlPairFromNode = exports.selectedCardAppearance = exports.mergeCardInfo = exports.isEmbedSupportedAtPosition = exports.isBlockSupportedAtPosition = exports.findCardInfo = exports.displayInfoForCard = exports.appearanceForNodeType = void 0;
7
+ var _model = require("@atlaskit/editor-prosemirror/model");
7
8
  var _state = require("@atlaskit/editor-prosemirror/state");
8
9
  var _pluginKey = require("./pm-plugins/plugin-key");
9
10
  var appearanceForNodeType = exports.appearanceForNodeType = function appearanceForNodeType(spec) {
@@ -51,4 +52,15 @@ var findCardInfo = exports.findCardInfo = function findCardInfo(state) {
51
52
  return pluginState.cards.find(function (cardInfo) {
52
53
  return cardInfo.pos === state.selection.from;
53
54
  });
55
+ };
56
+ var isAppearanceSupportedInParent = function isAppearanceSupportedInParent(currentNodePosition, editorState, fragment, currentAppearance) {
57
+ var resolvedPosition = editorState.doc.resolve(currentNodePosition);
58
+ var parent = currentAppearance === 'embed' || currentAppearance === 'block' ? resolvedPosition.node() : resolvedPosition.node(-1);
59
+ return parent && parent.type.validContent(fragment);
60
+ };
61
+ var isEmbedSupportedAtPosition = exports.isEmbedSupportedAtPosition = function isEmbedSupportedAtPosition(currentNodePosition, editorState, currentAppearance) {
62
+ return isAppearanceSupportedInParent(currentNodePosition, editorState, _model.Fragment.from(editorState.schema.nodes.embedCard.createChecked({})), currentAppearance);
63
+ };
64
+ var isBlockSupportedAtPosition = exports.isBlockSupportedAtPosition = function isBlockSupportedAtPosition(currentNodePosition, editorState, currentAppearance) {
65
+ return isAppearanceSupportedInParent(currentNodePosition, editorState, _model.Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance);
54
66
  };
@@ -0,0 +1,44 @@
1
+ import { useEffect, useMemo, useState } from 'react';
2
+ import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR } from '../local-storage';
3
+ const useLinkUpgradeDiscoverability = ({
4
+ url,
5
+ linkPosition,
6
+ cardContext,
7
+ pluginInjectionApi,
8
+ isPulseEnabled,
9
+ isOverlayEnabled
10
+ }) => {
11
+ var _cardContext$store, _pluginInjectionApi$c4;
12
+ const [urlState, setUrlState] = useState(cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$store = cardContext.store) === null || _cardContext$store === void 0 ? void 0 : _cardContext$store.getState()[url]);
13
+ useEffect(() => {
14
+ var _cardContext$store2;
15
+ const unsubscribe = cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 ? void 0 : _cardContext$store2.subscribe(() => {
16
+ var _cardContext$store3;
17
+ setUrlState(cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$store3 = cardContext.store) === null || _cardContext$store3 === void 0 ? void 0 : _cardContext$store3.getState()[url]);
18
+ });
19
+ return () => {
20
+ if (unsubscribe) {
21
+ unsubscribe();
22
+ }
23
+ };
24
+ }, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.store, url]);
25
+ const canBeUpgradedToEmbed = useMemo(() => {
26
+ var _cardContext$extracto;
27
+ const isResolved = (urlState === null || urlState === void 0 ? void 0 : urlState.status) === 'resolved';
28
+ return isResolved && !!(cardContext !== null && cardContext !== void 0 && (_cardContext$extracto = cardContext.extractors) !== null && _cardContext$extracto !== void 0 && _cardContext$extracto.getPreview(url, 'web'));
29
+ }, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.extractors, url, urlState === null || urlState === void 0 ? void 0 : urlState.status]);
30
+ const shouldShowLinkPulse = useMemo(() => {
31
+ var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$c3;
32
+ const isKeyDiscovered = isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK);
33
+ const awarenessCandidatePosition = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : (_pluginInjectionApi$c3 = _pluginInjectionApi$c2.currentState()) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.inlineCardAwarenessCandidatePosition;
34
+ return isPulseEnabled && !isKeyDiscovered && linkPosition === awarenessCandidatePosition && canBeUpgradedToEmbed;
35
+ }, [canBeUpgradedToEmbed, isPulseEnabled, linkPosition, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c4 = pluginInjectionApi.card) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.sharedState]);
36
+ const shouldShowLinkOverlay = (urlState === null || urlState === void 0 ? void 0 : urlState.status) === 'resolved' && isOverlayEnabled;
37
+ const shouldShowToolbarPulse = useMemo(() => isPulseEnabled && !isLocalStorageKeyDiscovered(LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR) && canBeUpgradedToEmbed, [canBeUpgradedToEmbed, isPulseEnabled]);
38
+ return {
39
+ shouldShowToolbarPulse,
40
+ shouldShowLinkPulse,
41
+ shouldShowLinkOverlay
42
+ };
43
+ };
44
+ export default useLinkUpgradeDiscoverability;
@@ -1,6 +1,9 @@
1
1
  import { StorageClient } from '@atlaskit/frontend-utilities';
2
2
  export const LOCAL_STORAGE_CLIENT_KEY = '@atlaskit/editor-plugin-card';
3
3
  export const LOCAL_STORAGE_DISCOVERED_KEY = 'discovered';
4
+ export const LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
5
+ export const LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR = 'link-toolbar-button-group';
6
+ export const ONE_DAY_IN_MILLISECONDS = 86400000;
4
7
  const storageClient = new StorageClient(LOCAL_STORAGE_CLIENT_KEY);
5
8
  export const isLocalStorageKeyDiscovered = key => {
6
9
  const localStorageValue = storageClient.getItem(key);
@@ -5,7 +5,8 @@ export const DiscoveryPulse = ({
5
5
  children,
6
6
  localStorageKey,
7
7
  isDiscovered,
8
- localStorageKeyExpirationInMs
8
+ localStorageKeyExpirationInMs,
9
+ discoveryMode = 'iteration'
9
10
  }) => {
10
11
  const discovered = isDiscovered || isLocalStorageKeyDiscovered(localStorageKey);
11
12
  const onDiscovery = useCallback(() => {
@@ -13,9 +14,11 @@ export const DiscoveryPulse = ({
13
14
  markLocalStorageKeyDiscovered(localStorageKey, localStorageKeyExpirationInMs);
14
15
  }
15
16
  }, [discovered, localStorageKey, localStorageKeyExpirationInMs]);
16
- return /*#__PURE__*/React.createElement(Pulse, {
17
- onAnimationIteration: onDiscovery,
17
+ const pulseProps = {
18
+ onAnimationStart: discoveryMode === 'start' ? onDiscovery : undefined,
19
+ onAnimationIteration: discoveryMode === 'iteration' ? onDiscovery : undefined,
18
20
  isDiscovered: discovered
19
- }, children);
21
+ };
22
+ return /*#__PURE__*/React.createElement(Pulse, pulseProps, children);
20
23
  };
21
24
  export default Pulse;
@@ -6,6 +6,7 @@ import { findOverflowScrollParent, UnsupportedInline } from '@atlaskit/editor-co
6
6
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
7
  import { Card as SmartCard } from '@atlaskit/smart-card';
8
8
  import { registerCard } from '../pm-plugins/actions';
9
+ import { isBlockSupportedAtPosition, isEmbedSupportedAtPosition } from '../utils';
9
10
  import { Card } from './genericCard';
10
11
  import { InlineCardWithAwareness } from './inlineCardWithAwareness';
11
12
 
@@ -104,14 +105,35 @@ export function InlineCardNodeView(props) {
104
105
  node,
105
106
  view,
106
107
  getPos,
107
- showServerActions
108
+ showServerActions,
109
+ allowEmbeds,
110
+ allowBlockCards,
111
+ enableInlineUpgradeFeatures,
112
+ pluginInjectionApi
108
113
  } = props;
109
- const WrappedCard = getBooleanFF('platform.linking-platform.smart-card.inline-switcher') ? WrappedInlineCardWithAwareness : WrappedInlineCard;
110
- return /*#__PURE__*/React.createElement(WrappedCard, {
114
+ if (!getBooleanFF('platform.linking-platform.smart-card.inline-switcher')) {
115
+ return /*#__PURE__*/React.createElement(WrappedInlineCard, {
116
+ node: node,
117
+ view: view,
118
+ getPos: getPos,
119
+ showServerActions: showServerActions,
120
+ useAlternativePreloader: useAlternativePreloader
121
+ });
122
+ }
123
+ const editorState = view.state;
124
+ const linkPosition = getPos && typeof getPos() === 'number' ? getPos() : undefined;
125
+ const canBeUpgradedToEmbed = !!linkPosition && allowEmbeds ? isEmbedSupportedAtPosition(linkPosition, editorState, 'inline') : false;
126
+ const canBeUpgradedToBlock = !!linkPosition && allowBlockCards ? isBlockSupportedAtPosition(linkPosition, editorState, 'inline') : false;
127
+ const isPulseEnabled = enableInlineUpgradeFeatures && canBeUpgradedToEmbed;
128
+ const isOverlayEnabled = enableInlineUpgradeFeatures && (canBeUpgradedToEmbed || canBeUpgradedToBlock);
129
+ return /*#__PURE__*/React.createElement(WrappedInlineCardWithAwareness, {
111
130
  node: node,
112
131
  view: view,
113
132
  getPos: getPos,
114
133
  showServerActions: showServerActions,
115
- useAlternativePreloader: useAlternativePreloader
134
+ useAlternativePreloader: useAlternativePreloader,
135
+ isOverlayEnabled: isOverlayEnabled,
136
+ isPulseEnabled: isPulseEnabled,
137
+ pluginInjectionApi: pluginInjectionApi
116
138
  });
117
139
  }