@atlaskit/editor-card-provider 6.8.12 → 6.8.14

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,26 @@
1
1
  # @atlaskit/editor-card-provider
2
2
 
3
+ ## 6.8.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 6.8.13
10
+
11
+ ### Patch Changes
12
+
13
+ - [`fdea0f8bc06c4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fdea0f8bc06c4) -
14
+ Thread appearance parameter through provider to support ORS optimized response payloads for smart
15
+ card inline resolve optimization.
16
+ - [`fdea0f8bc06c4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fdea0f8bc06c4) -
17
+ Gate the appearance argument in fetchNodesData behind the
18
+ platform_smartlink_inline_resolve_optimization flag. Previously, appearance was unconditionally
19
+ passed to cardClient.fetchData, causing shouldUseParentFetchData to always be true via this path
20
+ and bypassing the editorCardProvider SSR cache and Confluence-specific optimizations when the flag
21
+ was off.
22
+ - Updated dependencies
23
+
3
24
  ## 6.8.12
4
25
 
5
26
  ### Patch Changes
@@ -195,6 +195,9 @@ function isInternalUrl(url) {
195
195
  function isExternalUrl(url) {
196
196
  return !isInternalUrl(url);
197
197
  }
198
+ function getAppearanceForNode(node) {
199
+ return node.type === 'blockCard' ? 'block' : node.type === 'embedCard' ? 'embed' : 'inline';
200
+ }
198
201
  function isCardNode(node) {
199
202
  return ['inlineCard', 'blockCard', 'embedCard'].includes(node.type) && !!node.attrs && 'url' in node.attrs && typeof node.attrs.url === 'string';
200
203
  }
@@ -279,9 +282,10 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_No
279
282
  }, {
280
283
  key: "nodeDataKey",
281
284
  value: function nodeDataKey(node) {
282
- // We can use URL as a key here, because CardClient returns the same data for the same URL
283
- // regardless of the type of card (inline, block, embed).
284
- return node.attrs.url;
285
+ if (!(0, _platformFeatureFlags.fg)('platform_smartlink_inline_resolve_optimization')) {
286
+ return node.attrs.url;
287
+ }
288
+ return "".concat(node.attrs.url, "|").concat(getAppearanceForNode(node));
285
289
  }
286
290
  }, {
287
291
  key: "fetchNodesData",
@@ -289,7 +293,8 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_No
289
293
  var _this3 = this;
290
294
  var promises = nodes.map(function (node) {
291
295
  var url = node.attrs.url;
292
- return _this3.cardClient.fetchData(url);
296
+ var appearance = (0, _platformFeatureFlags.fg)('platform_smartlink_inline_resolve_optimization') ? getAppearanceForNode(node) : undefined;
297
+ return _this3.cardClient.fetchData(url, false, appearance);
293
298
  });
294
299
  return Promise.all(promises);
295
300
  }
@@ -118,6 +118,9 @@ export function isInternalUrl(url) {
118
118
  export function isExternalUrl(url) {
119
119
  return !isInternalUrl(url);
120
120
  }
121
+ function getAppearanceForNode(node) {
122
+ return node.type === 'blockCard' ? 'block' : node.type === 'embedCard' ? 'embed' : 'inline';
123
+ }
121
124
  function isCardNode(node) {
122
125
  return ['inlineCard', 'blockCard', 'embedCard'].includes(node.type) && !!node.attrs && 'url' in node.attrs && typeof node.attrs.url === 'string';
123
126
  }
@@ -187,14 +190,16 @@ export class EditorCardProvider extends NodeDataProvider {
187
190
  });
188
191
  }
189
192
  nodeDataKey(node) {
190
- // We can use URL as a key here, because CardClient returns the same data for the same URL
191
- // regardless of the type of card (inline, block, embed).
192
- return node.attrs.url;
193
+ if (!fg('platform_smartlink_inline_resolve_optimization')) {
194
+ return node.attrs.url;
195
+ }
196
+ return `${node.attrs.url}|${getAppearanceForNode(node)}`;
193
197
  }
194
198
  fetchNodesData(nodes) {
195
199
  const promises = nodes.map(node => {
196
200
  const url = node.attrs.url;
197
- return this.cardClient.fetchData(url);
201
+ const appearance = fg('platform_smartlink_inline_resolve_optimization') ? getAppearanceForNode(node) : undefined;
202
+ return this.cardClient.fetchData(url, false, appearance);
198
203
  });
199
204
  return Promise.all(promises);
200
205
  }
@@ -187,6 +187,9 @@ export function isInternalUrl(url) {
187
187
  export function isExternalUrl(url) {
188
188
  return !isInternalUrl(url);
189
189
  }
190
+ function getAppearanceForNode(node) {
191
+ return node.type === 'blockCard' ? 'block' : node.type === 'embedCard' ? 'embed' : 'inline';
192
+ }
190
193
  function isCardNode(node) {
191
194
  return ['inlineCard', 'blockCard', 'embedCard'].includes(node.type) && !!node.attrs && 'url' in node.attrs && typeof node.attrs.url === 'string';
192
195
  }
@@ -271,9 +274,10 @@ export var EditorCardProvider = /*#__PURE__*/function (_NodeDataProvider) {
271
274
  }, {
272
275
  key: "nodeDataKey",
273
276
  value: function nodeDataKey(node) {
274
- // We can use URL as a key here, because CardClient returns the same data for the same URL
275
- // regardless of the type of card (inline, block, embed).
276
- return node.attrs.url;
277
+ if (!fg('platform_smartlink_inline_resolve_optimization')) {
278
+ return node.attrs.url;
279
+ }
280
+ return "".concat(node.attrs.url, "|").concat(getAppearanceForNode(node));
277
281
  }
278
282
  }, {
279
283
  key: "fetchNodesData",
@@ -281,7 +285,8 @@ export var EditorCardProvider = /*#__PURE__*/function (_NodeDataProvider) {
281
285
  var _this3 = this;
282
286
  var promises = nodes.map(function (node) {
283
287
  var url = node.attrs.url;
284
- return _this3.cardClient.fetchData(url);
288
+ var appearance = fg('platform_smartlink_inline_resolve_optimization') ? getAppearanceForNode(node) : undefined;
289
+ return _this3.cardClient.fetchData(url, false, appearance);
285
290
  });
286
291
  return Promise.all(promises);
287
292
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-card-provider",
3
- "version": "6.8.12",
3
+ "version": "6.8.14",
4
4
  "description": "Contains the EditorCardProvider, for determining smart card behaviour in the editor.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,12 +39,12 @@
39
39
  "@atlaskit/linking-types": "^14.4.0",
40
40
  "@atlaskit/node-data-provider": "^12.0.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
- "@atlaskit/tmp-editor-statsig": "^93.0.0",
42
+ "@atlaskit/tmp-editor-statsig": "^94.0.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "dataloader": "^2.1.0"
45
45
  },
46
46
  "peerDependencies": {
47
- "@atlaskit/link-provider": "^4.6.0",
47
+ "@atlaskit/link-provider": "^4.7.0",
48
48
  "react": "^18.2.0"
49
49
  },
50
50
  "devDependencies": {
@@ -61,6 +61,9 @@
61
61
  "avp_unfurl_shared_charts_embed_by_default_2": {
62
62
  "type": "boolean"
63
63
  },
64
+ "platform_smartlink_inline_resolve_optimization": {
65
+ "type": "boolean"
66
+ },
64
67
  "loom-support-screenshot-sl-resolution": {
65
68
  "type": "boolean"
66
69
  }