@rebuy/rebuy 3.66.0 → 3.67.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.
@@ -115,7 +115,7 @@ export declare const CabUserConfig: z.ZodObject<{
115
115
  freeShippingReached: z.ZodOptional<z.ZodString>;
116
116
  freeShippingRemaining: z.ZodOptional<z.ZodString>;
117
117
  giftAreaTitle: z.ZodOptional<z.ZodString>;
118
- }, z.core.$loose>>>;
118
+ }, z.core.$loose>>, unknown>;
119
119
  name: z.ZodOptional<z.ZodString>;
120
120
  tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
121
121
  allProducts: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -149,10 +149,10 @@ export declare const CabUserConfig: z.ZodObject<{
149
149
  exclusionsEnabled: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
150
150
  filterOosVariants: z.ZodOptional<z.ZodBoolean>;
151
151
  id: z.ZodOptional<z.ZodString>;
152
- minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
152
+ minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>, unknown>;
153
153
  presentmentCurrencies: z.ZodPreprocess<z.ZodOptional<z.ZodObject<{
154
154
  enabled: z.ZodOptional<z.ZodBoolean>;
155
- }, z.core.$loose>>>;
155
+ }, z.core.$loose>>, unknown>;
156
156
  productAmountReachedLabel: z.ZodOptional<z.ZodBoolean>;
157
157
  productAmountReachedLabelText: z.ZodOptional<z.ZodString>;
158
158
  productAmountRemainingLabel: z.ZodOptional<z.ZodBoolean>;
@@ -170,9 +170,9 @@ export declare const CabUserConfig: z.ZodObject<{
170
170
  unlockConditionType: z.ZodOptional<z.ZodString>;
171
171
  }, z.core.$loose>>>;
172
172
  }, z.core.$loose>>>;
173
- }, z.core.$loose>>>>;
173
+ }, z.core.$loose>>, unknown>>;
174
174
  type: z.ZodOptional<z.ZodString>;
175
175
  }, z.core.$loose>>>;
176
- }, z.core.$loose>>>>>;
176
+ }, z.core.$loose>>>, unknown>>;
177
177
  }, z.core.$strip>;
178
178
  export type CabUserConfig = z.infer<typeof CabUserConfig>;
@@ -7,6 +7,7 @@ export * from './postPurchaseAdmission';
7
7
  export * from './postPurchaseAnalytics';
8
8
  export * from './postPurchaseChoice';
9
9
  export * from './postPurchaseClassification';
10
+ export * from './postPurchaseDecisionTrace';
10
11
  export * from './postPurchaseDecline';
11
12
  export * from './postPurchaseDeclineDelivery';
12
13
  export * from './postPurchaseDiscount';
@@ -0,0 +1,90 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Where a live Decision spent its time, in whole ms. `decisionMs` is the Decider's own time, from the request's
4
+ * verified input to the Decision the response carries. The prelude reads exist only once eligibility allowed a
5
+ * Decision, and each read's ms only once that read settled: a `prelude-timeout` row carries `preludeMs` with
6
+ * neither read, or only the one that finished in budget. Per-Flow evaluation ms ride on each Flow's outcome.
7
+ */
8
+ export declare const PostPurchaseDecisionTimingSchema: z.ZodObject<{
9
+ activeFlowsMs: z.ZodOptional<z.ZodNumber>;
10
+ decisionMs: z.ZodNumber;
11
+ preludeMs: z.ZodOptional<z.ZodNumber>;
12
+ targetingMs: z.ZodOptional<z.ZodNumber>;
13
+ }, z.core.$strip>;
14
+ export type PostPurchaseDecisionTiming = z.infer<typeof PostPurchaseDecisionTimingSchema>;
15
+ /**
16
+ * The `decision.trace` ledger row's payload (REB-25426): rebuy-api's live `/decide` Decision with its completed
17
+ * per-Flow evidence, written server-side after the response. Ids, outcomes and ms only: never customer data,
18
+ * tokens or product payloads. Logging only; nothing reads it back into a Decision.
19
+ */
20
+ export declare const PostPurchaseDecisionTraceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
21
+ entry: z.ZodObject<{
22
+ blockId: z.ZodNumber;
23
+ blockIndex: z.ZodString;
24
+ blockParentIndex: z.ZodString;
25
+ flowId: z.ZodNumber;
26
+ sectionId: z.ZodNumber;
27
+ widgetId: z.ZodNumber;
28
+ widgetTraffic: z.ZodNumber;
29
+ }, z.core.$strip>;
30
+ verdict: z.ZodLiteral<"render">;
31
+ flowCount: z.ZodNumber;
32
+ sampleRate: z.ZodNumber;
33
+ serverFlowOutcomes: z.ZodArray<z.ZodObject<{
34
+ flowId: z.ZodNumber;
35
+ incomplete: z.ZodOptional<z.ZodLiteral<true>>;
36
+ ms: z.ZodOptional<z.ZodNumber>;
37
+ outcome: z.ZodEnum<{
38
+ empty: "empty";
39
+ unsupported: "unsupported";
40
+ eligible: "eligible";
41
+ failed: "failed";
42
+ }>;
43
+ unpreparableCause: z.ZodOptional<z.ZodEnum<{
44
+ offer: "offer";
45
+ contract: "contract";
46
+ members: "members";
47
+ }>>;
48
+ }, z.core.$strip>>;
49
+ timing: z.ZodObject<{
50
+ activeFlowsMs: z.ZodOptional<z.ZodNumber>;
51
+ decisionMs: z.ZodNumber;
52
+ preludeMs: z.ZodOptional<z.ZodNumber>;
53
+ targetingMs: z.ZodOptional<z.ZodNumber>;
54
+ }, z.core.$strip>;
55
+ }, z.core.$strip>, z.ZodObject<{
56
+ serverSkipReason: z.ZodEnum<{
57
+ "destination-missing": "destination-missing";
58
+ "merchant-destination": "merchant-destination";
59
+ "merchant-time": "merchant-time";
60
+ "no-active-flows": "no-active-flows";
61
+ "no-eligible-flow": "no-eligible-flow";
62
+ "prelude-timeout": "prelude-timeout";
63
+ }>;
64
+ verdict: z.ZodLiteral<"skip">;
65
+ flowCount: z.ZodNumber;
66
+ sampleRate: z.ZodNumber;
67
+ serverFlowOutcomes: z.ZodArray<z.ZodObject<{
68
+ flowId: z.ZodNumber;
69
+ incomplete: z.ZodOptional<z.ZodLiteral<true>>;
70
+ ms: z.ZodOptional<z.ZodNumber>;
71
+ outcome: z.ZodEnum<{
72
+ empty: "empty";
73
+ unsupported: "unsupported";
74
+ eligible: "eligible";
75
+ failed: "failed";
76
+ }>;
77
+ unpreparableCause: z.ZodOptional<z.ZodEnum<{
78
+ offer: "offer";
79
+ contract: "contract";
80
+ members: "members";
81
+ }>>;
82
+ }, z.core.$strip>>;
83
+ timing: z.ZodObject<{
84
+ activeFlowsMs: z.ZodOptional<z.ZodNumber>;
85
+ decisionMs: z.ZodNumber;
86
+ preludeMs: z.ZodOptional<z.ZodNumber>;
87
+ targetingMs: z.ZodOptional<z.ZodNumber>;
88
+ }, z.core.$strip>;
89
+ }, z.core.$strip>], "verdict">;
90
+ export type PostPurchaseDecisionTrace = z.infer<typeof PostPurchaseDecisionTraceSchema>;
@@ -34,17 +34,29 @@ export type PostPurchaseShadowSkipReason = z.infer<typeof PostPurchaseShadowSkip
34
34
  * Each evaluated Flow's outcome from the Decider's completed trace, in evaluation order. Capped at
35
35
  * `POST_PURCHASE_SKIP_LIMIT` like the skip trace, since a shop can have more Flows than a ledger row should carry.
36
36
  * The cap rejects rather than clips, so a sender slices to the limit before parsing. A shadow sample holds at most
37
- * rebuy-api's `SHADOW_MAX_FLOWS` (10) Flows, so the list is complete there; carry a truncation marker before
38
- * anything reports more Flows than the cap.
37
+ * rebuy-api's `SHADOW_MAX_FLOWS` (10) Flows, so the list is complete there; the live `decision.trace` row
38
+ * (REB-25426) shares this shape and carries `flowCount`, its truncation marker, beside it.
39
+ *
40
+ * The REB-25426 fields are optional so a row from a sender without them stays valid: `ms` is the Flow's entry
41
+ * evaluation time, `incomplete` an `empty` the ranking worker answered 503 for (not a verified empty), and
42
+ * `unpreparableCause` an `empty` whose products Render's preparation could not show (`contract`, `members` or
43
+ * `offer`; rebuy-api's `DecisionTraceSchema` names each).
39
44
  */
40
45
  export declare const PostPurchaseShadowFlowOutcomesSchema: z.ZodArray<z.ZodObject<{
41
46
  flowId: z.ZodNumber;
47
+ incomplete: z.ZodOptional<z.ZodLiteral<true>>;
48
+ ms: z.ZodOptional<z.ZodNumber>;
42
49
  outcome: z.ZodEnum<{
43
50
  empty: "empty";
44
51
  unsupported: "unsupported";
45
- failed: "failed";
46
52
  eligible: "eligible";
53
+ failed: "failed";
47
54
  }>;
55
+ unpreparableCause: z.ZodOptional<z.ZodEnum<{
56
+ offer: "offer";
57
+ contract: "contract";
58
+ members: "members";
59
+ }>>;
48
60
  }, z.core.$strip>>;
49
61
  export type PostPurchaseShadowFlowOutcomes = z.infer<typeof PostPurchaseShadowFlowOutcomesSchema>;
50
62
  /**
@@ -82,12 +94,19 @@ export declare const PostPurchaseShadowReportFields: z.ZodObject<{
82
94
  sampleId: z.ZodString;
83
95
  serverFlowOutcomes: z.ZodOptional<z.ZodArray<z.ZodObject<{
84
96
  flowId: z.ZodNumber;
97
+ incomplete: z.ZodOptional<z.ZodLiteral<true>>;
98
+ ms: z.ZodOptional<z.ZodNumber>;
85
99
  outcome: z.ZodEnum<{
86
100
  empty: "empty";
87
101
  unsupported: "unsupported";
88
- failed: "failed";
89
102
  eligible: "eligible";
103
+ failed: "failed";
90
104
  }>;
105
+ unpreparableCause: z.ZodOptional<z.ZodEnum<{
106
+ offer: "offer";
107
+ contract: "contract";
108
+ members: "members";
109
+ }>>;
91
110
  }, z.core.$strip>>>;
92
111
  serverSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
93
112
  entry: z.ZodObject<{
@@ -113,8 +132,8 @@ export declare const PostPurchaseShadowReportFields: z.ZodObject<{
113
132
  }>>;
114
133
  status: z.ZodEnum<{
115
134
  match: "match";
116
- diverged: "diverged";
117
135
  incomplete: "incomplete";
136
+ diverged: "diverged";
118
137
  }>;
119
138
  targetingFlowIds: z.ZodArray<z.ZodNumber>;
120
139
  workflowPhase: z.ZodLiteral<"decide">;
@@ -150,12 +169,19 @@ export declare const PostPurchaseShadowReportSchema: z.ZodObject<{
150
169
  sampleId: z.ZodString;
151
170
  serverFlowOutcomes: z.ZodOptional<z.ZodArray<z.ZodObject<{
152
171
  flowId: z.ZodNumber;
172
+ incomplete: z.ZodOptional<z.ZodLiteral<true>>;
173
+ ms: z.ZodOptional<z.ZodNumber>;
153
174
  outcome: z.ZodEnum<{
154
175
  empty: "empty";
155
176
  unsupported: "unsupported";
156
- failed: "failed";
157
177
  eligible: "eligible";
178
+ failed: "failed";
158
179
  }>;
180
+ unpreparableCause: z.ZodOptional<z.ZodEnum<{
181
+ offer: "offer";
182
+ contract: "contract";
183
+ members: "members";
184
+ }>>;
159
185
  }, z.core.$strip>>>;
160
186
  serverSelection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
161
187
  entry: z.ZodObject<{
@@ -181,8 +207,8 @@ export declare const PostPurchaseShadowReportSchema: z.ZodObject<{
181
207
  }>>;
182
208
  status: z.ZodEnum<{
183
209
  match: "match";
184
- diverged: "diverged";
185
210
  incomplete: "incomplete";
211
+ diverged: "diverged";
186
212
  }>;
187
213
  targetingFlowIds: z.ZodArray<z.ZodNumber>;
188
214
  workflowPhase: z.ZodLiteral<"decide">;
@@ -74,10 +74,10 @@ export declare const SmartCartTier: z.ZodObject<{
74
74
  exclusionsEnabled: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
75
75
  filterOosVariants: z.ZodOptional<z.ZodBoolean>;
76
76
  id: z.ZodOptional<z.ZodString>;
77
- minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
77
+ minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>, unknown>;
78
78
  presentmentCurrencies: z.ZodPreprocess<z.ZodOptional<z.ZodObject<{
79
79
  enabled: z.ZodOptional<z.ZodBoolean>;
80
- }, z.core.$loose>>>;
80
+ }, z.core.$loose>>, unknown>;
81
81
  productAmountReachedLabel: z.ZodOptional<z.ZodBoolean>;
82
82
  productAmountReachedLabelText: z.ZodOptional<z.ZodString>;
83
83
  productAmountRemainingLabel: z.ZodOptional<z.ZodBoolean>;
@@ -112,7 +112,7 @@ export declare const SmartCartBar: z.ZodObject<{
112
112
  freeShippingReached: z.ZodOptional<z.ZodString>;
113
113
  freeShippingRemaining: z.ZodOptional<z.ZodString>;
114
114
  giftAreaTitle: z.ZodOptional<z.ZodString>;
115
- }, z.core.$loose>>>;
115
+ }, z.core.$loose>>, unknown>;
116
116
  name: z.ZodOptional<z.ZodString>;
117
117
  tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
118
118
  allProducts: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -146,10 +146,10 @@ export declare const SmartCartBar: z.ZodObject<{
146
146
  exclusionsEnabled: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
147
147
  filterOosVariants: z.ZodOptional<z.ZodBoolean>;
148
148
  id: z.ZodOptional<z.ZodString>;
149
- minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
149
+ minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>, unknown>;
150
150
  presentmentCurrencies: z.ZodPreprocess<z.ZodOptional<z.ZodObject<{
151
151
  enabled: z.ZodOptional<z.ZodBoolean>;
152
- }, z.core.$loose>>>;
152
+ }, z.core.$loose>>, unknown>;
153
153
  productAmountReachedLabel: z.ZodOptional<z.ZodBoolean>;
154
154
  productAmountReachedLabelText: z.ZodOptional<z.ZodString>;
155
155
  productAmountRemainingLabel: z.ZodOptional<z.ZodBoolean>;
@@ -183,7 +183,7 @@ export declare const SmartCartComponent: z.ZodObject<{
183
183
  freeShippingReached: z.ZodOptional<z.ZodString>;
184
184
  freeShippingRemaining: z.ZodOptional<z.ZodString>;
185
185
  giftAreaTitle: z.ZodOptional<z.ZodString>;
186
- }, z.core.$loose>>>;
186
+ }, z.core.$loose>>, unknown>;
187
187
  name: z.ZodOptional<z.ZodString>;
188
188
  tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
189
189
  allProducts: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -217,10 +217,10 @@ export declare const SmartCartComponent: z.ZodObject<{
217
217
  exclusionsEnabled: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
218
218
  filterOosVariants: z.ZodOptional<z.ZodBoolean>;
219
219
  id: z.ZodOptional<z.ZodString>;
220
- minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
220
+ minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>, unknown>;
221
221
  presentmentCurrencies: z.ZodPreprocess<z.ZodOptional<z.ZodObject<{
222
222
  enabled: z.ZodOptional<z.ZodBoolean>;
223
- }, z.core.$loose>>>;
223
+ }, z.core.$loose>>, unknown>;
224
224
  productAmountReachedLabel: z.ZodOptional<z.ZodBoolean>;
225
225
  productAmountReachedLabelText: z.ZodOptional<z.ZodString>;
226
226
  productAmountRemainingLabel: z.ZodOptional<z.ZodBoolean>;
@@ -238,7 +238,7 @@ export declare const SmartCartComponent: z.ZodObject<{
238
238
  unlockConditionType: z.ZodOptional<z.ZodString>;
239
239
  }, z.core.$loose>>>;
240
240
  }, z.core.$loose>>>;
241
- }, z.core.$loose>>>>;
241
+ }, z.core.$loose>>, unknown>>;
242
242
  type: z.ZodOptional<z.ZodString>;
243
243
  }, z.core.$loose>;
244
244
  /**
@@ -265,7 +265,7 @@ export declare const SmartCartConfig: z.ZodObject<{
265
265
  freeShippingReached: z.ZodOptional<z.ZodString>;
266
266
  freeShippingRemaining: z.ZodOptional<z.ZodString>;
267
267
  giftAreaTitle: z.ZodOptional<z.ZodString>;
268
- }, z.core.$loose>>>;
268
+ }, z.core.$loose>>, unknown>;
269
269
  name: z.ZodOptional<z.ZodString>;
270
270
  tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
271
271
  allProducts: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -299,10 +299,10 @@ export declare const SmartCartConfig: z.ZodObject<{
299
299
  exclusionsEnabled: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
300
300
  filterOosVariants: z.ZodOptional<z.ZodBoolean>;
301
301
  id: z.ZodOptional<z.ZodString>;
302
- minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
302
+ minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>, unknown>;
303
303
  presentmentCurrencies: z.ZodPreprocess<z.ZodOptional<z.ZodObject<{
304
304
  enabled: z.ZodOptional<z.ZodBoolean>;
305
- }, z.core.$loose>>>;
305
+ }, z.core.$loose>>, unknown>;
306
306
  productAmountReachedLabel: z.ZodOptional<z.ZodBoolean>;
307
307
  productAmountReachedLabelText: z.ZodOptional<z.ZodString>;
308
308
  productAmountRemainingLabel: z.ZodOptional<z.ZodBoolean>;
@@ -320,7 +320,7 @@ export declare const SmartCartConfig: z.ZodObject<{
320
320
  unlockConditionType: z.ZodOptional<z.ZodString>;
321
321
  }, z.core.$loose>>>;
322
322
  }, z.core.$loose>>>;
323
- }, z.core.$loose>>>>;
323
+ }, z.core.$loose>>, unknown>>;
324
324
  type: z.ZodOptional<z.ZodString>;
325
325
  }, z.core.$loose>>>;
326
326
  }, z.core.$loose>;
@@ -347,7 +347,7 @@ export declare const EngineSmartCart: z.ZodPreprocess<z.ZodOptional<z.ZodNullabl
347
347
  freeShippingReached: z.ZodOptional<z.ZodString>;
348
348
  freeShippingRemaining: z.ZodOptional<z.ZodString>;
349
349
  giftAreaTitle: z.ZodOptional<z.ZodString>;
350
- }, z.core.$loose>>>;
350
+ }, z.core.$loose>>, unknown>;
351
351
  name: z.ZodOptional<z.ZodString>;
352
352
  tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
353
353
  allProducts: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -381,10 +381,10 @@ export declare const EngineSmartCart: z.ZodPreprocess<z.ZodOptional<z.ZodNullabl
381
381
  exclusionsEnabled: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
382
382
  filterOosVariants: z.ZodOptional<z.ZodBoolean>;
383
383
  id: z.ZodOptional<z.ZodString>;
384
- minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
384
+ minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>, unknown>;
385
385
  presentmentCurrencies: z.ZodPreprocess<z.ZodOptional<z.ZodObject<{
386
386
  enabled: z.ZodOptional<z.ZodBoolean>;
387
- }, z.core.$loose>>>;
387
+ }, z.core.$loose>>, unknown>;
388
388
  productAmountReachedLabel: z.ZodOptional<z.ZodBoolean>;
389
389
  productAmountReachedLabelText: z.ZodOptional<z.ZodString>;
390
390
  productAmountRemainingLabel: z.ZodOptional<z.ZodBoolean>;
@@ -402,10 +402,10 @@ export declare const EngineSmartCart: z.ZodPreprocess<z.ZodOptional<z.ZodNullabl
402
402
  unlockConditionType: z.ZodOptional<z.ZodString>;
403
403
  }, z.core.$loose>>>;
404
404
  }, z.core.$loose>>>;
405
- }, z.core.$loose>>>>;
405
+ }, z.core.$loose>>, unknown>>;
406
406
  type: z.ZodOptional<z.ZodString>;
407
407
  }, z.core.$loose>>>;
408
- }, z.core.$loose>>>>;
408
+ }, z.core.$loose>>>, unknown>;
409
409
  export type SmartCartBar = z.infer<typeof SmartCartBar>;
410
410
  export type SmartCartConfig = z.infer<typeof SmartCartConfig>;
411
411
  export type SmartCartTier = z.infer<typeof SmartCartTier>;
@@ -94,7 +94,7 @@ export declare const UserConfig: z.ZodObject<{
94
94
  freeShippingReached: z.ZodOptional<z.ZodString>;
95
95
  freeShippingRemaining: z.ZodOptional<z.ZodString>;
96
96
  giftAreaTitle: z.ZodOptional<z.ZodString>;
97
- }, z.core.$loose>>>;
97
+ }, z.core.$loose>>, unknown>;
98
98
  name: z.ZodOptional<z.ZodString>;
99
99
  tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
100
100
  allProducts: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -128,10 +128,10 @@ export declare const UserConfig: z.ZodObject<{
128
128
  exclusionsEnabled: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
129
129
  filterOosVariants: z.ZodOptional<z.ZodBoolean>;
130
130
  id: z.ZodOptional<z.ZodString>;
131
- minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
131
+ minimum: z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>, unknown>;
132
132
  presentmentCurrencies: z.ZodPreprocess<z.ZodOptional<z.ZodObject<{
133
133
  enabled: z.ZodOptional<z.ZodBoolean>;
134
- }, z.core.$loose>>>;
134
+ }, z.core.$loose>>, unknown>;
135
135
  productAmountReachedLabel: z.ZodOptional<z.ZodBoolean>;
136
136
  productAmountReachedLabelText: z.ZodOptional<z.ZodString>;
137
137
  productAmountRemainingLabel: z.ZodOptional<z.ZodBoolean>;
@@ -149,10 +149,10 @@ export declare const UserConfig: z.ZodObject<{
149
149
  unlockConditionType: z.ZodOptional<z.ZodString>;
150
150
  }, z.core.$loose>>>;
151
151
  }, z.core.$loose>>>;
152
- }, z.core.$loose>>>>;
152
+ }, z.core.$loose>>, unknown>>;
153
153
  type: z.ZodOptional<z.ZodString>;
154
154
  }, z.core.$loose>>>;
155
- }, z.core.$loose>>>>>;
155
+ }, z.core.$loose>>>, unknown>>;
156
156
  smartFlows: z.ZodArray<z.ZodUnknown>;
157
157
  }, z.core.$strip>;
158
158
  export type UserConfig = z.infer<typeof UserConfig>;
@@ -5335,7 +5335,14 @@ var MAX_ICON_SIZE_PX = 64;
5335
5335
  var IN_SCOPE_TIER_TYPES = new Set(progressTierTypes);
5336
5336
  var inScope = (tier) => IN_SCOPE_TIER_TYPES.has(tier.type ?? "");
5337
5337
  var thresholdOf = (tier) => tier.unlockConditionType === "item_quantity" ? Math.ceil(Number(tier.minimum)) : Math.round(Number(tier.minimum) * 100);
5338
- var tierThresholds = (tier) => presentmentThresholds(tier.presentmentCurrencies);
5338
+ var tierThresholds = (tier, shopCurrency) => {
5339
+ const shopCode = shopCurrency?.toLowerCase();
5340
+ return Object.fromEntries(
5341
+ Object.entries(presentmentThresholds(tier.presentmentCurrencies)).filter(
5342
+ ([code, cents]) => cents > 0 && code !== shopCode
5343
+ )
5344
+ );
5345
+ };
5339
5346
  var tierLabel = (tier) => {
5340
5347
  const type = tier.type;
5341
5348
  if ((tier.customTierLabel || type === "decorative") && tier.customTierLabelText) return tier.customTierLabelText;
@@ -5389,7 +5396,7 @@ var exclusionsOf = (tier) => {
5389
5396
  });
5390
5397
  return rules.length > 0 ? rules : void 0;
5391
5398
  };
5392
- var toTierMeta = (tier) => {
5399
+ var toTierMeta = (tier, shopCurrency) => {
5393
5400
  const discount = discountOf(tier);
5394
5401
  const exclusions = exclusionsOf(tier);
5395
5402
  const gift = giftOf(tier);
@@ -5410,16 +5417,16 @@ var toTierMeta = (tier) => {
5410
5417
  /** Carry the image-swap flag only on gift tiers that set it — the client shows the gift's product image in the step slot instead of the bag icon. */
5411
5418
  ...gift && tier.productTierImage && { productTierImage: true },
5412
5419
  threshold: thresholdOf(tier),
5413
- thresholds: !isItemCount && type === "shipping" ? tierThresholds(tier) : {},
5420
+ thresholds: isItemCount ? {} : tierThresholds(tier, shopCurrency),
5414
5421
  ...tier.id && { tierId: tier.id },
5415
5422
  tierType: type,
5416
5423
  ...isItemCount && { unit: "item" }
5417
5424
  };
5418
5425
  };
5419
- var renderableTiers = (bar) => (bar.tiers ?? []).filter(
5426
+ var renderableTiers = (bar, shopCurrency) => (bar.tiers ?? []).filter(
5420
5427
  (tier) => (
5421
5428
  /** onsite `isTierDataValid`: a non-numeric (null/absent) minimum is dropped — else `thresholdOf` reads it as 0, an always-reached tier that auto-adds its gift to every cart. A literal 0 is finite and kept. Divergence: onsite's strict `typeof === 'number'` also drops a string `'50'`; here `minimum` was already `z.coerce`d (`'50' → 50`), so `Number.isFinite` keeps it — see smartCart.ts. */
5422
- inScope(tier) && Number.isFinite(tier.minimum) && CABProgressTier.safeParse(toTierMeta(tier)).success
5429
+ inScope(tier) && Number.isFinite(tier.minimum) && CABProgressTier.safeParse(toTierMeta(tier, shopCurrency)).success
5423
5430
  )
5424
5431
  );
5425
5432
  var PRODUCT_TOKENS = ["productTitle", "remainingAmount"];
@@ -5474,7 +5481,7 @@ var toTierFeedback = (tier) => {
5474
5481
  });
5475
5482
  return sections;
5476
5483
  };
5477
- var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progressColor) => ({
5484
+ var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progressColor, shopCurrency) => ({
5478
5485
  /**
5479
5486
  * React's `SmartCartProgressBarContent` centers the bar/message stack (`inlineAlignment="center"`); the
5480
5487
  * section inherits `layout`'s `alignment.horizontal: 'start'`, so an emitted-bare bar would left-align.
@@ -5530,7 +5537,7 @@ var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progr
5530
5537
  sectionType: "progressBar",
5531
5538
  /** React's bar/message stack uses `spacing="tight"` (→ `small-100`); `layout` defaults `spacing` to `base`, a wider gap. Emit `tight` for parity (mirrors the v1 shipping converter). */
5532
5539
  spacing: "tight",
5533
- tiers: tiers.map(toTierMeta)
5540
+ tiers: tiers.map((tier) => toTierMeta(tier, shopCurrency))
5534
5541
  });
5535
5542
  var barCountries = (bar) => [
5536
5543
  ...new Set((bar.countryCodes ?? []).map((code) => code.trim().toUpperCase()).filter(Boolean))
@@ -5556,9 +5563,16 @@ var dedupeBars = (entries) => {
5556
5563
  return rendered;
5557
5564
  };
5558
5565
  var convertSmartCartProgressBarToV2 = (input) => {
5559
- const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar) }));
5566
+ const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar, input.shopCurrency) }));
5560
5567
  const sections = dedupeBars(entries).map(
5561
- ({ countryCodes, entry, excludeCountryCodes }) => toProgressBarSection(entry.bar, entry.tiers, countryCodes, excludeCountryCodes, input.progressColor)
5568
+ ({ countryCodes, entry, excludeCountryCodes }) => toProgressBarSection(
5569
+ entry.bar,
5570
+ entry.tiers,
5571
+ countryCodes,
5572
+ excludeCountryCodes,
5573
+ input.progressColor,
5574
+ input.shopCurrency
5575
+ )
5562
5576
  );
5563
5577
  return CABRootSection.parse(
5564
5578
  normalizeTextContent({
@@ -6198,7 +6212,9 @@ var fetchProgressBarContext = async (shop, ctx, prefetched) => {
6198
6212
  const entitled = config.shop.billingVersion !== "v6" || config.shop.activePackages.some((pkg) => pkg.shortName === "cart-merchandising" && pkg.isActive);
6199
6213
  return {
6200
6214
  bars: entitled ? extractSmartCartBars(config.smartCart) : [],
6201
- progressColor: await fetchThemeColor(config.shop.shopId, ctx)
6215
+ progressColor: await fetchThemeColor(config.shop.shopId, ctx),
6216
+ /** The tiers' per-currency thresholds skip the shop's own code (onsite `getStoredPresentmentMinimum`). */
6217
+ shopCurrency: config.shop.currency
6202
6218
  };
6203
6219
  };
6204
6220
  var fetchThemeColor = async (shopId, ctx) => {
@@ -6280,8 +6296,14 @@ var fetchAndConvert = async (id, input, ctx, config) => {
6280
6296
  if (isMissingUpstreamPayload(data)) throw new NotFoundError(`Widget not found: ${id}`);
6281
6297
  const normalized = convertNumericObjects(deepCamelCase(data));
6282
6298
  if (isProgressBarV1(normalized) && normalized.barSettings.barType === "smart-cart") {
6283
- const { bars, progressColor } = await fetchProgressBarContext(input.shop, ctx, config);
6284
- return convertSmartCartProgressBarToV2({ bars: bars ?? [], id, progressColor, settings: normalized });
6299
+ const { bars, progressColor, shopCurrency } = await fetchProgressBarContext(input.shop, ctx, config);
6300
+ return convertSmartCartProgressBarToV2({
6301
+ bars: bars ?? [],
6302
+ id,
6303
+ progressColor,
6304
+ settings: normalized,
6305
+ shopCurrency
6306
+ });
6285
6307
  }
6286
6308
  if (isConvertibleProgressBarV1(normalized)) {
6287
6309
  const { progressColor } = await fetchProgressBarContext(input.shop, ctx, config);
@@ -5262,7 +5262,14 @@ var MAX_ICON_SIZE_PX = 64;
5262
5262
  var IN_SCOPE_TIER_TYPES = new Set(progressTierTypes);
5263
5263
  var inScope = (tier) => IN_SCOPE_TIER_TYPES.has(tier.type ?? "");
5264
5264
  var thresholdOf = (tier) => tier.unlockConditionType === "item_quantity" ? Math.ceil(Number(tier.minimum)) : Math.round(Number(tier.minimum) * 100);
5265
- var tierThresholds = (tier) => presentmentThresholds(tier.presentmentCurrencies);
5265
+ var tierThresholds = (tier, shopCurrency) => {
5266
+ const shopCode = shopCurrency?.toLowerCase();
5267
+ return Object.fromEntries(
5268
+ Object.entries(presentmentThresholds(tier.presentmentCurrencies)).filter(
5269
+ ([code, cents]) => cents > 0 && code !== shopCode
5270
+ )
5271
+ );
5272
+ };
5266
5273
  var tierLabel = (tier) => {
5267
5274
  const type = tier.type;
5268
5275
  if ((tier.customTierLabel || type === "decorative") && tier.customTierLabelText) return tier.customTierLabelText;
@@ -5316,7 +5323,7 @@ var exclusionsOf = (tier) => {
5316
5323
  });
5317
5324
  return rules.length > 0 ? rules : void 0;
5318
5325
  };
5319
- var toTierMeta = (tier) => {
5326
+ var toTierMeta = (tier, shopCurrency) => {
5320
5327
  const discount = discountOf(tier);
5321
5328
  const exclusions = exclusionsOf(tier);
5322
5329
  const gift = giftOf(tier);
@@ -5337,16 +5344,16 @@ var toTierMeta = (tier) => {
5337
5344
  /** Carry the image-swap flag only on gift tiers that set it — the client shows the gift's product image in the step slot instead of the bag icon. */
5338
5345
  ...gift && tier.productTierImage && { productTierImage: true },
5339
5346
  threshold: thresholdOf(tier),
5340
- thresholds: !isItemCount && type === "shipping" ? tierThresholds(tier) : {},
5347
+ thresholds: isItemCount ? {} : tierThresholds(tier, shopCurrency),
5341
5348
  ...tier.id && { tierId: tier.id },
5342
5349
  tierType: type,
5343
5350
  ...isItemCount && { unit: "item" }
5344
5351
  };
5345
5352
  };
5346
- var renderableTiers = (bar) => (bar.tiers ?? []).filter(
5353
+ var renderableTiers = (bar, shopCurrency) => (bar.tiers ?? []).filter(
5347
5354
  (tier) => (
5348
5355
  /** onsite `isTierDataValid`: a non-numeric (null/absent) minimum is dropped — else `thresholdOf` reads it as 0, an always-reached tier that auto-adds its gift to every cart. A literal 0 is finite and kept. Divergence: onsite's strict `typeof === 'number'` also drops a string `'50'`; here `minimum` was already `z.coerce`d (`'50' → 50`), so `Number.isFinite` keeps it — see smartCart.ts. */
5349
- inScope(tier) && Number.isFinite(tier.minimum) && CABProgressTier.safeParse(toTierMeta(tier)).success
5356
+ inScope(tier) && Number.isFinite(tier.minimum) && CABProgressTier.safeParse(toTierMeta(tier, shopCurrency)).success
5350
5357
  )
5351
5358
  );
5352
5359
  var PRODUCT_TOKENS = ["productTitle", "remainingAmount"];
@@ -5401,7 +5408,7 @@ var toTierFeedback = (tier) => {
5401
5408
  });
5402
5409
  return sections;
5403
5410
  };
5404
- var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progressColor) => ({
5411
+ var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progressColor, shopCurrency) => ({
5405
5412
  /**
5406
5413
  * React's `SmartCartProgressBarContent` centers the bar/message stack (`inlineAlignment="center"`); the
5407
5414
  * section inherits `layout`'s `alignment.horizontal: 'start'`, so an emitted-bare bar would left-align.
@@ -5457,7 +5464,7 @@ var toProgressBarSection = (bar, tiers, countryCodes, excludeCountryCodes, progr
5457
5464
  sectionType: "progressBar",
5458
5465
  /** React's bar/message stack uses `spacing="tight"` (→ `small-100`); `layout` defaults `spacing` to `base`, a wider gap. Emit `tight` for parity (mirrors the v1 shipping converter). */
5459
5466
  spacing: "tight",
5460
- tiers: tiers.map(toTierMeta)
5467
+ tiers: tiers.map((tier) => toTierMeta(tier, shopCurrency))
5461
5468
  });
5462
5469
  var barCountries = (bar) => [
5463
5470
  ...new Set((bar.countryCodes ?? []).map((code) => code.trim().toUpperCase()).filter(Boolean))
@@ -5483,9 +5490,16 @@ var dedupeBars = (entries) => {
5483
5490
  return rendered;
5484
5491
  };
5485
5492
  var convertSmartCartProgressBarToV2 = (input) => {
5486
- const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar) }));
5493
+ const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar, input.shopCurrency) }));
5487
5494
  const sections = dedupeBars(entries).map(
5488
- ({ countryCodes, entry, excludeCountryCodes }) => toProgressBarSection(entry.bar, entry.tiers, countryCodes, excludeCountryCodes, input.progressColor)
5495
+ ({ countryCodes, entry, excludeCountryCodes }) => toProgressBarSection(
5496
+ entry.bar,
5497
+ entry.tiers,
5498
+ countryCodes,
5499
+ excludeCountryCodes,
5500
+ input.progressColor,
5501
+ input.shopCurrency
5502
+ )
5489
5503
  );
5490
5504
  return CABRootSection.parse(
5491
5505
  normalizeTextContent({
@@ -6125,7 +6139,9 @@ var fetchProgressBarContext = async (shop, ctx, prefetched) => {
6125
6139
  const entitled = config.shop.billingVersion !== "v6" || config.shop.activePackages.some((pkg) => pkg.shortName === "cart-merchandising" && pkg.isActive);
6126
6140
  return {
6127
6141
  bars: entitled ? extractSmartCartBars(config.smartCart) : [],
6128
- progressColor: await fetchThemeColor(config.shop.shopId, ctx)
6142
+ progressColor: await fetchThemeColor(config.shop.shopId, ctx),
6143
+ /** The tiers' per-currency thresholds skip the shop's own code (onsite `getStoredPresentmentMinimum`). */
6144
+ shopCurrency: config.shop.currency
6129
6145
  };
6130
6146
  };
6131
6147
  var fetchThemeColor = async (shopId, ctx) => {
@@ -6207,8 +6223,14 @@ var fetchAndConvert = async (id, input, ctx, config) => {
6207
6223
  if (isMissingUpstreamPayload(data)) throw new NotFoundError(`Widget not found: ${id}`);
6208
6224
  const normalized = convertNumericObjects(deepCamelCase(data));
6209
6225
  if (isProgressBarV1(normalized) && normalized.barSettings.barType === "smart-cart") {
6210
- const { bars, progressColor } = await fetchProgressBarContext(input.shop, ctx, config);
6211
- return convertSmartCartProgressBarToV2({ bars: bars ?? [], id, progressColor, settings: normalized });
6226
+ const { bars, progressColor, shopCurrency } = await fetchProgressBarContext(input.shop, ctx, config);
6227
+ return convertSmartCartProgressBarToV2({
6228
+ bars: bars ?? [],
6229
+ id,
6230
+ progressColor,
6231
+ settings: normalized,
6232
+ shopCurrency
6233
+ });
6212
6234
  }
6213
6235
  if (isConvertibleProgressBarV1(normalized)) {
6214
6236
  const { progressColor } = await fetchProgressBarContext(input.shop, ctx, config);