@atlaskit/editor-plugin-card 11.0.2 → 11.1.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
+ ## 11.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`1288c1bfb6ef4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1288c1bfb6ef4) -
8
+ [https://product-fabric.atlassian.net/browse/ED-29443](ED-29443) - render SmartCard instead of
9
+ CardSSR if no smart card SSR data available
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 11.0.2
4
16
 
5
17
  ### Patch Changes
@@ -167,7 +167,7 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
167
167
  var _node$attrs = node.attrs,
168
168
  url = _node$attrs.url,
169
169
  data = _node$attrs.data;
170
- 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, {
170
+ var cardInner = (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable && isPageSSRed ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
171
171
  key: url,
172
172
  url: url !== null && url !== void 0 ? url : data.url,
173
173
  container: this.scrollContainer,
@@ -178,7 +178,7 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
178
178
  platform: 'web',
179
179
  actionOptions: actionOptions,
180
180
  CompetitorPrompt: CompetitorPrompt,
181
- hideIconLoadingSkeleton: (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable
181
+ hideIconLoadingSkeleton: true
182
182
  }), this.gapCursorSpan()) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
183
183
  key: url,
184
184
  url: url !== null && url !== void 0 ? url : data.url,
@@ -373,7 +373,7 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
373
373
  pctWidth: pctWidth,
374
374
  fullWidthMode: fullWidthMode
375
375
  };
376
- var smartCard = isPageSSRed && (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
376
+ var smartCard = (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable && isPageSSRed ? /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
377
377
  key: url,
378
378
  url: url,
379
379
  appearance: "embed",
@@ -387,7 +387,7 @@ var EmbedCardComponent = exports.EmbedCardComponent = /*#__PURE__*/function (_Re
387
387
  embedIframeRef: this.embedIframeRef,
388
388
  actionOptions: actionOptions,
389
389
  CompetitorPrompt: CompetitorPrompt,
390
- hideIconLoadingSkeleton: (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable
390
+ hideIconLoadingSkeleton: true
391
391
  }) : /*#__PURE__*/_react.default.createElement(_smartCard.Card, {
392
392
  key: url,
393
393
  url: url,
@@ -153,7 +153,10 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
153
153
  exposure: true
154
154
  }) ? handleOnClick : propsOnClick;
155
155
  var card = (0, _react.useMemo)(function () {
156
- if (isPageSSRed && url) {
156
+ if (
157
+ // The `isSSRDataAvailable` check is only required when the OTP experiment is on,
158
+ // because inline smart card SSR is already implemented without OTP.
159
+ ((0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) ? isSSRDataAvailable : true) && isPageSSRed && url) {
157
160
  return /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
158
161
  key: url,
159
162
  url: url,
@@ -167,7 +170,10 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
167
170
  isHovered: isHovered,
168
171
  showHoverPreview: showHoverPreview,
169
172
  hoverPreviewOptions: hoverPreviewOptions,
170
- disablePreviewPanel: disablePreviewPanel,
173
+ disablePreviewPanel: disablePreviewPanel
174
+ // Durin `platform_editor_smart_card_otp` cleaning up, replace this with `true`.
175
+ // Ths `isSSRDataAvailable` should be checked in the `if` condition above.
176
+ ,
171
177
  hideIconLoadingSkeleton: (0, _expValEquals.expValEquals)('platform_editor_smart_card_otp', 'isEnabled', true) && isSSRDataAvailable
172
178
  });
173
179
  }
@@ -44,10 +44,13 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
44
44
  return (
45
45
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
46
46
  (0, _react2.jsx)("span", {
47
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
47
48
  onMouseEnter: function onMouseEnter() {
48
49
  setShowConfigureButton(true);
49
50
  hoverCallback(true);
50
- },
51
+ }
52
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
53
+ ,
51
54
  onMouseLeave: function onMouseLeave() {
52
55
  if (!dropdownOpen) {
53
56
  setShowConfigureButton(false);
@@ -124,7 +124,7 @@ export class BlockCardComponent extends React.PureComponent {
124
124
  url,
125
125
  data
126
126
  } = node.attrs;
127
- const cardInner = isPageSSRed && expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardSSR, {
127
+ const cardInner = expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable && isPageSSRed ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardSSR, {
128
128
  key: url,
129
129
  url: url !== null && url !== void 0 ? url : data.url,
130
130
  container: this.scrollContainer,
@@ -135,7 +135,7 @@ export class BlockCardComponent extends React.PureComponent {
135
135
  platform: 'web',
136
136
  actionOptions: actionOptions,
137
137
  CompetitorPrompt: CompetitorPrompt,
138
- hideIconLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable
138
+ hideIconLoadingSkeleton: true
139
139
  }), this.gapCursorSpan()) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SmartCard, {
140
140
  key: url,
141
141
  url: url !== null && url !== void 0 ? url : data.url,
@@ -341,7 +341,7 @@ export class EmbedCardComponent extends React.PureComponent {
341
341
  pctWidth,
342
342
  fullWidthMode
343
343
  };
344
- const smartCard = isPageSSRed && expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/React.createElement(CardSSR, {
344
+ const smartCard = expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable && isPageSSRed ? /*#__PURE__*/React.createElement(CardSSR, {
345
345
  key: url,
346
346
  url: url,
347
347
  appearance: "embed",
@@ -355,7 +355,7 @@ export class EmbedCardComponent extends React.PureComponent {
355
355
  embedIframeRef: this.embedIframeRef,
356
356
  actionOptions: actionOptions,
357
357
  CompetitorPrompt: CompetitorPrompt,
358
- hideIconLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable
358
+ hideIconLoadingSkeleton: true
359
359
  }) : /*#__PURE__*/React.createElement(SmartCard, {
360
360
  key: url,
361
361
  url: url,
@@ -126,7 +126,10 @@ export const InlineCard = /*#__PURE__*/memo(({
126
126
  exposure: true
127
127
  }) ? handleOnClick : propsOnClick;
128
128
  const card = useMemo(() => {
129
- if (isPageSSRed && url) {
129
+ if (
130
+ // The `isSSRDataAvailable` check is only required when the OTP experiment is on,
131
+ // because inline smart card SSR is already implemented without OTP.
132
+ (expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ? isSSRDataAvailable : true) && isPageSSRed && url) {
130
133
  return /*#__PURE__*/React.createElement(CardSSR, {
131
134
  key: url,
132
135
  url: url,
@@ -140,7 +143,10 @@ export const InlineCard = /*#__PURE__*/memo(({
140
143
  isHovered: isHovered,
141
144
  showHoverPreview: showHoverPreview,
142
145
  hoverPreviewOptions: hoverPreviewOptions,
143
- disablePreviewPanel: disablePreviewPanel,
146
+ disablePreviewPanel: disablePreviewPanel
147
+ // Durin `platform_editor_smart_card_otp` cleaning up, replace this with `true`.
148
+ // Ths `isSSRDataAvailable` should be checked in the `if` condition above.
149
+ ,
144
150
  hideIconLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && isSSRDataAvailable
145
151
  });
146
152
  }
@@ -30,10 +30,13 @@ const OverlayWrapper = ({
30
30
  return (
31
31
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
32
32
  jsx("span", {
33
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
33
34
  onMouseEnter: () => {
34
35
  setShowConfigureButton(true);
35
36
  hoverCallback(true);
36
- },
37
+ }
38
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
39
+ ,
37
40
  onMouseLeave: () => {
38
41
  if (!dropdownOpen) {
39
42
  setShowConfigureButton(false);
@@ -160,7 +160,7 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
160
160
  var _node$attrs = node.attrs,
161
161
  url = _node$attrs.url,
162
162
  data = _node$attrs.data;
163
- var cardInner = isPageSSRed && expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardSSR, {
163
+ var cardInner = expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable && isPageSSRed ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardSSR, {
164
164
  key: url,
165
165
  url: url !== null && url !== void 0 ? url : data.url,
166
166
  container: this.scrollContainer,
@@ -171,7 +171,7 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
171
171
  platform: 'web',
172
172
  actionOptions: actionOptions,
173
173
  CompetitorPrompt: CompetitorPrompt,
174
- hideIconLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable
174
+ hideIconLoadingSkeleton: true
175
175
  }), this.gapCursorSpan()) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SmartCard, {
176
176
  key: url,
177
177
  url: url !== null && url !== void 0 ? url : data.url,
@@ -366,7 +366,7 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
366
366
  pctWidth: pctWidth,
367
367
  fullWidthMode: fullWidthMode
368
368
  };
369
- var smartCard = isPageSSRed && expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ? /*#__PURE__*/React.createElement(CardSSR, {
369
+ var smartCard = expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable && isPageSSRed ? /*#__PURE__*/React.createElement(CardSSR, {
370
370
  key: url,
371
371
  url: url,
372
372
  appearance: "embed",
@@ -380,7 +380,7 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
380
380
  embedIframeRef: this.embedIframeRef,
381
381
  actionOptions: actionOptions,
382
382
  CompetitorPrompt: CompetitorPrompt,
383
- hideIconLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable
383
+ hideIconLoadingSkeleton: true
384
384
  }) : /*#__PURE__*/React.createElement(SmartCard, {
385
385
  key: url,
386
386
  url: url,
@@ -142,7 +142,10 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
142
142
  exposure: true
143
143
  }) ? handleOnClick : propsOnClick;
144
144
  var card = useMemo(function () {
145
- if (isPageSSRed && url) {
145
+ if (
146
+ // The `isSSRDataAvailable` check is only required when the OTP experiment is on,
147
+ // because inline smart card SSR is already implemented without OTP.
148
+ (expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) ? isSSRDataAvailable : true) && isPageSSRed && url) {
146
149
  return /*#__PURE__*/React.createElement(CardSSR, {
147
150
  key: url,
148
151
  url: url,
@@ -156,7 +159,10 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
156
159
  isHovered: isHovered,
157
160
  showHoverPreview: showHoverPreview,
158
161
  hoverPreviewOptions: hoverPreviewOptions,
159
- disablePreviewPanel: disablePreviewPanel,
162
+ disablePreviewPanel: disablePreviewPanel
163
+ // Durin `platform_editor_smart_card_otp` cleaning up, replace this with `true`.
164
+ // Ths `isSSRDataAvailable` should be checked in the `if` condition above.
165
+ ,
160
166
  hideIconLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && isSSRDataAvailable
161
167
  });
162
168
  }
@@ -36,10 +36,13 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
36
36
  return (
37
37
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
38
38
  jsx("span", {
39
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
39
40
  onMouseEnter: function onMouseEnter() {
40
41
  setShowConfigureButton(true);
41
42
  hoverCallback(true);
42
- },
43
+ }
44
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
45
+ ,
43
46
  onMouseLeave: function onMouseLeave() {
44
47
  if (!dropdownOpen) {
45
48
  setShowConfigureButton(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "11.0.2",
3
+ "version": "11.1.0",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -61,7 +61,7 @@
61
61
  "@atlaskit/primitives": "^14.15.0",
62
62
  "@atlaskit/smart-card": "^42.3.0",
63
63
  "@atlaskit/theme": "^21.0.0",
64
- "@atlaskit/tmp-editor-statsig": "^12.32.0",
64
+ "@atlaskit/tmp-editor-statsig": "^12.33.0",
65
65
  "@atlaskit/tokens": "^6.4.0",
66
66
  "@babel/runtime": "^7.0.0",
67
67
  "@emotion/react": "^11.7.1",
@@ -71,7 +71,7 @@
71
71
  "uuid": "^3.1.0"
72
72
  },
73
73
  "peerDependencies": {
74
- "@atlaskit/editor-common": "^110.3.0",
74
+ "@atlaskit/editor-common": "^110.4.0",
75
75
  "@atlaskit/link-provider": "^4.0.0",
76
76
  "react": "^18.2.0",
77
77
  "react-intl-next": "npm:react-intl@^5.18.1"