@atlaskit/editor-card-provider 6.8.22 → 6.8.24

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,19 @@
1
1
  # @atlaskit/editor-card-provider
2
2
 
3
+ ## 6.8.24
4
+
5
+ ### Patch Changes
6
+
7
+ - [`027beb2f61316`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/027beb2f61316) -
8
+ Update smart link appearance, if and only if smart link is created from confluence editor quick
9
+ insert menu
10
+
11
+ ## 6.8.23
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 6.8.22
4
18
 
5
19
  ### Patch Changes
@@ -698,7 +698,23 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_No
698
698
  return _canBeResolvedAsEmbed.apply(this, arguments);
699
699
  }
700
700
  return canBeResolvedAsEmbed;
701
- }())
701
+ }()
702
+ /**
703
+ * Opt-in hook: when a caller explicitly requests an `'embed'` appearance and the
704
+ * user has no saved preference for the URL, honour that request as the default
705
+ * (above any provider default), validating embeddability first and falling back
706
+ * to a card (`'block'`) when the link cannot be embedded.
707
+ *
708
+ * Defaults to `false` so behaviour is unchanged for every existing consumer.
709
+ * Subclasses (e.g. Confluence) can override this to opt in, typically behind an
710
+ * experiment.
711
+ */
712
+ )
713
+ }, {
714
+ key: "shouldHonorRequestedEmbedAsDefault",
715
+ value: function shouldHonorRequestedEmbedAsDefault() {
716
+ return false;
717
+ }
702
718
  }, {
703
719
  key: "getAuthStatusFromResolveResponse",
704
720
  value: function () {
@@ -787,7 +803,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_No
787
803
  key: "resolve",
788
804
  value: function () {
789
805
  var _resolve = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(url, appearance, shouldForceAppearance, isEmbedFriendlyLocation) {
790
- var hardCodedAppearance, _yield$Promise$all, _yield$Promise$all2, matchedProviderPattern, userPreference, data, issueAri, _this$onResolve, isSupported, providerDefaultAppearance, isEmbedFriendlyLocationEvaluated, preferredAppearance, canItBeEmbed, datasource, id, parameters, authStatus, access, _t8, _t9;
806
+ var hardCodedAppearance, _yield$Promise$all, _yield$Promise$all2, matchedProviderPattern, userPreference, data, issueAri, _this$onResolve, isSupported, providerDefaultAppearance, isEmbedFriendlyLocationEvaluated, preferredAppearance, canItBeEmbed, _canItBeEmbed, datasource, id, parameters, authStatus, access, _t8, _t9;
791
807
  return _regenerator.default.wrap(function (_context11) {
792
808
  while (1) switch (_context11.prev = _context11.next) {
793
809
  case 0:
@@ -843,7 +859,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_No
843
859
  case 7:
844
860
  isSupported = _t8;
845
861
  if (!isSupported) {
846
- _context11.next = 14;
862
+ _context11.next = 16;
847
863
  break;
848
864
  }
849
865
  providerDefaultAppearance = matchedProviderPattern === null || matchedProviderPattern === void 0 ? void 0 : matchedProviderPattern.defaultView;
@@ -873,12 +889,22 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_No
873
889
  preferredAppearance = 'inline';
874
890
  }
875
891
  case 9:
892
+ if (!(!userPreference && appearance === 'embed' && isEmbedFriendlyLocationEvaluated && this.shouldHonorRequestedEmbedAsDefault())) {
893
+ _context11.next = 11;
894
+ break;
895
+ }
876
896
  _context11.next = 10;
877
- return this.getDatasourceFromResolveResponse(url);
897
+ return this.canBeResolvedAsEmbed(url);
878
898
  case 10:
899
+ _canItBeEmbed = _context11.sent;
900
+ preferredAppearance = _canItBeEmbed ? 'embed' : 'block';
901
+ case 11:
902
+ _context11.next = 12;
903
+ return this.getDatasourceFromResolveResponse(url);
904
+ case 12:
879
905
  datasource = _context11.sent;
880
906
  if (!datasource) {
881
- _context11.next = 11;
907
+ _context11.next = 13;
882
908
  break;
883
909
  }
884
910
  id = datasource.id, parameters = datasource.parameters;
@@ -891,42 +917,42 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_No
891
917
  type: 'table'
892
918
  }]
893
919
  }, url));
894
- case 11:
920
+ case 13:
895
921
  if (!(isEmbedFriendlyLocationEvaluated && !userPreference)) {
896
- _context11.next = 13;
922
+ _context11.next = 15;
897
923
  break;
898
924
  }
899
- _context11.next = 12;
925
+ _context11.next = 14;
900
926
  return this.getAuthStatusFromResolveResponse(url);
901
- case 12:
927
+ case 14:
902
928
  authStatus = _context11.sent;
903
929
  if (!authStatus) {
904
- _context11.next = 13;
930
+ _context11.next = 15;
905
931
  break;
906
932
  }
907
933
  access = authStatus.access;
908
934
  if (!(access === 'unauthorized')) {
909
- _context11.next = 13;
935
+ _context11.next = 15;
910
936
  break;
911
937
  }
912
938
  return _context11.abrupt("return", this.transformer.toSmartlinkAdf(url, 'block'));
913
- case 13:
939
+ case 15:
914
940
  return _context11.abrupt("return", this.transformer.toSmartlinkAdf(url, preferredAppearance));
915
- case 14:
916
- _context11.next = 16;
941
+ case 16:
942
+ _context11.next = 18;
917
943
  break;
918
- case 15:
919
- _context11.prev = 15;
944
+ case 17:
945
+ _context11.prev = 17;
920
946
  _t9 = _context11["catch"](0);
921
947
  // eslint-disable-next-line
922
948
  console.warn("Error when trying to check Smart Card url \"".concat(url, "\"").concat(_t9 instanceof Error ? " - ".concat(_t9.name, " ").concat(_t9.message) : ''), _t9);
923
- case 16:
949
+ case 18:
924
950
  return _context11.abrupt("return", Promise.reject(undefined));
925
- case 17:
951
+ case 19:
926
952
  case "end":
927
953
  return _context11.stop();
928
954
  }
929
- }, _callee11, this, [[0, 15]]);
955
+ }, _callee11, this, [[0, 17]]);
930
956
  }));
931
957
  function resolve(_x1, _x10, _x11, _x12) {
932
958
  return _resolve.apply(this, arguments);
@@ -362,6 +362,20 @@ export class EditorCardProvider extends NodeDataProvider {
362
362
  return false;
363
363
  }
364
364
  }
365
+
366
+ /**
367
+ * Opt-in hook: when a caller explicitly requests an `'embed'` appearance and the
368
+ * user has no saved preference for the URL, honour that request as the default
369
+ * (above any provider default), validating embeddability first and falling back
370
+ * to a card (`'block'`) when the link cannot be embedded.
371
+ *
372
+ * Defaults to `false` so behaviour is unchanged for every existing consumer.
373
+ * Subclasses (e.g. Confluence) can override this to opt in, typically behind an
374
+ * experiment.
375
+ */
376
+ shouldHonorRequestedEmbedAsDefault() {
377
+ return false;
378
+ }
365
379
  async getAuthStatusFromResolveResponse(url) {
366
380
  try {
367
381
  const {
@@ -450,6 +464,17 @@ export class EditorCardProvider extends NodeDataProvider {
450
464
  preferredAppearance = 'inline';
451
465
  }
452
466
  }
467
+
468
+ // When a caller explicitly requested an embed (e.g. Confluence's quick-insert
469
+ // embed flow tags the inserted link) and the user has no saved preference for
470
+ // this URL, honour embed-by-default above the provider default — but only in an
471
+ // embed-friendly location (matching how hard-coded embeds are gated above) and
472
+ // only when the link can actually be embedded, otherwise fall back to a card.
473
+ // Gated behind a default-off opt-in hook so other consumers are unaffected.
474
+ if (!userPreference && appearance === 'embed' && isEmbedFriendlyLocationEvaluated && this.shouldHonorRequestedEmbedAsDefault()) {
475
+ const canItBeEmbed = await this.canBeResolvedAsEmbed(url);
476
+ preferredAppearance = canItBeEmbed ? 'embed' : 'block';
477
+ }
453
478
  const datasource = await this.getDatasourceFromResolveResponse(url);
454
479
  if (datasource) {
455
480
  const {
@@ -690,7 +690,23 @@ export var EditorCardProvider = /*#__PURE__*/function (_NodeDataProvider) {
690
690
  return _canBeResolvedAsEmbed.apply(this, arguments);
691
691
  }
692
692
  return canBeResolvedAsEmbed;
693
- }())
693
+ }()
694
+ /**
695
+ * Opt-in hook: when a caller explicitly requests an `'embed'` appearance and the
696
+ * user has no saved preference for the URL, honour that request as the default
697
+ * (above any provider default), validating embeddability first and falling back
698
+ * to a card (`'block'`) when the link cannot be embedded.
699
+ *
700
+ * Defaults to `false` so behaviour is unchanged for every existing consumer.
701
+ * Subclasses (e.g. Confluence) can override this to opt in, typically behind an
702
+ * experiment.
703
+ */
704
+ )
705
+ }, {
706
+ key: "shouldHonorRequestedEmbedAsDefault",
707
+ value: function shouldHonorRequestedEmbedAsDefault() {
708
+ return false;
709
+ }
694
710
  }, {
695
711
  key: "getAuthStatusFromResolveResponse",
696
712
  value: function () {
@@ -779,7 +795,7 @@ export var EditorCardProvider = /*#__PURE__*/function (_NodeDataProvider) {
779
795
  key: "resolve",
780
796
  value: function () {
781
797
  var _resolve = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(url, appearance, shouldForceAppearance, isEmbedFriendlyLocation) {
782
- var hardCodedAppearance, _yield$Promise$all, _yield$Promise$all2, matchedProviderPattern, userPreference, data, issueAri, _this$onResolve, isSupported, providerDefaultAppearance, isEmbedFriendlyLocationEvaluated, preferredAppearance, canItBeEmbed, datasource, id, parameters, authStatus, access, _t8, _t9;
798
+ var hardCodedAppearance, _yield$Promise$all, _yield$Promise$all2, matchedProviderPattern, userPreference, data, issueAri, _this$onResolve, isSupported, providerDefaultAppearance, isEmbedFriendlyLocationEvaluated, preferredAppearance, canItBeEmbed, _canItBeEmbed, datasource, id, parameters, authStatus, access, _t8, _t9;
783
799
  return _regeneratorRuntime.wrap(function (_context11) {
784
800
  while (1) switch (_context11.prev = _context11.next) {
785
801
  case 0:
@@ -835,7 +851,7 @@ export var EditorCardProvider = /*#__PURE__*/function (_NodeDataProvider) {
835
851
  case 7:
836
852
  isSupported = _t8;
837
853
  if (!isSupported) {
838
- _context11.next = 14;
854
+ _context11.next = 16;
839
855
  break;
840
856
  }
841
857
  providerDefaultAppearance = matchedProviderPattern === null || matchedProviderPattern === void 0 ? void 0 : matchedProviderPattern.defaultView;
@@ -865,12 +881,22 @@ export var EditorCardProvider = /*#__PURE__*/function (_NodeDataProvider) {
865
881
  preferredAppearance = 'inline';
866
882
  }
867
883
  case 9:
884
+ if (!(!userPreference && appearance === 'embed' && isEmbedFriendlyLocationEvaluated && this.shouldHonorRequestedEmbedAsDefault())) {
885
+ _context11.next = 11;
886
+ break;
887
+ }
868
888
  _context11.next = 10;
869
- return this.getDatasourceFromResolveResponse(url);
889
+ return this.canBeResolvedAsEmbed(url);
870
890
  case 10:
891
+ _canItBeEmbed = _context11.sent;
892
+ preferredAppearance = _canItBeEmbed ? 'embed' : 'block';
893
+ case 11:
894
+ _context11.next = 12;
895
+ return this.getDatasourceFromResolveResponse(url);
896
+ case 12:
871
897
  datasource = _context11.sent;
872
898
  if (!datasource) {
873
- _context11.next = 11;
899
+ _context11.next = 13;
874
900
  break;
875
901
  }
876
902
  id = datasource.id, parameters = datasource.parameters;
@@ -883,42 +909,42 @@ export var EditorCardProvider = /*#__PURE__*/function (_NodeDataProvider) {
883
909
  type: 'table'
884
910
  }]
885
911
  }, url));
886
- case 11:
912
+ case 13:
887
913
  if (!(isEmbedFriendlyLocationEvaluated && !userPreference)) {
888
- _context11.next = 13;
914
+ _context11.next = 15;
889
915
  break;
890
916
  }
891
- _context11.next = 12;
917
+ _context11.next = 14;
892
918
  return this.getAuthStatusFromResolveResponse(url);
893
- case 12:
919
+ case 14:
894
920
  authStatus = _context11.sent;
895
921
  if (!authStatus) {
896
- _context11.next = 13;
922
+ _context11.next = 15;
897
923
  break;
898
924
  }
899
925
  access = authStatus.access;
900
926
  if (!(access === 'unauthorized')) {
901
- _context11.next = 13;
927
+ _context11.next = 15;
902
928
  break;
903
929
  }
904
930
  return _context11.abrupt("return", this.transformer.toSmartlinkAdf(url, 'block'));
905
- case 13:
931
+ case 15:
906
932
  return _context11.abrupt("return", this.transformer.toSmartlinkAdf(url, preferredAppearance));
907
- case 14:
908
- _context11.next = 16;
933
+ case 16:
934
+ _context11.next = 18;
909
935
  break;
910
- case 15:
911
- _context11.prev = 15;
936
+ case 17:
937
+ _context11.prev = 17;
912
938
  _t9 = _context11["catch"](0);
913
939
  // eslint-disable-next-line
914
940
  console.warn("Error when trying to check Smart Card url \"".concat(url, "\"").concat(_t9 instanceof Error ? " - ".concat(_t9.name, " ").concat(_t9.message) : ''), _t9);
915
- case 16:
941
+ case 18:
916
942
  return _context11.abrupt("return", Promise.reject(undefined));
917
- case 17:
943
+ case 19:
918
944
  case "end":
919
945
  return _context11.stop();
920
946
  }
921
- }, _callee11, this, [[0, 15]]);
947
+ }, _callee11, this, [[0, 17]]);
922
948
  }));
923
949
  function resolve(_x1, _x10, _x11, _x12) {
924
950
  return _resolve.apply(this, arguments);
@@ -65,6 +65,17 @@ export declare class EditorCardProvider extends NodeDataProvider<CardNode, JsonL
65
65
  * Make a /resolve call and find out if result has embed capability
66
66
  */
67
67
  private canBeResolvedAsEmbed;
68
+ /**
69
+ * Opt-in hook: when a caller explicitly requests an `'embed'` appearance and the
70
+ * user has no saved preference for the URL, honour that request as the default
71
+ * (above any provider default), validating embeddability first and falling back
72
+ * to a card (`'block'`) when the link cannot be embedded.
73
+ *
74
+ * Defaults to `false` so behaviour is unchanged for every existing consumer.
75
+ * Subclasses (e.g. Confluence) can override this to opt in, typically behind an
76
+ * experiment.
77
+ */
78
+ protected shouldHonorRequestedEmbedAsDefault(): boolean;
68
79
  private getAuthStatusFromResolveResponse;
69
80
  /**
70
81
  * Make a /resolve call and find out if result has datasource capability
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-card-provider",
3
- "version": "6.8.22",
3
+ "version": "6.8.24",
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,7 +39,7 @@
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": "^102.0.0",
42
+ "@atlaskit/tmp-editor-statsig": "^103.0.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "dataloader": "^2.1.0"
45
45
  },
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/entry-points/provider.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/provider.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/provider.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/entry-points/provider.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/entry-points/provider.d.ts"
15
8
  }
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/entry-points/smart-card-local-cache-client.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/smart-card-local-cache-client.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/smart-card-local-cache-client.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/entry-points/smart-card-local-cache-client.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/entry-points/smart-card-local-cache-client.d.ts"
15
8
  }
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/entry-points/url-checkers.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/url-checkers.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/url-checkers.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/entry-points/url-checkers.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/entry-points/url-checkers.d.ts"
15
8
  }
@@ -1,5 +0,0 @@
1
- import type { JsonLd } from '@atlaskit/json-ld-types';
2
- export declare class NetworkError extends Error {
3
- constructor(error: any);
4
- }
5
- export declare function request<T = JsonLd.Response>(method: string, url: string, data?: any, headers?: HeadersInit): Promise<T>;
@@ -1 +0,0 @@
1
- export { EditorCardProvider, editorCardProvider, isInternalUrl, isExternalUrl } from '../provider';
@@ -1 +0,0 @@
1
- export { SmartCardLocalCacheClient } from '../smart-card-local-cache-client';
@@ -1 +0,0 @@
1
- export { isConfluenceSlideUrl } from '../url-checkers';
@@ -1,2 +0,0 @@
1
- export { EditorCardProvider, editorCardProvider, isInternalUrl, isExternalUrl } from './provider';
2
- export { SmartCardLocalCacheClient } from './smart-card-local-cache-client';
@@ -1,80 +0,0 @@
1
- import type { JSONNode } from '@atlaskit/editor-json-transformer';
2
- import type { CallbackPayload } from '@atlaskit/node-data-provider';
3
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
- import { NodeDataProvider } from '@atlaskit/node-data-provider';
5
- import type { BlockCardAdf, EmbedCardAdf, CardAdf, InlineCardAdf, CardAppearance, DatasourceAdf, ProductType, EnvironmentsKeys } from '@atlaskit/linking-common';
6
- import type { CardProvider } from './types';
7
- import { CardClient } from '@atlaskit/link-provider';
8
- import type { JsonLd } from '@atlaskit/json-ld-types';
9
- type UrlChecker = (url: string) => RegExpMatchArray | null;
10
- export declare const isJiraWorkItem: (url: string) => boolean;
11
- export declare const internalUrlCheckers: {
12
- [key: string]: UrlChecker;
13
- };
14
- /**
15
- * Check if a URL is an internal Atlassian URL (Jira, Confluence, etc.)
16
- * by testing it against all known internal URL patterns
17
- */
18
- export declare function isInternalUrl(url: string): boolean;
19
- /**
20
- * Check if a URL is external (not a known internal Atlassian URL)
21
- */
22
- export declare function isExternalUrl(url: string): boolean;
23
- type CardNode = InlineCardAdf | BlockCardAdf | EmbedCardAdf;
24
- type SupportedUrlFilter = (url: string) => boolean;
25
- export declare class EditorCardProvider extends NodeDataProvider<CardNode, JsonLd.Response> implements CardProvider {
26
- readonly name: 'editorCardProvider' | string;
27
- private baseUrl;
28
- private resolverUrl;
29
- private providersData?;
30
- private requestHeaders;
31
- private transformer;
32
- private providersLoader;
33
- private cardClient;
34
- private smartCardLocalCacheClient;
35
- private onResolve;
36
- private supportedUrlFilter?;
37
- constructor(envKey?: EnvironmentsKeys, baseUrlOverride?: string, product?: ProductType, onResolve?: (url: string) => void, customCardClient?: CardClient, supportedUrlFilter?: SupportedUrlFilter);
38
- refreshCache(node: CardNode | PMNode): void;
39
- getData(node: CardNode | PMNode, callback: (payload: CallbackPayload<JsonLd.Response>) => void): void;
40
- nodeDataKey(node: CardNode): string;
41
- fetchNodesData(nodes: CardNode[]): Promise<JsonLd.Response[]>;
42
- isNodeSupported(node: JSONNode): node is CardNode;
43
- private batchProviders;
44
- private checkLinkResolved;
45
- private fetchDataForResource;
46
- private extractAriFromData;
47
- private fetchProvidersData;
48
- private loadProviderData;
49
- findPattern(url: string): Promise<boolean>;
50
- private doesUrlMatchPath;
51
- private findUserPreference;
52
- private findPatternData;
53
- /**
54
- *
55
- * Decides whether the url passed in should be embedded by default
56
- *
57
- * protected so that subclasses can override this in order to custom handle links embedded by default
58
- *
59
- * @param url
60
- * @returns 'embed' for the card appearance to embed by default
61
- */
62
- protected getHardCodedAppearance(url: string): CardAppearance | undefined;
63
- private fetchData;
64
- /**
65
- * Make a /resolve call and find out if result has embed capability
66
- */
67
- private canBeResolvedAsEmbed;
68
- private getAuthStatusFromResolveResponse;
69
- /**
70
- * Make a /resolve call and find out if result has datasource capability
71
- */
72
- private getDatasourceFromResolveResponse;
73
- /**
74
- * This is used to determine if the url is a local Jira url or a remote one.
75
- */
76
- private isLocalUrl;
77
- resolve(url: string, appearance: CardAppearance, shouldForceAppearance?: boolean, isEmbedFriendlyLocation?: boolean): Promise<CardAdf | DatasourceAdf>;
78
- }
79
- export declare const editorCardProvider: EditorCardProvider;
80
- export type { CardProvider } from './types';
@@ -1,55 +0,0 @@
1
- import type { SmartLinkResponse } from '@atlaskit/linking-types';
2
- type CacheEntry = {
3
- data: SmartLinkResponse;
4
- timestamp: number;
5
- };
6
- /**
7
- * Singleton cache client for smart link responses. Uses sessionStorage for per-tab isolation (no cross-tab conflicts).
8
- * If switching to localStorage for cross-tab sharing, add a 'storage' event listener in the constructor to sync
9
- * memoryCache when other tabs modify the cache, preventing race conditions from concurrent writes.
10
- */
11
- export declare class SmartCardLocalCacheClient {
12
- private static instance;
13
- private readonly storageClient;
14
- private maxItems;
15
- private memoryCache;
16
- private pendingWrite;
17
- private constructor();
18
- /**
19
- * Gets the singleton instance of SmartCardLocalCacheClient.
20
- * This ensures all callers share the same in-memory cache and prevents
21
- * race conditions when multiple instances write to the same storage key.
22
- * @param maxItems Maximum number of items to store in the cache (only used on first instantiation)
23
- * @returns The singleton instance
24
- */
25
- static getInstance(maxItems?: number): SmartCardLocalCacheClient;
26
- /**
27
- * Resets the singleton instance. Only intended for testing purposes.
28
- * @internal
29
- */
30
- static resetInstance(): void;
31
- /**
32
- * Retrieves the entire cache object from memory
33
- * @returns The entire cache object
34
- */
35
- getCache: () => Record<string, CacheEntry>;
36
- /**
37
- * Caches the SmartLinkResponse against the provided url in storage
38
- * @param url The url (key) to store the response against
39
- * @param response The SmartLinkResponse to be cached in storage
40
- */
41
- setItem: (url: string, response: SmartLinkResponse) => void;
42
- /**
43
- * Retrieves the cached SmartLinkResponse for the provided url from storage (if it exists)
44
- * @param url The url (key) to retrieve the cached response for
45
- * @returns The cached SmartLinkResponse if it exists, else undefined
46
- */
47
- getItem: (url: string | undefined) => SmartLinkResponse | undefined;
48
- /**
49
- * Checks if a cached entry exists for the provided url in storage
50
- * @param url The url (key) to check for existence in the cache
51
- * @returns True if a cached entry exists, else false
52
- */
53
- isUrlInCache: (url: string) => boolean;
54
- }
55
- export {};
@@ -1,9 +0,0 @@
1
- import type { CardAppearance, CardAdf, DatasourceAdf, Datasource } from '@atlaskit/linking-common';
2
- export declare class Transformer {
3
- private buildInlineAdf;
4
- private buildBlockAdf;
5
- private buildEmbedAdf;
6
- private buildDatasourceAdf;
7
- toSmartlinkAdf(url: string, appearance: CardAppearance): CardAdf;
8
- toDatasourceAdf(datasource: Datasource, url?: string): DatasourceAdf;
9
- }
@@ -1,34 +0,0 @@
1
- import type { CardAppearance } from '@atlaskit/linking-common';
2
- export interface CardProvider {
3
- resolve: (url: string, appearance: CardAppearance, shouldForceAppearance?: boolean, isEmbedFriendlyLocation?: boolean) => Promise<any>;
4
- }
5
- export type ORSCheckResponse = {
6
- isSupported: boolean;
7
- };
8
- type DisplayViews = 'inline' | 'block' | 'embed';
9
- export type ProviderPattern = {
10
- defaultView?: DisplayViews;
11
- source: string;
12
- supportedViews?: DisplayViews[];
13
- };
14
- type Provider = {
15
- key: string;
16
- patterns: ProviderPattern[];
17
- };
18
- export type LinkAppearance = CardAppearance | 'url';
19
- export interface UserPreferences {
20
- appearances: {
21
- appearance: LinkAppearance;
22
- urlSegment: string;
23
- }[];
24
- defaultAppearance: LinkAppearance;
25
- }
26
- export type ORSProvidersResponse = {
27
- providers: Provider[];
28
- userPreferences?: UserPreferences;
29
- };
30
- export interface ProvidersData {
31
- patterns: ProviderPattern[];
32
- userPreferences?: UserPreferences;
33
- }
34
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * URL checker utilities for Confluence content types.
3
- *
4
- * Exported via the `@atlaskit/editor-card-provider/url-checkers` subpath
5
- * so consumers don't have to depend on the barrel file.
6
- */
7
- /**
8
- * Returns `true` when the given URL points to a Confluence Slides page.
9
- */
10
- export declare const isConfluenceSlideUrl: (url: string) => boolean;