@atlaskit/editor-card-provider 5.3.1 → 5.5.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,45 @@
1
1
  # @atlaskit/editor-card-provider
2
2
 
3
+ ## 5.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`e5b3e00a23242`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e5b3e00a23242) - -
8
+ Added a new `custom` environment to `EnvironmentsKeys`. Now, you can pass the `baseUrlOverride`
9
+ parameter to both `EditorCardProvider` and `CardClient` to access a service directly.
10
+
11
+ - Introduced a new `setHeaders` method in CardClient, allowing you to specify custom HTTP headers
12
+ for requests to the object-resolver service.
13
+ - `EditorCardProvider` now supports passing a custom `CardClient` instance, so you can use your
14
+ own client instead of the built-in one.
15
+
16
+ These changes provide more flexibility for configuring access to the object-resolver service,
17
+ including support for SSR and integration with custom infrastructures.
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
23
+ ## 5.4.0
24
+
25
+ ### Minor Changes
26
+
27
+ - [`19da7355cd815`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/19da7355cd815) - -
28
+ Added a new `custom` environment to `EnvironmentsKeys`. Now, you can pass the `baseUrlOverride`
29
+ parameter to both `EditorCardProvider` and `CardClient` to access a service directly.
30
+
31
+ - Introduced a new `setHeaders` method in CardClient, allowing you to specify custom HTTP headers
32
+ for requests to the object-resolver service.
33
+ - `EditorCardProvider` now supports passing a custom `CardClient` instance, so you can use your
34
+ own client instead of the built-in one.
35
+
36
+ These changes provide more flexibility for configuring access to the object-resolver service,
37
+ including support for SSR and integration with custom infrastructures.
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies
42
+
3
43
  ## 5.3.1
4
44
 
5
45
  ### Patch Changes
@@ -133,7 +133,7 @@ var isJiraWorkItem = exports.isJiraWorkItem = function isJiraWorkItem(url) {
133
133
  return /\/browse\/((?:\w+)-(?:\d+))/i.test(url);
134
134
  };
135
135
  var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_ref) {
136
- function EditorCardProvider(envKey, baseUrlOverride, product, onResolve) {
136
+ function EditorCardProvider(envKey, baseUrlOverride, product, onResolve, customCardClient) {
137
137
  var _this;
138
138
  (0, _classCallCheck2.default)(this, EditorCardProvider);
139
139
  _this = _callSuper(this, EditorCardProvider);
@@ -159,8 +159,8 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
159
159
  return setTimeout(callback, BATCH_WAIT_TIME);
160
160
  }
161
161
  });
162
- _this.cardClient = new _linkProvider.CardClient(envKey, baseUrlOverride);
163
- if (product) {
162
+ _this.cardClient = customCardClient !== null && customCardClient !== void 0 ? customCardClient : new _linkProvider.CardClient(envKey, baseUrlOverride);
163
+ if (!customCardClient && product) {
164
164
  _this.cardClient.setProduct(product);
165
165
  }
166
166
  return _this;
@@ -68,7 +68,7 @@ url.match(/\/wiki\/spaces\/(?<resourceContext>[^\/]+)\/calendars\/(?<resourceId>
68
68
  const isJiraIssueNavigator = url => url.match(/^https:\/\/.*?\/jira\/software|core\/(c\/)?projects\/[^\/]+?\/issues\/?/);
69
69
  export const isJiraWorkItem = url => /\/browse\/((?:\w+)-(?:\d+))/i.test(url);
70
70
  export class EditorCardProvider extends NodeDataProvider {
71
- constructor(envKey, baseUrlOverride, product, onResolve) {
71
+ constructor(envKey, baseUrlOverride, product, onResolve, customCardClient) {
72
72
  super();
73
73
  _defineProperty(this, "getExperimentValue", (experimentName, parameterName, defaultValue) => {
74
74
  try {
@@ -88,8 +88,8 @@ export class EditorCardProvider extends NodeDataProvider {
88
88
  this.providersLoader = new DataLoader(keys => this.batchProviders(keys), {
89
89
  batchScheduleFn: callback => setTimeout(callback, BATCH_WAIT_TIME)
90
90
  });
91
- this.cardClient = new CardClient(envKey, baseUrlOverride);
92
- if (product) {
91
+ this.cardClient = customCardClient !== null && customCardClient !== void 0 ? customCardClient : new CardClient(envKey, baseUrlOverride);
92
+ if (!customCardClient && product) {
93
93
  this.cardClient.setProduct(product);
94
94
  }
95
95
  }
@@ -126,7 +126,7 @@ export var isJiraWorkItem = function isJiraWorkItem(url) {
126
126
  return /\/browse\/((?:\w+)-(?:\d+))/i.test(url);
127
127
  };
128
128
  export var EditorCardProvider = /*#__PURE__*/function (_ref) {
129
- function EditorCardProvider(envKey, baseUrlOverride, product, onResolve) {
129
+ function EditorCardProvider(envKey, baseUrlOverride, product, onResolve, customCardClient) {
130
130
  var _this;
131
131
  _classCallCheck(this, EditorCardProvider);
132
132
  _this = _callSuper(this, EditorCardProvider);
@@ -152,8 +152,8 @@ export var EditorCardProvider = /*#__PURE__*/function (_ref) {
152
152
  return setTimeout(callback, BATCH_WAIT_TIME);
153
153
  }
154
154
  });
155
- _this.cardClient = new CardClient(envKey, baseUrlOverride);
156
- if (product) {
155
+ _this.cardClient = customCardClient !== null && customCardClient !== void 0 ? customCardClient : new CardClient(envKey, baseUrlOverride);
156
+ if (!customCardClient && product) {
157
157
  _this.cardClient.setProduct(product);
158
158
  }
159
159
  return _this;
@@ -2,6 +2,7 @@ import type { JSONNode } from '@atlaskit/editor-json-transformer';
2
2
  import { NodeDataProvider } from '@atlaskit/node-data-provider';
3
3
  import { type BlockCardAdf, type EmbedCardAdf, type CardAdf, type InlineCardAdf, type CardAppearance, type DatasourceAdf, type ProductType } from '@atlaskit/linking-common';
4
4
  import { type CardProvider } from './types';
5
+ import { CardClient } from '@atlaskit/link-provider';
5
6
  import { type EnvironmentsKeys } from '@atlaskit/linking-common';
6
7
  import { type JsonLd } from '@atlaskit/json-ld-types';
7
8
  export declare const isJiraWorkItem: (url: string) => boolean;
@@ -16,7 +17,7 @@ export declare class EditorCardProvider extends NodeDataProvider<CardNode, JsonL
16
17
  private providersLoader;
17
18
  private cardClient;
18
19
  private onResolve;
19
- constructor(envKey?: EnvironmentsKeys, baseUrlOverride?: string, product?: ProductType, onResolve?: (url: string) => void);
20
+ constructor(envKey?: EnvironmentsKeys, baseUrlOverride?: string, product?: ProductType, onResolve?: (url: string) => void, customCardClient?: CardClient);
20
21
  nodeDataKey(node: CardNode): string;
21
22
  fetchNodesData(nodes: CardNode[]): Promise<JsonLd.Response[]>;
22
23
  isNodeSupported(node: JSONNode): node is CardNode;
@@ -2,6 +2,7 @@ import type { JSONNode } from '@atlaskit/editor-json-transformer';
2
2
  import { NodeDataProvider } from '@atlaskit/node-data-provider';
3
3
  import { type BlockCardAdf, type EmbedCardAdf, type CardAdf, type InlineCardAdf, type CardAppearance, type DatasourceAdf, type ProductType } from '@atlaskit/linking-common';
4
4
  import { type CardProvider } from './types';
5
+ import { CardClient } from '@atlaskit/link-provider';
5
6
  import { type EnvironmentsKeys } from '@atlaskit/linking-common';
6
7
  import { type JsonLd } from '@atlaskit/json-ld-types';
7
8
  export declare const isJiraWorkItem: (url: string) => boolean;
@@ -16,7 +17,7 @@ export declare class EditorCardProvider extends NodeDataProvider<CardNode, JsonL
16
17
  private providersLoader;
17
18
  private cardClient;
18
19
  private onResolve;
19
- constructor(envKey?: EnvironmentsKeys, baseUrlOverride?: string, product?: ProductType, onResolve?: (url: string) => void);
20
+ constructor(envKey?: EnvironmentsKeys, baseUrlOverride?: string, product?: ProductType, onResolve?: (url: string) => void, customCardClient?: CardClient);
20
21
  nodeDataKey(node: CardNode): string;
21
22
  fetchNodesData(nodes: CardNode[]): Promise<JsonLd.Response[]>;
22
23
  isNodeSupported(node: JSONNode): node is CardNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-card-provider",
3
- "version": "5.3.1",
3
+ "version": "5.5.0",
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",
@@ -37,16 +37,16 @@
37
37
  "@atlaskit/json-ld-types": "^1.4.0",
38
38
  "@atlaskit/link-client-extension": "^5.0.0",
39
39
  "@atlaskit/link-extractors": "^2.4.0",
40
- "@atlaskit/linking-common": "^9.2.0",
40
+ "@atlaskit/linking-common": "^9.4.0",
41
41
  "@atlaskit/linking-types": "^14.0.0",
42
42
  "@atlaskit/node-data-provider": "^4.5.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
- "@atlaskit/tmp-editor-statsig": "^10.0.0",
44
+ "@atlaskit/tmp-editor-statsig": "^11.0.0",
45
45
  "@babel/runtime": "^7.0.0",
46
46
  "dataloader": "^2.1.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@atlaskit/link-provider": "^3.4.0",
49
+ "@atlaskit/link-provider": "^3.6.0",
50
50
  "react": "^18.2.0"
51
51
  },
52
52
  "devDependencies": {