@atlaskit/editor-card-provider 6.8.22 → 6.8.23
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 +6 -0
- package/package.json +2 -2
- package/provider/package.json +1 -8
- package/smart-card-local-cache-client/package.json +1 -8
- package/url-checkers/package.json +1 -8
- package/dist/types-ts4.5/api.d.ts +0 -5
- package/dist/types-ts4.5/entry-points/provider.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/smart-card-local-cache-client.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/url-checkers.d.ts +0 -1
- package/dist/types-ts4.5/index.d.ts +0 -2
- package/dist/types-ts4.5/provider.d.ts +0 -80
- package/dist/types-ts4.5/smart-card-local-cache-client.d.ts +0 -55
- package/dist/types-ts4.5/transformer.d.ts +0 -9
- package/dist/types-ts4.5/types.d.ts +0 -34
- package/dist/types-ts4.5/url-checkers.d.ts +0 -10
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-card-provider",
|
|
3
|
-
"version": "6.8.
|
|
3
|
+
"version": "6.8.23",
|
|
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": "^
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^103.0.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"dataloader": "^2.1.0"
|
|
45
45
|
},
|
package/provider/package.json
CHANGED
|
@@ -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 +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,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;
|