@atlaskit/smart-card 44.5.0 → 44.5.2
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 +18 -0
- package/dist/cjs/extractors/flexible/actions/extract-rovo-chat-action.js +3 -4
- package/dist/cjs/state/hooks/use-current-site-cloud-id/index.js +71 -0
- package/dist/cjs/state/hooks/use-social-proof/index.js +60 -0
- package/dist/cjs/state/services/current-site-cloud-id/index.js +182 -0
- package/dist/cjs/state/services/personalization/index.js +267 -0
- package/dist/cjs/state/services/personalization/types.js +1 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/actions/extract-rovo-chat-action.js +3 -4
- package/dist/es2019/state/hooks/use-current-site-cloud-id/index.js +28 -0
- package/dist/es2019/state/hooks/use-social-proof/index.js +45 -0
- package/dist/es2019/state/services/current-site-cloud-id/index.js +118 -0
- package/dist/es2019/state/services/personalization/index.js +164 -0
- package/dist/es2019/state/services/personalization/types.js +0 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/actions/extract-rovo-chat-action.js +3 -4
- package/dist/esm/state/hooks/use-current-site-cloud-id/index.js +35 -0
- package/dist/esm/state/hooks/use-social-proof/index.js +53 -0
- package/dist/esm/state/services/current-site-cloud-id/index.js +174 -0
- package/dist/esm/state/services/personalization/index.js +258 -0
- package/dist/esm/state/services/personalization/types.js +0 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/common/ui/icons/blog-icon.d.ts +1 -1
- package/dist/types/common/ui/icons/live-document-icon.d.ts +1 -1
- package/dist/types/state/hooks/use-current-site-cloud-id/index.d.ts +6 -0
- package/dist/types/state/hooks/use-social-proof/index.d.ts +13 -0
- package/dist/types/state/services/current-site-cloud-id/index.d.ts +46 -0
- package/dist/types/state/services/personalization/index.d.ts +41 -0
- package/dist/types/state/services/personalization/types.d.ts +10 -0
- package/dist/types/view/FlexibleCard/assets/ai-chapter-icon.d.ts +3 -2
- package/dist/types/view/FlexibleCard/assets/ai-edit-icon.d.ts +3 -2
- package/dist/types/view/FlexibleCard/assets/ai-search-icon.d.ts +3 -2
- package/dist/types/view/FlexibleCard/assets/rovo-hex-logo.d.ts +4 -3
- package/dist/types-ts4.5/common/ui/icons/blog-icon.d.ts +1 -1
- package/dist/types-ts4.5/common/ui/icons/live-document-icon.d.ts +1 -1
- package/dist/types-ts4.5/state/hooks/use-current-site-cloud-id/index.d.ts +6 -0
- package/dist/types-ts4.5/state/hooks/use-social-proof/index.d.ts +13 -0
- package/dist/types-ts4.5/state/services/current-site-cloud-id/index.d.ts +46 -0
- package/dist/types-ts4.5/state/services/personalization/index.d.ts +41 -0
- package/dist/types-ts4.5/state/services/personalization/types.d.ts +10 -0
- package/dist/types-ts4.5/view/FlexibleCard/assets/ai-chapter-icon.d.ts +3 -2
- package/dist/types-ts4.5/view/FlexibleCard/assets/ai-edit-icon.d.ts +3 -2
- package/dist/types-ts4.5/view/FlexibleCard/assets/ai-search-icon.d.ts +3 -2
- package/dist/types-ts4.5/view/FlexibleCard/assets/rovo-hex-logo.d.ts +4 -3
- package/package.json +2 -2
- package/smart-card.docs.tsx +35 -15
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SocialProof {
|
|
2
|
+
connectedPct: number | undefined;
|
|
3
|
+
isEnabled: boolean;
|
|
4
|
+
/** True while fetching personalization (only when `isEnabled`). */
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Fetches provider usage percentage from the TAP Delivery personalization service when the
|
|
9
|
+
* killswitch allows it. Callers decide separately (e.g. via Statsig experiment) whether to
|
|
10
|
+
* surface that data in the UI.
|
|
11
|
+
*/
|
|
12
|
+
declare const useSocialProof: (traitName: string, extensionKey?: string, isKillswitchOn?: boolean) => SocialProof;
|
|
13
|
+
export default useSocialProof;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY: string;
|
|
2
|
+
/** Keys written by this service in localStorage when using {@link smartCardStorage}. */
|
|
3
|
+
export declare const CURRENT_SITE_CLOUD_ID_LOCAL_STORAGE_KEY: string;
|
|
4
|
+
export declare class CurrentSiteCloudIdService {
|
|
5
|
+
/**
|
|
6
|
+
* Holds the shared tenant_info work: one in-flight fetch, then (on success) a settled promise for the session cloud
|
|
7
|
+
* id so later callers never trigger another `tenant_info` in the same page lifetime (until {@link clearCache}).
|
|
8
|
+
*/
|
|
9
|
+
private tenantInfoInflightPromise;
|
|
10
|
+
private readStoredCloudId;
|
|
11
|
+
private writeStoredCloudId;
|
|
12
|
+
private ensureTenantInfoInflightStarted;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the currently cached cloud id synchronously and starts a background refresh.
|
|
15
|
+
* The refresh result is persisted for future calls but is not awaited by this call.
|
|
16
|
+
*/
|
|
17
|
+
getCachedCloudIdAndRefresh(): string | undefined;
|
|
18
|
+
/** Writes tenant cloud id for tests or callers that intentionally warm storage before edge resolves. */
|
|
19
|
+
persistStoredCloudId(cloudId: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* When local storage already has a tenant cloud id, it is returned immediately; a background tenant_info refresh
|
|
22
|
+
* is still kicked off unless one is already in flight.
|
|
23
|
+
*
|
|
24
|
+
* Without storage, this awaits the deduped in-flight tenant_info (first concurrent caller chooses the URL;
|
|
25
|
+
* all share one promise regardless of subsequent `baseUriWithNoTrailingSlash`).
|
|
26
|
+
*
|
|
27
|
+
* On network success with no cloud id, or on failure: falls back via {@link readStoredCloudId}.
|
|
28
|
+
*/
|
|
29
|
+
get(baseUriWithNoTrailingSlash?: string): Promise<string | undefined>;
|
|
30
|
+
/** Clears the session pin so the next {@link get} may run `tenant_info` again (e.g. tests). */
|
|
31
|
+
clearCache(): void;
|
|
32
|
+
}
|
|
33
|
+
export declare const currentSiteCloudIdService: CurrentSiteCloudIdService;
|
|
34
|
+
/**
|
|
35
|
+
* Resolves the current site cloud id through the module-level {@link currentSiteCloudIdService}.
|
|
36
|
+
* Returns a stored cloud id immediately when one exists; otherwise waits for the shared
|
|
37
|
+
* `tenant_info` request and persists the result for subsequent cached reads.
|
|
38
|
+
*/
|
|
39
|
+
export declare const getCurrentSiteCloudId: (baseUriWithNoTrailingSlash?: string) => Promise<string | undefined>;
|
|
40
|
+
/**
|
|
41
|
+
* Reads the current site cloud id from browser storage (the `site-cloud-id:v1` row) via the
|
|
42
|
+
* module-level {@link currentSiteCloudIdService} singleton, without awaiting network work.
|
|
43
|
+
* Calling this also starts the shared `tenant_info` refresh in the background when one is not
|
|
44
|
+
* already running, so a later call can observe a refreshed value when available.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getCachedCurrentSiteCloudIdAndRefresh(): string | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ProviderPctMap } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Logical key shape: `@atlaskit/smart-card:<feature>:<schema-version>:<scope>` (see smart-card
|
|
4
|
+
* storage conventions). {@link StorageClient} narrows the localStorage key to
|
|
5
|
+
* `<clientKey>_<itemKey>` with `clientKey === '@atlaskit/smart-card'` and
|
|
6
|
+
* `itemKey === 'pct-map:v1:<cloudId>:<traitName>'` (scope segments URI-encoded).
|
|
7
|
+
*/
|
|
8
|
+
export declare const PERSONALIZATION_STORAGE_SCOPE: string;
|
|
9
|
+
export declare const PERSONALIZATION_STORAGE_ITEM_KEY_PREFIX: string;
|
|
10
|
+
/**
|
|
11
|
+
* Service for fetching site-level traits from the TAP Delivery personalization API.
|
|
12
|
+
*/
|
|
13
|
+
export declare class PersonalizationService {
|
|
14
|
+
private cache;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the currently cached provider percentage map synchronously and starts a background refresh.
|
|
17
|
+
* The refresh result is persisted for future calls but is not awaited by this call.
|
|
18
|
+
*/
|
|
19
|
+
getCachedProviderPctMapAndRefresh(traitName: string): ProviderPctMap | null;
|
|
20
|
+
getProviderPctMap(traitName: string): Promise<ProviderPctMap | undefined>;
|
|
21
|
+
private readStoredProviderPctMap;
|
|
22
|
+
private writeStoredProviderPctMap;
|
|
23
|
+
private normalizeProviderPctMap;
|
|
24
|
+
private parseTraitValue;
|
|
25
|
+
clearCache(): void;
|
|
26
|
+
private clearStoredProviderPctMaps;
|
|
27
|
+
}
|
|
28
|
+
export declare const personalizationService: PersonalizationService;
|
|
29
|
+
/**
|
|
30
|
+
* Resolves the provider percentage map for a TAP Delivery trait through the module-level
|
|
31
|
+
* {@link personalizationService}. Work is deduped per trait name for the page lifetime, and a
|
|
32
|
+
* successful response is persisted by cloud id and trait name for later cached reads.
|
|
33
|
+
*/
|
|
34
|
+
export declare const getProviderPctMap: (traitName: string) => Promise<ProviderPctMap | undefined>;
|
|
35
|
+
/**
|
|
36
|
+
* Reads the provider percentage map for a trait from browser storage via the module-level
|
|
37
|
+
* {@link personalizationService} singleton, without awaiting network work.
|
|
38
|
+
* Calling this also starts the trait-scoped shared refresh in the background, so a later call can
|
|
39
|
+
* use a refreshed value when it becomes available.
|
|
40
|
+
*/
|
|
41
|
+
export declare function getCachedProviderPctMapAndRefresh(traitName: string): ProviderPctMap | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type PersonalizationTrait = {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string | boolean | number;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Map of extensionKey to connected users percentage.
|
|
7
|
+
* Keys are extensionKeys directly (e.g. 'google-object-provider').
|
|
8
|
+
* Values are integers 0-100.
|
|
9
|
+
*/
|
|
10
|
+
export type ProviderPctMap = Record<string, number>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
(
|
|
2
|
+
interface RovoHexLogoFunction {
|
|
3
|
+
(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
|
+
declare const RovoHexLogo: RovoHexLogoFunction;
|
|
6
7
|
export default RovoHexLogo;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "44.5.
|
|
3
|
+
"version": "44.5.2",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@atlaskit/textfield": "^8.3.0",
|
|
86
86
|
"@atlaskit/theme": "^23.2.0",
|
|
87
87
|
"@atlaskit/tile": "^1.1.0",
|
|
88
|
-
"@atlaskit/tmp-editor-statsig": "^74.
|
|
88
|
+
"@atlaskit/tmp-editor-statsig": "^74.5.0",
|
|
89
89
|
"@atlaskit/tokens": "^13.0.0",
|
|
90
90
|
"@atlaskit/tooltip": "^21.2.0",
|
|
91
91
|
"@atlaskit/ufo": "^0.4.0",
|
package/smart-card.docs.tsx
CHANGED
|
@@ -38,22 +38,26 @@ const documentation: ComponentStructuredContentSource[] = [
|
|
|
38
38
|
examples: [
|
|
39
39
|
{
|
|
40
40
|
name: 'Card (basic)',
|
|
41
|
-
description:
|
|
41
|
+
description:
|
|
42
|
+
'Inline, block, and embed appearances shown side by side. Requires staging login to resolve links.',
|
|
42
43
|
source: path.resolve(packagePath, './examples/content/card.tsx'),
|
|
43
44
|
},
|
|
44
45
|
{
|
|
45
46
|
name: 'Card (appearance: block)',
|
|
46
|
-
description:
|
|
47
|
+
description:
|
|
48
|
+
'Block appearance — card-style preview with detailed view of the linked material. In the editor this is referred to as the "Card".',
|
|
47
49
|
source: path.resolve(packagePath, './examples/content/block-card.tsx'),
|
|
48
50
|
},
|
|
49
51
|
{
|
|
50
52
|
name: 'Card (appearance: inline)',
|
|
51
|
-
description:
|
|
53
|
+
description:
|
|
54
|
+
'Inline appearance — link in text like a hyperlink. Use showHoverPreview for hover preview on inline Smart Links.',
|
|
52
55
|
source: path.resolve(packagePath, './examples/content/inline-card.tsx'),
|
|
53
56
|
},
|
|
54
57
|
{
|
|
55
58
|
name: 'Card (appearance: embed)',
|
|
56
|
-
description:
|
|
59
|
+
description:
|
|
60
|
+
'Embed appearance — linked content rendered in place. Requires a resolvable embed URL; not all links support embed.',
|
|
57
61
|
source: path.resolve(packagePath, './examples/content/embed-card.tsx'),
|
|
58
62
|
},
|
|
59
63
|
],
|
|
@@ -84,7 +88,8 @@ const documentation: ComponentStructuredContentSource[] = [
|
|
|
84
88
|
examples: [
|
|
85
89
|
{
|
|
86
90
|
name: 'Hover card',
|
|
87
|
-
description:
|
|
91
|
+
description:
|
|
92
|
+
'HoverCard wrapping a trigger element; shows Smart Link preview on hover. Requires staging login to resolve.',
|
|
88
93
|
source: path.resolve(packagePath, './examples/content/hover-card.tsx'),
|
|
89
94
|
},
|
|
90
95
|
],
|
|
@@ -114,7 +119,8 @@ const documentation: ComponentStructuredContentSource[] = [
|
|
|
114
119
|
examples: [
|
|
115
120
|
{
|
|
116
121
|
name: 'Link URL',
|
|
117
|
-
description:
|
|
122
|
+
description:
|
|
123
|
+
'Link safety: when link text looks like a URL but destination differs (warning) vs when text matches or is plain (no warning).',
|
|
118
124
|
source: path.resolve(packagePath, './examples/content/link-url.tsx'),
|
|
119
125
|
},
|
|
120
126
|
],
|
|
@@ -139,12 +145,21 @@ const documentation: ComponentStructuredContentSource[] = [
|
|
|
139
145
|
'Use a logical structure (e.g. heading hierarchy) so the card is navigable by assistive tech.',
|
|
140
146
|
'Ensure all interactive elements inside blocks (links, buttons, actions) are focusable and have accessible names.',
|
|
141
147
|
],
|
|
142
|
-
keywords: [
|
|
148
|
+
keywords: [
|
|
149
|
+
'smart-card',
|
|
150
|
+
'flexible',
|
|
151
|
+
'flexible card',
|
|
152
|
+
'flexible ui',
|
|
153
|
+
'blocks',
|
|
154
|
+
'elements',
|
|
155
|
+
'composable',
|
|
156
|
+
],
|
|
143
157
|
categories: ['linking', 'data-display'],
|
|
144
158
|
examples: [
|
|
145
159
|
{
|
|
146
160
|
name: 'Flexible UI card',
|
|
147
|
-
description:
|
|
161
|
+
description:
|
|
162
|
+
'Custom block layout with TitleBlock, PreviewBlock, MetadataBlock, SnippetBlock, and FooterBlock composed inside Card.',
|
|
148
163
|
source: path.resolve(packagePath, './examples/content/flexible-ui-card.tsx'),
|
|
149
164
|
},
|
|
150
165
|
],
|
|
@@ -174,7 +189,8 @@ const documentation: ComponentStructuredContentSource[] = [
|
|
|
174
189
|
examples: [
|
|
175
190
|
{
|
|
176
191
|
name: 'Title block default',
|
|
177
|
-
description:
|
|
192
|
+
description:
|
|
193
|
+
'TitleBlock with default props; title and icon come from the resolved link data.',
|
|
178
194
|
source: path.resolve(packagePath, './examples/content/title-block-default.tsx'),
|
|
179
195
|
},
|
|
180
196
|
],
|
|
@@ -204,7 +220,8 @@ const documentation: ComponentStructuredContentSource[] = [
|
|
|
204
220
|
examples: [
|
|
205
221
|
{
|
|
206
222
|
name: 'Metadata block primary',
|
|
207
|
-
description:
|
|
223
|
+
description:
|
|
224
|
+
'MetadataBlock with a primary row showing CollaboratorGroup and ModifiedOn elements.',
|
|
208
225
|
source: path.resolve(packagePath, './examples/content/metadata-block-primary.tsx'),
|
|
209
226
|
},
|
|
210
227
|
],
|
|
@@ -240,7 +257,8 @@ const documentation: ComponentStructuredContentSource[] = [
|
|
|
240
257
|
},
|
|
241
258
|
{
|
|
242
259
|
name: 'FooterBlock',
|
|
243
|
-
description:
|
|
260
|
+
description:
|
|
261
|
+
'A block component for the Smart Link footer, typically showing actions (e.g. copy, open, follow).',
|
|
244
262
|
status: 'general-availability',
|
|
245
263
|
import: {
|
|
246
264
|
name: 'FooterBlock',
|
|
@@ -262,7 +280,8 @@ const documentation: ComponentStructuredContentSource[] = [
|
|
|
262
280
|
examples: [
|
|
263
281
|
{
|
|
264
282
|
name: 'Footer block default',
|
|
265
|
-
description:
|
|
283
|
+
description:
|
|
284
|
+
'FooterBlock with default actions (e.g. copy, open, follow) at the bottom of the card.',
|
|
266
285
|
source: path.resolve(packagePath, './examples/content/footer-block-default.tsx'),
|
|
267
286
|
},
|
|
268
287
|
],
|
|
@@ -291,7 +310,8 @@ const documentation: ComponentStructuredContentSource[] = [
|
|
|
291
310
|
examples: [
|
|
292
311
|
{
|
|
293
312
|
name: 'Analytics',
|
|
294
|
-
description:
|
|
313
|
+
description:
|
|
314
|
+
'Card with AnalyticsListener capturing and displaying Smart Link analytics events (e.g. on click).',
|
|
295
315
|
source: path.resolve(packagePath, './examples/content/analytics.tsx'),
|
|
296
316
|
},
|
|
297
317
|
],
|
|
@@ -320,12 +340,12 @@ const documentation: ComponentStructuredContentSource[] = [
|
|
|
320
340
|
examples: [
|
|
321
341
|
{
|
|
322
342
|
name: 'useSmartLinkActions',
|
|
323
|
-
description:
|
|
343
|
+
description:
|
|
344
|
+
'useSmartLinkActions used to get actions for a URL and invoke one (e.g. Preview) from a custom button.',
|
|
324
345
|
source: path.resolve(packagePath, './examples/content/useSmartLinkActions.tsx'),
|
|
325
346
|
},
|
|
326
347
|
],
|
|
327
348
|
},
|
|
328
349
|
];
|
|
329
350
|
|
|
330
|
-
|
|
331
351
|
export default documentation;
|