@atlaskit/editor-plugin-card 16.6.0 → 16.7.1

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 (35) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/nodeviews/blockCard.js +16 -5
  3. package/dist/cjs/nodeviews/embedCard.js +16 -5
  4. package/dist/cjs/nodeviews/genericCard.js +2 -6
  5. package/dist/cjs/nodeviews/inlineCard.js +8 -4
  6. package/dist/cjs/pm-plugins/main.js +12 -5
  7. package/dist/cjs/ui/SmartCardSSRReactContextsProvider.js +28 -0
  8. package/dist/cjs/ui/WithCardContext.js +3 -18
  9. package/dist/es2019/nodeviews/blockCard.js +16 -5
  10. package/dist/es2019/nodeviews/embedCard.js +16 -5
  11. package/dist/es2019/nodeviews/genericCard.js +2 -6
  12. package/dist/es2019/nodeviews/inlineCard.js +8 -4
  13. package/dist/es2019/pm-plugins/main.js +12 -5
  14. package/dist/es2019/ui/SmartCardSSRReactContextsProvider.js +22 -0
  15. package/dist/es2019/ui/WithCardContext.js +3 -14
  16. package/dist/esm/nodeviews/blockCard.js +16 -5
  17. package/dist/esm/nodeviews/embedCard.js +16 -5
  18. package/dist/esm/nodeviews/genericCard.js +2 -6
  19. package/dist/esm/nodeviews/inlineCard.js +8 -4
  20. package/dist/esm/pm-plugins/main.js +12 -5
  21. package/dist/esm/ui/SmartCardSSRReactContextsProvider.js +21 -0
  22. package/dist/esm/ui/WithCardContext.js +3 -16
  23. package/dist/types/nodeviews/blockCard.d.ts +6 -2
  24. package/dist/types/nodeviews/embedCard.d.ts +6 -2
  25. package/dist/types/nodeviews/genericCard.d.ts +3 -1
  26. package/dist/types/nodeviews/inlineCard.d.ts +1 -1
  27. package/dist/types/ui/SmartCardSSRReactContextsProvider.d.ts +10 -0
  28. package/dist/types/ui/WithCardContext.d.ts +1 -3
  29. package/dist/types-ts4.5/nodeviews/blockCard.d.ts +6 -2
  30. package/dist/types-ts4.5/nodeviews/embedCard.d.ts +6 -2
  31. package/dist/types-ts4.5/nodeviews/genericCard.d.ts +3 -1
  32. package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +1 -1
  33. package/dist/types-ts4.5/ui/SmartCardSSRReactContextsProvider.d.ts +10 -0
  34. package/dist/types-ts4.5/ui/WithCardContext.d.ts +1 -3
  35. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 16.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 16.7.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`edd5d6d4c23ec`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/edd5d6d4c23ec) -
14
+ Add SSR streaming supporting to Editor starmt cards and extensions
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 16.6.0
4
21
 
5
22
  ### Minor Changes
@@ -23,9 +23,11 @@ var _editorSmartLinkDraggable = require("@atlaskit/editor-smart-link-draggable")
23
23
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
24
  var _smartCard = require("@atlaskit/smart-card");
25
25
  var _ssr = require("@atlaskit/smart-card/ssr");
26
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
26
27
  var _datasource = require("../nodeviews/datasource");
27
28
  var _actions = require("../pm-plugins/actions");
28
29
  var _utils2 = require("../pm-plugins/utils");
30
+ var _SmartCardSSRReactContextsProvider = require("../ui/SmartCardSSRReactContextsProvider");
29
31
  var _genericCard = require("./genericCard");
30
32
  function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
31
33
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
@@ -216,8 +218,13 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
216
218
  onClickCallback = _this$reactComponentP3.onClickCallback,
217
219
  CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
218
220
  isPageSSRed = _this$reactComponentP3.isPageSSRed,
219
- provider = _this$reactComponentP3.provider;
220
- return /*#__PURE__*/_react.default.createElement(WrappedBlockCard, {
221
+ provider = _this$reactComponentP3.provider,
222
+ intl = _this$reactComponentP3.intl,
223
+ smartCardContext = _this$reactComponentP3.smartCardContext;
224
+ return /*#__PURE__*/_react.default.createElement(_SmartCardSSRReactContextsProvider.SmartCardSSRReactContextsProvider, {
225
+ intl: intl,
226
+ smartCardContext: smartCardContext
227
+ }, /*#__PURE__*/_react.default.createElement(WrappedBlockCard, {
221
228
  node: this.node,
222
229
  view: this.view,
223
230
  getPos: this.getPos,
@@ -228,7 +235,7 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
228
235
  CompetitorPrompt: CompetitorPrompt,
229
236
  isPageSSRed: isPageSSRed,
230
237
  provider: provider
231
- });
238
+ }));
232
239
  }
233
240
 
234
241
  /**
@@ -265,7 +272,9 @@ var blockCardNodeView = exports.blockCardNodeView = function blockCardNodeView(_
265
272
  inlineCardViewProducer = _ref3.inlineCardViewProducer,
266
273
  CompetitorPrompt = _ref3.CompetitorPrompt,
267
274
  isPageSSRed = _ref3.isPageSSRed,
268
- provider = _ref3.provider;
275
+ provider = _ref3.provider,
276
+ intl = _ref3.intl,
277
+ smartCardContext = _ref3.smartCardContext;
269
278
  return function (node, view, getPos, decorations) {
270
279
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
271
280
  eventDispatcher = pmPluginFactoryParams.eventDispatcher;
@@ -275,7 +284,9 @@ var blockCardNodeView = exports.blockCardNodeView = function blockCardNodeView(_
275
284
  onClickCallback: onClickCallback,
276
285
  CompetitorPrompt: CompetitorPrompt,
277
286
  isPageSSRed: isPageSSRed,
278
- provider: provider
287
+ provider: provider,
288
+ intl: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
289
+ smartCardContext: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
279
290
  };
280
291
  var isDatasource = (0, _utils2.isDatasourceNode)(node);
281
292
  if (isDatasource) {
@@ -29,10 +29,12 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
29
29
  var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
30
30
  var _smartCard = require("@atlaskit/smart-card");
31
31
  var _ssr = require("@atlaskit/smart-card/ssr");
32
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
32
33
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
33
34
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
34
35
  var _actions = require("../pm-plugins/actions");
35
36
  var _ResizableEmbedCard = _interopRequireDefault(require("../ui/ResizableEmbedCard"));
37
+ var _SmartCardSSRReactContextsProvider = require("../ui/SmartCardSSRReactContextsProvider");
36
38
  var _blockCard = require("./blockCard");
37
39
  var _genericCard = require("./genericCard");
38
40
  function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
@@ -531,8 +533,13 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
531
533
  onClickCallback = _this$reactComponentP3.onClickCallback,
532
534
  CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
533
535
  isPageSSRed = _this$reactComponentP3.isPageSSRed,
534
- provider = _this$reactComponentP3.provider;
535
- return /*#__PURE__*/_react.default.createElement(WrappedEmbedCard, {
536
+ provider = _this$reactComponentP3.provider,
537
+ intl = _this$reactComponentP3.intl,
538
+ smartCardContext = _this$reactComponentP3.smartCardContext;
539
+ return /*#__PURE__*/_react.default.createElement(_SmartCardSSRReactContextsProvider.SmartCardSSRReactContextsProvider, {
540
+ intl: intl,
541
+ smartCardContext: smartCardContext
542
+ }, /*#__PURE__*/_react.default.createElement(WrappedEmbedCard, {
536
543
  node: this.node,
537
544
  view: this.view,
538
545
  eventDispatcher: eventDispatcher,
@@ -546,7 +553,7 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
546
553
  CompetitorPrompt: CompetitorPrompt,
547
554
  isPageSSRed: isPageSSRed,
548
555
  provider: provider
549
- });
556
+ }));
550
557
  }
551
558
 
552
559
  /**
@@ -583,7 +590,9 @@ var embedCardNodeView = exports.embedCardNodeView = function embedCardNodeView(_
583
590
  onClickCallback = _ref4.onClickCallback,
584
591
  CompetitorPrompt = _ref4.CompetitorPrompt,
585
592
  isPageSSRed = _ref4.isPageSSRed,
586
- provider = _ref4.provider;
593
+ provider = _ref4.provider,
594
+ intl = _ref4.intl,
595
+ smartCardContext = _ref4.smartCardContext;
587
596
  return function (node, view, getPos) {
588
597
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
589
598
  eventDispatcher = pmPluginFactoryParams.eventDispatcher,
@@ -598,7 +607,9 @@ var embedCardNodeView = exports.embedCardNodeView = function embedCardNodeView(_
598
607
  onClickCallback: onClickCallback,
599
608
  CompetitorPrompt: CompetitorPrompt,
600
609
  isPageSSRed: isPageSSRed,
601
- provider: provider
610
+ provider: provider,
611
+ intl: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
612
+ smartCardContext: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
602
613
  };
603
614
  return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps).init();
604
615
  };
@@ -19,7 +19,6 @@ var _analyticsNext = require("@atlaskit/analytics-next");
19
19
  var _hooks = require("@atlaskit/editor-common/hooks");
20
20
  var _utils = require("@atlaskit/editor-common/utils");
21
21
  var _link = _interopRequireDefault(require("@atlaskit/link"));
22
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
23
22
  var _doc = require("../pm-plugins/doc");
24
23
  var _state = require("../pm-plugins/util/state");
25
24
  var _utils2 = require("../pm-plugins/utils");
@@ -87,8 +86,7 @@ function Card(SmartCardComponent, UnsupportedComponent) {
87
86
  _this2 = this;
88
87
  var _this$props = this.props,
89
88
  pluginInjectionApi = _this$props.pluginInjectionApi,
90
- onClickCallback = _this$props.onClickCallback,
91
- smartCardContext = _this$props.smartCardContext;
89
+ onClickCallback = _this$props.onClickCallback;
92
90
  var _titleUrlPairFromNode = (0, _utils2.titleUrlPairFromNode)(this.props.node),
93
91
  url = _titleUrlPairFromNode.url;
94
92
  if (url && !(0, _adfSchema.isSafeUrl)(url)) {
@@ -126,9 +124,7 @@ function Card(SmartCardComponent, UnsupportedComponent) {
126
124
  url: url
127
125
  }, function (_ref2) {
128
126
  var onClick = _ref2.onClick;
129
- return /*#__PURE__*/_react.default.createElement(_WithCardContext.WithCardContext, {
130
- value: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
131
- }, function (cardContext) {
127
+ return /*#__PURE__*/_react.default.createElement(_WithCardContext.WithCardContext, null, function (cardContext) {
132
128
  return /*#__PURE__*/_react.default.createElement(SmartCardComponent, (0, _extends2.default)({
133
129
  key: url,
134
130
  cardContext: cardContext
@@ -24,6 +24,7 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
24
24
  var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
25
25
  var _actions = require("../pm-plugins/actions");
26
26
  var _utils = require("../pm-plugins/utils");
27
+ var _SmartCardSSRReactContextsProvider = require("../ui/SmartCardSSRReactContextsProvider");
27
28
  var _toolbar = require("../ui/toolbar");
28
29
  var _genericCard = require("./genericCard");
29
30
  var _inlineCardWithAwareness = require("./inlineCardWithAwareness");
@@ -203,6 +204,7 @@ function InlineCardNodeView(props) {
203
204
  isPageSSRed = props.isPageSSRed,
204
205
  provider = props.provider,
205
206
  CompetitorPrompt = props.CompetitorPrompt,
207
+ intl = props.intl,
206
208
  smartCardContext = props.smartCardContext;
207
209
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, (0, _expVal.expVal)('cc_dnd_smart_link_changeboard_platform_css', 'isEnabled', false) && (0, _platformFeatureFlags.fg)('cc_drag_and_drop_smart_link_from_content_to_tree') ? ['editorViewMode', 'card'] : ['editorViewMode'], (0, _expVal.expVal)('cc_dnd_smart_link_changeboard_platform_css', 'isEnabled', false) && (0, _platformFeatureFlags.fg)('cc_drag_and_drop_smart_link_from_content_to_tree') ? selectorWithCard : selectorWithoutCard),
208
210
  mode = _useSharedPluginState.mode,
@@ -239,17 +241,19 @@ function InlineCardNodeView(props) {
239
241
  onClickCallback: onClickCallback,
240
242
  isPageSSRed: isPageSSRed,
241
243
  provider: provider,
242
- appearance: "inline",
243
- smartCardContext: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
244
+ appearance: "inline"
244
245
  // Ignored via go/ees005
245
246
  // eslint-disable-next-line react/jsx-props-no-spreading
246
247
  }, enableInlineUpgradeFeatures && (0, _utils.getAwarenessProps)(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), CompetitorPromptComponent);
247
- return /*#__PURE__*/_react.default.createElement(_editorSmartLinkDraggable.SmartLinkDraggable, {
248
+ return /*#__PURE__*/_react.default.createElement(_SmartCardSSRReactContextsProvider.SmartCardSSRReactContextsProvider, {
249
+ intl: intl,
250
+ smartCardContext: smartCardContext
251
+ }, /*#__PURE__*/_react.default.createElement(_editorSmartLinkDraggable.SmartLinkDraggable, {
248
252
  url: url,
249
253
  appearance: _editorSmartLinkDraggable.SMART_LINK_APPEARANCE.INLINE,
250
254
  source: _editorSmartLinkDraggable.SMART_LINK_DRAG_TYPES.EDITOR,
251
255
  isChangeboardTarget: isChangeboardTarget
252
- }, inlineCardContent);
256
+ }, inlineCardContent));
253
257
  }
254
258
  var inlineCardNodeView = exports.inlineCardNodeView = function inlineCardNodeView(_ref5) {
255
259
  var inlineCardViewProducer = _ref5.inlineCardViewProducer;
@@ -8,6 +8,7 @@ exports.createPlugin = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
10
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
11
+ var _coreUtils = require("@atlaskit/editor-common/core-utils");
11
12
  var _reactNodeView = require("@atlaskit/editor-common/react-node-view");
12
13
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
14
  var _styles = require("@atlaskit/editor-common/styles");
@@ -60,9 +61,10 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
60
61
  onClickCallback = options.onClickCallback,
61
62
  isPageSSRed = options.isPageSSRed,
62
63
  provider = options.provider,
63
- smartCardContext = options.smartCardContext,
64
64
  CompetitorPrompt = options.CompetitorPrompt,
65
+ smartCardContext = options.smartCardContext,
65
66
  embedCardTransformers = options.embedCardTransformers;
67
+ var intl = pmPluginFactoryParams.getIntl();
66
68
  var enableInlineUpgradeFeatures = !!showUpgradeDiscoverability;
67
69
  var inlineCardViewProducer = (0, _reactNodeView.getInlineNodeViewProducer)({
68
70
  pmPluginFactoryParams: pmPluginFactoryParams,
@@ -77,8 +79,9 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
77
79
  onClickCallback: onClickCallback,
78
80
  isPageSSRed: isPageSSRed,
79
81
  provider: provider,
80
- smartCardContext: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined,
81
- CompetitorPrompt: CompetitorPrompt
82
+ CompetitorPrompt: (0, _coreUtils.isSSR)() && (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? undefined : CompetitorPrompt,
83
+ intl: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
84
+ smartCardContext: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
82
85
  }
83
86
  });
84
87
  return new _safePlugin.SafePlugin({
@@ -277,7 +280,9 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
277
280
  inlineCardViewProducer: inlineCardViewProducer,
278
281
  isPageSSRed: isPageSSRed,
279
282
  provider: provider,
280
- CompetitorPrompt: options.CompetitorPrompt
283
+ CompetitorPrompt: (0, _coreUtils.isSSR)() && (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? undefined : options.CompetitorPrompt,
284
+ intl: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
285
+ smartCardContext: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
281
286
  }),
282
287
  embedCard: (0, _lazyEmbedCard.lazyEmbedCardView)({
283
288
  allowResizing: allowResizing,
@@ -288,7 +293,9 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
288
293
  onClickCallback: options.onClickCallback,
289
294
  isPageSSRed: isPageSSRed,
290
295
  provider: provider,
291
- CompetitorPrompt: options.CompetitorPrompt
296
+ CompetitorPrompt: (0, _coreUtils.isSSR)() && (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? undefined : options.CompetitorPrompt,
297
+ intl: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
298
+ smartCardContext: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
292
299
  })
293
300
  }
294
301
  }, enableInlineUpgradeFeatures && {
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.SmartCardSSRReactContextsProvider = SmartCardSSRReactContextsProvider;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactIntl = require("react-intl");
10
+ var _coreUtils = require("@atlaskit/editor-common/core-utils");
11
+ var _linkProvider = require("@atlaskit/link-provider");
12
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
+ function SmartCardSSRReactContextsProvider(_ref) {
14
+ var smartCardContext = _ref.smartCardContext,
15
+ children = _ref.children,
16
+ intl = _ref.intl;
17
+ if (!(0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) || !(0, _coreUtils.isSSR)()) {
18
+ return children;
19
+ }
20
+ if (!intl || !smartCardContext) {
21
+ return children;
22
+ }
23
+ return /*#__PURE__*/_react.default.createElement(_reactIntl.RawIntlProvider, {
24
+ value: intl
25
+ }, /*#__PURE__*/_react.default.createElement(_linkProvider.SmartCardContext.Provider, {
26
+ value: smartCardContext
27
+ }, children));
28
+ }
@@ -1,29 +1,14 @@
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.WithCardContext = void 0;
9
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
- var _react = _interopRequireWildcard(require("react"));
8
+ var _react = _interopRequireDefault(require("react"));
11
9
  var _linkProvider = require("@atlaskit/link-provider");
12
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
14
- 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; }
15
- 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; }
16
10
  var WithCardContext = exports.WithCardContext = function WithCardContext(_ref) {
17
- var children = _ref.children,
18
- value = _ref.value;
11
+ var children = _ref.children;
19
12
  var cardContext = (0, _linkProvider.useSmartCardContext)();
20
- var cardContextWithValue = (0, _react.useMemo)(function () {
21
- if (!(0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true)) {
22
- return cardContext;
23
- }
24
- return value ? _objectSpread(_objectSpread({}, cardContext), {}, {
25
- value: value
26
- }) : cardContext;
27
- }, [value, cardContext]);
28
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children(cardContextWithValue));
13
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children(cardContext));
29
14
  };
@@ -11,9 +11,11 @@ import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPEARANCE } from
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
12
  import { Card as SmartCard } from '@atlaskit/smart-card';
13
13
  import { CardSSR } from '@atlaskit/smart-card/ssr';
14
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
15
  import { Datasource } from '../nodeviews/datasource';
15
16
  import { registerCard, removeCard } from '../pm-plugins/actions';
16
17
  import { isDatasourceNode } from '../pm-plugins/utils';
18
+ import { SmartCardSSRReactContextsProvider } from '../ui/SmartCardSSRReactContextsProvider';
17
19
  import { Card } from './genericCard';
18
20
 
19
21
  // eslint-disable-next-line @repo/internal/react/no-class-components
@@ -180,9 +182,14 @@ export class BlockCard extends ReactNodeView {
180
182
  onClickCallback,
181
183
  CompetitorPrompt,
182
184
  isPageSSRed,
183
- provider
185
+ provider,
186
+ intl,
187
+ smartCardContext
184
188
  } = this.reactComponentProps;
185
- return /*#__PURE__*/React.createElement(WrappedBlockCard, {
189
+ return /*#__PURE__*/React.createElement(SmartCardSSRReactContextsProvider, {
190
+ intl: intl,
191
+ smartCardContext: smartCardContext
192
+ }, /*#__PURE__*/React.createElement(WrappedBlockCard, {
186
193
  node: this.node,
187
194
  view: this.view,
188
195
  getPos: this.getPos,
@@ -193,7 +200,7 @@ export class BlockCard extends ReactNodeView {
193
200
  CompetitorPrompt: CompetitorPrompt,
194
201
  isPageSSRed: isPageSSRed,
195
202
  provider: provider
196
- });
203
+ }));
197
204
  }
198
205
 
199
206
  /**
@@ -225,7 +232,9 @@ export const blockCardNodeView = ({
225
232
  inlineCardViewProducer,
226
233
  CompetitorPrompt,
227
234
  isPageSSRed,
228
- provider
235
+ provider,
236
+ intl,
237
+ smartCardContext
229
238
  }) => (node, view, getPos, decorations) => {
230
239
  const {
231
240
  portalProviderAPI,
@@ -237,7 +246,9 @@ export const blockCardNodeView = ({
237
246
  onClickCallback: onClickCallback,
238
247
  CompetitorPrompt,
239
248
  isPageSSRed,
240
- provider
249
+ provider,
250
+ intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
251
+ smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
241
252
  };
242
253
  const isDatasource = isDatasourceNode(node);
243
254
  if (isDatasource) {
@@ -17,10 +17,12 @@ import { fg } from '@atlaskit/platform-feature-flags';
17
17
  import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
18
18
  import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
19
19
  import { CardSSR } from '@atlaskit/smart-card/ssr';
20
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
20
21
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
21
22
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
22
23
  import { registerCard, removeCard } from '../pm-plugins/actions';
23
24
  import ResizableEmbedCard from '../ui/ResizableEmbedCard';
25
+ import { SmartCardSSRReactContextsProvider } from '../ui/SmartCardSSRReactContextsProvider';
24
26
  import { BlockCardComponent } from './blockCard';
25
27
  import { Card } from './genericCard';
26
28
 
@@ -505,9 +507,14 @@ export class EmbedCard extends ReactNodeView {
505
507
  onClickCallback,
506
508
  CompetitorPrompt,
507
509
  isPageSSRed,
508
- provider
510
+ provider,
511
+ intl,
512
+ smartCardContext
509
513
  } = this.reactComponentProps;
510
- return /*#__PURE__*/React.createElement(WrappedEmbedCard, {
514
+ return /*#__PURE__*/React.createElement(SmartCardSSRReactContextsProvider, {
515
+ intl: intl,
516
+ smartCardContext: smartCardContext
517
+ }, /*#__PURE__*/React.createElement(WrappedEmbedCard, {
511
518
  node: this.node,
512
519
  view: this.view,
513
520
  eventDispatcher: eventDispatcher,
@@ -521,7 +528,7 @@ export class EmbedCard extends ReactNodeView {
521
528
  CompetitorPrompt: CompetitorPrompt,
522
529
  isPageSSRed: isPageSSRed,
523
530
  provider: provider
524
- });
531
+ }));
525
532
  }
526
533
 
527
534
  /**
@@ -553,7 +560,9 @@ export const embedCardNodeView = ({
553
560
  onClickCallback,
554
561
  CompetitorPrompt,
555
562
  isPageSSRed,
556
- provider
563
+ provider,
564
+ intl,
565
+ smartCardContext
557
566
  }) => (node, view, getPos) => {
558
567
  const {
559
568
  portalProviderAPI,
@@ -570,7 +579,9 @@ export const embedCardNodeView = ({
570
579
  onClickCallback: onClickCallback,
571
580
  CompetitorPrompt,
572
581
  isPageSSRed,
573
- provider
582
+ provider,
583
+ intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
584
+ smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
574
585
  };
575
586
  return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps).init();
576
587
  };
@@ -6,7 +6,6 @@ import { AnalyticsContext } from '@atlaskit/analytics-next';
6
6
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
7
  import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils';
8
8
  import Link from '@atlaskit/link';
9
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
9
  import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
11
10
  import { getPluginState } from '../pm-plugins/util/state';
12
11
  import { titleUrlPairFromNode } from '../pm-plugins/utils';
@@ -63,8 +62,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
63
62
  var _getPluginState;
64
63
  const {
65
64
  pluginInjectionApi,
66
- onClickCallback,
67
- smartCardContext
65
+ onClickCallback
68
66
  } = this.props;
69
67
  const {
70
68
  url
@@ -104,9 +102,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
104
102
  url: url
105
103
  }, ({
106
104
  onClick
107
- }) => /*#__PURE__*/React.createElement(WithCardContext, {
108
- value: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
109
- }, cardContext => /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
105
+ }) => /*#__PURE__*/React.createElement(WithCardContext, null, cardContext => /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
110
106
  key: url,
111
107
  cardContext: cardContext
112
108
  // Ignored via go/ees005
@@ -15,6 +15,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
15
15
  import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
16
16
  import { registerCard, removeCard } from '../pm-plugins/actions';
17
17
  import { getAwarenessProps } from '../pm-plugins/utils';
18
+ import { SmartCardSSRReactContextsProvider } from '../ui/SmartCardSSRReactContextsProvider';
18
19
  import { visitCardLinkAnalytics } from '../ui/toolbar';
19
20
  import { Card } from './genericCard';
20
21
  import { InlineCardWithAwareness } from './inlineCardWithAwareness';
@@ -200,6 +201,7 @@ export function InlineCardNodeView(props) {
200
201
  isPageSSRed,
201
202
  provider,
202
203
  CompetitorPrompt,
204
+ intl,
203
205
  smartCardContext
204
206
  } = props;
205
207
  const {
@@ -238,17 +240,19 @@ export function InlineCardNodeView(props) {
238
240
  onClickCallback: onClickCallback,
239
241
  isPageSSRed: isPageSSRed,
240
242
  provider: provider,
241
- appearance: "inline",
242
- smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
243
+ appearance: "inline"
243
244
  // Ignored via go/ees005
244
245
  // eslint-disable-next-line react/jsx-props-no-spreading
245
246
  }, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), CompetitorPromptComponent);
246
- return /*#__PURE__*/React.createElement(SmartLinkDraggable, {
247
+ return /*#__PURE__*/React.createElement(SmartCardSSRReactContextsProvider, {
248
+ intl: intl,
249
+ smartCardContext: smartCardContext
250
+ }, /*#__PURE__*/React.createElement(SmartLinkDraggable, {
247
251
  url: url,
248
252
  appearance: SMART_LINK_APPEARANCE.INLINE,
249
253
  source: SMART_LINK_DRAG_TYPES.EDITOR,
250
254
  isChangeboardTarget: isChangeboardTarget
251
- }, inlineCardContent);
255
+ }, inlineCardContent));
252
256
  }
253
257
  export const inlineCardNodeView = ({
254
258
  inlineCardViewProducer
@@ -1,4 +1,5 @@
1
1
  import rafSchedule from 'raf-schd';
2
+ import { isSSR } from '@atlaskit/editor-common/core-utils';
2
3
  import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
3
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
5
  import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/styles';
@@ -49,10 +50,11 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
49
50
  onClickCallback,
50
51
  isPageSSRed,
51
52
  provider,
52
- smartCardContext,
53
53
  CompetitorPrompt,
54
+ smartCardContext,
54
55
  embedCardTransformers
55
56
  } = options;
57
+ const intl = pmPluginFactoryParams.getIntl();
56
58
  const enableInlineUpgradeFeatures = !!showUpgradeDiscoverability;
57
59
  const inlineCardViewProducer = getInlineNodeViewProducer({
58
60
  pmPluginFactoryParams,
@@ -67,8 +69,9 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
67
69
  onClickCallback,
68
70
  isPageSSRed,
69
71
  provider,
70
- smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined,
71
- CompetitorPrompt
72
+ CompetitorPrompt: isSSR() && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? undefined : CompetitorPrompt,
73
+ intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
74
+ smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
72
75
  }
73
76
  });
74
77
  return new SafePlugin({
@@ -272,7 +275,9 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
272
275
  inlineCardViewProducer,
273
276
  isPageSSRed,
274
277
  provider,
275
- CompetitorPrompt: options.CompetitorPrompt
278
+ CompetitorPrompt: isSSR() && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? undefined : options.CompetitorPrompt,
279
+ intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
280
+ smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
276
281
  }),
277
282
  embedCard: lazyEmbedCardView({
278
283
  allowResizing,
@@ -283,7 +288,9 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
283
288
  onClickCallback: options.onClickCallback,
284
289
  isPageSSRed,
285
290
  provider,
286
- CompetitorPrompt: options.CompetitorPrompt
291
+ CompetitorPrompt: isSSR() && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? undefined : options.CompetitorPrompt,
292
+ intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
293
+ smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
287
294
  })
288
295
  },
289
296
  ...(enableInlineUpgradeFeatures && {
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { RawIntlProvider } from 'react-intl';
3
+ import { isSSR } from '@atlaskit/editor-common/core-utils';
4
+ import { SmartCardContext } from '@atlaskit/link-provider';
5
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
+ export function SmartCardSSRReactContextsProvider({
7
+ smartCardContext,
8
+ children,
9
+ intl
10
+ }) {
11
+ if (!expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) || !isSSR()) {
12
+ return children;
13
+ }
14
+ if (!intl || !smartCardContext) {
15
+ return children;
16
+ }
17
+ return /*#__PURE__*/React.createElement(RawIntlProvider, {
18
+ value: intl
19
+ }, /*#__PURE__*/React.createElement(SmartCardContext.Provider, {
20
+ value: smartCardContext
21
+ }, children));
22
+ }
@@ -1,19 +1,8 @@
1
- import React, { useMemo } from 'react';
1
+ import React from 'react';
2
2
  import { useSmartCardContext } from '@atlaskit/link-provider';
3
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
3
  export const WithCardContext = ({
5
- children,
6
- value
4
+ children
7
5
  }) => {
8
6
  const cardContext = useSmartCardContext();
9
- const cardContextWithValue = useMemo(() => {
10
- if (!expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true)) {
11
- return cardContext;
12
- }
13
- return value ? {
14
- ...cardContext,
15
- value
16
- } : cardContext;
17
- }, [value, cardContext]);
18
- return /*#__PURE__*/React.createElement(React.Fragment, null, children(cardContextWithValue));
7
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children(cardContext));
19
8
  };
@@ -20,9 +20,11 @@ import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPEARANCE } from
20
20
  import { fg } from '@atlaskit/platform-feature-flags';
21
21
  import { Card as SmartCard } from '@atlaskit/smart-card';
22
22
  import { CardSSR } from '@atlaskit/smart-card/ssr';
23
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
23
24
  import { Datasource } from '../nodeviews/datasource';
24
25
  import { registerCard, removeCard as _removeCard } from '../pm-plugins/actions';
25
26
  import { isDatasourceNode } from '../pm-plugins/utils';
27
+ import { SmartCardSSRReactContextsProvider } from '../ui/SmartCardSSRReactContextsProvider';
26
28
  import { Card } from './genericCard';
27
29
 
28
30
  // eslint-disable-next-line @repo/internal/react/no-class-components
@@ -211,8 +213,13 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
211
213
  onClickCallback = _this$reactComponentP3.onClickCallback,
212
214
  CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
213
215
  isPageSSRed = _this$reactComponentP3.isPageSSRed,
214
- provider = _this$reactComponentP3.provider;
215
- return /*#__PURE__*/React.createElement(WrappedBlockCard, {
216
+ provider = _this$reactComponentP3.provider,
217
+ intl = _this$reactComponentP3.intl,
218
+ smartCardContext = _this$reactComponentP3.smartCardContext;
219
+ return /*#__PURE__*/React.createElement(SmartCardSSRReactContextsProvider, {
220
+ intl: intl,
221
+ smartCardContext: smartCardContext
222
+ }, /*#__PURE__*/React.createElement(WrappedBlockCard, {
216
223
  node: this.node,
217
224
  view: this.view,
218
225
  getPos: this.getPos,
@@ -223,7 +230,7 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
223
230
  CompetitorPrompt: CompetitorPrompt,
224
231
  isPageSSRed: isPageSSRed,
225
232
  provider: provider
226
- });
233
+ }));
227
234
  }
228
235
 
229
236
  /**
@@ -260,7 +267,9 @@ export var blockCardNodeView = function blockCardNodeView(_ref3) {
260
267
  inlineCardViewProducer = _ref3.inlineCardViewProducer,
261
268
  CompetitorPrompt = _ref3.CompetitorPrompt,
262
269
  isPageSSRed = _ref3.isPageSSRed,
263
- provider = _ref3.provider;
270
+ provider = _ref3.provider,
271
+ intl = _ref3.intl,
272
+ smartCardContext = _ref3.smartCardContext;
264
273
  return function (node, view, getPos, decorations) {
265
274
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
266
275
  eventDispatcher = pmPluginFactoryParams.eventDispatcher;
@@ -270,7 +279,9 @@ export var blockCardNodeView = function blockCardNodeView(_ref3) {
270
279
  onClickCallback: onClickCallback,
271
280
  CompetitorPrompt: CompetitorPrompt,
272
281
  isPageSSRed: isPageSSRed,
273
- provider: provider
282
+ provider: provider,
283
+ intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
284
+ smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
274
285
  };
275
286
  var isDatasource = isDatasourceNode(node);
276
287
  if (isDatasource) {
@@ -28,10 +28,12 @@ import { fg } from '@atlaskit/platform-feature-flags';
28
28
  import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
29
29
  import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
30
30
  import { CardSSR } from '@atlaskit/smart-card/ssr';
31
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
31
32
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
32
33
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
33
34
  import { registerCard, removeCard as _removeCard } from '../pm-plugins/actions';
34
35
  import ResizableEmbedCard from '../ui/ResizableEmbedCard';
36
+ import { SmartCardSSRReactContextsProvider } from '../ui/SmartCardSSRReactContextsProvider';
35
37
  import { BlockCardComponent } from './blockCard';
36
38
  import { Card } from './genericCard';
37
39
 
@@ -526,8 +528,13 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
526
528
  onClickCallback = _this$reactComponentP3.onClickCallback,
527
529
  CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
528
530
  isPageSSRed = _this$reactComponentP3.isPageSSRed,
529
- provider = _this$reactComponentP3.provider;
530
- return /*#__PURE__*/React.createElement(WrappedEmbedCard, {
531
+ provider = _this$reactComponentP3.provider,
532
+ intl = _this$reactComponentP3.intl,
533
+ smartCardContext = _this$reactComponentP3.smartCardContext;
534
+ return /*#__PURE__*/React.createElement(SmartCardSSRReactContextsProvider, {
535
+ intl: intl,
536
+ smartCardContext: smartCardContext
537
+ }, /*#__PURE__*/React.createElement(WrappedEmbedCard, {
531
538
  node: this.node,
532
539
  view: this.view,
533
540
  eventDispatcher: eventDispatcher,
@@ -541,7 +548,7 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
541
548
  CompetitorPrompt: CompetitorPrompt,
542
549
  isPageSSRed: isPageSSRed,
543
550
  provider: provider
544
- });
551
+ }));
545
552
  }
546
553
 
547
554
  /**
@@ -578,7 +585,9 @@ export var embedCardNodeView = function embedCardNodeView(_ref4) {
578
585
  onClickCallback = _ref4.onClickCallback,
579
586
  CompetitorPrompt = _ref4.CompetitorPrompt,
580
587
  isPageSSRed = _ref4.isPageSSRed,
581
- provider = _ref4.provider;
588
+ provider = _ref4.provider,
589
+ intl = _ref4.intl,
590
+ smartCardContext = _ref4.smartCardContext;
582
591
  return function (node, view, getPos) {
583
592
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
584
593
  eventDispatcher = pmPluginFactoryParams.eventDispatcher,
@@ -593,7 +602,9 @@ export var embedCardNodeView = function embedCardNodeView(_ref4) {
593
602
  onClickCallback: onClickCallback,
594
603
  CompetitorPrompt: CompetitorPrompt,
595
604
  isPageSSRed: isPageSSRed,
596
- provider: provider
605
+ provider: provider,
606
+ intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
607
+ smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
597
608
  };
598
609
  return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps).init();
599
610
  };
@@ -13,7 +13,6 @@ import { AnalyticsContext } from '@atlaskit/analytics-next';
13
13
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
14
14
  import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils';
15
15
  import Link from '@atlaskit/link';
16
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
16
  import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
18
17
  import { getPluginState } from '../pm-plugins/util/state';
19
18
  import { titleUrlPairFromNode } from '../pm-plugins/utils';
@@ -78,8 +77,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
78
77
  _this2 = this;
79
78
  var _this$props = this.props,
80
79
  pluginInjectionApi = _this$props.pluginInjectionApi,
81
- onClickCallback = _this$props.onClickCallback,
82
- smartCardContext = _this$props.smartCardContext;
80
+ onClickCallback = _this$props.onClickCallback;
83
81
  var _titleUrlPairFromNode = titleUrlPairFromNode(this.props.node),
84
82
  url = _titleUrlPairFromNode.url;
85
83
  if (url && !isSafeUrl(url)) {
@@ -117,9 +115,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
117
115
  url: url
118
116
  }, function (_ref2) {
119
117
  var onClick = _ref2.onClick;
120
- return /*#__PURE__*/React.createElement(WithCardContext, {
121
- value: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
122
- }, function (cardContext) {
118
+ return /*#__PURE__*/React.createElement(WithCardContext, null, function (cardContext) {
123
119
  return /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
124
120
  key: url,
125
121
  cardContext: cardContext
@@ -15,6 +15,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
15
15
  import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
16
16
  import { registerCard, removeCard } from '../pm-plugins/actions';
17
17
  import { getAwarenessProps } from '../pm-plugins/utils';
18
+ import { SmartCardSSRReactContextsProvider } from '../ui/SmartCardSSRReactContextsProvider';
18
19
  import { visitCardLinkAnalytics } from '../ui/toolbar';
19
20
  import { Card } from './genericCard';
20
21
  import { InlineCardWithAwareness } from './inlineCardWithAwareness';
@@ -191,6 +192,7 @@ export function InlineCardNodeView(props) {
191
192
  isPageSSRed = props.isPageSSRed,
192
193
  provider = props.provider,
193
194
  CompetitorPrompt = props.CompetitorPrompt,
195
+ intl = props.intl,
194
196
  smartCardContext = props.smartCardContext;
195
197
  var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, expVal('cc_dnd_smart_link_changeboard_platform_css', 'isEnabled', false) && fg('cc_drag_and_drop_smart_link_from_content_to_tree') ? ['editorViewMode', 'card'] : ['editorViewMode'], expVal('cc_dnd_smart_link_changeboard_platform_css', 'isEnabled', false) && fg('cc_drag_and_drop_smart_link_from_content_to_tree') ? selectorWithCard : selectorWithoutCard),
196
198
  mode = _useSharedPluginState.mode,
@@ -227,17 +229,19 @@ export function InlineCardNodeView(props) {
227
229
  onClickCallback: onClickCallback,
228
230
  isPageSSRed: isPageSSRed,
229
231
  provider: provider,
230
- appearance: "inline",
231
- smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
232
+ appearance: "inline"
232
233
  // Ignored via go/ees005
233
234
  // eslint-disable-next-line react/jsx-props-no-spreading
234
235
  }, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), CompetitorPromptComponent);
235
- return /*#__PURE__*/React.createElement(SmartLinkDraggable, {
236
+ return /*#__PURE__*/React.createElement(SmartCardSSRReactContextsProvider, {
237
+ intl: intl,
238
+ smartCardContext: smartCardContext
239
+ }, /*#__PURE__*/React.createElement(SmartLinkDraggable, {
236
240
  url: url,
237
241
  appearance: SMART_LINK_APPEARANCE.INLINE,
238
242
  source: SMART_LINK_DRAG_TYPES.EDITOR,
239
243
  isChangeboardTarget: isChangeboardTarget
240
- }, inlineCardContent);
244
+ }, inlineCardContent));
241
245
  }
242
246
  export var inlineCardNodeView = function inlineCardNodeView(_ref5) {
243
247
  var inlineCardViewProducer = _ref5.inlineCardViewProducer;
@@ -3,6 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import rafSchedule from 'raf-schd';
6
+ import { isSSR } from '@atlaskit/editor-common/core-utils';
6
7
  import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
7
8
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
9
  import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/styles';
@@ -53,9 +54,10 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
53
54
  onClickCallback = options.onClickCallback,
54
55
  isPageSSRed = options.isPageSSRed,
55
56
  provider = options.provider,
56
- smartCardContext = options.smartCardContext,
57
57
  CompetitorPrompt = options.CompetitorPrompt,
58
+ smartCardContext = options.smartCardContext,
58
59
  embedCardTransformers = options.embedCardTransformers;
60
+ var intl = pmPluginFactoryParams.getIntl();
59
61
  var enableInlineUpgradeFeatures = !!showUpgradeDiscoverability;
60
62
  var inlineCardViewProducer = getInlineNodeViewProducer({
61
63
  pmPluginFactoryParams: pmPluginFactoryParams,
@@ -70,8 +72,9 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
70
72
  onClickCallback: onClickCallback,
71
73
  isPageSSRed: isPageSSRed,
72
74
  provider: provider,
73
- smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined,
74
- CompetitorPrompt: CompetitorPrompt
75
+ CompetitorPrompt: isSSR() && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? undefined : CompetitorPrompt,
76
+ intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
77
+ smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
75
78
  }
76
79
  });
77
80
  return new SafePlugin({
@@ -270,7 +273,9 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
270
273
  inlineCardViewProducer: inlineCardViewProducer,
271
274
  isPageSSRed: isPageSSRed,
272
275
  provider: provider,
273
- CompetitorPrompt: options.CompetitorPrompt
276
+ CompetitorPrompt: isSSR() && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? undefined : options.CompetitorPrompt,
277
+ intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
278
+ smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
274
279
  }),
275
280
  embedCard: lazyEmbedCardView({
276
281
  allowResizing: allowResizing,
@@ -281,7 +286,9 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
281
286
  onClickCallback: options.onClickCallback,
282
287
  isPageSSRed: isPageSSRed,
283
288
  provider: provider,
284
- CompetitorPrompt: options.CompetitorPrompt
289
+ CompetitorPrompt: isSSR() && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? undefined : options.CompetitorPrompt,
290
+ intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
291
+ smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
285
292
  })
286
293
  }
287
294
  }, enableInlineUpgradeFeatures && {
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { RawIntlProvider } from 'react-intl';
3
+ import { isSSR } from '@atlaskit/editor-common/core-utils';
4
+ import { SmartCardContext } from '@atlaskit/link-provider';
5
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
6
+ export function SmartCardSSRReactContextsProvider(_ref) {
7
+ var smartCardContext = _ref.smartCardContext,
8
+ children = _ref.children,
9
+ intl = _ref.intl;
10
+ if (!expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) || !isSSR()) {
11
+ return children;
12
+ }
13
+ if (!intl || !smartCardContext) {
14
+ return children;
15
+ }
16
+ return /*#__PURE__*/React.createElement(RawIntlProvider, {
17
+ value: intl
18
+ }, /*#__PURE__*/React.createElement(SmartCardContext.Provider, {
19
+ value: smartCardContext
20
+ }, children));
21
+ }
@@ -1,20 +1,7 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
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; }
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
- import React, { useMemo } from 'react';
1
+ import React from 'react';
5
2
  import { useSmartCardContext } from '@atlaskit/link-provider';
6
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
3
  export var WithCardContext = function WithCardContext(_ref) {
8
- var children = _ref.children,
9
- value = _ref.value;
4
+ var children = _ref.children;
10
5
  var cardContext = useSmartCardContext();
11
- var cardContextWithValue = useMemo(function () {
12
- if (!expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true)) {
13
- return cardContext;
14
- }
15
- return value ? _objectSpread(_objectSpread({}, cardContext), {}, {
16
- value: value
17
- }) : cardContext;
18
- }, [value, cardContext]);
19
- return /*#__PURE__*/React.createElement(React.Fragment, null, children(cardContextWithValue));
6
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children(cardContext));
20
7
  };
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
+ import type { IntlShape } from 'react-intl';
2
3
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
3
4
  import type { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
4
5
  import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
5
6
  import type { Node } from '@atlaskit/editor-prosemirror/model';
6
7
  import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
8
+ import type { CardContext } from '@atlaskit/link-provider';
7
9
  import { Datasource } from '../nodeviews/datasource';
8
10
  import type { SmartCardProps } from './genericCard';
9
11
  export declare class BlockCardComponent extends React.PureComponent<SmartCardProps & {
@@ -26,7 +28,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
26
28
  }) => void;
27
29
  render(): React.JSX.Element;
28
30
  }
29
- export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt'>;
31
+ export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt' | 'intl' | 'smartCardContext'>;
30
32
  export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
31
33
  private id;
32
34
  unsubscribe: (() => void) | undefined;
@@ -51,10 +53,12 @@ export interface BlockCardNodeViewProperties {
51
53
  sourceUrl: string;
52
54
  }>;
53
55
  inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
56
+ intl?: IntlShape;
54
57
  isPageSSRed: BlockCardNodeViewProps['isPageSSRed'];
55
58
  onClickCallback: BlockCardNodeViewProps['onClickCallback'];
56
59
  pluginInjectionApi: BlockCardNodeViewProps['pluginInjectionApi'];
57
60
  pmPluginFactoryParams: PMPluginFactoryParams;
58
61
  provider: BlockCardNodeViewProps['provider'];
62
+ smartCardContext?: CardContext;
59
63
  }
60
- export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, provider, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => BlockCard | Datasource | NodeView;
64
+ export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, provider, intl, smartCardContext, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => BlockCard | Datasource | NodeView;
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
2
  import type { ComponentProps } from 'react';
3
+ import type { IntlShape } from 'react-intl';
3
4
  import type { RichMediaLayout } from '@atlaskit/adf-schema';
4
5
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
5
6
  import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
6
7
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
7
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
9
+ import type { CardContext } from '@atlaskit/link-provider';
8
10
  import type { cardPlugin } from '../index';
9
11
  import type { SmartCardProps } from './genericCard';
10
12
  /**
@@ -68,7 +70,7 @@ export declare class EmbedCardComponent extends React.PureComponent<SmartCardPro
68
70
  render(): React.JSX.Element;
69
71
  }
70
72
  export declare const EmbedOrBlockCardComponent: (props: ComponentProps<typeof EmbedCardComponent>) => React.JSX.Element;
71
- export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt'>;
73
+ export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt' | 'intl' | 'smartCardContext'>;
72
74
  export declare class EmbedCard extends ReactNodeView<EmbedCardNodeViewProps> {
73
75
  private id;
74
76
  unsubscribe: (() => void) | undefined;
@@ -89,10 +91,12 @@ export interface EmbedCardNodeViewProperties {
89
91
  allowResizing: EmbedCardNodeViewProps['allowResizing'];
90
92
  CompetitorPrompt?: EmbedCardNodeViewProps['CompetitorPrompt'];
91
93
  fullWidthMode: EmbedCardNodeViewProps['fullWidthMode'];
94
+ intl?: IntlShape;
92
95
  isPageSSRed: EmbedCardNodeViewProps['isPageSSRed'];
93
96
  onClickCallback: EmbedCardNodeViewProps['onClickCallback'];
94
97
  pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
95
98
  pmPluginFactoryParams: PMPluginFactoryParams;
96
99
  provider: EmbedCardNodeViewProps['provider'];
100
+ smartCardContext?: CardContext;
97
101
  }
98
- export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, provider, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
102
+ export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, provider, intl, smartCardContext, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
@@ -1,5 +1,6 @@
1
1
  import type { EventHandler, KeyboardEvent, MouseEvent } from 'react';
2
2
  import React from 'react';
3
+ import type { IntlShape } from 'react-intl';
3
4
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
4
5
  import type { OnClickCallback } from '@atlaskit/editor-common/card';
5
6
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
@@ -33,7 +34,6 @@ export interface CardProps extends CardNodeViewProps {
33
34
  onClickCallback?: OnClickCallback;
34
35
  pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
35
36
  showHoverPreview?: BaseCardProps['showHoverPreview'];
36
- smartCardContext?: CardContext;
37
37
  useAlternativePreloader?: boolean;
38
38
  view: EditorView;
39
39
  }
@@ -47,12 +47,14 @@ export interface SmartCardProps extends CardProps {
47
47
  }>;
48
48
  disablePreviewPanel?: BaseCardProps['disablePreviewPanel'];
49
49
  enableInlineUpgradeFeatures?: boolean;
50
+ intl?: IntlShape;
50
51
  isHovered?: boolean;
51
52
  isPageSSRed?: boolean;
52
53
  onClick?: EventHandler<MouseEvent | KeyboardEvent> | undefined;
53
54
  onResolve?: (tr: Transaction, title?: string) => void;
54
55
  pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
55
56
  provider?: Providers['cardProvider'];
57
+ smartCardContext?: CardContext;
56
58
  }
57
59
  /**
58
60
  *
@@ -5,7 +5,7 @@ import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemir
5
5
  import type { SmartCardProps } from './genericCard';
6
6
  import type { InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
7
7
  export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, disablePreviewPanel, }: SmartCardProps) => React.JSX.Element | null>;
8
- export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt' | 'provider' | 'smartCardContext'>;
8
+ export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt' | 'provider' | 'intl' | 'smartCardContext'>;
9
9
  /**
10
10
  * Inline card node view component that renders a Smart Link inline card within the editor.
11
11
  *
@@ -0,0 +1,10 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type IntlShape } from 'react-intl';
3
+ import { type CardContext } from '@atlaskit/link-provider';
4
+ interface Props {
5
+ children: ReactNode;
6
+ intl: IntlShape | undefined;
7
+ smartCardContext: CardContext | undefined;
8
+ }
9
+ export declare function SmartCardSSRReactContextsProvider({ smartCardContext, children, intl, }: Props): ReactNode;
10
+ export {};
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
2
  import { useSmartCardContext } from '@atlaskit/link-provider';
3
- import type { CardContext } from '@atlaskit/link-provider';
4
- export declare const WithCardContext: ({ children, value, }: {
3
+ export declare const WithCardContext: ({ children, }: {
5
4
  children: (cardContext: ReturnType<typeof useSmartCardContext>) => React.ReactNode;
6
- value?: CardContext;
7
5
  }) => React.JSX.Element;
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
+ import type { IntlShape } from 'react-intl';
2
3
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
3
4
  import type { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
4
5
  import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
5
6
  import type { Node } from '@atlaskit/editor-prosemirror/model';
6
7
  import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
8
+ import type { CardContext } from '@atlaskit/link-provider';
7
9
  import { Datasource } from '../nodeviews/datasource';
8
10
  import type { SmartCardProps } from './genericCard';
9
11
  export declare class BlockCardComponent extends React.PureComponent<SmartCardProps & {
@@ -26,7 +28,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
26
28
  }) => void;
27
29
  render(): React.JSX.Element;
28
30
  }
29
- export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt'>;
31
+ export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt' | 'intl' | 'smartCardContext'>;
30
32
  export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
31
33
  private id;
32
34
  unsubscribe: (() => void) | undefined;
@@ -51,10 +53,12 @@ export interface BlockCardNodeViewProperties {
51
53
  sourceUrl: string;
52
54
  }>;
53
55
  inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
56
+ intl?: IntlShape;
54
57
  isPageSSRed: BlockCardNodeViewProps['isPageSSRed'];
55
58
  onClickCallback: BlockCardNodeViewProps['onClickCallback'];
56
59
  pluginInjectionApi: BlockCardNodeViewProps['pluginInjectionApi'];
57
60
  pmPluginFactoryParams: PMPluginFactoryParams;
58
61
  provider: BlockCardNodeViewProps['provider'];
62
+ smartCardContext?: CardContext;
59
63
  }
60
- export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, provider, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => BlockCard | Datasource | NodeView;
64
+ export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, provider, intl, smartCardContext, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => BlockCard | Datasource | NodeView;
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
2
  import type { ComponentProps } from 'react';
3
+ import type { IntlShape } from 'react-intl';
3
4
  import type { RichMediaLayout } from '@atlaskit/adf-schema';
4
5
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
5
6
  import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
6
7
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
7
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
9
+ import type { CardContext } from '@atlaskit/link-provider';
8
10
  import type { cardPlugin } from '../index';
9
11
  import type { SmartCardProps } from './genericCard';
10
12
  /**
@@ -68,7 +70,7 @@ export declare class EmbedCardComponent extends React.PureComponent<SmartCardPro
68
70
  render(): React.JSX.Element;
69
71
  }
70
72
  export declare const EmbedOrBlockCardComponent: (props: ComponentProps<typeof EmbedCardComponent>) => React.JSX.Element;
71
- export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt'>;
73
+ export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt' | 'intl' | 'smartCardContext'>;
72
74
  export declare class EmbedCard extends ReactNodeView<EmbedCardNodeViewProps> {
73
75
  private id;
74
76
  unsubscribe: (() => void) | undefined;
@@ -89,10 +91,12 @@ export interface EmbedCardNodeViewProperties {
89
91
  allowResizing: EmbedCardNodeViewProps['allowResizing'];
90
92
  CompetitorPrompt?: EmbedCardNodeViewProps['CompetitorPrompt'];
91
93
  fullWidthMode: EmbedCardNodeViewProps['fullWidthMode'];
94
+ intl?: IntlShape;
92
95
  isPageSSRed: EmbedCardNodeViewProps['isPageSSRed'];
93
96
  onClickCallback: EmbedCardNodeViewProps['onClickCallback'];
94
97
  pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
95
98
  pmPluginFactoryParams: PMPluginFactoryParams;
96
99
  provider: EmbedCardNodeViewProps['provider'];
100
+ smartCardContext?: CardContext;
97
101
  }
98
- export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, provider, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
102
+ export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, provider, intl, smartCardContext, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
@@ -1,5 +1,6 @@
1
1
  import type { EventHandler, KeyboardEvent, MouseEvent } from 'react';
2
2
  import React from 'react';
3
+ import type { IntlShape } from 'react-intl';
3
4
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
4
5
  import type { OnClickCallback } from '@atlaskit/editor-common/card';
5
6
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
@@ -33,7 +34,6 @@ export interface CardProps extends CardNodeViewProps {
33
34
  onClickCallback?: OnClickCallback;
34
35
  pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
35
36
  showHoverPreview?: BaseCardProps['showHoverPreview'];
36
- smartCardContext?: CardContext;
37
37
  useAlternativePreloader?: boolean;
38
38
  view: EditorView;
39
39
  }
@@ -47,12 +47,14 @@ export interface SmartCardProps extends CardProps {
47
47
  }>;
48
48
  disablePreviewPanel?: BaseCardProps['disablePreviewPanel'];
49
49
  enableInlineUpgradeFeatures?: boolean;
50
+ intl?: IntlShape;
50
51
  isHovered?: boolean;
51
52
  isPageSSRed?: boolean;
52
53
  onClick?: EventHandler<MouseEvent | KeyboardEvent> | undefined;
53
54
  onResolve?: (tr: Transaction, title?: string) => void;
54
55
  pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
55
56
  provider?: Providers['cardProvider'];
57
+ smartCardContext?: CardContext;
56
58
  }
57
59
  /**
58
60
  *
@@ -5,7 +5,7 @@ import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemir
5
5
  import type { SmartCardProps } from './genericCard';
6
6
  import type { InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
7
7
  export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, disablePreviewPanel, }: SmartCardProps) => React.JSX.Element | null>;
8
- export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt' | 'provider' | 'smartCardContext'>;
8
+ export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt' | 'provider' | 'intl' | 'smartCardContext'>;
9
9
  /**
10
10
  * Inline card node view component that renders a Smart Link inline card within the editor.
11
11
  *
@@ -0,0 +1,10 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type IntlShape } from 'react-intl';
3
+ import { type CardContext } from '@atlaskit/link-provider';
4
+ interface Props {
5
+ children: ReactNode;
6
+ intl: IntlShape | undefined;
7
+ smartCardContext: CardContext | undefined;
8
+ }
9
+ export declare function SmartCardSSRReactContextsProvider({ smartCardContext, children, intl, }: Props): ReactNode;
10
+ export {};
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
2
  import { useSmartCardContext } from '@atlaskit/link-provider';
3
- import type { CardContext } from '@atlaskit/link-provider';
4
- export declare const WithCardContext: ({ children, value, }: {
3
+ export declare const WithCardContext: ({ children, }: {
5
4
  children: (cardContext: ReturnType<typeof useSmartCardContext>) => React.ReactNode;
6
- value?: CardContext;
7
5
  }) => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "16.6.0",
3
+ "version": "16.7.1",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/editor-plugin-feature-flags": "^9.0.0",
43
43
  "@atlaskit/editor-plugin-floating-toolbar": "^12.0.0",
44
44
  "@atlaskit/editor-plugin-grid": "^10.1.0",
45
- "@atlaskit/editor-plugin-toolbar": "^7.1.0",
45
+ "@atlaskit/editor-plugin-toolbar": "^7.2.0",
46
46
  "@atlaskit/editor-plugin-width": "^11.0.0",
47
47
  "@atlaskit/editor-prosemirror": "^7.3.0",
48
48
  "@atlaskit/editor-shared-styles": "^3.10.0",
@@ -62,7 +62,7 @@
62
62
  "@atlaskit/primitives": "^19.0.0",
63
63
  "@atlaskit/prosemirror-history": "^0.2.0",
64
64
  "@atlaskit/smart-card": "^44.9.0",
65
- "@atlaskit/tmp-editor-statsig": "^79.0.0",
65
+ "@atlaskit/tmp-editor-statsig": "^80.0.0",
66
66
  "@atlaskit/tokens": "^13.0.0",
67
67
  "@babel/runtime": "^7.0.0",
68
68
  "@emotion/react": "^11.7.1",
@@ -72,7 +72,7 @@
72
72
  "uuid": "^3.1.0"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atlaskit/editor-common": "^114.29.0",
75
+ "@atlaskit/editor-common": "^114.30.0",
76
76
  "@atlaskit/link-provider": "^4.4.0",
77
77
  "react": "^18.2.0",
78
78
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"