@atlaskit/editor-card-provider 6.5.6 → 6.6.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 +17 -0
- package/README.md +10 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/provider.js +51 -4
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/provider.js +45 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/provider.js +47 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/provider.d.ts +17 -2
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/provider.d.ts +17 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-card-provider
|
|
2
2
|
|
|
3
|
+
## 6.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`f0140695e5997`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f0140695e5997) -
|
|
8
|
+
EDITOR-5585 all split function for card provider with config
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 6.5.7
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 6.5.6
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -30,6 +30,16 @@ const provider = new EditorCardProvider('stg');
|
|
|
30
30
|
// You may also pass in a base url override, if you'd like EditorCardProvider
|
|
31
31
|
// to make requests other than api-private.atlassian.com (prod) or pug.jira-dev.com (stg)
|
|
32
32
|
const provider = new EditorCardProvider('stg', 'www.acme.com/your-api-here');
|
|
33
|
+
|
|
34
|
+
// You may optionally pass a url filter to control which card nodes are supported.
|
|
35
|
+
const provider = new EditorCardProvider(
|
|
36
|
+
'stg',
|
|
37
|
+
undefined,
|
|
38
|
+
undefined,
|
|
39
|
+
undefined,
|
|
40
|
+
undefined,
|
|
41
|
+
(url) => url.endsWith('.atlassian.net'),
|
|
42
|
+
);
|
|
33
43
|
```
|
|
34
44
|
|
|
35
45
|
## Team
|
package/dist/cjs/index.js
CHANGED
|
@@ -21,5 +21,17 @@ Object.defineProperty(exports, "editorCardProvider", {
|
|
|
21
21
|
return _provider.editorCardProvider;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "isExternalUrl", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _provider.isExternalUrl;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "isInternalUrl", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _provider.isInternalUrl;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
24
36
|
var _provider = require("./provider");
|
|
25
37
|
var _smartCardLocalCacheClient = require("./smart-card-local-cache-client");
|
package/dist/cjs/provider.js
CHANGED
|
@@ -5,7 +5,10 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.internalUrlCheckers = exports.editorCardProvider = exports.EditorCardProvider = void 0;
|
|
9
|
+
exports.isExternalUrl = isExternalUrl;
|
|
10
|
+
exports.isInternalUrl = isInternalUrl;
|
|
11
|
+
exports.isJiraWorkItem = void 0;
|
|
9
12
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
@@ -32,7 +35,6 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
32
35
|
function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
33
36
|
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), (0, _setPrototypeOf2.default)(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return (0, _inherits2.default)(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)(>|$)/g, function (e, r, t) { if ("" === t) return e; var p = o[r]; return Array.isArray(p) ? "$" + p.join("$") : "number" == typeof p ? "$" + p : ""; })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != _typeof(e[e.length - 1]) && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); } /* eslint-disable require-unicode-regexp,prefer-regex-literals */
|
|
34
37
|
var BATCH_WAIT_TIME = 50;
|
|
35
|
-
|
|
36
38
|
// Check if it is matching a Jira Roadmaps or Jira Timeline url
|
|
37
39
|
// NOT to be confused with JSM timeline
|
|
38
40
|
var isJiraRoadmapOrTimeline = function isJiraRoadmapOrTimeline(url) {
|
|
@@ -136,8 +138,46 @@ var isAvpVisualizationView = function isAvpVisualizationView(url) {
|
|
|
136
138
|
var isJiraWorkItem = exports.isJiraWorkItem = function isJiraWorkItem(url) {
|
|
137
139
|
return /\/browse\/((?:\w+)-(?:\d+))/i.test(url);
|
|
138
140
|
};
|
|
141
|
+
var internalUrlCheckers = exports.internalUrlCheckers = {
|
|
142
|
+
isJiraRoadmapOrTimeline: isJiraRoadmapOrTimeline,
|
|
143
|
+
isPolarisView: isPolarisView,
|
|
144
|
+
isJwmView: isJwmView,
|
|
145
|
+
isJiraList: isJiraList,
|
|
146
|
+
isConfluenceWhiteboard: isConfluenceWhiteboard,
|
|
147
|
+
isConfluenceDatabase: isConfluenceDatabase,
|
|
148
|
+
isJiraDashboard: isJiraDashboard,
|
|
149
|
+
isJiraBacklog: isJiraBacklog,
|
|
150
|
+
isJiraBoard: isJiraBoard,
|
|
151
|
+
isJiraPlan: isJiraPlan,
|
|
152
|
+
isJiraVersion: isJiraVersion,
|
|
153
|
+
isJiraForm: isJiraForm,
|
|
154
|
+
isJiraSummary: isJiraSummary,
|
|
155
|
+
isRovoAgentProfilePage: isRovoAgentProfilePage,
|
|
156
|
+
isConfluenceTeamCalendars: isConfluenceTeamCalendars,
|
|
157
|
+
isJiraIssueNavigator: isJiraIssueNavigator
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Check if a URL is an internal Atlassian URL (Jira, Confluence, etc.)
|
|
162
|
+
* by testing it against all known internal URL patterns
|
|
163
|
+
*/
|
|
164
|
+
function isInternalUrl(url) {
|
|
165
|
+
return Object.values(internalUrlCheckers).some(function (checker) {
|
|
166
|
+
return checker(url);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Check if a URL is external (not a known internal Atlassian URL)
|
|
172
|
+
*/
|
|
173
|
+
function isExternalUrl(url) {
|
|
174
|
+
return !isInternalUrl(url);
|
|
175
|
+
}
|
|
176
|
+
function isCardNode(node) {
|
|
177
|
+
return ['inlineCard', 'blockCard', 'embedCard'].includes(node.type) && !!node.attrs && 'url' in node.attrs && typeof node.attrs.url === 'string';
|
|
178
|
+
}
|
|
139
179
|
var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_ref) {
|
|
140
|
-
function EditorCardProvider(envKey, baseUrlOverride, product, onResolve, customCardClient) {
|
|
180
|
+
function EditorCardProvider(envKey, baseUrlOverride, product, onResolve, customCardClient, supportedUrlFilter) {
|
|
141
181
|
var _this;
|
|
142
182
|
(0, _classCallCheck2.default)(this, EditorCardProvider);
|
|
143
183
|
_this = _callSuper(this, EditorCardProvider);
|
|
@@ -147,6 +187,7 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
147
187
|
_this.resolverUrl = (0, _linkingCommon.getResolverUrl)(envKey, baseUrlOverride);
|
|
148
188
|
_this.transformer = new _transformer.Transformer();
|
|
149
189
|
_this.onResolve = onResolve;
|
|
190
|
+
_this.supportedUrlFilter = supportedUrlFilter;
|
|
150
191
|
_this.requestHeaders = {
|
|
151
192
|
Origin: _this.baseUrl
|
|
152
193
|
};
|
|
@@ -228,7 +269,13 @@ var EditorCardProvider = exports.EditorCardProvider = /*#__PURE__*/function (_re
|
|
|
228
269
|
}, {
|
|
229
270
|
key: "isNodeSupported",
|
|
230
271
|
value: function isNodeSupported(node) {
|
|
231
|
-
|
|
272
|
+
if (!isCardNode(node)) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
if (!this.supportedUrlFilter) {
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
return this.supportedUrlFilter(node.attrs.url);
|
|
232
279
|
}
|
|
233
280
|
}, {
|
|
234
281
|
key: "batchProviders",
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Disable no-re-export rule for entry point files
|
|
2
2
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
3
3
|
|
|
4
|
-
export { EditorCardProvider, editorCardProvider } from './provider';
|
|
4
|
+
export { EditorCardProvider, editorCardProvider, isInternalUrl, isExternalUrl } from './provider';
|
|
5
5
|
export { SmartCardLocalCacheClient } from './smart-card-local-cache-client';
|
package/dist/es2019/provider.js
CHANGED
|
@@ -12,7 +12,6 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
12
12
|
import { request } from './api';
|
|
13
13
|
import { SmartCardLocalCacheClient } from './smart-card-local-cache-client';
|
|
14
14
|
const BATCH_WAIT_TIME = 50;
|
|
15
|
-
|
|
16
15
|
// Check if it is matching a Jira Roadmaps or Jira Timeline url
|
|
17
16
|
// NOT to be confused with JSM timeline
|
|
18
17
|
const isJiraRoadmapOrTimeline = url => url.match(/^https:\/\/.*?\/jira\/software\/(c\/)?projects\/[^\/]+?\/boards\/.*?\/(timeline|roadmap)\/?/);
|
|
@@ -69,8 +68,44 @@ url.match(/\/wiki\/spaces\/(?<resourceContext>[^\/]+)\/calendars\/(?<resourceId>
|
|
|
69
68
|
const isJiraIssueNavigator = url => url.match(/^https:\/\/.*?\/jira\/software|core\/(c\/)?projects\/[^\/]+?\/issues\/?/);
|
|
70
69
|
const isAvpVisualizationView = url => url.match(/^https:\/\/.*?\/avpviz\/c\/[^\/]+.*/);
|
|
71
70
|
export const isJiraWorkItem = url => /\/browse\/((?:\w+)-(?:\d+))/i.test(url);
|
|
71
|
+
export const internalUrlCheckers = {
|
|
72
|
+
isJiraRoadmapOrTimeline,
|
|
73
|
+
isPolarisView,
|
|
74
|
+
isJwmView,
|
|
75
|
+
isJiraList,
|
|
76
|
+
isConfluenceWhiteboard,
|
|
77
|
+
isConfluenceDatabase,
|
|
78
|
+
isJiraDashboard,
|
|
79
|
+
isJiraBacklog,
|
|
80
|
+
isJiraBoard,
|
|
81
|
+
isJiraPlan,
|
|
82
|
+
isJiraVersion,
|
|
83
|
+
isJiraForm,
|
|
84
|
+
isJiraSummary,
|
|
85
|
+
isRovoAgentProfilePage,
|
|
86
|
+
isConfluenceTeamCalendars,
|
|
87
|
+
isJiraIssueNavigator
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Check if a URL is an internal Atlassian URL (Jira, Confluence, etc.)
|
|
92
|
+
* by testing it against all known internal URL patterns
|
|
93
|
+
*/
|
|
94
|
+
export function isInternalUrl(url) {
|
|
95
|
+
return Object.values(internalUrlCheckers).some(checker => checker(url));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Check if a URL is external (not a known internal Atlassian URL)
|
|
100
|
+
*/
|
|
101
|
+
export function isExternalUrl(url) {
|
|
102
|
+
return !isInternalUrl(url);
|
|
103
|
+
}
|
|
104
|
+
function isCardNode(node) {
|
|
105
|
+
return ['inlineCard', 'blockCard', 'embedCard'].includes(node.type) && !!node.attrs && 'url' in node.attrs && typeof node.attrs.url === 'string';
|
|
106
|
+
}
|
|
72
107
|
export class EditorCardProvider extends NodeDataProvider {
|
|
73
|
-
constructor(envKey, baseUrlOverride, product, onResolve, customCardClient) {
|
|
108
|
+
constructor(envKey, baseUrlOverride, product, onResolve, customCardClient, supportedUrlFilter) {
|
|
74
109
|
super();
|
|
75
110
|
_defineProperty(this, "smartCardLocalCacheClient", SmartCardLocalCacheClient.getInstance());
|
|
76
111
|
this.name = 'editorCardProvider';
|
|
@@ -78,6 +113,7 @@ export class EditorCardProvider extends NodeDataProvider {
|
|
|
78
113
|
this.resolverUrl = getResolverUrl(envKey, baseUrlOverride);
|
|
79
114
|
this.transformer = new Transformer();
|
|
80
115
|
this.onResolve = onResolve;
|
|
116
|
+
this.supportedUrlFilter = supportedUrlFilter;
|
|
81
117
|
this.requestHeaders = {
|
|
82
118
|
Origin: this.baseUrl
|
|
83
119
|
};
|
|
@@ -141,7 +177,13 @@ export class EditorCardProvider extends NodeDataProvider {
|
|
|
141
177
|
return Promise.all(promises);
|
|
142
178
|
}
|
|
143
179
|
isNodeSupported(node) {
|
|
144
|
-
|
|
180
|
+
if (!isCardNode(node)) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
if (!this.supportedUrlFilter) {
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
return this.supportedUrlFilter(node.attrs.url);
|
|
145
187
|
}
|
|
146
188
|
async batchProviders(keys) {
|
|
147
189
|
// EDM-2205: Batch requests in the case that user paste multiple links at
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Disable no-re-export rule for entry point files
|
|
2
2
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
3
3
|
|
|
4
|
-
export { EditorCardProvider, editorCardProvider } from './provider';
|
|
4
|
+
export { EditorCardProvider, editorCardProvider, isInternalUrl, isExternalUrl } from './provider';
|
|
5
5
|
export { SmartCardLocalCacheClient } from './smart-card-local-cache-client';
|
package/dist/esm/provider.js
CHANGED
|
@@ -27,7 +27,6 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
27
27
|
import { request } from './api';
|
|
28
28
|
import { SmartCardLocalCacheClient } from './smart-card-local-cache-client';
|
|
29
29
|
var BATCH_WAIT_TIME = 50;
|
|
30
|
-
|
|
31
30
|
// Check if it is matching a Jira Roadmaps or Jira Timeline url
|
|
32
31
|
// NOT to be confused with JSM timeline
|
|
33
32
|
var isJiraRoadmapOrTimeline = function isJiraRoadmapOrTimeline(url) {
|
|
@@ -131,8 +130,46 @@ var isAvpVisualizationView = function isAvpVisualizationView(url) {
|
|
|
131
130
|
export var isJiraWorkItem = function isJiraWorkItem(url) {
|
|
132
131
|
return /\/browse\/((?:\w+)-(?:\d+))/i.test(url);
|
|
133
132
|
};
|
|
133
|
+
export var internalUrlCheckers = {
|
|
134
|
+
isJiraRoadmapOrTimeline: isJiraRoadmapOrTimeline,
|
|
135
|
+
isPolarisView: isPolarisView,
|
|
136
|
+
isJwmView: isJwmView,
|
|
137
|
+
isJiraList: isJiraList,
|
|
138
|
+
isConfluenceWhiteboard: isConfluenceWhiteboard,
|
|
139
|
+
isConfluenceDatabase: isConfluenceDatabase,
|
|
140
|
+
isJiraDashboard: isJiraDashboard,
|
|
141
|
+
isJiraBacklog: isJiraBacklog,
|
|
142
|
+
isJiraBoard: isJiraBoard,
|
|
143
|
+
isJiraPlan: isJiraPlan,
|
|
144
|
+
isJiraVersion: isJiraVersion,
|
|
145
|
+
isJiraForm: isJiraForm,
|
|
146
|
+
isJiraSummary: isJiraSummary,
|
|
147
|
+
isRovoAgentProfilePage: isRovoAgentProfilePage,
|
|
148
|
+
isConfluenceTeamCalendars: isConfluenceTeamCalendars,
|
|
149
|
+
isJiraIssueNavigator: isJiraIssueNavigator
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Check if a URL is an internal Atlassian URL (Jira, Confluence, etc.)
|
|
154
|
+
* by testing it against all known internal URL patterns
|
|
155
|
+
*/
|
|
156
|
+
export function isInternalUrl(url) {
|
|
157
|
+
return Object.values(internalUrlCheckers).some(function (checker) {
|
|
158
|
+
return checker(url);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Check if a URL is external (not a known internal Atlassian URL)
|
|
164
|
+
*/
|
|
165
|
+
export function isExternalUrl(url) {
|
|
166
|
+
return !isInternalUrl(url);
|
|
167
|
+
}
|
|
168
|
+
function isCardNode(node) {
|
|
169
|
+
return ['inlineCard', 'blockCard', 'embedCard'].includes(node.type) && !!node.attrs && 'url' in node.attrs && typeof node.attrs.url === 'string';
|
|
170
|
+
}
|
|
134
171
|
export var EditorCardProvider = /*#__PURE__*/function (_ref) {
|
|
135
|
-
function EditorCardProvider(envKey, baseUrlOverride, product, onResolve, customCardClient) {
|
|
172
|
+
function EditorCardProvider(envKey, baseUrlOverride, product, onResolve, customCardClient, supportedUrlFilter) {
|
|
136
173
|
var _this;
|
|
137
174
|
_classCallCheck(this, EditorCardProvider);
|
|
138
175
|
_this = _callSuper(this, EditorCardProvider);
|
|
@@ -142,6 +179,7 @@ export var EditorCardProvider = /*#__PURE__*/function (_ref) {
|
|
|
142
179
|
_this.resolverUrl = getResolverUrl(envKey, baseUrlOverride);
|
|
143
180
|
_this.transformer = new Transformer();
|
|
144
181
|
_this.onResolve = onResolve;
|
|
182
|
+
_this.supportedUrlFilter = supportedUrlFilter;
|
|
145
183
|
_this.requestHeaders = {
|
|
146
184
|
Origin: _this.baseUrl
|
|
147
185
|
};
|
|
@@ -223,7 +261,13 @@ export var EditorCardProvider = /*#__PURE__*/function (_ref) {
|
|
|
223
261
|
}, {
|
|
224
262
|
key: "isNodeSupported",
|
|
225
263
|
value: function isNodeSupported(node) {
|
|
226
|
-
|
|
264
|
+
if (!isCardNode(node)) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
if (!this.supportedUrlFilter) {
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
return this.supportedUrlFilter(node.attrs.url);
|
|
227
271
|
}
|
|
228
272
|
}, {
|
|
229
273
|
key: "batchProviders",
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { EditorCardProvider, editorCardProvider } from './provider';
|
|
1
|
+
export { EditorCardProvider, editorCardProvider, isInternalUrl, isExternalUrl } from './provider';
|
|
2
2
|
export { SmartCardLocalCacheClient } from './smart-card-local-cache-client';
|
package/dist/types/provider.d.ts
CHANGED
|
@@ -6,10 +6,24 @@ import type { BlockCardAdf, EmbedCardAdf, CardAdf, InlineCardAdf, CardAppearance
|
|
|
6
6
|
import type { CardProvider } from './types';
|
|
7
7
|
import { CardClient } from '@atlaskit/link-provider';
|
|
8
8
|
import type { JsonLd } from '@atlaskit/json-ld-types';
|
|
9
|
+
type UrlChecker = (url: string) => RegExpMatchArray | null;
|
|
9
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;
|
|
10
23
|
type CardNode = InlineCardAdf | BlockCardAdf | EmbedCardAdf;
|
|
24
|
+
type SupportedUrlFilter = (url: string) => boolean;
|
|
11
25
|
export declare class EditorCardProvider extends NodeDataProvider<CardNode, JsonLd.Response> implements CardProvider {
|
|
12
|
-
readonly name: 'editorCardProvider';
|
|
26
|
+
readonly name: 'editorCardProvider' | string;
|
|
13
27
|
private baseUrl;
|
|
14
28
|
private resolverUrl;
|
|
15
29
|
private providersData?;
|
|
@@ -19,7 +33,8 @@ export declare class EditorCardProvider extends NodeDataProvider<CardNode, JsonL
|
|
|
19
33
|
private cardClient;
|
|
20
34
|
private smartCardLocalCacheClient;
|
|
21
35
|
private onResolve;
|
|
22
|
-
|
|
36
|
+
private supportedUrlFilter?;
|
|
37
|
+
constructor(envKey?: EnvironmentsKeys, baseUrlOverride?: string, product?: ProductType, onResolve?: (url: string) => void, customCardClient?: CardClient, supportedUrlFilter?: SupportedUrlFilter);
|
|
23
38
|
refreshCache(node: CardNode | PMNode): void;
|
|
24
39
|
getData(node: CardNode | PMNode, callback: (payload: CallbackPayload<JsonLd.Response>) => void): void;
|
|
25
40
|
nodeDataKey(node: CardNode): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { EditorCardProvider, editorCardProvider } from './provider';
|
|
1
|
+
export { EditorCardProvider, editorCardProvider, isInternalUrl, isExternalUrl } from './provider';
|
|
2
2
|
export { SmartCardLocalCacheClient } from './smart-card-local-cache-client';
|
|
@@ -6,10 +6,24 @@ import type { BlockCardAdf, EmbedCardAdf, CardAdf, InlineCardAdf, CardAppearance
|
|
|
6
6
|
import type { CardProvider } from './types';
|
|
7
7
|
import { CardClient } from '@atlaskit/link-provider';
|
|
8
8
|
import type { JsonLd } from '@atlaskit/json-ld-types';
|
|
9
|
+
type UrlChecker = (url: string) => RegExpMatchArray | null;
|
|
9
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;
|
|
10
23
|
type CardNode = InlineCardAdf | BlockCardAdf | EmbedCardAdf;
|
|
24
|
+
type SupportedUrlFilter = (url: string) => boolean;
|
|
11
25
|
export declare class EditorCardProvider extends NodeDataProvider<CardNode, JsonLd.Response> implements CardProvider {
|
|
12
|
-
readonly name: 'editorCardProvider';
|
|
26
|
+
readonly name: 'editorCardProvider' | string;
|
|
13
27
|
private baseUrl;
|
|
14
28
|
private resolverUrl;
|
|
15
29
|
private providersData?;
|
|
@@ -19,7 +33,8 @@ export declare class EditorCardProvider extends NodeDataProvider<CardNode, JsonL
|
|
|
19
33
|
private cardClient;
|
|
20
34
|
private smartCardLocalCacheClient;
|
|
21
35
|
private onResolve;
|
|
22
|
-
|
|
36
|
+
private supportedUrlFilter?;
|
|
37
|
+
constructor(envKey?: EnvironmentsKeys, baseUrlOverride?: string, product?: ProductType, onResolve?: (url: string) => void, customCardClient?: CardClient, supportedUrlFilter?: SupportedUrlFilter);
|
|
23
38
|
refreshCache(node: CardNode | PMNode): void;
|
|
24
39
|
getData(node: CardNode | PMNode, callback: (payload: CallbackPayload<JsonLd.Response>) => void): void;
|
|
25
40
|
nodeDataKey(node: CardNode): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-card-provider",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.6.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",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@atlaskit/linking-types": "^14.2.0",
|
|
40
40
|
"@atlaskit/node-data-provider": "^9.0.0",
|
|
41
41
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
42
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^48.0.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"dataloader": "^2.1.0"
|
|
45
45
|
},
|