@syntrologie/adapt-product 2.28.0 → 2.29.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.
Files changed (113) hide show
  1. package/dist/__fixtures__/variant-payloads.d.ts +33 -0
  2. package/dist/__fixtures__/variant-payloads.d.ts.map +1 -0
  3. package/dist/cdn.d.ts +1 -0
  4. package/dist/cdn.d.ts.map +1 -1
  5. package/dist/cdn.js +9 -3
  6. package/dist/cdn.js.map +2 -2
  7. package/dist/{chunk-SGJGJRCP.js → chunk-7Z4Y44WC.js} +139 -6
  8. package/dist/chunk-7Z4Y44WC.js.map +7 -0
  9. package/dist/chunk-VY23O32Z.js +10963 -0
  10. package/dist/chunk-VY23O32Z.js.map +7 -0
  11. package/dist/decision/card-effects.d.ts +20 -0
  12. package/dist/decision/card-effects.d.ts.map +1 -0
  13. package/dist/decision/card.d.ts +150 -0
  14. package/dist/decision/card.d.ts.map +1 -0
  15. package/dist/decision/pdp-compose.d.ts +69 -0
  16. package/dist/decision/pdp-compose.d.ts.map +1 -0
  17. package/dist/decision/pdp-effects.d.ts +17 -0
  18. package/dist/decision/pdp-effects.d.ts.map +1 -0
  19. package/dist/decision/pdp.d.ts +214 -0
  20. package/dist/decision/pdp.d.ts.map +1 -0
  21. package/dist/native/nativeSlotSwap.d.ts +40 -0
  22. package/dist/native/nativeSlotSwap.d.ts.map +1 -0
  23. package/dist/native/nativeSlotWatcher.d.ts +135 -0
  24. package/dist/native/nativeSlotWatcher.d.ts.map +1 -0
  25. package/dist/platformAdapter.d.ts +82 -0
  26. package/dist/platformAdapter.d.ts.map +1 -0
  27. package/dist/runtime.d.ts +318 -36
  28. package/dist/runtime.d.ts.map +1 -1
  29. package/dist/runtime.js +10 -2
  30. package/dist/sanitizer.d.ts.map +1 -1
  31. package/dist/schema-primitives.d.ts +197 -12
  32. package/dist/schema-primitives.d.ts.map +1 -1
  33. package/dist/schema.d.ts +2098 -164
  34. package/dist/schema.d.ts.map +1 -1
  35. package/dist/schema.js +11 -1
  36. package/dist/scoring/pool-selection.d.ts +35 -0
  37. package/dist/scoring/pool-selection.d.ts.map +1 -0
  38. package/dist/scoring/scored-template.d.ts +106 -0
  39. package/dist/scoring/scored-template.d.ts.map +1 -0
  40. package/dist/variantCache.d.ts +5 -0
  41. package/dist/variantCache.d.ts.map +1 -0
  42. package/dist/widgets/OtherProductTileLit.d.ts +46 -0
  43. package/dist/widgets/OtherProductTileLit.d.ts.map +1 -0
  44. package/dist/widgets/PdpChartBarStackedLit.d.ts +33 -0
  45. package/dist/widgets/PdpChartBarStackedLit.d.ts.map +1 -0
  46. package/dist/widgets/PdpChartLit.d.ts +56 -0
  47. package/dist/widgets/PdpChartLit.d.ts.map +1 -0
  48. package/dist/widgets/PdpChartMetricPullLit.d.ts +33 -0
  49. package/dist/widgets/PdpChartMetricPullLit.d.ts.map +1 -0
  50. package/dist/widgets/PdpOtherProductsCarouselLit.d.ts +33 -0
  51. package/dist/widgets/PdpOtherProductsCarouselLit.d.ts.map +1 -0
  52. package/dist/widgets/PdpOtherProductsGridLit.d.ts +20 -0
  53. package/dist/widgets/PdpOtherProductsGridLit.d.ts.map +1 -0
  54. package/dist/widgets/PdpOtherProductsLit.d.ts +35 -0
  55. package/dist/widgets/PdpOtherProductsLit.d.ts.map +1 -0
  56. package/dist/widgets/PdpPeerFeedCarouselLit.d.ts +30 -0
  57. package/dist/widgets/PdpPeerFeedCarouselLit.d.ts.map +1 -0
  58. package/dist/widgets/PdpPeerFeedLit.d.ts +51 -0
  59. package/dist/widgets/PdpPeerFeedLit.d.ts.map +1 -0
  60. package/dist/widgets/PdpPeerFeedMasonryLit.d.ts +30 -0
  61. package/dist/widgets/PdpPeerFeedMasonryLit.d.ts.map +1 -0
  62. package/dist/widgets/PdpQaAccordionLit.d.ts +27 -0
  63. package/dist/widgets/PdpQaAccordionLit.d.ts.map +1 -0
  64. package/dist/widgets/PdpQaLit.d.ts +48 -0
  65. package/dist/widgets/PdpQaLit.d.ts.map +1 -0
  66. package/dist/widgets/PdpQaSideBySideLit.d.ts +27 -0
  67. package/dist/widgets/PdpQaSideBySideLit.d.ts.map +1 -0
  68. package/dist/widgets/PdpRegionalFullBleedLit.d.ts +27 -0
  69. package/dist/widgets/PdpRegionalFullBleedLit.d.ts.map +1 -0
  70. package/dist/widgets/PdpRegionalInlineNoteLit.d.ts +27 -0
  71. package/dist/widgets/PdpRegionalInlineNoteLit.d.ts.map +1 -0
  72. package/dist/widgets/PdpRegionalLit.d.ts +48 -0
  73. package/dist/widgets/PdpRegionalLit.d.ts.map +1 -0
  74. package/dist/widgets/PdpRibbonLit.d.ts +31 -0
  75. package/dist/widgets/PdpRibbonLit.d.ts.map +1 -0
  76. package/dist/widgets/PdpSectionHeaderLit.d.ts +30 -0
  77. package/dist/widgets/PdpSectionHeaderLit.d.ts.map +1 -0
  78. package/dist/widgets/PdpSlotLit.d.ts +30 -0
  79. package/dist/widgets/PdpSlotLit.d.ts.map +1 -0
  80. package/dist/widgets/PdpSlotPlaceholderLit.d.ts +22 -0
  81. package/dist/widgets/PdpSlotPlaceholderLit.d.ts.map +1 -0
  82. package/dist/widgets/PdpTrendingNewsHeroLit.d.ts +32 -0
  83. package/dist/widgets/PdpTrendingNewsHeroLit.d.ts.map +1 -0
  84. package/dist/widgets/PdpTrendingNewsLit.d.ts +42 -0
  85. package/dist/widgets/PdpTrendingNewsLit.d.ts.map +1 -0
  86. package/dist/widgets/PdpTrendingNewsMagazineLit.d.ts +32 -0
  87. package/dist/widgets/PdpTrendingNewsMagazineLit.d.ts.map +1 -0
  88. package/dist/widgets/ProductCardLit.d.ts +78 -0
  89. package/dist/widgets/ProductCardLit.d.ts.map +1 -1
  90. package/dist/widgets/ProductComparisonLit.d.ts +9 -4
  91. package/dist/widgets/ProductComparisonLit.d.ts.map +1 -1
  92. package/dist/widgets/ProductGridLit.d.ts +1 -0
  93. package/dist/widgets/ProductGridLit.d.ts.map +1 -1
  94. package/dist/widgets/ProductHeroLit.d.ts +1 -0
  95. package/dist/widgets/ProductHeroLit.d.ts.map +1 -1
  96. package/dist/widgets/ProductRecoCarouselLit.d.ts +24 -0
  97. package/dist/widgets/ProductRecoCarouselLit.d.ts.map +1 -0
  98. package/dist/widgets/SyntroPdpLit.d.ts +366 -0
  99. package/dist/widgets/SyntroPdpLit.d.ts.map +1 -0
  100. package/dist/widgets/VariantPanelLit.d.ts +98 -0
  101. package/dist/widgets/VariantPanelLit.d.ts.map +1 -0
  102. package/dist/widgets/ensureStylesInRoot.d.ts +22 -0
  103. package/dist/widgets/ensureStylesInRoot.d.ts.map +1 -0
  104. package/dist/widgets/entrance.d.ts +35 -0
  105. package/dist/widgets/entrance.d.ts.map +1 -0
  106. package/dist/widgets/renderHealth.d.ts +57 -0
  107. package/dist/widgets/renderHealth.d.ts.map +1 -0
  108. package/dist/widgets/renderHealthReporter.d.ts +66 -0
  109. package/dist/widgets/renderHealthReporter.d.ts.map +1 -0
  110. package/package.json +4 -1
  111. package/dist/chunk-QZZVFYL6.js +0 -1352
  112. package/dist/chunk-QZZVFYL6.js.map +0 -7
  113. package/dist/chunk-SGJGJRCP.js.map +0 -7
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Native slot watcher — the quick-view-modal half of the native-takeover
3
+ * feature (FEAT-1784346204).
4
+ *
5
+ * On the vela SPA there is NO `<syntro-pdp>` element: the quick-view modal
6
+ * server-renders its OWN native FAQ / review sections (the Task 4 shape). This
7
+ * watcher observes those sections appearing, scores the visitor ONCE per product,
8
+ * swaps the personalized preset content into the host sections (via the Task 1
9
+ * `swapNativeSlot` engine), mounts a compact trending-news "extras" section, and
10
+ * speaks a small DOM-event protocol that the demo toggle (Task 7) drives:
11
+ *
12
+ * listens (document): `syntro:demo-toggle` — CustomEvent<{ on: boolean }>
13
+ * emits (document): `syntro:pdp-native-swap` — CustomEvent<{
14
+ * state: 'swapped' | 'restored' | 'default-kept' | 'unavailable';
15
+ * productId: string;
16
+ * summary: string; // "Tailored for: runner · fit_risk"; '' when not swapped
17
+ * canToggle: boolean; // true whenever flipping the toggle can visibly change
18
+ * // anything — a personalized overlap swap OR the cold
19
+ * // generic extras. false for `unavailable` and for a
20
+ * // cold visitor whose product has no `unknown`-row
21
+ * // trending-news to mount.
22
+ * extrasMounted: boolean; // whether the compact trending-news extras section is
23
+ * // currently in the DOM. A cold-with-extras visitor
24
+ * // emits `default-kept` + extrasMounted:true.
25
+ * archetype: string; // raw scorer sport slug ('' unless swapped) — the
26
+ * // band maps it to HUMAN words and never prints it.
27
+ * decision: string; // raw scorer decision slug ('' unless swapped).
28
+ * }>
29
+ *
30
+ * The four states are unchanged. A fully-unknown visitor on a product that HAS an
31
+ * `unknown` preset row with trending-news still keeps the overlap sections
32
+ * (qa/peer-feed) at their defaults, but mounts the generic extras — parity with
33
+ * `<syntro-pdp>`, which renders the unknown preset's extra sections. That case
34
+ * emits `default-kept` + canToggle:true + extrasMounted:true.
35
+ *
36
+ * It is INERT on pages owned by `<syntro-pdp>` (that element does its own native
37
+ * takeover): if one exists in the document when the watcher starts, it never
38
+ * observes. Single watcher per page; module-scoped state; never throws.
39
+ */
40
+ import { type NativeItemFields, type NativeSlotKind } from './nativeSlotSwap';
41
+ /** One config-set slot value: the widget kind, an optional header, and its content. */
42
+ interface SlotPreset {
43
+ kind: string;
44
+ header?: unknown;
45
+ data: unknown;
46
+ }
47
+ /** `presets[product][archetype][slot] = SlotPreset` — the config's SET values. */
48
+ type PdpPresetTable = Record<string, Record<string, Record<string, SlotPreset>>>;
49
+ interface ScoreSpec {
50
+ model_id: string;
51
+ name: string;
52
+ type: string;
53
+ values?: string[];
54
+ value_descriptions?: Record<string, string>;
55
+ signals?: Record<string, unknown>;
56
+ }
57
+ interface SynOSGlobal {
58
+ score?: (spec: ScoreSpec) => Promise<string>;
59
+ scoreMulti?: (specs: ScoreSpec[]) => Promise<string[]>;
60
+ }
61
+ declare function readSynOS(): SynOSGlobal | undefined;
62
+ declare function readPresets(): PdpPresetTable | undefined;
63
+ declare function readArchetypeDescriptions(): Record<string, string>;
64
+ declare function readDecisionDescriptions(): Record<string, string>;
65
+ declare function readChatExcerpt(): string;
66
+ interface ScorePair {
67
+ archetype: string;
68
+ decision: string;
69
+ }
70
+ declare function doScore(productPresets: Record<string, Record<string, SlotPreset>>): Promise<ScorePair>;
71
+ /** Build the flat host-field items for one native slot from its scored preset. */
72
+ declare function fieldsForSlot(row: Record<string, SlotPreset>, slotId: string, kind: NativeSlotKind, decision: string): NativeItemFields[];
73
+ /** The preset slot's section-header shape (eyebrow/title/accent/subtitle). */
74
+ interface ExtrasHeader {
75
+ eyebrow?: string | null;
76
+ title?: string | null;
77
+ accent?: string | null;
78
+ subtitle?: string | null;
79
+ }
80
+ /** Pool-selected trending-news payload + the slot's section header, so the
81
+ * modal's extras carry the same heading the page's section wrapper renders
82
+ * (a header-less article pile reads as a rendering glitch — Parker,
83
+ * 2026-07-18). */
84
+ declare function extrasDataFor(row: Record<string, SlotPreset>, decision: string): {
85
+ payload: Record<string, unknown>;
86
+ header: ExtrasHeader | null;
87
+ } | null;
88
+ /** The native slot container for a product, ignoring any inside a `<syntro-pdp>`. */
89
+ declare function slotContainer(productId: string, kind: NativeSlotKind): HTMLElement | null;
90
+ type SwapEventState = 'swapped' | 'restored' | 'default-kept' | 'unavailable';
91
+ declare function emit(state: SwapEventState, productId: string, summary: string, canToggle: boolean, extrasMounted: boolean, archetype?: string, decision?: string): void;
92
+ declare function tearDownSwap(): void;
93
+ /**
94
+ * Mount the compact trending-news extras section for a product, appended after the
95
+ * peer-feed section's PARENT block (falling back to the qa section). Shared by the
96
+ * personalized swap and the cold generic-extras path. Returns true when it mounted
97
+ * (a resolvable container existed) so the caller can decide whether anything
98
+ * visibly changed. Records the node on `session.extras`.
99
+ */
100
+ declare function mountExtras(productId: string, extrasData: {
101
+ payload: Record<string, unknown>;
102
+ header: ExtrasHeader | null;
103
+ }): boolean;
104
+ /**
105
+ * Start the native slot watcher. Idempotent: a second call is a no-op that
106
+ * returns the SAME stop function (single watcher per page).
107
+ *
108
+ * No-ops (never observes) when a `<syntro-pdp>` element already owns the page —
109
+ * that element performs its own native takeover.
110
+ */
111
+ export declare function startNativeSlotWatcher(): () => void;
112
+ /**
113
+ * Test seam. Fully resets module state between tests (production code never calls
114
+ * this). `scanNow` synchronously scans the whole document for native containers
115
+ * and drives the SAME flush logic the observer uses — a deterministic stand-in
116
+ * for jsdom's async MutationObserver.
117
+ */
118
+ export declare const _testing: {
119
+ scanNow(): Promise<void>;
120
+ readSynOSForTest: typeof readSynOS;
121
+ readPresetsForTest: typeof readPresets;
122
+ readArchetypeDescriptionsForTest: typeof readArchetypeDescriptions;
123
+ readDecisionDescriptionsForTest: typeof readDecisionDescriptions;
124
+ readChatExcerptForTest: typeof readChatExcerpt;
125
+ doScoreForTest: typeof doScore;
126
+ fieldsForSlotForTest: typeof fieldsForSlot;
127
+ extrasDataForTest: typeof extrasDataFor;
128
+ slotContainerForTest: typeof slotContainer;
129
+ mountExtrasForTest: typeof mountExtras;
130
+ emitForTest: typeof emit;
131
+ tearDownSwapForTest: typeof tearDownSwap;
132
+ reset(): void;
133
+ };
134
+ export {};
135
+ //# sourceMappingURL=nativeSlotWatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nativeSlotWatcher.d.ts","sourceRoot":"","sources":["../../src/native/nativeSlotWatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAKpB,MAAM,kBAAkB,CAAC;AAI1B,uFAAuF;AACvF,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;CACf;AACD,kFAAkF;AAClF,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE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;;;;;;;;;;aAgBrB,IAAI;CAgBd,CAAC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Platform-agnostic commerce interface the product-card widget reads to fetch
3
+ * variants, add to cart, and open the cart. The widget never branches on
4
+ * platform — it just reads whatever adapter the RUNTIME published for the
5
+ * detected platform.
6
+ *
7
+ * Implementations live in the platform packages and are wired in by the runtime
8
+ * (see runtime-sdk `_platforms-registered.ts` → `setProductCommerceGlobal`):
9
+ * - platform-shopify: /products/{handle}.js + /cart/add.js + navigate to /cart.
10
+ * - platform-woocommerce (future): Store API + ?wc-ajax=add_to_cart.
11
+ *
12
+ * This is NOT host-injected. The host page supplies nothing.
13
+ */
14
+ export interface ProductPlatformAdapter {
15
+ /** Fetch normalized variant data for a product. */
16
+ fetchVariants(productId: string): Promise<VariantPayload>;
17
+ /** Perform the platform-specific add-to-cart POST. Returns success or
18
+ * a structured error the widget can render. */
19
+ addToCart(input: AddToCartInput): Promise<AddToCartResult>;
20
+ /** Open the host's cart UI. Implementation is entirely platform-specific.
21
+ * The widget calls this AFTER closing the chat canvas. */
22
+ openCart(): Promise<void>;
23
+ }
24
+ export interface AddToCartInput {
25
+ product_id: string;
26
+ /** null for single-SKU products (no variant to pick). */
27
+ variant_id: string | null;
28
+ quantity: number;
29
+ }
30
+ export interface AddToCartResult {
31
+ ok: boolean;
32
+ /** Set when ok=false. */
33
+ error?: {
34
+ code: 'oos' | 'network' | 'validation' | 'unknown';
35
+ message: string;
36
+ };
37
+ }
38
+ export interface VariantPayload {
39
+ product_id: string;
40
+ attributes: AttributeDef[];
41
+ variants: Variant[];
42
+ }
43
+ export interface AttributeDef {
44
+ /** Stable id: 'size', 'color', 'cadence'. */
45
+ key: string;
46
+ /** Display label: 'Size', 'Color', 'Delivery'. */
47
+ label: string;
48
+ /** Render mode. Extensible: future kinds may include 'dropdown'. */
49
+ kind: 'pill' | 'swatch';
50
+ values: AttributeValue[];
51
+ }
52
+ export interface AttributeValue {
53
+ /** Stable id: 'large', 'red', 'subscribe'. */
54
+ id: string;
55
+ /** Display label: 'Large', 'Red', 'Subscribe — save 15%'. */
56
+ label: string;
57
+ /** Present when the attribute's kind is 'swatch'; null for pill attributes. */
58
+ swatch: SwatchSpec | null;
59
+ }
60
+ export interface SwatchSpec {
61
+ kind: 'color' | 'image';
62
+ /** Hex color (#000000) for kind 'color'; URL for kind 'image'. */
63
+ value: string;
64
+ }
65
+ export interface Variant {
66
+ /** Platform-native SKU/variant id used as the cart-POST id. */
67
+ id: string;
68
+ /** Map of attribute key → value id, e.g. { size: 'large', color: 'red' }. */
69
+ selection: Record<string, string>;
70
+ price: number;
71
+ compare_at_price: number | null;
72
+ in_stock: boolean;
73
+ /** Optional per-variant hero image URL. When present the variant panel swaps
74
+ * its image to this on selection; otherwise it keeps the product-level image.
75
+ * Populated by platforms that carry variant-level media (Shopify
76
+ * `variant.featured_image`); absent for products whose image never varies by
77
+ * SKU (e.g. pack-size only). */
78
+ featured_image?: string;
79
+ }
80
+ /** Retrieve the runtime-published commerce adapter. Null if none was set. */
81
+ export declare function getProductPlatformAdapter(): ProductPlatformAdapter | null;
82
+ //# sourceMappingURL=platformAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformAdapter.d.ts","sourceRoot":"","sources":["../src/platformAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,sBAAsB;IACrC,mDAAmD;IACnD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE1D;oDACgD;IAChD,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE3D;+DAC2D;IAC3D,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QA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