@atlaskit/editor-card-provider 3.3.6 → 3.4.1

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,20 @@
1
1
  # @atlaskit/editor-card-provider
2
2
 
3
+ ## 3.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 3.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#112094](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/112094)
14
+ [`b19771fec1a43`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b19771fec1a43) -
15
+ Accept additional optional product arg in provider that will be forwarded as X-Product header to
16
+ ORSbatch resolve endpoint
17
+
3
18
  ## 3.3.6
4
19
 
5
20
  ### Patch Changes
@@ -61,9 +61,6 @@ var isYoutubeVideo = function isYoutubeVideo(url) {
61
61
  return url.match(/^https:\/\/(.*?\.)?(youtube\..*?\/(watch\?|v\/|shorts\/)|youtu\.be)/);
62
62
  };
63
63
  var isLoomUrl = function isLoomUrl(url) {
64
- if (!(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.embed-loom-by-default')) {
65
- return null;
66
- }
67
64
  return url.match( /*#__PURE__*/_wrapRegExp(/^https:\/\/(.*?\.)?(loom\..*?\/(share|embed))\/([a-zA-Z0-9-]*\x2D)?([a-f0-9]{32})/, {
68
65
  videoId: 5
69
66
  }));
@@ -75,7 +72,7 @@ var isJiraDashboard = function isJiraDashboard(url) {
75
72
  return url.match(/^https:\/\/.*?\/jira\/dashboards\/[0-9]+.*/);
76
73
  };
77
74
  var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
78
- function EditorCardProvider(envKey, baseUrlOverride) {
75
+ function EditorCardProvider(envKey, baseUrlOverride, product) {
79
76
  var _this = this;
80
77
  (0, _classCallCheck2.default)(this, EditorCardProvider);
81
78
  this.baseUrl = baseUrlOverride || (0, _linkingCommon.getBaseUrl)(envKey);
@@ -92,6 +89,9 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function () {
92
89
  }
93
90
  });
94
91
  this.cardClient = new _linkProvider.CardClient(envKey, baseUrlOverride);
92
+ if (product) {
93
+ this.cardClient.setProduct(product);
94
+ }
95
95
  }
96
96
  (0, _createClass2.default)(EditorCardProvider, [{
97
97
  key: "batchProviders",
@@ -23,9 +23,6 @@ const isConfluenceWhiteboard = url => url.match(/\/wiki\/spaces\/?.*\/whiteboard
23
23
  const isConfluenceDatabase = url => url.match(/\/wiki\/spaces\/~?[\d\w]+\/database\/\d+(\?.*(savedViewId=([0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|all-entries|default)|entryId=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|unsavedView=[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}).*)?$/);
24
24
  const isYoutubeVideo = url => url.match(/^https:\/\/(.*?\.)?(youtube\..*?\/(watch\?|v\/|shorts\/)|youtu\.be)/);
25
25
  const isLoomUrl = url => {
26
- if (!getBooleanFF('platform.linking-platform.embed-loom-by-default')) {
27
- return null;
28
- }
29
26
  return url.match(/^https:\/\/(.*?\.)?(loom\..*?\/(share|embed))\/([a-zA-Z0-9-]*-)?(?<videoId>[a-f0-9]{32})/);
30
27
  };
31
28
  const isJiraDashboard = url => {
@@ -35,7 +32,7 @@ const isJiraDashboard = url => {
35
32
  return url.match(/^https:\/\/.*?\/jira\/dashboards\/[0-9]+.*/);
36
33
  };
37
34
  export class EditorCardProvider {
38
- constructor(envKey, baseUrlOverride) {
35
+ constructor(envKey, baseUrlOverride, product) {
39
36
  this.baseUrl = baseUrlOverride || getBaseUrl(envKey);
40
37
  this.resolverUrl = getResolverUrl(envKey, baseUrlOverride);
41
38
  this.transformer = new Transformer();
@@ -46,6 +43,9 @@ export class EditorCardProvider {
46
43
  batchScheduleFn: callback => setTimeout(callback, BATCH_WAIT_TIME)
47
44
  });
48
45
  this.cardClient = new CardClient(envKey, baseUrlOverride);
46
+ if (product) {
47
+ this.cardClient.setProduct(product);
48
+ }
49
49
  }
50
50
  async batchProviders(keys) {
51
51
  // EDM-2205: Batch requests in the case that user paste multiple links at
@@ -54,9 +54,6 @@ var isYoutubeVideo = function isYoutubeVideo(url) {
54
54
  return url.match(/^https:\/\/(.*?\.)?(youtube\..*?\/(watch\?|v\/|shorts\/)|youtu\.be)/);
55
55
  };
56
56
  var isLoomUrl = function isLoomUrl(url) {
57
- if (!getBooleanFF('platform.linking-platform.embed-loom-by-default')) {
58
- return null;
59
- }
60
57
  return url.match( /*#__PURE__*/_wrapRegExp(/^https:\/\/(.*?\.)?(loom\..*?\/(share|embed))\/([a-zA-Z0-9-]*\x2D)?([a-f0-9]{32})/, {
61
58
  videoId: 5
62
59
  }));
@@ -68,7 +65,7 @@ var isJiraDashboard = function isJiraDashboard(url) {
68
65
  return url.match(/^https:\/\/.*?\/jira\/dashboards\/[0-9]+.*/);
69
66
  };
70
67
  export var EditorCardProvider = /*#__PURE__*/function () {
71
- function EditorCardProvider(envKey, baseUrlOverride) {
68
+ function EditorCardProvider(envKey, baseUrlOverride, product) {
72
69
  var _this = this;
73
70
  _classCallCheck(this, EditorCardProvider);
74
71
  this.baseUrl = baseUrlOverride || getBaseUrl(envKey);
@@ -85,6 +82,9 @@ export var EditorCardProvider = /*#__PURE__*/function () {
85
82
  }
86
83
  });
87
84
  this.cardClient = new CardClient(envKey, baseUrlOverride);
85
+ if (product) {
86
+ this.cardClient.setProduct(product);
87
+ }
88
88
  }
89
89
  _createClass(EditorCardProvider, [{
90
90
  key: "batchProviders",
@@ -1,5 +1,5 @@
1
1
  import 'setimmediate';
2
- import { type CardAdf, type CardAppearance, type DatasourceAdf } from '@atlaskit/linking-common';
2
+ import { type CardAdf, type CardAppearance, type DatasourceAdf, type ProductType } from '@atlaskit/linking-common';
3
3
  import { type CardProvider } from './types';
4
4
  import { type EnvironmentsKeys } from '@atlaskit/linking-common';
5
5
  export declare class EditorCardProvider implements CardProvider {
@@ -10,7 +10,7 @@ export declare class EditorCardProvider implements CardProvider {
10
10
  private transformer;
11
11
  private providersLoader;
12
12
  private cardClient;
13
- constructor(envKey?: EnvironmentsKeys, baseUrlOverride?: string);
13
+ constructor(envKey?: EnvironmentsKeys, baseUrlOverride?: string, product?: ProductType);
14
14
  private batchProviders;
15
15
  private checkLinkResolved;
16
16
  private fetchProvidersData;
@@ -1,5 +1,5 @@
1
1
  import 'setimmediate';
2
- import { type CardAdf, type CardAppearance, type DatasourceAdf } from '@atlaskit/linking-common';
2
+ import { type CardAdf, type CardAppearance, type DatasourceAdf, type ProductType } from '@atlaskit/linking-common';
3
3
  import { type CardProvider } from './types';
4
4
  import { type EnvironmentsKeys } from '@atlaskit/linking-common';
5
5
  export declare class EditorCardProvider implements CardProvider {
@@ -10,7 +10,7 @@ export declare class EditorCardProvider implements CardProvider {
10
10
  private transformer;
11
11
  private providersLoader;
12
12
  private cardClient;
13
- constructor(envKey?: EnvironmentsKeys, baseUrlOverride?: string);
13
+ constructor(envKey?: EnvironmentsKeys, baseUrlOverride?: string, product?: ProductType);
14
14
  private batchProviders;
15
15
  private checkLinkResolved;
16
16
  private fetchProvidersData;
package/package.json CHANGED
@@ -1,66 +1,63 @@
1
1
  {
2
- "name": "@atlaskit/editor-card-provider",
3
- "version": "3.3.6",
4
- "description": "Contains the EditorCardProvider, for determining smart card behaviour in the editor.",
5
- "author": "Atlassian Pty Ltd",
6
- "license": "Apache-2.0",
7
- "publishConfig": {
8
- "registry": "https://registry.npmjs.org/"
9
- },
10
- "atlassian": {
11
- "team": "Linking Platform",
12
- "inPublicMirror": false,
13
- "releaseModel": "continuous",
14
- "website": {
15
- "name": "EditorCardProvider"
16
- }
17
- },
18
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
19
- "main": "dist/cjs/index.js",
20
- "module": "dist/esm/index.js",
21
- "module:es2019": "dist/es2019/index.js",
22
- "types": "dist/types/index.d.ts",
23
- "typesVersions": {
24
- ">=4.5 <4.9": {
25
- "*": [
26
- "dist/types-ts4.5/*",
27
- "dist/types-ts4.5/index.d.ts"
28
- ]
29
- }
30
- },
31
- "sideEffects": false,
32
- "atlaskit:src": "src/index.ts",
33
- "af:exports": {
34
- ".": "./src/index.ts"
35
- },
36
- "dependencies": {
37
- "@atlaskit/eslint-plugin-platform": "0.6.2",
38
- "@atlaskit/link-client-extension": "^1.8.0",
39
- "@atlaskit/link-extractors": "^1.5.0",
40
- "@atlaskit/linking-common": "^5.7.0",
41
- "@atlaskit/platform-feature-flags": "^0.2.1",
42
- "@babel/runtime": "^7.0.0",
43
- "dataloader": "^2.0.0",
44
- "json-ld-types": "^4.1.0",
45
- "setimmediate": "^1.0.5"
46
- },
47
- "peerDependencies": {
48
- "@atlaskit/link-provider": "^1.10.0",
49
- "react": "^16.8.0"
50
- },
51
- "devDependencies": {
52
- "@atlassian/feature-flags-test-utils": "^0.2.0",
53
- "typescript": "~5.4.2"
54
- },
55
- "platform-feature-flags": {
56
- "platform.linking-platform.embed-youtube-by-default": {
57
- "type": "boolean"
58
- },
59
- "platform.linking-platform.embed-loom-by-default": {
60
- "type": "boolean"
61
- },
62
- "platform.linking-platform.jira-dashboard-embed_ycjcj": {
63
- "type": "boolean"
64
- }
65
- }
66
- }
2
+ "name": "@atlaskit/editor-card-provider",
3
+ "version": "3.4.1",
4
+ "description": "Contains the EditorCardProvider, for determining smart card behaviour in the editor.",
5
+ "author": "Atlassian Pty Ltd",
6
+ "license": "Apache-2.0",
7
+ "publishConfig": {
8
+ "registry": "https://registry.npmjs.org/"
9
+ },
10
+ "atlassian": {
11
+ "team": "Linking Platform",
12
+ "inPublicMirror": false,
13
+ "releaseModel": "continuous",
14
+ "website": {
15
+ "name": "EditorCardProvider"
16
+ }
17
+ },
18
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
19
+ "main": "dist/cjs/index.js",
20
+ "module": "dist/esm/index.js",
21
+ "module:es2019": "dist/es2019/index.js",
22
+ "types": "dist/types/index.d.ts",
23
+ "typesVersions": {
24
+ ">=4.5 <4.9": {
25
+ "*": [
26
+ "dist/types-ts4.5/*",
27
+ "dist/types-ts4.5/index.d.ts"
28
+ ]
29
+ }
30
+ },
31
+ "sideEffects": false,
32
+ "atlaskit:src": "src/index.ts",
33
+ "af:exports": {
34
+ ".": "./src/index.ts"
35
+ },
36
+ "dependencies": {
37
+ "@atlaskit/eslint-plugin-platform": "0.7.0",
38
+ "@atlaskit/link-client-extension": "^1.9.0",
39
+ "@atlaskit/link-extractors": "^1.5.0",
40
+ "@atlaskit/linking-common": "^5.7.0",
41
+ "@atlaskit/platform-feature-flags": "^0.3.0",
42
+ "@babel/runtime": "^7.0.0",
43
+ "dataloader": "^2.0.0",
44
+ "json-ld-types": "^4.1.0",
45
+ "setimmediate": "^1.0.5"
46
+ },
47
+ "peerDependencies": {
48
+ "@atlaskit/link-provider": "^1.12.0",
49
+ "react": "^16.8.0"
50
+ },
51
+ "devDependencies": {
52
+ "@atlassian/feature-flags-test-utils": "^0.2.0",
53
+ "typescript": "~5.4.2"
54
+ },
55
+ "platform-feature-flags": {
56
+ "platform.linking-platform.embed-youtube-by-default": {
57
+ "type": "boolean"
58
+ },
59
+ "platform.linking-platform.jira-dashboard-embed_ycjcj": {
60
+ "type": "boolean"
61
+ }
62
+ }
63
+ }