@decocms/blocks 8.18.1 → 8.20.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/dist/v8/analytics/client.d.ts +10 -0
- package/dist/v8/analytics/client.d.ts.map +1 -1
- package/dist/v8/analytics/client.js +29 -3
- package/dist/v8/analytics/client.js.map +1 -1
- package/dist/v8/client.js +1 -11
- package/dist/v8/client.js.map +1 -1
- package/dist/v8/experiments.d.ts +20 -50
- package/dist/v8/experiments.d.ts.map +1 -1
- package/dist/v8/experiments.js +35 -189
- package/dist/v8/experiments.js.map +1 -1
- package/package.json +1 -1
- package/skills/deco-go-live/SKILL.md +1 -1
- package/skills/deco-go-live/references/qa-checklist-template.md +1 -1
- package/skills/deco-go-live/scripts/preflight.sh +2 -2
- package/skills/deco-nextjs-site/SKILL.md +1 -1
- package/skills/deco-nextjs-site/references/proxy-and-drafts.md +1 -1
- package/skills/deco-storefront-caching/references/perf-guardrails-e2e.md +1 -1
- package/skills/deco-storefront-caching/references/verification.md +1 -1
- package/skills/deco-storefront-caching/references/worker-page-cache.md +1 -1
- package/skills/deco-tanstack-site/references/worker-entry.md +1 -1
- package/skills/deco-v7-to-v8-migration/references/nextjs.md +1 -1
- package/skills/deco-v7-to-v8-migration/scripts/experiments.ts +1 -1
- package/skills/deco-v7-to-v8-migration/scripts/matchers.ts +5 -6
- package/skills/deco-variants/SKILL.md +3 -3
- package/skills/deco-variants/references/caching-variants.md +2 -5
- package/skills/deco-variants/references/experiments-and-campaigns.md +3 -3
- package/skills/deco-variants/references/multivariate.md +1 -1
- package/skills/deco-variants/references/v7-matchers.md +5 -17
- package/src/v8/analytics/client.ts +36 -1
- package/src/v8/client.ts +1 -12
- package/src/v8/experiments.ts +39 -209
|
@@ -32,6 +32,16 @@ export interface AnalyticsClientOptions {
|
|
|
32
32
|
heatmapRate?: number;
|
|
33
33
|
/** Errors module: cross-origin script hosts that count as the site's own. */
|
|
34
34
|
errorHosts?: string[];
|
|
35
|
+
/**
|
|
36
|
+
* The visitor's A/B tests as the page rendered them: each test of the saved `experiments`
|
|
37
|
+
* block on or off, exactly the map that decided the page (on TanStack, what the worker
|
|
38
|
+
* decided, `requestAssignments(request)?.experiments`). Every event then carries each test's
|
|
39
|
+
* arm, `on` or `off`, in `exp`, the first page view included, and the collector stores it as
|
|
40
|
+
* it stores any `exp`. Passing the decision rather than an id keeps what is measured equal to
|
|
41
|
+
* what was shown, a preview's switched tests and a release change included. Leave it unset
|
|
42
|
+
* on a preview, whose switched tests are no visitor's.
|
|
43
|
+
*/
|
|
44
|
+
experiments?: Readonly<Record<string, boolean>>;
|
|
35
45
|
}
|
|
36
46
|
/**
|
|
37
47
|
* Starts collection in the browser: the page view now and on every client-side
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/v8/analytics/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,2EAA2E;AAC3E,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,UAAU,GACV,SAAS,GACT,MAAM,GACN,YAAY,GACZ,QAAQ,GACR,SAAS,GACT,QAAQ,CAAC;AAEb,MAAM,WAAW,sBAAsB;IACrC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACb,2EAA2E;IAC3E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,qEAAqE;IACrE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/v8/analytics/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,2EAA2E;AAC3E,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,UAAU,GACV,SAAS,GACT,MAAM,GACN,YAAY,GACZ,QAAQ,GACR,SAAS,GACT,QAAQ,CAAC;AAEb,MAAM,WAAW,sBAAsB;IACrC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACb,2EAA2E;IAC3E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,qEAAqE;IACrE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACjD;AA2BD;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAClC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAkDzC"}
|
|
@@ -8,6 +8,18 @@
|
|
|
8
8
|
* `startAnalytics()` does the work in the browser and never rejects, so a
|
|
9
9
|
* failure is "analytics stopped", never "the page broke".
|
|
10
10
|
*/
|
|
11
|
+
/** The decided tests as the collector's `exp` values, `on` or `off`; non-boolean entries left out. */
|
|
12
|
+
function armsOf(experiments) {
|
|
13
|
+
const arms = Object.create(null);
|
|
14
|
+
if (typeof experiments !== "object" || experiments === null)
|
|
15
|
+
return arms;
|
|
16
|
+
for (const name of Object.keys(experiments)) {
|
|
17
|
+
const on = experiments[name];
|
|
18
|
+
if (typeof on === "boolean")
|
|
19
|
+
arms[name] = on ? "on" : "off";
|
|
20
|
+
}
|
|
21
|
+
return arms;
|
|
22
|
+
}
|
|
11
23
|
/** One loader per file, so a bundler splits each module into its own chunk. */
|
|
12
24
|
const MODULES = {
|
|
13
25
|
click: () => import("./runtime/modules/click.js"),
|
|
@@ -35,8 +47,15 @@ export async function startAnalytics(options = {}) {
|
|
|
35
47
|
return null;
|
|
36
48
|
const w = window;
|
|
37
49
|
try {
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
const arms = armsOf(options.experiments);
|
|
51
|
+
if (w.__dqBooted) {
|
|
52
|
+
// The tag booted first: its API is the client, so the arms go through it.
|
|
53
|
+
if (typeof w.__dq?.track !== "function")
|
|
54
|
+
return null;
|
|
55
|
+
for (const name of Object.keys(arms))
|
|
56
|
+
w.__dq.setExperiment?.(name, arms[name]);
|
|
57
|
+
return w.__dq;
|
|
58
|
+
}
|
|
40
59
|
// The same fields the collector writes ahead of `/_dq/a.js`, and the same precedence: what
|
|
41
60
|
// the page already set on `window.__dq` wins. `q` is held back and replayed below, once
|
|
42
61
|
// every module has registered: core replays its stub in a microtask, and a module in its
|
|
@@ -53,13 +72,20 @@ export async function startAnalytics(options = {}) {
|
|
|
53
72
|
...(options.key ? { k: options.key } : {}),
|
|
54
73
|
...(options.heatmapRate !== undefined ? { hr: options.heatmapRate } : {}),
|
|
55
74
|
...(options.errorHosts?.length ? { er: options.errorHosts } : {}),
|
|
56
|
-
}, page,
|
|
75
|
+
}, page,
|
|
76
|
+
// The page's own map (another script's tests) is kept; on a name both carry, the arm the
|
|
77
|
+
// page rendered wins. Set before core boots, so the first page view carries it.
|
|
78
|
+
Object.keys(arms).length ? { x: { ...page.x, ...arms } } : {}, { q: [] });
|
|
57
79
|
await import("./runtime/src/index.js");
|
|
58
80
|
// Core assigns its API only when it collects; skipped means skipped, modules included.
|
|
59
81
|
if (typeof w.__dq.track !== "function")
|
|
60
82
|
return null;
|
|
61
83
|
for (const name of new Set(options.modules ?? []))
|
|
62
84
|
await MODULES[name]?.();
|
|
85
|
+
// A module may set a test of its own on load: `deco` reads v7's `deco_segment`, which a
|
|
86
|
+
// migrated visitor still carries and v8 never rewrites. The arm the page rendered wins.
|
|
87
|
+
for (const name of Object.keys(arms))
|
|
88
|
+
w.__dq.setExperiment?.(name, arms[name]);
|
|
63
89
|
for (const r of queued)
|
|
64
90
|
w.__dq.q?.push?.(r);
|
|
65
91
|
return w.__dq;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/v8/analytics/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/v8/analytics/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA+CH,sGAAsG;AACtG,SAAS,MAAM,CACb,WAA0D;IAE1D,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAA2B,CAAC;IAC3D,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACzE,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5C,MAAM,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,OAAO,EAAE,KAAK,SAAS;YAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAC9D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,+EAA+E;AAC/E,MAAM,OAAO,GAAoD;IAC/D,KAAK,EAAE,GAAG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CAAC,CAAC,EAAE,EACzE,EAAE,CAAC,EAAE,EAAE,EAAE,CACV,CAAC;QAEF,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;QACvC,uFAAuF;QACvF,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,UAAU;YAAE,OAAO,IAAI,CAAC;QAEpD,KAAK,MAAM,IAAI,IAAI,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;YAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QAC3E,wFAAwF;QACxF,wFAAwF;QACxF,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/E,KAAK,MAAM,CAAC,IAAI,MAAM;YAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5C,OAAO,CAAC,CAAC,IAAI,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/v8/client.js
CHANGED
|
@@ -189,17 +189,7 @@ function copyVisitor(visitor) {
|
|
|
189
189
|
if (typeof visitor !== "object" || visitor === null || typeof visitor.id !== "string") {
|
|
190
190
|
return null;
|
|
191
191
|
}
|
|
192
|
-
|
|
193
|
-
const copy = {
|
|
194
|
-
id: visitor.id,
|
|
195
|
-
active: Object.freeze(strings(visitor.active)),
|
|
196
|
-
inactiveDrawn: Object.freeze(strings(visitor.inactiveDrawn)),
|
|
197
|
-
pct: Object.freeze(Object.assign(Object.create(null), visitor.pct)),
|
|
198
|
-
};
|
|
199
|
-
if (typeof visitor.exp === "object" && visitor.exp !== null) {
|
|
200
|
-
copy.exp = Object.freeze(Object.assign(Object.create(null), visitor.exp));
|
|
201
|
-
}
|
|
202
|
-
return Object.freeze(copy);
|
|
192
|
+
return Object.freeze({ id: visitor.id });
|
|
203
193
|
}
|
|
204
194
|
function asCMSError(error) {
|
|
205
195
|
return isResolutionError(error) ? error : errors.blockFailed("<unknown>", [], error);
|
package/dist/v8/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/v8/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,SAAS,EAET,gBAAgB,EAChB,QAAQ,EACR,IAAI,GACL,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAkB,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAY,OAAO,EAAkB,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAoCzC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GACvB,gGAAgG;IAChG,iGAAiG;IACjG,8FAA8F;IAC9F,yCAAyC,CAAC;AAK5C,MAAM,OAAO,SAAS;IACX,QAAQ,CAAgB;IACxB,SAAS,GAAG,IAAI,OAAO,EAAY,CAAC;IACpC,QAAQ,CAAiB;IAClC,SAAS,CAAgC;IACzC,OAAO,CAA8B;IACrC,uCAAuC;IACvC,SAAS,CAAqB;IAE9B,YAAY,OAAsB;QAChC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACv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AAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;AACvF,CAAC"}
|
package/dist/v8/experiments.d.ts
CHANGED
|
@@ -14,45 +14,27 @@
|
|
|
14
14
|
* storage in an app) and hands it to `cms.client({ visitor })`; the built-in
|
|
15
15
|
* `split-traffic` calls `assign` with it.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* it has no id; v7's stored assignments are read and honoured, never rewritten.
|
|
17
|
+
* A visitor is only its id, stored as is in the `deco_vid` cookie and written
|
|
18
|
+
* once, on a first visit. v7's `deco_segment` is neither read nor written:
|
|
19
|
+
* its stored decisions aren't honoured, and a visitor who has only it gets a
|
|
20
|
+
* new id.
|
|
22
21
|
*/
|
|
23
22
|
/** The saved block `experiments`: each test's name and the whole percentage of visitors in it, 0–100. */
|
|
24
23
|
export type Experiments = Record<string, number>;
|
|
25
24
|
/** What a visitor got: each test's name and whether they are in it. */
|
|
26
25
|
export type Assignments = Record<string, boolean>;
|
|
27
|
-
/**
|
|
28
|
-
* Who is visiting: an id every assignment is computed from, plus the
|
|
29
|
-
* assignments v7 stored (`active`, `inactiveDrawn`, `pct`, `exp`), which are honoured and
|
|
30
|
-
* carried, never rewritten.
|
|
31
|
-
*/
|
|
26
|
+
/** Who is visiting: an id every assignment is computed from, and nothing else. */
|
|
32
27
|
export interface Visitor {
|
|
33
|
-
/**
|
|
34
|
-
* 16 random bytes as 22 base64url characters, drawn once per visitor. `""`
|
|
35
|
-
* for a visitor with no id of its own (one built from a cache key's
|
|
36
|
-
* assignments), which is in only the tests `active` names.
|
|
37
|
-
*/
|
|
28
|
+
/** 16 random bytes as 22 base64url characters, drawn once per visitor. */
|
|
38
29
|
id: string;
|
|
39
|
-
/** Tests v7 put this visitor in. */
|
|
40
|
-
active: string[];
|
|
41
|
-
/** Tests v7 left this visitor out of. */
|
|
42
|
-
inactiveDrawn: string[];
|
|
43
|
-
/** The percentage each of v7's decisions was made at. */
|
|
44
|
-
pct: Record<string, number>;
|
|
45
|
-
/** v7's N-way decisions. Never read; carried as they are. */
|
|
46
|
-
exp?: Record<string, string>;
|
|
47
30
|
}
|
|
48
31
|
/** What `readVisitor` answers. */
|
|
49
32
|
export interface VisitorFromRequest {
|
|
50
33
|
/** The request's visitor, or a new one when it had none. */
|
|
51
34
|
visitor: Visitor;
|
|
52
35
|
/**
|
|
53
|
-
* The `Set-Cookie` line to send when the visitor had no id (a first
|
|
54
|
-
*
|
|
55
|
-
* preview.
|
|
36
|
+
* The `Set-Cookie` line to send when the visitor had no id (a first
|
|
37
|
+
* visit); `null` otherwise. Never send it from a preview.
|
|
56
38
|
*/
|
|
57
39
|
cookie: string | null;
|
|
58
40
|
}
|
|
@@ -63,28 +45,21 @@ interface RequestWithHeaders {
|
|
|
63
45
|
get(name: string): string | null;
|
|
64
46
|
};
|
|
65
47
|
}
|
|
66
|
-
/** A new visitor: a fresh id
|
|
48
|
+
/** A new visitor: a fresh id. */
|
|
67
49
|
export declare function newVisitor(): Visitor;
|
|
68
50
|
/**
|
|
69
|
-
* A visitor out of its stored form (what `serializeVisitor` wrote
|
|
70
|
-
* of the `
|
|
71
|
-
*
|
|
72
|
-
* decisions). Never throws.
|
|
51
|
+
* A visitor out of its stored form (what `serializeVisitor` wrote: the value
|
|
52
|
+
* of the `deco_vid` cookie or of `x-deco-visitor`). `null` when the text is
|
|
53
|
+
* missing or isn't an id. Never throws.
|
|
73
54
|
*/
|
|
74
55
|
export declare function parseVisitor(text: string | null | undefined): Visitor | null;
|
|
75
|
-
/**
|
|
76
|
-
* The visitor's stored form: v7's `btoa(encodeURIComponent(JSON.stringify(...)))`,
|
|
77
|
-
* with a fixed key order and names sorted, so two equal visitors give
|
|
78
|
-
* byte-equal values. Under 2KB: past it, v7's entries are dropped, first the
|
|
79
|
-
* ones the id reproduces anyway.
|
|
80
|
-
*/
|
|
56
|
+
/** The visitor's stored form: its id. */
|
|
81
57
|
export declare function serializeVisitor(visitor: Visitor): string;
|
|
82
58
|
/**
|
|
83
|
-
* The web helper: the visitor out of a request's `
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* came over plain http. Never throws.
|
|
59
|
+
* The web helper: the visitor out of a request's `deco_vid` cookie, and the
|
|
60
|
+
* `Set-Cookie` line to send back when it had none (a first visit). The cookie
|
|
61
|
+
* isn't `HttpOnly`, so a script on the page can read the id, and is `Secure`
|
|
62
|
+
* unless the request came over plain http. Never throws.
|
|
88
63
|
*/
|
|
89
64
|
export declare function readVisitor(request: RequestWithHeaders): VisitorFromRequest;
|
|
90
65
|
/**
|
|
@@ -93,14 +68,9 @@ export declare function readVisitor(request: RequestWithHeaders): VisitorFromReq
|
|
|
93
68
|
* A visitor is in a test when their roll for it (a fixed number in [0, 100)
|
|
94
69
|
* from the test's name and their id) is under its percentage, so 0 puts
|
|
95
70
|
* nobody in, 100 everybody, and raising a percentage only adds people. A
|
|
96
|
-
* fractional percentage is rounded.
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* in and one out of a test that shrinks stays out. Without a visitor every
|
|
100
|
-
* test is `false`. A visitor without an id (`""`, as a page built from a
|
|
101
|
-
* cache key's assignments gives one) has no roll: it is in exactly the tests
|
|
102
|
-
* its stored `active` and `pct` keep it in. Entries that aren't finite numbers are
|
|
103
|
-
* left out. Pure; never throws.
|
|
71
|
+
* fractional percentage is rounded. Without a visitor, or with an id that
|
|
72
|
+
* isn't 22 base64url characters, every test is `false`. Entries that aren't
|
|
73
|
+
* finite numbers are left out. Pure; never throws.
|
|
104
74
|
*/
|
|
105
75
|
export declare function assign(experiments: Experiments | null | undefined, visitor: Visitor | null | undefined): Assignments;
|
|
106
76
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experiments.d.ts","sourceRoot":"","sources":["../../src/v8/experiments.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"experiments.d.ts","sourceRoot":"","sources":["../../src/v8/experiments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,yGAAyG;AACzG,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD,uEAAuE;AACvE,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAElD,kFAAkF;AAClF,MAAM,WAAW,OAAO;IACtB,0EAA0E;IAC1E,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,kCAAkC;AAClC,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,gGAAgG;AAChG,UAAU,kBAAkB;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CAC/C;AAsBD,iCAAiC;AACjC,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,IAAI,CAG5E;AAED,yCAAyC;AACzC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAEzD;AAwBD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CAkB3E;AAMD;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CACpB,WAAW,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EAC3C,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,GAClC,WAAW,CAWb"}
|
package/dist/v8/experiments.js
CHANGED
|
@@ -14,164 +14,48 @@
|
|
|
14
14
|
* storage in an app) and hands it to `cms.client({ visitor })`; the built-in
|
|
15
15
|
* `split-traffic` calls `assign` with it.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* it has no id; v7's stored assignments are read and honoured, never rewritten.
|
|
17
|
+
* A visitor is only its id, stored as is in the `deco_vid` cookie and written
|
|
18
|
+
* once, on a first visit. v7's `deco_segment` is neither read nor written:
|
|
19
|
+
* its stored decisions aren't honoured, and a visitor who has only it gets a
|
|
20
|
+
* new id.
|
|
22
21
|
*/
|
|
23
22
|
import { newId, roll } from "./bucketing.js";
|
|
24
|
-
/** The visitor's
|
|
25
|
-
const VISITOR_COOKIE = "
|
|
23
|
+
/** The visitor's cookie: the id, as is. */
|
|
24
|
+
const VISITOR_COOKIE = "deco_vid";
|
|
26
25
|
/** One year: the id is the visitor, and it should outlive any single test. */
|
|
27
26
|
const VISITOR_COOKIE_MAX_AGE = 60 * 60 * 24 * 365;
|
|
28
|
-
/**
|
|
29
|
-
* A cookie over this stays out of every request. An id plus 50 of v7's
|
|
30
|
-
* decisions fits well under it; past it, `serializeVisitor` drops entries,
|
|
31
|
-
* the ones the id reproduces first.
|
|
32
|
-
*/
|
|
33
|
-
const COOKIE_BUDGET = 2048;
|
|
34
27
|
const ID_RE = /^[A-Za-z0-9_-]{22}$/;
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*/
|
|
39
|
-
function record() {
|
|
40
|
-
return Object.create(null);
|
|
41
|
-
}
|
|
42
|
-
function emptyStored() {
|
|
43
|
-
return { active: [], inactiveDrawn: [], pct: record() };
|
|
44
|
-
}
|
|
45
|
-
function stringList(value) {
|
|
46
|
-
if (!Array.isArray(value))
|
|
47
|
-
return [];
|
|
48
|
-
return value.filter((entry) => typeof entry === "string");
|
|
49
|
-
}
|
|
50
|
-
function pctRecord(value) {
|
|
51
|
-
const out = record();
|
|
52
|
-
if (typeof value !== "object" || value === null)
|
|
53
|
-
return out;
|
|
54
|
-
for (const [name, pct] of Object.entries(value)) {
|
|
55
|
-
if (typeof pct === "number" && Number.isFinite(pct))
|
|
56
|
-
out[name] = pct;
|
|
57
|
-
}
|
|
58
|
-
return out;
|
|
59
|
-
}
|
|
60
|
-
function expRecord(value) {
|
|
61
|
-
if (typeof value !== "object" || value === null)
|
|
28
|
+
/** The id in a stored value, or `undefined`. Tolerates surrounding spaces and percent-encoding. */
|
|
29
|
+
function idOf(text) {
|
|
30
|
+
if (typeof text !== "string")
|
|
62
31
|
return undefined;
|
|
63
|
-
|
|
64
|
-
for (const [name, variant] of Object.entries(value)) {
|
|
65
|
-
if (typeof variant === "string")
|
|
66
|
-
out[name] = variant;
|
|
67
|
-
}
|
|
68
|
-
return Object.keys(out).length > 0 ? out : undefined;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* A stored value, with or without an id; `null` when it doesn't read. Never
|
|
72
|
-
* throws. The value may arrive percent-encoded (some cookie APIs encode what
|
|
73
|
-
* they write; base64 never holds a `%`, so decoding first is always safe).
|
|
74
|
-
* Entries of the wrong type are dropped, and an id that is not 22 base64url
|
|
75
|
-
* characters is treated as absent.
|
|
76
|
-
*/
|
|
77
|
-
function parseStored(text) {
|
|
78
|
-
if (typeof text !== "string" || text === "")
|
|
79
|
-
return null;
|
|
32
|
+
let value = text.trim();
|
|
80
33
|
try {
|
|
81
|
-
|
|
82
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
83
|
-
return null;
|
|
84
|
-
const body = parsed;
|
|
85
|
-
const stored = {
|
|
86
|
-
active: stringList(body.active),
|
|
87
|
-
inactiveDrawn: stringList(body.inactiveDrawn),
|
|
88
|
-
pct: pctRecord(body.pct),
|
|
89
|
-
};
|
|
90
|
-
if (typeof body.id === "string" && ID_RE.test(body.id))
|
|
91
|
-
stored.id = body.id;
|
|
92
|
-
const exp = expRecord(body.exp);
|
|
93
|
-
if (exp)
|
|
94
|
-
stored.exp = exp;
|
|
95
|
-
return stored;
|
|
34
|
+
value = decodeURIComponent(value);
|
|
96
35
|
}
|
|
97
36
|
catch {
|
|
98
|
-
return
|
|
37
|
+
return undefined;
|
|
99
38
|
}
|
|
39
|
+
return ID_RE.test(value) ? value : undefined;
|
|
100
40
|
}
|
|
101
|
-
/** A new visitor: a fresh id
|
|
41
|
+
/** A new visitor: a fresh id. */
|
|
102
42
|
export function newVisitor() {
|
|
103
|
-
return { id: newId()
|
|
43
|
+
return { id: newId() };
|
|
104
44
|
}
|
|
105
45
|
/**
|
|
106
|
-
* A visitor out of its stored form (what `serializeVisitor` wrote
|
|
107
|
-
* of the `
|
|
108
|
-
*
|
|
109
|
-
* decisions). Never throws.
|
|
46
|
+
* A visitor out of its stored form (what `serializeVisitor` wrote: the value
|
|
47
|
+
* of the `deco_vid` cookie or of `x-deco-visitor`). `null` when the text is
|
|
48
|
+
* missing or isn't an id. Never throws.
|
|
110
49
|
*/
|
|
111
50
|
export function parseVisitor(text) {
|
|
112
|
-
const
|
|
113
|
-
return
|
|
51
|
+
const id = idOf(text);
|
|
52
|
+
return id === undefined ? null : { id };
|
|
114
53
|
}
|
|
115
|
-
/**
|
|
116
|
-
* The visitor's stored form: v7's `btoa(encodeURIComponent(JSON.stringify(...)))`,
|
|
117
|
-
* with a fixed key order and names sorted, so two equal visitors give
|
|
118
|
-
* byte-equal values. Under 2KB: past it, v7's entries are dropped, first the
|
|
119
|
-
* ones the id reproduces anyway.
|
|
120
|
-
*/
|
|
54
|
+
/** The visitor's stored form: its id. */
|
|
121
55
|
export function serializeVisitor(visitor) {
|
|
122
|
-
|
|
123
|
-
const inactiveDrawn = [...visitor.inactiveDrawn].sort();
|
|
124
|
-
const dropped = new Set();
|
|
125
|
-
const encode = () => {
|
|
126
|
-
const stillActive = active.filter((name) => !dropped.has(name));
|
|
127
|
-
const stillInactive = inactiveDrawn.filter((name) => !dropped.has(name));
|
|
128
|
-
const pct = record();
|
|
129
|
-
for (const name of Object.keys(visitor.pct).sort()) {
|
|
130
|
-
// v7 kept a `pct` beside its N-way names too, and `exp` is carried
|
|
131
|
-
// untouched, so their fingerprint is carried with it.
|
|
132
|
-
const listed = stillActive.includes(name) ||
|
|
133
|
-
stillInactive.includes(name) ||
|
|
134
|
-
(visitor.exp !== undefined && Object.hasOwn(visitor.exp, name));
|
|
135
|
-
if (listed)
|
|
136
|
-
pct[name] = visitor.pct[name];
|
|
137
|
-
}
|
|
138
|
-
const body = {
|
|
139
|
-
active: stillActive,
|
|
140
|
-
inactiveDrawn: stillInactive,
|
|
141
|
-
pct,
|
|
142
|
-
};
|
|
143
|
-
if (visitor.id !== undefined)
|
|
144
|
-
body.id = visitor.id;
|
|
145
|
-
if (visitor.exp !== undefined)
|
|
146
|
-
body.exp = visitor.exp;
|
|
147
|
-
return btoa(encodeURIComponent(JSON.stringify(body)));
|
|
148
|
-
};
|
|
149
|
-
let value = encode();
|
|
150
|
-
if (value.length <= COOKIE_BUDGET)
|
|
151
|
-
return value;
|
|
152
|
-
// Over budget. A dropped entry is decided by the roll from then on, which
|
|
153
|
-
// keeps the decision only when the stored one already agrees with the roll.
|
|
154
|
-
// So drop those first, and the others only if the value is still too big.
|
|
155
|
-
const reproducible = (name) => {
|
|
156
|
-
const pct = visitor.pct[name];
|
|
157
|
-
if (typeof pct !== "number")
|
|
158
|
-
return false;
|
|
159
|
-
return active.includes(name) === roll(name, visitor.id) < pct;
|
|
160
|
-
};
|
|
161
|
-
for (const name of [
|
|
162
|
-
...inactiveDrawn.filter(reproducible),
|
|
163
|
-
...active.filter(reproducible),
|
|
164
|
-
...inactiveDrawn.filter((name) => !reproducible(name)),
|
|
165
|
-
...active.filter((name) => !reproducible(name)),
|
|
166
|
-
]) {
|
|
167
|
-
if (value.length <= COOKIE_BUDGET)
|
|
168
|
-
break;
|
|
169
|
-
dropped.add(name);
|
|
170
|
-
value = encode();
|
|
171
|
-
}
|
|
172
|
-
return value;
|
|
56
|
+
return visitor.id;
|
|
173
57
|
}
|
|
174
|
-
/** The raw `
|
|
58
|
+
/** The raw `deco_vid` value out of a `Cookie` header. */
|
|
175
59
|
function readCookie(cookies) {
|
|
176
60
|
if (!cookies)
|
|
177
61
|
return undefined;
|
|
@@ -197,11 +81,10 @@ function isPlainHttp(url) {
|
|
|
197
81
|
}
|
|
198
82
|
}
|
|
199
83
|
/**
|
|
200
|
-
* The web helper: the visitor out of a request's `
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* came over plain http. Never throws.
|
|
84
|
+
* The web helper: the visitor out of a request's `deco_vid` cookie, and the
|
|
85
|
+
* `Set-Cookie` line to send back when it had none (a first visit). The cookie
|
|
86
|
+
* isn't `HttpOnly`, so a script on the page can read the id, and is `Secure`
|
|
87
|
+
* unless the request came over plain http. Never throws.
|
|
205
88
|
*/
|
|
206
89
|
export function readVisitor(request) {
|
|
207
90
|
let header = null;
|
|
@@ -211,10 +94,10 @@ export function readVisitor(request) {
|
|
|
211
94
|
catch {
|
|
212
95
|
header = null;
|
|
213
96
|
}
|
|
214
|
-
const stored =
|
|
215
|
-
if (stored
|
|
97
|
+
const stored = parseVisitor(readCookie(header));
|
|
98
|
+
if (stored !== null)
|
|
216
99
|
return { visitor: stored, cookie: null };
|
|
217
|
-
const visitor =
|
|
100
|
+
const visitor = newVisitor();
|
|
218
101
|
const parts = [
|
|
219
102
|
`${VISITOR_COOKIE}=${serializeVisitor(visitor)}`,
|
|
220
103
|
"Path=/",
|
|
@@ -228,65 +111,28 @@ export function readVisitor(request) {
|
|
|
228
111
|
function roundPct(allocation) {
|
|
229
112
|
return Math.round(Math.min(100, Math.max(0, allocation)));
|
|
230
113
|
}
|
|
231
|
-
/**
|
|
232
|
-
* A v7 decision after the percentage moved: raising a percentage never
|
|
233
|
-
* removes anyone v7 put in, and lowering it never adds anyone v7 left out.
|
|
234
|
-
* Otherwise the roll decides, as for any visitor.
|
|
235
|
-
*/
|
|
236
|
-
function keptFromV7(stored, from, to) {
|
|
237
|
-
if (to === from)
|
|
238
|
-
return stored;
|
|
239
|
-
if (stored && to > from)
|
|
240
|
-
return true;
|
|
241
|
-
if (!stored && to < from)
|
|
242
|
-
return false;
|
|
243
|
-
return undefined;
|
|
244
|
-
}
|
|
245
114
|
/**
|
|
246
115
|
* This visitor's answer for every test: `true` when they are in it.
|
|
247
116
|
*
|
|
248
117
|
* A visitor is in a test when their roll for it (a fixed number in [0, 100)
|
|
249
118
|
* from the test's name and their id) is under its percentage, so 0 puts
|
|
250
119
|
* nobody in, 100 everybody, and raising a percentage only adds people. A
|
|
251
|
-
* fractional percentage is rounded.
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* in and one out of a test that shrinks stays out. Without a visitor every
|
|
255
|
-
* test is `false`. A visitor without an id (`""`, as a page built from a
|
|
256
|
-
* cache key's assignments gives one) has no roll: it is in exactly the tests
|
|
257
|
-
* its stored `active` and `pct` keep it in. Entries that aren't finite numbers are
|
|
258
|
-
* left out. Pure; never throws.
|
|
120
|
+
* fractional percentage is rounded. Without a visitor, or with an id that
|
|
121
|
+
* isn't 22 base64url characters, every test is `false`. Entries that aren't
|
|
122
|
+
* finite numbers are left out. Pure; never throws.
|
|
259
123
|
*/
|
|
260
124
|
export function assign(experiments, visitor) {
|
|
261
|
-
const assignments =
|
|
125
|
+
const assignments = Object.create(null);
|
|
262
126
|
if (typeof experiments !== "object" || experiments === null)
|
|
263
127
|
return assignments;
|
|
264
128
|
const id = visitor !== null && typeof visitor === "object" ? visitor.id : undefined;
|
|
265
129
|
const known = typeof id === "string" && ID_RE.test(id);
|
|
266
|
-
const v = visitor !== null && typeof visitor === "object" ? visitor : {};
|
|
267
130
|
for (const name of Object.keys(experiments).sort()) {
|
|
268
131
|
const allocation = experiments[name];
|
|
269
132
|
if (typeof allocation !== "number" || !Number.isFinite(allocation))
|
|
270
133
|
continue;
|
|
271
|
-
|
|
272
|
-
const stored = list(v.active).includes(name)
|
|
273
|
-
? true
|
|
274
|
-
: list(v.inactiveDrawn).includes(name)
|
|
275
|
-
? false
|
|
276
|
-
: undefined;
|
|
277
|
-
// v7 wrote `round(traffic * 100)` here, and its own reader treated a
|
|
278
|
-
// missing or negative entry as "matches anything".
|
|
279
|
-
const raw = isRecord(v.pct) && Object.hasOwn(v.pct, name) ? v.pct[name] : undefined;
|
|
280
|
-
const from = typeof raw === "number" && Number.isFinite(raw) && raw >= 0 ? roundPct(raw) : pct;
|
|
281
|
-
const kept = stored === undefined ? undefined : keptFromV7(stored, from, pct);
|
|
282
|
-
assignments[name] = kept ?? (known && roll(name, id) < pct);
|
|
134
|
+
assignments[name] = known && roll(name, id) < roundPct(allocation);
|
|
283
135
|
}
|
|
284
136
|
return assignments;
|
|
285
137
|
}
|
|
286
|
-
function list(value) {
|
|
287
|
-
return Array.isArray(value) ? value : [];
|
|
288
|
-
}
|
|
289
|
-
function isRecord(value) {
|
|
290
|
-
return typeof value === "object" && value !== null;
|
|
291
|
-
}
|
|
292
138
|
//# sourceMappingURL=experiments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experiments.js","sourceRoot":"","sources":["../../src/v8/experiments.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"experiments.js","sourceRoot":"","sources":["../../src/v8/experiments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AA+B7C,2CAA2C;AAC3C,MAAM,cAAc,GAAG,UAAU,CAAC;AAElC,8EAA8E;AAC9E,MAAM,sBAAsB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;AAElD,MAAM,KAAK,GAAG,qBAAqB,CAAC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UAAkB;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,MAAM,CACpB,WAA2C,EAC3C,OAAmC;IAEnC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAgB,CAAC;IACvD,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI;QAAE,OAAO,WAAW,CAAC;IAChF,MAAM,EAAE,GAAG,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACpF,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACnD,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;YAAE,SAAS;QAC7E,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,EAAY,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -80,7 +80,7 @@ or curl-able.
|
|
|
80
80
|
## 5. Cache (→ **deco-storefront-caching**)
|
|
81
81
|
|
|
82
82
|
- [ ] 🔴 **A signed-in shopper never gets a stored anonymous page**; nothing per-user is stored.
|
|
83
|
-
- [ ] 🟡 Anonymous pages set no cookie except the first-visit `
|
|
83
|
+
- [ ] 🟡 Anonymous pages set no cookie except the first-visit `deco_vid`, and the second request is `X-Cache: HIT`.
|
|
84
84
|
- [ ] 🟡 The cache key drops the paid-media parameters your traffic carries.
|
|
85
85
|
- [ ] 🟡 A failed loader marks the page degraded (`x-deco-degraded`) instead of caching "not found".
|
|
86
86
|
|
|
@@ -137,7 +137,7 @@ navigation.
|
|
|
137
137
|
|---|---|---|
|
|
138
138
|
| M1 | Browser heap stays flat over 10 SPA navigations | DevTools Memory |
|
|
139
139
|
| M2 | Minicart open/close 10× leaves the heap flat | heap snapshots before and after |
|
|
140
|
-
| M3 | Anonymous pages send no `Set-Cookie` except the first-visit `
|
|
140
|
+
| M3 | Anonymous pages send no `Set-Cookie` except the first-visit `deco_vid` | `curl -sI` without cookies |
|
|
141
141
|
| M4 | The second anonymous request is a cache hit | `X-Cache: HIT` from the site's page cache (**deco-storefront-caching**) |
|
|
142
142
|
| M5 | Lazy sections load their chunk only when needed | network panel while scrolling |
|
|
143
143
|
|