@atlaskit/editor-plugin-card 7.5.1 → 7.6.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,21 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 7.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`5763f85b421a2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5763f85b421a2) - -
8
+ The new method `getCacheStatusForNode` is added to `NodeDataProvider` class to get the cache
9
+ status for a given node.
10
+ - The `CardSSR` component will start supporting `hideIconLoadingSkeleton` property for any type of
11
+ smart card.
12
+
13
+ ### Patch Changes
14
+
15
+ - [`a2cd8c46a3e94`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2cd8c46a3e94) -
16
+ EDITOR-1442 Bump adf-schema
17
+ - Updated dependencies
18
+
3
19
  ## 7.5.1
4
20
 
5
21
  ### Patch Changes
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.blockCardNodeView = exports.BlockCardComponent = exports.BlockCard = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
8
9
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
@@ -15,6 +17,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
15
17
  var _react = _interopRequireDefault(require("react"));
16
18
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
17
19
  var _v = _interopRequireDefault(require("uuid/v4"));
20
+ var _editorCardProvider = require("@atlaskit/editor-card-provider");
18
21
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
19
22
  var _ui = require("@atlaskit/editor-common/ui");
20
23
  var _utils = require("@atlaskit/editor-common/utils");
@@ -26,6 +29,8 @@ var _actions = require("../pm-plugins/actions");
26
29
  var _utils2 = require("../pm-plugins/utils");
27
30
  var _genericCard = require("./genericCard");
28
31
  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; }
32
+ 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; }
33
+ 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; }
29
34
  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)); }
30
35
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
31
36
  // eslint-disable-next-line @repo/internal/react/no-class-components
@@ -36,6 +41,9 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
36
41
  _this = _callSuper(this, BlockCardComponent, [props]);
37
42
  // Ignored via go/ees005
38
43
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
44
+ (0, _defineProperty2.default)(_this, "state", {
45
+ isSSRDataAvailable: false
46
+ });
39
47
  (0, _defineProperty2.default)(_this, "onResolve", function (data) {
40
48
  var _this$props = _this.props,
41
49
  getPos = _this$props.getPos,
@@ -86,6 +94,46 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
86
94
  }
87
95
  (0, _inherits2.default)(BlockCardComponent, _React$PureComponent);
88
96
  return (0, _createClass2.default)(BlockCardComponent, [{
97
+ key: "componentDidMount",
98
+ value: function componentDidMount() {
99
+ var _this2 = this;
100
+ if (!(0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true)) {
101
+ return;
102
+ }
103
+ var provider = this.props.provider;
104
+ if (!provider) {
105
+ return;
106
+ }
107
+ var updateSSRDataAvailability = /*#__PURE__*/function () {
108
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
109
+ var resolvedProvider;
110
+ return _regenerator.default.wrap(function _callee$(_context) {
111
+ while (1) switch (_context.prev = _context.next) {
112
+ case 0:
113
+ _context.next = 2;
114
+ return provider;
115
+ case 2:
116
+ resolvedProvider = _context.sent;
117
+ if (resolvedProvider instanceof _editorCardProvider.EditorCardProvider) {
118
+ _this2.setState(function (state) {
119
+ return _objectSpread(_objectSpread({}, state), {}, {
120
+ isSSRDataAvailable: resolvedProvider.getCacheStatusForNode(_this2.props.node) === 'ssr'
121
+ });
122
+ });
123
+ }
124
+ case 4:
125
+ case "end":
126
+ return _context.stop();
127
+ }
128
+ }, _callee);
129
+ }));
130
+ return function updateSSRDataAvailability() {
131
+ return _ref2.apply(this, arguments);
132
+ };
133
+ }();
134
+ void updateSSRDataAvailability();
135
+ }
136
+ }, {
89
137
  key: "componentWillUnmount",
90
138
  value: function componentWillUnmount() {
91
139
  this.removeCard();
@@ -126,7 +174,8 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
126
174
  onError: this.onError,
127
175
  platform: 'web',
128
176
  actionOptions: actionOptions,
129
- CompetitorPrompt: CompetitorPrompt
177
+ CompetitorPrompt: CompetitorPrompt,
178
+ hideIconLoadingSkeleton: (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable
130
179
  }), this.gapCursorSpan()) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
131
180
  key: url,
132
181
  url: url !== null && url !== void 0 ? url : data.url,
@@ -150,31 +199,31 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
150
199
  var WrappedBlockCard = (0, _genericCard.Card)(BlockCardComponent, _ui.UnsupportedBlock);
151
200
  var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
152
201
  function BlockCard() {
153
- var _this2;
202
+ var _this3;
154
203
  (0, _classCallCheck2.default)(this, BlockCard);
155
204
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
156
205
  args[_key] = arguments[_key];
157
206
  }
158
- _this2 = _callSuper(this, BlockCard, [].concat(args));
159
- (0, _defineProperty2.default)(_this2, "id", (0, _v.default)());
160
- (0, _defineProperty2.default)(_this2, "updateContentEditable", function (editorViewModeState, divElement) {
207
+ _this3 = _callSuper(this, BlockCard, [].concat(args));
208
+ (0, _defineProperty2.default)(_this3, "id", (0, _v.default)());
209
+ (0, _defineProperty2.default)(_this3, "updateContentEditable", function (editorViewModeState, divElement) {
161
210
  divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
162
211
  });
163
- return _this2;
212
+ return _this3;
164
213
  }
165
214
  (0, _inherits2.default)(BlockCard, _ReactNodeView);
166
215
  return (0, _createClass2.default)(BlockCard, [{
167
216
  key: "createDomRef",
168
217
  value: function createDomRef() {
169
218
  var _this$reactComponentP,
170
- _this3 = this,
219
+ _this4 = this,
171
220
  _this$reactComponentP2;
172
221
  var domRef = document.createElement('div');
173
222
  // workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
174
223
  // see also: https://github.com/ProseMirror/prosemirror/issues/884
175
- this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.sharedState.onChange(function (_ref2) {
176
- var nextSharedState = _ref2.nextSharedState;
177
- return _this3.updateContentEditable(nextSharedState, domRef);
224
+ this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.sharedState.onChange(function (_ref3) {
225
+ var nextSharedState = _ref3.nextSharedState;
226
+ return _this4.updateContentEditable(nextSharedState, domRef);
178
227
  });
179
228
  this.updateContentEditable((_this$reactComponentP2 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP2 === void 0 || (_this$reactComponentP2 = _this$reactComponentP2.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : _this$reactComponentP2.sharedState.currentState(), domRef);
180
229
  domRef.setAttribute('spellcheck', 'false');
@@ -206,7 +255,8 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
206
255
  pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
207
256
  onClickCallback = _this$reactComponentP3.onClickCallback,
208
257
  CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
209
- isPageSSRed = _this$reactComponentP3.isPageSSRed;
258
+ isPageSSRed = _this$reactComponentP3.isPageSSRed,
259
+ provider = _this$reactComponentP3.provider;
210
260
  return /*#__PURE__*/_react.default.createElement(WrappedBlockCard, {
211
261
  node: this.node,
212
262
  view: this.view,
@@ -216,7 +266,8 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
216
266
  onClickCallback: onClickCallback,
217
267
  id: this.id,
218
268
  CompetitorPrompt: CompetitorPrompt,
219
- isPageSSRed: isPageSSRed
269
+ isPageSSRed: isPageSSRed,
270
+ provider: provider
220
271
  });
221
272
  }
222
273
  }, {
@@ -228,15 +279,16 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
228
279
  }
229
280
  }]);
230
281
  }(_reactNodeView.default);
231
- var blockCardNodeView = exports.blockCardNodeView = function blockCardNodeView(_ref3) {
232
- var pmPluginFactoryParams = _ref3.pmPluginFactoryParams,
233
- actionOptions = _ref3.actionOptions,
234
- pluginInjectionApi = _ref3.pluginInjectionApi,
235
- onClickCallback = _ref3.onClickCallback,
236
- allowDatasource = _ref3.allowDatasource,
237
- inlineCardViewProducer = _ref3.inlineCardViewProducer,
238
- CompetitorPrompt = _ref3.CompetitorPrompt,
239
- isPageSSRed = _ref3.isPageSSRed;
282
+ var blockCardNodeView = exports.blockCardNodeView = function blockCardNodeView(_ref4) {
283
+ var pmPluginFactoryParams = _ref4.pmPluginFactoryParams,
284
+ actionOptions = _ref4.actionOptions,
285
+ pluginInjectionApi = _ref4.pluginInjectionApi,
286
+ onClickCallback = _ref4.onClickCallback,
287
+ allowDatasource = _ref4.allowDatasource,
288
+ inlineCardViewProducer = _ref4.inlineCardViewProducer,
289
+ CompetitorPrompt = _ref4.CompetitorPrompt,
290
+ isPageSSRed = _ref4.isPageSSRed,
291
+ provider = _ref4.provider;
240
292
  return function (node, view, getPos, decorations) {
241
293
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
242
294
  eventDispatcher = pmPluginFactoryParams.eventDispatcher;
@@ -245,7 +297,8 @@ var blockCardNodeView = exports.blockCardNodeView = function blockCardNodeView(_
245
297
  pluginInjectionApi: pluginInjectionApi,
246
298
  onClickCallback: onClickCallback,
247
299
  CompetitorPrompt: CompetitorPrompt,
248
- isPageSSRed: isPageSSRed
300
+ isPageSSRed: isPageSSRed,
301
+ provider: provider
249
302
  };
250
303
  var isDatasource = (0, _utils2.isDatasourceNode)(node);
251
304
  if (isDatasource) {
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.embedCardNodeView = exports.EmbedOrBlockCardComponent = exports.EmbedCardComponent = exports.EmbedCard = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
8
9
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
@@ -17,6 +19,7 @@ var _react = _interopRequireDefault(require("react"));
17
19
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
18
20
  var _v = _interopRequireDefault(require("uuid/v4"));
19
21
  var _steps = require("@atlaskit/adf-schema/steps");
22
+ var _editorCardProvider = require("@atlaskit/editor-card-provider");
20
23
  var _hooks = require("@atlaskit/editor-common/hooks");
21
24
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
22
25
  var _ui = require("@atlaskit/editor-common/ui");
@@ -139,7 +142,8 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
139
142
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
140
143
  (0, _defineProperty2.default)(_this, "embedIframeRef", /*#__PURE__*/_react.default.createRef());
141
144
  (0, _defineProperty2.default)(_this, "state", {
142
- hasPreview: true
145
+ hasPreview: true,
146
+ isSSRDataAvailable: false
143
147
  });
144
148
  (0, _defineProperty2.default)(_this, "getPosSafely", function () {
145
149
  var getPos = _this.props.getPos;
@@ -282,6 +286,46 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
282
286
  }
283
287
  (0, _inherits2.default)(EmbedCardComponent, _React$PureComponent);
284
288
  return (0, _createClass2.default)(EmbedCardComponent, [{
289
+ key: "componentDidMount",
290
+ value: function componentDidMount() {
291
+ var _this2 = this;
292
+ if (!(0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true)) {
293
+ return;
294
+ }
295
+ var provider = this.props.provider;
296
+ if (!provider) {
297
+ return;
298
+ }
299
+ var updateSSRDataAvailability = /*#__PURE__*/function () {
300
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
301
+ var resolvedProvider;
302
+ return _regenerator.default.wrap(function _callee$(_context) {
303
+ while (1) switch (_context.prev = _context.next) {
304
+ case 0:
305
+ _context.next = 2;
306
+ return provider;
307
+ case 2:
308
+ resolvedProvider = _context.sent;
309
+ if (resolvedProvider instanceof _editorCardProvider.EditorCardProvider) {
310
+ _this2.setState(function (state) {
311
+ return _objectSpread(_objectSpread({}, state), {}, {
312
+ isSSRDataAvailable: resolvedProvider.getCacheStatusForNode(_this2.props.node) === 'ssr'
313
+ });
314
+ });
315
+ }
316
+ case 4:
317
+ case "end":
318
+ return _context.stop();
319
+ }
320
+ }, _callee);
321
+ }));
322
+ return function updateSSRDataAvailability() {
323
+ return _ref3.apply(this, arguments);
324
+ };
325
+ }();
326
+ void updateSSRDataAvailability();
327
+ }
328
+ }, {
285
329
  key: "componentWillUnmount",
286
330
  value: function componentWillUnmount() {
287
331
  this.removeCard();
@@ -353,7 +397,8 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
353
397
  container: this.scrollContainer,
354
398
  embedIframeRef: this.embedIframeRef,
355
399
  actionOptions: actionOptions,
356
- CompetitorPrompt: CompetitorPrompt
400
+ CompetitorPrompt: CompetitorPrompt,
401
+ hideIconLoadingSkeleton: (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable
357
402
  }) : /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
358
403
  key: url,
359
404
  url: url,
@@ -412,7 +457,8 @@ var EmbedOrBlockCardComponent = exports.EmbedOrBlockCardComponent = function Emb
412
457
  hasPreview: props.hasPreview,
413
458
  liveHeight: props.liveHeight,
414
459
  initialAspectRatio: props.initialAspectRatio,
415
- isPageSSRed: props.isPageSSRed
460
+ isPageSSRed: props.isPageSSRed,
461
+ provider: props.provider
416
462
  }) : /*#__PURE__*/_react.default.createElement(EmbedCardComponent, {
417
463
  id: props.id,
418
464
  node: props.node,
@@ -431,7 +477,8 @@ var EmbedOrBlockCardComponent = exports.EmbedOrBlockCardComponent = function Emb
431
477
  hasPreview: props.hasPreview,
432
478
  liveHeight: props.liveHeight,
433
479
  initialAspectRatio: props.initialAspectRatio,
434
- isPageSSRed: props.isPageSSRed
480
+ isPageSSRed: props.isPageSSRed,
481
+ provider: props.provider
435
482
  });
436
483
  };
437
484
  var WrappedEmbedCardWithCondition = (0, _platformFeatureFlagsReact.componentWithCondition)(function () {
@@ -440,17 +487,17 @@ var WrappedEmbedCardWithCondition = (0, _platformFeatureFlagsReact.componentWith
440
487
  var WrappedEmbedCard = (0, _genericCard.Card)(WrappedEmbedCardWithCondition, _ui.UnsupportedBlock);
441
488
  var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
442
489
  function EmbedCard() {
443
- var _this2;
490
+ var _this3;
444
491
  (0, _classCallCheck2.default)(this, EmbedCard);
445
492
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
446
493
  args[_key] = arguments[_key];
447
494
  }
448
- _this2 = _callSuper(this, EmbedCard, [].concat(args));
449
- (0, _defineProperty2.default)(_this2, "id", (0, _v.default)());
450
- (0, _defineProperty2.default)(_this2, "updateContentEditable", function (editorViewModeState, divElement) {
495
+ _this3 = _callSuper(this, EmbedCard, [].concat(args));
496
+ (0, _defineProperty2.default)(_this3, "id", (0, _v.default)());
497
+ (0, _defineProperty2.default)(_this3, "updateContentEditable", function (editorViewModeState, divElement) {
451
498
  divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
452
499
  });
453
- return _this2;
500
+ return _this3;
454
501
  }
455
502
  (0, _inherits2.default)(EmbedCard, _ReactNodeView);
456
503
  return (0, _createClass2.default)(EmbedCard, [{
@@ -465,13 +512,13 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
465
512
  key: "createDomRef",
466
513
  value: function createDomRef() {
467
514
  var _this$reactComponentP,
468
- _this3 = this,
515
+ _this4 = this,
469
516
  _this$reactComponentP2;
470
517
  var domRef = document.createElement('div');
471
518
  // It is a tradeoff for the bug mentioned that occurs in Chrome: https://product-fabric.atlassian.net/browse/ED-5379, https://github.com/ProseMirror/prosemirror/issues/884
472
- this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.sharedState.onChange(function (_ref3) {
473
- var nextSharedState = _ref3.nextSharedState;
474
- return _this3.updateContentEditable(nextSharedState, domRef);
519
+ this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.sharedState.onChange(function (_ref4) {
520
+ var nextSharedState = _ref4.nextSharedState;
521
+ return _this4.updateContentEditable(nextSharedState, domRef);
475
522
  });
476
523
  this.updateContentEditable((_this$reactComponentP2 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP2 === void 0 || (_this$reactComponentP2 = _this$reactComponentP2.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : _this$reactComponentP2.sharedState.currentState(), domRef);
477
524
  domRef.setAttribute('spellcheck', 'false');
@@ -488,7 +535,8 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
488
535
  pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
489
536
  onClickCallback = _this$reactComponentP3.onClickCallback,
490
537
  CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
491
- isPageSSRed = _this$reactComponentP3.isPageSSRed;
538
+ isPageSSRed = _this$reactComponentP3.isPageSSRed,
539
+ provider = _this$reactComponentP3.provider;
492
540
  return /*#__PURE__*/_react.default.createElement(WrappedEmbedCard, {
493
541
  node: this.node,
494
542
  view: this.view,
@@ -501,7 +549,8 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
501
549
  onClickCallback: onClickCallback,
502
550
  id: this.id,
503
551
  CompetitorPrompt: CompetitorPrompt,
504
- isPageSSRed: isPageSSRed
552
+ isPageSSRed: isPageSSRed,
553
+ provider: provider
505
554
  });
506
555
  }
507
556
  }, {
@@ -513,15 +562,16 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
513
562
  }
514
563
  }]);
515
564
  }(_reactNodeView.default);
516
- var embedCardNodeView = exports.embedCardNodeView = function embedCardNodeView(_ref4) {
517
- var allowResizing = _ref4.allowResizing,
518
- fullWidthMode = _ref4.fullWidthMode,
519
- pmPluginFactoryParams = _ref4.pmPluginFactoryParams,
520
- pluginInjectionApi = _ref4.pluginInjectionApi,
521
- actionOptions = _ref4.actionOptions,
522
- onClickCallback = _ref4.onClickCallback,
523
- CompetitorPrompt = _ref4.CompetitorPrompt,
524
- isPageSSRed = _ref4.isPageSSRed;
565
+ var embedCardNodeView = exports.embedCardNodeView = function embedCardNodeView(_ref5) {
566
+ var allowResizing = _ref5.allowResizing,
567
+ fullWidthMode = _ref5.fullWidthMode,
568
+ pmPluginFactoryParams = _ref5.pmPluginFactoryParams,
569
+ pluginInjectionApi = _ref5.pluginInjectionApi,
570
+ actionOptions = _ref5.actionOptions,
571
+ onClickCallback = _ref5.onClickCallback,
572
+ CompetitorPrompt = _ref5.CompetitorPrompt,
573
+ isPageSSRed = _ref5.isPageSSRed,
574
+ provider = _ref5.provider;
525
575
  return function (node, view, getPos) {
526
576
  var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
527
577
  eventDispatcher = pmPluginFactoryParams.eventDispatcher,
@@ -535,7 +585,8 @@ var embedCardNodeView = exports.embedCardNodeView = function embedCardNodeView(_
535
585
  actionOptions: actionOptions,
536
586
  onClickCallback: onClickCallback,
537
587
  CompetitorPrompt: CompetitorPrompt,
538
- isPageSSRed: isPageSSRed
588
+ isPageSSRed: isPageSSRed,
589
+ provider: provider
539
590
  };
540
591
  return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps).init();
541
592
  };
@@ -8,16 +8,21 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.InlineCard = void 0;
9
9
  exports.InlineCardNodeView = InlineCardNodeView;
10
10
  exports.inlineCardNodeView = void 0;
11
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
15
  var _react = _interopRequireWildcard(require("react"));
13
16
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
14
17
  var _v = _interopRequireDefault(require("uuid/v4"));
18
+ var _editorCardProvider = require("@atlaskit/editor-card-provider");
15
19
  var _analytics = require("@atlaskit/editor-common/analytics");
16
20
  var _hooks = require("@atlaskit/editor-common/hooks");
17
21
  var _ui = require("@atlaskit/editor-common/ui");
18
22
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
23
  var _smartCard = require("@atlaskit/smart-card");
20
24
  var _ssr = require("@atlaskit/smart-card/ssr");
25
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
21
26
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
22
27
  var _actions = require("../pm-plugins/actions");
23
28
  var _utils = require("../pm-plugins/utils");
@@ -38,6 +43,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
38
43
  showHoverPreview = _ref.showHoverPreview,
39
44
  hoverPreviewOptions = _ref.hoverPreviewOptions,
40
45
  isPageSSRed = _ref.isPageSSRed,
46
+ provider = _ref.provider,
41
47
  pluginInjectionApi = _ref.pluginInjectionApi,
42
48
  disablePreviewPanel = _ref.disablePreviewPanel;
43
49
  var _node$attrs = node.attrs,
@@ -54,6 +60,42 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
54
60
  view.dispatch(tr);
55
61
  };
56
62
  }, [getPos, view]);
63
+ var _useState = (0, _react.useState)(false),
64
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
65
+ isSSRDataAvailable = _useState2[0],
66
+ setIsSSRDataAvailable = _useState2[1];
67
+ (0, _react.useEffect)(function () {
68
+ if (!(0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true)) {
69
+ return;
70
+ }
71
+ if (!provider) {
72
+ return;
73
+ }
74
+ var updateSSRDataAvailability = /*#__PURE__*/function () {
75
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
76
+ var resolvedProvider;
77
+ return _regenerator.default.wrap(function _callee$(_context) {
78
+ while (1) switch (_context.prev = _context.next) {
79
+ case 0:
80
+ _context.next = 2;
81
+ return provider;
82
+ case 2:
83
+ resolvedProvider = _context.sent;
84
+ if (resolvedProvider instanceof _editorCardProvider.EditorCardProvider) {
85
+ setIsSSRDataAvailable(resolvedProvider.getCacheStatusForNode(node) === 'ssr');
86
+ }
87
+ case 4:
88
+ case "end":
89
+ return _context.stop();
90
+ }
91
+ }, _callee);
92
+ }));
93
+ return function updateSSRDataAvailability() {
94
+ return _ref2.apply(this, arguments);
95
+ };
96
+ }();
97
+ void updateSSRDataAvailability();
98
+ }, [provider, node]);
57
99
  var scrollContainer = (0, _react.useMemo)(
58
100
  // Ignored via go/ees005
59
101
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
@@ -98,8 +140,8 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
98
140
  var handleOnClick = (0, _react.useCallback)(function (event) {
99
141
  if (event.metaKey || event.ctrlKey) {
100
142
  var _pluginInjectionApi$a;
101
- var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
102
- editorAnalyticsApi = _ref2.actions;
143
+ var _ref3 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
144
+ editorAnalyticsApi = _ref3.actions;
103
145
  (0, _toolbar.visitCardLinkAnalytics)(editorAnalyticsApi, _analytics.INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
104
146
  window.open(url, '_blank');
105
147
  } else {
@@ -125,7 +167,8 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
125
167
  isHovered: isHovered,
126
168
  showHoverPreview: showHoverPreview,
127
169
  hoverPreviewOptions: hoverPreviewOptions,
128
- disablePreviewPanel: disablePreviewPanel
170
+ disablePreviewPanel: disablePreviewPanel,
171
+ hideIconLoadingSkeleton: (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) && isSSRDataAvailable
129
172
  });
130
173
  }
131
174
  return /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
@@ -143,7 +186,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
143
186
  hoverPreviewOptions: hoverPreviewOptions,
144
187
  disablePreviewPanel: disablePreviewPanel
145
188
  });
146
- }, [url, data, onClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, disablePreviewPanel]);
189
+ }, [url, data, onClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, disablePreviewPanel, isSSRDataAvailable]);
147
190
 
148
191
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready,
149
192
  // otherwise if we got data, we can render the card directly since it doesn't need the Provider
@@ -188,6 +231,7 @@ function InlineCardNodeView(props) {
188
231
  pluginInjectionApi = props.pluginInjectionApi,
189
232
  onClickCallback = props.onClickCallback,
190
233
  isPageSSRed = props.isPageSSRed,
234
+ provider = props.provider,
191
235
  CompetitorPrompt = props.CompetitorPrompt;
192
236
  var _useSharedState = useSharedState(pluginInjectionApi),
193
237
  mode = _useSharedState.mode;
@@ -205,13 +249,14 @@ function InlineCardNodeView(props) {
205
249
  pluginInjectionApi: pluginInjectionApi,
206
250
  onClickCallback: onClickCallback,
207
251
  isPageSSRed: isPageSSRed,
252
+ provider: provider,
208
253
  appearance: "inline"
209
254
  // Ignored via go/ees005
210
255
  // eslint-disable-next-line react/jsx-props-no-spreading
211
256
  }, enableInlineUpgradeFeatures && (0, _utils.getAwarenessProps)(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), (0, _platformFeatureFlags.fg)('prompt_whiteboard_competitor_link_gate') && CompetitorPromptComponent);
212
257
  }
213
- var inlineCardNodeView = exports.inlineCardNodeView = function inlineCardNodeView(_ref3) {
214
- var inlineCardViewProducer = _ref3.inlineCardViewProducer;
258
+ var inlineCardNodeView = exports.inlineCardNodeView = function inlineCardNodeView(_ref4) {
259
+ var inlineCardViewProducer = _ref4.inlineCardViewProducer;
215
260
  return function (node, view, getPos, decorations) {
216
261
  return inlineCardViewProducer(node, view, getPos, decorations);
217
262
  };
@@ -52,6 +52,7 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
52
52
  isOverlayEnabled = _ref.isOverlayEnabled,
53
53
  isSelected = _ref.isSelected,
54
54
  isPageSSRed = _ref.isPageSSRed,
55
+ provider = _ref.provider,
55
56
  appearance = _ref.appearance;
56
57
  var _useState = (0, _react.useState)(false),
57
58
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -116,10 +117,11 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
116
117
  cardContext: cardContext,
117
118
  isHovered: isHovered,
118
119
  isPageSSRed: isPageSSRed,
120
+ provider: provider,
119
121
  pluginInjectionApi: pluginInjectionApi,
120
122
  disablePreviewPanel: true
121
123
  }));
122
- }, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, pluginInjectionApi]);
124
+ }, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, provider, pluginInjectionApi]);
123
125
  var innerCardOriginal = (0, _react.useMemo)(function () {
124
126
  return /*#__PURE__*/_react.default.createElement(_inlineCard.InlineCard, {
125
127
  node: node,
@@ -132,10 +134,11 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
132
134
  cardContext: cardContext,
133
135
  isHovered: isHovered,
134
136
  isPageSSRed: isPageSSRed,
137
+ provider: provider,
135
138
  pluginInjectionApi: pluginInjectionApi,
136
139
  showHoverPreview: false
137
140
  });
138
- }, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi]);
141
+ }, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, provider, pluginInjectionApi]);
139
142
  var shouldShowOpenButtonOverlay = (0, _react.useMemo)(function () {
140
143
  var shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless';
141
144
  return (mode === 'edit' || editorAppearance === 'comment' || shouldShowOpenButtonOverlayInChomeless) && ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') || (0, _expValEquals.expValEquals)('platform_editor_preview_panel_linking_exp', 'isEnabled', true));
@@ -200,6 +203,7 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
200
203
  cardContext: cardContext,
201
204
  isHovered: isHovered,
202
205
  isPageSSRed: isPageSSRed,
206
+ provider: provider,
203
207
  pluginInjectionApi: pluginInjectionApi,
204
208
  showHoverPreview: mode === 'view' && showHoverPreview,
205
209
  disablePreviewPanel: true
@@ -216,6 +220,7 @@ var InlineCardWithAwareness = exports.InlineCardWithAwareness = /*#__PURE__*/(0,
216
220
  cardContext: cardContext,
217
221
  isHovered: isHovered,
218
222
  isPageSSRed: isPageSSRed,
223
+ provider: provider,
219
224
  pluginInjectionApi: pluginInjectionApi,
220
225
  showHoverPreview: mode === 'view' && showHoverPreview
221
226
  });
@@ -54,6 +54,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
54
54
  allowBlockCards = options.allowBlockCards,
55
55
  onClickCallback = options.onClickCallback,
56
56
  isPageSSRed = options.isPageSSRed,
57
+ provider = options.provider,
57
58
  CompetitorPrompt = options.CompetitorPrompt;
58
59
  var enableInlineUpgradeFeatures = !!showUpgradeDiscoverability;
59
60
  var inlineCardViewProducer = (0, _reactNodeView.getInlineNodeViewProducer)({
@@ -68,6 +69,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
68
69
  pluginInjectionApi: pluginInjectionApi,
69
70
  onClickCallback: onClickCallback,
70
71
  isPageSSRed: isPageSSRed,
72
+ provider: provider,
71
73
  CompetitorPrompt: CompetitorPrompt
72
74
  }
73
75
  });
@@ -196,7 +198,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
196
198
  // Find requests in this state that weren't in the old one.
197
199
  var newRequests = (0, _state2.getNewRequests)(oldState, currentState);
198
200
  // Ask the CardProvider to resolve all new requests.
199
- var provider = currentState.provider;
201
+ var _provider = currentState.provider;
200
202
  newRequests.forEach(function (request) {
201
203
  /**
202
204
  * Queue each asynchronous resolve request on separate frames.
@@ -209,7 +211,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
209
211
  */
210
212
  var invoke = (0, _rafSchd.default)(function () {
211
213
  var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3;
212
- return (0, _resolve.resolveWithProvider)(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 || (_pluginInjectionApi$a3 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined);
214
+ return (0, _resolve.resolveWithProvider)(view, _provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 || (_pluginInjectionApi$a3 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined);
213
215
  });
214
216
  rafCancellationCallbacks.push(invoke.cancel);
215
217
  invoke();
@@ -236,6 +238,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
236
238
  inlineCard: (0, _lazyInlineCard.lazyInlineCardView)({
237
239
  inlineCardViewProducer: inlineCardViewProducer,
238
240
  isPageSSRed: isPageSSRed
241
+ // no need provider here, it's in the inlineCardViewProducer.extraComponentProps
239
242
  }),
240
243
  blockCard: (0, _lazyBlockCard.lazyBlockCardView)({
241
244
  pmPluginFactoryParams: pmPluginFactoryParams,
@@ -245,6 +248,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
245
248
  allowDatasource: options.allowDatasource,
246
249
  inlineCardViewProducer: inlineCardViewProducer,
247
250
  isPageSSRed: isPageSSRed,
251
+ provider: provider,
248
252
  CompetitorPrompt: options.CompetitorPrompt
249
253
  }),
250
254
  embedCard: (0, _lazyEmbedCard.lazyEmbedCardView)({
@@ -255,6 +259,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
255
259
  actionOptions: actionOptions,
256
260
  onClickCallback: options.onClickCallback,
257
261
  isPageSSRed: isPageSSRed,
262
+ provider: provider,
258
263
  CompetitorPrompt: options.CompetitorPrompt
259
264
  })
260
265
  }