@ebitex/content-sdk 1.0.229 → 1.0.236
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/README.md +15 -8
- package/dist/audience/client.d.ts +26 -34
- package/dist/audience/client.d.ts.map +1 -1
- package/dist/audience/client.js +1 -22
- package/dist/audience/client.js.map +1 -1
- package/dist/audience/session.d.ts +72 -0
- package/dist/audience/session.d.ts.map +1 -0
- package/dist/audience/session.js +199 -0
- package/dist/audience/session.js.map +1 -0
- package/dist/content/client.d.ts +31 -11
- package/dist/content/client.d.ts.map +1 -1
- package/dist/content/client.js +84 -22
- package/dist/content/client.js.map +1 -1
- package/dist/delivery/client.d.ts +22 -12
- package/dist/delivery/client.d.ts.map +1 -1
- package/dist/delivery/client.js +22 -12
- package/dist/delivery/client.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/react/Experience.d.ts.map +1 -1
- package/dist/react/Experience.js +4 -1
- package/dist/react/Experience.js.map +1 -1
- package/dist/react/Resolve.d.ts.map +1 -1
- package/dist/react/Resolve.js +3 -1
- package/dist/react/Resolve.js.map +1 -1
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +3 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/useAudienceChange.d.ts +18 -0
- package/dist/react/useAudienceChange.d.ts.map +1 -0
- package/dist/react/useAudienceChange.js +23 -0
- package/dist/react/useAudienceChange.js.map +1 -0
- package/dist/react/useNavigation.d.ts.map +1 -1
- package/dist/react/useNavigation.js +3 -1
- package/dist/react/useNavigation.js.map +1 -1
- package/dist/react/useSignIn.d.ts +27 -0
- package/dist/react/useSignIn.d.ts.map +1 -0
- package/dist/react/useSignIn.js +57 -0
- package/dist/react/useSignIn.js.map +1 -0
- package/dist/render/protocol.d.ts +7 -1
- package/dist/render/protocol.d.ts.map +1 -1
- package/dist/render/protocol.js.map +1 -1
- package/dist/types.d.ts +3 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -117,18 +117,25 @@ with the content model it expects.
|
|
|
117
117
|
|
|
118
118
|
## Know the visitor's audiences
|
|
119
119
|
|
|
120
|
-
Personalized
|
|
121
|
-
|
|
120
|
+
Personalized and restricted content depends on which audiences a visitor is in. Give the client an `audience` option and it
|
|
121
|
+
does the whole flow: it asks which audiences your content uses, asks Audience which of them the visitor is in, keeps the
|
|
122
|
+
signed answer in memory, renews it, and sends it with every read.
|
|
122
123
|
|
|
123
124
|
```ts
|
|
124
|
-
import {
|
|
125
|
-
|
|
126
|
-
const audience = createAudienceClient({ apiKey: import.meta.env.VITE_AUDIENCE_DELIVERY_KEY })
|
|
125
|
+
import { createContentClient } from '@ebitex/content-sdk'
|
|
127
126
|
|
|
128
|
-
const
|
|
129
|
-
|
|
127
|
+
const content = createContentClient({
|
|
128
|
+
apiKey: import.meta.env.VITE_DELIVERY_KEY,
|
|
129
|
+
audience: { apiKey: import.meta.env.VITE_AUDIENCE_DELIVERY_KEY },
|
|
130
|
+
})
|
|
130
131
|
```
|
|
131
132
|
|
|
133
|
+
A Forms submission, a sign-in link followed in another tab, the tab coming back after a pause and a stale token each
|
|
134
|
+
refresh the answer by themselves, and `<Experience>` re-reads when it changes. `useAudienceChange()` re-renders your own
|
|
135
|
+
component when the visitor's audiences change, and `useSignIn()` runs the emailed-link sign-in. On a server, make one
|
|
136
|
+
client per request with `content.forVisitor({ visitor, consent })`. Audiences are never sent in the context; Content
|
|
137
|
+
refuses them there.
|
|
138
|
+
|
|
132
139
|
An Audience delivery key is its own kind (a Content delivery key does not work). One with an allowed-origins list is
|
|
133
140
|
browser-safe and the list is checked on every request. `visitor` and `consent` are optional: without them, or without
|
|
134
|
-
consent granted on that device, the context alone decides
|
|
141
|
+
consent granted on that device, the context alone decides. It never throws into a page: when Audience cannot answer, the visitor holds no audiences and `onError` hears about it.
|
|
@@ -28,9 +28,14 @@ export interface AudienceConsentSignals {
|
|
|
28
28
|
export interface ResolveAudiencesOptions {
|
|
29
29
|
/**
|
|
30
30
|
* The session's own properties: a flat object of strings, numbers, booleans and lists of those (a locale, a campaign, a buyer type). Members under
|
|
31
|
-
* `individual` are reserved and refused.
|
|
31
|
+
* `individual` are reserved and refused. Audiences are the result of this call, never an input.
|
|
32
32
|
*/
|
|
33
|
-
ctx?:
|
|
33
|
+
ctx?: ContextBag;
|
|
34
|
+
/**
|
|
35
|
+
* Ask only about these audiences (at most 64): the ones your content uses, which `GET /content/delivery/v1/audiences` lists. This keeps the signed token small. More than 64 is refused with
|
|
36
|
+
* `too_many_audiences`; a token never drops a grant silently. The content client does this for you.
|
|
37
|
+
*/
|
|
38
|
+
audiences?: readonly string[];
|
|
34
39
|
/** The device's visitor token, when the site has one. */
|
|
35
40
|
visitor?: string;
|
|
36
41
|
consent?: AudienceConsentSignals;
|
|
@@ -38,32 +43,29 @@ export interface ResolveAudiencesOptions {
|
|
|
38
43
|
}
|
|
39
44
|
/** Why a presented visitor was not recognised. */
|
|
40
45
|
export type AudienceRecognitionReason = 'token_invalid' | 'session_token' | 'revoked' | 'recognition_not_granted' | 'no_visitor';
|
|
46
|
+
/** What a grant proves: `verified` (a stored member who proved control of their email), `declared` (a stored member) or `context` (worked out from the context you sent, which anyone can obtain: public copy). */
|
|
47
|
+
export type AudienceAssurance = 'verified' | 'declared' | 'context';
|
|
48
|
+
export interface AudienceGrant {
|
|
49
|
+
audienceId: string;
|
|
50
|
+
assurance: AudienceAssurance;
|
|
51
|
+
}
|
|
52
|
+
/** The signed answer that proves a visitor's audiences to Content. Opaque to you: the content client sends it, and renews it before `expiresAtUtc`. */
|
|
53
|
+
export interface AudienceAccess {
|
|
54
|
+
/** The signed audience token to send as `X-Ebitex-Audiences`. */
|
|
55
|
+
token: string;
|
|
56
|
+
expiresAtUtc: string;
|
|
57
|
+
grants: AudienceGrant[];
|
|
58
|
+
}
|
|
41
59
|
export interface ResolvedAudiences {
|
|
42
|
-
/** The ids of the audiences the visitor is in, sorted. Ids only: Content stores an id, so a rename breaks nothing. */
|
|
60
|
+
/** The ids of the audiences the visitor is in (the grants' ids), sorted. Ids only: Content stores an id, so a rename breaks nothing. */
|
|
43
61
|
audiences: string[];
|
|
62
|
+
/** The signed audience token and the grants it carries, for every visitor, an anonymous one included. */
|
|
63
|
+
access: AudienceAccess;
|
|
44
64
|
/** True when what Audience knows about a person was used. False means the context alone decided. */
|
|
45
65
|
recognised: boolean;
|
|
46
66
|
/** Why a presented visitor was not recognised, else `null`. */
|
|
47
67
|
reason: AudienceRecognitionReason | null;
|
|
48
68
|
}
|
|
49
|
-
export interface ClaimOptions {
|
|
50
|
-
/** The device's visitor token. A claim is for this device only. */
|
|
51
|
-
visitor?: string;
|
|
52
|
-
consent?: AudienceConsentSignals;
|
|
53
|
-
/** Ask only about the audiences your rules name (at most 200). The claim stays small, and each ask costs less. */
|
|
54
|
-
audiences?: readonly string[];
|
|
55
|
-
signal?: AbortSignal;
|
|
56
|
-
}
|
|
57
|
-
export interface MembershipClaim {
|
|
58
|
-
/** The signed claim to send as `membership` on Content requests, or `null` when the visitor is not recognised: show the unlock page, it is not an error. */
|
|
59
|
-
claim: string | null;
|
|
60
|
-
/** When the claim stops verifying. Ask again before then: each ask re-reads membership, so a removal takes effect within one lifetime. */
|
|
61
|
-
expiresAtUtc: string | null;
|
|
62
|
-
recognised: boolean;
|
|
63
|
-
reason: AudienceRecognitionReason | null;
|
|
64
|
-
/** The audience ids the claim carries. Ids only. */
|
|
65
|
-
audiences: string[];
|
|
66
|
-
}
|
|
67
69
|
export interface StartSignInOptions {
|
|
68
70
|
/** The address the visitor holds. */
|
|
69
71
|
email: string;
|
|
@@ -78,28 +80,18 @@ export interface StartSignInOptions {
|
|
|
78
80
|
}
|
|
79
81
|
export interface AudienceClient {
|
|
80
82
|
readonly baseUrl: string;
|
|
81
|
-
/**
|
|
82
|
-
* The signed claim Content needs to serve a restricted page: which audiences this device's person is in. Pass the result's `claim` as `membership` to `resolveLocation`,
|
|
83
|
-
* `getNavigation` or `resolvePath`, and ask again before `expiresAtUtc`. A visitor nobody recognises gets `claim: null` and the reason, not an error.
|
|
84
|
-
*/
|
|
85
|
-
claim(options?: ClaimOptions): Promise<MembershipClaim>;
|
|
86
83
|
/**
|
|
87
84
|
* Asks for a one-time sign-in link to be emailed. **The answer never depends on the address** (always the same message), so it cannot be used to find out who is a member.
|
|
88
|
-
* After the visitor
|
|
85
|
+
* After the visitor follows the link, resolve again (the content client does this when the tab becomes visible).
|
|
89
86
|
*/
|
|
90
87
|
startSignIn(options: StartSignInOptions): Promise<{
|
|
91
88
|
message: string;
|
|
92
89
|
}>;
|
|
93
90
|
/**
|
|
94
|
-
* Which audiences is this visitor in
|
|
95
|
-
*
|
|
91
|
+
* Which audiences is this visitor in, and the signed token that proves it? The content client calls this for you (the `audience` option of `createContentClient`); call it
|
|
92
|
+
* yourself only when you use the delivery client directly, and send `access.token` as `audienceToken`. It never calls Content, and Content never calls it.
|
|
96
93
|
*/
|
|
97
94
|
resolve(options?: ResolveAudiencesOptions): Promise<ResolvedAudiences>;
|
|
98
95
|
}
|
|
99
96
|
export declare function createAudienceClient(options: AudienceClientOptions): AudienceClient;
|
|
100
|
-
/**
|
|
101
|
-
* The context to send to Content: `ctx` with the resolved audience ids added to any it already has (the union, each id once, in order). Pure, and
|
|
102
|
-
* it never mutates `ctx`.
|
|
103
|
-
*/
|
|
104
|
-
export declare function withAudiences(ctx: ContextBag | undefined, resolved: Pick<ResolvedAudiences, 'audiences'>): ContextBag;
|
|
105
97
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/audience/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAK7C,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH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AM,CAAA;KAAE,CAAC,CAAA;IAEtE;;;OAGG;IACH,OAAO,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;CACvE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CA4CnF"}
|
package/dist/audience/client.js
CHANGED
|
@@ -10,19 +10,6 @@ export function createAudienceClient(options) {
|
|
|
10
10
|
const doFetch = options.fetch ?? globalThis.fetch;
|
|
11
11
|
return {
|
|
12
12
|
baseUrl,
|
|
13
|
-
async claim(o = {}) {
|
|
14
|
-
const response = await doFetch(`${baseUrl}/audience/delivery/v1/claim`, {
|
|
15
|
-
method: 'POST',
|
|
16
|
-
headers: { Authorization: `Bearer ${apiKey}`, Accept: 'application/json', 'Content-Type': 'application/json' },
|
|
17
|
-
body: JSON.stringify({ visitor: o.visitor, consent: o.consent, audiences: o.audiences }),
|
|
18
|
-
signal: o.signal,
|
|
19
|
-
});
|
|
20
|
-
if (!response.ok) {
|
|
21
|
-
const body = await readBody(response);
|
|
22
|
-
throw new ContentDeliveryError(response.status, body, readRetryAfter(response, body), readRequestId(response, body));
|
|
23
|
-
}
|
|
24
|
-
return (await response.json());
|
|
25
|
-
},
|
|
26
13
|
async startSignIn(o) {
|
|
27
14
|
const response = await doFetch(`${baseUrl}/audience/delivery/v1/sign-in`, {
|
|
28
15
|
method: 'POST',
|
|
@@ -40,7 +27,7 @@ export function createAudienceClient(options) {
|
|
|
40
27
|
const response = await doFetch(`${baseUrl}/audience/delivery/v1/resolve`, {
|
|
41
28
|
method: 'POST',
|
|
42
29
|
headers: { Authorization: `Bearer ${apiKey}`, Accept: 'application/json', 'Content-Type': 'application/json' },
|
|
43
|
-
body: JSON.stringify({ ctx: o.ctx ?? {}, visitor: o.visitor, consent: o.consent }),
|
|
30
|
+
body: JSON.stringify({ ctx: o.ctx ?? {}, visitor: o.visitor, consent: o.consent, audiences: o.audiences }),
|
|
44
31
|
signal: o.signal,
|
|
45
32
|
});
|
|
46
33
|
if (!response.ok) {
|
|
@@ -51,12 +38,4 @@ export function createAudienceClient(options) {
|
|
|
51
38
|
},
|
|
52
39
|
};
|
|
53
40
|
}
|
|
54
|
-
/**
|
|
55
|
-
* The context to send to Content: `ctx` with the resolved audience ids added to any it already has (the union, each id once, in order). Pure, and
|
|
56
|
-
* it never mutates `ctx`.
|
|
57
|
-
*/
|
|
58
|
-
export function withAudiences(ctx, resolved) {
|
|
59
|
-
const merged = [...new Set([...(ctx?.audiences ?? []), ...resolved.audiences])];
|
|
60
|
-
return { ...ctx, audiences: merged };
|
|
61
|
-
}
|
|
62
41
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/audience/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE/E,MAAM,gBAAgB,GAAG,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/audience/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE/E,MAAM,gBAAgB,GAAG,uBAAuB,CAAA;AA4GhD,MAAM,UAAU,oBAAoB,CAAC,OAA8B;IACjE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;IAC1B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;IAC7D,CAAC;IAED,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CA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,cAAc,EAAE,kBAAkB,EAAE;gBAC9G,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;gBAC1G,MAAM,EAAE,CAAC,CAAC,MAAM;aACjB,CAAC,CAAA;YAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAA;gBACrC,MAAM,IAAI,oBAAoB,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAA;YACtH,CAAC;YAED,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAsB,CAAA;QACrD,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ContextBag } from '../types.js';
|
|
2
|
+
import type { AudienceClient, AudienceConsentSignals } from './client.js';
|
|
3
|
+
/**
|
|
4
|
+
* The audience half of `createContentClient`: everything between "this visitor" and "the right content" that an implementer should never have to know about. It asks Content
|
|
5
|
+
* which audiences it uses, asks Audience which of them the visitor is in (once per session, using the visitor's cookie and consent where they exist), keeps the signed answer **in
|
|
6
|
+
* memory only**, hands it to every read, and renews it before it expires or when something may have changed (a Forms submission, the tab becoming visible again after a pause, a
|
|
7
|
+
* response that says the token is stale). It never throws into a page: when Audience cannot answer, the visitor simply holds no audiences and `onError` hears about it.
|
|
8
|
+
*/
|
|
9
|
+
export interface AudienceOptions {
|
|
10
|
+
/** An Audience **delivery** key. A key with an allowed-origins or IP restriction is browser-safe; one with neither is a server key and must never reach a browser. */
|
|
11
|
+
apiKey: string;
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
fetch?: typeof globalThis.fetch;
|
|
14
|
+
/**
|
|
15
|
+
* What the page knows about this visit, sent to **Audience only** (never to Content), so a campaign tag can place the visitor in a "came from a campaign" audience without splitting
|
|
16
|
+
* Content's cache. A flat object of strings, numbers, booleans and lists of those, or a function producing it each time the visitor's audiences are asked for.
|
|
17
|
+
*/
|
|
18
|
+
context?: ContextBag | (() => ContextBag | Promise<ContextBag>);
|
|
19
|
+
/** The visitors SDK instance (`createVisitors(...)`): its `token` is the device's visitor token. Or pass the token yourself with `visitor`. In a browser with neither, the `ebitex_visitor` cookie is read. */
|
|
20
|
+
visitors?: {
|
|
21
|
+
readonly token: string | null;
|
|
22
|
+
};
|
|
23
|
+
visitor?: string | null | (() => string | null | undefined);
|
|
24
|
+
/** The device's raw consent signals (`cmp`, `gpc`, `dnt`, `cmpString`), when your site has them. Only Audience turns these into a decision. */
|
|
25
|
+
consent?: AudienceConsentSignals | (() => AudienceConsentSignals | undefined);
|
|
26
|
+
/** Called when Audience or the audience list could not be read. The page still renders (the visitor holds no audiences); this is for your logs. */
|
|
27
|
+
onError?: (error: unknown) => void;
|
|
28
|
+
}
|
|
29
|
+
/** What the content client reads before every request. */
|
|
30
|
+
export interface HeldAudiences {
|
|
31
|
+
/** The signed token to send, or `undefined` when the visitor holds no audience Content uses. */
|
|
32
|
+
token: string | undefined;
|
|
33
|
+
/** `'none'` when the visitor holds no audience Content uses; otherwise a stable key of their grants, safe to put in a cache key. */
|
|
34
|
+
key: string;
|
|
35
|
+
}
|
|
36
|
+
export interface AudienceHandle {
|
|
37
|
+
/** Renews the visitor's audiences now, re-reading what changed. Needed only to force it: a Forms submission, a sign-in link followed in another tab, an expiring token and a stale-token response each do it by themselves. */
|
|
38
|
+
refresh(): Promise<void>;
|
|
39
|
+
/** Called whenever the visitor's audiences change. Returns the function that stops listening. */
|
|
40
|
+
onChange(listener: () => void): () => void;
|
|
41
|
+
/** The ids of the audiences the visitor holds that Content uses (a hint for your own UI: the server already decided what to deliver). */
|
|
42
|
+
readonly audiences: readonly string[];
|
|
43
|
+
/** Increments each time the visitor's audiences change. */
|
|
44
|
+
readonly revision: number;
|
|
45
|
+
/** Asks for a one-time sign-in link to be emailed, for the device's visitor. The answer never depends on the address. */
|
|
46
|
+
signIn(email: string, options?: {
|
|
47
|
+
returnUrl?: string;
|
|
48
|
+
audienceId?: string;
|
|
49
|
+
}): Promise<{
|
|
50
|
+
message: string;
|
|
51
|
+
}>;
|
|
52
|
+
/** Stops the listeners and the renewal timer this session holds. */
|
|
53
|
+
dispose(): void;
|
|
54
|
+
}
|
|
55
|
+
export declare const NONE_KEY = "none";
|
|
56
|
+
/** The browser event the Forms SDK dispatches on `window` after a successful submission. Carries no personal data. */
|
|
57
|
+
export declare const FORM_SUBMITTED_EVENT = "ebitex:form-submitted";
|
|
58
|
+
export interface AudienceSessionInput {
|
|
59
|
+
options: AudienceOptions;
|
|
60
|
+
client: AudienceClient;
|
|
61
|
+
/** The audiences published content names (`GET /audiences`). */
|
|
62
|
+
listInUse: () => Promise<string[]>;
|
|
63
|
+
now?: () => number;
|
|
64
|
+
}
|
|
65
|
+
export interface AudienceSession extends AudienceHandle {
|
|
66
|
+
/** The token and cache key to use for the request being made now: resolves (once) if nothing is held. */
|
|
67
|
+
current(): Promise<HeldAudiences>;
|
|
68
|
+
/** The response said the token sent was `expired` or `invalid`. */
|
|
69
|
+
stale(): void;
|
|
70
|
+
}
|
|
71
|
+
export declare function createAudienceSession(input: AudienceSessionInput): AudienceSession;
|
|
72
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/audience/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAkB,cAAc,EAAE,sBAAsB,EAAiB,MAAM,aAAa,CAAA;AA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,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC1G,oEAAoE;IACpE,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,eAAO,MAAM,QAAQ,SAAS,CAAA;AAc9B,sHAAsH;AACtH,eAAO,MAAM,oBAAoB,0BAA0B,CAAA;AAO3D,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,eAAe,CAAA;IACxB,MAAM,EAAE,cAAc,CAAA;IACtB,gEAAgE;IAChE,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAClC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,yGAAyG;IACzG,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC,CAAA;IACjC,mEAAmE;IACnE,KAAK,IAAI,IAAI,CAAA;CACd;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,GAAG,eAAe,CAmLlF"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { ContentSdkError } from '../errors.js';
|
|
2
|
+
export const NONE_KEY = 'none';
|
|
3
|
+
const NONE = { token: undefined, key: NONE_KEY };
|
|
4
|
+
/** Renew this long before the token expires, so a request never carries one that lapses on the way. */
|
|
5
|
+
const RENEW_MARGIN_MS = 60_000;
|
|
6
|
+
/** After a failed renewal, ask again no sooner than this, so a down Audience is not hammered by every request. */
|
|
7
|
+
const FAILURE_BACKOFF_MS = 30_000;
|
|
8
|
+
/** A stale-token response triggers at most one renewal per this long, so a server that keeps saying so cannot start a loop. */
|
|
9
|
+
const STALE_RENEWAL_GAP_MS = 10_000;
|
|
10
|
+
/** A tab hidden for at least this long refreshes when it becomes visible again (a sign-in link followed in another tab). */
|
|
11
|
+
const HIDDEN_LONG_ENOUGH_MS = 3_000;
|
|
12
|
+
/** The longest a single timer may wait (just under 2^31 ms). */
|
|
13
|
+
const MAX_TIMER_MS = 2_000_000_000;
|
|
14
|
+
/** The browser event the Forms SDK dispatches on `window` after a successful submission. Carries no personal data. */
|
|
15
|
+
export const FORM_SUBMITTED_EVENT = 'ebitex:form-submitted';
|
|
16
|
+
export function createAudienceSession(input) {
|
|
17
|
+
const { options, client, listInUse } = input;
|
|
18
|
+
const now = input.now ?? (() => Date.now());
|
|
19
|
+
let held;
|
|
20
|
+
let revision = 0;
|
|
21
|
+
let inflight;
|
|
22
|
+
let inUse;
|
|
23
|
+
let timer;
|
|
24
|
+
let lastStaleRenewal = -Infinity;
|
|
25
|
+
let hiddenSince = 0;
|
|
26
|
+
let disposed = false;
|
|
27
|
+
const listeners = new Set();
|
|
28
|
+
function visitorNow() {
|
|
29
|
+
const source = options.visitor;
|
|
30
|
+
const explicit = typeof source === 'function' ? source() : source;
|
|
31
|
+
if (typeof explicit === 'string' && explicit !== '')
|
|
32
|
+
return explicit;
|
|
33
|
+
if (explicit === null)
|
|
34
|
+
return undefined;
|
|
35
|
+
const fromSdk = options.visitors?.token;
|
|
36
|
+
if (typeof fromSdk === 'string' && fromSdk !== '')
|
|
37
|
+
return fromSdk;
|
|
38
|
+
return cookieVisitor();
|
|
39
|
+
}
|
|
40
|
+
function consentNow() {
|
|
41
|
+
return typeof options.consent === 'function' ? options.consent() : options.consent;
|
|
42
|
+
}
|
|
43
|
+
async function contextNow() {
|
|
44
|
+
const source = options.context;
|
|
45
|
+
if (source === undefined)
|
|
46
|
+
return {};
|
|
47
|
+
return typeof source === 'function' ? await source() : source;
|
|
48
|
+
}
|
|
49
|
+
function keyOf(grants) {
|
|
50
|
+
return grants.length === 0
|
|
51
|
+
? NONE_KEY
|
|
52
|
+
: [...grants].map((g) => `${g.audienceId}:${g.assurance}`).sort().join(',');
|
|
53
|
+
}
|
|
54
|
+
function commit(next) {
|
|
55
|
+
const changed = (held?.key ?? NONE_KEY) !== next.key;
|
|
56
|
+
held = next;
|
|
57
|
+
schedule();
|
|
58
|
+
if (changed) {
|
|
59
|
+
revision += 1;
|
|
60
|
+
for (const listener of [...listeners]) {
|
|
61
|
+
try {
|
|
62
|
+
listener();
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
options.onError?.(error);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function schedule() {
|
|
71
|
+
if (timer !== undefined)
|
|
72
|
+
clearTimeout(timer);
|
|
73
|
+
timer = undefined;
|
|
74
|
+
if (disposed || held === undefined || held.token === undefined || !Number.isFinite(held.expiresAtMs))
|
|
75
|
+
return;
|
|
76
|
+
// Clamped: a delay past 2^31 ms makes a timer fire at once, which would renew in a loop.
|
|
77
|
+
const wait = Math.min(MAX_TIMER_MS, Math.max(1_000, held.expiresAtMs - RENEW_MARGIN_MS - now()));
|
|
78
|
+
timer = setTimeout(() => void renew(), wait);
|
|
79
|
+
timer.unref?.();
|
|
80
|
+
}
|
|
81
|
+
function fromAccess(access) {
|
|
82
|
+
const grants = access.grants ?? [];
|
|
83
|
+
return { token: grants.length === 0 ? undefined : access.token, key: keyOf(grants), expiresAtMs: Date.parse(access.expiresAtUtc), grants };
|
|
84
|
+
}
|
|
85
|
+
async function doRenew() {
|
|
86
|
+
try {
|
|
87
|
+
inUse ??= listInUse();
|
|
88
|
+
const used = await inUse;
|
|
89
|
+
// Content names no audience: there is nothing to ask Audience about, and an empty `audiences` would ask about everything.
|
|
90
|
+
if (used.length === 0) {
|
|
91
|
+
commit({ ...NONE, expiresAtMs: now() + RENEW_MARGIN_MS * 5, grants: [] });
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const resolved = await client.resolve({ ctx: await contextNow(), visitor: visitorNow(), consent: consentNow(), audiences: used });
|
|
95
|
+
commit(fromAccess(resolved.access));
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
inUse = undefined;
|
|
99
|
+
options.onError?.(error);
|
|
100
|
+
commit({ ...NONE, expiresAtMs: now() + FAILURE_BACKOFF_MS, grants: [] });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function renew() {
|
|
104
|
+
if (disposed)
|
|
105
|
+
return Promise.resolve();
|
|
106
|
+
inflight ??= doRenew().finally(() => {
|
|
107
|
+
inflight = undefined;
|
|
108
|
+
});
|
|
109
|
+
return inflight;
|
|
110
|
+
}
|
|
111
|
+
async function refresh() {
|
|
112
|
+
// Whatever is in flight was started before whatever made us refresh, so it may be answering the old question: let it finish, then ask again.
|
|
113
|
+
if (inflight !== undefined)
|
|
114
|
+
await inflight;
|
|
115
|
+
inUse = undefined;
|
|
116
|
+
await renew();
|
|
117
|
+
}
|
|
118
|
+
function onFormSubmitted() {
|
|
119
|
+
void refresh();
|
|
120
|
+
}
|
|
121
|
+
function onVisibility() {
|
|
122
|
+
if (document.visibilityState === 'hidden') {
|
|
123
|
+
hiddenSince = now();
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (hiddenSince !== 0 && now() - hiddenSince >= HIDDEN_LONG_ENOUGH_MS) {
|
|
127
|
+
hiddenSince = 0;
|
|
128
|
+
void refresh();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const browser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof window.addEventListener === 'function';
|
|
132
|
+
if (browser) {
|
|
133
|
+
window.addEventListener(FORM_SUBMITTED_EVENT, onFormSubmitted);
|
|
134
|
+
document.addEventListener('visibilitychange', onVisibility);
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
async current() {
|
|
138
|
+
if (held === undefined || now() >= held.expiresAtMs - (held.token === undefined ? 0 : RENEW_MARGIN_MS)) {
|
|
139
|
+
await renew();
|
|
140
|
+
}
|
|
141
|
+
return held === undefined ? NONE : { token: held.token, key: held.key };
|
|
142
|
+
},
|
|
143
|
+
stale() {
|
|
144
|
+
if (now() - lastStaleRenewal < STALE_RENEWAL_GAP_MS)
|
|
145
|
+
return;
|
|
146
|
+
lastStaleRenewal = now();
|
|
147
|
+
void refresh();
|
|
148
|
+
},
|
|
149
|
+
refresh,
|
|
150
|
+
onChange(listener) {
|
|
151
|
+
listeners.add(listener);
|
|
152
|
+
return () => {
|
|
153
|
+
listeners.delete(listener);
|
|
154
|
+
};
|
|
155
|
+
},
|
|
156
|
+
get audiences() {
|
|
157
|
+
return held === undefined ? [] : [...new Set(held.grants.map((g) => g.audienceId))].sort();
|
|
158
|
+
},
|
|
159
|
+
get revision() {
|
|
160
|
+
return revision;
|
|
161
|
+
},
|
|
162
|
+
async signIn(email, extra = {}) {
|
|
163
|
+
const visitor = visitorNow();
|
|
164
|
+
if (visitor === undefined) {
|
|
165
|
+
throw new ContentSdkError('invalid_options', 'Signing in needs the device\'s visitor token: pass `visitors` (or `visitor`) in the audience option.');
|
|
166
|
+
}
|
|
167
|
+
return client.startSignIn({ email, visitor, consent: consentNow(), returnUrl: extra.returnUrl, audienceId: extra.audienceId });
|
|
168
|
+
},
|
|
169
|
+
dispose() {
|
|
170
|
+
disposed = true;
|
|
171
|
+
if (timer !== undefined)
|
|
172
|
+
clearTimeout(timer);
|
|
173
|
+
listeners.clear();
|
|
174
|
+
if (browser) {
|
|
175
|
+
window.removeEventListener(FORM_SUBMITTED_EVENT, onFormSubmitted);
|
|
176
|
+
document.removeEventListener('visibilitychange', onVisibility);
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/** The recognition cookie the visitors SDK writes while a device may be recognised. Absent on a server, and when recognition was not granted. */
|
|
182
|
+
function cookieVisitor() {
|
|
183
|
+
if (typeof document === 'undefined' || typeof document.cookie !== 'string')
|
|
184
|
+
return undefined;
|
|
185
|
+
for (const part of document.cookie.split(';')) {
|
|
186
|
+
const [name, ...rest] = part.trim().split('=');
|
|
187
|
+
if (name === 'ebitex_visitor') {
|
|
188
|
+
const value = rest.join('=');
|
|
189
|
+
try {
|
|
190
|
+
return decodeURIComponent(value) || undefined;
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
return value || undefined;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/audience/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAwD9C,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAA;AAC9B,MAAM,IAAI,GAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAA;AAE/D,uGAAuG;AACvG,MAAM,eAAe,GAAG,MAAM,CAAA;AAC9B,kHAAkH;AAClH,MAAM,kBAAkB,GAAG,MAAM,CAAA;AACjC,+HAA+H;AAC/H,MAAM,oBAAoB,GAAG,MAAM,CAAA;AACnC,4HAA4H;AAC5H,MAAM,qBAAqB,GAAG,KAAK,CAAA;AACnC,gEAAgE;AAChE,MAAM,YAAY,GAAG,aAAa,CAAA;AAElC,sHAAsH;AACtH,MAAM,CAAC,MAAM,oBAAoB,GAAG,uBAAuB,CAAA;AAsB3D,MAAM,UAAU,qBAAqB,CAAC,KAA2B;IAC/D,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAA;IAC5C,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IAE3C,IAAI,IAAsB,CAAA;IAC1B,IAAI,QAAQ,GAAG,CAAC,CAAA;IAChB,IAAI,QAAmC,CAAA;IACvC,IAAI,KAAoC,CAAA;IACxC,IAAI,KAAgD,CAAA;IACpD,IAAI,gBAAgB,GAAG,CAAC,QAAQ,CAAA;IAChC,IAAI,WAAW,GAAG,CAAC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AK,CAAC,UAAU,EAAE,CAAC,CAAA;QAChI,CAAC;QAED,OAAO;YACL,QAAQ,GAAG,IAAI,CAAA;YACf,IAAI,KAAK,KAAK,SAAS;gBAAE,YAAY,CAAC,KAAK,CAAC,CAAA;YAC5C,SAAS,CAAC,KAAK,EAAE,CAAA;YACjB,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAA;gBACjE,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAA;YAChE,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,iJAAiJ;AACjJ,SAAS,aAAa;IACpB,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAA;IAC5F,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9C,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC9C,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YAC5B,IAAI,CAAC;gBACH,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,SAAS,CAAA;YAC/C,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,IAAI,SAAS,CAAA;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
package/dist/content/client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import
|
|
1
|
+
import { type AudienceHandle, type AudienceOptions } from '../audience/session.js';
|
|
2
|
+
import { type DeliveryClient, type DeliveryClientOptions, type GetComponentOptions, type ListComponentsOptions, type QueryStreamOptions, type StreamFacetOptions } from '../delivery/client.js';
|
|
3
|
+
import type { ComponentPage, ComponentValue, ContentDocument, ContextBag, ExpandedReference, LocaleTreeNode, NavigationInclude, PresentationEnvelope, SiteAddressing, SiteSummary, StreamFacetResult, StreamPage } from '../types.js';
|
|
3
4
|
import { type CacheOptions } from './cache.js';
|
|
4
5
|
import { type NavigationTree } from './navigation.js';
|
|
5
6
|
import { type ResolveStrategy } from './strategy.js';
|
|
@@ -12,8 +13,6 @@ export interface NavigationOptions {
|
|
|
12
13
|
/** Bypasses the in-memory cache for this call. */
|
|
13
14
|
fresh?: boolean;
|
|
14
15
|
signal?: AbortSignal;
|
|
15
|
-
/** The visitor's membership claim: restricted pages they may read appear in the tree. Like `ResolveOverrides.membership`, it bypasses the cache and the persisted entry. */
|
|
16
|
-
membership?: string;
|
|
17
16
|
/**
|
|
18
17
|
* The page this navigation is for, under a site with a locale addressing strategy. It supplies the
|
|
19
18
|
* host a `localeHost` site needs for a path anchor, and the locale a node-id (or absent) anchor is
|
|
@@ -36,8 +35,15 @@ export interface ContentClientOptions extends DeliveryClientOptions {
|
|
|
36
35
|
* the organization's locale tree; nothing in Node, or when none matches (the server's default).
|
|
37
36
|
*/
|
|
38
37
|
locale?: string | ((locales: LocaleTreeNode[]) => string | undefined);
|
|
39
|
-
/** The personalization context bag, or a (possibly async) function producing it per resolve. Always sent — `{}` by default — so the server resolves personalization and tokens. */
|
|
38
|
+
/** The personalization context bag, or a (possibly async) function producing it per resolve. Always sent — `{}` by default — so the server resolves personalization and tokens. Audiences are not part of it: see `audience`. */
|
|
40
39
|
context?: ContextBag | (() => ContextBag | Promise<ContextBag>);
|
|
40
|
+
/**
|
|
41
|
+
* Turn on audience-aware delivery. With this set, the client obtains the visitor's signed audience token from Audience, sends it with every read that depends on it, renews it before
|
|
42
|
+
* it expires or when something may have changed (a Forms submission, the tab becoming visible again after a pause), keeps a separate cache for each set of audiences the visitor holds, and
|
|
43
|
+
* re-renders the React tree when that set changes. You supply an Audience delivery key and, optionally, what the page knows about the visit; you never handle a token. Without it nothing changes:
|
|
44
|
+
* a variant on an audience is simply not delivered, as for a visitor in no audience. A failure of Audience never stops a page rendering.
|
|
45
|
+
*/
|
|
46
|
+
audience?: AudienceOptions;
|
|
41
47
|
/**
|
|
42
48
|
* Default `{ strategy: 'adaptive' }` — `full` for the first *location* this client instance
|
|
43
49
|
* resolves (and every later resolve of it), `normalized` (depth 1) for any other. **In Node,
|
|
@@ -74,12 +80,6 @@ export interface ResolveOverrides {
|
|
|
74
80
|
signal?: AbortSignal;
|
|
75
81
|
/** Bypass (and replace) the cached result for this one request. */
|
|
76
82
|
fresh?: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* The visitor's membership claim (`audience.claim()`), for a restricted page. A request that carries one **never touches the cache or the persisted entry**: what a member is shown
|
|
79
|
-
* must not be served to the next visitor, and a claim must never become part of a stored key. A restricted page without a claim, or with one that does not admit the visitor,
|
|
80
|
-
* rejects with a `ContentDeliveryError` whose `code` is `members_only`; read it with `membersOnlyOf`.
|
|
81
|
-
*/
|
|
82
|
-
membership?: string;
|
|
83
83
|
}
|
|
84
84
|
/** The site a result was resolved against — the full summary when the SDK looked it up, or just the id when one was configured. */
|
|
85
85
|
export interface ResolvedSite {
|
|
@@ -183,6 +183,17 @@ export type OwnerRef = {
|
|
|
183
183
|
export interface ContentClient {
|
|
184
184
|
/** The low-level client this one is built on — nothing is hidden. */
|
|
185
185
|
readonly delivery: DeliveryClient;
|
|
186
|
+
/** The visitor's audiences: `undefined` unless the client was created with an `audience` option. */
|
|
187
|
+
readonly audience: AudienceHandle | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* A client for one visitor, for a server that handles many: the same options with this request's visitor token, consent and context, and **its own caches**, so one visitor's content
|
|
190
|
+
* is never served to another. Create one per incoming request. Without an `audience` option it is a plain copy.
|
|
191
|
+
*/
|
|
192
|
+
forVisitor(visitor: {
|
|
193
|
+
visitor?: string | null;
|
|
194
|
+
consent?: AudienceOptions['consent'];
|
|
195
|
+
context?: AudienceOptions['context'];
|
|
196
|
+
}): ContentClient;
|
|
186
197
|
/** Resolves whatever lives at a location — invoke it on every router change. */
|
|
187
198
|
resolveLocation(location: LocationLike, overrides?: ResolveOverrides): Promise<ExperienceResult>;
|
|
188
199
|
/**
|
|
@@ -218,6 +229,15 @@ export interface ContentClient {
|
|
|
218
229
|
* no entry, it has expired, or preview is activated.
|
|
219
230
|
*/
|
|
220
231
|
peekLocation(location: LocationLike): PersistedExperience | undefined;
|
|
232
|
+
/**
|
|
233
|
+
* The raw stream and Component reads, made with the visitor's current audience token when the client has an `audience` option (and with none otherwise): the same token
|
|
234
|
+
* `resolveLocation` sends, renewed the same way. They are not cached, so one visitor's answer is never served to another. Pass `site` yourself where the raw client needs it;
|
|
235
|
+
* the token is never an option here.
|
|
236
|
+
*/
|
|
237
|
+
queryStream(stream: string, options?: Omit<QueryStreamOptions, 'audienceToken'>): Promise<StreamPage>;
|
|
238
|
+
getStreamFacet(stream: string, field: string, options?: Omit<StreamFacetOptions, 'audienceToken'>): Promise<StreamFacetResult>;
|
|
239
|
+
getComponent(provider: string, key: string, options?: Omit<GetComponentOptions, 'audienceToken'>): Promise<ExpandedReference>;
|
|
240
|
+
listComponents(options: Omit<ListComponentsOptions, 'audienceToken'>): Promise<ComponentPage>;
|
|
221
241
|
/** The persisted result of the last successful `resolveReference` for this descriptor, if any — synchronous, no request. Same absence rules as `peekLocation`. `TContent` asserts, exactly as it does on `resolveReference`. */
|
|
222
242
|
peekReference<TContent = ContentDocument>(descriptor: ReferenceLike): PersistedReference<TContent> | undefined;
|
|
223
243
|
/** Drops every cached result and the memoized site/locale, including anything persisted. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/content/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/content/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