@rebuy/rebuy 3.41.0 → 3.43.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 +971 -787
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +971 -787
- package/dist/pricing/index.cjs +58 -1
- package/dist/pricing/index.d.ts +2 -0
- package/dist/pricing/index.mjs +58 -1
- package/dist/pricing/postPurchaseDisplayFacts.d.ts +36 -0
- package/dist/pricing/postPurchaseDisplayPrice.d.ts +8 -0
- package/dist/pricing/postPurchaseReduction.d.ts +17 -0
- package/dist/schema/checkout-and-beyond/constants.cjs +4 -0
- package/dist/schema/checkout-and-beyond/constants.mjs +4 -0
- package/dist/schema/checkout-and-beyond/index.cjs +388 -374
- package/dist/schema/checkout-and-beyond/index.mjs +388 -374
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/postPurchaseAdmission.d.ts +33 -0
- package/dist/schema/postPurchaseDisplayPrice.d.ts +31 -0
- package/dist/schema/postPurchaseFollowups.d.ts +47 -0
- package/dist/schema/postPurchaseHealth.d.ts +5 -0
- package/dist/schema/postPurchasePlanCatalog.d.ts +2 -0
- package/dist/schema/postPurchaseProduct.d.ts +2 -0
- package/dist/schema/postPurchaseProductCollectionView.d.ts +62 -0
- package/dist/schema/postPurchaseProductView.d.ts +65 -0
- package/dist/schema/postPurchaseRecovery.d.ts +47 -0
- package/dist/schema/postPurchaseSubscriptionProduct.d.ts +2 -0
- package/dist/schema/postPurchaseUpgrade.d.ts +117 -0
- package/dist/schema/widget-data.cjs +452 -441
- package/dist/schema/widget-data.mjs +452 -441
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts +14 -0
- package/dist/schema/widgets/checkout-and-beyond/image.d.ts +8 -0
- package/dist/schema/widgets/checkout-and-beyond/imageThumbnails.d.ts +13 -0
- package/dist/schema/widgets/checkout-and-beyond/index.d.ts +1 -0
- package/dist/schema/widgets/checkout-and-beyond/variants.d.ts +1 -0
- package/dist/server/index.cjs +1721 -1419
- package/dist/server/index.mjs +1707 -1405
- package/dist/server/postPurchasePlanCatalog.d.ts +4 -1
- package/dist/server/preparePostPurchaseAdmissionView.d.ts +53 -0
- package/dist/server/preparePostPurchaseCollectionGroup.d.ts +57 -0
- package/dist/server/preparePostPurchaseCollectionView.d.ts +53 -0
- package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +53 -0
- package/dist/server/preparePostPurchaseGroupDefault.d.ts +53 -0
- package/dist/server/preparePostPurchaseGroupView.d.ts +53 -0
- package/dist/server/preparePostPurchaseMemberView.d.ts +159 -0
- package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +53 -0
- package/dist/server/preparePostPurchaseQuantityView.d.ts +53 -0
- package/dist/server/preparePostPurchaseSubscription.d.ts +1 -0
- package/dist/server/selectPostPurchaseChoice.d.ts +1 -0
- package/dist/transforms/index.cjs +980 -581
- package/dist/transforms/index.mjs +980 -581
- package/dist/transforms/postPurchase/convertProductInformation.d.ts +6 -2
- package/dist/transforms/postPurchase/productCardControls.d.ts +7 -0
- package/dist/transforms/postPurchase/productCardCosts.d.ts +3 -0
- package/dist/transforms/postPurchase/productCardPricing.d.ts +3 -0
- package/dist/transforms/postPurchase/productCardRows.d.ts +63 -0
- package/dist/transforms/postPurchase/productCardSettings.d.ts +103 -0
- package/dist/transforms/postPurchase/types.d.ts +2 -2
- package/dist/transforms/productCard/earnedText.d.ts +25 -0
- package/dist/transforms/productCard/priceText.d.ts +2 -0
- package/dist/transforms/productCard/quantitySection.d.ts +28 -0
- package/dist/transforms/productCard/subscriptionToggle.d.ts +18 -0
- package/package.json +1 -1
|
@@ -43,6 +43,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
43
43
|
CABExperiment: () => CABExperiment,
|
|
44
44
|
CABImageSection: () => CABImageSection,
|
|
45
45
|
CABImageSectionFields: () => CABImageSectionFields,
|
|
46
|
+
CABImageThumbnails: () => CABImageThumbnails,
|
|
46
47
|
CABIntegrations: () => CABIntegrations,
|
|
47
48
|
CABLayoutSection: () => CABLayoutSection,
|
|
48
49
|
CABLayoutWrapping: () => CABLayoutWrapping,
|
|
@@ -135,6 +136,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
135
136
|
VariableType: () => VariableType,
|
|
136
137
|
VariantMode: () => VariantMode,
|
|
137
138
|
VariantSelector: () => VariantSelector,
|
|
139
|
+
VariantsMode: () => VariantsMode,
|
|
138
140
|
VerticalAlignment: () => VerticalAlignment,
|
|
139
141
|
WidgetType: () => WidgetType,
|
|
140
142
|
bannerColors: () => bannerColors,
|
|
@@ -204,13 +206,14 @@ __export(checkout_and_beyond_exports, {
|
|
|
204
206
|
variableTypes: () => variableTypes,
|
|
205
207
|
variantModes: () => variantModes,
|
|
206
208
|
variantSelectors: () => variantSelectors,
|
|
209
|
+
variantsModes: () => variantsModes,
|
|
207
210
|
verticalAlignments: () => verticalAlignments,
|
|
208
211
|
widgetTypes: () => widgetTypes
|
|
209
212
|
});
|
|
210
213
|
module.exports = __toCommonJS(checkout_and_beyond_exports);
|
|
211
214
|
|
|
212
215
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
213
|
-
var
|
|
216
|
+
var import_zod22 = require("zod");
|
|
214
217
|
|
|
215
218
|
// src/schema/widgets/checkout-and-beyond/common.ts
|
|
216
219
|
var freezeEnum = (values) => Object.freeze(Object.fromEntries(values.map((v) => [v, v])));
|
|
@@ -386,6 +389,8 @@ var variableTypes = ["boolean", "number", "text"];
|
|
|
386
389
|
var VariableType = freezeEnum(variableTypes);
|
|
387
390
|
var variantModes = ["multiple", "single"];
|
|
388
391
|
var VariantMode = freezeEnum(variantModes);
|
|
392
|
+
var variantsModes = [...variantModes, "productGroup"];
|
|
393
|
+
var VariantsMode = freezeEnum(variantsModes);
|
|
389
394
|
var variantSelectors = ["menu", "radio", "button"];
|
|
390
395
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
391
396
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
@@ -420,18 +425,18 @@ var WidgetType = freezeEnum(widgetTypes);
|
|
|
420
425
|
|
|
421
426
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
422
427
|
var import_uuid13 = require("uuid");
|
|
423
|
-
var
|
|
428
|
+
var import_zod21 = require("zod");
|
|
424
429
|
|
|
425
430
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
426
|
-
var
|
|
431
|
+
var import_zod20 = require("zod");
|
|
427
432
|
|
|
428
433
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
429
434
|
var import_uuid3 = require("uuid");
|
|
430
|
-
var
|
|
435
|
+
var import_zod6 = require("zod");
|
|
431
436
|
|
|
432
437
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
433
438
|
var import_uuid = require("uuid");
|
|
434
|
-
var
|
|
439
|
+
var import_zod4 = require("zod");
|
|
435
440
|
|
|
436
441
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
437
442
|
var iconNames = [
|
|
@@ -517,6 +522,13 @@ var IconSize = freezeEnum(iconSizes);
|
|
|
517
522
|
var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "warning"];
|
|
518
523
|
var IconTone = freezeEnum(iconTones);
|
|
519
524
|
|
|
525
|
+
// src/schema/widgets/checkout-and-beyond/imageThumbnails.ts
|
|
526
|
+
var import_zod = require("zod");
|
|
527
|
+
var CABImageThumbnails = import_zod.z.object({
|
|
528
|
+
limit: import_zod.z.number().int().min(1).default(8),
|
|
529
|
+
perLine: import_zod.z.number().int().min(1).max(8).default(4)
|
|
530
|
+
});
|
|
531
|
+
|
|
520
532
|
// src/schema/widgets/checkout-and-beyond/regex.ts
|
|
521
533
|
var ARRAY_INDEX_STRING = /^(0|[1-9]\d*)$/;
|
|
522
534
|
var DYNAMIC_TOKEN_REGEX = /^\{\{\s*[A-Za-z]+\s*\}\}$/;
|
|
@@ -593,10 +605,10 @@ var isTextType = isSectionType(SectionType.text);
|
|
|
593
605
|
var isVariantsType = isSectionType(SectionType.variants);
|
|
594
606
|
|
|
595
607
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
596
|
-
var
|
|
608
|
+
var import_zod3 = require("zod");
|
|
597
609
|
|
|
598
610
|
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
599
|
-
var
|
|
611
|
+
var import_zod2 = require("zod");
|
|
600
612
|
var ruleTypes = [
|
|
601
613
|
"cart",
|
|
602
614
|
"cart_count",
|
|
@@ -615,7 +627,7 @@ var ruleTypes = [
|
|
|
615
627
|
"product_type",
|
|
616
628
|
"product_vendor"
|
|
617
629
|
];
|
|
618
|
-
var ruleType =
|
|
630
|
+
var ruleType = import_zod2.z.enum(ruleTypes);
|
|
619
631
|
var RuleType = ruleType.enum;
|
|
620
632
|
var ruleOperators = [
|
|
621
633
|
"after",
|
|
@@ -630,124 +642,124 @@ var ruleOperators = [
|
|
|
630
642
|
"greater_than",
|
|
631
643
|
"less_than"
|
|
632
644
|
];
|
|
633
|
-
var ruleOperator =
|
|
645
|
+
var ruleOperator = import_zod2.z.enum(ruleOperators);
|
|
634
646
|
var RuleOperator = ruleOperator.enum;
|
|
635
|
-
var RuleCondition =
|
|
636
|
-
operator:
|
|
637
|
-
products:
|
|
638
|
-
type:
|
|
639
|
-
value:
|
|
647
|
+
var RuleCondition = import_zod2.z.object({
|
|
648
|
+
operator: import_zod2.z.enum(ruleOperators).default(RuleOperator.anything),
|
|
649
|
+
products: import_zod2.z.union([import_zod2.z.array(import_zod2.z.unknown()), import_zod2.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
650
|
+
type: import_zod2.z.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
651
|
+
value: import_zod2.z.coerce.string().default("")
|
|
640
652
|
});
|
|
641
|
-
var RuleLogicBlock =
|
|
642
|
-
rules:
|
|
653
|
+
var RuleLogicBlock = import_zod2.z.object({
|
|
654
|
+
rules: import_zod2.z.array(RuleCondition).default(() => [])
|
|
643
655
|
});
|
|
644
|
-
var CABRulesetEntry =
|
|
645
|
-
exitIfMatched:
|
|
646
|
-
logic:
|
|
647
|
-
output:
|
|
648
|
-
|
|
649
|
-
key:
|
|
650
|
-
type:
|
|
651
|
-
value:
|
|
656
|
+
var CABRulesetEntry = import_zod2.z.object({
|
|
657
|
+
exitIfMatched: import_zod2.z.boolean().default(true),
|
|
658
|
+
logic: import_zod2.z.array(RuleLogicBlock).default(() => []),
|
|
659
|
+
output: import_zod2.z.array(
|
|
660
|
+
import_zod2.z.object({
|
|
661
|
+
key: import_zod2.z.string().default("should_show"),
|
|
662
|
+
type: import_zod2.z.literal("data_json").default("data_json"),
|
|
663
|
+
value: import_zod2.z.string().default("true")
|
|
652
664
|
})
|
|
653
665
|
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
654
666
|
});
|
|
655
|
-
var CABRuleset =
|
|
667
|
+
var CABRuleset = import_zod2.z.union([import_zod2.z.array(CABRulesetEntry), import_zod2.z.strictObject({}).transform(() => [])]).default(() => []);
|
|
656
668
|
|
|
657
669
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
658
|
-
var variableEffect =
|
|
659
|
-
var CABVariableSeed =
|
|
660
|
-
dataSourceId:
|
|
670
|
+
var variableEffect = import_zod3.z.enum(variableEffects);
|
|
671
|
+
var CABVariableSeed = import_zod3.z.object({
|
|
672
|
+
dataSourceId: import_zod3.z.number().nullable().default(null),
|
|
661
673
|
ruleset: CABRuleset
|
|
662
674
|
});
|
|
663
|
-
var CABBooleanVariable =
|
|
675
|
+
var CABBooleanVariable = import_zod3.z.object({
|
|
664
676
|
/**
|
|
665
677
|
* Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
|
|
666
678
|
* from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
|
|
667
679
|
* below; a cross-field default has no `.default()` spelling. An explicit value always wins.
|
|
668
680
|
*/
|
|
669
|
-
defaultValue:
|
|
670
|
-
name:
|
|
681
|
+
defaultValue: import_zod3.z.boolean().optional(),
|
|
682
|
+
name: import_zod3.z.string().min(1),
|
|
671
683
|
seed: CABVariableSeed.optional(),
|
|
672
684
|
/** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
|
|
673
|
-
type:
|
|
685
|
+
type: import_zod3.z.literal(VariableType.boolean).default(VariableType.boolean)
|
|
674
686
|
});
|
|
675
|
-
var CABTextVariable =
|
|
676
|
-
defaultValue:
|
|
677
|
-
name:
|
|
678
|
-
seed:
|
|
679
|
-
type:
|
|
687
|
+
var CABTextVariable = import_zod3.z.object({
|
|
688
|
+
defaultValue: import_zod3.z.string(),
|
|
689
|
+
name: import_zod3.z.string().min(1),
|
|
690
|
+
seed: import_zod3.z.never().optional(),
|
|
691
|
+
type: import_zod3.z.literal(VariableType.text)
|
|
680
692
|
});
|
|
681
|
-
var CABNumberVariable =
|
|
682
|
-
defaultValue:
|
|
683
|
-
name:
|
|
684
|
-
seed:
|
|
685
|
-
type:
|
|
693
|
+
var CABNumberVariable = import_zod3.z.object({
|
|
694
|
+
defaultValue: import_zod3.z.number(),
|
|
695
|
+
name: import_zod3.z.string().min(1),
|
|
696
|
+
seed: import_zod3.z.never().optional(),
|
|
697
|
+
type: import_zod3.z.literal(VariableType.number)
|
|
686
698
|
});
|
|
687
|
-
var CABVariable =
|
|
699
|
+
var CABVariable = import_zod3.z.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
|
|
688
700
|
(variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
|
|
689
701
|
);
|
|
690
|
-
var CABVariableEffect =
|
|
702
|
+
var CABVariableEffect = import_zod3.z.object({
|
|
691
703
|
effect: variableEffect.default(VariableEffect.toggle),
|
|
692
|
-
variable:
|
|
704
|
+
variable: import_zod3.z.string().min(1)
|
|
693
705
|
});
|
|
694
|
-
var CABVisibility =
|
|
695
|
-
variable:
|
|
696
|
-
visibleWhen:
|
|
706
|
+
var CABVisibility = import_zod3.z.object({
|
|
707
|
+
variable: import_zod3.z.string().min(1),
|
|
708
|
+
visibleWhen: import_zod3.z.boolean().default(true)
|
|
697
709
|
});
|
|
698
|
-
var contentOperator =
|
|
699
|
-
var resultCountOperator =
|
|
700
|
-
var resultTagOperator =
|
|
701
|
-
var mutatorEvent =
|
|
702
|
-
var CABContentTrigger =
|
|
710
|
+
var contentOperator = import_zod3.z.enum(contentOperators);
|
|
711
|
+
var resultCountOperator = import_zod3.z.enum(resultCountOperators);
|
|
712
|
+
var resultTagOperator = import_zod3.z.enum(resultTagOperators);
|
|
713
|
+
var mutatorEvent = import_zod3.z.enum(mutatorEvents);
|
|
714
|
+
var CABContentTrigger = import_zod3.z.object({
|
|
703
715
|
operator: contentOperator.default(ContentOperator.is_empty),
|
|
704
|
-
type:
|
|
716
|
+
type: import_zod3.z.literal("content")
|
|
705
717
|
});
|
|
706
|
-
var CABResultCountTrigger =
|
|
718
|
+
var CABResultCountTrigger = import_zod3.z.object({
|
|
707
719
|
operator: resultCountOperator.default(ResultCountOperator.equals),
|
|
708
|
-
type:
|
|
709
|
-
value:
|
|
720
|
+
type: import_zod3.z.literal("result_count"),
|
|
721
|
+
value: import_zod3.z.number().default(0)
|
|
710
722
|
});
|
|
711
|
-
var CABResultTagTrigger =
|
|
723
|
+
var CABResultTagTrigger = import_zod3.z.object({
|
|
712
724
|
operator: resultTagOperator.default(ResultTagOperator.contains),
|
|
713
|
-
type:
|
|
714
|
-
value:
|
|
725
|
+
type: import_zod3.z.literal("result_tag"),
|
|
726
|
+
value: import_zod3.z.string().min(1)
|
|
715
727
|
});
|
|
716
|
-
var CABEventTrigger =
|
|
728
|
+
var CABEventTrigger = import_zod3.z.object({
|
|
717
729
|
event: mutatorEvent,
|
|
718
|
-
type:
|
|
730
|
+
type: import_zod3.z.literal("event")
|
|
719
731
|
});
|
|
720
|
-
var CABVariableTrigger =
|
|
732
|
+
var CABVariableTrigger = import_zod3.z.discriminatedUnion("type", [
|
|
721
733
|
CABContentTrigger,
|
|
722
734
|
CABEventTrigger,
|
|
723
735
|
CABResultCountTrigger,
|
|
724
736
|
CABResultTagTrigger
|
|
725
737
|
]);
|
|
726
|
-
var CABVariableMutator =
|
|
738
|
+
var CABVariableMutator = import_zod3.z.object({
|
|
727
739
|
effect: variableEffect.default(VariableEffect.set_false),
|
|
728
|
-
variable:
|
|
740
|
+
variable: import_zod3.z.string().min(1),
|
|
729
741
|
when: CABVariableTrigger
|
|
730
742
|
});
|
|
731
743
|
var CABVariableFields = {
|
|
732
|
-
mutators:
|
|
733
|
-
variables:
|
|
744
|
+
mutators: import_zod3.z.array(CABVariableMutator).optional(),
|
|
745
|
+
variables: import_zod3.z.array(CABVariable).refine((variables) => new Set(variables.map(({ name }) => name)).size === variables.length, {
|
|
734
746
|
message: "variable names must be unique within a section"
|
|
735
747
|
}).optional(),
|
|
736
748
|
visibility: CABVisibility.optional()
|
|
737
749
|
};
|
|
738
750
|
|
|
739
751
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
740
|
-
var CABImageSectionFields =
|
|
752
|
+
var CABImageSectionFields = import_zod4.z.object({
|
|
741
753
|
...CABVariableFields,
|
|
742
|
-
altText:
|
|
754
|
+
altText: import_zod4.z.string().refine(checkForHTML, NO_HTML).default(""),
|
|
743
755
|
/**
|
|
744
756
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
745
757
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
746
758
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
747
759
|
*/
|
|
748
|
-
aspectRatio:
|
|
749
|
-
border:
|
|
750
|
-
buttonField:
|
|
760
|
+
aspectRatio: import_zod4.z.number().positive().nullable().default(null),
|
|
761
|
+
border: import_zod4.z.lazy(() => CABBorder),
|
|
762
|
+
buttonField: import_zod4.z.enum(buttonFields).optional(),
|
|
751
763
|
/**
|
|
752
764
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
753
765
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -766,29 +778,30 @@ var CABImageSectionFields = import_zod3.z.object({
|
|
|
766
778
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
767
779
|
* the risky half.
|
|
768
780
|
*/
|
|
769
|
-
category:
|
|
781
|
+
category: import_zod4.z.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
770
782
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
771
|
-
iconSize:
|
|
783
|
+
iconSize: import_zod4.z.enum(iconSizes).nullable().default(null),
|
|
772
784
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
773
|
-
iconTone:
|
|
774
|
-
name:
|
|
775
|
-
naturalHeight:
|
|
776
|
-
naturalWidth:
|
|
785
|
+
iconTone: import_zod4.z.enum(iconTones).nullable().default(null),
|
|
786
|
+
name: import_zod4.z.string().optional(),
|
|
787
|
+
naturalHeight: import_zod4.z.number().default(0),
|
|
788
|
+
naturalWidth: import_zod4.z.number().default(0),
|
|
777
789
|
/**
|
|
778
790
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
779
791
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
780
792
|
*/
|
|
781
|
-
objectFit:
|
|
782
|
-
sectionId:
|
|
783
|
-
sectionType:
|
|
793
|
+
objectFit: import_zod4.z.enum(objectFits).default(ObjectFit.contain),
|
|
794
|
+
sectionId: import_zod4.z.uuid().default(() => (0, import_uuid.v7)()),
|
|
795
|
+
sectionType: import_zod4.z.literal(SectionType.image).default(SectionType.image),
|
|
784
796
|
/**
|
|
785
797
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
786
798
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
787
799
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
788
800
|
* server-chosen tier icon actually needs it.
|
|
789
801
|
*/
|
|
790
|
-
source:
|
|
791
|
-
|
|
802
|
+
source: import_zod4.z.union([import_zod4.z.url(), import_zod4.z.literal(""), import_zod4.z.string().regex(DYNAMIC_TOKEN_REGEX), import_zod4.z.enum(iconNames)]).default(""),
|
|
803
|
+
thumbnails: CABImageThumbnails.optional(),
|
|
804
|
+
width: import_zod4.z.number().default(100)
|
|
792
805
|
});
|
|
793
806
|
var iconNameSet = new Set(iconNames);
|
|
794
807
|
var isIconName = (source) => iconNameSet.has(source);
|
|
@@ -810,71 +823,71 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, c
|
|
|
810
823
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
811
824
|
var import_compat2 = require("es-toolkit/compat");
|
|
812
825
|
var import_uuid2 = require("uuid");
|
|
813
|
-
var
|
|
814
|
-
var enumOrOmit = (...vals) =>
|
|
815
|
-
var TiptapText =
|
|
816
|
-
marks:
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
attrs:
|
|
823
|
-
class:
|
|
824
|
-
href:
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
826
|
+
var import_zod5 = require("zod");
|
|
827
|
+
var enumOrOmit = (...vals) => import_zod5.z.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
828
|
+
var TiptapText = import_zod5.z.object({
|
|
829
|
+
marks: import_zod5.z.union([
|
|
830
|
+
import_zod5.z.array(
|
|
831
|
+
import_zod5.z.discriminatedUnion("type", [
|
|
832
|
+
import_zod5.z.object({ type: import_zod5.z.literal("bold") }),
|
|
833
|
+
import_zod5.z.object({ type: import_zod5.z.literal("italic") }),
|
|
834
|
+
import_zod5.z.object({
|
|
835
|
+
attrs: import_zod5.z.object({
|
|
836
|
+
class: import_zod5.z.string().nullable(),
|
|
837
|
+
href: import_zod5.z.union([
|
|
838
|
+
import_zod5.z.url(),
|
|
839
|
+
import_zod5.z.literal("#"),
|
|
840
|
+
import_zod5.z.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
841
|
+
import_zod5.z.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
829
842
|
]),
|
|
830
|
-
rel:
|
|
831
|
-
target:
|
|
843
|
+
rel: import_zod5.z.string().default("noopener noreferrer nofollow"),
|
|
844
|
+
target: import_zod5.z.string().default("_blank")
|
|
832
845
|
}),
|
|
833
|
-
type:
|
|
846
|
+
type: import_zod5.z.literal("link")
|
|
834
847
|
}),
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
attrs:
|
|
848
|
+
import_zod5.z.object({ type: import_zod5.z.literal("strike") }),
|
|
849
|
+
import_zod5.z.object({
|
|
850
|
+
attrs: import_zod5.z.object({
|
|
838
851
|
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
839
852
|
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
840
853
|
}),
|
|
841
|
-
type:
|
|
854
|
+
type: import_zod5.z.literal("textStyle")
|
|
842
855
|
})
|
|
843
856
|
])
|
|
844
857
|
),
|
|
845
|
-
|
|
858
|
+
import_zod5.z.strictObject({}).transform(() => [])
|
|
846
859
|
]).optional(),
|
|
847
|
-
text:
|
|
848
|
-
type:
|
|
860
|
+
text: import_zod5.z.string().default(""),
|
|
861
|
+
type: import_zod5.z.literal("text").default("text")
|
|
849
862
|
});
|
|
850
|
-
var TiptapParagraph =
|
|
851
|
-
attrs:
|
|
863
|
+
var TiptapParagraph = import_zod5.z.object({
|
|
864
|
+
attrs: import_zod5.z.object({
|
|
852
865
|
textAlign: enumOrOmit(...textAlignments)
|
|
853
866
|
}).default({ textAlign: TextAlignment.start }),
|
|
854
|
-
content:
|
|
855
|
-
type:
|
|
867
|
+
content: import_zod5.z.union([import_zod5.z.array(TiptapText), import_zod5.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
868
|
+
type: import_zod5.z.literal("paragraph").default("paragraph")
|
|
856
869
|
});
|
|
857
|
-
var TiptapDocument =
|
|
858
|
-
attrs:
|
|
870
|
+
var TiptapDocument = import_zod5.z.object({
|
|
871
|
+
attrs: import_zod5.z.object({
|
|
859
872
|
blockSpacing: enumOrOmit(...spacings)
|
|
860
873
|
}).default({ blockSpacing: Spacing.base }),
|
|
861
|
-
content:
|
|
862
|
-
type:
|
|
874
|
+
content: import_zod5.z.union([import_zod5.z.array(TiptapParagraph), import_zod5.z.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
875
|
+
type: import_zod5.z.literal("doc").default("doc")
|
|
863
876
|
});
|
|
864
|
-
var CABTextTier =
|
|
865
|
-
threshold:
|
|
866
|
-
thresholds:
|
|
867
|
-
tierId:
|
|
868
|
-
tierType:
|
|
877
|
+
var CABTextTier = import_zod5.z.object({
|
|
878
|
+
threshold: import_zod5.z.number().int().nonnegative(),
|
|
879
|
+
thresholds: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.number().int().nonnegative()).default(() => ({})),
|
|
880
|
+
tierId: import_zod5.z.string().optional(),
|
|
881
|
+
tierType: import_zod5.z.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
869
882
|
});
|
|
870
|
-
var CABTextSection =
|
|
883
|
+
var CABTextSection = import_zod5.z.object({
|
|
871
884
|
...CABVariableFields,
|
|
872
|
-
buttonField:
|
|
873
|
-
content:
|
|
874
|
-
name:
|
|
875
|
-
optionId:
|
|
876
|
-
sectionId:
|
|
877
|
-
sectionType:
|
|
885
|
+
buttonField: import_zod5.z.enum(buttonFields).optional(),
|
|
886
|
+
content: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.union([import_zod5.z.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
887
|
+
name: import_zod5.z.string().optional(),
|
|
888
|
+
optionId: import_zod5.z.number().optional(),
|
|
889
|
+
sectionId: import_zod5.z.uuid().default(() => (0, import_uuid2.v7)()),
|
|
890
|
+
sectionType: import_zod5.z.literal(SectionType.text).default(SectionType.text),
|
|
878
891
|
tier: CABTextTier.optional()
|
|
879
892
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
880
893
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
@@ -896,35 +909,35 @@ var CABTextSection = import_zod4.z.object({
|
|
|
896
909
|
});
|
|
897
910
|
|
|
898
911
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
899
|
-
var CABButtonContent =
|
|
900
|
-
() =>
|
|
912
|
+
var CABButtonContent = import_zod6.z.lazy(
|
|
913
|
+
() => import_zod6.z.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
901
914
|
);
|
|
902
|
-
var CABButtonSection =
|
|
915
|
+
var CABButtonSection = import_zod6.z.object({
|
|
903
916
|
...CABVariableFields,
|
|
904
|
-
action:
|
|
905
|
-
buttonStyle:
|
|
906
|
-
custom:
|
|
907
|
-
color:
|
|
908
|
-
height:
|
|
909
|
-
width:
|
|
917
|
+
action: import_zod6.z.union([import_zod6.z.literal(""), import_zod6.z.enum(buttonActions)]).default(""),
|
|
918
|
+
buttonStyle: import_zod6.z.enum(buttonStyles).default(ButtonStyle.primary),
|
|
919
|
+
custom: import_zod6.z.object({
|
|
920
|
+
color: import_zod6.z.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
921
|
+
height: import_zod6.z.number().default(52),
|
|
922
|
+
width: import_zod6.z.number().default(300)
|
|
910
923
|
}).default({
|
|
911
924
|
color: "#005bd3",
|
|
912
925
|
height: 52,
|
|
913
926
|
width: 300
|
|
914
927
|
}),
|
|
915
|
-
disableDowngrade:
|
|
916
|
-
name:
|
|
917
|
-
optionId:
|
|
918
|
-
popover:
|
|
919
|
-
alignment:
|
|
920
|
-
position:
|
|
928
|
+
disableDowngrade: import_zod6.z.boolean().default(false),
|
|
929
|
+
name: import_zod6.z.string().optional(),
|
|
930
|
+
optionId: import_zod6.z.number().optional(),
|
|
931
|
+
popover: import_zod6.z.object({
|
|
932
|
+
alignment: import_zod6.z.enum(textAlignments).default(TextAlignment.center),
|
|
933
|
+
position: import_zod6.z.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
921
934
|
}).optional().default(() => ({
|
|
922
935
|
alignment: TextAlignment.center,
|
|
923
936
|
position: PopoverPosition.blockStart
|
|
924
937
|
})),
|
|
925
|
-
sectionId:
|
|
926
|
-
sections:
|
|
927
|
-
sectionType:
|
|
938
|
+
sectionId: import_zod6.z.uuid().default(() => (0, import_uuid3.v7)()),
|
|
939
|
+
sections: import_zod6.z.union([import_zod6.z.array(CABButtonContent), import_zod6.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
940
|
+
sectionType: import_zod6.z.literal(SectionType.button).default(SectionType.button),
|
|
928
941
|
/**
|
|
929
942
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
930
943
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -939,25 +952,25 @@ var CABButtonSection = import_zod5.z.object({
|
|
|
939
952
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
940
953
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
941
954
|
*/
|
|
942
|
-
tier:
|
|
955
|
+
tier: import_zod6.z.object({ tierId: import_zod6.z.string().min(1) }).optional(),
|
|
943
956
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
944
|
-
trackingUrl:
|
|
957
|
+
trackingUrl: import_zod6.z.string().optional(),
|
|
945
958
|
/**
|
|
946
959
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
947
960
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
948
961
|
*/
|
|
949
|
-
variableEffects:
|
|
962
|
+
variableEffects: import_zod6.z.array(CABVariableEffect).optional()
|
|
950
963
|
});
|
|
951
964
|
|
|
952
965
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
953
|
-
var
|
|
966
|
+
var import_zod11 = require("zod");
|
|
954
967
|
|
|
955
968
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
956
|
-
var
|
|
969
|
+
var import_zod10 = require("zod");
|
|
957
970
|
|
|
958
971
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
959
972
|
var import_uuid4 = require("uuid");
|
|
960
|
-
var
|
|
973
|
+
var import_zod7 = require("zod");
|
|
961
974
|
|
|
962
975
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
963
976
|
var import_es_toolkit3 = require("es-toolkit");
|
|
@@ -1011,77 +1024,77 @@ var targetAreas = {
|
|
|
1011
1024
|
};
|
|
1012
1025
|
|
|
1013
1026
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
1014
|
-
var CABDiscount =
|
|
1015
|
-
amount:
|
|
1016
|
-
discountedBy:
|
|
1017
|
-
discountedFrom:
|
|
1018
|
-
type:
|
|
1027
|
+
var CABDiscount = import_zod7.z.object({
|
|
1028
|
+
amount: import_zod7.z.union([import_zod7.z.number(), import_zod7.z.string()]).catch(0),
|
|
1029
|
+
discountedBy: import_zod7.z.string().optional(),
|
|
1030
|
+
discountedFrom: import_zod7.z.enum(discountSources).optional().catch(void 0),
|
|
1031
|
+
type: import_zod7.z.enum(discountTypes).catch("none")
|
|
1019
1032
|
});
|
|
1020
|
-
var CABIntegrations =
|
|
1021
|
-
judgeme:
|
|
1022
|
-
junip:
|
|
1023
|
-
klaviyo:
|
|
1024
|
-
loox:
|
|
1025
|
-
okendo:
|
|
1026
|
-
opinew:
|
|
1027
|
-
reviewsio:
|
|
1028
|
-
stamped:
|
|
1029
|
-
yotpo:
|
|
1033
|
+
var CABIntegrations = import_zod7.z.object({
|
|
1034
|
+
judgeme: import_zod7.z.boolean().default(false),
|
|
1035
|
+
junip: import_zod7.z.boolean().default(false),
|
|
1036
|
+
klaviyo: import_zod7.z.boolean().default(false),
|
|
1037
|
+
loox: import_zod7.z.boolean().default(false),
|
|
1038
|
+
okendo: import_zod7.z.boolean().default(false),
|
|
1039
|
+
opinew: import_zod7.z.boolean().default(false),
|
|
1040
|
+
reviewsio: import_zod7.z.boolean().default(false),
|
|
1041
|
+
stamped: import_zod7.z.boolean().default(false),
|
|
1042
|
+
yotpo: import_zod7.z.boolean().default(false)
|
|
1030
1043
|
});
|
|
1031
|
-
var CABVariantLabels =
|
|
1032
|
-
variantOption:
|
|
1033
|
-
variantOptions:
|
|
1044
|
+
var CABVariantLabels = import_zod7.z.object({
|
|
1045
|
+
variantOption: import_zod7.z.string().optional().catch(void 0),
|
|
1046
|
+
variantOptions: import_zod7.z.string().optional().catch(void 0)
|
|
1034
1047
|
});
|
|
1035
|
-
var CABDataSourceSection =
|
|
1036
|
-
dataSourceId:
|
|
1037
|
-
dataSourcePath:
|
|
1048
|
+
var CABDataSourceSection = import_zod7.z.object({
|
|
1049
|
+
dataSourceId: import_zod7.z.number().nullable().default(null),
|
|
1050
|
+
dataSourcePath: import_zod7.z.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
1038
1051
|
discount: CABDiscount.optional(),
|
|
1039
1052
|
integrations: CABIntegrations.optional(),
|
|
1040
|
-
limit:
|
|
1041
|
-
matchVariant:
|
|
1042
|
-
matchVariantOutOfStock:
|
|
1043
|
-
name:
|
|
1044
|
-
productType:
|
|
1045
|
-
sectionId:
|
|
1046
|
-
sectionType:
|
|
1053
|
+
limit: import_zod7.z.number().default(1),
|
|
1054
|
+
matchVariant: import_zod7.z.boolean().default(false),
|
|
1055
|
+
matchVariantOutOfStock: import_zod7.z.boolean().default(false),
|
|
1056
|
+
name: import_zod7.z.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
1057
|
+
productType: import_zod7.z.enum(productTypes).optional(),
|
|
1058
|
+
sectionId: import_zod7.z.uuid().default(() => (0, import_uuid4.v7)()),
|
|
1059
|
+
sectionType: import_zod7.z.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
1047
1060
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
1048
|
-
subscriptionIsDefault:
|
|
1049
|
-
treatAsGwp:
|
|
1061
|
+
subscriptionIsDefault: import_zod7.z.boolean().default(false),
|
|
1062
|
+
treatAsGwp: import_zod7.z.boolean().default(false),
|
|
1050
1063
|
variantLabels: CABVariantLabels.optional().catch(void 0)
|
|
1051
1064
|
});
|
|
1052
1065
|
|
|
1053
1066
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
1054
1067
|
var import_uuid6 = require("uuid");
|
|
1055
|
-
var
|
|
1068
|
+
var import_zod9 = require("zod");
|
|
1056
1069
|
|
|
1057
1070
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
1058
1071
|
var import_uuid5 = require("uuid");
|
|
1059
|
-
var
|
|
1060
|
-
var CABVariantContent =
|
|
1061
|
-
() =>
|
|
1072
|
+
var import_zod8 = require("zod");
|
|
1073
|
+
var CABVariantContent = import_zod8.z.lazy(
|
|
1074
|
+
() => import_zod8.z.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
1062
1075
|
);
|
|
1063
|
-
var CABProductSection =
|
|
1076
|
+
var CABProductSection = import_zod8.z.object({
|
|
1064
1077
|
...CABVariableFields,
|
|
1065
|
-
name:
|
|
1066
|
-
productId:
|
|
1067
|
-
sectionId:
|
|
1068
|
-
sections:
|
|
1069
|
-
sectionType:
|
|
1070
|
-
selectors:
|
|
1071
|
-
variantMode:
|
|
1078
|
+
name: import_zod8.z.string().optional(),
|
|
1079
|
+
productId: import_zod8.z.number().nullable().default(null),
|
|
1080
|
+
sectionId: import_zod8.z.uuid().default(() => (0, import_uuid5.v7)()),
|
|
1081
|
+
sections: import_zod8.z.union([import_zod8.z.array(CABVariantContent), import_zod8.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
1082
|
+
sectionType: import_zod8.z.literal(SectionType.product).default(SectionType.product),
|
|
1083
|
+
selectors: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
1084
|
+
variantMode: import_zod8.z.enum(variantModes).default(VariantMode.multiple)
|
|
1072
1085
|
});
|
|
1073
1086
|
|
|
1074
1087
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
1075
|
-
var CABProductsSection =
|
|
1088
|
+
var CABProductsSection = import_zod9.z.object({
|
|
1076
1089
|
...CABVariableFields,
|
|
1077
|
-
name:
|
|
1078
|
-
sectionId:
|
|
1079
|
-
sections:
|
|
1080
|
-
sectionType:
|
|
1090
|
+
name: import_zod9.z.string().optional(),
|
|
1091
|
+
sectionId: import_zod9.z.uuid().default(() => (0, import_uuid6.v7)()),
|
|
1092
|
+
sections: import_zod9.z.union([import_zod9.z.array(import_zod9.z.lazy(() => CABProductSection)), import_zod9.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
1093
|
+
sectionType: import_zod9.z.literal(SectionType.products).default(SectionType.products)
|
|
1081
1094
|
});
|
|
1082
1095
|
|
|
1083
1096
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
1084
|
-
var CABOffersSection =
|
|
1097
|
+
var CABOffersSection = import_zod10.z.lazy(
|
|
1085
1098
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
1086
1099
|
/**
|
|
1087
1100
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -1089,8 +1102,8 @@ var CABOffersSection = import_zod9.z.lazy(
|
|
|
1089
1102
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
1090
1103
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
1091
1104
|
*/
|
|
1092
|
-
divider:
|
|
1093
|
-
sections:
|
|
1105
|
+
divider: import_zod10.z.boolean().optional(),
|
|
1106
|
+
sections: import_zod10.z.union([import_zod10.z.array(import_zod10.z.lazy(() => CABSection)), import_zod10.z.strictObject({}).transform(() => [])]).default(() => [
|
|
1094
1107
|
CABBannerSection.parse({
|
|
1095
1108
|
buttonField: "undoAddToOrder",
|
|
1096
1109
|
color: "success",
|
|
@@ -1104,77 +1117,77 @@ var CABOffersSection = import_zod9.z.lazy(
|
|
|
1104
1117
|
CABDataSourceSection.parse({}),
|
|
1105
1118
|
CABProductsSection.parse({})
|
|
1106
1119
|
]),
|
|
1107
|
-
sectionType:
|
|
1120
|
+
sectionType: import_zod10.z.literal(SectionType.offers).default(SectionType.offers)
|
|
1108
1121
|
})
|
|
1109
1122
|
);
|
|
1110
1123
|
|
|
1111
1124
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
1112
|
-
var CABCarouselSection =
|
|
1125
|
+
var CABCarouselSection = import_zod11.z.lazy(
|
|
1113
1126
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
1114
|
-
autoAdvanceInterval:
|
|
1115
|
-
itemsAtOnce:
|
|
1127
|
+
autoAdvanceInterval: import_zod11.z.number().default(0),
|
|
1128
|
+
itemsAtOnce: import_zod11.z.number().min(1).default(1),
|
|
1116
1129
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
1117
|
-
offersDirection:
|
|
1118
|
-
sections:
|
|
1119
|
-
sectionType:
|
|
1130
|
+
offersDirection: import_zod11.z.enum(offersDirections).default("vertical"),
|
|
1131
|
+
sections: import_zod11.z.union([import_zod11.z.array(import_zod11.z.lazy(() => CABSection)), import_zod11.z.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
1132
|
+
sectionType: import_zod11.z.literal(SectionType.carousel).default(SectionType.carousel)
|
|
1120
1133
|
})
|
|
1121
1134
|
);
|
|
1122
1135
|
|
|
1123
1136
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
1124
|
-
var
|
|
1125
|
-
var CABCartLineSection =
|
|
1137
|
+
var import_zod12 = require("zod");
|
|
1138
|
+
var CABCartLineSection = import_zod12.z.lazy(
|
|
1126
1139
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
1127
|
-
sections:
|
|
1128
|
-
sectionType:
|
|
1140
|
+
sections: import_zod12.z.union([import_zod12.z.array(import_zod12.z.lazy(() => CABSection)), import_zod12.z.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
1141
|
+
sectionType: import_zod12.z.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
1129
1142
|
})
|
|
1130
1143
|
);
|
|
1131
1144
|
|
|
1132
1145
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
1133
1146
|
var import_uuid7 = require("uuid");
|
|
1134
|
-
var
|
|
1135
|
-
var CABDiscountSection =
|
|
1147
|
+
var import_zod13 = require("zod");
|
|
1148
|
+
var CABDiscountSection = import_zod13.z.object({
|
|
1136
1149
|
...CABVariableFields,
|
|
1137
|
-
amount:
|
|
1138
|
-
discountedBy:
|
|
1139
|
-
discountedFrom:
|
|
1140
|
-
message:
|
|
1141
|
-
name:
|
|
1142
|
-
quantity:
|
|
1143
|
-
sectionId:
|
|
1144
|
-
sectionType:
|
|
1145
|
-
type:
|
|
1150
|
+
amount: import_zod13.z.union([import_zod13.z.number(), import_zod13.z.string()]).catch(0),
|
|
1151
|
+
discountedBy: import_zod13.z.string().optional(),
|
|
1152
|
+
discountedFrom: import_zod13.z.enum(discountSources).optional().catch(void 0),
|
|
1153
|
+
message: import_zod13.z.string().optional(),
|
|
1154
|
+
name: import_zod13.z.string().optional(),
|
|
1155
|
+
quantity: import_zod13.z.number().default(1),
|
|
1156
|
+
sectionId: import_zod13.z.uuid().default(() => (0, import_uuid7.v7)()),
|
|
1157
|
+
sectionType: import_zod13.z.literal(SectionType.discount).default(SectionType.discount),
|
|
1158
|
+
type: import_zod13.z.enum(discountTypes).catch("none")
|
|
1146
1159
|
});
|
|
1147
1160
|
|
|
1148
1161
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
1149
1162
|
var import_uuid8 = require("uuid");
|
|
1150
|
-
var
|
|
1151
|
-
var CABMonetizeAds =
|
|
1152
|
-
requestId:
|
|
1163
|
+
var import_zod14 = require("zod");
|
|
1164
|
+
var CABMonetizeAds = import_zod14.z.object({
|
|
1165
|
+
requestId: import_zod14.z.string().optional(),
|
|
1153
1166
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
1154
|
-
testing:
|
|
1167
|
+
testing: import_zod14.z.boolean().default(false)
|
|
1155
1168
|
});
|
|
1156
|
-
var CABMonetizeSection =
|
|
1169
|
+
var CABMonetizeSection = import_zod14.z.object({
|
|
1157
1170
|
...CABVariableFields,
|
|
1158
1171
|
ads: CABMonetizeAds.optional(),
|
|
1159
|
-
name:
|
|
1172
|
+
name: import_zod14.z.string().optional(),
|
|
1160
1173
|
/**
|
|
1161
1174
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
1162
1175
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
1163
1176
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
1164
1177
|
*/
|
|
1165
|
-
offers:
|
|
1178
|
+
offers: import_zod14.z.array(import_zod14.z.lazy(() => CABSection)).optional(),
|
|
1166
1179
|
/** Privacy Policy footer href (the widget's `privacy_policy_url` setting); read server-side for hydration, relayed by the client only on the legacy `/cab/monetize` fallback. */
|
|
1167
|
-
privacyPolicyUrl:
|
|
1168
|
-
sectionId:
|
|
1169
|
-
sectionType:
|
|
1180
|
+
privacyPolicyUrl: import_zod14.z.string().optional(),
|
|
1181
|
+
sectionId: import_zod14.z.uuid().default(() => (0, import_uuid8.v7)()),
|
|
1182
|
+
sectionType: import_zod14.z.literal(SectionType.monetize).default(SectionType.monetize),
|
|
1170
1183
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
1171
|
-
subVertical:
|
|
1184
|
+
subVertical: import_zod14.z.string().optional(),
|
|
1172
1185
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
1173
|
-
vertical:
|
|
1186
|
+
vertical: import_zod14.z.string().optional()
|
|
1174
1187
|
});
|
|
1175
1188
|
|
|
1176
1189
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
1177
|
-
var
|
|
1190
|
+
var import_zod15 = require("zod");
|
|
1178
1191
|
|
|
1179
1192
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
1180
1193
|
var GIFT_LABELS = {
|
|
@@ -1293,34 +1306,34 @@ var GIFT_LABELS = {
|
|
|
1293
1306
|
};
|
|
1294
1307
|
|
|
1295
1308
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
1296
|
-
var CABProgressTierExclusion =
|
|
1297
|
-
collectionIds:
|
|
1298
|
-
productIds:
|
|
1299
|
-
tags:
|
|
1300
|
-
type:
|
|
1309
|
+
var CABProgressTierExclusion = import_zod15.z.object({
|
|
1310
|
+
collectionIds: import_zod15.z.array(import_zod15.z.number().int().positive()).default(() => []),
|
|
1311
|
+
productIds: import_zod15.z.array(import_zod15.z.number().int().positive()).default(() => []),
|
|
1312
|
+
tags: import_zod15.z.array(import_zod15.z.string().min(1)).default(() => []),
|
|
1313
|
+
type: import_zod15.z.enum(progressTierExclusionTypes)
|
|
1301
1314
|
});
|
|
1302
|
-
var CABProgressTier =
|
|
1315
|
+
var CABProgressTier = import_zod15.z.object({
|
|
1303
1316
|
/**
|
|
1304
1317
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
1305
1318
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
1306
1319
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
1307
1320
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
1308
1321
|
*/
|
|
1309
|
-
discount:
|
|
1322
|
+
discount: import_zod15.z.object({ amount: import_zod15.z.number().nonnegative(), type: import_zod15.z.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
1310
1323
|
/**
|
|
1311
1324
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
1312
1325
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
1313
1326
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
1314
1327
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
1315
1328
|
*/
|
|
1316
|
-
exclusions:
|
|
1329
|
+
exclusions: import_zod15.z.array(CABProgressTierExclusion).default(() => []),
|
|
1317
1330
|
/**
|
|
1318
1331
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
1319
1332
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
1320
1333
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
1321
1334
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
1322
1335
|
*/
|
|
1323
|
-
filterOosVariants:
|
|
1336
|
+
filterOosVariants: import_zod15.z.boolean().default(false),
|
|
1324
1337
|
/**
|
|
1325
1338
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
1326
1339
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -1328,10 +1341,10 @@ var CABProgressTier = import_zod14.z.object({
|
|
|
1328
1341
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
1329
1342
|
* tree is complete.
|
|
1330
1343
|
*/
|
|
1331
|
-
gift:
|
|
1332
|
-
productId:
|
|
1333
|
-
title:
|
|
1334
|
-
variantIds:
|
|
1344
|
+
gift: import_zod15.z.object({
|
|
1345
|
+
productId: import_zod15.z.number().int().positive(),
|
|
1346
|
+
title: import_zod15.z.string().optional(),
|
|
1347
|
+
variantIds: import_zod15.z.array(import_zod15.z.number().int().positive()).default(() => [])
|
|
1335
1348
|
}).optional(),
|
|
1336
1349
|
/**
|
|
1337
1350
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -1351,7 +1364,7 @@ var CABProgressTier = import_zod14.z.object({
|
|
|
1351
1364
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
1352
1365
|
* React's size rather than the old hardcoded 20.
|
|
1353
1366
|
*/
|
|
1354
|
-
iconSizePx:
|
|
1367
|
+
iconSizePx: import_zod15.z.number().int().min(1).max(64).default(18),
|
|
1355
1368
|
/**
|
|
1356
1369
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
1357
1370
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -1361,35 +1374,35 @@ var CABProgressTier = import_zod14.z.object({
|
|
|
1361
1374
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
1362
1375
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
1363
1376
|
*/
|
|
1364
|
-
label:
|
|
1377
|
+
label: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string()).optional(),
|
|
1365
1378
|
/**
|
|
1366
1379
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
1367
1380
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
1368
1381
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
1369
1382
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
1370
1383
|
*/
|
|
1371
|
-
productTierImage:
|
|
1384
|
+
productTierImage: import_zod15.z.boolean().default(false),
|
|
1372
1385
|
/**
|
|
1373
1386
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
1374
1387
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
1375
1388
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
1376
1389
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
1377
1390
|
*/
|
|
1378
|
-
threshold:
|
|
1391
|
+
threshold: import_zod15.z.number().int().nonnegative(),
|
|
1379
1392
|
/**
|
|
1380
1393
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
1381
1394
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
1382
1395
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
1383
1396
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
1384
1397
|
*/
|
|
1385
|
-
thresholds:
|
|
1398
|
+
thresholds: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.number().int().nonnegative()).default(() => ({})),
|
|
1386
1399
|
/**
|
|
1387
1400
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
1388
1401
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
1389
1402
|
* shipping bar (single unlabeled tier, no gift).
|
|
1390
1403
|
*/
|
|
1391
|
-
tierId:
|
|
1392
|
-
tierType:
|
|
1404
|
+
tierId: import_zod15.z.string().optional(),
|
|
1405
|
+
tierType: import_zod15.z.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
1393
1406
|
/**
|
|
1394
1407
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
1395
1408
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -1400,9 +1413,9 @@ var CABProgressTier = import_zod14.z.object({
|
|
|
1400
1413
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
1401
1414
|
* template text supplies grammatically-neutral wording around the token.
|
|
1402
1415
|
*/
|
|
1403
|
-
unit:
|
|
1416
|
+
unit: import_zod15.z.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
1404
1417
|
});
|
|
1405
|
-
var CABProgressBarSection =
|
|
1418
|
+
var CABProgressBarSection = import_zod15.z.lazy(
|
|
1406
1419
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1407
1420
|
/**
|
|
1408
1421
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -1411,35 +1424,35 @@ var CABProgressBarSection = import_zod14.z.lazy(
|
|
|
1411
1424
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
1412
1425
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
1413
1426
|
*/
|
|
1414
|
-
barId:
|
|
1427
|
+
barId: import_zod15.z.string().optional(),
|
|
1415
1428
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
1416
|
-
countryCodes:
|
|
1429
|
+
countryCodes: import_zod15.z.array(import_zod15.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1417
1430
|
/**
|
|
1418
1431
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
1419
1432
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
1420
1433
|
*/
|
|
1421
|
-
excludeCountryCodes:
|
|
1434
|
+
excludeCountryCodes: import_zod15.z.array(import_zod15.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1422
1435
|
/**
|
|
1423
1436
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
1424
1437
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
1425
1438
|
* adds the cart's discount allocations back to the live subtotal.
|
|
1426
1439
|
*/
|
|
1427
|
-
excludeDiscountInSubtotal:
|
|
1440
|
+
excludeDiscountInSubtotal: import_zod15.z.boolean().default(false),
|
|
1428
1441
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
1429
|
-
excludedVariantIds:
|
|
1442
|
+
excludedVariantIds: import_zod15.z.array(import_zod15.z.number().int().positive()).default(() => []),
|
|
1430
1443
|
/**
|
|
1431
1444
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
1432
1445
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
1433
1446
|
*/
|
|
1434
|
-
freeShippingOnSubscription:
|
|
1447
|
+
freeShippingOnSubscription: import_zod15.z.boolean().default(false),
|
|
1435
1448
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
1436
|
-
giftAreaTitle:
|
|
1449
|
+
giftAreaTitle: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
1437
1450
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
1438
|
-
giftLabels:
|
|
1439
|
-
addGift:
|
|
1440
|
-
remove:
|
|
1441
|
-
selectOptions:
|
|
1442
|
-
yourGift:
|
|
1451
|
+
giftLabels: import_zod15.z.object({
|
|
1452
|
+
addGift: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
1453
|
+
remove: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
1454
|
+
selectOptions: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
1455
|
+
yourGift: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
1443
1456
|
}).default(() => ({
|
|
1444
1457
|
addGift: { ...GIFT_LABELS.addGift },
|
|
1445
1458
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -1447,38 +1460,38 @@ var CABProgressBarSection = import_zod14.z.lazy(
|
|
|
1447
1460
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
1448
1461
|
})),
|
|
1449
1462
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
1450
|
-
name:
|
|
1463
|
+
name: import_zod15.z.string().default("Order progress"),
|
|
1451
1464
|
/**
|
|
1452
1465
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
1453
1466
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
1454
1467
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
1455
1468
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
1456
1469
|
*/
|
|
1457
|
-
progressColor:
|
|
1458
|
-
sectionType:
|
|
1470
|
+
progressColor: import_zod15.z.string().optional(),
|
|
1471
|
+
sectionType: import_zod15.z.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
1459
1472
|
/**
|
|
1460
1473
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
1461
1474
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
1462
1475
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
1463
1476
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
1464
1477
|
*/
|
|
1465
|
-
tiers:
|
|
1478
|
+
tiers: import_zod15.z.union([import_zod15.z.array(CABProgressTier), import_zod15.z.strictObject({}).transform(() => [])]).default(() => [])
|
|
1466
1479
|
})
|
|
1467
1480
|
);
|
|
1468
1481
|
|
|
1469
1482
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
1470
1483
|
var import_uuid9 = require("uuid");
|
|
1471
|
-
var
|
|
1472
|
-
var CABQuantitySection =
|
|
1484
|
+
var import_zod16 = require("zod");
|
|
1485
|
+
var CABQuantitySection = import_zod16.z.object({
|
|
1473
1486
|
...CABVariableFields,
|
|
1474
|
-
errorMessages:
|
|
1475
|
-
|
|
1476
|
-
|
|
1487
|
+
errorMessages: import_zod16.z.record(
|
|
1488
|
+
import_zod16.z.string(),
|
|
1489
|
+
import_zod16.z.object({
|
|
1477
1490
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
1478
|
-
increment:
|
|
1479
|
-
max:
|
|
1480
|
-
min:
|
|
1481
|
-
neg:
|
|
1491
|
+
increment: import_zod16.z.string().optional(),
|
|
1492
|
+
max: import_zod16.z.string().optional(),
|
|
1493
|
+
min: import_zod16.z.string().optional(),
|
|
1494
|
+
neg: import_zod16.z.string().optional()
|
|
1482
1495
|
})
|
|
1483
1496
|
).default({
|
|
1484
1497
|
en: {
|
|
@@ -1488,18 +1501,18 @@ var CABQuantitySection = import_zod15.z.object({
|
|
|
1488
1501
|
neg: "Quantity cannot be negative"
|
|
1489
1502
|
}
|
|
1490
1503
|
}),
|
|
1491
|
-
inputType:
|
|
1492
|
-
max:
|
|
1493
|
-
min:
|
|
1504
|
+
inputType: import_zod16.z.enum(quantityInputs).default(QuantityInput.select),
|
|
1505
|
+
max: import_zod16.z.number().min(1).max(100).default(10),
|
|
1506
|
+
min: import_zod16.z.number().min(1).default(1),
|
|
1494
1507
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
1495
|
-
name:
|
|
1496
|
-
sectionId:
|
|
1497
|
-
sectionType:
|
|
1508
|
+
name: import_zod16.z.string().default("Quantity"),
|
|
1509
|
+
sectionId: import_zod16.z.uuid().default(() => (0, import_uuid9.v7)()),
|
|
1510
|
+
sectionType: import_zod16.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1498
1511
|
});
|
|
1499
1512
|
|
|
1500
1513
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1501
1514
|
var import_uuid10 = require("uuid");
|
|
1502
|
-
var
|
|
1515
|
+
var import_zod17 = require("zod");
|
|
1503
1516
|
|
|
1504
1517
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
1505
1518
|
var REVIEW_LABELS = {
|
|
@@ -1562,68 +1575,69 @@ var REVIEW_LABELS = {
|
|
|
1562
1575
|
};
|
|
1563
1576
|
|
|
1564
1577
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1565
|
-
var CABReviewsSection =
|
|
1578
|
+
var CABReviewsSection = import_zod17.z.object({
|
|
1566
1579
|
...CABVariableFields,
|
|
1567
|
-
color:
|
|
1580
|
+
color: import_zod17.z.string().default("#fadb14"),
|
|
1568
1581
|
/**
|
|
1569
1582
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
1570
1583
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
1571
1584
|
* or merchant work.
|
|
1572
1585
|
*/
|
|
1573
|
-
countLabels:
|
|
1574
|
-
one:
|
|
1575
|
-
other:
|
|
1586
|
+
countLabels: import_zod17.z.object({
|
|
1587
|
+
one: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
1588
|
+
other: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
1576
1589
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
1577
|
-
name:
|
|
1578
|
-
sectionId:
|
|
1579
|
-
sectionType:
|
|
1580
|
-
size:
|
|
1590
|
+
name: import_zod17.z.string().optional(),
|
|
1591
|
+
sectionId: import_zod17.z.uuid().default(() => (0, import_uuid10.v7)()),
|
|
1592
|
+
sectionType: import_zod17.z.literal(SectionType.reviews).default(SectionType.reviews),
|
|
1593
|
+
size: import_zod17.z.enum(reviewsSizes).default(ReviewsSize.default),
|
|
1581
1594
|
/**
|
|
1582
1595
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
1583
1596
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
1584
1597
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
1585
1598
|
* the whole reviews section.
|
|
1586
1599
|
*/
|
|
1587
|
-
strokeColor:
|
|
1600
|
+
strokeColor: import_zod17.z.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
1588
1601
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
1589
|
-
strokeWidth:
|
|
1602
|
+
strokeWidth: import_zod17.z.number().nonnegative().default(0)
|
|
1590
1603
|
});
|
|
1591
1604
|
|
|
1592
1605
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
1593
1606
|
var import_uuid11 = require("uuid");
|
|
1594
|
-
var
|
|
1595
|
-
var CABSeparatorSection =
|
|
1607
|
+
var import_zod18 = require("zod");
|
|
1608
|
+
var CABSeparatorSection = import_zod18.z.object({
|
|
1596
1609
|
...CABVariableFields,
|
|
1597
|
-
sectionId:
|
|
1598
|
-
sectionType:
|
|
1610
|
+
sectionId: import_zod18.z.uuid().default(() => (0, import_uuid11.v7)()),
|
|
1611
|
+
sectionType: import_zod18.z.literal(SectionType.separator).default(SectionType.separator)
|
|
1599
1612
|
});
|
|
1600
1613
|
|
|
1601
1614
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
1602
1615
|
var import_compat3 = require("es-toolkit/compat");
|
|
1603
1616
|
var import_uuid12 = require("uuid");
|
|
1604
|
-
var
|
|
1605
|
-
var CABVariantsSection =
|
|
1617
|
+
var import_zod19 = require("zod");
|
|
1618
|
+
var CABVariantsSection = import_zod19.z.object({
|
|
1606
1619
|
...CABVariableFields,
|
|
1607
|
-
hideOutOfStockVariants:
|
|
1608
|
-
name:
|
|
1609
|
-
sectionId:
|
|
1610
|
-
sectionType:
|
|
1611
|
-
selector:
|
|
1612
|
-
|
|
1620
|
+
hideOutOfStockVariants: import_zod19.z.boolean().default(false),
|
|
1621
|
+
name: import_zod19.z.string().optional(),
|
|
1622
|
+
sectionId: import_zod19.z.uuid().default(() => (0, import_uuid12.v7)()),
|
|
1623
|
+
sectionType: import_zod19.z.literal(SectionType.variants).default(SectionType.variants),
|
|
1624
|
+
selector: import_zod19.z.enum((0, import_compat3.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
1625
|
+
/** `productGroup` is additive (REB-24817): a renderer without group support must render nothing for it. */
|
|
1626
|
+
variantMode: import_zod19.z.enum(variantsModes).default(VariantsMode.multiple)
|
|
1613
1627
|
});
|
|
1614
1628
|
|
|
1615
1629
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
1616
|
-
var CABBorder =
|
|
1617
|
-
radius:
|
|
1618
|
-
style:
|
|
1619
|
-
width:
|
|
1630
|
+
var CABBorder = import_zod20.z.object({
|
|
1631
|
+
radius: import_zod20.z.enum(borderRadii).default(BorderRadius.base),
|
|
1632
|
+
style: import_zod20.z.enum(borderStyles).default(BorderStyle.none),
|
|
1633
|
+
width: import_zod20.z.enum(borderWidths).default(BorderWidth.base)
|
|
1620
1634
|
}).default({
|
|
1621
1635
|
radius: BorderRadius.base,
|
|
1622
1636
|
style: BorderStyle.none,
|
|
1623
1637
|
width: BorderWidth.base
|
|
1624
1638
|
});
|
|
1625
|
-
var CABSection =
|
|
1626
|
-
() =>
|
|
1639
|
+
var CABSection = import_zod20.z.lazy(
|
|
1640
|
+
() => import_zod20.z.discriminatedUnion("sectionType", [
|
|
1627
1641
|
CABBannerSection,
|
|
1628
1642
|
CABButtonSection,
|
|
1629
1643
|
CABCarouselSection,
|
|
@@ -1646,50 +1660,50 @@ var CABSection = import_zod19.z.lazy(
|
|
|
1646
1660
|
);
|
|
1647
1661
|
|
|
1648
1662
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
1649
|
-
var GridItem =
|
|
1650
|
-
var CABLayoutWrapping =
|
|
1651
|
-
breakAt:
|
|
1652
|
-
maxPerLine:
|
|
1663
|
+
var GridItem = import_zod21.z.union([import_zod21.z.literal("auto"), import_zod21.z.literal("fill"), import_zod21.z.string().regex(/^\d+%$/), import_zod21.z.number()]);
|
|
1664
|
+
var CABLayoutWrapping = import_zod21.z.object({
|
|
1665
|
+
breakAt: import_zod21.z.number().positive(),
|
|
1666
|
+
maxPerLine: import_zod21.z.number().int().positive()
|
|
1653
1667
|
});
|
|
1654
|
-
var CABLayoutSection =
|
|
1668
|
+
var CABLayoutSection = import_zod21.z.object({
|
|
1655
1669
|
...CABVariableFields,
|
|
1656
|
-
alignment:
|
|
1657
|
-
horizontal:
|
|
1658
|
-
vertical:
|
|
1670
|
+
alignment: import_zod21.z.object({
|
|
1671
|
+
horizontal: import_zod21.z.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
1672
|
+
vertical: import_zod21.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
1659
1673
|
}).default({
|
|
1660
1674
|
horizontal: HorizontalAlignment.start,
|
|
1661
1675
|
vertical: VerticalAlignment.top
|
|
1662
1676
|
}),
|
|
1663
|
-
border:
|
|
1664
|
-
buttonField:
|
|
1665
|
-
direction:
|
|
1677
|
+
border: import_zod21.z.lazy(() => CABBorder),
|
|
1678
|
+
buttonField: import_zod21.z.enum(buttonFields).optional(),
|
|
1679
|
+
direction: import_zod21.z.enum(directions).default(Direction.rows),
|
|
1666
1680
|
/**
|
|
1667
1681
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
1668
1682
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
1669
1683
|
*/
|
|
1670
|
-
frame:
|
|
1671
|
-
grid:
|
|
1672
|
-
columns:
|
|
1673
|
-
rows:
|
|
1684
|
+
frame: import_zod21.z.enum(layoutFrames).optional(),
|
|
1685
|
+
grid: import_zod21.z.object({
|
|
1686
|
+
columns: import_zod21.z.union([import_zod21.z.array(GridItem), import_zod21.z.undefined()]).default(() => ["auto"]),
|
|
1687
|
+
rows: import_zod21.z.union([import_zod21.z.array(GridItem), import_zod21.z.undefined()]).default(() => ["auto"])
|
|
1674
1688
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
1675
|
-
name:
|
|
1676
|
-
padding:
|
|
1677
|
-
sectionId:
|
|
1678
|
-
sections:
|
|
1679
|
-
sectionType:
|
|
1680
|
-
spacing:
|
|
1689
|
+
name: import_zod21.z.string().optional(),
|
|
1690
|
+
padding: import_zod21.z.enum(spacings).default(Spacing.none),
|
|
1691
|
+
sectionId: import_zod21.z.uuid().default(() => (0, import_uuid13.v7)()),
|
|
1692
|
+
sections: import_zod21.z.union([import_zod21.z.array(import_zod21.z.lazy(() => CABSection)), import_zod21.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
1693
|
+
sectionType: import_zod21.z.literal(SectionType.layout).default(SectionType.layout),
|
|
1694
|
+
spacing: import_zod21.z.enum(spacings).default(Spacing.base),
|
|
1681
1695
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
1682
|
-
viewUrl:
|
|
1683
|
-
width:
|
|
1696
|
+
viewUrl: import_zod21.z.string().optional(),
|
|
1697
|
+
width: import_zod21.z.number().default(100),
|
|
1684
1698
|
wrapping: CABLayoutWrapping.optional()
|
|
1685
1699
|
});
|
|
1686
1700
|
|
|
1687
1701
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
1688
|
-
var CABBannerSection =
|
|
1702
|
+
var CABBannerSection = import_zod22.z.lazy(
|
|
1689
1703
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1690
|
-
buttonField:
|
|
1691
|
-
color:
|
|
1692
|
-
dismissible:
|
|
1704
|
+
buttonField: import_zod22.z.enum(buttonFields).optional(),
|
|
1705
|
+
color: import_zod22.z.enum(bannerColors).default("info"),
|
|
1706
|
+
dismissible: import_zod22.z.boolean().default(true),
|
|
1693
1707
|
/**
|
|
1694
1708
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
1695
1709
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -1705,8 +1719,8 @@ var CABBannerSection = import_zod21.z.lazy(
|
|
|
1705
1719
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
1706
1720
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
1707
1721
|
*/
|
|
1708
|
-
heading:
|
|
1709
|
-
sectionType:
|
|
1722
|
+
heading: import_zod22.z.record(import_zod22.z.string(), import_zod22.z.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
1723
|
+
sectionType: import_zod22.z.literal(SectionType.banner).default(SectionType.banner)
|
|
1710
1724
|
})
|
|
1711
1725
|
);
|
|
1712
1726
|
|
|
@@ -1943,7 +1957,7 @@ var OFFER_LABELS = {
|
|
|
1943
1957
|
};
|
|
1944
1958
|
|
|
1945
1959
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1946
|
-
var
|
|
1960
|
+
var import_zod23 = require("zod");
|
|
1947
1961
|
|
|
1948
1962
|
// src/schema/widgets/checkout-and-beyond/uiLabels.ts
|
|
1949
1963
|
var UI_LABELS = {
|
|
@@ -1963,8 +1977,8 @@ var UI_LABELS = {
|
|
|
1963
1977
|
};
|
|
1964
1978
|
|
|
1965
1979
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1966
|
-
var localized = (fallback) =>
|
|
1967
|
-
var CABUILabels =
|
|
1980
|
+
var localized = (fallback) => import_zod23.z.record(import_zod23.z.string(), import_zod23.z.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
1981
|
+
var CABUILabels = import_zod23.z.object({
|
|
1968
1982
|
currentPage: localized(UI_LABELS.currentPage),
|
|
1969
1983
|
guest: localized(UI_LABELS.guest),
|
|
1970
1984
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -1989,37 +2003,37 @@ var CABUILabels = import_zod22.z.object({
|
|
|
1989
2003
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
1990
2004
|
updating: { ...UI_LABELS.updating }
|
|
1991
2005
|
}));
|
|
1992
|
-
var TargetArea =
|
|
1993
|
-
fill:
|
|
1994
|
-
flip:
|
|
1995
|
-
icon:
|
|
1996
|
-
label:
|
|
1997
|
-
width:
|
|
2006
|
+
var TargetArea = import_zod23.z.object({
|
|
2007
|
+
fill: import_zod23.z.boolean().optional(),
|
|
2008
|
+
flip: import_zod23.z.enum(["both", "horizontal", "vertical"]).optional(),
|
|
2009
|
+
icon: import_zod23.z.string(),
|
|
2010
|
+
label: import_zod23.z.string(),
|
|
2011
|
+
width: import_zod23.z.string()
|
|
1998
2012
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
1999
|
-
var CABTracking =
|
|
2000
|
-
enableAttribution:
|
|
2001
|
-
enableSource:
|
|
2002
|
-
enableWidget:
|
|
2013
|
+
var CABTracking = import_zod23.z.object({
|
|
2014
|
+
enableAttribution: import_zod23.z.boolean().nullish().transform((value) => value ?? true),
|
|
2015
|
+
enableSource: import_zod23.z.boolean().nullish().transform((value) => value ?? true),
|
|
2016
|
+
enableWidget: import_zod23.z.boolean().nullish().transform((value) => value ?? true)
|
|
2003
2017
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
2004
|
-
var CABExperiment =
|
|
2005
|
-
elementId:
|
|
2006
|
-
experimentId:
|
|
2007
|
-
experimentType:
|
|
2008
|
-
selectedId:
|
|
2018
|
+
var CABExperiment = import_zod23.z.object({
|
|
2019
|
+
elementId: import_zod23.z.number(),
|
|
2020
|
+
experimentId: import_zod23.z.number(),
|
|
2021
|
+
experimentType: import_zod23.z.string(),
|
|
2022
|
+
selectedId: import_zod23.z.number()
|
|
2009
2023
|
});
|
|
2010
2024
|
var CABRootSection = CABLayoutSection.extend({
|
|
2011
|
-
editorMode:
|
|
2025
|
+
editorMode: import_zod23.z.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
2012
2026
|
experiment: CABExperiment.optional(),
|
|
2013
2027
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
2014
2028
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
2015
|
-
previewMode:
|
|
2016
|
-
storeId:
|
|
2029
|
+
previewMode: import_zod23.z.boolean().nullish().transform((value) => value ?? false),
|
|
2030
|
+
storeId: import_zod23.z.number().nullable().default(null),
|
|
2017
2031
|
targetArea: TargetArea.nullable(),
|
|
2018
2032
|
tracking: CABTracking,
|
|
2019
|
-
type:
|
|
2033
|
+
type: import_zod23.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
2020
2034
|
uiLabels: CABUILabels,
|
|
2021
|
-
version:
|
|
2022
|
-
widgetId:
|
|
2035
|
+
version: import_zod23.z.literal(2).default(2),
|
|
2036
|
+
widgetId: import_zod23.z.number().nullable().default(null)
|
|
2023
2037
|
});
|
|
2024
2038
|
|
|
2025
2039
|
// src/schema/widgets/checkout-and-beyond/switchLabels.ts
|