@atlaskit/editor-plugin-card 7.3.1 → 7.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 7.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`598cea2432fa9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/598cea2432fa9) -
8
+ [ux] UI and behaviour updates of the HoverLinkOverlay for the Preview Panels.
9
+ - Updated dependencies
10
+
11
+ ## 7.4.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`bd14b2c6330ba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd14b2c6330ba) -
16
+ [https://product-fabric.atlassian.net/browse/ED-28981](ED-28981) - use `CardSSR` component for
17
+ smart card SSR
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 7.3.1
4
24
 
5
25
  ### 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,
@@ -17,6 +17,7 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
17
17
  var _actions = require("../pm-plugins/actions");
18
18
  var _pluginKey = require("../pm-plugins/plugin-key");
19
19
  var _AwarenessWrapper = require("../ui/AwarenessWrapper");
20
+ var _PreviewInvoker = require("../ui/preview/PreviewInvoker");
20
21
  var _inlineCard = require("./inlineCard");
21
22
  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); }
22
23
  var selector = function selector(states) {
@@ -94,6 +95,7 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
94
95
  mode = _useSharedState.mode,
95
96
  selection = _useSharedState.selection;
96
97
  var floatingToolbarNode = selection instanceof _state.NodeSelection && selection.node;
98
+ // This is a prop to show Hover card, Hover card should be shown only in Live View and Classic Renderer (note when only Editor controls enabled we don't show in Live view)
97
99
  var showHoverPreview = floatingToolbarNode !== node && (0, _platformFeatureFlags.fg)('platform_editor_preview_panel_linking');
98
100
  var innerCardWithOpenButtonOverlay = (0, _react.useMemo)(function () {
99
101
  var _pluginInjectionApi$a;
@@ -114,10 +116,9 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
114
116
  cardContext: cardContext,
115
117
  isHovered: isHovered,
116
118
  isPageSSRed: isPageSSRed,
117
- pluginInjectionApi: pluginInjectionApi,
118
- showHoverPreview: showHoverPreview
119
+ pluginInjectionApi: pluginInjectionApi
119
120
  }));
120
- }, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, pluginInjectionApi, showHoverPreview]);
121
+ }, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, pluginInjectionApi]);
121
122
  var innerCardOriginal = (0, _react.useMemo)(function () {
122
123
  return /*#__PURE__*/_react.default.createElement(_inlineCard.InlineCard, {
123
124
  node: node,
@@ -131,19 +132,20 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
131
132
  isHovered: isHovered,
132
133
  isPageSSRed: isPageSSRed,
133
134
  pluginInjectionApi: pluginInjectionApi,
134
- showHoverPreview: showHoverPreview
135
+ showHoverPreview: false
135
136
  });
136
- }, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi, showHoverPreview]);
137
+ }, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi]);
137
138
  var shouldShowOpenButtonOverlay = (0, _react.useMemo)(function () {
138
139
  var shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless';
139
140
  return (mode === 'edit' || editorAppearance === 'comment' || shouldShowOpenButtonOverlayInChomeless) && ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') || (0, _platformFeatureFlags.fg)('platform_editor_preview_panel_linking'));
140
141
  }, [mode, editorAppearance]);
141
142
  var innerCard = shouldShowOpenButtonOverlay ? innerCardWithOpenButtonOverlay : innerCardOriginal;
142
- if ((0, _platformFeatureFlags.fg)('platform_editor_preview_panel_linking')) {
143
+ if (mode === 'view' && (0, _platformFeatureFlags.fg)('platform_editor_preview_panel_linking')) {
143
144
  var _cardContext$value;
144
- var cardState = cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 || (_cardContext$value = _cardContext$value.store) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.getState()[node.attrs.url];
145
+ var url = node.attrs.url;
146
+ var cardState = cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 || (_cardContext$value = _cardContext$value.store) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.getState()[url];
145
147
  if (cardState) {
146
- var _cardContext$value2, _cardContext$value2$i, _cardContext$value3, _pluginInjectionApi$a2;
148
+ var _cardContext$value2, _cardContext$value2$i, _cardContext$value3;
147
149
  var ari = (0, _smartCard.getObjectAri)(cardState.details);
148
150
  var name = (0, _smartCard.getObjectName)(cardState.details);
149
151
  var iconUrl = (0, _smartCard.getObjectIconUrl)(cardState.details);
@@ -151,42 +153,73 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
151
153
  ari: ari
152
154
  }));
153
155
  var openPreviewPanel = cardContext === null || cardContext === void 0 || (_cardContext$value3 = cardContext.value) === null || _cardContext$value3 === void 0 ? void 0 : _cardContext$value3.openPreviewPanel;
154
- var handleOpenGlancePanelClick = function handleOpenGlancePanelClick(event) {
155
- if (openPreviewPanel && isPanelAvailable) {
156
- // Prevent anchor default behaviour(click to open the anchor link)
157
- // When glance panel is available, let openPreviewPanel handle it
158
- event.preventDefault();
159
- openPreviewPanel({
160
- url: node.attrs.url,
161
- ari: ari,
162
- name: name || '',
163
- iconUrl: iconUrl
156
+ var isPreviewPanelAvailable = Boolean(openPreviewPanel && isPanelAvailable);
157
+ var innerCardWithPanelButtonOverlay = /*#__PURE__*/_react.default.createElement(_PreviewInvoker.PreviewInvoker, {
158
+ url: url,
159
+ appearance: "inline"
160
+ }, function (_ref2) {
161
+ var canPreview = _ref2.canPreview,
162
+ invokePreview = _ref2.invokePreview;
163
+ var isPreviewModalAvailable = Boolean(canPreview && invokePreview);
164
+ // In view mode we show HoverLinkOverlay only with if preview mode or panel is available
165
+ // otherwise a use can click on smartlink itself to open the link in a new tab.
166
+ var isPreviewAvailable = isPreviewPanelAvailable || isPreviewModalAvailable;
167
+ if (isPreviewAvailable) {
168
+ var _pluginInjectionApi$a2;
169
+ return /*#__PURE__*/_react.default.createElement(_ui.HoverLinkOverlay, {
170
+ isVisible: isResolvedViewRendered,
171
+ url: url,
172
+ compactPadding: editorAppearance === 'comment' || editorAppearance === 'chromeless',
173
+ editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions,
174
+ view: view,
175
+ showPanelButton: isPreviewAvailable,
176
+ showPanelButtonIcon: isPreviewAvailable && isPreviewPanelAvailable ? 'panel' : 'modal',
177
+ onClick: function onClick(event) {
178
+ if (isPreviewPanelAvailable) {
179
+ event.preventDefault();
180
+ openPreviewPanel === null || openPreviewPanel === void 0 || openPreviewPanel({
181
+ url: url,
182
+ ari: ari || '',
183
+ name: name || '',
184
+ iconUrl: iconUrl
185
+ });
186
+ } else if (isPreviewModalAvailable) {
187
+ event.preventDefault();
188
+ invokePreview === null || invokePreview === void 0 || invokePreview();
189
+ }
190
+ }
191
+ }, /*#__PURE__*/_react.default.createElement(_inlineCard.InlineCard, {
192
+ node: node,
193
+ view: view,
194
+ getPos: getPos,
195
+ useAlternativePreloader: useAlternativePreloader,
196
+ actionOptions: actionOptions,
197
+ onResolve: onResolve,
198
+ onClick: onClick,
199
+ cardContext: cardContext,
200
+ isHovered: isHovered,
201
+ isPageSSRed: isPageSSRed,
202
+ pluginInjectionApi: pluginInjectionApi,
203
+ showHoverPreview: mode === 'view' && showHoverPreview
204
+ }));
205
+ } else {
206
+ return /*#__PURE__*/_react.default.createElement(_inlineCard.InlineCard, {
207
+ node: node,
208
+ view: view,
209
+ getPos: getPos,
210
+ useAlternativePreloader: useAlternativePreloader,
211
+ actionOptions: actionOptions,
212
+ onResolve: onResolve,
213
+ onClick: onClick,
214
+ cardContext: cardContext,
215
+ isHovered: isHovered,
216
+ isPageSSRed: isPageSSRed,
217
+ pluginInjectionApi: pluginInjectionApi,
218
+ showHoverPreview: mode === 'view' && showHoverPreview
164
219
  });
165
220
  }
166
- };
167
- var innerCardWithPanelButtonOverlay = /*#__PURE__*/_react.default.createElement(_ui.HoverLinkOverlay, {
168
- isVisible: isResolvedViewRendered,
169
- url: node.attrs.url,
170
- compactPadding: editorAppearance === 'comment' || editorAppearance === 'chromeless',
171
- editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions,
172
- view: view,
173
- showPanelButton: !!isPanelAvailable,
174
- onClick: handleOpenGlancePanelClick
175
- }, /*#__PURE__*/_react.default.createElement(_inlineCard.InlineCard, {
176
- node: node,
177
- view: view,
178
- getPos: getPos,
179
- useAlternativePreloader: useAlternativePreloader,
180
- actionOptions: actionOptions,
181
- onResolve: onResolve,
182
- onClick: onClick,
183
- cardContext: cardContext,
184
- isHovered: isHovered,
185
- isPageSSRed: isPageSSRed,
186
- pluginInjectionApi: pluginInjectionApi,
187
- showHoverPreview: showHoverPreview
188
- }));
189
- innerCard = isPanelAvailable && openPreviewPanel ? innerCardWithPanelButtonOverlay : innerCard;
221
+ });
222
+ innerCard = innerCardWithPanelButtonOverlay;
190
223
  }
191
224
  }
192
225
  var getPosFunction = typeof getPos === 'function' ? getPos : undefined;
@@ -33,7 +33,7 @@ var loaderWrapperStyles = (0, _react2.css)({
33
33
  }
34
34
  });
35
35
  var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref) {
36
- var _cardContext$value, _cardContext$value3;
36
+ var _cardContext$value2;
37
37
  var cardContext = _ref.cardContext,
38
38
  children = _ref.children,
39
39
  getPos = _ref.getPos,
@@ -85,10 +85,8 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
85
85
  setIsHovered(isHovered);
86
86
  setOverlayHoveredStyles(isHovered);
87
87
  }, [setOverlayHoveredStyles]);
88
- var isPreviewPanelAvailable = cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.isPreviewPanelAvailable;
89
- var shouldShowGlancePanel = (isPreviewPanelAvailable || false) && (0, _platformFeatureFlags.fg)('platform_editor_preview_panel_linking');
90
88
  var cardWithOverlay = (0, _react.useMemo)(function () {
91
- if (shouldShowLinkOverlay && !shouldShowGlancePanel && !(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
89
+ if (shouldShowLinkOverlay && !(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && !(0, _platformFeatureFlags.fg)('platform_editor_preview_panel_linking')) {
92
90
  return (0, _react2.jsx)(_InlineCardOverlay.default, {
93
91
  isSelected: isSelected,
94
92
  isVisible: isResolvedViewRendered && (isInserted || isHovered || isSelected),
@@ -102,11 +100,11 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
102
100
  }, children);
103
101
  }
104
102
  return children;
105
- }, [shouldShowLinkOverlay, children, isSelected, isResolvedViewRendered, isInserted, isHovered, url, handleOverlayChange, shouldShowGlancePanel]);
103
+ }, [shouldShowLinkOverlay, children, isSelected, isResolvedViewRendered, isInserted, isHovered, url, handleOverlayChange]);
106
104
  var isInline = appearance === 'inline';
107
105
  var placeholderUniqId = linkPosition || 0;
108
106
  return (0, _react.useMemo)(function () {
109
- var _cardContext$value2;
107
+ var _cardContext$value;
110
108
  return (0, _react2.jsx)("span", {
111
109
  css: shouldShowLinkPulse && loaderWrapperStyles
112
110
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -117,7 +115,7 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
117
115
  "data-ssr-placeholder-replace": "awareness-wrapper-".concat(placeholderUniqId)
118
116
  }, (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
119
117
  data: {
120
- attributes: (0, _utils.getResolvedAttributesFromStore)(url, 'inline', cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store)
118
+ attributes: (0, _utils.getResolvedAttributesFromStore)(url, 'inline', cardContext === null || cardContext === void 0 || (_cardContext$value = cardContext.value) === null || _cardContext$value === void 0 ? void 0 : _cardContext$value.store)
121
119
  }
122
120
  }, (0, _react2.jsx)(_Pulse.DiscoveryPulse, {
123
121
  localStorageKey: _localStorage.LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK,
@@ -127,5 +125,5 @@ var AwarenessWrapper = exports.AwarenessWrapper = function AwarenessWrapper(_ref
127
125
  testId: "link-discovery-pulse",
128
126
  isInline: isInline
129
127
  }, cardWithOverlay)));
130
- }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value3 = cardContext.value) === null || _cardContext$value3 === void 0 ? void 0 : _cardContext$value3.store, isResolvedViewRendered, cardWithOverlay, isInline, placeholderUniqId]);
128
+ }, [shouldShowLinkPulse, url, cardContext === null || cardContext === void 0 || (_cardContext$value2 = cardContext.value) === null || _cardContext$value2 === void 0 ? void 0 : _cardContext$value2.store, isResolvedViewRendered, cardWithOverlay, isInline, placeholderUniqId]);
131
129
  };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.PreviewInvoker = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _hooks = require("@atlaskit/smart-card/hooks");
10
+ 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); }
11
+ var PreviewInvoker = exports.PreviewInvoker = function PreviewInvoker(_ref) {
12
+ var url = _ref.url,
13
+ appearance = _ref.appearance,
14
+ children = _ref.children;
15
+ var actions = (0, _hooks.useSmartLinkActions)({
16
+ url: url,
17
+ appearance: appearance
18
+ });
19
+ var preview = (0, _react.useMemo)(function () {
20
+ return actions.find(function (action) {
21
+ return action.id === 'preview-content';
22
+ });
23
+ }, [actions]);
24
+ var invokePreview = (0, _react.useCallback)(function () {
25
+ try {
26
+ preview === null || preview === void 0 || preview.invoke();
27
+ } catch (_unused) {}
28
+ }, [preview]);
29
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children({
30
+ canPreview: !!preview,
31
+ invokePreview: invokePreview
32
+ }));
33
+ };
@@ -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
  };