@heyplaybook/hydrogen 0.7.1 → 0.8.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/README.md CHANGED
@@ -206,6 +206,97 @@ The manifest is cached per isolate exactly like the ruleset: 60 s fresh, 300 s
206
206
  stale, a 300 ms / 1.5 s render budget, a 30 s backoff after a failure. The kill
207
207
  switch and a missing shop id turn it off with everything else.
208
208
 
209
+ ### Server-side render: named slots and section slots (0.8.0)
210
+
211
+ The cloak hides the page until the browser has painted the test. With slots, the
212
+ store server renders the visitor's arm straight into the HTML instead: no hide, no
213
+ swap. Render a slot once per spot; any test a designer places at that slot is then
214
+ server-rendered, with no code change per test.
215
+
216
+ **Named slots** — one per spot, from a fixed vocabulary:
217
+
218
+ | Name | Page | Where |
219
+ |---|---|---|
220
+ | `buy-column-top` | product | first thing in the buy column, above the title / breadcrumbs |
221
+ | `after-add-to-cart` | product | right after the Add to Cart block, outside your button group |
222
+ | `under-size` | product | under the Size option's label, above its buttons |
223
+ | `collection-grid-top` | collection | right before the product grid |
224
+ | `after-home-hero` | home | right after the hero section |
225
+
226
+ ```tsx
227
+ import {PlaybookSlot} from '@heyplaybook/hydrogen';
228
+
229
+ const {playbookSsr} = useRootLoaderData(); // the root loader's `ssr`
230
+
231
+ <AddToCart … />
232
+ <PlaybookSlot ssr={playbookSsr} name="after-add-to-cart" />
233
+ ```
234
+
235
+ **Section slots** — wrap your section renderer and every CMS section gets a slot
236
+ before and after it (`section:<id>:before` / `section:<id>:after`), so home and
237
+ landing pages need no names agreed in advance. With Pack, replace
238
+ `<RenderSections content={page} />` with:
239
+
240
+ ```tsx
241
+ import {useSections} from '@pack/react';
242
+ import {PlaybookSections} from '@heyplaybook/hydrogen';
243
+
244
+ const sections = useSections({content: page}); // what RenderSections renders
245
+ <PlaybookSections ssr={playbookSsr} sections={sections} />
246
+ ```
247
+
248
+ The section id is each element's React key (`useSections` keys by section id).
249
+ Pass `sectionId={(el, i) => …}` if your elements are keyed differently.
250
+
251
+ **Declare what you render** in `server.ts`, so the server only drops the cloak for
252
+ a test it will actually render:
253
+
254
+ ```ts
255
+ import {createPlaybookContext, SECTION_SLOTS} from '@heyplaybook/hydrogen';
256
+
257
+ createPlaybookContext({
258
+ // …
259
+ ssrSlots: [
260
+ 'buy-column-top',
261
+ 'after-add-to-cart',
262
+ 'under-size',
263
+ 'collection-grid-top',
264
+ 'after-home-hero',
265
+ SECTION_SLOTS, // you render <PlaybookSections>
266
+ ],
267
+ });
268
+ ```
269
+
270
+ Root head, once:
271
+
272
+ ```tsx
273
+ <PlaybookSsrHead ssr={data.ssr} nonce={nonce} />
274
+ ```
275
+
276
+ How it behaves:
277
+
278
+ - **Matching.** A test's anchor carries a slot key. The server matches it first,
279
+ then falls back to the 0.7 exact-selector match, so `{anchor, position}` slots
280
+ keep working unchanged.
281
+ - **The marker.** Every slot renders an inert `<template data-pb-slot="<key>">`
282
+ (display none, no box, no layout effect). The browser path anchors to it
283
+ (`[data-pb-slot="<key>"]`), so a test at a slot also renders correctly for a
284
+ visitor the server didn't decide for.
285
+ - **Placement.** The design renders right after the marker (right before it for a
286
+ `before` anchor), exactly where the browser path would put it.
287
+ - **Slot report.** After hydration `<PlaybookRoot>` reports which markers a page
288
+ renders, so Playbook learns your slot list and its designer offers those slots as
289
+ placements. Sampled (1 in 10 page loads), at most once a day per browser per page
290
+ type, no shopper data. `slotReport={false}` turns it off.
291
+ - **Fallback.** Anything the server can't render (a test at a plain selector, a
292
+ slot this page doesn't declare, more than one test on the page, a non-html
293
+ design) keeps the cloak, as before.
294
+
295
+ Render each named slot only where it belongs, and only once per page. A declared
296
+ slot that a page doesn't actually render (e.g. `under-size` on a product with no
297
+ Size option) costs that page the cloak: the browser then places the design late, at
298
+ the test's fallback spot. Wrap such a slot in the same condition as its spot.
299
+
209
300
  ### Cart attribute at creation
210
301
 
211
302
  Writing `_pb_vid` after the fact can race other attribute writers (Intelligems writes when
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import { ReactNode, Component } from 'react';
3
+ import { ReactNode, ReactElement, Component } from 'react';
4
4
 
5
5
  /**
6
6
  * Analytics consent — vendored from the Playbook platform's shared consent module (the
@@ -479,6 +479,45 @@ declare function playbookHeadSnippet(cloak: PlaybookCloakConfig | null | undefin
479
479
  /** The same nodes as an HTML string, for a non-React head. '' when untargeted. */
480
480
  declare function playbookHeadSnippetHtml(cloak: PlaybookCloakConfig | null | undefined, options?: PlaybookHeadSnippetOptions): string;
481
481
 
482
+ /**
483
+ * 0.8.0: the server-render slot vocabulary — a VENDORED copy of the
484
+ * platform's `shared/src/editor-protocol/ssr-slots.ts` (the package can't
485
+ * import the monorepo's internal packages). `__tests__/slots.test.ts` fails if the two drift, so
486
+ * a name added on one side must be added on the other in the same change.
487
+ *
488
+ * Two kinds of slot:
489
+ *
490
+ * - NAMED: `<PlaybookSlot name="after-add-to-cart" />`, one per spot, from
491
+ * the list below.
492
+ * - SECTION: `<PlaybookSections>` renders `section:<id>:before` and
493
+ * `section:<id>:after` around each CMS section (home, landing pages).
494
+ *
495
+ * Every slot renders an inert `<template data-pb-slot="<key>">` marker, so a
496
+ * slot is also a CSS anchor (`[data-pb-slot="<key>"]`) for the browser path,
497
+ * and the package can report which slots a page renders.
498
+ */
499
+ declare const SSR_SLOT_ATTR = "data-pb-slot";
500
+ /** The named slots. Extend in step with the platform's list. */
501
+ declare const SSR_SLOT_NAMES: readonly ["buy-column-top", "after-add-to-cart", "under-size", "collection-grid-top", "after-home-hero"];
502
+ type PlaybookSlotName = (typeof SSR_SLOT_NAMES)[number];
503
+ type SectionSlotSide = 'before' | 'after';
504
+ type SectionSlotKey = `section:${string}:${SectionSlotSide}`;
505
+ type PlaybookSlotKey = PlaybookSlotName | SectionSlotKey;
506
+ /**
507
+ * Declare in `createPlaybookContext({ssrSlots})` that the store wraps its
508
+ * sections in `<PlaybookSections>`: a test anchored to any section slot is
509
+ * then server-rendered.
510
+ */
511
+ declare const SECTION_SLOTS: "section:*";
512
+ /** A named slot or a well-formed section slot key. */
513
+ declare function isSlotKey(v: unknown): v is PlaybookSlotKey;
514
+ /** `section:<id>:before|after`, or null for an id that isn't selector-safe. */
515
+ declare function sectionSlotKey(id: unknown, side: SectionSlotSide): SectionSlotKey | null;
516
+ /** The CSS selector of a slot's marker. */
517
+ declare function slotSelector(key: PlaybookSlotKey): string;
518
+ /** The slot a selector names when it is exactly a slot marker selector, else null. */
519
+ declare function slotFromSelector(selector: unknown): PlaybookSlotKey | null;
520
+
482
521
  interface SsrSnapshotNode {
483
522
  id: string;
484
523
  html: string;
@@ -495,10 +534,16 @@ interface SsrArm {
495
534
  w: number;
496
535
  c: 0 | 1;
497
536
  x: string | null;
537
+ /**
538
+ * Anchor: selector + position (+ fallback). 0.8.0: `slot` = the named or
539
+ * section slot the arm mounts at (platform `ExperienceAnchor.slot`); the
540
+ * slot match comes first, the exact selector is the 0.7 fallback.
541
+ */
498
542
  a: {
499
543
  s: string;
500
544
  p: 'before' | 'after' | 'prepend' | 'append';
501
545
  f?: string;
546
+ slot?: string;
502
547
  } | null;
503
548
  hide: string[];
504
549
  }
@@ -570,6 +615,13 @@ interface SsrDecision {
570
615
  testName: string;
571
616
  armLabel: string;
572
617
  };
618
+ /**
619
+ * 0.8.0: which kind of declared slot serves the arm (`loaderData()` sets it):
620
+ * `slot` = a named / section slot (by slot key), `anchor` = a 0.7 selector
621
+ * slot. Only that kind of `<PlaybookSlot>` renders the design, so a store
622
+ * that has both for one spot never renders it twice.
623
+ */
624
+ matchedBy?: 'slot' | 'anchor';
573
625
  }
574
626
  type SsrOutcome = {
575
627
  decision: SsrDecision;
@@ -604,11 +656,32 @@ declare function ssrHostInnerHtml(snapshot: SsrSnapshot, page: {
604
656
  t: string;
605
657
  h: string;
606
658
  }): string;
607
- /** Does this slot serve the decision's anchor? Exact selector + position match. */
608
- declare function slotMatches(d: SsrDecision, slot: {
609
- anchor: string;
610
- position?: string;
611
- }): boolean;
659
+ /**
660
+ * 0.8.0: the slot an arm's anchor serves — its `slot`, else the slot its
661
+ * selector names when the selector is exactly a marker
662
+ * (`[data-pb-slot="…"]`). Null for a plain CSS anchor.
663
+ */
664
+ declare function armSlot(a: SsrArm['a'] | null | undefined): PlaybookSlotKey | null;
665
+ /**
666
+ * A slot the store renders, as `<PlaybookSlot>` props or a
667
+ * `createPlaybookContext({ssrSlots})` entry:
668
+ *
669
+ * - `{name}` — a named slot or a section slot key; `{name: SECTION_SLOTS}`
670
+ * = any section slot (`<PlaybookSections>`);
671
+ * - `{anchor, position}` — the 0.7 exact-selector slot.
672
+ */
673
+ interface SsrSlotRef {
674
+ name?: string;
675
+ anchor?: string;
676
+ position?: 'before' | 'after' | 'prepend' | 'append';
677
+ }
678
+ /**
679
+ * Does this slot serve the decision's arm? By SLOT KEY first (a named or
680
+ * section slot: the arm's `slot`, or the slot its selector names), then the
681
+ * 0.7 exact selector + position match, so a store's selector-keyed slots
682
+ * keep working unchanged.
683
+ */
684
+ declare function slotMatches(d: SsrDecision, slot: SsrSlotRef): boolean;
612
685
 
613
686
  /** The env keys the kit reads (all optional). */
614
687
  interface PlaybookEnv {
@@ -651,17 +724,19 @@ interface CreatePlaybookContextOptions {
651
724
  */
652
725
  cloak?: boolean;
653
726
  /**
654
- * 0.7.0: the `<PlaybookSlot>`s this store renders (anchor selector +
655
- * position, exactly as the slot props). On a page an all-traffic test
656
- * targets, `loaderData()` picks the visitor's arm on the server and returns
657
- * it as `ssr` when one of these slots serves the arm's anchor (or the arm is
658
- * the original page); the cloak then stays off for that page. Empty/absent =
659
- * no server render, the 0.6.0 cloak only.
727
+ * The slots this store renders. On a page an all-traffic test targets,
728
+ * `loaderData()` picks the visitor's arm on the server and returns it as
729
+ * `ssr` when one of these slots serves the arm (or the arm is the original
730
+ * page); the cloak then stays off for that page. Empty/absent = no server
731
+ * render, the 0.6.0 cloak only.
732
+ *
733
+ * - 0.8.0 a slot NAME (`'after-add-to-cart'`, the `<PlaybookSlot name>`s
734
+ * the store renders) or `SECTION_SLOTS` (the store wraps its sections
735
+ * in `<PlaybookSections>`). Matched by the arm's slot key.
736
+ * - 0.7.0 `{anchor, position}`, exactly as the `<PlaybookSlot>` props.
737
+ * Matched by exact selector, after the slot key.
660
738
  */
661
- ssrSlots?: ReadonlyArray<{
662
- anchor: string;
663
- position?: 'before' | 'after' | 'prepend' | 'append';
664
- }>;
739
+ ssrSlots?: ReadonlyArray<string | SsrSlotRef>;
665
740
  /**
666
741
  * 0.6.0: the storefront DOMAIN the targeting manifest is keyed by (its
667
742
  * `?shop=`; the Playbook UUID doesn't work there). Overrides
@@ -822,18 +897,84 @@ declare function PlaybookSsrHead({ ssr, nonce }: {
822
897
  ssr: SsrDecision | null | undefined;
823
898
  nonce?: string;
824
899
  }): react_jsx_runtime.JSX.Element | null;
825
- /**
826
- * The server-rendered arm, placed by the store where the test's anchor is.
827
- * Renders only when the decision's arm targets exactly this anchor + position;
828
- * otherwise nothing (and the SDK renders as usual).
829
- */
830
- declare function PlaybookSlot({ ssr, anchor, position, }: {
900
+ type PlaybookSlotProps = {
831
901
  ssr: SsrDecision | null | undefined;
832
- /** The CSS selector the test anchors to, exactly as Playbook stores it. */
902
+ /**
903
+ * 0.8.0: the slot's name (`after-add-to-cart`, …) or a section slot key
904
+ * (`section:<id>:after`; `<PlaybookSections>` renders those for you).
905
+ */
906
+ name: PlaybookSlotKey;
907
+ anchor?: never;
908
+ position?: never;
909
+ } | {
910
+ ssr: SsrDecision | null | undefined;
911
+ name?: never;
912
+ /** 0.7: the CSS selector the test anchors to, exactly as Playbook stores it. */
833
913
  anchor: string;
834
914
  position?: 'before' | 'after' | 'prepend' | 'append';
915
+ };
916
+ /**
917
+ * The server-rendered arm, placed by the store where the test mounts.
918
+ *
919
+ * A NAMED slot always renders an inert marker, `<template data-pb-slot>`
920
+ * (no box, nothing in layout), so the page says which slots it has: the
921
+ * browser path anchors to it (`[data-pb-slot="<name>"]`) and the package
922
+ * reports it to Playbook. When the decision's arm mounts at this slot the
923
+ * design renders beside the marker (before it for a `before` anchor, else
924
+ * after), exactly where the browser path would put it.
925
+ *
926
+ * A 0.7 SELECTOR slot renders only when the arm targets exactly this anchor +
927
+ * position; otherwise nothing (and the SDK renders as usual).
928
+ *
929
+ * Slot key first: when `loaderData()` matched the arm to a declared named /
930
+ * section slot (`ssr.matchedBy === 'slot'`), only that slot renders it, so a
931
+ * store keeping an old selector slot at the same spot never renders it twice.
932
+ */
933
+ declare function PlaybookSlot(props: PlaybookSlotProps): react_jsx_runtime.JSX.Element | null;
934
+ /**
935
+ * 0.8.0 SECTION slots: renders the store's sections with a slot before and
936
+ * after each one (`section:<id>:before|after`), so a test can mount between
937
+ * any two sections of a home or landing page with no name agreed in advance.
938
+ *
939
+ * // Pack: same output as <RenderSections content={page} />, plus the slots.
940
+ * const sections = useSections({content: page});
941
+ * <PlaybookSections ssr={playbookSsr} sections={sections} />
942
+ *
943
+ * The id is each element's React key (`useSections` keys by section id), or
944
+ * `sectionId(element, index)` when the store keys them differently. A section
945
+ * without a usable id renders as is, with no slots. Declare `SECTION_SLOTS`
946
+ * in `createPlaybookContext({ssrSlots})`.
947
+ */
948
+ declare function PlaybookSections({ ssr, sections, sectionId, }: {
949
+ ssr: SsrDecision | null | undefined;
950
+ sections: ReadonlyArray<ReactNode> | null | undefined;
951
+ sectionId?: (element: ReactElement, index: number) => string | null | undefined;
835
952
  }): react_jsx_runtime.JSX.Element | null;
836
953
 
954
+ declare const SLOT_REPORT_URL = "/apps/playbook/api/storefront/ssr/slots";
955
+ declare const SLOT_REPORT_SAMPLE_RATE = 0.1;
956
+ /** The slot keys the markup under `root` renders, in page order, de-duplicated and capped. */
957
+ declare function renderedSlotKeys(root: ParentNode): string[];
958
+ interface StorageLike {
959
+ getItem(key: string): string | null;
960
+ setItem(key: string, value: string): void;
961
+ }
962
+ /**
963
+ * Read this page's markers and report them when the dedupe + sample allow.
964
+ * Returns whether it sent. Browser only; never throws.
965
+ */
966
+ declare function reportPageSlots(input: {
967
+ shopId: string | null | undefined;
968
+ pathname: string;
969
+ url?: string;
970
+ sampleRate?: number;
971
+ fetchImpl?: typeof fetch;
972
+ root?: ParentNode;
973
+ storage?: StorageLike | null;
974
+ random?: () => number;
975
+ now?: () => number;
976
+ }): boolean;
977
+
837
978
  /**
838
979
  * Store-specific "why not in test" text for the QA panel. Return a string to
839
980
  * show it (it wins over the generic reason), or null to fall back to the
@@ -990,6 +1131,16 @@ interface PlaybookRootProps {
990
1131
  previewIgnoresTargeting?: boolean;
991
1132
  /** Observe cart-sync decisions (debug/logging). */
992
1133
  onCartSyncEvent?: (event: CartSyncEvent) => void;
1134
+ /**
1135
+ * 0.8.0: report which server-render slots each page renders (its
1136
+ * `<template data-pb-slot>` markers) so Playbook learns the store's slot
1137
+ * list. Sampled, deduped per browser per day, no shopper data (see
1138
+ * `./slot-report`). Default on; `false` turns it off.
1139
+ */
1140
+ slotReport?: boolean | {
1141
+ sampleRate?: number;
1142
+ url?: string;
1143
+ };
993
1144
  exposureUrl?: string;
994
1145
  eventUrl?: string;
995
1146
  supportedEvents?: string[];
@@ -1005,7 +1156,7 @@ declare function visitorInRunningTest(state: PlaybookState | null | undefined):
1005
1156
  declare function PlaybookAAExposure({ testKey }: {
1006
1157
  testKey?: string;
1007
1158
  }): react_jsx_runtime.JSX.Element;
1008
- declare function PlaybookRoot({ state, location, navigate, cart, consent, storeContext, editorPreview, aaSentinel, debug, dataLayer, previewIgnoresTargeting, onCartSyncEvent, exposureUrl, eventUrl, supportedEvents, children, }: PlaybookRootProps): react_jsx_runtime.JSX.Element;
1159
+ declare function PlaybookRoot({ state, location, navigate, cart, consent, storeContext, editorPreview, aaSentinel, debug, dataLayer, previewIgnoresTargeting, onCartSyncEvent, exposureUrl, eventUrl, supportedEvents, slotReport, children, }: PlaybookRootProps): react_jsx_runtime.JSX.Element;
1009
1160
 
1010
1161
  interface Props {
1011
1162
  /** For the console warning only. */
@@ -1374,4 +1525,4 @@ declare function inNamespace(hashValue: string, namespace: [string, number, numb
1374
1525
  declare function chooseVariation(n: number, ranges: VariationRange[]): number;
1375
1526
  declare function getBucketRanges(numVariations: number, coverage: number | undefined, weights?: number[]): VariationRange[];
1376
1527
 
1377
- export { AA_SITEWIDE_TEST, type AddToCartSource, type AddedLineInput, CART_SYNC_IDLE_MS, CART_VISITOR_ATTRIBUTE, CLOAK_MAX_MS, CLOAK_STYLE_ID, CONSENT_LOADED_EVENTS, CONTROL_ARM, type CartAttribute, type CartAttributeReader, type CartAttributeWriter, type CartLineSnapshot, type CartSyncEvent, type CartSyncSnapshot, type CartWriteResult, type ConsentState, type CreatePlaybookContextOptions, type CreatePlaybookOptions, DEFAULT_DATALAYER_EVENT, DEFAULT_EVENT_URL, DEFAULT_EXPERIENCE_SDK_URL, DEFAULT_EXPOSURE_URL, DEFAULT_PLATFORM_URL, DEFAULT_PROXY_ENDPOINT, DEFAULT_SDK_URL, DEFAULT_SUPPORTED_EVENTS, EXPERIENCE_SDK_SCRIPT_ID, EXPERIENCE_VISITOR_CART_ATTRIBUTE, EXPOSURE_CART_ATTRIBUTE, EXPOSURE_COOKIE, type ExperienceAttributionConsent, type ExperienceAttributionInput, type HeadSnippetParts, LEGACY_VISITOR_COOKIE, MAX_WRITES_PER_CART, PlaybookAAExposure, type PlaybookArm, type PlaybookAssignReason, type PlaybookAssignment, PlaybookBoundary, type PlaybookCartAdapter, type PlaybookClientConsent, type PlaybookCloakConfig, PlaybookCloakHead, type PlaybookConsentAdapter, type PlaybookDataLayerOption, type PlaybookDebugExplain, type PlaybookDebugOptions, PlaybookDebugPanel, type PlaybookDevice, type PlaybookEnv, PlaybookExposure, PlaybookHead, type PlaybookHeadProps, type PlaybookHeadSnippetOptions, type PlaybookLoaderData, type PlaybookPreview, PlaybookProvider, type PlaybookProxyOptions, type PlaybookRequestContext, PlaybookRoot, type PlaybookRootProps, type PlaybookRuleset, type PlaybookServerConsent, type PlaybookServerResult, PlaybookSlot, PlaybookSsrHead, type PlaybookState, type PlaybookStoreContext, type PlaybookTestRule, type PlaybookTestStatus, type PlaybookVariant, type PlaybookVisitorType, type RulesetSource, SESSION_VISITOR_COOKIE, STANDARD_EVENTS, type SsrDecision, type SsrOutcome, type SsrPayload, type StandardEvent, TRUEVAULT_CONSENT_COOKIE, type TrackScope, type TrackedEntry, type TrueVaultConsentOptions, VISITOR_COOKIE, addedLinesFrom, analyticsConsentFromCookie, assignTest, bucketIndex, buildHeadSnippet, cartHasPlaybookAttribute, chooseVariation, consentFromAnalytics, createCartAttributeReader, createCartAttributeSync, createCartAttributeWriter, createPlaybook, createPlaybookContext, createPlaybookProxyHandler, createTrueVaultConsent, debugPanelAllowed, decideSsr, declareConsentRequired, detectDevice, detectGeo, experienceVisitorIdFromCookies, getBucketRanges, getConsentState, getEqualWeights, getServerTrackedLog, getSessionContext, getSsrPayload, getTargetedPages, getTrackedLog, hasPlaybookParams, hasSentExposure, hash, inNamespace, isAnalyticsConsentGranted, isKillSwitchOn, isPreviewHost, manifestUrl, matchTargetedPage, matchesPathPrefix, mergeAttributes, normalizeExposureList, onConsentChange, onConsentLoaded, playbookBackendUrl, playbookCartAttribute, playbookHeadSnippet, playbookHeadSnippetHtml, playbookTrack, prefetchRuleset, reconcileExperienceCartAttributes, reconcilePlaybookCartAttribute, revealScript, sanitizeManifestPages, sanitizeRuleset, setNextAddSource, shopifyCustomerPrivacyConsent, slotMatches, ssrHostInnerHtml, ssrUrl, subscribeTrackedLog, syncVisitorId, takeAddSource, targetPageKey, trackAddToCart, trackAddToCartLines, trueVaultDecision, truevaultConsent, useAnalyticsAllowed, usePageEngagement, usePlaybookConsent, usePlaybookExposure, usePlaybookInteraction, usePlaybookState, usePlaybookVariant, usePreviewParamRedirect, visitorInRunningTest, visitorSeedScript, waitForConsentAPI, withPlaybook, withPlaybookCartAttribute };
1528
+ export { AA_SITEWIDE_TEST, type AddToCartSource, type AddedLineInput, CART_SYNC_IDLE_MS, CART_VISITOR_ATTRIBUTE, CLOAK_MAX_MS, CLOAK_STYLE_ID, CONSENT_LOADED_EVENTS, CONTROL_ARM, type CartAttribute, type CartAttributeReader, type CartAttributeWriter, type CartLineSnapshot, type CartSyncEvent, type CartSyncSnapshot, type CartWriteResult, type ConsentState, type CreatePlaybookContextOptions, type CreatePlaybookOptions, DEFAULT_DATALAYER_EVENT, DEFAULT_EVENT_URL, DEFAULT_EXPERIENCE_SDK_URL, DEFAULT_EXPOSURE_URL, DEFAULT_PLATFORM_URL, DEFAULT_PROXY_ENDPOINT, DEFAULT_SDK_URL, DEFAULT_SUPPORTED_EVENTS, EXPERIENCE_SDK_SCRIPT_ID, EXPERIENCE_VISITOR_CART_ATTRIBUTE, EXPOSURE_CART_ATTRIBUTE, EXPOSURE_COOKIE, type ExperienceAttributionConsent, type ExperienceAttributionInput, type HeadSnippetParts, LEGACY_VISITOR_COOKIE, MAX_WRITES_PER_CART, PlaybookAAExposure, type PlaybookArm, type PlaybookAssignReason, type PlaybookAssignment, PlaybookBoundary, type PlaybookCartAdapter, type PlaybookClientConsent, type PlaybookCloakConfig, PlaybookCloakHead, type PlaybookConsentAdapter, type PlaybookDataLayerOption, type PlaybookDebugExplain, type PlaybookDebugOptions, PlaybookDebugPanel, type PlaybookDevice, type PlaybookEnv, PlaybookExposure, PlaybookHead, type PlaybookHeadProps, type PlaybookHeadSnippetOptions, type PlaybookLoaderData, type PlaybookPreview, PlaybookProvider, type PlaybookProxyOptions, type PlaybookRequestContext, PlaybookRoot, type PlaybookRootProps, type PlaybookRuleset, PlaybookSections, type PlaybookServerConsent, type PlaybookServerResult, PlaybookSlot, type PlaybookSlotKey, type PlaybookSlotName, type PlaybookSlotProps, PlaybookSsrHead, type PlaybookState, type PlaybookStoreContext, type PlaybookTestRule, type PlaybookTestStatus, type PlaybookVariant, type PlaybookVisitorType, type RulesetSource, SECTION_SLOTS, SESSION_VISITOR_COOKIE, SLOT_REPORT_SAMPLE_RATE, SLOT_REPORT_URL, SSR_SLOT_ATTR, SSR_SLOT_NAMES, STANDARD_EVENTS, type SectionSlotKey, type SsrDecision, type SsrOutcome, type SsrPayload, type SsrSlotRef, type StandardEvent, TRUEVAULT_CONSENT_COOKIE, type TrackScope, type TrackedEntry, type TrueVaultConsentOptions, VISITOR_COOKIE, addedLinesFrom, analyticsConsentFromCookie, armSlot, assignTest, bucketIndex, buildHeadSnippet, cartHasPlaybookAttribute, chooseVariation, consentFromAnalytics, createCartAttributeReader, createCartAttributeSync, createCartAttributeWriter, createPlaybook, createPlaybookContext, createPlaybookProxyHandler, createTrueVaultConsent, debugPanelAllowed, decideSsr, declareConsentRequired, detectDevice, detectGeo, experienceVisitorIdFromCookies, getBucketRanges, getConsentState, getEqualWeights, getServerTrackedLog, getSessionContext, getSsrPayload, getTargetedPages, getTrackedLog, hasPlaybookParams, hasSentExposure, hash, inNamespace, isAnalyticsConsentGranted, isKillSwitchOn, isPreviewHost, isSlotKey, manifestUrl, matchTargetedPage, matchesPathPrefix, mergeAttributes, normalizeExposureList, onConsentChange, onConsentLoaded, playbookBackendUrl, playbookCartAttribute, playbookHeadSnippet, playbookHeadSnippetHtml, playbookTrack, prefetchRuleset, reconcileExperienceCartAttributes, reconcilePlaybookCartAttribute, renderedSlotKeys, reportPageSlots, revealScript, sanitizeManifestPages, sanitizeRuleset, sectionSlotKey, setNextAddSource, shopifyCustomerPrivacyConsent, slotFromSelector, slotMatches, slotSelector, ssrHostInnerHtml, ssrUrl, subscribeTrackedLog, syncVisitorId, takeAddSource, targetPageKey, trackAddToCart, trackAddToCartLines, trueVaultDecision, truevaultConsent, useAnalyticsAllowed, usePageEngagement, usePlaybookConsent, usePlaybookExposure, usePlaybookInteraction, usePlaybookState, usePlaybookVariant, usePreviewParamRedirect, visitorInRunningTest, visitorSeedScript, waitForConsentAPI, withPlaybook, withPlaybookCartAttribute };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { memo, createContext, Component, useContext, useMemo, useCallback, useState, useEffect, useSyncExternalStore, useRef } from 'react';
2
+ import { memo, createContext, isValidElement, Fragment as Fragment$1, Component, useContext, useMemo, useCallback, useState, useEffect, useSyncExternalStore, useRef } from 'react';
3
3
 
4
4
  // src/growthbook.ts
5
5
  function hashFnv32a(str2) {
@@ -1072,6 +1072,44 @@ function hasOwnedPreviewParams(search) {
1072
1072
  return OWNED_PARAM_RE.test(search || "");
1073
1073
  }
1074
1074
 
1075
+ // src/slots.ts
1076
+ var SSR_SLOT_ATTR = "data-pb-slot";
1077
+ var SSR_SLOT_NAMES = [
1078
+ "buy-column-top",
1079
+ "after-add-to-cart",
1080
+ "under-size",
1081
+ "collection-grid-top",
1082
+ "after-home-hero"
1083
+ ];
1084
+ var SECTION_ID_RE = /^[A-Za-z0-9_-]{1,64}$/;
1085
+ var SECTION_KEY_RE = /^section:([A-Za-z0-9_-]{1,64}):(before|after)$/;
1086
+ var SLOT_KEY_MAX = 80;
1087
+ var SECTION_SLOTS = "section:*";
1088
+ function isSlotName(v) {
1089
+ return typeof v === "string" && SSR_SLOT_NAMES.includes(v);
1090
+ }
1091
+ function isSlotKey(v) {
1092
+ if (typeof v !== "string" || !v || v.length > SLOT_KEY_MAX) return false;
1093
+ return isSlotName(v) || SECTION_KEY_RE.test(v);
1094
+ }
1095
+ function isSectionSlotKey(v) {
1096
+ return typeof v === "string" && SECTION_KEY_RE.test(v);
1097
+ }
1098
+ function sectionSlotKey(id, side) {
1099
+ const v = typeof id === "string" || typeof id === "number" ? String(id).trim() : "";
1100
+ return SECTION_ID_RE.test(v) ? `section:${v}:${side}` : null;
1101
+ }
1102
+ function slotSelector(key) {
1103
+ return `[${SSR_SLOT_ATTR}="${key}"]`;
1104
+ }
1105
+ function slotFromSelector(selector) {
1106
+ if (typeof selector !== "string") return null;
1107
+ const m = /^\s*(?:template)?\[data-pb-slot=(?:"([^"]*)"|'([^']*)')\]\s*$/.exec(selector);
1108
+ if (!m) return null;
1109
+ const key = m[1] ?? m[2];
1110
+ return isSlotKey(key) ? key : null;
1111
+ }
1112
+
1075
1113
  // src/ssr.ts
1076
1114
  var SSR_SNAPSHOT_VERSION = 1;
1077
1115
  function ssrUrl(platformUrl, shopDomain) {
@@ -1267,11 +1305,29 @@ function ssrStateScript(d) {
1267
1305
  };
1268
1306
  return `window.__pbSsr=${JSON.stringify(state).replace(/</g, "\\u003c")};`;
1269
1307
  }
1308
+ function armSlot(a) {
1309
+ if (!a) return null;
1310
+ return isSlotKey(a.slot) ? a.slot : slotFromSelector(a.s);
1311
+ }
1270
1312
  function slotMatches(d, slot) {
1271
1313
  const a = d.arm.a;
1272
1314
  if (!a) return false;
1315
+ if (typeof slot.name === "string" && slot.name) {
1316
+ const key = armSlot(a);
1317
+ if (!key) return false;
1318
+ return slot.name === SECTION_SLOTS ? isSectionSlotKey(key) : key === slot.name;
1319
+ }
1320
+ if (typeof slot.anchor !== "string") return false;
1273
1321
  return a.s.trim() === slot.anchor.trim() && a.p === (slot.position ?? "after");
1274
1322
  }
1323
+ function toSlotRef(decl) {
1324
+ return typeof decl === "string" ? { name: decl } : decl;
1325
+ }
1326
+ function declaredSlotFor(d, refs) {
1327
+ if (refs.some((r) => typeof r.name === "string" && r.name && slotMatches(d, r))) return "slot";
1328
+ if (refs.some((r) => !r.name && slotMatches(d, r))) return "anchor";
1329
+ return null;
1330
+ }
1275
1331
 
1276
1332
  // src/request-context.ts
1277
1333
  var FINALIZE_WAIT_MS = 2e3;
@@ -1396,6 +1452,7 @@ function createPlaybookContext({
1396
1452
  return cloakPromise;
1397
1453
  };
1398
1454
  let ssrRendered = false;
1455
+ const slotRefs = ssrSlots.map(toSlotRef);
1399
1456
  let ssrPromise = null;
1400
1457
  const ssrFor = (cloak) => {
1401
1458
  if (!ssrPromise) {
@@ -1411,8 +1468,12 @@ function createPlaybookContext({
1411
1468
  const pageKey = targetPageKey(url.pathname);
1412
1469
  const out2 = decidePreviewSsr(payload2, pageKey, (pages) => matchTargetedPage(pages, url.pathname) !== null);
1413
1470
  if ("skip" in out2) return { ssr: null, skip: out2.skip };
1414
- const d2 = out2.decision;
1415
- if (d2.experienceId && !ssrSlots.some((s2) => slotMatches(d2, s2))) return { ssr: null, skip: "preview-no-slot" };
1471
+ let d2 = out2.decision;
1472
+ if (d2.experienceId) {
1473
+ const via = declaredSlotFor(d2, slotRefs);
1474
+ if (!via) return { ssr: null, skip: "preview-no-slot" };
1475
+ d2 = { ...d2, matchedBy: via };
1476
+ }
1416
1477
  ssrRendered = true;
1417
1478
  return { ssr: d2, skip: null };
1418
1479
  }
@@ -1429,8 +1490,12 @@ function createPlaybookContext({
1429
1490
  fallbackVisitorId: own
1430
1491
  });
1431
1492
  if ("skip" in out) return { ssr: null, skip: out.skip };
1432
- const d = out.decision;
1433
- if (d.experienceId && !ssrSlots.some((s2) => slotMatches(d, s2))) return { ssr: null, skip: "no-slot" };
1493
+ let d = out.decision;
1494
+ if (d.experienceId) {
1495
+ const via = declaredSlotFor(d, slotRefs);
1496
+ if (!via) return { ssr: null, skip: "no-slot" };
1497
+ d = { ...d, matchedBy: via };
1498
+ }
1434
1499
  ssrRendered = true;
1435
1500
  return { ssr: d, skip: null };
1436
1501
  })().catch(() => ({ ssr: null, skip: "error" }));
@@ -1715,12 +1780,7 @@ function PlaybookSsrHead({ ssr, nonce }) {
1715
1780
  hide ? /* @__PURE__ */ jsx("style", { id: "pb-ssr-hide", nonce, dangerouslySetInnerHTML: { __html: escStyle(hide) } }) : null
1716
1781
  ] });
1717
1782
  }
1718
- function PlaybookSlot({
1719
- ssr,
1720
- anchor,
1721
- position = "after"
1722
- }) {
1723
- if (!ssr || !ssr.experienceId || !ssr.snapshot || !slotMatches(ssr, { anchor, position })) return null;
1783
+ function SsrHost({ ssr }) {
1724
1784
  return /* @__PURE__ */ jsx(
1725
1785
  "div",
1726
1786
  {
@@ -1733,6 +1793,144 @@ function PlaybookSlot({
1733
1793
  }
1734
1794
  );
1735
1795
  }
1796
+ function PlaybookSlot(props) {
1797
+ const { ssr } = props;
1798
+ if (typeof props.name === "string") {
1799
+ const key = props.name;
1800
+ if (!isSlotKey(key)) return null;
1801
+ const marker = /* @__PURE__ */ jsx("template", { "data-pb-slot": key });
1802
+ const hit = !!ssr && !!ssr.experienceId && !!ssr.snapshot && ssr.matchedBy !== "anchor" && slotMatches(ssr, { name: key });
1803
+ if (!hit) return marker;
1804
+ return ssr.arm.a?.p === "before" ? /* @__PURE__ */ jsxs(Fragment, { children: [
1805
+ /* @__PURE__ */ jsx(SsrHost, { ssr }),
1806
+ marker
1807
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1808
+ marker,
1809
+ /* @__PURE__ */ jsx(SsrHost, { ssr })
1810
+ ] });
1811
+ }
1812
+ if (!ssr || !ssr.experienceId || !ssr.snapshot || typeof props.anchor !== "string") return null;
1813
+ if (ssr.matchedBy === "slot") return null;
1814
+ if (!slotMatches(ssr, { anchor: props.anchor, position: props.position ?? "after" })) return null;
1815
+ return /* @__PURE__ */ jsx(SsrHost, { ssr });
1816
+ }
1817
+ function keyOf(el) {
1818
+ if (!isValidElement(el) || el.key == null) return null;
1819
+ return String(el.key);
1820
+ }
1821
+ function PlaybookSections({
1822
+ ssr,
1823
+ sections,
1824
+ sectionId
1825
+ }) {
1826
+ if (!sections?.length) return null;
1827
+ return /* @__PURE__ */ jsx(Fragment, { children: sections.map((el, index) => {
1828
+ if (el == null || el === false) return null;
1829
+ const id = (isValidElement(el) && sectionId ? sectionId(el, index) : null) ?? keyOf(el);
1830
+ const before = id ? sectionSlotKey(id, "before") : null;
1831
+ const after = id ? sectionSlotKey(id, "after") : null;
1832
+ const key = id ?? `pb-section-${index}`;
1833
+ if (!before || !after) return /* @__PURE__ */ jsx(Fragment$1, { children: el }, key);
1834
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1835
+ /* @__PURE__ */ jsx(PlaybookSlot, { ssr, name: before }),
1836
+ el,
1837
+ /* @__PURE__ */ jsx(PlaybookSlot, { ssr, name: after })
1838
+ ] }, key);
1839
+ }) });
1840
+ }
1841
+
1842
+ // src/slot-report.ts
1843
+ var SLOT_REPORT_URL = "/apps/playbook/api/storefront/ssr/slots";
1844
+ var SLOT_REPORT_SAMPLE_RATE = 0.1;
1845
+ var SLOT_REPORT_TTL_MS = 24 * 60 * 60 * 1e3;
1846
+ var SLOT_REPORT_MAX_SLOTS = 100;
1847
+ var STORAGE_PREFIX = "_pb_slots:";
1848
+ function renderedSlotKeys(root) {
1849
+ const out = [];
1850
+ try {
1851
+ for (const el of Array.from(root.querySelectorAll(`[${SSR_SLOT_ATTR}]`))) {
1852
+ const key = el.getAttribute(SSR_SLOT_ATTR);
1853
+ if (isSlotKey(key) && !out.includes(key)) out.push(key);
1854
+ if (out.length >= SLOT_REPORT_MAX_SLOTS) break;
1855
+ }
1856
+ } catch {
1857
+ }
1858
+ return out;
1859
+ }
1860
+ function slotReportScope(pageKey) {
1861
+ const type = pageKey.split(":")[0];
1862
+ return type === "product" || type === "collection" ? `${type}:*` : pageKey;
1863
+ }
1864
+ function slotListSignature(slots) {
1865
+ const s2 = [...slots].sort().join("|");
1866
+ let h = 2166136261;
1867
+ for (let i = 0; i < s2.length; i++) {
1868
+ h ^= s2.charCodeAt(i);
1869
+ h = Math.imul(h, 16777619);
1870
+ }
1871
+ return (h >>> 0).toString(36);
1872
+ }
1873
+ function shouldReportSlots(input) {
1874
+ if (!input.slots.length) return false;
1875
+ const sig = slotListSignature(input.slots);
1876
+ try {
1877
+ const raw = input.storage?.getItem(STORAGE_PREFIX + input.scope);
1878
+ if (raw) {
1879
+ const [prevSig, at] = raw.split("|");
1880
+ if (prevSig === sig && input.now - Number(at) < SLOT_REPORT_TTL_MS) return false;
1881
+ }
1882
+ } catch {
1883
+ }
1884
+ return input.random < input.sampleRate;
1885
+ }
1886
+ function rememberSlotReport(storage, scope, slots, now) {
1887
+ try {
1888
+ storage?.setItem(STORAGE_PREFIX + scope, `${slotListSignature(slots)}|${now}`);
1889
+ } catch {
1890
+ }
1891
+ }
1892
+ function slotReportBody(shopId, pageKey, slots) {
1893
+ return JSON.stringify({ shopId, page: pageKey, slots: slots.slice(0, SLOT_REPORT_MAX_SLOTS) });
1894
+ }
1895
+ function localStore() {
1896
+ try {
1897
+ return window.localStorage;
1898
+ } catch {
1899
+ return null;
1900
+ }
1901
+ }
1902
+ function reportPageSlots(input) {
1903
+ try {
1904
+ if (!input.shopId) return false;
1905
+ const pageKey = targetPageKey(input.pathname);
1906
+ if (!pageKey) return false;
1907
+ const slots = renderedSlotKeys(input.root ?? document);
1908
+ const storage = input.storage === void 0 ? localStore() : input.storage;
1909
+ const now = (input.now ?? Date.now)();
1910
+ const scope = slotReportScope(pageKey);
1911
+ const go = shouldReportSlots({
1912
+ scope,
1913
+ slots,
1914
+ now,
1915
+ random: (input.random ?? Math.random)(),
1916
+ sampleRate: input.sampleRate ?? SLOT_REPORT_SAMPLE_RATE,
1917
+ storage
1918
+ });
1919
+ if (!go) return false;
1920
+ rememberSlotReport(storage, scope, slots, now);
1921
+ const f = input.fetchImpl ?? fetch;
1922
+ void f(input.url ?? SLOT_REPORT_URL, {
1923
+ method: "POST",
1924
+ headers: { "content-type": "application/json" },
1925
+ body: slotReportBody(input.shopId, pageKey, slots),
1926
+ keepalive: true,
1927
+ credentials: "omit"
1928
+ }).catch(() => void 0);
1929
+ return true;
1930
+ } catch {
1931
+ return false;
1932
+ }
1933
+ }
1736
1934
  var PlaybookBoundary = class extends Component {
1737
1935
  state = { failed: false };
1738
1936
  static getDerivedStateFromError() {
@@ -2953,6 +3151,19 @@ function PlaybookAAExposure({ testKey = AA_SITEWIDE_TEST }) {
2953
3151
  const ref = usePlaybookExposure(testKey, variant);
2954
3152
  return /* @__PURE__ */ jsx("span", { ref, "aria-hidden": "true", style: SENTINEL_STYLE });
2955
3153
  }
3154
+ var SLOT_REPORT_DELAY_MS = 1500;
3155
+ function SlotReport({
3156
+ shopId,
3157
+ pathname,
3158
+ options
3159
+ }) {
3160
+ const { sampleRate, url } = options;
3161
+ useEffect(() => {
3162
+ const timer = setTimeout(() => reportPageSlots({ shopId, pathname, sampleRate, url }), SLOT_REPORT_DELAY_MS);
3163
+ return () => clearTimeout(timer);
3164
+ }, [shopId, pathname, sampleRate, url]);
3165
+ return null;
3166
+ }
2956
3167
  function Engagement({ pathname, enabled }) {
2957
3168
  usePageEngagement(pathname, enabled);
2958
3169
  return null;
@@ -2973,10 +3184,12 @@ function PlaybookRoot({
2973
3184
  exposureUrl,
2974
3185
  eventUrl,
2975
3186
  supportedEvents,
3187
+ slotReport = true,
2976
3188
  children
2977
3189
  }) {
2978
3190
  const hydrated = useHydrated();
2979
3191
  const enabled = !!state?.enabled;
3192
+ const slotReportOptions = slotReport === false ? null : slotReport === true ? {} : slotReport;
2980
3193
  return /* @__PURE__ */ jsxs(
2981
3194
  PlaybookProvider,
2982
3195
  {
@@ -3002,6 +3215,7 @@ function PlaybookRoot({
3002
3215
  }
3003
3216
  ) }),
3004
3217
  state?.previewToken && /* @__PURE__ */ jsx(PlaybookBoundary, { name: "preview param", children: /* @__PURE__ */ jsx(PreviewParam, { location, navigate }) }),
3218
+ enabled && state?.shopId && slotReportOptions && !editorPreview && /* @__PURE__ */ jsx(PlaybookBoundary, { name: "slot report", children: /* @__PURE__ */ jsx(SlotReport, { shopId: state.shopId, pathname: location.pathname, options: slotReportOptions }) }),
3005
3219
  enabled && aaSentinel && !editorPreview && /* @__PURE__ */ jsx(PlaybookBoundary, { name: "aa sentinel", children: /* @__PURE__ */ jsx(PlaybookAAExposure, {}) }),
3006
3220
  /* @__PURE__ */ jsx(PlaybookBoundary, { name: "debug panel", children: /* @__PURE__ */ jsx(
3007
3221
  PlaybookDebugPanel,
@@ -3203,4 +3417,4 @@ function trackAddToCartLines(lines, cartLines, source) {
3203
3417
  }
3204
3418
  }
3205
3419
 
3206
- export { AA_SITEWIDE_TEST, CART_SYNC_IDLE_MS, CART_VISITOR_ATTRIBUTE, CLOAK_MAX_MS, CLOAK_STYLE_ID, CONSENT_LOADED_EVENTS, CONTROL_ARM, DEFAULT_DATALAYER_EVENT, DEFAULT_EVENT_URL, DEFAULT_EXPERIENCE_SDK_URL, DEFAULT_EXPOSURE_URL, DEFAULT_PLATFORM_URL, DEFAULT_PROXY_ENDPOINT, DEFAULT_SDK_URL, DEFAULT_SUPPORTED_EVENTS, EXPERIENCE_SDK_SCRIPT_ID, EXPERIENCE_VISITOR_CART_ATTRIBUTE, EXPOSURE_CART_ATTRIBUTE, EXPOSURE_COOKIE, LEGACY_VISITOR_COOKIE, MAX_WRITES_PER_CART, PlaybookAAExposure, PlaybookBoundary, PlaybookCloakHead, PlaybookDebugPanel, PlaybookExposure, PlaybookHead, PlaybookProvider, PlaybookRoot, PlaybookSlot, PlaybookSsrHead, SESSION_VISITOR_COOKIE, STANDARD_EVENTS, TRUEVAULT_CONSENT_COOKIE, VISITOR_COOKIE, addedLinesFrom, analyticsConsentFromCookie, assignTest, bucketIndex, buildHeadSnippet, cartHasPlaybookAttribute, chooseVariation, consentFromAnalytics, createCartAttributeReader, createCartAttributeSync, createCartAttributeWriter, createPlaybook, createPlaybookContext, createPlaybookProxyHandler, createTrueVaultConsent, debugPanelAllowed, decideSsr, declareConsentRequired, detectDevice, detectGeo, experienceVisitorIdFromCookies, getBucketRanges, getConsentState, getEqualWeights, getServerTrackedLog, getSessionContext, getSsrPayload, getTargetedPages, getTrackedLog, hasPlaybookParams, hasSentExposure, hash, inNamespace, isAnalyticsConsentGranted, isKillSwitchOn, isPreviewHost, manifestUrl, matchTargetedPage, matchesPathPrefix, mergeAttributes, normalizeExposureList, onConsentChange, onConsentLoaded, playbookBackendUrl, playbookCartAttribute, playbookHeadSnippet, playbookHeadSnippetHtml, playbookTrack, prefetchRuleset, reconcileExperienceCartAttributes, reconcilePlaybookCartAttribute, revealScript, sanitizeManifestPages, sanitizeRuleset, setNextAddSource, shopifyCustomerPrivacyConsent, slotMatches, ssrHostInnerHtml, ssrUrl, subscribeTrackedLog, syncVisitorId, takeAddSource, targetPageKey, trackAddToCart, trackAddToCartLines, trueVaultDecision, truevaultConsent, useAnalyticsAllowed, usePageEngagement, usePlaybookConsent, usePlaybookExposure, usePlaybookInteraction, usePlaybookState, usePlaybookVariant, usePreviewParamRedirect, visitorInRunningTest, visitorSeedScript, waitForConsentAPI, withPlaybook, withPlaybookCartAttribute };
3420
+ export { AA_SITEWIDE_TEST, CART_SYNC_IDLE_MS, CART_VISITOR_ATTRIBUTE, CLOAK_MAX_MS, CLOAK_STYLE_ID, CONSENT_LOADED_EVENTS, CONTROL_ARM, DEFAULT_DATALAYER_EVENT, DEFAULT_EVENT_URL, DEFAULT_EXPERIENCE_SDK_URL, DEFAULT_EXPOSURE_URL, DEFAULT_PLATFORM_URL, DEFAULT_PROXY_ENDPOINT, DEFAULT_SDK_URL, DEFAULT_SUPPORTED_EVENTS, EXPERIENCE_SDK_SCRIPT_ID, EXPERIENCE_VISITOR_CART_ATTRIBUTE, EXPOSURE_CART_ATTRIBUTE, EXPOSURE_COOKIE, LEGACY_VISITOR_COOKIE, MAX_WRITES_PER_CART, PlaybookAAExposure, PlaybookBoundary, PlaybookCloakHead, PlaybookDebugPanel, PlaybookExposure, PlaybookHead, PlaybookProvider, PlaybookRoot, PlaybookSections, PlaybookSlot, PlaybookSsrHead, SECTION_SLOTS, SESSION_VISITOR_COOKIE, SLOT_REPORT_SAMPLE_RATE, SLOT_REPORT_URL, SSR_SLOT_ATTR, SSR_SLOT_NAMES, STANDARD_EVENTS, TRUEVAULT_CONSENT_COOKIE, VISITOR_COOKIE, addedLinesFrom, analyticsConsentFromCookie, armSlot, assignTest, bucketIndex, buildHeadSnippet, cartHasPlaybookAttribute, chooseVariation, consentFromAnalytics, createCartAttributeReader, createCartAttributeSync, createCartAttributeWriter, createPlaybook, createPlaybookContext, createPlaybookProxyHandler, createTrueVaultConsent, debugPanelAllowed, decideSsr, declareConsentRequired, detectDevice, detectGeo, experienceVisitorIdFromCookies, getBucketRanges, getConsentState, getEqualWeights, getServerTrackedLog, getSessionContext, getSsrPayload, getTargetedPages, getTrackedLog, hasPlaybookParams, hasSentExposure, hash, inNamespace, isAnalyticsConsentGranted, isKillSwitchOn, isPreviewHost, isSlotKey, manifestUrl, matchTargetedPage, matchesPathPrefix, mergeAttributes, normalizeExposureList, onConsentChange, onConsentLoaded, playbookBackendUrl, playbookCartAttribute, playbookHeadSnippet, playbookHeadSnippetHtml, playbookTrack, prefetchRuleset, reconcileExperienceCartAttributes, reconcilePlaybookCartAttribute, renderedSlotKeys, reportPageSlots, revealScript, sanitizeManifestPages, sanitizeRuleset, sectionSlotKey, setNextAddSource, shopifyCustomerPrivacyConsent, slotFromSelector, slotMatches, slotSelector, ssrHostInnerHtml, ssrUrl, subscribeTrackedLog, syncVisitorId, takeAddSource, targetPageKey, trackAddToCart, trackAddToCartLines, trueVaultDecision, truevaultConsent, useAnalyticsAllowed, usePageEngagement, usePlaybookConsent, usePlaybookExposure, usePlaybookInteraction, usePlaybookState, usePlaybookVariant, usePreviewParamRedirect, visitorInRunningTest, visitorSeedScript, waitForConsentAPI, withPlaybook, withPlaybookCartAttribute };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyplaybook/hydrogen",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Playbook store-edit tests for Shopify Hydrogen storefronts: server-side assignment, consent-gated visitor cookie, in-view exposures and cart attribution.",
5
5
  "license": "MIT",
6
6
  "author": "Pack Digital Inc.",