@rebuy/rebuy 3.5.0 → 3.6.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/dist/index.cjs +740 -647
- package/dist/index.mjs +740 -647
- package/dist/schema/checkout-and-beyond/constants.cjs +16 -0
- package/dist/schema/checkout-and-beyond/constants.mjs +16 -0
- package/dist/schema/checkout-and-beyond/index.cjs +454 -362
- package/dist/schema/checkout-and-beyond/index.mjs +454 -362
- package/dist/schema/widget-data.cjs +508 -435
- package/dist/schema/widget-data.mjs +508 -435
- package/dist/schema/widgetData.d.ts +438 -147
- package/dist/schema/widgets/checkout-and-beyond/banner.d.ts +145 -48
- package/dist/schema/widgets/checkout-and-beyond/button.d.ts +154 -49
- package/dist/schema/widgets/checkout-and-beyond/carousel.d.ts +145 -48
- package/dist/schema/widgets/checkout-and-beyond/cartLine.d.ts +145 -48
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts +29 -0
- package/dist/schema/widgets/checkout-and-beyond/discount.d.ts +146 -0
- package/dist/schema/widgets/checkout-and-beyond/icons.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/image.d.ts +294 -100
- package/dist/schema/widgets/checkout-and-beyond/index.d.ts +1 -0
- package/dist/schema/widgets/checkout-and-beyond/layout.d.ts +148 -52
- package/dist/schema/widgets/checkout-and-beyond/monetize.d.ts +146 -49
- package/dist/schema/widgets/checkout-and-beyond/offers.d.ts +145 -48
- package/dist/schema/widgets/checkout-and-beyond/product.d.ts +146 -0
- package/dist/schema/widgets/checkout-and-beyond/products.d.ts +292 -0
- package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts +145 -48
- package/dist/schema/widgets/checkout-and-beyond/quantity.d.ts +146 -49
- package/dist/schema/widgets/checkout-and-beyond/reviews.d.ts +146 -49
- package/dist/schema/widgets/checkout-and-beyond/root.d.ts +146 -49
- package/dist/schema/widgets/checkout-and-beyond/rule.d.ts +140 -68
- package/dist/schema/widgets/checkout-and-beyond/text.d.ts +146 -49
- package/dist/schema/widgets/checkout-and-beyond/variables.d.ts +470 -0
- package/dist/schema/widgets/checkout-and-beyond/variants.d.ts +146 -49
- package/dist/schema/widgets/contentBlock.d.ts +146 -49
- package/dist/schema/widgets/lineItemEditor.d.ts +146 -49
- package/dist/schema/widgets/rebuyButton.d.ts +146 -49
- package/dist/server/index.cjs +492 -416
- package/dist/server/index.mjs +492 -416
- package/dist/transforms/index.cjs +393 -317
- package/dist/transforms/index.mjs +393 -317
- package/dist/transforms/monetizeV1/convertMonetizeToV2.d.ts +2 -2
- package/package.json +1 -1
|
@@ -37,6 +37,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
37
37
|
CABDataSourceSection: () => CABDataSourceSection,
|
|
38
38
|
CABDiscount: () => CABDiscount,
|
|
39
39
|
CABDiscountSection: () => CABDiscountSection,
|
|
40
|
+
CABEventTrigger: () => CABEventTrigger,
|
|
40
41
|
CABExperiment: () => CABExperiment,
|
|
41
42
|
CABImageSection: () => CABImageSection,
|
|
42
43
|
CABImageSectionFields: () => CABImageSectionFields,
|
|
@@ -49,16 +50,26 @@ __export(checkout_and_beyond_exports, {
|
|
|
49
50
|
CABProgressBarSection: () => CABProgressBarSection,
|
|
50
51
|
CABProgressTier: () => CABProgressTier,
|
|
51
52
|
CABQuantitySection: () => CABQuantitySection,
|
|
53
|
+
CABResultCountTrigger: () => CABResultCountTrigger,
|
|
54
|
+
CABResultTagTrigger: () => CABResultTagTrigger,
|
|
52
55
|
CABReviewsSection: () => CABReviewsSection,
|
|
53
56
|
CABRootSection: () => CABRootSection,
|
|
54
|
-
|
|
57
|
+
CABRuleset: () => CABRuleset,
|
|
58
|
+
CABRulesetEntry: () => CABRulesetEntry,
|
|
55
59
|
CABSection: () => CABSection,
|
|
56
60
|
CABTextSection: () => CABTextSection,
|
|
57
61
|
CABTextTier: () => CABTextTier,
|
|
58
62
|
CABTracking: () => CABTracking,
|
|
59
63
|
CABUILabels: () => CABUILabels,
|
|
64
|
+
CABVariable: () => CABVariable,
|
|
65
|
+
CABVariableEffect: () => CABVariableEffect,
|
|
66
|
+
CABVariableFields: () => CABVariableFields,
|
|
67
|
+
CABVariableMutator: () => CABVariableMutator,
|
|
68
|
+
CABVariableSeed: () => CABVariableSeed,
|
|
69
|
+
CABVariableTrigger: () => CABVariableTrigger,
|
|
60
70
|
CABVariantContent: () => CABVariantContent,
|
|
61
71
|
CABVariantsSection: () => CABVariantsSection,
|
|
72
|
+
CABVisibility: () => CABVisibility,
|
|
62
73
|
COMBINED_ENDPOINTS: () => COMBINED_ENDPOINTS,
|
|
63
74
|
DEFAULT_ENDPOINTS: () => DEFAULT_ENDPOINTS,
|
|
64
75
|
DYNAMIC_TOKEN_REGEX: () => DYNAMIC_TOKEN_REGEX,
|
|
@@ -76,6 +87,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
76
87
|
IconTone: () => IconTone,
|
|
77
88
|
InlineTextSizeName: () => InlineTextSizeName,
|
|
78
89
|
LanguageKey: () => LanguageKey,
|
|
90
|
+
MutatorEvent: () => MutatorEvent,
|
|
79
91
|
NO_HTML: () => NO_HTML,
|
|
80
92
|
OFFER_LABELS: () => OFFER_LABELS,
|
|
81
93
|
ObjectFit: () => ObjectFit,
|
|
@@ -87,6 +99,8 @@ __export(checkout_and_beyond_exports, {
|
|
|
87
99
|
QuantityInput: () => QuantityInput,
|
|
88
100
|
REVIEW_LABELS: () => REVIEW_LABELS,
|
|
89
101
|
ROOT_RELATIVE_PATH_REGEX: () => ROOT_RELATIVE_PATH_REGEX,
|
|
102
|
+
ResultCountOperator: () => ResultCountOperator,
|
|
103
|
+
ResultTagOperator: () => ResultTagOperator,
|
|
90
104
|
ReviewsSize: () => ReviewsSize,
|
|
91
105
|
RuleCondition: () => RuleCondition,
|
|
92
106
|
RuleLogicBlock: () => RuleLogicBlock,
|
|
@@ -103,6 +117,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
103
117
|
TiptapParagraph: () => TiptapParagraph,
|
|
104
118
|
TiptapText: () => TiptapText,
|
|
105
119
|
UI_LABELS: () => UI_LABELS,
|
|
120
|
+
VariableEffect: () => VariableEffect,
|
|
106
121
|
VariantMode: () => VariantMode,
|
|
107
122
|
VariantSelector: () => VariantSelector,
|
|
108
123
|
VerticalAlignment: () => VerticalAlignment,
|
|
@@ -147,6 +162,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
147
162
|
isTextType: () => isTextType,
|
|
148
163
|
isVariantsType: () => isVariantsType,
|
|
149
164
|
languageKeys: () => languageKeys,
|
|
165
|
+
mutatorEvents: () => mutatorEvents,
|
|
150
166
|
objectFits: () => objectFits,
|
|
151
167
|
offersDirections: () => offersDirections,
|
|
152
168
|
popoverPositionMap: () => popoverPositionMap,
|
|
@@ -155,6 +171,8 @@ __export(checkout_and_beyond_exports, {
|
|
|
155
171
|
progressTierTypes: () => progressTierTypes,
|
|
156
172
|
progressTierUnits: () => progressTierUnits,
|
|
157
173
|
quantityInputs: () => quantityInputs,
|
|
174
|
+
resultCountOperators: () => resultCountOperators,
|
|
175
|
+
resultTagOperators: () => resultTagOperators,
|
|
158
176
|
reviewsSizes: () => reviewsSizes,
|
|
159
177
|
ruleOperators: () => ruleOperators,
|
|
160
178
|
ruleTypes: () => ruleTypes,
|
|
@@ -164,6 +182,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
164
182
|
textAlignments: () => textAlignments,
|
|
165
183
|
textColorNames: () => textColorNames,
|
|
166
184
|
textSizeNames: () => textSizeNames,
|
|
185
|
+
variableEffects: () => variableEffects,
|
|
167
186
|
variantModes: () => variantModes,
|
|
168
187
|
variantSelectors: () => variantSelectors,
|
|
169
188
|
verticalAlignments: () => verticalAlignments,
|
|
@@ -172,7 +191,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
172
191
|
module.exports = __toCommonJS(checkout_and_beyond_exports);
|
|
173
192
|
|
|
174
193
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
175
|
-
var
|
|
194
|
+
var import_zod20 = require("zod");
|
|
176
195
|
|
|
177
196
|
// src/schema/widgets/checkout-and-beyond/common.ts
|
|
178
197
|
var freezeEnum = (values) => Object.freeze(Object.fromEntries(values.map((v) => [v, v])));
|
|
@@ -279,6 +298,8 @@ var languageKeys = [
|
|
|
279
298
|
"zh"
|
|
280
299
|
];
|
|
281
300
|
var LanguageKey = freezeEnum(languageKeys);
|
|
301
|
+
var mutatorEvents = ["item_added", "quantity_changed", "variant_selected"];
|
|
302
|
+
var MutatorEvent = freezeEnum(mutatorEvents);
|
|
282
303
|
var objectFits = ["cover", "contain"];
|
|
283
304
|
var ObjectFit = freezeEnum(objectFits);
|
|
284
305
|
var popoverPositions = ["inlineStart", "inlineEnd", "blockStart", "blockEnd"];
|
|
@@ -297,6 +318,10 @@ var progressTierUnits = ["currency", "item"];
|
|
|
297
318
|
var ProgressTierUnit = freezeEnum(progressTierUnits);
|
|
298
319
|
var quantityInputs = ["select", "number"];
|
|
299
320
|
var QuantityInput = freezeEnum(quantityInputs);
|
|
321
|
+
var resultCountOperators = ["equals", "greater_than", "less_than"];
|
|
322
|
+
var ResultCountOperator = freezeEnum(resultCountOperators);
|
|
323
|
+
var resultTagOperators = ["contains", "does_not_contain"];
|
|
324
|
+
var ResultTagOperator = freezeEnum(resultTagOperators);
|
|
300
325
|
var reviewsSizes = ["small", "default", "large"];
|
|
301
326
|
var ReviewsSize = freezeEnum(reviewsSizes);
|
|
302
327
|
var sectionTypes = [
|
|
@@ -329,6 +354,8 @@ var inlineTextSizeNames = ["extraSmall", "small", "base", "medium", "large", "ex
|
|
|
329
354
|
var InlineTextSizeName = freezeEnum(inlineTextSizeNames);
|
|
330
355
|
var textSizeNames = [...inlineTextSizeNames, "heading"];
|
|
331
356
|
var TextSizeName = freezeEnum(textSizeNames);
|
|
357
|
+
var variableEffects = ["set_false", "set_true", "toggle"];
|
|
358
|
+
var VariableEffect = freezeEnum(variableEffects);
|
|
332
359
|
var variantModes = ["multiple", "single"];
|
|
333
360
|
var VariantMode = freezeEnum(variantModes);
|
|
334
361
|
var variantSelectors = ["menu", "radio", "button"];
|
|
@@ -338,85 +365,18 @@ var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
|
338
365
|
|
|
339
366
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
340
367
|
var import_uuid12 = require("uuid");
|
|
341
|
-
var
|
|
342
|
-
|
|
343
|
-
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
344
|
-
var import_zod = require("zod");
|
|
345
|
-
var ruleTypes = [
|
|
346
|
-
"cart",
|
|
347
|
-
"cart_count",
|
|
348
|
-
"cart_item_count",
|
|
349
|
-
"cart_line_count",
|
|
350
|
-
"cart_subtotal",
|
|
351
|
-
"collection",
|
|
352
|
-
"customer",
|
|
353
|
-
"customer_order_count",
|
|
354
|
-
"customer_tag",
|
|
355
|
-
"customer_total_spent",
|
|
356
|
-
"date",
|
|
357
|
-
"product",
|
|
358
|
-
"product_tag",
|
|
359
|
-
"product_title",
|
|
360
|
-
"product_type",
|
|
361
|
-
"product_vendor"
|
|
362
|
-
];
|
|
363
|
-
var ruleType = import_zod.z.enum(ruleTypes);
|
|
364
|
-
var RuleType = ruleType.enum;
|
|
365
|
-
var ruleOperators = [
|
|
366
|
-
"after",
|
|
367
|
-
"anything",
|
|
368
|
-
"before",
|
|
369
|
-
"contains",
|
|
370
|
-
"contains_any",
|
|
371
|
-
"does_not_contain",
|
|
372
|
-
"does_not_contain_any",
|
|
373
|
-
"equals",
|
|
374
|
-
"does_not_equal",
|
|
375
|
-
"greater_than",
|
|
376
|
-
"less_than"
|
|
377
|
-
];
|
|
378
|
-
var ruleOperator = import_zod.z.enum(ruleOperators);
|
|
379
|
-
var RuleOperator = ruleOperator.enum;
|
|
380
|
-
var RuleCondition = import_zod.z.object({
|
|
381
|
-
operator: import_zod.z.enum(ruleOperators).default(RuleOperator.anything),
|
|
382
|
-
products: import_zod.z.union([import_zod.z.array(import_zod.z.unknown()), import_zod.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
383
|
-
type: import_zod.z.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
384
|
-
value: import_zod.z.coerce.string().default("")
|
|
385
|
-
});
|
|
386
|
-
var RuleLogicBlock = import_zod.z.object({
|
|
387
|
-
rules: import_zod.z.array(RuleCondition).default(() => [])
|
|
388
|
-
});
|
|
389
|
-
var CABRule = import_zod.z.object({
|
|
390
|
-
dataSourceId: import_zod.z.number().nullable().default(null),
|
|
391
|
-
enabled: import_zod.z.boolean().default(false),
|
|
392
|
-
ruleset: import_zod.z.union([
|
|
393
|
-
import_zod.z.array(
|
|
394
|
-
import_zod.z.object({
|
|
395
|
-
exitIfMatched: import_zod.z.boolean().default(true),
|
|
396
|
-
logic: import_zod.z.array(RuleLogicBlock).default(() => []),
|
|
397
|
-
output: import_zod.z.array(
|
|
398
|
-
import_zod.z.object({
|
|
399
|
-
key: import_zod.z.string().default("should_show"),
|
|
400
|
-
type: import_zod.z.literal("data_json").default("data_json"),
|
|
401
|
-
value: import_zod.z.string().default("true")
|
|
402
|
-
})
|
|
403
|
-
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
404
|
-
})
|
|
405
|
-
),
|
|
406
|
-
import_zod.z.strictObject({}).transform(() => [])
|
|
407
|
-
]).default(() => [])
|
|
408
|
-
});
|
|
368
|
+
var import_zod19 = require("zod");
|
|
409
369
|
|
|
410
370
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
411
|
-
var
|
|
371
|
+
var import_zod18 = require("zod");
|
|
412
372
|
|
|
413
373
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
414
374
|
var import_uuid3 = require("uuid");
|
|
415
|
-
var
|
|
375
|
+
var import_zod5 = require("zod");
|
|
416
376
|
|
|
417
377
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
418
378
|
var import_uuid = require("uuid");
|
|
419
|
-
var
|
|
379
|
+
var import_zod3 = require("zod");
|
|
420
380
|
|
|
421
381
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
422
382
|
var iconNames = [
|
|
@@ -576,17 +536,142 @@ var isReviewsType = isSectionType(SectionType.reviews);
|
|
|
576
536
|
var isTextType = isSectionType(SectionType.text);
|
|
577
537
|
var isVariantsType = isSectionType(SectionType.variants);
|
|
578
538
|
|
|
539
|
+
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
540
|
+
var import_zod2 = require("zod");
|
|
541
|
+
|
|
542
|
+
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
543
|
+
var import_zod = require("zod");
|
|
544
|
+
var ruleTypes = [
|
|
545
|
+
"cart",
|
|
546
|
+
"cart_count",
|
|
547
|
+
"cart_item_count",
|
|
548
|
+
"cart_line_count",
|
|
549
|
+
"cart_subtotal",
|
|
550
|
+
"collection",
|
|
551
|
+
"customer",
|
|
552
|
+
"customer_order_count",
|
|
553
|
+
"customer_tag",
|
|
554
|
+
"customer_total_spent",
|
|
555
|
+
"date",
|
|
556
|
+
"product",
|
|
557
|
+
"product_tag",
|
|
558
|
+
"product_title",
|
|
559
|
+
"product_type",
|
|
560
|
+
"product_vendor"
|
|
561
|
+
];
|
|
562
|
+
var ruleType = import_zod.z.enum(ruleTypes);
|
|
563
|
+
var RuleType = ruleType.enum;
|
|
564
|
+
var ruleOperators = [
|
|
565
|
+
"after",
|
|
566
|
+
"anything",
|
|
567
|
+
"before",
|
|
568
|
+
"contains",
|
|
569
|
+
"contains_any",
|
|
570
|
+
"does_not_contain",
|
|
571
|
+
"does_not_contain_any",
|
|
572
|
+
"equals",
|
|
573
|
+
"does_not_equal",
|
|
574
|
+
"greater_than",
|
|
575
|
+
"less_than"
|
|
576
|
+
];
|
|
577
|
+
var ruleOperator = import_zod.z.enum(ruleOperators);
|
|
578
|
+
var RuleOperator = ruleOperator.enum;
|
|
579
|
+
var RuleCondition = import_zod.z.object({
|
|
580
|
+
operator: import_zod.z.enum(ruleOperators).default(RuleOperator.anything),
|
|
581
|
+
products: import_zod.z.union([import_zod.z.array(import_zod.z.unknown()), import_zod.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
582
|
+
type: import_zod.z.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
583
|
+
value: import_zod.z.coerce.string().default("")
|
|
584
|
+
});
|
|
585
|
+
var RuleLogicBlock = import_zod.z.object({
|
|
586
|
+
rules: import_zod.z.array(RuleCondition).default(() => [])
|
|
587
|
+
});
|
|
588
|
+
var CABRulesetEntry = import_zod.z.object({
|
|
589
|
+
exitIfMatched: import_zod.z.boolean().default(true),
|
|
590
|
+
logic: import_zod.z.array(RuleLogicBlock).default(() => []),
|
|
591
|
+
output: import_zod.z.array(
|
|
592
|
+
import_zod.z.object({
|
|
593
|
+
key: import_zod.z.string().default("should_show"),
|
|
594
|
+
type: import_zod.z.literal("data_json").default("data_json"),
|
|
595
|
+
value: import_zod.z.string().default("true")
|
|
596
|
+
})
|
|
597
|
+
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
598
|
+
});
|
|
599
|
+
var CABRuleset = import_zod.z.union([import_zod.z.array(CABRulesetEntry), import_zod.z.strictObject({}).transform(() => [])]).default(() => []);
|
|
600
|
+
|
|
601
|
+
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
602
|
+
var variableEffect = import_zod2.z.enum(variableEffects);
|
|
603
|
+
var CABVariableSeed = import_zod2.z.object({
|
|
604
|
+
dataSourceId: import_zod2.z.number().nullable().default(null),
|
|
605
|
+
ruleset: CABRuleset
|
|
606
|
+
});
|
|
607
|
+
var CABVariable = import_zod2.z.object({
|
|
608
|
+
/**
|
|
609
|
+
* Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
|
|
610
|
+
* from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
|
|
611
|
+
* below; a cross-field default has no `.default()` spelling. An explicit value always wins.
|
|
612
|
+
*/
|
|
613
|
+
defaultValue: import_zod2.z.boolean().optional(),
|
|
614
|
+
name: import_zod2.z.string().min(1),
|
|
615
|
+
seed: CABVariableSeed.optional()
|
|
616
|
+
}).transform(({ defaultValue, ...variable }) => ({
|
|
617
|
+
defaultValue: defaultValue ?? variable.seed === void 0,
|
|
618
|
+
...variable
|
|
619
|
+
}));
|
|
620
|
+
var CABVariableEffect = import_zod2.z.object({
|
|
621
|
+
effect: variableEffect.default(VariableEffect.toggle),
|
|
622
|
+
variable: import_zod2.z.string().min(1)
|
|
623
|
+
});
|
|
624
|
+
var CABVisibility = import_zod2.z.object({
|
|
625
|
+
variable: import_zod2.z.string().min(1),
|
|
626
|
+
visibleWhen: import_zod2.z.boolean().default(true)
|
|
627
|
+
});
|
|
628
|
+
var resultCountOperator = import_zod2.z.enum(resultCountOperators);
|
|
629
|
+
var resultTagOperator = import_zod2.z.enum(resultTagOperators);
|
|
630
|
+
var mutatorEvent = import_zod2.z.enum(mutatorEvents);
|
|
631
|
+
var CABResultCountTrigger = import_zod2.z.object({
|
|
632
|
+
operator: resultCountOperator.default(ResultCountOperator.equals),
|
|
633
|
+
type: import_zod2.z.literal("result_count"),
|
|
634
|
+
value: import_zod2.z.number().default(0)
|
|
635
|
+
});
|
|
636
|
+
var CABResultTagTrigger = import_zod2.z.object({
|
|
637
|
+
operator: resultTagOperator.default(ResultTagOperator.contains),
|
|
638
|
+
type: import_zod2.z.literal("result_tag"),
|
|
639
|
+
value: import_zod2.z.string().min(1)
|
|
640
|
+
});
|
|
641
|
+
var CABEventTrigger = import_zod2.z.object({
|
|
642
|
+
event: mutatorEvent,
|
|
643
|
+
type: import_zod2.z.literal("event")
|
|
644
|
+
});
|
|
645
|
+
var CABVariableTrigger = import_zod2.z.discriminatedUnion("type", [
|
|
646
|
+
CABEventTrigger,
|
|
647
|
+
CABResultCountTrigger,
|
|
648
|
+
CABResultTagTrigger
|
|
649
|
+
]);
|
|
650
|
+
var CABVariableMutator = import_zod2.z.object({
|
|
651
|
+
effect: variableEffect.default(VariableEffect.set_false),
|
|
652
|
+
variable: import_zod2.z.string().min(1),
|
|
653
|
+
when: CABVariableTrigger
|
|
654
|
+
});
|
|
655
|
+
var CABVariableFields = {
|
|
656
|
+
mutators: import_zod2.z.array(CABVariableMutator).optional(),
|
|
657
|
+
variables: import_zod2.z.array(CABVariable).refine((variables) => new Set(variables.map(({ name }) => name)).size === variables.length, {
|
|
658
|
+
message: "variable names must be unique within a section"
|
|
659
|
+
}).optional(),
|
|
660
|
+
visibility: CABVisibility.optional()
|
|
661
|
+
};
|
|
662
|
+
|
|
579
663
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
580
|
-
var CABImageSectionFields =
|
|
581
|
-
|
|
664
|
+
var CABImageSectionFields = import_zod3.z.object({
|
|
665
|
+
...CABVariableFields,
|
|
666
|
+
altText: import_zod3.z.string().refine(checkForHTML, NO_HTML).default(""),
|
|
582
667
|
/**
|
|
583
668
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
584
669
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
585
670
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
586
671
|
*/
|
|
587
|
-
aspectRatio:
|
|
588
|
-
border:
|
|
589
|
-
buttonField:
|
|
672
|
+
aspectRatio: import_zod3.z.number().positive().nullable().default(null),
|
|
673
|
+
border: import_zod3.z.lazy(() => CABBorder),
|
|
674
|
+
buttonField: import_zod3.z.enum(buttonFields).optional(),
|
|
590
675
|
/**
|
|
591
676
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
592
677
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -605,30 +690,29 @@ var CABImageSectionFields = import_zod2.z.object({
|
|
|
605
690
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
606
691
|
* the risky half.
|
|
607
692
|
*/
|
|
608
|
-
category:
|
|
693
|
+
category: import_zod3.z.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
609
694
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
610
|
-
iconSize:
|
|
695
|
+
iconSize: import_zod3.z.enum(iconSizes).nullable().default(null),
|
|
611
696
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
612
|
-
iconTone:
|
|
613
|
-
name:
|
|
614
|
-
naturalHeight:
|
|
615
|
-
naturalWidth:
|
|
697
|
+
iconTone: import_zod3.z.enum(iconTones).nullable().default(null),
|
|
698
|
+
name: import_zod3.z.string().optional(),
|
|
699
|
+
naturalHeight: import_zod3.z.number().default(0),
|
|
700
|
+
naturalWidth: import_zod3.z.number().default(0),
|
|
616
701
|
/**
|
|
617
702
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
618
703
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
619
704
|
*/
|
|
620
|
-
objectFit:
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
sectionType: import_zod2.z.literal(SectionType.image).default(SectionType.image),
|
|
705
|
+
objectFit: import_zod3.z.enum(objectFits).default(ObjectFit.contain),
|
|
706
|
+
sectionId: import_zod3.z.uuid().default(() => (0, import_uuid.v7)()),
|
|
707
|
+
sectionType: import_zod3.z.literal(SectionType.image).default(SectionType.image),
|
|
624
708
|
/**
|
|
625
709
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
626
710
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
627
711
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
628
712
|
* server-chosen tier icon actually needs it.
|
|
629
713
|
*/
|
|
630
|
-
source:
|
|
631
|
-
width:
|
|
714
|
+
source: import_zod3.z.union([import_zod3.z.url(), import_zod3.z.literal(""), import_zod3.z.string().regex(DYNAMIC_TOKEN_REGEX), import_zod3.z.enum(iconNames)]).default(""),
|
|
715
|
+
width: import_zod3.z.number().default(100)
|
|
632
716
|
});
|
|
633
717
|
var iconNameSet = new Set(iconNames);
|
|
634
718
|
var isIconName = (source) => iconNameSet.has(source);
|
|
@@ -650,71 +734,71 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, c
|
|
|
650
734
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
651
735
|
var import_compat2 = require("es-toolkit/compat");
|
|
652
736
|
var import_uuid2 = require("uuid");
|
|
653
|
-
var
|
|
654
|
-
var enumOrOmit = (...vals) =>
|
|
655
|
-
var TiptapText =
|
|
656
|
-
marks:
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
attrs:
|
|
663
|
-
class:
|
|
664
|
-
href:
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
737
|
+
var import_zod4 = require("zod");
|
|
738
|
+
var enumOrOmit = (...vals) => import_zod4.z.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
739
|
+
var TiptapText = import_zod4.z.object({
|
|
740
|
+
marks: import_zod4.z.union([
|
|
741
|
+
import_zod4.z.array(
|
|
742
|
+
import_zod4.z.discriminatedUnion("type", [
|
|
743
|
+
import_zod4.z.object({ type: import_zod4.z.literal("bold") }),
|
|
744
|
+
import_zod4.z.object({ type: import_zod4.z.literal("italic") }),
|
|
745
|
+
import_zod4.z.object({
|
|
746
|
+
attrs: import_zod4.z.object({
|
|
747
|
+
class: import_zod4.z.string().nullable(),
|
|
748
|
+
href: import_zod4.z.union([
|
|
749
|
+
import_zod4.z.url(),
|
|
750
|
+
import_zod4.z.literal("#"),
|
|
751
|
+
import_zod4.z.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
752
|
+
import_zod4.z.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
669
753
|
]),
|
|
670
|
-
rel:
|
|
671
|
-
target:
|
|
754
|
+
rel: import_zod4.z.string().default("noopener noreferrer nofollow"),
|
|
755
|
+
target: import_zod4.z.string().default("_blank")
|
|
672
756
|
}),
|
|
673
|
-
type:
|
|
757
|
+
type: import_zod4.z.literal("link")
|
|
674
758
|
}),
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
attrs:
|
|
759
|
+
import_zod4.z.object({ type: import_zod4.z.literal("strike") }),
|
|
760
|
+
import_zod4.z.object({
|
|
761
|
+
attrs: import_zod4.z.object({
|
|
678
762
|
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
679
763
|
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
680
764
|
}),
|
|
681
|
-
type:
|
|
765
|
+
type: import_zod4.z.literal("textStyle")
|
|
682
766
|
})
|
|
683
767
|
])
|
|
684
768
|
),
|
|
685
|
-
|
|
769
|
+
import_zod4.z.strictObject({}).transform(() => [])
|
|
686
770
|
]).optional(),
|
|
687
|
-
text:
|
|
688
|
-
type:
|
|
771
|
+
text: import_zod4.z.string().default(""),
|
|
772
|
+
type: import_zod4.z.literal("text").default("text")
|
|
689
773
|
});
|
|
690
|
-
var TiptapParagraph =
|
|
691
|
-
attrs:
|
|
774
|
+
var TiptapParagraph = import_zod4.z.object({
|
|
775
|
+
attrs: import_zod4.z.object({
|
|
692
776
|
textAlign: enumOrOmit(...textAlignments)
|
|
693
777
|
}).default({ textAlign: TextAlignment.start }),
|
|
694
|
-
content:
|
|
695
|
-
type:
|
|
778
|
+
content: import_zod4.z.union([import_zod4.z.array(TiptapText), import_zod4.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
779
|
+
type: import_zod4.z.literal("paragraph").default("paragraph")
|
|
696
780
|
});
|
|
697
|
-
var TiptapDocument =
|
|
698
|
-
attrs:
|
|
781
|
+
var TiptapDocument = import_zod4.z.object({
|
|
782
|
+
attrs: import_zod4.z.object({
|
|
699
783
|
blockSpacing: enumOrOmit(...spacings)
|
|
700
784
|
}).default({ blockSpacing: Spacing.base }),
|
|
701
|
-
content:
|
|
702
|
-
type:
|
|
785
|
+
content: import_zod4.z.union([import_zod4.z.array(TiptapParagraph), import_zod4.z.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
786
|
+
type: import_zod4.z.literal("doc").default("doc")
|
|
703
787
|
});
|
|
704
|
-
var CABTextTier =
|
|
705
|
-
threshold:
|
|
706
|
-
thresholds:
|
|
707
|
-
tierId:
|
|
708
|
-
tierType:
|
|
788
|
+
var CABTextTier = import_zod4.z.object({
|
|
789
|
+
threshold: import_zod4.z.number().int().nonnegative(),
|
|
790
|
+
thresholds: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.number().int().nonnegative()).default(() => ({})),
|
|
791
|
+
tierId: import_zod4.z.string().optional(),
|
|
792
|
+
tierType: import_zod4.z.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
709
793
|
});
|
|
710
|
-
var CABTextSection =
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
sectionId:
|
|
717
|
-
sectionType:
|
|
794
|
+
var CABTextSection = import_zod4.z.object({
|
|
795
|
+
...CABVariableFields,
|
|
796
|
+
buttonField: import_zod4.z.enum(buttonFields).optional(),
|
|
797
|
+
content: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.union([import_zod4.z.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
798
|
+
name: import_zod4.z.string().optional(),
|
|
799
|
+
optionId: import_zod4.z.number().optional(),
|
|
800
|
+
sectionId: import_zod4.z.uuid().default(() => (0, import_uuid2.v7)()),
|
|
801
|
+
sectionType: import_zod4.z.literal(SectionType.text).default(SectionType.text),
|
|
718
802
|
tier: CABTextTier.optional()
|
|
719
803
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
720
804
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
@@ -736,35 +820,35 @@ var CABTextSection = import_zod3.z.object({
|
|
|
736
820
|
});
|
|
737
821
|
|
|
738
822
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
739
|
-
var CABButtonContent =
|
|
740
|
-
() =>
|
|
823
|
+
var CABButtonContent = import_zod5.z.lazy(
|
|
824
|
+
() => import_zod5.z.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
741
825
|
);
|
|
742
|
-
var CABButtonSection =
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
826
|
+
var CABButtonSection = import_zod5.z.object({
|
|
827
|
+
...CABVariableFields,
|
|
828
|
+
action: import_zod5.z.union([import_zod5.z.literal(""), import_zod5.z.enum(buttonActions)]).default(""),
|
|
829
|
+
buttonStyle: import_zod5.z.enum(buttonStyles).default(ButtonStyle.primary),
|
|
830
|
+
custom: import_zod5.z.object({
|
|
831
|
+
color: import_zod5.z.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
832
|
+
height: import_zod5.z.number().default(52),
|
|
833
|
+
width: import_zod5.z.number().default(300)
|
|
749
834
|
}).default({
|
|
750
835
|
color: "#005bd3",
|
|
751
836
|
height: 52,
|
|
752
837
|
width: 300
|
|
753
838
|
}),
|
|
754
|
-
disableDowngrade:
|
|
755
|
-
name:
|
|
756
|
-
optionId:
|
|
757
|
-
popover:
|
|
758
|
-
alignment:
|
|
759
|
-
position:
|
|
839
|
+
disableDowngrade: import_zod5.z.boolean().default(false),
|
|
840
|
+
name: import_zod5.z.string().optional(),
|
|
841
|
+
optionId: import_zod5.z.number().optional(),
|
|
842
|
+
popover: import_zod5.z.object({
|
|
843
|
+
alignment: import_zod5.z.enum(textAlignments).default(TextAlignment.center),
|
|
844
|
+
position: import_zod5.z.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
760
845
|
}).optional().default(() => ({
|
|
761
846
|
alignment: TextAlignment.center,
|
|
762
847
|
position: PopoverPosition.blockStart
|
|
763
848
|
})),
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
sectionType: import_zod4.z.literal(SectionType.button).default(SectionType.button),
|
|
849
|
+
sectionId: import_zod5.z.uuid().default(() => (0, import_uuid3.v7)()),
|
|
850
|
+
sections: import_zod5.z.union([import_zod5.z.array(CABButtonContent), import_zod5.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
851
|
+
sectionType: import_zod5.z.literal(SectionType.button).default(SectionType.button),
|
|
768
852
|
/**
|
|
769
853
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
770
854
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -779,20 +863,25 @@ var CABButtonSection = import_zod4.z.object({
|
|
|
779
863
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
780
864
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
781
865
|
*/
|
|
782
|
-
tier:
|
|
866
|
+
tier: import_zod5.z.object({ tierId: import_zod5.z.string().min(1) }).optional(),
|
|
783
867
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
784
|
-
trackingUrl:
|
|
868
|
+
trackingUrl: import_zod5.z.string().optional(),
|
|
869
|
+
/**
|
|
870
|
+
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
871
|
+
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
872
|
+
*/
|
|
873
|
+
variableEffects: import_zod5.z.array(CABVariableEffect).optional()
|
|
785
874
|
});
|
|
786
875
|
|
|
787
876
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
788
|
-
var
|
|
877
|
+
var import_zod10 = require("zod");
|
|
789
878
|
|
|
790
879
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
791
|
-
var
|
|
880
|
+
var import_zod9 = require("zod");
|
|
792
881
|
|
|
793
882
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
794
883
|
var import_uuid4 = require("uuid");
|
|
795
|
-
var
|
|
884
|
+
var import_zod6 = require("zod");
|
|
796
885
|
|
|
797
886
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
798
887
|
var import_es_toolkit3 = require("es-toolkit");
|
|
@@ -871,72 +960,74 @@ var widgetTypes = [
|
|
|
871
960
|
var WidgetType = freezeEnum(widgetTypes);
|
|
872
961
|
|
|
873
962
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
874
|
-
var CABDiscount =
|
|
875
|
-
amount:
|
|
876
|
-
discountedBy:
|
|
877
|
-
discountedFrom:
|
|
878
|
-
type:
|
|
963
|
+
var CABDiscount = import_zod6.z.object({
|
|
964
|
+
amount: import_zod6.z.union([import_zod6.z.number(), import_zod6.z.string()]).catch(0),
|
|
965
|
+
discountedBy: import_zod6.z.string().optional(),
|
|
966
|
+
discountedFrom: import_zod6.z.enum(discountSources).optional().catch(void 0),
|
|
967
|
+
type: import_zod6.z.enum(discountTypes).catch("none")
|
|
879
968
|
});
|
|
880
|
-
var CABIntegrations =
|
|
881
|
-
judgeme:
|
|
882
|
-
junip:
|
|
883
|
-
klaviyo:
|
|
884
|
-
loox:
|
|
885
|
-
okendo:
|
|
886
|
-
opinew:
|
|
887
|
-
reviewsio:
|
|
888
|
-
stamped:
|
|
889
|
-
yotpo:
|
|
969
|
+
var CABIntegrations = import_zod6.z.object({
|
|
970
|
+
judgeme: import_zod6.z.boolean().default(false),
|
|
971
|
+
junip: import_zod6.z.boolean().default(false),
|
|
972
|
+
klaviyo: import_zod6.z.boolean().default(false),
|
|
973
|
+
loox: import_zod6.z.boolean().default(false),
|
|
974
|
+
okendo: import_zod6.z.boolean().default(false),
|
|
975
|
+
opinew: import_zod6.z.boolean().default(false),
|
|
976
|
+
reviewsio: import_zod6.z.boolean().default(false),
|
|
977
|
+
stamped: import_zod6.z.boolean().default(false),
|
|
978
|
+
yotpo: import_zod6.z.boolean().default(false)
|
|
890
979
|
});
|
|
891
|
-
var CABDataSourceSection =
|
|
892
|
-
dataSourceId:
|
|
893
|
-
dataSourcePath:
|
|
980
|
+
var CABDataSourceSection = import_zod6.z.object({
|
|
981
|
+
dataSourceId: import_zod6.z.number().nullable().default(null),
|
|
982
|
+
dataSourcePath: import_zod6.z.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
894
983
|
discount: CABDiscount.optional(),
|
|
895
984
|
integrations: CABIntegrations.optional(),
|
|
896
|
-
limit:
|
|
897
|
-
matchVariant:
|
|
898
|
-
matchVariantOutOfStock:
|
|
899
|
-
name:
|
|
900
|
-
productType:
|
|
901
|
-
sectionId:
|
|
902
|
-
sectionType:
|
|
985
|
+
limit: import_zod6.z.number().default(1),
|
|
986
|
+
matchVariant: import_zod6.z.boolean().default(false),
|
|
987
|
+
matchVariantOutOfStock: import_zod6.z.boolean().default(false),
|
|
988
|
+
name: import_zod6.z.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
989
|
+
productType: import_zod6.z.enum(productTypes).optional(),
|
|
990
|
+
sectionId: import_zod6.z.uuid().default(() => (0, import_uuid4.v7)()),
|
|
991
|
+
sectionType: import_zod6.z.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
903
992
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
904
|
-
subscriptionIsDefault:
|
|
905
|
-
treatAsGwp:
|
|
993
|
+
subscriptionIsDefault: import_zod6.z.boolean().default(false),
|
|
994
|
+
treatAsGwp: import_zod6.z.boolean().default(false)
|
|
906
995
|
});
|
|
907
996
|
|
|
908
997
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
909
998
|
var import_uuid6 = require("uuid");
|
|
910
|
-
var
|
|
999
|
+
var import_zod8 = require("zod");
|
|
911
1000
|
|
|
912
1001
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
913
1002
|
var import_uuid5 = require("uuid");
|
|
914
|
-
var
|
|
915
|
-
var CABVariantContent =
|
|
916
|
-
() =>
|
|
1003
|
+
var import_zod7 = require("zod");
|
|
1004
|
+
var CABVariantContent = import_zod7.z.lazy(
|
|
1005
|
+
() => import_zod7.z.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
917
1006
|
);
|
|
918
|
-
var CABProductSection =
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1007
|
+
var CABProductSection = import_zod7.z.object({
|
|
1008
|
+
...CABVariableFields,
|
|
1009
|
+
name: import_zod7.z.string().optional(),
|
|
1010
|
+
productId: import_zod7.z.number().nullable().default(null),
|
|
1011
|
+
sectionId: import_zod7.z.uuid().default(() => (0, import_uuid5.v7)()),
|
|
1012
|
+
sections: import_zod7.z.union([import_zod7.z.array(CABVariantContent), import_zod7.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
1013
|
+
sectionType: import_zod7.z.literal(SectionType.product).default(SectionType.product),
|
|
1014
|
+
selectors: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
1015
|
+
variantMode: import_zod7.z.enum(variantModes).default(VariantMode.multiple)
|
|
926
1016
|
});
|
|
927
1017
|
|
|
928
1018
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
929
|
-
var CABProductsSection =
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
1019
|
+
var CABProductsSection = import_zod8.z.object({
|
|
1020
|
+
...CABVariableFields,
|
|
1021
|
+
name: import_zod8.z.string().optional(),
|
|
1022
|
+
sectionId: import_zod8.z.uuid().default(() => (0, import_uuid6.v7)()),
|
|
1023
|
+
sections: import_zod8.z.union([import_zod8.z.array(import_zod8.z.lazy(() => CABProductSection)), import_zod8.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
1024
|
+
sectionType: import_zod8.z.literal(SectionType.products).default(SectionType.products)
|
|
934
1025
|
});
|
|
935
1026
|
|
|
936
1027
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
937
|
-
var CABOffersSection =
|
|
1028
|
+
var CABOffersSection = import_zod9.z.lazy(
|
|
938
1029
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
939
|
-
sections:
|
|
1030
|
+
sections: import_zod9.z.union([import_zod9.z.array(import_zod9.z.lazy(() => CABSection)), import_zod9.z.strictObject({}).transform(() => [])]).default(() => [
|
|
940
1031
|
CABBannerSection.parse({
|
|
941
1032
|
buttonField: "undoAddToOrder",
|
|
942
1033
|
color: "success",
|
|
@@ -950,64 +1041,65 @@ var CABOffersSection = import_zod8.z.lazy(
|
|
|
950
1041
|
CABDataSourceSection.parse({}),
|
|
951
1042
|
CABProductsSection.parse({})
|
|
952
1043
|
]),
|
|
953
|
-
sectionType:
|
|
1044
|
+
sectionType: import_zod9.z.literal(SectionType.offers).default(SectionType.offers)
|
|
954
1045
|
})
|
|
955
1046
|
);
|
|
956
1047
|
|
|
957
1048
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
958
|
-
var CABCarouselSection =
|
|
1049
|
+
var CABCarouselSection = import_zod10.z.lazy(
|
|
959
1050
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
960
|
-
autoAdvanceInterval:
|
|
961
|
-
itemsAtOnce:
|
|
1051
|
+
autoAdvanceInterval: import_zod10.z.number().default(0),
|
|
1052
|
+
itemsAtOnce: import_zod10.z.number().min(1).default(1),
|
|
962
1053
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
963
|
-
offersDirection:
|
|
964
|
-
sections:
|
|
965
|
-
sectionType:
|
|
1054
|
+
offersDirection: import_zod10.z.enum(offersDirections).default("vertical"),
|
|
1055
|
+
sections: import_zod10.z.union([import_zod10.z.array(import_zod10.z.lazy(() => CABSection)), import_zod10.z.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
1056
|
+
sectionType: import_zod10.z.literal(SectionType.carousel).default(SectionType.carousel)
|
|
966
1057
|
})
|
|
967
1058
|
);
|
|
968
1059
|
|
|
969
1060
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
970
|
-
var
|
|
971
|
-
var CABCartLineSection =
|
|
1061
|
+
var import_zod11 = require("zod");
|
|
1062
|
+
var CABCartLineSection = import_zod11.z.lazy(
|
|
972
1063
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
973
|
-
sections:
|
|
974
|
-
sectionType:
|
|
1064
|
+
sections: import_zod11.z.union([import_zod11.z.array(import_zod11.z.lazy(() => CABSection)), import_zod11.z.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
1065
|
+
sectionType: import_zod11.z.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
975
1066
|
})
|
|
976
1067
|
);
|
|
977
1068
|
|
|
978
1069
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
979
1070
|
var import_uuid7 = require("uuid");
|
|
980
|
-
var
|
|
981
|
-
var CABDiscountSection =
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1071
|
+
var import_zod12 = require("zod");
|
|
1072
|
+
var CABDiscountSection = import_zod12.z.object({
|
|
1073
|
+
...CABVariableFields,
|
|
1074
|
+
amount: import_zod12.z.union([import_zod12.z.number(), import_zod12.z.string()]).catch(0),
|
|
1075
|
+
discountedBy: import_zod12.z.string().optional(),
|
|
1076
|
+
discountedFrom: import_zod12.z.enum(discountSources).optional().catch(void 0),
|
|
1077
|
+
message: import_zod12.z.string().optional(),
|
|
1078
|
+
name: import_zod12.z.string().optional(),
|
|
1079
|
+
quantity: import_zod12.z.number().default(1),
|
|
1080
|
+
sectionId: import_zod12.z.uuid().default(() => (0, import_uuid7.v7)()),
|
|
1081
|
+
sectionType: import_zod12.z.literal(SectionType.discount).default(SectionType.discount),
|
|
1082
|
+
type: import_zod12.z.enum(discountTypes).catch("none")
|
|
991
1083
|
});
|
|
992
1084
|
|
|
993
1085
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
994
1086
|
var import_uuid8 = require("uuid");
|
|
995
|
-
var
|
|
996
|
-
var CABMonetizeSection =
|
|
997
|
-
|
|
1087
|
+
var import_zod13 = require("zod");
|
|
1088
|
+
var CABMonetizeSection = import_zod13.z.object({
|
|
1089
|
+
...CABVariableFields,
|
|
1090
|
+
name: import_zod13.z.string().optional(),
|
|
998
1091
|
/** Privacy Policy footer href (the widget's `privacy_policy_url` setting); the client relays it to `/cab/monetize`. */
|
|
999
|
-
privacyPolicyUrl:
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
sectionType: import_zod12.z.literal(SectionType.monetize).default(SectionType.monetize),
|
|
1092
|
+
privacyPolicyUrl: import_zod13.z.string().optional(),
|
|
1093
|
+
sectionId: import_zod13.z.uuid().default(() => (0, import_uuid8.v7)()),
|
|
1094
|
+
sectionType: import_zod13.z.literal(SectionType.monetize).default(SectionType.monetize),
|
|
1003
1095
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
1004
|
-
subVertical:
|
|
1096
|
+
subVertical: import_zod13.z.string().optional(),
|
|
1005
1097
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
1006
|
-
vertical:
|
|
1098
|
+
vertical: import_zod13.z.string().optional()
|
|
1007
1099
|
});
|
|
1008
1100
|
|
|
1009
1101
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
1010
|
-
var
|
|
1102
|
+
var import_zod14 = require("zod");
|
|
1011
1103
|
|
|
1012
1104
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
1013
1105
|
var GIFT_LABELS = {
|
|
@@ -1126,21 +1218,21 @@ var GIFT_LABELS = {
|
|
|
1126
1218
|
};
|
|
1127
1219
|
|
|
1128
1220
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
1129
|
-
var CABProgressTier =
|
|
1221
|
+
var CABProgressTier = import_zod14.z.object({
|
|
1130
1222
|
/**
|
|
1131
1223
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
1132
1224
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
1133
1225
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
1134
1226
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
1135
1227
|
*/
|
|
1136
|
-
discount:
|
|
1228
|
+
discount: import_zod14.z.object({ amount: import_zod14.z.number().nonnegative(), type: import_zod14.z.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
1137
1229
|
/**
|
|
1138
1230
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
1139
1231
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
1140
1232
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
1141
1233
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
1142
1234
|
*/
|
|
1143
|
-
filterOosVariants:
|
|
1235
|
+
filterOosVariants: import_zod14.z.boolean().default(false),
|
|
1144
1236
|
/**
|
|
1145
1237
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
1146
1238
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -1148,10 +1240,10 @@ var CABProgressTier = import_zod13.z.object({
|
|
|
1148
1240
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
1149
1241
|
* tree is complete.
|
|
1150
1242
|
*/
|
|
1151
|
-
gift:
|
|
1152
|
-
productId:
|
|
1153
|
-
title:
|
|
1154
|
-
variantIds:
|
|
1243
|
+
gift: import_zod14.z.object({
|
|
1244
|
+
productId: import_zod14.z.number().int().positive(),
|
|
1245
|
+
title: import_zod14.z.string().optional(),
|
|
1246
|
+
variantIds: import_zod14.z.array(import_zod14.z.number().int().positive()).default(() => [])
|
|
1155
1247
|
}).optional(),
|
|
1156
1248
|
/**
|
|
1157
1249
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
@@ -1162,35 +1254,35 @@ var CABProgressTier = import_zod13.z.object({
|
|
|
1162
1254
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
1163
1255
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
1164
1256
|
*/
|
|
1165
|
-
label:
|
|
1257
|
+
label: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.string()).optional(),
|
|
1166
1258
|
/**
|
|
1167
1259
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
1168
1260
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
1169
1261
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
1170
1262
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
1171
1263
|
*/
|
|
1172
|
-
productTierImage:
|
|
1264
|
+
productTierImage: import_zod14.z.boolean().default(false),
|
|
1173
1265
|
/**
|
|
1174
1266
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
1175
1267
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
1176
1268
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
1177
1269
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
1178
1270
|
*/
|
|
1179
|
-
threshold:
|
|
1271
|
+
threshold: import_zod14.z.number().int().nonnegative(),
|
|
1180
1272
|
/**
|
|
1181
1273
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
1182
1274
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
1183
1275
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
1184
1276
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
1185
1277
|
*/
|
|
1186
|
-
thresholds:
|
|
1278
|
+
thresholds: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.number().int().nonnegative()).default(() => ({})),
|
|
1187
1279
|
/**
|
|
1188
1280
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
1189
1281
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
1190
1282
|
* shipping bar (single unlabeled tier, no gift).
|
|
1191
1283
|
*/
|
|
1192
|
-
tierId:
|
|
1193
|
-
tierType:
|
|
1284
|
+
tierId: import_zod14.z.string().optional(),
|
|
1285
|
+
tierType: import_zod14.z.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
1194
1286
|
/**
|
|
1195
1287
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
1196
1288
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -1201,9 +1293,9 @@ var CABProgressTier = import_zod13.z.object({
|
|
|
1201
1293
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
1202
1294
|
* template text supplies grammatically-neutral wording around the token.
|
|
1203
1295
|
*/
|
|
1204
|
-
unit:
|
|
1296
|
+
unit: import_zod14.z.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
1205
1297
|
});
|
|
1206
|
-
var CABProgressBarSection =
|
|
1298
|
+
var CABProgressBarSection = import_zod14.z.lazy(
|
|
1207
1299
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1208
1300
|
/**
|
|
1209
1301
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -1212,35 +1304,35 @@ var CABProgressBarSection = import_zod13.z.lazy(
|
|
|
1212
1304
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
1213
1305
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
1214
1306
|
*/
|
|
1215
|
-
barId:
|
|
1307
|
+
barId: import_zod14.z.string().optional(),
|
|
1216
1308
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
1217
|
-
countryCodes:
|
|
1309
|
+
countryCodes: import_zod14.z.array(import_zod14.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1218
1310
|
/**
|
|
1219
1311
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
1220
1312
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
1221
1313
|
*/
|
|
1222
|
-
excludeCountryCodes:
|
|
1314
|
+
excludeCountryCodes: import_zod14.z.array(import_zod14.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1223
1315
|
/**
|
|
1224
1316
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
1225
1317
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
1226
1318
|
* adds the cart's discount allocations back to the live subtotal.
|
|
1227
1319
|
*/
|
|
1228
|
-
excludeDiscountInSubtotal:
|
|
1320
|
+
excludeDiscountInSubtotal: import_zod14.z.boolean().default(false),
|
|
1229
1321
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
1230
|
-
excludedVariantIds:
|
|
1322
|
+
excludedVariantIds: import_zod14.z.array(import_zod14.z.number().int().positive()).default(() => []),
|
|
1231
1323
|
/**
|
|
1232
1324
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
1233
1325
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
1234
1326
|
*/
|
|
1235
|
-
freeShippingOnSubscription:
|
|
1327
|
+
freeShippingOnSubscription: import_zod14.z.boolean().default(false),
|
|
1236
1328
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
1237
|
-
giftAreaTitle:
|
|
1329
|
+
giftAreaTitle: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
1238
1330
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
1239
|
-
giftLabels:
|
|
1240
|
-
addGift:
|
|
1241
|
-
remove:
|
|
1242
|
-
selectOptions:
|
|
1243
|
-
yourGift:
|
|
1331
|
+
giftLabels: import_zod14.z.object({
|
|
1332
|
+
addGift: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
1333
|
+
remove: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
1334
|
+
selectOptions: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
1335
|
+
yourGift: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
1244
1336
|
}).default(() => ({
|
|
1245
1337
|
addGift: { ...GIFT_LABELS.addGift },
|
|
1246
1338
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -1248,37 +1340,38 @@ var CABProgressBarSection = import_zod13.z.lazy(
|
|
|
1248
1340
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
1249
1341
|
})),
|
|
1250
1342
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
1251
|
-
name:
|
|
1343
|
+
name: import_zod14.z.string().default("Order progress"),
|
|
1252
1344
|
/**
|
|
1253
1345
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
1254
1346
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
1255
1347
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
1256
1348
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
1257
1349
|
*/
|
|
1258
|
-
progressColor:
|
|
1259
|
-
sectionType:
|
|
1350
|
+
progressColor: import_zod14.z.string().optional(),
|
|
1351
|
+
sectionType: import_zod14.z.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
1260
1352
|
/**
|
|
1261
1353
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
1262
1354
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
1263
1355
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
1264
1356
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
1265
1357
|
*/
|
|
1266
|
-
tiers:
|
|
1358
|
+
tiers: import_zod14.z.union([import_zod14.z.array(CABProgressTier), import_zod14.z.strictObject({}).transform(() => [])]).default(() => [])
|
|
1267
1359
|
})
|
|
1268
1360
|
);
|
|
1269
1361
|
|
|
1270
1362
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
1271
1363
|
var import_uuid9 = require("uuid");
|
|
1272
|
-
var
|
|
1273
|
-
var CABQuantitySection =
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1364
|
+
var import_zod15 = require("zod");
|
|
1365
|
+
var CABQuantitySection = import_zod15.z.object({
|
|
1366
|
+
...CABVariableFields,
|
|
1367
|
+
errorMessages: import_zod15.z.record(
|
|
1368
|
+
import_zod15.z.string(),
|
|
1369
|
+
import_zod15.z.object({
|
|
1277
1370
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
1278
|
-
increment:
|
|
1279
|
-
max:
|
|
1280
|
-
min:
|
|
1281
|
-
neg:
|
|
1371
|
+
increment: import_zod15.z.string().optional(),
|
|
1372
|
+
max: import_zod15.z.string().optional(),
|
|
1373
|
+
min: import_zod15.z.string().optional(),
|
|
1374
|
+
neg: import_zod15.z.string().optional()
|
|
1282
1375
|
})
|
|
1283
1376
|
).default({
|
|
1284
1377
|
en: {
|
|
@@ -1288,19 +1381,18 @@ var CABQuantitySection = import_zod14.z.object({
|
|
|
1288
1381
|
neg: "Quantity cannot be negative"
|
|
1289
1382
|
}
|
|
1290
1383
|
}),
|
|
1291
|
-
inputType:
|
|
1292
|
-
max:
|
|
1293
|
-
min:
|
|
1384
|
+
inputType: import_zod15.z.enum(quantityInputs).default(QuantityInput.select),
|
|
1385
|
+
max: import_zod15.z.number().min(1).max(100).default(10),
|
|
1386
|
+
min: import_zod15.z.number().min(1).default(1),
|
|
1294
1387
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
1295
|
-
name:
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
sectionType: import_zod14.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1388
|
+
name: import_zod15.z.string().default("Quantity"),
|
|
1389
|
+
sectionId: import_zod15.z.uuid().default(() => (0, import_uuid9.v7)()),
|
|
1390
|
+
sectionType: import_zod15.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1299
1391
|
});
|
|
1300
1392
|
|
|
1301
1393
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1302
1394
|
var import_uuid10 = require("uuid");
|
|
1303
|
-
var
|
|
1395
|
+
var import_zod16 = require("zod");
|
|
1304
1396
|
|
|
1305
1397
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
1306
1398
|
var REVIEW_LABELS = {
|
|
@@ -1363,50 +1455,50 @@ var REVIEW_LABELS = {
|
|
|
1363
1455
|
};
|
|
1364
1456
|
|
|
1365
1457
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1366
|
-
var CABReviewsSection =
|
|
1367
|
-
|
|
1458
|
+
var CABReviewsSection = import_zod16.z.object({
|
|
1459
|
+
...CABVariableFields,
|
|
1460
|
+
color: import_zod16.z.string().default("#fadb14"),
|
|
1368
1461
|
/**
|
|
1369
1462
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
1370
1463
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
1371
1464
|
* or merchant work.
|
|
1372
1465
|
*/
|
|
1373
|
-
countLabels:
|
|
1374
|
-
one:
|
|
1375
|
-
other:
|
|
1466
|
+
countLabels: import_zod16.z.object({
|
|
1467
|
+
one: import_zod16.z.record(import_zod16.z.string(), import_zod16.z.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
1468
|
+
other: import_zod16.z.record(import_zod16.z.string(), import_zod16.z.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
1376
1469
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
1377
|
-
name:
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
size: import_zod15.z.enum(reviewsSizes).default(ReviewsSize.default)
|
|
1470
|
+
name: import_zod16.z.string().optional(),
|
|
1471
|
+
sectionId: import_zod16.z.uuid().default(() => (0, import_uuid10.v7)()),
|
|
1472
|
+
sectionType: import_zod16.z.literal(SectionType.reviews).default(SectionType.reviews),
|
|
1473
|
+
size: import_zod16.z.enum(reviewsSizes).default(ReviewsSize.default)
|
|
1382
1474
|
});
|
|
1383
1475
|
|
|
1384
1476
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
1385
1477
|
var import_compat3 = require("es-toolkit/compat");
|
|
1386
1478
|
var import_uuid11 = require("uuid");
|
|
1387
|
-
var
|
|
1388
|
-
var CABVariantsSection =
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
sectionId:
|
|
1393
|
-
sectionType:
|
|
1394
|
-
selector:
|
|
1395
|
-
variantMode:
|
|
1479
|
+
var import_zod17 = require("zod");
|
|
1480
|
+
var CABVariantsSection = import_zod17.z.object({
|
|
1481
|
+
...CABVariableFields,
|
|
1482
|
+
hideOutOfStockVariants: import_zod17.z.boolean().default(false),
|
|
1483
|
+
name: import_zod17.z.string().optional(),
|
|
1484
|
+
sectionId: import_zod17.z.uuid().default(() => (0, import_uuid11.v7)()),
|
|
1485
|
+
sectionType: import_zod17.z.literal(SectionType.variants).default(SectionType.variants),
|
|
1486
|
+
selector: import_zod17.z.enum((0, import_compat3.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
1487
|
+
variantMode: import_zod17.z.enum(variantModes).default(VariantMode.multiple)
|
|
1396
1488
|
});
|
|
1397
1489
|
|
|
1398
1490
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
1399
|
-
var CABBorder =
|
|
1400
|
-
radius:
|
|
1401
|
-
style:
|
|
1402
|
-
width:
|
|
1491
|
+
var CABBorder = import_zod18.z.object({
|
|
1492
|
+
radius: import_zod18.z.enum(borderRadii).default(BorderRadius.base),
|
|
1493
|
+
style: import_zod18.z.enum(borderStyles).default(BorderStyle.none),
|
|
1494
|
+
width: import_zod18.z.enum(borderWidths).default(BorderWidth.base)
|
|
1403
1495
|
}).default({
|
|
1404
1496
|
radius: BorderRadius.base,
|
|
1405
1497
|
style: BorderStyle.none,
|
|
1406
1498
|
width: BorderWidth.base
|
|
1407
1499
|
});
|
|
1408
|
-
var CABSection =
|
|
1409
|
-
() =>
|
|
1500
|
+
var CABSection = import_zod18.z.lazy(
|
|
1501
|
+
() => import_zod18.z.discriminatedUnion("sectionType", [
|
|
1410
1502
|
CABBannerSection,
|
|
1411
1503
|
CABButtonSection,
|
|
1412
1504
|
CABCarouselSection,
|
|
@@ -1428,40 +1520,40 @@ var CABSection = import_zod17.z.lazy(
|
|
|
1428
1520
|
);
|
|
1429
1521
|
|
|
1430
1522
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
1431
|
-
var GridItem =
|
|
1432
|
-
var CABLayoutSection =
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1523
|
+
var GridItem = import_zod19.z.union([import_zod19.z.literal("auto"), import_zod19.z.literal("fill"), import_zod19.z.string().regex(/^\d+%$/), import_zod19.z.number()]);
|
|
1524
|
+
var CABLayoutSection = import_zod19.z.object({
|
|
1525
|
+
...CABVariableFields,
|
|
1526
|
+
alignment: import_zod19.z.object({
|
|
1527
|
+
horizontal: import_zod19.z.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
1528
|
+
vertical: import_zod19.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
1436
1529
|
}).default({
|
|
1437
1530
|
horizontal: HorizontalAlignment.start,
|
|
1438
1531
|
vertical: VerticalAlignment.top
|
|
1439
1532
|
}),
|
|
1440
|
-
border:
|
|
1441
|
-
buttonField:
|
|
1442
|
-
direction:
|
|
1443
|
-
grid:
|
|
1444
|
-
columns:
|
|
1445
|
-
rows:
|
|
1533
|
+
border: import_zod19.z.lazy(() => CABBorder),
|
|
1534
|
+
buttonField: import_zod19.z.enum(buttonFields).optional(),
|
|
1535
|
+
direction: import_zod19.z.enum(directions).default(Direction.rows),
|
|
1536
|
+
grid: import_zod19.z.object({
|
|
1537
|
+
columns: import_zod19.z.union([import_zod19.z.array(GridItem), import_zod19.z.undefined()]).default(() => ["auto"]),
|
|
1538
|
+
rows: import_zod19.z.union([import_zod19.z.array(GridItem), import_zod19.z.undefined()]).default(() => ["auto"])
|
|
1446
1539
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
1447
|
-
name:
|
|
1448
|
-
padding:
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
spacing: import_zod18.z.enum(spacings).default(Spacing.base),
|
|
1540
|
+
name: import_zod19.z.string().optional(),
|
|
1541
|
+
padding: import_zod19.z.enum(spacings).default(Spacing.none),
|
|
1542
|
+
sectionId: import_zod19.z.uuid().default(() => (0, import_uuid12.v7)()),
|
|
1543
|
+
sections: import_zod19.z.union([import_zod19.z.array(import_zod19.z.lazy(() => CABSection)), import_zod19.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
1544
|
+
sectionType: import_zod19.z.literal(SectionType.layout).default(SectionType.layout),
|
|
1545
|
+
spacing: import_zod19.z.enum(spacings).default(Spacing.base),
|
|
1454
1546
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
1455
|
-
viewUrl:
|
|
1456
|
-
width:
|
|
1547
|
+
viewUrl: import_zod19.z.string().optional(),
|
|
1548
|
+
width: import_zod19.z.number().default(100)
|
|
1457
1549
|
});
|
|
1458
1550
|
|
|
1459
1551
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
1460
|
-
var CABBannerSection =
|
|
1552
|
+
var CABBannerSection = import_zod20.z.lazy(
|
|
1461
1553
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1462
|
-
buttonField:
|
|
1463
|
-
color:
|
|
1464
|
-
dismissible:
|
|
1554
|
+
buttonField: import_zod20.z.enum(buttonFields).optional(),
|
|
1555
|
+
color: import_zod20.z.enum(bannerColors).default("info"),
|
|
1556
|
+
dismissible: import_zod20.z.boolean().default(true),
|
|
1465
1557
|
/**
|
|
1466
1558
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
1467
1559
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -1477,8 +1569,8 @@ var CABBannerSection = import_zod19.z.lazy(
|
|
|
1477
1569
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
1478
1570
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
1479
1571
|
*/
|
|
1480
|
-
heading:
|
|
1481
|
-
sectionType:
|
|
1572
|
+
heading: import_zod20.z.record(import_zod20.z.string(), import_zod20.z.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
1573
|
+
sectionType: import_zod20.z.literal(SectionType.banner).default(SectionType.banner)
|
|
1482
1574
|
})
|
|
1483
1575
|
);
|
|
1484
1576
|
|
|
@@ -1683,7 +1775,7 @@ var OFFER_LABELS = {
|
|
|
1683
1775
|
};
|
|
1684
1776
|
|
|
1685
1777
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1686
|
-
var
|
|
1778
|
+
var import_zod21 = require("zod");
|
|
1687
1779
|
|
|
1688
1780
|
// src/schema/widgets/checkout-and-beyond/uiLabels.ts
|
|
1689
1781
|
var UI_LABELS = {
|
|
@@ -1699,8 +1791,8 @@ var UI_LABELS = {
|
|
|
1699
1791
|
};
|
|
1700
1792
|
|
|
1701
1793
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1702
|
-
var localized = (fallback) =>
|
|
1703
|
-
var CABUILabels =
|
|
1794
|
+
var localized = (fallback) => import_zod21.z.record(import_zod21.z.string(), import_zod21.z.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
1795
|
+
var CABUILabels = import_zod21.z.object({
|
|
1704
1796
|
currentPage: localized(UI_LABELS.currentPage),
|
|
1705
1797
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
1706
1798
|
nextPage: localized(UI_LABELS.nextPage),
|
|
@@ -1721,37 +1813,37 @@ var CABUILabels = import_zod20.z.object({
|
|
|
1721
1813
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
1722
1814
|
updating: { ...UI_LABELS.updating }
|
|
1723
1815
|
}));
|
|
1724
|
-
var TargetArea =
|
|
1725
|
-
fill:
|
|
1726
|
-
flip:
|
|
1727
|
-
icon:
|
|
1728
|
-
label:
|
|
1729
|
-
width:
|
|
1816
|
+
var TargetArea = import_zod21.z.object({
|
|
1817
|
+
fill: import_zod21.z.boolean().optional(),
|
|
1818
|
+
flip: import_zod21.z.enum(["both", "horizontal", "vertical"]).optional(),
|
|
1819
|
+
icon: import_zod21.z.string(),
|
|
1820
|
+
label: import_zod21.z.string(),
|
|
1821
|
+
width: import_zod21.z.string()
|
|
1730
1822
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
1731
|
-
var CABTracking =
|
|
1732
|
-
enableAttribution:
|
|
1733
|
-
enableSource:
|
|
1734
|
-
enableWidget:
|
|
1823
|
+
var CABTracking = import_zod21.z.object({
|
|
1824
|
+
enableAttribution: import_zod21.z.boolean().nullish().transform((value) => value ?? true),
|
|
1825
|
+
enableSource: import_zod21.z.boolean().nullish().transform((value) => value ?? true),
|
|
1826
|
+
enableWidget: import_zod21.z.boolean().nullish().transform((value) => value ?? true)
|
|
1735
1827
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
1736
|
-
var CABExperiment =
|
|
1737
|
-
elementId:
|
|
1738
|
-
experimentId:
|
|
1739
|
-
experimentType:
|
|
1740
|
-
selectedId:
|
|
1828
|
+
var CABExperiment = import_zod21.z.object({
|
|
1829
|
+
elementId: import_zod21.z.number(),
|
|
1830
|
+
experimentId: import_zod21.z.number(),
|
|
1831
|
+
experimentType: import_zod21.z.string(),
|
|
1832
|
+
selectedId: import_zod21.z.number()
|
|
1741
1833
|
});
|
|
1742
1834
|
var CABRootSection = CABLayoutSection.extend({
|
|
1743
|
-
editorMode:
|
|
1835
|
+
editorMode: import_zod21.z.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
1744
1836
|
experiment: CABExperiment.optional(),
|
|
1745
1837
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
1746
1838
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
1747
|
-
previewMode:
|
|
1748
|
-
storeId:
|
|
1839
|
+
previewMode: import_zod21.z.boolean().nullish().transform((value) => value ?? false),
|
|
1840
|
+
storeId: import_zod21.z.number().nullable().default(null),
|
|
1749
1841
|
targetArea: TargetArea.nullable(),
|
|
1750
1842
|
tracking: CABTracking,
|
|
1751
|
-
type:
|
|
1843
|
+
type: import_zod21.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
1752
1844
|
uiLabels: CABUILabels,
|
|
1753
|
-
version:
|
|
1754
|
-
widgetId:
|
|
1845
|
+
version: import_zod21.z.literal(2).default(2),
|
|
1846
|
+
widgetId: import_zod21.z.number().nullable().default(null)
|
|
1755
1847
|
});
|
|
1756
1848
|
|
|
1757
1849
|
// src/schema/widgets/checkout-and-beyond/switchLabels.ts
|