@heyplaybook/hydrogen 0.0.0-stage → 0.2.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.
@@ -0,0 +1,477 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ /**
5
+ * Playbook code-test types. Mirrors the ruleset contract served by
6
+ * `GET {PLAYBOOK_PLATFORM_URL}/api/storefront/tests/rules?shop={shopId}`.
7
+ */
8
+ type PlaybookTestStatus = 'running' | 'paused' | 'completed';
9
+ type PlaybookDevice = 'mobile' | 'desktop';
10
+ type PlaybookVisitorType = 'new' | 'returning';
11
+ interface PlaybookArm {
12
+ key: string;
13
+ weight: number;
14
+ }
15
+ interface PlaybookTestRule {
16
+ key: string;
17
+ seed?: string;
18
+ hashVersion?: number;
19
+ status: PlaybookTestStatus;
20
+ coverage?: number;
21
+ arms: PlaybookArm[];
22
+ namespace?: {
23
+ id: string;
24
+ range: [number, number];
25
+ } | null;
26
+ targeting?: {
27
+ device?: PlaybookDevice;
28
+ pathPrefix?: string[];
29
+ visitorType?: PlaybookVisitorType;
30
+ } | null;
31
+ winner?: string | null;
32
+ config?: Record<string, unknown> | null;
33
+ }
34
+ interface PlaybookRuleset {
35
+ version: string;
36
+ generatedAt: string;
37
+ tests: PlaybookTestRule[];
38
+ }
39
+ /** One test's resolved outcome for the current visitor (ships to the client). */
40
+ /** Why a visitor got this arm (debug/QA; mirrors the platform core's AssignReason). */
41
+ type PlaybookAssignReason = 'preview'
42
+ /** Another test is being previewed on this request: this one serves control. */
43
+ | 'preview-isolated' | 'override' | 'winner' | 'not-running' | 'no-visitor' | 'targeting-device' | 'targeting-visitor-type' | 'namespace' | 'hash-error' | 'coverage' | 'assigned' | 'unknown-test';
44
+ interface PlaybookAssignment {
45
+ arm: string;
46
+ status: PlaybookTestStatus;
47
+ reason: PlaybookAssignReason;
48
+ /** True only when the visitor was bucketed into a RUNNING test. */
49
+ inTest: boolean;
50
+ /** True when the arm comes from a verified `pb_preview` token or a QA override. */
51
+ forced: boolean;
52
+ config: Record<string, unknown>;
53
+ /** Evaluated on the client against the current route (SPA navigation). */
54
+ pathPrefix?: string[];
55
+ }
56
+ /** Serializable state the root loader hands to the client. */
57
+ interface PlaybookState {
58
+ enabled: boolean;
59
+ shopId: string | null;
60
+ visitorId: string | null;
61
+ visitorType: PlaybookVisitorType;
62
+ device: PlaybookDevice;
63
+ /**
64
+ * Analytics consent as the server saw it (`_tracking_consent` cookie). The
65
+ * client re-reads the live Customer Privacy API before any beacon.
66
+ */
67
+ serverConsent: 'granted' | 'denied' | 'pending' | 'absent';
68
+ /** The store declared a late-loading CMP (closed until it answers). */
69
+ consentRequired: boolean;
70
+ /** Coarse geo from the edge (Oxygen `oxygen-buyer-*`), for exposure context. */
71
+ geo?: {
72
+ country: string | null;
73
+ region: string | null;
74
+ };
75
+ /** Server time (ISO) so date-windowed variants render identically on SSR + hydration. */
76
+ now: string;
77
+ rulesetVersion: string | null;
78
+ /** Where this render's ruleset came from; null when disabled. */
79
+ rulesetSource: 'memory' | 'stale' | 'fetched' | 'last-good' | 'cold-fallback' | null;
80
+ /**
81
+ * The verified `pb_preview` token, or null. Only present for a merchant's own
82
+ * verified preview link; lets the client carry `?pb_preview=` across in-app
83
+ * navigation inside a cross-site frame where third-party cookies may be blocked.
84
+ */
85
+ previewToken: string | null;
86
+ tests: Record<string, PlaybookAssignment>;
87
+ }
88
+ interface PlaybookPreview {
89
+ testKey: string;
90
+ arm: string;
91
+ }
92
+
93
+ declare const DEFAULT_PLATFORM_URL = "https://www.heyplaybook.com";
94
+ interface CreatePlaybookOptions {
95
+ /** Playbook shop UUID. Falsy → disabled: everyone gets control, no cookies. */
96
+ shopId: string | null | undefined;
97
+ platformUrl?: string | null;
98
+ request: Request;
99
+ /** Keeps a background ruleset refresh alive after the response (Workers). */
100
+ waitUntil?: (p: Promise<unknown>) => void;
101
+ fetchImpl?: typeof fetch;
102
+ /**
103
+ * Arms to force regardless of status/targeting (QA). Forced views never
104
+ * expose. The CALLER decides when overrides are trusted (e.g. preview hosts
105
+ * only) — this module applies whatever it is given.
106
+ *
107
+ * Precedence per test: a `pb_preview` token on THIS request > an override
108
+ * from this request (`source: 'request'`) > a `pb_preview` carried by the
109
+ * session cookie > a session override > natural assignment.
110
+ */
111
+ overrides?: PlaybookOverride[];
112
+ /**
113
+ * The store's CMP may load after first paint (headless, e.g. TrueVault
114
+ * Polaris): with no `_tracking_consent` cookie yet, treat consent as pending
115
+ * (closed) instead of absent (open). Mirrors the SDK's
116
+ * `data-pb-consent="required"`.
117
+ */
118
+ consentRequired?: boolean;
119
+ }
120
+ interface PlaybookOverride extends PlaybookPreview {
121
+ /** `request`: set by this request's URL; `session`: replayed from a cookie. */
122
+ source?: 'request' | 'session';
123
+ }
124
+ interface PlaybookServerResult {
125
+ /** Serializable; pass to the client through loader data. */
126
+ state: PlaybookState;
127
+ assignments: Record<string, PlaybookAssignment>;
128
+ /** Null when disabled, and during a verified preview (no visitor is tracked). */
129
+ visitorId: string | null;
130
+ preview: PlaybookPreview | null;
131
+ /** Where the verified preview came from (this request's URL or the cookie). */
132
+ previewSource: 'request' | 'session' | null;
133
+ /** Set-Cookie values to APPEND (never `set`) on the document response. */
134
+ setCookieHeaders: string[];
135
+ }
136
+ /**
137
+ * Coarse geo from edge headers: Oxygen (`oxygen-buyer-country`,
138
+ * `oxygen-buyer-region-code`), falling back to Cloudflare / Vercel names.
139
+ */
140
+ declare function detectGeo(headers: Headers): {
141
+ country: string | null;
142
+ region: string | null;
143
+ };
144
+ declare function detectDevice(userAgent: string | null): PlaybookDevice;
145
+ declare function createPlaybook({ shopId, platformUrl, request, waitUntil, fetchImpl, overrides, consentRequired, }: CreatePlaybookOptions): Promise<PlaybookServerResult>;
146
+
147
+ /**
148
+ * Ruleset fetch with an in-memory (per-isolate) cache.
149
+ *
150
+ * - Fresh for 60s; served stale for a further 300s while one background
151
+ * refresh runs (stale-while-revalidate).
152
+ * - Past that, a render waits at most RENDER_BUDGET_MS for a fresh copy, then
153
+ * falls back to the last good ruleset; with none, the caller gets `null`
154
+ * and everyone sees control.
155
+ * - A failed or malformed fetch never replaces a good cached copy.
156
+ */
157
+
158
+ /**
159
+ * Where the ruleset for this render came from (debug/QA):
160
+ * - `memory`: fresh in-memory copy (< 60s).
161
+ * - `stale`: stale copy served while a background refresh runs.
162
+ * - `fetched`: waited for the network and got it within budget.
163
+ * - `last-good`: network missed the budget; served the last good copy.
164
+ * - `cold-fallback`: nothing in memory and the network missed even the
165
+ * cold budget (or failed) — everyone gets control for this render.
166
+ */
167
+ type RulesetSource = 'memory' | 'stale' | 'fetched' | 'last-good' | 'cold-fallback';
168
+ declare function getRulesetWithSource({ platformUrl, shopId, waitUntil, fetchImpl, }: {
169
+ platformUrl: string;
170
+ shopId: string;
171
+ waitUntil?: (p: Promise<unknown>) => void;
172
+ fetchImpl?: typeof fetch;
173
+ }): Promise<{
174
+ ruleset: PlaybookRuleset | null;
175
+ source: RulesetSource;
176
+ }>;
177
+ /**
178
+ * Start (or join) the ruleset fetch as early as possible in a request, before
179
+ * routing/rendering; the render then joins the in-flight promise. Never throws.
180
+ */
181
+ declare function prefetchRuleset(args: Parameters<typeof getRulesetWithSource>[0]): void;
182
+
183
+ /**
184
+ * Analytics consent — vendored from the Playbook platform's shared consent module (the
185
+ * storefront SDKs' single source; see Playbook's
186
+ * `.ai/docs/STOREFRONT-CONSENT-GATING.md`, which is binding). Keep the logic
187
+ * identical; this copy exists only because the store can't import the
188
+ * Playbook monorepo.
189
+ *
190
+ * Contract:
191
+ * - Read Shopify's Customer Privacy API (`analytics` purpose only, matching
192
+ * the checkout Web Pixel). Never integrate with a CMP directly — any CMP that
193
+ * feeds the API (e.g. TrueVault Polaris) works with no code here.
194
+ * - RENDERING is functional and never gated. The persistent visitor cookie,
195
+ * exposures, events and the cart attribute are ANALYTICS and are gated.
196
+ * - FAIL OPEN only when the API is genuinely absent; CLOSED when it exists and
197
+ * denies, or while a known-present API is still resolving.
198
+ *
199
+ * Client: `window`/`document` touched at CALL time only (safe to import on the
200
+ * server). Server: `analyticsConsentFromCookie` reads Shopify's own
201
+ * `_tracking_consent` cookie, the same signal the checkout pixel trusts.
202
+ */
203
+ type ConsentState = 'granted' | 'denied' | 'pending' | 'absent';
204
+ /**
205
+ * Force the "a CMP is present" branch: a headless store whose CMP injects
206
+ * `Shopify.customerPrivacy` after we boot (e.g. TrueVault Polaris). Without it a
207
+ * first-time visitor with no `_tracking_consent` cookie would fail open.
208
+ */
209
+ declare function declareConsentRequired(): void;
210
+ /** Wait for the API: already loaded → `loadFeatures()` → bounded poll → give up. */
211
+ declare function waitForConsentAPI(): Promise<void>;
212
+ /** Granted right now? Closed while resolving a known-present API; open if absent. */
213
+ declare function isAnalyticsConsentGranted(): boolean;
214
+ declare function getConsentState(): ConsentState;
215
+ /** Subscribe to `visitorConsentCollected` (decision read from event.detail). */
216
+ declare function onConsentChange(cb: (granted: boolean) => void): () => void;
217
+ /**
218
+ * SERVER: analytics consent from Shopify's `_tracking_consent` cookie.
219
+ * Returns `granted` / `denied`, `pending` when the cookie exists but analytics
220
+ * is undecided, and `absent` when there is no cookie at all. Tolerates both
221
+ * known payload shapes (`con.CMP.a` = "1"/"0"/"" and `purposes.a` boolean);
222
+ * anything unparseable is `pending` (closed), never granted.
223
+ */
224
+ declare function analyticsConsentFromCookie(raw: string | undefined): ConsentState;
225
+
226
+ /**
227
+ * The standard events — ONE taxonomy for every store (GROWTH-TESTS.md "The
228
+ * standard events"). Store-specific interactions are `variant_interaction`
229
+ * with a `name` slug, never a new event.
230
+ */
231
+ declare const STANDARD_EVENTS: readonly ["add_to_cart", "checkout_started", "scroll_depth", "engaged_time", "variant_interaction"];
232
+ type StandardEvent = (typeof STANDARD_EVENTS)[number];
233
+ declare const DEFAULT_SUPPORTED_EVENTS: string[];
234
+ /** Store-supplied context the module can't derive (market, locale, login). */
235
+ interface PlaybookStoreContext {
236
+ market?: string | null;
237
+ locale?: string | null;
238
+ isLoggedIn?: boolean | null;
239
+ }
240
+ interface TrackedEntry {
241
+ at: string;
242
+ kind: 'exposure' | 'event';
243
+ name: string;
244
+ testKey: string;
245
+ arm: string;
246
+ status: 'sent' | 'held' | 'blocked';
247
+ props?: Record<string, unknown>;
248
+ }
249
+ declare function getTrackedLog(): readonly TrackedEntry[];
250
+ declare function getServerTrackedLog(): readonly TrackedEntry[];
251
+ declare function subscribeTrackedLog(fn: () => void): () => void;
252
+ interface SessionContext {
253
+ utm: Record<string, string>;
254
+ referrerHost: string | null;
255
+ landingPath: string;
256
+ /** Which ad network's click id was on the landing URL — never the value. */
257
+ clickIdType: string | null;
258
+ }
259
+ /** Captured once per session on its first page, then reused. */
260
+ declare function getSessionContext(): SessionContext | null;
261
+ /** Whether this browser session already sent an exposure for the test. */
262
+ declare function hasSentExposure(visitorId: string, testKey: string): boolean;
263
+ /** Which tests an event is attributed to. */
264
+ type TrackScope =
265
+ /** every running test this visitor was exposed to this session */
266
+ 'visitor'
267
+ /** running tests whose slot was on screen during this page view */
268
+ | 'page'
269
+ /** explicit test keys */
270
+ | {
271
+ testKeys: string[];
272
+ };
273
+ interface TrackOptions {
274
+ /** Once per visitor per test per session under this suffix (e.g. the event). */
275
+ oncePerSession?: string;
276
+ /** Use sendBeacon (pagehide). */
277
+ beacon?: boolean;
278
+ }
279
+ /**
280
+ * Track an event for every test in `scope`. No-op without consent, outside a
281
+ * running test, or for forced previews. Unsupported event names are held.
282
+ */
283
+ declare function playbookTrack(event: StandardEvent, rawProps?: Record<string, unknown>, scope?: TrackScope, { oncePerSession, beacon }?: TrackOptions): number;
284
+
285
+ declare const DEFAULT_EXPOSURE_URL = "/apps/playbook/api/storefront/tests/exposure";
286
+ declare const DEFAULT_EVENT_URL = "/apps/playbook/api/storefront/tests/event";
287
+ /** Live analytics consent: granted / denied / pending / absent (API absent). */
288
+ declare function usePlaybookConsent(): ConsentState;
289
+ /**
290
+ * May analytics (exposures, events, the persistent visitor cookie, the cart
291
+ * attribute) run? Open only when granted or the API is genuinely absent.
292
+ */
293
+ declare function useAnalyticsAllowed(): boolean;
294
+ declare function usePlaybookState(): PlaybookState | null;
295
+ interface PlaybookVariant {
296
+ arm: string;
297
+ inTest: boolean;
298
+ forced: boolean;
299
+ config: Record<string, unknown>;
300
+ }
301
+ /**
302
+ * The visitor's arm for a test. Resolved on the server and read from loader
303
+ * state, so SSR and hydration render the same arm (no flicker).
304
+ *
305
+ * `eligible: false` (e.g. "not a towel product") → control, not in test.
306
+ * A forced arm (QA `pb_force` or a `pb_preview` link) skips status and traffic
307
+ * split but still respects targeting: a towel arm forced on a towel page must
308
+ * not follow the session onto a bedding page.
309
+ */
310
+ declare function usePlaybookVariant(testKey: string, { eligible }?: {
311
+ eligible?: boolean;
312
+ }): PlaybookVariant;
313
+
314
+ /**
315
+ * Returns `(name, target?)` that logs a `variant_interaction` for this test —
316
+ * anything the variant itself offers (`copy_code`, `open_review_quote`) —
317
+ * once per name+target per session. No-op without consent, outside the test,
318
+ * or for forced previews.
319
+ */
320
+ declare function usePlaybookInteraction(testKey: string, variant: PlaybookVariant): (name: string, target?: string) => void;
321
+ /**
322
+ * Logs an exposure when the attached element is actually on screen, once per
323
+ * visitor per test per session. Attach the returned ref to an element that
324
+ * renders in BOTH arms (e.g. the price) so control and variant are exposed by
325
+ * the same trigger. No-op for forced previews and visitors not in the test.
326
+ */
327
+ declare function usePlaybookExposure(testKey: string, variant: PlaybookVariant, { enabled }?: {
328
+ enabled?: boolean;
329
+ }): (el: Element | null) => void;
330
+ /**
331
+ * Preview-only: after an in-app navigation drops `?pb_preview=`, returns the
332
+ * URL (path + search + hash) that puts it back, or null when nothing to do.
333
+ * Needed inside a cross-site frame, where the SameSite=None preview cookie can
334
+ * still be blocked as a third-party cookie. Normal shoppers have no token, so
335
+ * this is always null for them.
336
+ */
337
+ declare function usePreviewParamRedirect(location: {
338
+ pathname: string;
339
+ search: string;
340
+ hash: string;
341
+ }): string | null;
342
+
343
+ declare function PlaybookProvider({ state, pathname, exposureUrl, eventUrl, supportedEvents, storeContext, children, }: {
344
+ state: PlaybookState | null | undefined;
345
+ /** Current route pathname (re-render on navigation so path targeting updates). */
346
+ pathname: string;
347
+ exposureUrl?: string;
348
+ eventUrl?: string;
349
+ /** Event names the platform endpoint accepts; others are held, not sent. */
350
+ supportedEvents?: string[];
351
+ /** Market / locale / login state, for the exposure context. */
352
+ storeContext?: PlaybookStoreContext;
353
+ children: ReactNode;
354
+ }): react_jsx_runtime.JSX.Element;
355
+ /** Component form of `usePlaybookExposure` for wrapping an existing element. */
356
+ declare function PlaybookExposure({ testKey, variant, enabled, children, }: {
357
+ testKey: string;
358
+ variant: PlaybookVariant;
359
+ enabled?: boolean;
360
+ children: (ref: (el: Element | null) => void) => ReactNode;
361
+ }): react_jsx_runtime.JSX.Element;
362
+
363
+ /**
364
+ * CLIENT: keep the browser's copies of the ONE visitor id in line with the
365
+ * consent decision, exactly as the platform's shared visitor-id module
366
+ * does for the SDK (so both write the same keys the same way):
367
+ *
368
+ * granted / no CMP → `_pb_visitor_id` cookie, 365d (promotes a session id)
369
+ * denied / pending → sessionStorage only; any cookie is EXPIRED
370
+ *
371
+ * sessionStorage `_pb_visitor_id` is always seeded with the server's id so the
372
+ * SDK's helper (which reads sessionStorage under denial) uses the same value.
373
+ */
374
+
375
+ declare function syncVisitorId(visitorId: string, consent: ConsentState): void;
376
+ /**
377
+ * Inline script for the document <head>, BEFORE the SDK script: seeds
378
+ * sessionStorage so `playbook.js` resolves the same visitor id even when it
379
+ * runs before hydration. `visitorId` is a validated UUID (no escaping needed
380
+ * beyond JSON).
381
+ */
382
+ declare function visitorSeedScript(visitorId: string): string;
383
+
384
+ declare function usePageEngagement(pathname: string, enabled: boolean): void;
385
+
386
+ /** Minimal cookie helpers (web-standard, no dependencies). */
387
+ /**
388
+ * The ONE Playbook visitor id, shared with the existing SDK (`playbook.js`,
389
+ * the platform's shared visitor-id module): persistent (365d, host-only,
390
+ * readable by JS) only with analytics consent or no consent system.
391
+ */
392
+ declare const VISITOR_COOKIE = "_pb_visitor_id";
393
+ /**
394
+ * Session-scoped carrier of the same id while consent is denied or pending, so
395
+ * the server can render the same arm on every page of the session (the SDK's
396
+ * equivalent is sessionStorage, which the server can't read). Functional:
397
+ * expires with the browser session, never written once the persistent cookie
398
+ * is allowed.
399
+ */
400
+ declare const SESSION_VISITOR_COOKIE = "_pb_session_vid";
401
+ /** Retired pilot cookie; migrated on first read, then expired. */
402
+ declare const LEGACY_VISITOR_COOKIE = "pb_vid";
403
+
404
+ type AddToCartSource = 'pdp' | 'quick_add' | 'cart_upsell' | 'other';
405
+ declare function setNextAddSource(source: AddToCartSource): void;
406
+ declare function takeAddSource(): AddToCartSource;
407
+ interface AddedLineInput {
408
+ merchandiseId?: string;
409
+ quantity?: number;
410
+ }
411
+ interface CartLineSnapshot {
412
+ merchandise?: {
413
+ id?: string;
414
+ price?: {
415
+ amount?: string;
416
+ };
417
+ product?: {
418
+ id?: string;
419
+ };
420
+ };
421
+ }
422
+ /** One `add_to_cart` per added line. Never throws. */
423
+ declare function trackAddToCartLines(lines: AddedLineInput[], cartLines: CartLineSnapshot[], source: AddToCartSource): void;
424
+
425
+ /** Cart attribute that ties an order back to the visitor's assignments. */
426
+ declare const CART_VISITOR_ATTRIBUTE = "_pb_vid";
427
+ declare function playbookCartAttribute(visitorId: string): {
428
+ key: string;
429
+ value: string;
430
+ };
431
+ /** True when the cart already carries this visitor's id. */
432
+ declare function cartHasPlaybookAttribute(attributes: ReadonlyArray<{
433
+ key: string;
434
+ value?: string | null;
435
+ }> | null | undefined, visitorId: string): boolean;
436
+
437
+ declare const CONTROL_ARM = "control";
438
+ interface AssignInput {
439
+ visitorId: string | null;
440
+ device: PlaybookDevice;
441
+ visitorType: PlaybookVisitorType;
442
+ preview?: PlaybookPreview | null;
443
+ }
444
+ declare function assignTest(test: PlaybookTestRule, { visitorId, device, visitorType, preview }: AssignInput): PlaybookAssignment;
445
+ /**
446
+ * Path targeting is evaluated against the CURRENT route on the client, so a
447
+ * root loader that doesn't revalidate on SPA navigation stays correct. A
448
+ * leading locale segment (`/en-ca/products/…`) is ignored.
449
+ */
450
+ declare function matchesPathPrefix(pathname: string, prefixes: string[] | undefined): boolean;
451
+
452
+ /**
453
+ * GrowthBook assignment primitives, vendored for Playbook code tests.
454
+ *
455
+ * Ported from GrowthBook's JavaScript SDK
456
+ * (https://github.com/growthbook/growthbook, packages/sdk-js/src/util.ts),
457
+ * MIT License, Copyright (c) 2021 GrowthBook, Inc.
458
+ *
459
+ * The canonical copy lives in the Playbook platform's shared core (unit-tested against
460
+ * GrowthBook's published `cases.json` vectors). This file must stay
461
+ * behaviour-identical to it: the platform's readout re-derives assignment from
462
+ * the same inputs, so any drift here silently corrupts a test.
463
+ *
464
+ * Pure and isomorphic: no Node, DOM or Worker globals.
465
+ */
466
+ type VariationRange = [number, number];
467
+ /**
468
+ * Deterministic hash → n in [0, 1). Version 2 is GrowthBook's unbiased
469
+ * algorithm; version 1 is the original (still used for namespaces).
470
+ */
471
+ declare function hash(seed: string, value: string, version: number): number | null;
472
+ declare function getEqualWeights(n: number): number[];
473
+ declare function inNamespace(hashValue: string, namespace: [string, number, number]): boolean;
474
+ declare function chooseVariation(n: number, ranges: VariationRange[]): number;
475
+ declare function getBucketRanges(numVariations: number, coverage: number | undefined, weights?: number[]): VariationRange[];
476
+
477
+ export { type AddToCartSource, type AddedLineInput, CART_VISITOR_ATTRIBUTE, CONTROL_ARM, type CartLineSnapshot, type ConsentState, type CreatePlaybookOptions, DEFAULT_EVENT_URL, DEFAULT_EXPOSURE_URL, DEFAULT_PLATFORM_URL, DEFAULT_SUPPORTED_EVENTS, LEGACY_VISITOR_COOKIE, type PlaybookArm, type PlaybookAssignReason, type PlaybookAssignment, type PlaybookDevice, PlaybookExposure, type PlaybookOverride, type PlaybookPreview, PlaybookProvider, type PlaybookRuleset, type PlaybookServerResult, type PlaybookState, type PlaybookStoreContext, type PlaybookTestRule, type PlaybookTestStatus, type PlaybookVariant, type PlaybookVisitorType, type RulesetSource, SESSION_VISITOR_COOKIE, STANDARD_EVENTS, type StandardEvent, type TrackScope, type TrackedEntry, VISITOR_COOKIE, analyticsConsentFromCookie, assignTest, cartHasPlaybookAttribute, chooseVariation, createPlaybook, declareConsentRequired, detectDevice, detectGeo, getBucketRanges, getConsentState, getEqualWeights, getServerTrackedLog, getSessionContext, getTrackedLog, hasSentExposure, hash, inNamespace, isAnalyticsConsentGranted, matchesPathPrefix, onConsentChange, playbookCartAttribute, playbookTrack, prefetchRuleset, setNextAddSource, subscribeTrackedLog, syncVisitorId, takeAddSource, trackAddToCartLines, useAnalyticsAllowed, usePageEngagement, usePlaybookConsent, usePlaybookExposure, usePlaybookInteraction, usePlaybookState, usePlaybookVariant, usePreviewParamRedirect, visitorSeedScript, waitForConsentAPI };