@atlaskit/editor-plugin-card 7.3.1 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 7.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`bd14b2c6330ba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd14b2c6330ba) -
8
+ [https://product-fabric.atlassian.net/browse/ED-28981](ED-28981) - use `CardSSR` component for
9
+ smart card SSR
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 7.3.1
4
16
 
5
17
  ### Patch Changes
@@ -19,6 +19,8 @@ var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/rea
19
19
  var _ui = require("@atlaskit/editor-common/ui");
20
20
  var _utils = require("@atlaskit/editor-common/utils");
21
21
  var _smartCard = require("@atlaskit/smart-card");
22
+ var _ssr = require("@atlaskit/smart-card/ssr");
23
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
22
24
  var _datasource = require("../nodeviews/datasource");
23
25
  var _actions = require("../pm-plugins/actions");
24
26
  var _utils2 = require("../pm-plugins/utils");
@@ -109,11 +111,23 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
109
111
  cardContext = _this$props2.cardContext,
110
112
  actionOptions = _this$props2.actionOptions,
111
113
  onClick = _this$props2.onClick,
112
- CompetitorPrompt = _this$props2.CompetitorPrompt;
114
+ CompetitorPrompt = _this$props2.CompetitorPrompt,
115
+ isPageSSRed = _this$props2.isPageSSRed;
113
116
  var _node$attrs = node.attrs,
114
117
  url = _node$attrs.url,
115
118
  data = _node$attrs.data;
116
- var cardInner = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
119
+ var cardInner = isPageSSRed && (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
120
+ key: url,
121
+ url: url !== null && url !== void 0 ? url : data.url,
122
+ container: this.scrollContainer,
123
+ appearance: "block",
124
+ onClick: onClick,
125
+ onResolve: this.onResolve,
126
+ onError: this.onError,
127
+ platform: 'web',
128
+ actionOptions: actionOptions,
129
+ CompetitorPrompt: CompetitorPrompt
130
+ }), this.gapCursorSpan()) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
117
131
  key: url,
118
132
  url: url !== null && url !== void 0 ? url : data.url,
119
133
  container: this.scrollContainer,
@@ -191,7 +205,8 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
191
205
  actionOptions = _this$reactComponentP3.actionOptions,
192
206
  pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
193
207
  onClickCallback = _this$reactComponentP3.onClickCallback,
194
- CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt;
208
+ CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
209
+ isPageSSRed = _this$reactComponentP3.isPageSSRed;
195
210
  return /*#__PURE__*/_react.default.createElement(WrappedBlockCard, {
196
211
  node: this.node,
197
212
  view: this.view,
@@ -200,7 +215,8 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
200
215
  pluginInjectionApi: pluginInjectionApi,
201
216
  onClickCallback: onClickCallback,
202
217
  id: this.id,
203
- CompetitorPrompt: CompetitorPrompt
218
+ CompetitorPrompt: CompetitorPrompt,
219
+ isPageSSRed: isPageSSRed
204
220
  });
205
221
  }
206
222
  }, {
@@ -219,7 +235,8 @@ var blockCardNodeView = exports.blockCardNodeView = function blockCardNodeView(_
219
235
  onClickCallback = _ref3.onClickCallback,
220
236
  allowDatasource = _ref3.allowDatasource,
221
237
  inlineCardViewProducer = _ref3.inlineCardViewProducer,
222
- CompetitorPrompt = _ref3.CompetitorPrompt;
238
+ CompetitorPrompt = _ref3.CompetitorPrompt,
239
+ isPageSSRed = _ref3.isPageSSRed;
223
240
  return function (node, view, getPos, decorations) {
224
241
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
225
242
  eventDispatcher = pmPluginFactoryParams.eventDispatcher;
@@ -227,7 +244,8 @@ var blockCardNodeView = exports.blockCardNodeView = function blockCardNodeView(_
227
244
  actionOptions: actionOptions,
228
245
  pluginInjectionApi: pluginInjectionApi,
229
246
  onClickCallback: onClickCallback,
230
- CompetitorPrompt: CompetitorPrompt
247
+ CompetitorPrompt: CompetitorPrompt,
248
+ isPageSSRed: isPageSSRed
231
249
  };
232
250
  var isDatasource = (0, _utils2.isDatasourceNode)(node);
233
251
  if (isDatasource) {
@@ -25,6 +25,7 @@ var _utils = require("@atlaskit/editor-common/utils");
25
25
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
26
26
  var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
27
27
  var _smartCard = require("@atlaskit/smart-card");
28
+ var _ssr = require("@atlaskit/smart-card/ssr");
28
29
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
29
30
  var _actions = require("../pm-plugins/actions");
30
31
  var _ResizableEmbedCard = _interopRequireDefault(require("../ui/ResizableEmbedCard"));
@@ -311,7 +312,8 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
311
312
  pluginInjectionApi = _this$props.pluginInjectionApi,
312
313
  actionOptions = _this$props.actionOptions,
313
314
  onClick = _this$props.onClick,
314
- CompetitorPrompt = _this$props.CompetitorPrompt;
315
+ CompetitorPrompt = _this$props.CompetitorPrompt,
316
+ isPageSSRed = _this$props.isPageSSRed;
315
317
  var _node$attrs = node.attrs,
316
318
  url = _node$attrs.url,
317
319
  pctWidth = _node$attrs.width,
@@ -338,7 +340,21 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
338
340
  pctWidth: pctWidth,
339
341
  fullWidthMode: fullWidthMode
340
342
  };
341
- var smartCard = /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
343
+ var smartCard = isPageSSRed && (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
344
+ key: url,
345
+ url: url,
346
+ appearance: "embed",
347
+ onClick: onClick,
348
+ onResolve: this.onResolve,
349
+ onError: this.onError,
350
+ frameStyle: "show",
351
+ inheritDimensions: true,
352
+ platform: 'web',
353
+ container: this.scrollContainer,
354
+ embedIframeRef: this.embedIframeRef,
355
+ actionOptions: actionOptions,
356
+ CompetitorPrompt: CompetitorPrompt
357
+ }) : /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
342
358
  key: url,
343
359
  url: url,
344
360
  appearance: "embed",
@@ -395,7 +411,8 @@ var EmbedOrBlockCardComponent = exports.EmbedOrBlockCardComponent = function Emb
395
411
  smartCard: props.smartCard,
396
412
  hasPreview: props.hasPreview,
397
413
  liveHeight: props.liveHeight,
398
- initialAspectRatio: props.initialAspectRatio
414
+ initialAspectRatio: props.initialAspectRatio,
415
+ isPageSSRed: props.isPageSSRed
399
416
  }) : /*#__PURE__*/_react.default.createElement(EmbedCardComponent, {
400
417
  id: props.id,
401
418
  node: props.node,
@@ -413,7 +430,8 @@ var EmbedOrBlockCardComponent = exports.EmbedOrBlockCardComponent = function Emb
413
430
  smartCard: props.smartCard,
414
431
  hasPreview: props.hasPreview,
415
432
  liveHeight: props.liveHeight,
416
- initialAspectRatio: props.initialAspectRatio
433
+ initialAspectRatio: props.initialAspectRatio,
434
+ isPageSSRed: props.isPageSSRed
417
435
  });
418
436
  };
419
437
  var WrappedEmbedCardWithCondition = (0, _platformFeatureFlagsReact.componentWithCondition)(function () {
@@ -469,7 +487,8 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
469
487
  dispatchAnalyticsEvent = _this$reactComponentP3.dispatchAnalyticsEvent,
470
488
  pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
471
489
  onClickCallback = _this$reactComponentP3.onClickCallback,
472
- CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt;
490
+ CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
491
+ isPageSSRed = _this$reactComponentP3.isPageSSRed;
473
492
  return /*#__PURE__*/_react.default.createElement(WrappedEmbedCard, {
474
493
  node: this.node,
475
494
  view: this.view,
@@ -481,7 +500,8 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
481
500
  pluginInjectionApi: pluginInjectionApi,
482
501
  onClickCallback: onClickCallback,
483
502
  id: this.id,
484
- CompetitorPrompt: CompetitorPrompt
503
+ CompetitorPrompt: CompetitorPrompt,
504
+ isPageSSRed: isPageSSRed
485
505
  });
486
506
  }
487
507
  }, {
@@ -500,7 +520,8 @@ var embedCardNodeView = exports.embedCardNodeView = function embedCardNodeView(_
500
520
  pluginInjectionApi = _ref4.pluginInjectionApi,
501
521
  actionOptions = _ref4.actionOptions,
502
522
  onClickCallback = _ref4.onClickCallback,
503
- CompetitorPrompt = _ref4.CompetitorPrompt;
523
+ CompetitorPrompt = _ref4.CompetitorPrompt,
524
+ isPageSSRed = _ref4.isPageSSRed;
504
525
  return function (node, view, getPos) {
505
526
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
506
527
  eventDispatcher = pmPluginFactoryParams.eventDispatcher,
@@ -513,7 +534,8 @@ var embedCardNodeView = exports.embedCardNodeView = function embedCardNodeView(_
513
534
  pluginInjectionApi: pluginInjectionApi,
514
535
  actionOptions: actionOptions,
515
536
  onClickCallback: onClickCallback,
516
- CompetitorPrompt: CompetitorPrompt
537
+ CompetitorPrompt: CompetitorPrompt,
538
+ isPageSSRed: isPageSSRed
517
539
  };
518
540
  return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
519
541
  };
@@ -18,7 +18,6 @@ var _ui = require("@atlaskit/editor-common/ui");
18
18
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
19
  var _smartCard = require("@atlaskit/smart-card");
20
20
  var _ssr = require("@atlaskit/smart-card/ssr");
21
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
22
21
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
23
22
  var _actions = require("../pm-plugins/actions");
24
23
  var _utils = require("../pm-plugins/utils");
@@ -111,8 +110,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
111
110
  exposure: true
112
111
  }) ? handleOnClick : propsOnClick;
113
112
  var card = (0, _react.useMemo)(function () {
114
- // Should be removed when the platform_editor_smart_card_otp experiment is rolled out
115
- if (isPageSSRed && url && !(0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true)) {
113
+ if (isPageSSRed && url) {
116
114
  return /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
117
115
  key: url,
118
116
  url: url,
@@ -6,6 +6,8 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
6
6
  import { findOverflowScrollParent, UnsupportedBlock } from '@atlaskit/editor-common/ui';
7
7
  import { browser, canRenderDatasource } from '@atlaskit/editor-common/utils';
8
8
  import { Card as SmartCard } from '@atlaskit/smart-card';
9
+ import { CardSSR } from '@atlaskit/smart-card/ssr';
10
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
11
  import { Datasource } from '../nodeviews/datasource';
10
12
  import { registerCard, removeCard } from '../pm-plugins/actions';
11
13
  import { isDatasourceNode } from '../pm-plugins/utils';
@@ -90,13 +92,25 @@ export class BlockCardComponent extends React.PureComponent {
90
92
  cardContext,
91
93
  actionOptions,
92
94
  onClick,
93
- CompetitorPrompt
95
+ CompetitorPrompt,
96
+ isPageSSRed
94
97
  } = this.props;
95
98
  const {
96
99
  url,
97
100
  data
98
101
  } = node.attrs;
99
- const cardInner = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SmartCard, {
102
+ const cardInner = isPageSSRed && expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardSSR, {
103
+ key: url,
104
+ url: url !== null && url !== void 0 ? url : data.url,
105
+ container: this.scrollContainer,
106
+ appearance: "block",
107
+ onClick: onClick,
108
+ onResolve: this.onResolve,
109
+ onError: this.onError,
110
+ platform: 'web',
111
+ actionOptions: actionOptions,
112
+ CompetitorPrompt: CompetitorPrompt
113
+ }), this.gapCursorSpan()) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SmartCard, {
100
114
  key: url,
101
115
  url: url !== null && url !== void 0 ? url : data.url,
102
116
  container: this.scrollContainer,
@@ -154,7 +168,8 @@ export class BlockCard extends ReactNodeView {
154
168
  actionOptions,
155
169
  pluginInjectionApi,
156
170
  onClickCallback,
157
- CompetitorPrompt
171
+ CompetitorPrompt,
172
+ isPageSSRed
158
173
  } = this.reactComponentProps;
159
174
  return /*#__PURE__*/React.createElement(WrappedBlockCard, {
160
175
  node: this.node,
@@ -164,7 +179,8 @@ export class BlockCard extends ReactNodeView {
164
179
  pluginInjectionApi: pluginInjectionApi,
165
180
  onClickCallback: onClickCallback,
166
181
  id: this.id,
167
- CompetitorPrompt: CompetitorPrompt
182
+ CompetitorPrompt: CompetitorPrompt,
183
+ isPageSSRed: isPageSSRed
168
184
  });
169
185
  }
170
186
  destroy() {
@@ -180,7 +196,8 @@ export const blockCardNodeView = ({
180
196
  onClickCallback,
181
197
  allowDatasource,
182
198
  inlineCardViewProducer,
183
- CompetitorPrompt
199
+ CompetitorPrompt,
200
+ isPageSSRed
184
201
  }) => (node, view, getPos, decorations) => {
185
202
  const {
186
203
  portalProviderAPI,
@@ -190,7 +207,8 @@ export const blockCardNodeView = ({
190
207
  actionOptions,
191
208
  pluginInjectionApi,
192
209
  onClickCallback: onClickCallback,
193
- CompetitorPrompt
210
+ CompetitorPrompt,
211
+ isPageSSRed
194
212
  };
195
213
  const isDatasource = isDatasourceNode(node);
196
214
  if (isDatasource) {
@@ -12,6 +12,7 @@ import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-
12
12
  import { akEditorFullPageNarrowBreakout, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
13
13
  import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
14
14
  import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
15
+ import { CardSSR } from '@atlaskit/smart-card/ssr';
15
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
16
17
  import { registerCard, removeCard } from '../pm-plugins/actions';
17
18
  import ResizableEmbedCard from '../ui/ResizableEmbedCard';
@@ -300,7 +301,8 @@ export class EmbedCardComponent extends React.PureComponent {
300
301
  pluginInjectionApi,
301
302
  actionOptions,
302
303
  onClick,
303
- CompetitorPrompt
304
+ CompetitorPrompt,
305
+ isPageSSRed
304
306
  } = this.props;
305
307
  const {
306
308
  url,
@@ -330,7 +332,21 @@ export class EmbedCardComponent extends React.PureComponent {
330
332
  pctWidth,
331
333
  fullWidthMode
332
334
  };
333
- const smartCard = /*#__PURE__*/React.createElement(SmartCard, {
335
+ const smartCard = isPageSSRed && expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/React.createElement(CardSSR, {
336
+ key: url,
337
+ url: url,
338
+ appearance: "embed",
339
+ onClick: onClick,
340
+ onResolve: this.onResolve,
341
+ onError: this.onError,
342
+ frameStyle: "show",
343
+ inheritDimensions: true,
344
+ platform: 'web',
345
+ container: this.scrollContainer,
346
+ embedIframeRef: this.embedIframeRef,
347
+ actionOptions: actionOptions,
348
+ CompetitorPrompt: CompetitorPrompt
349
+ }) : /*#__PURE__*/React.createElement(SmartCard, {
334
350
  key: url,
335
351
  url: url,
336
352
  appearance: "embed",
@@ -386,7 +402,8 @@ export const EmbedOrBlockCardComponent = props => {
386
402
  smartCard: props.smartCard,
387
403
  hasPreview: props.hasPreview,
388
404
  liveHeight: props.liveHeight,
389
- initialAspectRatio: props.initialAspectRatio
405
+ initialAspectRatio: props.initialAspectRatio,
406
+ isPageSSRed: props.isPageSSRed
390
407
  }) : /*#__PURE__*/React.createElement(EmbedCardComponent, {
391
408
  id: props.id,
392
409
  node: props.node,
@@ -404,7 +421,8 @@ export const EmbedOrBlockCardComponent = props => {
404
421
  smartCard: props.smartCard,
405
422
  hasPreview: props.hasPreview,
406
423
  liveHeight: props.liveHeight,
407
- initialAspectRatio: props.initialAspectRatio
424
+ initialAspectRatio: props.initialAspectRatio,
425
+ isPageSSRed: props.isPageSSRed
408
426
  });
409
427
  };
410
428
  const WrappedEmbedCardWithCondition = componentWithCondition(() => expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true), EmbedOrBlockCardComponent, EmbedCardComponent);
@@ -442,7 +460,8 @@ export class EmbedCard extends ReactNodeView {
442
460
  dispatchAnalyticsEvent,
443
461
  pluginInjectionApi,
444
462
  onClickCallback,
445
- CompetitorPrompt
463
+ CompetitorPrompt,
464
+ isPageSSRed
446
465
  } = this.reactComponentProps;
447
466
  return /*#__PURE__*/React.createElement(WrappedEmbedCard, {
448
467
  node: this.node,
@@ -455,7 +474,8 @@ export class EmbedCard extends ReactNodeView {
455
474
  pluginInjectionApi: pluginInjectionApi,
456
475
  onClickCallback: onClickCallback,
457
476
  id: this.id,
458
- CompetitorPrompt: CompetitorPrompt
477
+ CompetitorPrompt: CompetitorPrompt,
478
+ isPageSSRed: isPageSSRed
459
479
  });
460
480
  }
461
481
  destroy() {
@@ -471,7 +491,8 @@ export const embedCardNodeView = ({
471
491
  pluginInjectionApi,
472
492
  actionOptions,
473
493
  onClickCallback,
474
- CompetitorPrompt
494
+ CompetitorPrompt,
495
+ isPageSSRed
475
496
  }) => (node, view, getPos) => {
476
497
  const {
477
498
  portalProviderAPI,
@@ -486,7 +507,8 @@ export const embedCardNodeView = ({
486
507
  pluginInjectionApi,
487
508
  actionOptions,
488
509
  onClickCallback: onClickCallback,
489
- CompetitorPrompt
510
+ CompetitorPrompt,
511
+ isPageSSRed
490
512
  };
491
513
  return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
492
514
  };
@@ -8,7 +8,6 @@ import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-co
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { Card as SmartCard } from '@atlaskit/smart-card';
10
10
  import { CardSSR } from '@atlaskit/smart-card/ssr';
11
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
11
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
12
  import { registerCard, removeCard } from '../pm-plugins/actions';
14
13
  import { getAwarenessProps } from '../pm-plugins/utils';
@@ -107,8 +106,7 @@ export const InlineCard = /*#__PURE__*/memo(({
107
106
  exposure: true
108
107
  }) ? handleOnClick : propsOnClick;
109
108
  const card = useMemo(() => {
110
- // Should be removed when the platform_editor_smart_card_otp experiment is rolled out
111
- if (isPageSSRed && url && !expValEquals('platform_editor_smart_card_otp', 'isEnabled', true)) {
109
+ if (isPageSSRed && url) {
112
110
  return /*#__PURE__*/React.createElement(CardSSR, {
113
111
  key: url,
114
112
  url: url,
@@ -15,6 +15,8 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
15
15
  import { findOverflowScrollParent, UnsupportedBlock } from '@atlaskit/editor-common/ui';
16
16
  import { browser, canRenderDatasource } from '@atlaskit/editor-common/utils';
17
17
  import { Card as SmartCard } from '@atlaskit/smart-card';
18
+ import { CardSSR } from '@atlaskit/smart-card/ssr';
19
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
18
20
  import { Datasource } from '../nodeviews/datasource';
19
21
  import { registerCard, removeCard as _removeCard } from '../pm-plugins/actions';
20
22
  import { isDatasourceNode } from '../pm-plugins/utils';
@@ -103,11 +105,23 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
103
105
  cardContext = _this$props2.cardContext,
104
106
  actionOptions = _this$props2.actionOptions,
105
107
  onClick = _this$props2.onClick,
106
- CompetitorPrompt = _this$props2.CompetitorPrompt;
108
+ CompetitorPrompt = _this$props2.CompetitorPrompt,
109
+ isPageSSRed = _this$props2.isPageSSRed;
107
110
  var _node$attrs = node.attrs,
108
111
  url = _node$attrs.url,
109
112
  data = _node$attrs.data;
110
- var cardInner = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SmartCard, {
113
+ var cardInner = isPageSSRed && expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardSSR, {
114
+ key: url,
115
+ url: url !== null && url !== void 0 ? url : data.url,
116
+ container: this.scrollContainer,
117
+ appearance: "block",
118
+ onClick: onClick,
119
+ onResolve: this.onResolve,
120
+ onError: this.onError,
121
+ platform: 'web',
122
+ actionOptions: actionOptions,
123
+ CompetitorPrompt: CompetitorPrompt
124
+ }), this.gapCursorSpan()) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SmartCard, {
111
125
  key: url,
112
126
  url: url !== null && url !== void 0 ? url : data.url,
113
127
  container: this.scrollContainer,
@@ -185,7 +199,8 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
185
199
  actionOptions = _this$reactComponentP3.actionOptions,
186
200
  pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
187
201
  onClickCallback = _this$reactComponentP3.onClickCallback,
188
- CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt;
202
+ CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
203
+ isPageSSRed = _this$reactComponentP3.isPageSSRed;
189
204
  return /*#__PURE__*/React.createElement(WrappedBlockCard, {
190
205
  node: this.node,
191
206
  view: this.view,
@@ -194,7 +209,8 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
194
209
  pluginInjectionApi: pluginInjectionApi,
195
210
  onClickCallback: onClickCallback,
196
211
  id: this.id,
197
- CompetitorPrompt: CompetitorPrompt
212
+ CompetitorPrompt: CompetitorPrompt,
213
+ isPageSSRed: isPageSSRed
198
214
  });
199
215
  }
200
216
  }, {
@@ -213,7 +229,8 @@ export var blockCardNodeView = function blockCardNodeView(_ref3) {
213
229
  onClickCallback = _ref3.onClickCallback,
214
230
  allowDatasource = _ref3.allowDatasource,
215
231
  inlineCardViewProducer = _ref3.inlineCardViewProducer,
216
- CompetitorPrompt = _ref3.CompetitorPrompt;
232
+ CompetitorPrompt = _ref3.CompetitorPrompt,
233
+ isPageSSRed = _ref3.isPageSSRed;
217
234
  return function (node, view, getPos, decorations) {
218
235
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
219
236
  eventDispatcher = pmPluginFactoryParams.eventDispatcher;
@@ -221,7 +238,8 @@ export var blockCardNodeView = function blockCardNodeView(_ref3) {
221
238
  actionOptions: actionOptions,
222
239
  pluginInjectionApi: pluginInjectionApi,
223
240
  onClickCallback: onClickCallback,
224
- CompetitorPrompt: CompetitorPrompt
241
+ CompetitorPrompt: CompetitorPrompt,
242
+ isPageSSRed: isPageSSRed
225
243
  };
226
244
  var isDatasource = isDatasourceNode(node);
227
245
  if (isDatasource) {
@@ -23,6 +23,7 @@ import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-
23
23
  import { akEditorFullPageNarrowBreakout, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
24
24
  import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
25
25
  import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
26
+ import { CardSSR } from '@atlaskit/smart-card/ssr';
26
27
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
27
28
  import { registerCard, removeCard as _removeCard } from '../pm-plugins/actions';
28
29
  import ResizableEmbedCard from '../ui/ResizableEmbedCard';
@@ -304,7 +305,8 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
304
305
  pluginInjectionApi = _this$props.pluginInjectionApi,
305
306
  actionOptions = _this$props.actionOptions,
306
307
  onClick = _this$props.onClick,
307
- CompetitorPrompt = _this$props.CompetitorPrompt;
308
+ CompetitorPrompt = _this$props.CompetitorPrompt,
309
+ isPageSSRed = _this$props.isPageSSRed;
308
310
  var _node$attrs = node.attrs,
309
311
  url = _node$attrs.url,
310
312
  pctWidth = _node$attrs.width,
@@ -331,7 +333,21 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
331
333
  pctWidth: pctWidth,
332
334
  fullWidthMode: fullWidthMode
333
335
  };
334
- var smartCard = /*#__PURE__*/React.createElement(SmartCard, {
336
+ var smartCard = isPageSSRed && expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/React.createElement(CardSSR, {
337
+ key: url,
338
+ url: url,
339
+ appearance: "embed",
340
+ onClick: onClick,
341
+ onResolve: this.onResolve,
342
+ onError: this.onError,
343
+ frameStyle: "show",
344
+ inheritDimensions: true,
345
+ platform: 'web',
346
+ container: this.scrollContainer,
347
+ embedIframeRef: this.embedIframeRef,
348
+ actionOptions: actionOptions,
349
+ CompetitorPrompt: CompetitorPrompt
350
+ }) : /*#__PURE__*/React.createElement(SmartCard, {
335
351
  key: url,
336
352
  url: url,
337
353
  appearance: "embed",
@@ -388,7 +404,8 @@ export var EmbedOrBlockCardComponent = function EmbedOrBlockCardComponent(props)
388
404
  smartCard: props.smartCard,
389
405
  hasPreview: props.hasPreview,
390
406
  liveHeight: props.liveHeight,
391
- initialAspectRatio: props.initialAspectRatio
407
+ initialAspectRatio: props.initialAspectRatio,
408
+ isPageSSRed: props.isPageSSRed
392
409
  }) : /*#__PURE__*/React.createElement(EmbedCardComponent, {
393
410
  id: props.id,
394
411
  node: props.node,
@@ -406,7 +423,8 @@ export var EmbedOrBlockCardComponent = function EmbedOrBlockCardComponent(props)
406
423
  smartCard: props.smartCard,
407
424
  hasPreview: props.hasPreview,
408
425
  liveHeight: props.liveHeight,
409
- initialAspectRatio: props.initialAspectRatio
426
+ initialAspectRatio: props.initialAspectRatio,
427
+ isPageSSRed: props.isPageSSRed
410
428
  });
411
429
  };
412
430
  var WrappedEmbedCardWithCondition = componentWithCondition(function () {
@@ -462,7 +480,8 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
462
480
  dispatchAnalyticsEvent = _this$reactComponentP3.dispatchAnalyticsEvent,
463
481
  pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
464
482
  onClickCallback = _this$reactComponentP3.onClickCallback,
465
- CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt;
483
+ CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
484
+ isPageSSRed = _this$reactComponentP3.isPageSSRed;
466
485
  return /*#__PURE__*/React.createElement(WrappedEmbedCard, {
467
486
  node: this.node,
468
487
  view: this.view,
@@ -474,7 +493,8 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
474
493
  pluginInjectionApi: pluginInjectionApi,
475
494
  onClickCallback: onClickCallback,
476
495
  id: this.id,
477
- CompetitorPrompt: CompetitorPrompt
496
+ CompetitorPrompt: CompetitorPrompt,
497
+ isPageSSRed: isPageSSRed
478
498
  });
479
499
  }
480
500
  }, {
@@ -493,7 +513,8 @@ export var embedCardNodeView = function embedCardNodeView(_ref4) {
493
513
  pluginInjectionApi = _ref4.pluginInjectionApi,
494
514
  actionOptions = _ref4.actionOptions,
495
515
  onClickCallback = _ref4.onClickCallback,
496
- CompetitorPrompt = _ref4.CompetitorPrompt;
516
+ CompetitorPrompt = _ref4.CompetitorPrompt,
517
+ isPageSSRed = _ref4.isPageSSRed;
497
518
  return function (node, view, getPos) {
498
519
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
499
520
  eventDispatcher = pmPluginFactoryParams.eventDispatcher,
@@ -506,7 +527,8 @@ export var embedCardNodeView = function embedCardNodeView(_ref4) {
506
527
  pluginInjectionApi: pluginInjectionApi,
507
528
  actionOptions: actionOptions,
508
529
  onClickCallback: onClickCallback,
509
- CompetitorPrompt: CompetitorPrompt
530
+ CompetitorPrompt: CompetitorPrompt,
531
+ isPageSSRed: isPageSSRed
510
532
  };
511
533
  return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
512
534
  };
@@ -8,7 +8,6 @@ import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-co
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { Card as SmartCard } from '@atlaskit/smart-card';
10
10
  import { CardSSR } from '@atlaskit/smart-card/ssr';
11
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
11
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
12
  import { registerCard, removeCard } from '../pm-plugins/actions';
14
13
  import { getAwarenessProps } from '../pm-plugins/utils';
@@ -100,8 +99,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
100
99
  exposure: true
101
100
  }) ? handleOnClick : propsOnClick;
102
101
  var card = useMemo(function () {
103
- // Should be removed when the platform_editor_smart_card_otp experiment is rolled out
104
- if (isPageSSRed && url && !expValEquals('platform_editor_smart_card_otp', 'isEnabled', true)) {
102
+ if (isPageSSRed && url) {
105
103
  return /*#__PURE__*/React.createElement(CardSSR, {
106
104
  key: url,
107
105
  url: url,
@@ -49,4 +49,4 @@ export interface BlockCardNodeViewProperties {
49
49
  linkType?: string;
50
50
  }>;
51
51
  }
52
- export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
52
+ export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
@@ -64,4 +64,4 @@ export interface EmbedCardNodeViewProperties {
64
64
  isPageSSRed: EmbedCardNodeViewProps['isPageSSRed'];
65
65
  CompetitorPrompt?: EmbedCardNodeViewProps['CompetitorPrompt'];
66
66
  }
67
- export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
67
+ export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
@@ -49,4 +49,4 @@ export interface BlockCardNodeViewProperties {
49
49
  linkType?: string;
50
50
  }>;
51
51
  }
52
- export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
52
+ export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
@@ -64,4 +64,4 @@ export interface EmbedCardNodeViewProperties {
64
64
  isPageSSRed: EmbedCardNodeViewProps['isPageSSRed'];
65
65
  CompetitorPrompt?: EmbedCardNodeViewProps['CompetitorPrompt'];
66
66
  }
67
- export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
67
+ export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "7.3.1",
3
+ "version": "7.4.0",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -49,18 +49,18 @@
49
49
  "@atlaskit/editor-prosemirror": "7.0.0",
50
50
  "@atlaskit/editor-shared-styles": "^3.6.0",
51
51
  "@atlaskit/frontend-utilities": "^3.1.0",
52
- "@atlaskit/icon": "^27.11.0",
52
+ "@atlaskit/icon": "^27.12.0",
53
53
  "@atlaskit/link": "^3.2.0",
54
54
  "@atlaskit/link-analytics": "^10.0.0",
55
55
  "@atlaskit/link-client-extension": "^5.0.0",
56
56
  "@atlaskit/link-datasource": "^4.19.0",
57
57
  "@atlaskit/linking-common": "^9.2.0",
58
58
  "@atlaskit/linking-types": "^14.0.0",
59
- "@atlaskit/menu": "^8.1.0",
59
+ "@atlaskit/menu": "^8.3.0",
60
60
  "@atlaskit/platform-feature-flags": "^1.1.0",
61
61
  "@atlaskit/platform-feature-flags-react": "^0.2.0",
62
62
  "@atlaskit/primitives": "^14.11.0",
63
- "@atlaskit/smart-card": "^40.8.0",
63
+ "@atlaskit/smart-card": "^40.10.0",
64
64
  "@atlaskit/theme": "^19.0.0",
65
65
  "@atlaskit/tmp-editor-statsig": "^9.27.0",
66
66
  "@atlaskit/tokens": "^6.0.0",
@@ -72,7 +72,7 @@
72
72
  "uuid": "^3.1.0"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atlaskit/editor-common": "^107.21.0",
75
+ "@atlaskit/editor-common": "^107.23.0",
76
76
  "@atlaskit/link-provider": "^3.4.0",
77
77
  "react": "^18.2.0",
78
78
  "react-intl-next": "npm:react-intl@^5.18.1"