@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,20 @@
1
+ import { type ProductPlatformAdapter, type VariantPayload } from '../platformAdapter';
2
+ import type { CardEffect, CardEvent } from './card';
3
+ export interface CardEffectPorts {
4
+ dispatch(event: CardEvent): void;
5
+ publishEvent(name: string, props: Record<string, unknown>): void;
6
+ captureTelemetry(name: string, props: Record<string, unknown>): void;
7
+ closeSdk(): void;
8
+ bindProduct(productId: string): void;
9
+ reportRenderHealth(): void;
10
+ cleanup(): void;
11
+ schedule(callback: () => void, delayMs: number): unknown;
12
+ cancelScheduled(handle: unknown): void;
13
+ getAdapter?(): ProductPlatformAdapter | null;
14
+ fetchVariants?(adapter: ProductPlatformAdapter, productId: string): Promise<VariantPayload>;
15
+ }
16
+ export interface CardEffectExecutor {
17
+ execute(effect: CardEffect): Promise<void>;
18
+ }
19
+ export declare function createCardEffectExecutor(ports: CardEffectPorts): CardEffectExecutor;
20
+ //# sourceMappingURL=card-effects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-effects.d.ts","sourceRoot":"","sources":["../../src/decision/card-effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACjC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACjE,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrE,QAAQ,IAAI,IAAI,CAAC;IACjB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,kBAAkB,IAAI,IAAI,CAAC;IAC3B,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACzD,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvC,UAAU,CAAC,IAAI,sBAAsB,GAAG,IAAI,CAAC;IAC7C,aAAa,CAAC,CAAC,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC7F;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAQD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,eAAe,GAAG,kBAAkB,CAuHnF"}
@@ -0,0 +1,150 @@
1
+ import type { AddToCartInput, VariantPayload } from '../platformAdapter';
2
+ export type CardProductState = {
3
+ status: 'empty';
4
+ id: null;
5
+ } | {
6
+ status: 'invalid';
7
+ id: string | null;
8
+ } | {
9
+ status: 'valid';
10
+ id: string;
11
+ };
12
+ export type CardVariantState = {
13
+ status: 'idle';
14
+ } | {
15
+ status: 'loading';
16
+ } | {
17
+ status: 'ready';
18
+ payload: VariantPayload;
19
+ } | {
20
+ status: 'error';
21
+ message: string;
22
+ };
23
+ export type CardCartState = {
24
+ status: 'idle';
25
+ } | {
26
+ status: 'pending';
27
+ variantId: string | null;
28
+ } | {
29
+ status: 'added';
30
+ } | {
31
+ status: 'error';
32
+ message: string;
33
+ };
34
+ export interface CardState {
35
+ generation: number;
36
+ connection: 'connected' | 'disconnected';
37
+ commerce: 'available' | 'unavailable';
38
+ product: CardProductState;
39
+ face: 'front' | 'back';
40
+ flip: 'flat' | 'animating';
41
+ variants: CardVariantState;
42
+ cart: CardCartState;
43
+ selection: Record<string, string>;
44
+ activation: {
45
+ status: 'idle';
46
+ } | {
47
+ status: 'pending';
48
+ reducedMotion: boolean;
49
+ };
50
+ }
51
+ export type CardEvent = {
52
+ type: 'props-replaced';
53
+ productId: string | null;
54
+ valid: boolean;
55
+ } | {
56
+ type: 'commerce-updated';
57
+ available: boolean;
58
+ } | {
59
+ type: 'primary-activated';
60
+ reducedMotion?: boolean;
61
+ } | {
62
+ type: 'variants-resolved';
63
+ generation: number;
64
+ payload: VariantPayload | null;
65
+ } | {
66
+ type: 'variants-failed';
67
+ generation: number;
68
+ message: string;
69
+ errorName?: string;
70
+ } | {
71
+ type: 'selection-changed';
72
+ attributeKey: string;
73
+ valueId: string;
74
+ } | {
75
+ type: 'variant-add-activated';
76
+ variantId: string;
77
+ } | {
78
+ type: 'add-succeeded';
79
+ generation: number;
80
+ } | {
81
+ type: 'add-failed';
82
+ generation: number;
83
+ message: string;
84
+ code?: string;
85
+ } | {
86
+ type: 'retry-activated';
87
+ } | {
88
+ type: 'back-activated';
89
+ } | {
90
+ type: 'animation-settled';
91
+ } | {
92
+ type: 'disconnected';
93
+ } | {
94
+ type: 'reconnected';
95
+ };
96
+ export type CardEffect = {
97
+ type: 'lookup-variants';
98
+ generation: number;
99
+ productId: string;
100
+ } | {
101
+ type: 'add-to-cart';
102
+ generation: number;
103
+ input: AddToCartInput;
104
+ } | {
105
+ type: 'open-cart';
106
+ } | {
107
+ type: 'close-sdk';
108
+ } | {
109
+ type: 'publish-event';
110
+ name: string;
111
+ props: Record<string, unknown>;
112
+ } | {
113
+ type: 'capture-telemetry';
114
+ name: string;
115
+ props: Record<string, unknown>;
116
+ } | {
117
+ type: 'schedule-flip-settle';
118
+ delayMs: number;
119
+ } | {
120
+ type: 'cancel-flip-settle';
121
+ } | {
122
+ type: 'bind-product';
123
+ productId: string;
124
+ } | {
125
+ type: 'report-render-health';
126
+ } | {
127
+ type: 'cleanup';
128
+ };
129
+ export interface CardTransition {
130
+ state: CardState;
131
+ effects: CardEffect[];
132
+ }
133
+ export interface CardView {
134
+ face: CardState['face'];
135
+ flipAnimating: boolean;
136
+ primaryCta: {
137
+ mode: 'add' | 'adding' | 'view-cart';
138
+ disabled: boolean;
139
+ };
140
+ panel: {
141
+ status: 'hidden' | 'loading' | 'ready' | 'error';
142
+ payload: VariantPayload | null;
143
+ error: string | null;
144
+ };
145
+ addError: string | null;
146
+ }
147
+ export declare function createInitialCardState(generation?: number): CardState;
148
+ export declare function selectCardView(state: CardState): CardView;
149
+ export declare function transitionCard(state: CardState, event: CardEvent): CardTransition;
150
+ //# sourceMappingURL=card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/decision/card.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzE,MAAM,MAAM,gBAAgB,GACxB;IAAE,MAAM,EAAE,OAAO,CAAC;IAA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ACjD,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;QAC/B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KACtB,CAAC;IACF,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,wBAAgB,sBAAsB,CAAC,UAAU,SAAI,GAAG,SAAS,CAahE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,QAAQ,CAwCzD;AA6ND,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,cAAc,CAoJjF"}
@@ -0,0 +1,69 @@
1
+ import type { ScoredTemplateResult, SlotPreset } from '../scoring/scored-template';
2
+ import type { PdpExplainMetric } from './pdp';
3
+ export interface PdpModuleHeaderClient {
4
+ eyebrow: string;
5
+ title: string;
6
+ accent: string | null;
7
+ subtitle: string | null;
8
+ }
9
+ export interface PdpPlanTaskClient {
10
+ slot: string;
11
+ kind: 'trending-news' | 'chart' | 'qa' | 'regional' | 'peer-feed' | 'other-products';
12
+ variant: string | null;
13
+ header: PdpModuleHeaderClient;
14
+ }
15
+ export interface PdpPlanEnvelope {
16
+ rationale: string;
17
+ tasks: PdpPlanTaskClient[];
18
+ }
19
+ /**
20
+ * Fixed PDP slot set and canonical live-slot order. Configured slots lead in
21
+ * this order; remaining live slots keep stable page positions regardless of
22
+ * response latency, so heavy modules cannot leapfrog lighter content.
23
+ */
24
+ export declare const PDP_SLOT_IDS: readonly ["pdp-slot-qa", "pdp-slot-trending-news", "pdp-slot-peer-feed", "pdp-slot-chart", "pdp-slot-regional", "pdp-slot-other-products"];
25
+ export declare function orderPdpSlots(slotIds: string[], isSet: (slot: string) => boolean): string[];
26
+ export declare function buildPdpPlan(slots: Array<{
27
+ slot: string;
28
+ preset: SlotPreset | undefined;
29
+ }>): PdpPlanEnvelope;
30
+ export interface PdpComposeModuleRequest {
31
+ generation: number;
32
+ slot: string;
33
+ archetype: string;
34
+ decisionArchetype: string;
35
+ behaviorSummary: string;
36
+ }
37
+ export type PdpComposeUnset = (unsetSlots: string[], archetype: string, decisionArchetype?: string) => Promise<void>;
38
+ export interface PdpComposePorts {
39
+ scoreSummary(generation: number): Promise<string>;
40
+ requestDossier(generation: number): Promise<PdpExplainMetric[]>;
41
+ resolveTemplate(generation: number, composeUnset: PdpComposeUnset): Promise<ScoredTemplateResult>;
42
+ requestModule(request: PdpComposeModuleRequest): Promise<void> | void;
43
+ /** Early exit for the scored axes — fired the INSTANT the score exists,
44
+ * before the behavior summary resolves and before the live modules are
45
+ * awaited, so the why-box never trails either (BUG-1783990580; the
46
+ * summary alone was worth ~0.5s). Only invoked when live slots exist;
47
+ * the all-preset path resolves compose() fast anyway. */
48
+ onScored?(args: {
49
+ generation: number;
50
+ archetype: string;
51
+ decisionArchetype: string;
52
+ }): void;
53
+ /** Follow-up to onScored: the behavior summary, when it lands. Consumers
54
+ * patch it into the already-visible explanation (dossier-fold pattern). */
55
+ onSummary?(args: {
56
+ generation: number;
57
+ behaviorSummary: string;
58
+ }): void;
59
+ }
60
+ export interface PdpComposeResult {
61
+ template: ScoredTemplateResult;
62
+ summary: string;
63
+ dossier: Promise<PdpExplainMetric[]>;
64
+ }
65
+ export interface PdpComposeAdapter {
66
+ compose(generation: number): Promise<PdpComposeResult>;
67
+ }
68
+ export declare function createPdpComposeAdapter(ports: PdpComposePorts): PdpComposeAdapter;
69
+ //# sourceMappingURL=pdp-compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdp-compose.d.ts","sourceRoot":"","sources":["../../src/decision/pdp-compose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9C,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG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AAC,CAAC;IAChE,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClG,aAAa,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACtE;;;;6DAIyD;IACzD,QAAQ,CAAC,CAAC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAE5F;+EAC2E;IAC3E,SAAS,CAAC,CAAC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACzE;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACxD;AAUD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,GAAG,iBAAiB,CA8CjF"}
@@ -0,0 +1,17 @@
1
+ import type { PdpEffect, PdpEvent } from './pdp';
2
+ export interface PdpEffectRun {
3
+ dispatch(event: PdpEvent): boolean;
4
+ isCurrent(): boolean;
5
+ }
6
+ export interface PdpEffectPorts {
7
+ dispatch(event: PdpEvent): void;
8
+ startCompose(generation: number, run: PdpEffectRun): Promise<void> | void;
9
+ captureTelemetry(name: string, props: Record<string, unknown>): Promise<void> | void;
10
+ warn(code: string, props: Record<string, unknown>): Promise<void> | void;
11
+ cleanup(): Promise<void> | void;
12
+ }
13
+ export interface PdpEffectExecutor {
14
+ execute(effect: PdpEffect): Promise<void>;
15
+ }
16
+ export declare function createPdpEffectExecutor(ports: PdpEffectPorts): PdpEffectExecutor;
17
+ //# sourceMappingURL=pdp-effects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdp-effects.d.ts","sourceRoot":"","sources":["../../src/decision/pdp-effects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC;IACnC,SAAS,IAAI,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IAChC,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1E,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACrF,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACzE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG,iBAAiB,CAwDhF"}
@@ -0,0 +1,214 @@
1
+ export type PdpConnection = 'connected' | 'disconnected';
2
+ export type PdpActivationState = {
3
+ status: 'waiting-runtime';
4
+ } | {
5
+ status: 'waiting-app';
6
+ } | {
7
+ status: 'active';
8
+ };
9
+ export type PdpStreamState = {
10
+ status: 'idle';
11
+ } | {
12
+ status: 'streaming';
13
+ } | {
14
+ status: 'done';
15
+ } | {
16
+ status: 'error';
17
+ message: string;
18
+ };
19
+ export interface PdpModuleHeader {
20
+ eyebrow: string;
21
+ title: string;
22
+ accent: string | null;
23
+ subtitle: string | null;
24
+ }
25
+ export interface PdpPlanTask {
26
+ slot: string;
27
+ kind: 'trending-news' | 'chart' | 'qa' | 'regional' | 'peer-feed' | 'other-products';
28
+ variant: string | null;
29
+ header: PdpModuleHeader;
30
+ }
31
+ export interface PdpPlan {
32
+ rationale: string;
33
+ tasks: PdpPlanTask[];
34
+ }
35
+ export type PdpPlanState = {
36
+ status: 'empty';
37
+ } | {
38
+ status: 'ready';
39
+ plan: PdpPlan;
40
+ };
41
+ export type PdpSlotStatus = 'pending' | 'mounted' | 'failed';
42
+ export type PdpSlotState = Record<string, PdpSlotStatus>;
43
+ export interface PdpExplainMetric {
44
+ value: string;
45
+ label: string;
46
+ hint?: string;
47
+ }
48
+ export interface PdpExplanation {
49
+ archetypeLabel: string;
50
+ archetypeDesc: string;
51
+ decisionLabel: string | null;
52
+ decisionDesc: string | null;
53
+ summary: string;
54
+ metrics: PdpExplainMetric[];
55
+ }
56
+ export type PdpExplanationState = {
57
+ status: 'empty';
58
+ } | {
59
+ status: 'loading';
60
+ } | {
61
+ status: 'ready';
62
+ explanation: PdpExplanation;
63
+ };
64
+ export interface PdpSlotReasoning {
65
+ source: 'cached' | 'live';
66
+ text: string;
67
+ }
68
+ export type PdpReasoningState = Record<string, PdpSlotReasoning>;
69
+ export type PdpDossierState = {
70
+ status: 'idle';
71
+ } | {
72
+ status: 'loading';
73
+ } | {
74
+ status: 'ready';
75
+ metrics: PdpExplainMetric[];
76
+ } | {
77
+ status: 'error';
78
+ message: string;
79
+ };
80
+ export interface PdpState {
81
+ generation: number;
82
+ connection: PdpConnection;
83
+ activation: PdpActivationState;
84
+ stream: PdpStreamState;
85
+ plan: PdpPlanState;
86
+ slots: PdpSlotState;
87
+ explanation: PdpExplanationState;
88
+ reasoning: PdpReasoningState;
89
+ dossier: PdpDossierState;
90
+ dossierOpen: boolean;
91
+ portalPresent: boolean;
92
+ }
93
+ export type PdpEvent = {
94
+ type: 'runtime-updated';
95
+ runtimeAvailable: boolean;
96
+ appActive: boolean;
97
+ configured: boolean;
98
+ } | {
99
+ type: 'plan-received';
100
+ generation: number;
101
+ plan: PdpPlan;
102
+ } | {
103
+ type: 'mount-succeeded';
104
+ generation: number;
105
+ slot: string;
106
+ } | {
107
+ type: 'mount-missed';
108
+ generation: number;
109
+ slot: string;
110
+ } | {
111
+ type: 'module-resolved';
112
+ generation: number;
113
+ slot: string;
114
+ } | {
115
+ type: 'module-failed';
116
+ generation: number;
117
+ slot: string;
118
+ } | {
119
+ type: 'cached-reasoning-resolved';
120
+ generation: number;
121
+ slot: string;
122
+ text: string;
123
+ } | {
124
+ type: 'live-reasoning-resolved';
125
+ generation: number;
126
+ slot: string;
127
+ text: string;
128
+ } | {
129
+ type: 'explanation-resolved';
130
+ generation: number;
131
+ explanation: PdpExplanation;
132
+ durationMs?: number;
133
+ } | {
134
+ type: 'dossier-resolved';
135
+ generation: number;
136
+ metrics: PdpExplainMetric[];
137
+ } | {
138
+ type: 'compose-succeeded';
139
+ generation: number;
140
+ } | {
141
+ type: 'compose-failed';
142
+ generation: number;
143
+ message: string;
144
+ } | {
145
+ type: 'portal-updated';
146
+ present: boolean;
147
+ } | {
148
+ type: 'dossier-toggled';
149
+ open: boolean;
150
+ } | {
151
+ type: 'disconnected';
152
+ } | {
153
+ type: 'reconnected';
154
+ runtimeAvailable: boolean;
155
+ appActive: boolean;
156
+ configured: boolean;
157
+ };
158
+ export type PdpEffect = {
159
+ type: 'start-compose';
160
+ generation: number;
161
+ } | {
162
+ type: 'capture-telemetry';
163
+ name: string;
164
+ props: Record<string, unknown>;
165
+ } | {
166
+ type: 'warn';
167
+ code: string;
168
+ props: Record<string, unknown>;
169
+ } | {
170
+ type: 'cleanup';
171
+ };
172
+ export interface PdpTransition {
173
+ state: PdpState;
174
+ effects: PdpEffect[];
175
+ }
176
+ export interface PdpSlotView {
177
+ task: PdpPlanTask;
178
+ status: PdpSlotStatus;
179
+ visible: boolean;
180
+ showLoading: boolean;
181
+ reasoning: PdpSlotReasoning | null;
182
+ }
183
+ export type PdpWhyBoxView = {
184
+ status: 'hidden';
185
+ destination: null;
186
+ } | {
187
+ status: 'loading';
188
+ destination: 'inline' | 'portal';
189
+ } | {
190
+ status: 'ready';
191
+ destination: 'inline' | 'portal';
192
+ explanation: PdpExplanation;
193
+ dossier: PdpExplainMetric[];
194
+ dossierOpen: boolean;
195
+ };
196
+ export type PdpTerminalView = {
197
+ status: 'none';
198
+ } | {
199
+ status: 'done';
200
+ } | {
201
+ status: 'error';
202
+ message: string;
203
+ };
204
+ export interface PdpView {
205
+ layout: 'skeleton' | 'content';
206
+ rootState: 'pending' | PdpStreamState['status'];
207
+ slots: PdpSlotView[];
208
+ whyBox: PdpWhyBoxView;
209
+ terminal: PdpTerminalView;
210
+ }
211
+ export declare function createInitialPdpState(generation?: number): PdpState;
212
+ export declare function selectPdpView(state: PdpState): PdpView;
213
+ export declare function transitionPdp(state: PdpState, event: PdpEvent): PdpTransition;
214
+ //# sourceMappingURL=pdp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdp.d.ts","sourceRoot":"","sources":["../../src/decision/pdp.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,cAAc,CAAC;AAEzD,MAAM,MAAM,kBAAkB,GAC1B;IAAE,MAAM,EAAE,iBAAiB,CAAA;CAAE,GAC7B;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,GACzB;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEzB,MAAM,MAAM,cAAc,GACtB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,WAAW,CAAA;CAA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OAAO,CAAC;IAChB,WAAW,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC,WAAW,EAAE,cAAc,CAAC;IAC5B,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEN,MAAM,MAAM,eAAe,GACvB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B,SAAS,EAAE,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAChD,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,wBAAgB,qBAAqB,CAAC,UAAU,SAAI,GAAG,QAAQ,CAc9D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAiDtD;AAwFD,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,GAAG,aAAa,CAyH7E"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Native slot swap — the design-agnostic content-swap engine (FEAT-1784346204).
3
+ *
4
+ * A host page renders its OWN FAQ/review sections and marks them with the
5
+ * data-attribute contract below. Personalization never re-renders the design:
6
+ * we clone one of the host's existing items as the template, fill its
7
+ * `[data-syntro-field]` text nodes, and replace the item set. The swapped
8
+ * section is literally the host's DOM shape. `restore()` reattaches the
9
+ * ORIGINAL nodes (same references — a React host may hold refs to them).
10
+ */
11
+ export declare const NATIVE_SLOT_ATTR = "data-syntro-slot";
12
+ export declare const NATIVE_ITEM_ATTR = "data-syntro-item";
13
+ export declare const NATIVE_FIELD_ATTR = "data-syntro-field";
14
+ /** Same string as adaptive-reviews' PRODUCT_ID_ATTRIBUTE — kept as an
15
+ * independent constant so adaptive-product gains no cross-package dep. */
16
+ export declare const NATIVE_PRODUCT_ATTR = "data-syntro-product-id";
17
+ export type NativeSlotKind = 'qa' | 'peer-feed';
18
+ export type NativeItemFields = Record<string, string>;
19
+ export interface NativeSwapHandle {
20
+ container: HTMLElement;
21
+ restore(): void;
22
+ }
23
+ export declare function findNativeSlot(root: ParentNode, kind: NativeSlotKind): HTMLElement | null;
24
+ export declare function nativeProductId(container: HTMLElement): string | null;
25
+ /**
26
+ * PDP slot id → native-section kind. Only these two slots have a native (host
27
+ * server-rendered) counterpart; every other slot renders as usual. Shared by
28
+ * `SyntroPdpLit` (page-owning element) and `nativeSlotWatcher` (SPA modal).
29
+ */
30
+ export declare const NATIVE_KIND_BY_SLOT: Record<string, NativeSlotKind>;
31
+ /**
32
+ * Map a mounted instance's `content` payload to the flat `[field → text]` items
33
+ * the native swap engine fills. qa → {question, answer}; peer-feed maps the
34
+ * review shape onto the host's field names (quote→text, persona→reviewer,
35
+ * time_ago→meta). Malformed/absent lists degrade to an empty item set (the swap
36
+ * engine then no-ops and leaves the host defaults).
37
+ */
38
+ export declare function nativeFieldsFromContent(kind: NativeSlotKind, content: Record<string, unknown>): NativeItemFields[];
39
+ export declare function swapNativeSlot(container: HTMLElement, items: NativeItemFields[]): NativeSwapHandle | null;
40
+ //# sourceMappingURL=nativeSlotSwap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nativeSlotSwap.d.ts","sourceRoot":"","sources":["../../src/native/nativeSlotSwap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD;0EAC0E;AAC1E,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,WAAW,CAAC;AAChD,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,WAAW,CAAC;IACvB,OAAO,IAAI,IAAI,CAAC;CACjB;AAKD,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,GAAG,WAAW,GAAG,IAAI,CAEzF;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAKrE;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAG9D,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,gBAAgB,EAAE,CAkBpB;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,gBAAgB,EAAE,GACxB,gBAAgB,GAAG,IAAI,CAsCzB"}