@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/schema/widgetData.ts
|
|
2
|
-
import { z as
|
|
2
|
+
import { z as z32 } from "zod";
|
|
3
3
|
|
|
4
4
|
// src/schema/widgets/abTestingPlaceholder.ts
|
|
5
5
|
import { z } from "zod";
|
|
@@ -178,6 +178,8 @@ var variableTypes = ["boolean", "number", "text"];
|
|
|
178
178
|
var VariableType = freezeEnum(variableTypes);
|
|
179
179
|
var variantModes = ["multiple", "single"];
|
|
180
180
|
var VariantMode = freezeEnum(variantModes);
|
|
181
|
+
var variantsModes = [...variantModes, "productGroup"];
|
|
182
|
+
var VariantsMode = freezeEnum(variantsModes);
|
|
181
183
|
var variantSelectors = ["menu", "radio", "button"];
|
|
182
184
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
183
185
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
@@ -267,17 +269,17 @@ var CheckoutExtension = z2.looseObject({
|
|
|
267
269
|
});
|
|
268
270
|
|
|
269
271
|
// src/schema/widgets/contentBlock.ts
|
|
270
|
-
import { z as
|
|
272
|
+
import { z as z26 } from "zod";
|
|
271
273
|
|
|
272
274
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
273
|
-
import { z as
|
|
275
|
+
import { z as z25 } from "zod";
|
|
274
276
|
|
|
275
277
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
276
278
|
import { v7 as uuidv713 } from "uuid";
|
|
277
|
-
import { z as
|
|
279
|
+
import { z as z24 } from "zod";
|
|
278
280
|
|
|
279
281
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
280
|
-
import { z as
|
|
282
|
+
import { z as z23 } from "zod";
|
|
281
283
|
|
|
282
284
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
283
285
|
import { z as z3 } from "zod";
|
|
@@ -356,11 +358,11 @@ var CABBannerSection = z3.lazy(
|
|
|
356
358
|
|
|
357
359
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
358
360
|
import { v7 as uuidv73 } from "uuid";
|
|
359
|
-
import { z as
|
|
361
|
+
import { z as z9 } from "zod";
|
|
360
362
|
|
|
361
363
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
362
364
|
import { v7 as uuidv7 } from "uuid";
|
|
363
|
-
import { z as
|
|
365
|
+
import { z as z7 } from "zod";
|
|
364
366
|
|
|
365
367
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
366
368
|
var iconNames = [
|
|
@@ -446,11 +448,18 @@ var IconSize = freezeEnum(iconSizes);
|
|
|
446
448
|
var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "warning"];
|
|
447
449
|
var IconTone = freezeEnum(iconTones);
|
|
448
450
|
|
|
451
|
+
// src/schema/widgets/checkout-and-beyond/imageThumbnails.ts
|
|
452
|
+
import { z as z4 } from "zod";
|
|
453
|
+
var CABImageThumbnails = z4.object({
|
|
454
|
+
limit: z4.number().int().min(1).default(8),
|
|
455
|
+
perLine: z4.number().int().min(1).max(8).default(4)
|
|
456
|
+
});
|
|
457
|
+
|
|
449
458
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
450
|
-
import { z as
|
|
459
|
+
import { z as z6 } from "zod";
|
|
451
460
|
|
|
452
461
|
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
453
|
-
import { z as
|
|
462
|
+
import { z as z5 } from "zod";
|
|
454
463
|
var ruleTypes = [
|
|
455
464
|
"cart",
|
|
456
465
|
"cart_count",
|
|
@@ -469,7 +478,7 @@ var ruleTypes = [
|
|
|
469
478
|
"product_type",
|
|
470
479
|
"product_vendor"
|
|
471
480
|
];
|
|
472
|
-
var ruleType =
|
|
481
|
+
var ruleType = z5.enum(ruleTypes);
|
|
473
482
|
var RuleType = ruleType.enum;
|
|
474
483
|
var ruleOperators = [
|
|
475
484
|
"after",
|
|
@@ -484,124 +493,124 @@ var ruleOperators = [
|
|
|
484
493
|
"greater_than",
|
|
485
494
|
"less_than"
|
|
486
495
|
];
|
|
487
|
-
var ruleOperator =
|
|
496
|
+
var ruleOperator = z5.enum(ruleOperators);
|
|
488
497
|
var RuleOperator = ruleOperator.enum;
|
|
489
|
-
var RuleCondition =
|
|
490
|
-
operator:
|
|
491
|
-
products:
|
|
492
|
-
type:
|
|
493
|
-
value:
|
|
498
|
+
var RuleCondition = z5.object({
|
|
499
|
+
operator: z5.enum(ruleOperators).default(RuleOperator.anything),
|
|
500
|
+
products: z5.union([z5.array(z5.unknown()), z5.strictObject({}).transform(() => [])]).default(() => []),
|
|
501
|
+
type: z5.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
502
|
+
value: z5.coerce.string().default("")
|
|
494
503
|
});
|
|
495
|
-
var RuleLogicBlock =
|
|
496
|
-
rules:
|
|
504
|
+
var RuleLogicBlock = z5.object({
|
|
505
|
+
rules: z5.array(RuleCondition).default(() => [])
|
|
497
506
|
});
|
|
498
|
-
var CABRulesetEntry =
|
|
499
|
-
exitIfMatched:
|
|
500
|
-
logic:
|
|
501
|
-
output:
|
|
502
|
-
|
|
503
|
-
key:
|
|
504
|
-
type:
|
|
505
|
-
value:
|
|
507
|
+
var CABRulesetEntry = z5.object({
|
|
508
|
+
exitIfMatched: z5.boolean().default(true),
|
|
509
|
+
logic: z5.array(RuleLogicBlock).default(() => []),
|
|
510
|
+
output: z5.array(
|
|
511
|
+
z5.object({
|
|
512
|
+
key: z5.string().default("should_show"),
|
|
513
|
+
type: z5.literal("data_json").default("data_json"),
|
|
514
|
+
value: z5.string().default("true")
|
|
506
515
|
})
|
|
507
516
|
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
508
517
|
});
|
|
509
|
-
var CABRuleset =
|
|
518
|
+
var CABRuleset = z5.union([z5.array(CABRulesetEntry), z5.strictObject({}).transform(() => [])]).default(() => []);
|
|
510
519
|
|
|
511
520
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
512
|
-
var variableEffect =
|
|
513
|
-
var CABVariableSeed =
|
|
514
|
-
dataSourceId:
|
|
521
|
+
var variableEffect = z6.enum(variableEffects);
|
|
522
|
+
var CABVariableSeed = z6.object({
|
|
523
|
+
dataSourceId: z6.number().nullable().default(null),
|
|
515
524
|
ruleset: CABRuleset
|
|
516
525
|
});
|
|
517
|
-
var CABBooleanVariable =
|
|
526
|
+
var CABBooleanVariable = z6.object({
|
|
518
527
|
/**
|
|
519
528
|
* Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
|
|
520
529
|
* from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
|
|
521
530
|
* below; a cross-field default has no `.default()` spelling. An explicit value always wins.
|
|
522
531
|
*/
|
|
523
|
-
defaultValue:
|
|
524
|
-
name:
|
|
532
|
+
defaultValue: z6.boolean().optional(),
|
|
533
|
+
name: z6.string().min(1),
|
|
525
534
|
seed: CABVariableSeed.optional(),
|
|
526
535
|
/** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
|
|
527
|
-
type:
|
|
536
|
+
type: z6.literal(VariableType.boolean).default(VariableType.boolean)
|
|
528
537
|
});
|
|
529
|
-
var CABTextVariable =
|
|
530
|
-
defaultValue:
|
|
531
|
-
name:
|
|
532
|
-
seed:
|
|
533
|
-
type:
|
|
538
|
+
var CABTextVariable = z6.object({
|
|
539
|
+
defaultValue: z6.string(),
|
|
540
|
+
name: z6.string().min(1),
|
|
541
|
+
seed: z6.never().optional(),
|
|
542
|
+
type: z6.literal(VariableType.text)
|
|
534
543
|
});
|
|
535
|
-
var CABNumberVariable =
|
|
536
|
-
defaultValue:
|
|
537
|
-
name:
|
|
538
|
-
seed:
|
|
539
|
-
type:
|
|
544
|
+
var CABNumberVariable = z6.object({
|
|
545
|
+
defaultValue: z6.number(),
|
|
546
|
+
name: z6.string().min(1),
|
|
547
|
+
seed: z6.never().optional(),
|
|
548
|
+
type: z6.literal(VariableType.number)
|
|
540
549
|
});
|
|
541
|
-
var CABVariable =
|
|
550
|
+
var CABVariable = z6.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
|
|
542
551
|
(variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
|
|
543
552
|
);
|
|
544
|
-
var CABVariableEffect =
|
|
553
|
+
var CABVariableEffect = z6.object({
|
|
545
554
|
effect: variableEffect.default(VariableEffect.toggle),
|
|
546
|
-
variable:
|
|
555
|
+
variable: z6.string().min(1)
|
|
547
556
|
});
|
|
548
|
-
var CABVisibility =
|
|
549
|
-
variable:
|
|
550
|
-
visibleWhen:
|
|
557
|
+
var CABVisibility = z6.object({
|
|
558
|
+
variable: z6.string().min(1),
|
|
559
|
+
visibleWhen: z6.boolean().default(true)
|
|
551
560
|
});
|
|
552
|
-
var contentOperator =
|
|
553
|
-
var resultCountOperator =
|
|
554
|
-
var resultTagOperator =
|
|
555
|
-
var mutatorEvent =
|
|
556
|
-
var CABContentTrigger =
|
|
561
|
+
var contentOperator = z6.enum(contentOperators);
|
|
562
|
+
var resultCountOperator = z6.enum(resultCountOperators);
|
|
563
|
+
var resultTagOperator = z6.enum(resultTagOperators);
|
|
564
|
+
var mutatorEvent = z6.enum(mutatorEvents);
|
|
565
|
+
var CABContentTrigger = z6.object({
|
|
557
566
|
operator: contentOperator.default(ContentOperator.is_empty),
|
|
558
|
-
type:
|
|
567
|
+
type: z6.literal("content")
|
|
559
568
|
});
|
|
560
|
-
var CABResultCountTrigger =
|
|
569
|
+
var CABResultCountTrigger = z6.object({
|
|
561
570
|
operator: resultCountOperator.default(ResultCountOperator.equals),
|
|
562
|
-
type:
|
|
563
|
-
value:
|
|
571
|
+
type: z6.literal("result_count"),
|
|
572
|
+
value: z6.number().default(0)
|
|
564
573
|
});
|
|
565
|
-
var CABResultTagTrigger =
|
|
574
|
+
var CABResultTagTrigger = z6.object({
|
|
566
575
|
operator: resultTagOperator.default(ResultTagOperator.contains),
|
|
567
|
-
type:
|
|
568
|
-
value:
|
|
576
|
+
type: z6.literal("result_tag"),
|
|
577
|
+
value: z6.string().min(1)
|
|
569
578
|
});
|
|
570
|
-
var CABEventTrigger =
|
|
579
|
+
var CABEventTrigger = z6.object({
|
|
571
580
|
event: mutatorEvent,
|
|
572
|
-
type:
|
|
581
|
+
type: z6.literal("event")
|
|
573
582
|
});
|
|
574
|
-
var CABVariableTrigger =
|
|
583
|
+
var CABVariableTrigger = z6.discriminatedUnion("type", [
|
|
575
584
|
CABContentTrigger,
|
|
576
585
|
CABEventTrigger,
|
|
577
586
|
CABResultCountTrigger,
|
|
578
587
|
CABResultTagTrigger
|
|
579
588
|
]);
|
|
580
|
-
var CABVariableMutator =
|
|
589
|
+
var CABVariableMutator = z6.object({
|
|
581
590
|
effect: variableEffect.default(VariableEffect.set_false),
|
|
582
|
-
variable:
|
|
591
|
+
variable: z6.string().min(1),
|
|
583
592
|
when: CABVariableTrigger
|
|
584
593
|
});
|
|
585
594
|
var CABVariableFields = {
|
|
586
|
-
mutators:
|
|
587
|
-
variables:
|
|
595
|
+
mutators: z6.array(CABVariableMutator).optional(),
|
|
596
|
+
variables: z6.array(CABVariable).refine((variables) => new Set(variables.map(({ name }) => name)).size === variables.length, {
|
|
588
597
|
message: "variable names must be unique within a section"
|
|
589
598
|
}).optional(),
|
|
590
599
|
visibility: CABVisibility.optional()
|
|
591
600
|
};
|
|
592
601
|
|
|
593
602
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
594
|
-
var CABImageSectionFields =
|
|
603
|
+
var CABImageSectionFields = z7.object({
|
|
595
604
|
...CABVariableFields,
|
|
596
|
-
altText:
|
|
605
|
+
altText: z7.string().refine(checkForHTML, NO_HTML).default(""),
|
|
597
606
|
/**
|
|
598
607
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
599
608
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
600
609
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
601
610
|
*/
|
|
602
|
-
aspectRatio:
|
|
603
|
-
border:
|
|
604
|
-
buttonField:
|
|
611
|
+
aspectRatio: z7.number().positive().nullable().default(null),
|
|
612
|
+
border: z7.lazy(() => CABBorder),
|
|
613
|
+
buttonField: z7.enum(buttonFields).optional(),
|
|
605
614
|
/**
|
|
606
615
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
607
616
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -620,29 +629,30 @@ var CABImageSectionFields = z6.object({
|
|
|
620
629
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
621
630
|
* the risky half.
|
|
622
631
|
*/
|
|
623
|
-
category:
|
|
632
|
+
category: z7.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
624
633
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
625
|
-
iconSize:
|
|
634
|
+
iconSize: z7.enum(iconSizes).nullable().default(null),
|
|
626
635
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
627
|
-
iconTone:
|
|
628
|
-
name:
|
|
629
|
-
naturalHeight:
|
|
630
|
-
naturalWidth:
|
|
636
|
+
iconTone: z7.enum(iconTones).nullable().default(null),
|
|
637
|
+
name: z7.string().optional(),
|
|
638
|
+
naturalHeight: z7.number().default(0),
|
|
639
|
+
naturalWidth: z7.number().default(0),
|
|
631
640
|
/**
|
|
632
641
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
633
642
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
634
643
|
*/
|
|
635
|
-
objectFit:
|
|
636
|
-
sectionId:
|
|
637
|
-
sectionType:
|
|
644
|
+
objectFit: z7.enum(objectFits).default(ObjectFit.contain),
|
|
645
|
+
sectionId: z7.uuid().default(() => uuidv7()),
|
|
646
|
+
sectionType: z7.literal(SectionType.image).default(SectionType.image),
|
|
638
647
|
/**
|
|
639
648
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
640
649
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
641
650
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
642
651
|
* server-chosen tier icon actually needs it.
|
|
643
652
|
*/
|
|
644
|
-
source:
|
|
645
|
-
|
|
653
|
+
source: z7.union([z7.url(), z7.literal(""), z7.string().regex(DYNAMIC_TOKEN_REGEX), z7.enum(iconNames)]).default(""),
|
|
654
|
+
thumbnails: CABImageThumbnails.optional(),
|
|
655
|
+
width: z7.number().default(100)
|
|
646
656
|
});
|
|
647
657
|
var iconNameSet = new Set(iconNames);
|
|
648
658
|
var isIconName = (source) => iconNameSet.has(source);
|
|
@@ -664,71 +674,71 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, c
|
|
|
664
674
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
665
675
|
import { forEach, isString as isString2 } from "es-toolkit/compat";
|
|
666
676
|
import { v7 as uuidv72 } from "uuid";
|
|
667
|
-
import { z as
|
|
668
|
-
var enumOrOmit = (...vals) =>
|
|
669
|
-
var TiptapText =
|
|
670
|
-
marks:
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
attrs:
|
|
677
|
-
class:
|
|
678
|
-
href:
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
677
|
+
import { z as z8 } from "zod";
|
|
678
|
+
var enumOrOmit = (...vals) => z8.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
679
|
+
var TiptapText = z8.object({
|
|
680
|
+
marks: z8.union([
|
|
681
|
+
z8.array(
|
|
682
|
+
z8.discriminatedUnion("type", [
|
|
683
|
+
z8.object({ type: z8.literal("bold") }),
|
|
684
|
+
z8.object({ type: z8.literal("italic") }),
|
|
685
|
+
z8.object({
|
|
686
|
+
attrs: z8.object({
|
|
687
|
+
class: z8.string().nullable(),
|
|
688
|
+
href: z8.union([
|
|
689
|
+
z8.url(),
|
|
690
|
+
z8.literal("#"),
|
|
691
|
+
z8.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
692
|
+
z8.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
683
693
|
]),
|
|
684
|
-
rel:
|
|
685
|
-
target:
|
|
694
|
+
rel: z8.string().default("noopener noreferrer nofollow"),
|
|
695
|
+
target: z8.string().default("_blank")
|
|
686
696
|
}),
|
|
687
|
-
type:
|
|
697
|
+
type: z8.literal("link")
|
|
688
698
|
}),
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
attrs:
|
|
699
|
+
z8.object({ type: z8.literal("strike") }),
|
|
700
|
+
z8.object({
|
|
701
|
+
attrs: z8.object({
|
|
692
702
|
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
693
703
|
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
694
704
|
}),
|
|
695
|
-
type:
|
|
705
|
+
type: z8.literal("textStyle")
|
|
696
706
|
})
|
|
697
707
|
])
|
|
698
708
|
),
|
|
699
|
-
|
|
709
|
+
z8.strictObject({}).transform(() => [])
|
|
700
710
|
]).optional(),
|
|
701
|
-
text:
|
|
702
|
-
type:
|
|
711
|
+
text: z8.string().default(""),
|
|
712
|
+
type: z8.literal("text").default("text")
|
|
703
713
|
});
|
|
704
|
-
var TiptapParagraph =
|
|
705
|
-
attrs:
|
|
714
|
+
var TiptapParagraph = z8.object({
|
|
715
|
+
attrs: z8.object({
|
|
706
716
|
textAlign: enumOrOmit(...textAlignments)
|
|
707
717
|
}).default({ textAlign: TextAlignment.start }),
|
|
708
|
-
content:
|
|
709
|
-
type:
|
|
718
|
+
content: z8.union([z8.array(TiptapText), z8.strictObject({}).transform(() => [])]).default(() => []),
|
|
719
|
+
type: z8.literal("paragraph").default("paragraph")
|
|
710
720
|
});
|
|
711
|
-
var TiptapDocument =
|
|
712
|
-
attrs:
|
|
721
|
+
var TiptapDocument = z8.object({
|
|
722
|
+
attrs: z8.object({
|
|
713
723
|
blockSpacing: enumOrOmit(...spacings)
|
|
714
724
|
}).default({ blockSpacing: Spacing.base }),
|
|
715
|
-
content:
|
|
716
|
-
type:
|
|
725
|
+
content: z8.union([z8.array(TiptapParagraph), z8.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
726
|
+
type: z8.literal("doc").default("doc")
|
|
717
727
|
});
|
|
718
|
-
var CABTextTier =
|
|
719
|
-
threshold:
|
|
720
|
-
thresholds:
|
|
721
|
-
tierId:
|
|
722
|
-
tierType:
|
|
728
|
+
var CABTextTier = z8.object({
|
|
729
|
+
threshold: z8.number().int().nonnegative(),
|
|
730
|
+
thresholds: z8.record(z8.string(), z8.number().int().nonnegative()).default(() => ({})),
|
|
731
|
+
tierId: z8.string().optional(),
|
|
732
|
+
tierType: z8.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
723
733
|
});
|
|
724
|
-
var CABTextSection =
|
|
734
|
+
var CABTextSection = z8.object({
|
|
725
735
|
...CABVariableFields,
|
|
726
|
-
buttonField:
|
|
727
|
-
content:
|
|
728
|
-
name:
|
|
729
|
-
optionId:
|
|
730
|
-
sectionId:
|
|
731
|
-
sectionType:
|
|
736
|
+
buttonField: z8.enum(buttonFields).optional(),
|
|
737
|
+
content: z8.record(z8.string(), z8.union([z8.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
738
|
+
name: z8.string().optional(),
|
|
739
|
+
optionId: z8.number().optional(),
|
|
740
|
+
sectionId: z8.uuid().default(() => uuidv72()),
|
|
741
|
+
sectionType: z8.literal(SectionType.text).default(SectionType.text),
|
|
732
742
|
tier: CABTextTier.optional()
|
|
733
743
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
734
744
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
@@ -750,35 +760,35 @@ var CABTextSection = z7.object({
|
|
|
750
760
|
});
|
|
751
761
|
|
|
752
762
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
753
|
-
var CABButtonContent =
|
|
754
|
-
() =>
|
|
763
|
+
var CABButtonContent = z9.lazy(
|
|
764
|
+
() => z9.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
755
765
|
);
|
|
756
|
-
var CABButtonSection =
|
|
766
|
+
var CABButtonSection = z9.object({
|
|
757
767
|
...CABVariableFields,
|
|
758
|
-
action:
|
|
759
|
-
buttonStyle:
|
|
760
|
-
custom:
|
|
761
|
-
color:
|
|
762
|
-
height:
|
|
763
|
-
width:
|
|
768
|
+
action: z9.union([z9.literal(""), z9.enum(buttonActions)]).default(""),
|
|
769
|
+
buttonStyle: z9.enum(buttonStyles).default(ButtonStyle.primary),
|
|
770
|
+
custom: z9.object({
|
|
771
|
+
color: z9.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
772
|
+
height: z9.number().default(52),
|
|
773
|
+
width: z9.number().default(300)
|
|
764
774
|
}).default({
|
|
765
775
|
color: "#005bd3",
|
|
766
776
|
height: 52,
|
|
767
777
|
width: 300
|
|
768
778
|
}),
|
|
769
|
-
disableDowngrade:
|
|
770
|
-
name:
|
|
771
|
-
optionId:
|
|
772
|
-
popover:
|
|
773
|
-
alignment:
|
|
774
|
-
position:
|
|
779
|
+
disableDowngrade: z9.boolean().default(false),
|
|
780
|
+
name: z9.string().optional(),
|
|
781
|
+
optionId: z9.number().optional(),
|
|
782
|
+
popover: z9.object({
|
|
783
|
+
alignment: z9.enum(textAlignments).default(TextAlignment.center),
|
|
784
|
+
position: z9.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
775
785
|
}).optional().default(() => ({
|
|
776
786
|
alignment: TextAlignment.center,
|
|
777
787
|
position: PopoverPosition.blockStart
|
|
778
788
|
})),
|
|
779
|
-
sectionId:
|
|
780
|
-
sections:
|
|
781
|
-
sectionType:
|
|
789
|
+
sectionId: z9.uuid().default(() => uuidv73()),
|
|
790
|
+
sections: z9.union([z9.array(CABButtonContent), z9.strictObject({}).transform(() => [])]).default(() => []),
|
|
791
|
+
sectionType: z9.literal(SectionType.button).default(SectionType.button),
|
|
782
792
|
/**
|
|
783
793
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
784
794
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -793,96 +803,96 @@ var CABButtonSection = z8.object({
|
|
|
793
803
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
794
804
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
795
805
|
*/
|
|
796
|
-
tier:
|
|
806
|
+
tier: z9.object({ tierId: z9.string().min(1) }).optional(),
|
|
797
807
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
798
|
-
trackingUrl:
|
|
808
|
+
trackingUrl: z9.string().optional(),
|
|
799
809
|
/**
|
|
800
810
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
801
811
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
802
812
|
*/
|
|
803
|
-
variableEffects:
|
|
813
|
+
variableEffects: z9.array(CABVariableEffect).optional()
|
|
804
814
|
});
|
|
805
815
|
|
|
806
816
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
807
|
-
import { z as
|
|
817
|
+
import { z as z14 } from "zod";
|
|
808
818
|
|
|
809
819
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
810
|
-
import { z as
|
|
820
|
+
import { z as z13 } from "zod";
|
|
811
821
|
|
|
812
822
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
813
823
|
import { v7 as uuidv74 } from "uuid";
|
|
814
|
-
import { z as
|
|
815
|
-
var CABDiscount =
|
|
816
|
-
amount:
|
|
817
|
-
discountedBy:
|
|
818
|
-
discountedFrom:
|
|
819
|
-
type:
|
|
824
|
+
import { z as z10 } from "zod";
|
|
825
|
+
var CABDiscount = z10.object({
|
|
826
|
+
amount: z10.union([z10.number(), z10.string()]).catch(0),
|
|
827
|
+
discountedBy: z10.string().optional(),
|
|
828
|
+
discountedFrom: z10.enum(discountSources).optional().catch(void 0),
|
|
829
|
+
type: z10.enum(discountTypes).catch("none")
|
|
820
830
|
});
|
|
821
|
-
var CABIntegrations =
|
|
822
|
-
judgeme:
|
|
823
|
-
junip:
|
|
824
|
-
klaviyo:
|
|
825
|
-
loox:
|
|
826
|
-
okendo:
|
|
827
|
-
opinew:
|
|
828
|
-
reviewsio:
|
|
829
|
-
stamped:
|
|
830
|
-
yotpo:
|
|
831
|
+
var CABIntegrations = z10.object({
|
|
832
|
+
judgeme: z10.boolean().default(false),
|
|
833
|
+
junip: z10.boolean().default(false),
|
|
834
|
+
klaviyo: z10.boolean().default(false),
|
|
835
|
+
loox: z10.boolean().default(false),
|
|
836
|
+
okendo: z10.boolean().default(false),
|
|
837
|
+
opinew: z10.boolean().default(false),
|
|
838
|
+
reviewsio: z10.boolean().default(false),
|
|
839
|
+
stamped: z10.boolean().default(false),
|
|
840
|
+
yotpo: z10.boolean().default(false)
|
|
831
841
|
});
|
|
832
|
-
var CABVariantLabels =
|
|
833
|
-
variantOption:
|
|
834
|
-
variantOptions:
|
|
842
|
+
var CABVariantLabels = z10.object({
|
|
843
|
+
variantOption: z10.string().optional().catch(void 0),
|
|
844
|
+
variantOptions: z10.string().optional().catch(void 0)
|
|
835
845
|
});
|
|
836
|
-
var CABDataSourceSection =
|
|
837
|
-
dataSourceId:
|
|
838
|
-
dataSourcePath:
|
|
846
|
+
var CABDataSourceSection = z10.object({
|
|
847
|
+
dataSourceId: z10.number().nullable().default(null),
|
|
848
|
+
dataSourcePath: z10.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
839
849
|
discount: CABDiscount.optional(),
|
|
840
850
|
integrations: CABIntegrations.optional(),
|
|
841
|
-
limit:
|
|
842
|
-
matchVariant:
|
|
843
|
-
matchVariantOutOfStock:
|
|
844
|
-
name:
|
|
845
|
-
productType:
|
|
846
|
-
sectionId:
|
|
847
|
-
sectionType:
|
|
851
|
+
limit: z10.number().default(1),
|
|
852
|
+
matchVariant: z10.boolean().default(false),
|
|
853
|
+
matchVariantOutOfStock: z10.boolean().default(false),
|
|
854
|
+
name: z10.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
855
|
+
productType: z10.enum(productTypes).optional(),
|
|
856
|
+
sectionId: z10.uuid().default(() => uuidv74()),
|
|
857
|
+
sectionType: z10.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
848
858
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
849
|
-
subscriptionIsDefault:
|
|
850
|
-
treatAsGwp:
|
|
859
|
+
subscriptionIsDefault: z10.boolean().default(false),
|
|
860
|
+
treatAsGwp: z10.boolean().default(false),
|
|
851
861
|
variantLabels: CABVariantLabels.optional().catch(void 0)
|
|
852
862
|
});
|
|
853
863
|
|
|
854
864
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
855
865
|
import { v7 as uuidv76 } from "uuid";
|
|
856
|
-
import { z as
|
|
866
|
+
import { z as z12 } from "zod";
|
|
857
867
|
|
|
858
868
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
859
869
|
import { v7 as uuidv75 } from "uuid";
|
|
860
|
-
import { z as
|
|
861
|
-
var CABVariantContent =
|
|
862
|
-
() =>
|
|
870
|
+
import { z as z11 } from "zod";
|
|
871
|
+
var CABVariantContent = z11.lazy(
|
|
872
|
+
() => z11.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
863
873
|
);
|
|
864
|
-
var CABProductSection =
|
|
874
|
+
var CABProductSection = z11.object({
|
|
865
875
|
...CABVariableFields,
|
|
866
|
-
name:
|
|
867
|
-
productId:
|
|
868
|
-
sectionId:
|
|
869
|
-
sections:
|
|
870
|
-
sectionType:
|
|
871
|
-
selectors:
|
|
872
|
-
variantMode:
|
|
876
|
+
name: z11.string().optional(),
|
|
877
|
+
productId: z11.number().nullable().default(null),
|
|
878
|
+
sectionId: z11.uuid().default(() => uuidv75()),
|
|
879
|
+
sections: z11.union([z11.array(CABVariantContent), z11.strictObject({}).transform(() => [])]).default(() => []),
|
|
880
|
+
sectionType: z11.literal(SectionType.product).default(SectionType.product),
|
|
881
|
+
selectors: z11.record(z11.string(), z11.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
882
|
+
variantMode: z11.enum(variantModes).default(VariantMode.multiple)
|
|
873
883
|
});
|
|
874
884
|
|
|
875
885
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
876
|
-
var CABProductsSection =
|
|
886
|
+
var CABProductsSection = z12.object({
|
|
877
887
|
...CABVariableFields,
|
|
878
|
-
name:
|
|
879
|
-
sectionId:
|
|
880
|
-
sections:
|
|
881
|
-
sectionType:
|
|
888
|
+
name: z12.string().optional(),
|
|
889
|
+
sectionId: z12.uuid().default(() => uuidv76()),
|
|
890
|
+
sections: z12.union([z12.array(z12.lazy(() => CABProductSection)), z12.strictObject({}).transform(() => [])]).default(() => []),
|
|
891
|
+
sectionType: z12.literal(SectionType.products).default(SectionType.products)
|
|
882
892
|
});
|
|
883
893
|
|
|
884
894
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
885
|
-
var CABOffersSection =
|
|
895
|
+
var CABOffersSection = z13.lazy(
|
|
886
896
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
887
897
|
/**
|
|
888
898
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -890,8 +900,8 @@ var CABOffersSection = z12.lazy(
|
|
|
890
900
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
891
901
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
892
902
|
*/
|
|
893
|
-
divider:
|
|
894
|
-
sections:
|
|
903
|
+
divider: z13.boolean().optional(),
|
|
904
|
+
sections: z13.union([z13.array(z13.lazy(() => CABSection)), z13.strictObject({}).transform(() => [])]).default(() => [
|
|
895
905
|
CABBannerSection.parse({
|
|
896
906
|
buttonField: "undoAddToOrder",
|
|
897
907
|
color: "success",
|
|
@@ -905,77 +915,77 @@ var CABOffersSection = z12.lazy(
|
|
|
905
915
|
CABDataSourceSection.parse({}),
|
|
906
916
|
CABProductsSection.parse({})
|
|
907
917
|
]),
|
|
908
|
-
sectionType:
|
|
918
|
+
sectionType: z13.literal(SectionType.offers).default(SectionType.offers)
|
|
909
919
|
})
|
|
910
920
|
);
|
|
911
921
|
|
|
912
922
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
913
|
-
var CABCarouselSection =
|
|
923
|
+
var CABCarouselSection = z14.lazy(
|
|
914
924
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
915
|
-
autoAdvanceInterval:
|
|
916
|
-
itemsAtOnce:
|
|
925
|
+
autoAdvanceInterval: z14.number().default(0),
|
|
926
|
+
itemsAtOnce: z14.number().min(1).default(1),
|
|
917
927
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
918
|
-
offersDirection:
|
|
919
|
-
sections:
|
|
920
|
-
sectionType:
|
|
928
|
+
offersDirection: z14.enum(offersDirections).default("vertical"),
|
|
929
|
+
sections: z14.union([z14.array(z14.lazy(() => CABSection)), z14.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
930
|
+
sectionType: z14.literal(SectionType.carousel).default(SectionType.carousel)
|
|
921
931
|
})
|
|
922
932
|
);
|
|
923
933
|
|
|
924
934
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
925
|
-
import { z as
|
|
926
|
-
var CABCartLineSection =
|
|
935
|
+
import { z as z15 } from "zod";
|
|
936
|
+
var CABCartLineSection = z15.lazy(
|
|
927
937
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
928
|
-
sections:
|
|
929
|
-
sectionType:
|
|
938
|
+
sections: z15.union([z15.array(z15.lazy(() => CABSection)), z15.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
939
|
+
sectionType: z15.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
930
940
|
})
|
|
931
941
|
);
|
|
932
942
|
|
|
933
943
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
934
944
|
import { v7 as uuidv77 } from "uuid";
|
|
935
|
-
import { z as
|
|
936
|
-
var CABDiscountSection =
|
|
945
|
+
import { z as z16 } from "zod";
|
|
946
|
+
var CABDiscountSection = z16.object({
|
|
937
947
|
...CABVariableFields,
|
|
938
|
-
amount:
|
|
939
|
-
discountedBy:
|
|
940
|
-
discountedFrom:
|
|
941
|
-
message:
|
|
942
|
-
name:
|
|
943
|
-
quantity:
|
|
944
|
-
sectionId:
|
|
945
|
-
sectionType:
|
|
946
|
-
type:
|
|
948
|
+
amount: z16.union([z16.number(), z16.string()]).catch(0),
|
|
949
|
+
discountedBy: z16.string().optional(),
|
|
950
|
+
discountedFrom: z16.enum(discountSources).optional().catch(void 0),
|
|
951
|
+
message: z16.string().optional(),
|
|
952
|
+
name: z16.string().optional(),
|
|
953
|
+
quantity: z16.number().default(1),
|
|
954
|
+
sectionId: z16.uuid().default(() => uuidv77()),
|
|
955
|
+
sectionType: z16.literal(SectionType.discount).default(SectionType.discount),
|
|
956
|
+
type: z16.enum(discountTypes).catch("none")
|
|
947
957
|
});
|
|
948
958
|
|
|
949
959
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
950
960
|
import { v7 as uuidv78 } from "uuid";
|
|
951
|
-
import { z as
|
|
952
|
-
var CABMonetizeAds =
|
|
953
|
-
requestId:
|
|
961
|
+
import { z as z17 } from "zod";
|
|
962
|
+
var CABMonetizeAds = z17.object({
|
|
963
|
+
requestId: z17.string().optional(),
|
|
954
964
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
955
|
-
testing:
|
|
965
|
+
testing: z17.boolean().default(false)
|
|
956
966
|
});
|
|
957
|
-
var CABMonetizeSection =
|
|
967
|
+
var CABMonetizeSection = z17.object({
|
|
958
968
|
...CABVariableFields,
|
|
959
969
|
ads: CABMonetizeAds.optional(),
|
|
960
|
-
name:
|
|
970
|
+
name: z17.string().optional(),
|
|
961
971
|
/**
|
|
962
972
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
963
973
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
964
974
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
965
975
|
*/
|
|
966
|
-
offers:
|
|
976
|
+
offers: z17.array(z17.lazy(() => CABSection)).optional(),
|
|
967
977
|
/** 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. */
|
|
968
|
-
privacyPolicyUrl:
|
|
969
|
-
sectionId:
|
|
970
|
-
sectionType:
|
|
978
|
+
privacyPolicyUrl: z17.string().optional(),
|
|
979
|
+
sectionId: z17.uuid().default(() => uuidv78()),
|
|
980
|
+
sectionType: z17.literal(SectionType.monetize).default(SectionType.monetize),
|
|
971
981
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
972
|
-
subVertical:
|
|
982
|
+
subVertical: z17.string().optional(),
|
|
973
983
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
974
|
-
vertical:
|
|
984
|
+
vertical: z17.string().optional()
|
|
975
985
|
});
|
|
976
986
|
|
|
977
987
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
978
|
-
import { z as
|
|
988
|
+
import { z as z18 } from "zod";
|
|
979
989
|
|
|
980
990
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
981
991
|
var GIFT_LABELS = {
|
|
@@ -1094,34 +1104,34 @@ var GIFT_LABELS = {
|
|
|
1094
1104
|
};
|
|
1095
1105
|
|
|
1096
1106
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
1097
|
-
var CABProgressTierExclusion =
|
|
1098
|
-
collectionIds:
|
|
1099
|
-
productIds:
|
|
1100
|
-
tags:
|
|
1101
|
-
type:
|
|
1107
|
+
var CABProgressTierExclusion = z18.object({
|
|
1108
|
+
collectionIds: z18.array(z18.number().int().positive()).default(() => []),
|
|
1109
|
+
productIds: z18.array(z18.number().int().positive()).default(() => []),
|
|
1110
|
+
tags: z18.array(z18.string().min(1)).default(() => []),
|
|
1111
|
+
type: z18.enum(progressTierExclusionTypes)
|
|
1102
1112
|
});
|
|
1103
|
-
var CABProgressTier =
|
|
1113
|
+
var CABProgressTier = z18.object({
|
|
1104
1114
|
/**
|
|
1105
1115
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
1106
1116
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
1107
1117
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
1108
1118
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
1109
1119
|
*/
|
|
1110
|
-
discount:
|
|
1120
|
+
discount: z18.object({ amount: z18.number().nonnegative(), type: z18.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
1111
1121
|
/**
|
|
1112
1122
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
1113
1123
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
1114
1124
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
1115
1125
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
1116
1126
|
*/
|
|
1117
|
-
exclusions:
|
|
1127
|
+
exclusions: z18.array(CABProgressTierExclusion).default(() => []),
|
|
1118
1128
|
/**
|
|
1119
1129
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
1120
1130
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
1121
1131
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
1122
1132
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
1123
1133
|
*/
|
|
1124
|
-
filterOosVariants:
|
|
1134
|
+
filterOosVariants: z18.boolean().default(false),
|
|
1125
1135
|
/**
|
|
1126
1136
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
1127
1137
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -1129,10 +1139,10 @@ var CABProgressTier = z17.object({
|
|
|
1129
1139
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
1130
1140
|
* tree is complete.
|
|
1131
1141
|
*/
|
|
1132
|
-
gift:
|
|
1133
|
-
productId:
|
|
1134
|
-
title:
|
|
1135
|
-
variantIds:
|
|
1142
|
+
gift: z18.object({
|
|
1143
|
+
productId: z18.number().int().positive(),
|
|
1144
|
+
title: z18.string().optional(),
|
|
1145
|
+
variantIds: z18.array(z18.number().int().positive()).default(() => [])
|
|
1136
1146
|
}).optional(),
|
|
1137
1147
|
/**
|
|
1138
1148
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -1152,7 +1162,7 @@ var CABProgressTier = z17.object({
|
|
|
1152
1162
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
1153
1163
|
* React's size rather than the old hardcoded 20.
|
|
1154
1164
|
*/
|
|
1155
|
-
iconSizePx:
|
|
1165
|
+
iconSizePx: z18.number().int().min(1).max(64).default(18),
|
|
1156
1166
|
/**
|
|
1157
1167
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
1158
1168
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -1162,35 +1172,35 @@ var CABProgressTier = z17.object({
|
|
|
1162
1172
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
1163
1173
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
1164
1174
|
*/
|
|
1165
|
-
label:
|
|
1175
|
+
label: z18.record(z18.string(), z18.string()).optional(),
|
|
1166
1176
|
/**
|
|
1167
1177
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
1168
1178
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
1169
1179
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
1170
1180
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
1171
1181
|
*/
|
|
1172
|
-
productTierImage:
|
|
1182
|
+
productTierImage: z18.boolean().default(false),
|
|
1173
1183
|
/**
|
|
1174
1184
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
1175
1185
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
1176
1186
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
1177
1187
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
1178
1188
|
*/
|
|
1179
|
-
threshold:
|
|
1189
|
+
threshold: z18.number().int().nonnegative(),
|
|
1180
1190
|
/**
|
|
1181
1191
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
1182
1192
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
1183
1193
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
1184
1194
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
1185
1195
|
*/
|
|
1186
|
-
thresholds:
|
|
1196
|
+
thresholds: z18.record(z18.string(), z18.number().int().nonnegative()).default(() => ({})),
|
|
1187
1197
|
/**
|
|
1188
1198
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
1189
1199
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
1190
1200
|
* shipping bar (single unlabeled tier, no gift).
|
|
1191
1201
|
*/
|
|
1192
|
-
tierId:
|
|
1193
|
-
tierType:
|
|
1202
|
+
tierId: z18.string().optional(),
|
|
1203
|
+
tierType: z18.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
1194
1204
|
/**
|
|
1195
1205
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
1196
1206
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -1201,9 +1211,9 @@ var CABProgressTier = z17.object({
|
|
|
1201
1211
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
1202
1212
|
* template text supplies grammatically-neutral wording around the token.
|
|
1203
1213
|
*/
|
|
1204
|
-
unit:
|
|
1214
|
+
unit: z18.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
1205
1215
|
});
|
|
1206
|
-
var CABProgressBarSection =
|
|
1216
|
+
var CABProgressBarSection = z18.lazy(
|
|
1207
1217
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1208
1218
|
/**
|
|
1209
1219
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -1212,35 +1222,35 @@ var CABProgressBarSection = z17.lazy(
|
|
|
1212
1222
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
1213
1223
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
1214
1224
|
*/
|
|
1215
|
-
barId:
|
|
1225
|
+
barId: z18.string().optional(),
|
|
1216
1226
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
1217
|
-
countryCodes:
|
|
1227
|
+
countryCodes: z18.array(z18.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1218
1228
|
/**
|
|
1219
1229
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
1220
1230
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
1221
1231
|
*/
|
|
1222
|
-
excludeCountryCodes:
|
|
1232
|
+
excludeCountryCodes: z18.array(z18.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1223
1233
|
/**
|
|
1224
1234
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
1225
1235
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
1226
1236
|
* adds the cart's discount allocations back to the live subtotal.
|
|
1227
1237
|
*/
|
|
1228
|
-
excludeDiscountInSubtotal:
|
|
1238
|
+
excludeDiscountInSubtotal: z18.boolean().default(false),
|
|
1229
1239
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
1230
|
-
excludedVariantIds:
|
|
1240
|
+
excludedVariantIds: z18.array(z18.number().int().positive()).default(() => []),
|
|
1231
1241
|
/**
|
|
1232
1242
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
1233
1243
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
1234
1244
|
*/
|
|
1235
|
-
freeShippingOnSubscription:
|
|
1245
|
+
freeShippingOnSubscription: z18.boolean().default(false),
|
|
1236
1246
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
1237
|
-
giftAreaTitle:
|
|
1247
|
+
giftAreaTitle: z18.record(z18.string(), z18.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
1238
1248
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
1239
|
-
giftLabels:
|
|
1240
|
-
addGift:
|
|
1241
|
-
remove:
|
|
1242
|
-
selectOptions:
|
|
1243
|
-
yourGift:
|
|
1249
|
+
giftLabels: z18.object({
|
|
1250
|
+
addGift: z18.record(z18.string(), z18.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
1251
|
+
remove: z18.record(z18.string(), z18.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
1252
|
+
selectOptions: z18.record(z18.string(), z18.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
1253
|
+
yourGift: z18.record(z18.string(), z18.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
1244
1254
|
}).default(() => ({
|
|
1245
1255
|
addGift: { ...GIFT_LABELS.addGift },
|
|
1246
1256
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -1248,38 +1258,38 @@ var CABProgressBarSection = z17.lazy(
|
|
|
1248
1258
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
1249
1259
|
})),
|
|
1250
1260
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
1251
|
-
name:
|
|
1261
|
+
name: z18.string().default("Order progress"),
|
|
1252
1262
|
/**
|
|
1253
1263
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
1254
1264
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
1255
1265
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
1256
1266
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
1257
1267
|
*/
|
|
1258
|
-
progressColor:
|
|
1259
|
-
sectionType:
|
|
1268
|
+
progressColor: z18.string().optional(),
|
|
1269
|
+
sectionType: z18.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
1260
1270
|
/**
|
|
1261
1271
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
1262
1272
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
1263
1273
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
1264
1274
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
1265
1275
|
*/
|
|
1266
|
-
tiers:
|
|
1276
|
+
tiers: z18.union([z18.array(CABProgressTier), z18.strictObject({}).transform(() => [])]).default(() => [])
|
|
1267
1277
|
})
|
|
1268
1278
|
);
|
|
1269
1279
|
|
|
1270
1280
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
1271
1281
|
import { v7 as uuidv79 } from "uuid";
|
|
1272
|
-
import { z as
|
|
1273
|
-
var CABQuantitySection =
|
|
1282
|
+
import { z as z19 } from "zod";
|
|
1283
|
+
var CABQuantitySection = z19.object({
|
|
1274
1284
|
...CABVariableFields,
|
|
1275
|
-
errorMessages:
|
|
1276
|
-
|
|
1277
|
-
|
|
1285
|
+
errorMessages: z19.record(
|
|
1286
|
+
z19.string(),
|
|
1287
|
+
z19.object({
|
|
1278
1288
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
1279
|
-
increment:
|
|
1280
|
-
max:
|
|
1281
|
-
min:
|
|
1282
|
-
neg:
|
|
1289
|
+
increment: z19.string().optional(),
|
|
1290
|
+
max: z19.string().optional(),
|
|
1291
|
+
min: z19.string().optional(),
|
|
1292
|
+
neg: z19.string().optional()
|
|
1283
1293
|
})
|
|
1284
1294
|
).default({
|
|
1285
1295
|
en: {
|
|
@@ -1289,18 +1299,18 @@ var CABQuantitySection = z18.object({
|
|
|
1289
1299
|
neg: "Quantity cannot be negative"
|
|
1290
1300
|
}
|
|
1291
1301
|
}),
|
|
1292
|
-
inputType:
|
|
1293
|
-
max:
|
|
1294
|
-
min:
|
|
1302
|
+
inputType: z19.enum(quantityInputs).default(QuantityInput.select),
|
|
1303
|
+
max: z19.number().min(1).max(100).default(10),
|
|
1304
|
+
min: z19.number().min(1).default(1),
|
|
1295
1305
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
1296
|
-
name:
|
|
1297
|
-
sectionId:
|
|
1298
|
-
sectionType:
|
|
1306
|
+
name: z19.string().default("Quantity"),
|
|
1307
|
+
sectionId: z19.uuid().default(() => uuidv79()),
|
|
1308
|
+
sectionType: z19.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1299
1309
|
});
|
|
1300
1310
|
|
|
1301
1311
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1302
1312
|
import { v7 as uuidv710 } from "uuid";
|
|
1303
|
-
import { z as
|
|
1313
|
+
import { z as z20 } from "zod";
|
|
1304
1314
|
|
|
1305
1315
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
1306
1316
|
var REVIEW_LABELS = {
|
|
@@ -1363,68 +1373,69 @@ var REVIEW_LABELS = {
|
|
|
1363
1373
|
};
|
|
1364
1374
|
|
|
1365
1375
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1366
|
-
var CABReviewsSection =
|
|
1376
|
+
var CABReviewsSection = z20.object({
|
|
1367
1377
|
...CABVariableFields,
|
|
1368
|
-
color:
|
|
1378
|
+
color: z20.string().default("#fadb14"),
|
|
1369
1379
|
/**
|
|
1370
1380
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
1371
1381
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
1372
1382
|
* or merchant work.
|
|
1373
1383
|
*/
|
|
1374
|
-
countLabels:
|
|
1375
|
-
one:
|
|
1376
|
-
other:
|
|
1384
|
+
countLabels: z20.object({
|
|
1385
|
+
one: z20.record(z20.string(), z20.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
1386
|
+
other: z20.record(z20.string(), z20.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
1377
1387
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
1378
|
-
name:
|
|
1379
|
-
sectionId:
|
|
1380
|
-
sectionType:
|
|
1381
|
-
size:
|
|
1388
|
+
name: z20.string().optional(),
|
|
1389
|
+
sectionId: z20.uuid().default(() => uuidv710()),
|
|
1390
|
+
sectionType: z20.literal(SectionType.reviews).default(SectionType.reviews),
|
|
1391
|
+
size: z20.enum(reviewsSizes).default(ReviewsSize.default),
|
|
1382
1392
|
/**
|
|
1383
1393
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
1384
1394
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
1385
1395
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
1386
1396
|
* the whole reviews section.
|
|
1387
1397
|
*/
|
|
1388
|
-
strokeColor:
|
|
1398
|
+
strokeColor: z20.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
1389
1399
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
1390
|
-
strokeWidth:
|
|
1400
|
+
strokeWidth: z20.number().nonnegative().default(0)
|
|
1391
1401
|
});
|
|
1392
1402
|
|
|
1393
1403
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
1394
1404
|
import { v7 as uuidv711 } from "uuid";
|
|
1395
|
-
import { z as
|
|
1396
|
-
var CABSeparatorSection =
|
|
1405
|
+
import { z as z21 } from "zod";
|
|
1406
|
+
var CABSeparatorSection = z21.object({
|
|
1397
1407
|
...CABVariableFields,
|
|
1398
|
-
sectionId:
|
|
1399
|
-
sectionType:
|
|
1408
|
+
sectionId: z21.uuid().default(() => uuidv711()),
|
|
1409
|
+
sectionType: z21.literal(SectionType.separator).default(SectionType.separator)
|
|
1400
1410
|
});
|
|
1401
1411
|
|
|
1402
1412
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
1403
1413
|
import { slice } from "es-toolkit/compat";
|
|
1404
1414
|
import { v7 as uuidv712 } from "uuid";
|
|
1405
|
-
import { z as
|
|
1406
|
-
var CABVariantsSection =
|
|
1415
|
+
import { z as z22 } from "zod";
|
|
1416
|
+
var CABVariantsSection = z22.object({
|
|
1407
1417
|
...CABVariableFields,
|
|
1408
|
-
hideOutOfStockVariants:
|
|
1409
|
-
name:
|
|
1410
|
-
sectionId:
|
|
1411
|
-
sectionType:
|
|
1412
|
-
selector:
|
|
1413
|
-
|
|
1418
|
+
hideOutOfStockVariants: z22.boolean().default(false),
|
|
1419
|
+
name: z22.string().optional(),
|
|
1420
|
+
sectionId: z22.uuid().default(() => uuidv712()),
|
|
1421
|
+
sectionType: z22.literal(SectionType.variants).default(SectionType.variants),
|
|
1422
|
+
selector: z22.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
1423
|
+
/** `productGroup` is additive (REB-24817): a renderer without group support must render nothing for it. */
|
|
1424
|
+
variantMode: z22.enum(variantsModes).default(VariantsMode.multiple)
|
|
1414
1425
|
});
|
|
1415
1426
|
|
|
1416
1427
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
1417
|
-
var CABBorder =
|
|
1418
|
-
radius:
|
|
1419
|
-
style:
|
|
1420
|
-
width:
|
|
1428
|
+
var CABBorder = z23.object({
|
|
1429
|
+
radius: z23.enum(borderRadii).default(BorderRadius.base),
|
|
1430
|
+
style: z23.enum(borderStyles).default(BorderStyle.none),
|
|
1431
|
+
width: z23.enum(borderWidths).default(BorderWidth.base)
|
|
1421
1432
|
}).default({
|
|
1422
1433
|
radius: BorderRadius.base,
|
|
1423
1434
|
style: BorderStyle.none,
|
|
1424
1435
|
width: BorderWidth.base
|
|
1425
1436
|
});
|
|
1426
|
-
var CABSection =
|
|
1427
|
-
() =>
|
|
1437
|
+
var CABSection = z23.lazy(
|
|
1438
|
+
() => z23.discriminatedUnion("sectionType", [
|
|
1428
1439
|
CABBannerSection,
|
|
1429
1440
|
CABButtonSection,
|
|
1430
1441
|
CABCarouselSection,
|
|
@@ -1447,41 +1458,41 @@ var CABSection = z22.lazy(
|
|
|
1447
1458
|
);
|
|
1448
1459
|
|
|
1449
1460
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
1450
|
-
var GridItem =
|
|
1451
|
-
var CABLayoutWrapping =
|
|
1452
|
-
breakAt:
|
|
1453
|
-
maxPerLine:
|
|
1461
|
+
var GridItem = z24.union([z24.literal("auto"), z24.literal("fill"), z24.string().regex(/^\d+%$/), z24.number()]);
|
|
1462
|
+
var CABLayoutWrapping = z24.object({
|
|
1463
|
+
breakAt: z24.number().positive(),
|
|
1464
|
+
maxPerLine: z24.number().int().positive()
|
|
1454
1465
|
});
|
|
1455
|
-
var CABLayoutSection =
|
|
1466
|
+
var CABLayoutSection = z24.object({
|
|
1456
1467
|
...CABVariableFields,
|
|
1457
|
-
alignment:
|
|
1458
|
-
horizontal:
|
|
1459
|
-
vertical:
|
|
1468
|
+
alignment: z24.object({
|
|
1469
|
+
horizontal: z24.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
1470
|
+
vertical: z24.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
1460
1471
|
}).default({
|
|
1461
1472
|
horizontal: HorizontalAlignment.start,
|
|
1462
1473
|
vertical: VerticalAlignment.top
|
|
1463
1474
|
}),
|
|
1464
|
-
border:
|
|
1465
|
-
buttonField:
|
|
1466
|
-
direction:
|
|
1475
|
+
border: z24.lazy(() => CABBorder),
|
|
1476
|
+
buttonField: z24.enum(buttonFields).optional(),
|
|
1477
|
+
direction: z24.enum(directions).default(Direction.rows),
|
|
1467
1478
|
/**
|
|
1468
1479
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
1469
1480
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
1470
1481
|
*/
|
|
1471
|
-
frame:
|
|
1472
|
-
grid:
|
|
1473
|
-
columns:
|
|
1474
|
-
rows:
|
|
1482
|
+
frame: z24.enum(layoutFrames).optional(),
|
|
1483
|
+
grid: z24.object({
|
|
1484
|
+
columns: z24.union([z24.array(GridItem), z24.undefined()]).default(() => ["auto"]),
|
|
1485
|
+
rows: z24.union([z24.array(GridItem), z24.undefined()]).default(() => ["auto"])
|
|
1475
1486
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
1476
|
-
name:
|
|
1477
|
-
padding:
|
|
1478
|
-
sectionId:
|
|
1479
|
-
sections:
|
|
1480
|
-
sectionType:
|
|
1481
|
-
spacing:
|
|
1487
|
+
name: z24.string().optional(),
|
|
1488
|
+
padding: z24.enum(spacings).default(Spacing.none),
|
|
1489
|
+
sectionId: z24.uuid().default(() => uuidv713()),
|
|
1490
|
+
sections: z24.union([z24.array(z24.lazy(() => CABSection)), z24.strictObject({}).transform(() => [])]).default(() => []),
|
|
1491
|
+
sectionType: z24.literal(SectionType.layout).default(SectionType.layout),
|
|
1492
|
+
spacing: z24.enum(spacings).default(Spacing.base),
|
|
1482
1493
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
1483
|
-
viewUrl:
|
|
1484
|
-
width:
|
|
1494
|
+
viewUrl: z24.string().optional(),
|
|
1495
|
+
width: z24.number().default(100),
|
|
1485
1496
|
wrapping: CABLayoutWrapping.optional()
|
|
1486
1497
|
});
|
|
1487
1498
|
|
|
@@ -1503,8 +1514,8 @@ var UI_LABELS = {
|
|
|
1503
1514
|
};
|
|
1504
1515
|
|
|
1505
1516
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1506
|
-
var localized = (fallback) =>
|
|
1507
|
-
var CABUILabels =
|
|
1517
|
+
var localized = (fallback) => z25.record(z25.string(), z25.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
1518
|
+
var CABUILabels = z25.object({
|
|
1508
1519
|
currentPage: localized(UI_LABELS.currentPage),
|
|
1509
1520
|
guest: localized(UI_LABELS.guest),
|
|
1510
1521
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -1529,154 +1540,154 @@ var CABUILabels = z24.object({
|
|
|
1529
1540
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
1530
1541
|
updating: { ...UI_LABELS.updating }
|
|
1531
1542
|
}));
|
|
1532
|
-
var TargetArea =
|
|
1533
|
-
fill:
|
|
1534
|
-
flip:
|
|
1535
|
-
icon:
|
|
1536
|
-
label:
|
|
1537
|
-
width:
|
|
1543
|
+
var TargetArea = z25.object({
|
|
1544
|
+
fill: z25.boolean().optional(),
|
|
1545
|
+
flip: z25.enum(["both", "horizontal", "vertical"]).optional(),
|
|
1546
|
+
icon: z25.string(),
|
|
1547
|
+
label: z25.string(),
|
|
1548
|
+
width: z25.string()
|
|
1538
1549
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
1539
|
-
var CABTracking =
|
|
1540
|
-
enableAttribution:
|
|
1541
|
-
enableSource:
|
|
1542
|
-
enableWidget:
|
|
1550
|
+
var CABTracking = z25.object({
|
|
1551
|
+
enableAttribution: z25.boolean().nullish().transform((value) => value ?? true),
|
|
1552
|
+
enableSource: z25.boolean().nullish().transform((value) => value ?? true),
|
|
1553
|
+
enableWidget: z25.boolean().nullish().transform((value) => value ?? true)
|
|
1543
1554
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
1544
|
-
var CABExperiment =
|
|
1545
|
-
elementId:
|
|
1546
|
-
experimentId:
|
|
1547
|
-
experimentType:
|
|
1548
|
-
selectedId:
|
|
1555
|
+
var CABExperiment = z25.object({
|
|
1556
|
+
elementId: z25.number(),
|
|
1557
|
+
experimentId: z25.number(),
|
|
1558
|
+
experimentType: z25.string(),
|
|
1559
|
+
selectedId: z25.number()
|
|
1549
1560
|
});
|
|
1550
1561
|
var CABRootSection = CABLayoutSection.extend({
|
|
1551
|
-
editorMode:
|
|
1562
|
+
editorMode: z25.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
1552
1563
|
experiment: CABExperiment.optional(),
|
|
1553
1564
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
1554
1565
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
1555
|
-
previewMode:
|
|
1556
|
-
storeId:
|
|
1566
|
+
previewMode: z25.boolean().nullish().transform((value) => value ?? false),
|
|
1567
|
+
storeId: z25.number().nullable().default(null),
|
|
1557
1568
|
targetArea: TargetArea.nullable(),
|
|
1558
1569
|
tracking: CABTracking,
|
|
1559
|
-
type:
|
|
1570
|
+
type: z25.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
1560
1571
|
uiLabels: CABUILabels,
|
|
1561
|
-
version:
|
|
1562
|
-
widgetId:
|
|
1572
|
+
version: z25.literal(2).default(2),
|
|
1573
|
+
widgetId: z25.number().nullable().default(null)
|
|
1563
1574
|
});
|
|
1564
1575
|
|
|
1565
1576
|
// src/schema/widgets/contentBlock.ts
|
|
1566
|
-
var ContentBlockV1 =
|
|
1567
|
-
blockSpacing:
|
|
1568
|
-
imageBlocks:
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
altText:
|
|
1572
|
-
description:
|
|
1573
|
-
id:
|
|
1574
|
-
imagePlacement:
|
|
1575
|
-
imageSize:
|
|
1576
|
-
imageUrl:
|
|
1577
|
-
textAlignment:
|
|
1577
|
+
var ContentBlockV1 = z26.object({
|
|
1578
|
+
blockSpacing: z26.enum(spacings).optional(),
|
|
1579
|
+
imageBlocks: z26.union([
|
|
1580
|
+
z26.array(
|
|
1581
|
+
z26.object({
|
|
1582
|
+
altText: z26.string().nullable(),
|
|
1583
|
+
description: z26.string().nullable(),
|
|
1584
|
+
id: z26.uuid(),
|
|
1585
|
+
imagePlacement: z26.enum(["top", "right", "bottom", "left"]),
|
|
1586
|
+
imageSize: z26.number(),
|
|
1587
|
+
imageUrl: z26.url(),
|
|
1588
|
+
textAlignment: z26.enum(["left", "center", "right"]),
|
|
1578
1589
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
1579
|
-
textSize:
|
|
1590
|
+
textSize: z26.enum(inlineTextSizeNames)
|
|
1580
1591
|
})
|
|
1581
1592
|
),
|
|
1582
|
-
|
|
1593
|
+
z26.strictObject({}).transform(() => [])
|
|
1583
1594
|
]).optional(),
|
|
1584
|
-
imageLayout:
|
|
1585
|
-
language:
|
|
1586
|
-
description:
|
|
1587
|
-
superTitle:
|
|
1588
|
-
title:
|
|
1595
|
+
imageLayout: z26.enum(["row", "column"]).optional(),
|
|
1596
|
+
language: z26.object({
|
|
1597
|
+
description: z26.string(),
|
|
1598
|
+
superTitle: z26.string(),
|
|
1599
|
+
title: z26.string()
|
|
1589
1600
|
}),
|
|
1590
|
-
previewMode:
|
|
1591
|
-
type:
|
|
1592
|
-
version:
|
|
1601
|
+
previewMode: z26.boolean(),
|
|
1602
|
+
type: z26.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block),
|
|
1603
|
+
version: z26.literal(1)
|
|
1593
1604
|
});
|
|
1594
|
-
var ContentBlock =
|
|
1605
|
+
var ContentBlock = z26.discriminatedUnion("version", [
|
|
1595
1606
|
ContentBlockV1,
|
|
1596
1607
|
CABRootSection.extend({
|
|
1597
|
-
type:
|
|
1608
|
+
type: z26.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
1598
1609
|
})
|
|
1599
1610
|
]);
|
|
1600
1611
|
|
|
1601
1612
|
// src/schema/widgets/giftWithPurchase.ts
|
|
1602
|
-
import { z as
|
|
1603
|
-
var GiftWithPurchase =
|
|
1604
|
-
type:
|
|
1613
|
+
import { z as z27 } from "zod";
|
|
1614
|
+
var GiftWithPurchase = z27.looseObject({
|
|
1615
|
+
type: z27.literal(WidgetType.gift_with_purchase).default(WidgetType.gift_with_purchase)
|
|
1605
1616
|
});
|
|
1606
1617
|
|
|
1607
1618
|
// src/schema/widgets/lineItemEditor.ts
|
|
1608
|
-
import { z as
|
|
1609
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
1610
|
-
downgradeToOneTimeLabel:
|
|
1619
|
+
import { z as z28 } from "zod";
|
|
1620
|
+
var LineItemEditorSwitchLanguageV1 = z28.object({
|
|
1621
|
+
downgradeToOneTimeLabel: z28.string().optional(),
|
|
1611
1622
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
1612
|
-
subscriptionOptionLabel:
|
|
1613
|
-
upgradeToSubscriptionLabel:
|
|
1614
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
1623
|
+
subscriptionOptionLabel: z28.string().optional(),
|
|
1624
|
+
upgradeToSubscriptionLabel: z28.string().optional(),
|
|
1625
|
+
upgradeToSubscriptionWithoutDiscountLabel: z28.string().optional()
|
|
1615
1626
|
});
|
|
1616
|
-
var LineItemEditorV1 =
|
|
1627
|
+
var LineItemEditorV1 = z28.object({
|
|
1617
1628
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
1618
|
-
button:
|
|
1619
|
-
previewMode:
|
|
1620
|
-
switchToSubscription:
|
|
1621
|
-
disableDowngrade:
|
|
1629
|
+
button: z28.object({ kind: z28.enum(["plain", "primary", "secondary"]).optional() }).optional(),
|
|
1630
|
+
previewMode: z28.boolean().optional(),
|
|
1631
|
+
switchToSubscription: z28.object({
|
|
1632
|
+
disableDowngrade: z28.boolean().optional(),
|
|
1622
1633
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
1623
1634
|
}).optional(),
|
|
1624
|
-
switchToSubscriptionEnabled:
|
|
1625
|
-
tracking:
|
|
1626
|
-
enableAttribution:
|
|
1627
|
-
enableSource:
|
|
1628
|
-
enableWidget:
|
|
1635
|
+
switchToSubscriptionEnabled: z28.boolean().optional(),
|
|
1636
|
+
tracking: z28.object({
|
|
1637
|
+
enableAttribution: z28.boolean().optional(),
|
|
1638
|
+
enableSource: z28.boolean().optional(),
|
|
1639
|
+
enableWidget: z28.boolean().optional()
|
|
1629
1640
|
}).optional(),
|
|
1630
|
-
type:
|
|
1631
|
-
version:
|
|
1641
|
+
type: z28.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
1642
|
+
version: z28.literal(1)
|
|
1632
1643
|
});
|
|
1633
|
-
var LineItemEditor =
|
|
1644
|
+
var LineItemEditor = z28.discriminatedUnion("version", [
|
|
1634
1645
|
LineItemEditorV1,
|
|
1635
1646
|
CABRootSection.extend({
|
|
1636
|
-
type:
|
|
1647
|
+
type: z28.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
1637
1648
|
})
|
|
1638
1649
|
]);
|
|
1639
1650
|
|
|
1640
1651
|
// src/schema/widgets/progressBar.ts
|
|
1641
|
-
import { z as
|
|
1642
|
-
var ProgressBar =
|
|
1643
|
-
type:
|
|
1652
|
+
import { z as z29 } from "zod";
|
|
1653
|
+
var ProgressBar = z29.looseObject({
|
|
1654
|
+
type: z29.literal(WidgetType.ui_extension_progress_bar).default(WidgetType.ui_extension_progress_bar)
|
|
1644
1655
|
});
|
|
1645
1656
|
|
|
1646
1657
|
// src/schema/widgets/rebuyButton.ts
|
|
1647
|
-
import { z as
|
|
1648
|
-
var RebuyButtonV1 =
|
|
1649
|
-
type:
|
|
1650
|
-
version:
|
|
1658
|
+
import { z as z30 } from "zod";
|
|
1659
|
+
var RebuyButtonV1 = z30.looseObject({
|
|
1660
|
+
type: z30.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button),
|
|
1661
|
+
version: z30.literal(1)
|
|
1651
1662
|
});
|
|
1652
|
-
var RebuyButton =
|
|
1663
|
+
var RebuyButton = z30.discriminatedUnion("version", [
|
|
1653
1664
|
RebuyButtonV1,
|
|
1654
1665
|
CABRootSection.extend({
|
|
1655
|
-
type:
|
|
1666
|
+
type: z30.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
1656
1667
|
})
|
|
1657
1668
|
]);
|
|
1658
1669
|
|
|
1659
1670
|
// src/schema/widgets/rebuyMonetize.ts
|
|
1660
|
-
import { z as
|
|
1661
|
-
var RebuyMonetize =
|
|
1662
|
-
type:
|
|
1671
|
+
import { z as z31 } from "zod";
|
|
1672
|
+
var RebuyMonetize = z31.looseObject({
|
|
1673
|
+
type: z31.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad)
|
|
1663
1674
|
});
|
|
1664
|
-
var RebuyMonetizeV1 =
|
|
1665
|
-
name:
|
|
1666
|
-
previewMode:
|
|
1675
|
+
var RebuyMonetizeV1 = z31.object({
|
|
1676
|
+
name: z31.string().nullable().optional(),
|
|
1677
|
+
previewMode: z31.boolean().optional(),
|
|
1667
1678
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
1668
|
-
privacyPolicyUrl:
|
|
1679
|
+
privacyPolicyUrl: z31.string().nullable().optional(),
|
|
1669
1680
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
1670
|
-
subVertical:
|
|
1671
|
-
tracking:
|
|
1672
|
-
enableAttribution:
|
|
1673
|
-
enableSource:
|
|
1674
|
-
enableWidget:
|
|
1681
|
+
subVertical: z31.string().nullable().optional(),
|
|
1682
|
+
tracking: z31.object({
|
|
1683
|
+
enableAttribution: z31.boolean().optional(),
|
|
1684
|
+
enableSource: z31.boolean().optional(),
|
|
1685
|
+
enableWidget: z31.boolean().optional()
|
|
1675
1686
|
}).optional(),
|
|
1676
|
-
type:
|
|
1677
|
-
version:
|
|
1687
|
+
type: z31.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
1688
|
+
version: z31.literal(1),
|
|
1678
1689
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
1679
|
-
vertical:
|
|
1690
|
+
vertical: z31.string().nullable().optional()
|
|
1680
1691
|
});
|
|
1681
1692
|
|
|
1682
1693
|
// src/schema/widgetData.ts
|
|
@@ -1690,7 +1701,7 @@ var extensionWidgetTypes = [
|
|
|
1690
1701
|
WidgetType.ui_extension_line_item_editor,
|
|
1691
1702
|
WidgetType.ui_extension_progress_bar
|
|
1692
1703
|
];
|
|
1693
|
-
var WidgetData =
|
|
1704
|
+
var WidgetData = z32.discriminatedUnion("type", [
|
|
1694
1705
|
ABTestingPlaceholder,
|
|
1695
1706
|
CheckoutExtension,
|
|
1696
1707
|
ContentBlock,
|