@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/widgets/checkout-and-beyond/banner.ts
|
|
2
|
-
import { z as
|
|
2
|
+
import { z as z22 } from "zod";
|
|
3
3
|
|
|
4
4
|
// src/schema/widgets/checkout-and-beyond/common.ts
|
|
5
5
|
var freezeEnum = (values) => Object.freeze(Object.fromEntries(values.map((v) => [v, v])));
|
|
@@ -175,6 +175,8 @@ var variableTypes = ["boolean", "number", "text"];
|
|
|
175
175
|
var VariableType = freezeEnum(variableTypes);
|
|
176
176
|
var variantModes = ["multiple", "single"];
|
|
177
177
|
var VariantMode = freezeEnum(variantModes);
|
|
178
|
+
var variantsModes = [...variantModes, "productGroup"];
|
|
179
|
+
var VariantsMode = freezeEnum(variantsModes);
|
|
178
180
|
var variantSelectors = ["menu", "radio", "button"];
|
|
179
181
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
180
182
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
@@ -209,18 +211,18 @@ var WidgetType = freezeEnum(widgetTypes);
|
|
|
209
211
|
|
|
210
212
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
211
213
|
import { v7 as uuidv713 } from "uuid";
|
|
212
|
-
import { z as
|
|
214
|
+
import { z as z21 } from "zod";
|
|
213
215
|
|
|
214
216
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
215
|
-
import { z as
|
|
217
|
+
import { z as z20 } from "zod";
|
|
216
218
|
|
|
217
219
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
218
220
|
import { v7 as uuidv73 } from "uuid";
|
|
219
|
-
import { z as
|
|
221
|
+
import { z as z6 } from "zod";
|
|
220
222
|
|
|
221
223
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
222
224
|
import { v7 as uuidv7 } from "uuid";
|
|
223
|
-
import { z as
|
|
225
|
+
import { z as z4 } from "zod";
|
|
224
226
|
|
|
225
227
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
226
228
|
var iconNames = [
|
|
@@ -306,6 +308,13 @@ var IconSize = freezeEnum(iconSizes);
|
|
|
306
308
|
var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "warning"];
|
|
307
309
|
var IconTone = freezeEnum(iconTones);
|
|
308
310
|
|
|
311
|
+
// src/schema/widgets/checkout-and-beyond/imageThumbnails.ts
|
|
312
|
+
import { z } from "zod";
|
|
313
|
+
var CABImageThumbnails = z.object({
|
|
314
|
+
limit: z.number().int().min(1).default(8),
|
|
315
|
+
perLine: z.number().int().min(1).max(8).default(4)
|
|
316
|
+
});
|
|
317
|
+
|
|
309
318
|
// src/schema/widgets/checkout-and-beyond/regex.ts
|
|
310
319
|
var ARRAY_INDEX_STRING = /^(0|[1-9]\d*)$/;
|
|
311
320
|
var DYNAMIC_TOKEN_REGEX = /^\{\{\s*[A-Za-z]+\s*\}\}$/;
|
|
@@ -382,10 +391,10 @@ var isTextType = isSectionType(SectionType.text);
|
|
|
382
391
|
var isVariantsType = isSectionType(SectionType.variants);
|
|
383
392
|
|
|
384
393
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
385
|
-
import { z as
|
|
394
|
+
import { z as z3 } from "zod";
|
|
386
395
|
|
|
387
396
|
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
388
|
-
import { z } from "zod";
|
|
397
|
+
import { z as z2 } from "zod";
|
|
389
398
|
var ruleTypes = [
|
|
390
399
|
"cart",
|
|
391
400
|
"cart_count",
|
|
@@ -404,7 +413,7 @@ var ruleTypes = [
|
|
|
404
413
|
"product_type",
|
|
405
414
|
"product_vendor"
|
|
406
415
|
];
|
|
407
|
-
var ruleType =
|
|
416
|
+
var ruleType = z2.enum(ruleTypes);
|
|
408
417
|
var RuleType = ruleType.enum;
|
|
409
418
|
var ruleOperators = [
|
|
410
419
|
"after",
|
|
@@ -419,124 +428,124 @@ var ruleOperators = [
|
|
|
419
428
|
"greater_than",
|
|
420
429
|
"less_than"
|
|
421
430
|
];
|
|
422
|
-
var ruleOperator =
|
|
431
|
+
var ruleOperator = z2.enum(ruleOperators);
|
|
423
432
|
var RuleOperator = ruleOperator.enum;
|
|
424
|
-
var RuleCondition =
|
|
425
|
-
operator:
|
|
426
|
-
products:
|
|
427
|
-
type:
|
|
428
|
-
value:
|
|
433
|
+
var RuleCondition = z2.object({
|
|
434
|
+
operator: z2.enum(ruleOperators).default(RuleOperator.anything),
|
|
435
|
+
products: z2.union([z2.array(z2.unknown()), z2.strictObject({}).transform(() => [])]).default(() => []),
|
|
436
|
+
type: z2.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
437
|
+
value: z2.coerce.string().default("")
|
|
429
438
|
});
|
|
430
|
-
var RuleLogicBlock =
|
|
431
|
-
rules:
|
|
439
|
+
var RuleLogicBlock = z2.object({
|
|
440
|
+
rules: z2.array(RuleCondition).default(() => [])
|
|
432
441
|
});
|
|
433
|
-
var CABRulesetEntry =
|
|
434
|
-
exitIfMatched:
|
|
435
|
-
logic:
|
|
436
|
-
output:
|
|
437
|
-
|
|
438
|
-
key:
|
|
439
|
-
type:
|
|
440
|
-
value:
|
|
442
|
+
var CABRulesetEntry = z2.object({
|
|
443
|
+
exitIfMatched: z2.boolean().default(true),
|
|
444
|
+
logic: z2.array(RuleLogicBlock).default(() => []),
|
|
445
|
+
output: z2.array(
|
|
446
|
+
z2.object({
|
|
447
|
+
key: z2.string().default("should_show"),
|
|
448
|
+
type: z2.literal("data_json").default("data_json"),
|
|
449
|
+
value: z2.string().default("true")
|
|
441
450
|
})
|
|
442
451
|
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
443
452
|
});
|
|
444
|
-
var CABRuleset =
|
|
453
|
+
var CABRuleset = z2.union([z2.array(CABRulesetEntry), z2.strictObject({}).transform(() => [])]).default(() => []);
|
|
445
454
|
|
|
446
455
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
447
|
-
var variableEffect =
|
|
448
|
-
var CABVariableSeed =
|
|
449
|
-
dataSourceId:
|
|
456
|
+
var variableEffect = z3.enum(variableEffects);
|
|
457
|
+
var CABVariableSeed = z3.object({
|
|
458
|
+
dataSourceId: z3.number().nullable().default(null),
|
|
450
459
|
ruleset: CABRuleset
|
|
451
460
|
});
|
|
452
|
-
var CABBooleanVariable =
|
|
461
|
+
var CABBooleanVariable = z3.object({
|
|
453
462
|
/**
|
|
454
463
|
* Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
|
|
455
464
|
* from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
|
|
456
465
|
* below; a cross-field default has no `.default()` spelling. An explicit value always wins.
|
|
457
466
|
*/
|
|
458
|
-
defaultValue:
|
|
459
|
-
name:
|
|
467
|
+
defaultValue: z3.boolean().optional(),
|
|
468
|
+
name: z3.string().min(1),
|
|
460
469
|
seed: CABVariableSeed.optional(),
|
|
461
470
|
/** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
|
|
462
|
-
type:
|
|
471
|
+
type: z3.literal(VariableType.boolean).default(VariableType.boolean)
|
|
463
472
|
});
|
|
464
|
-
var CABTextVariable =
|
|
465
|
-
defaultValue:
|
|
466
|
-
name:
|
|
467
|
-
seed:
|
|
468
|
-
type:
|
|
473
|
+
var CABTextVariable = z3.object({
|
|
474
|
+
defaultValue: z3.string(),
|
|
475
|
+
name: z3.string().min(1),
|
|
476
|
+
seed: z3.never().optional(),
|
|
477
|
+
type: z3.literal(VariableType.text)
|
|
469
478
|
});
|
|
470
|
-
var CABNumberVariable =
|
|
471
|
-
defaultValue:
|
|
472
|
-
name:
|
|
473
|
-
seed:
|
|
474
|
-
type:
|
|
479
|
+
var CABNumberVariable = z3.object({
|
|
480
|
+
defaultValue: z3.number(),
|
|
481
|
+
name: z3.string().min(1),
|
|
482
|
+
seed: z3.never().optional(),
|
|
483
|
+
type: z3.literal(VariableType.number)
|
|
475
484
|
});
|
|
476
|
-
var CABVariable =
|
|
485
|
+
var CABVariable = z3.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
|
|
477
486
|
(variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
|
|
478
487
|
);
|
|
479
|
-
var CABVariableEffect =
|
|
488
|
+
var CABVariableEffect = z3.object({
|
|
480
489
|
effect: variableEffect.default(VariableEffect.toggle),
|
|
481
|
-
variable:
|
|
490
|
+
variable: z3.string().min(1)
|
|
482
491
|
});
|
|
483
|
-
var CABVisibility =
|
|
484
|
-
variable:
|
|
485
|
-
visibleWhen:
|
|
492
|
+
var CABVisibility = z3.object({
|
|
493
|
+
variable: z3.string().min(1),
|
|
494
|
+
visibleWhen: z3.boolean().default(true)
|
|
486
495
|
});
|
|
487
|
-
var contentOperator =
|
|
488
|
-
var resultCountOperator =
|
|
489
|
-
var resultTagOperator =
|
|
490
|
-
var mutatorEvent =
|
|
491
|
-
var CABContentTrigger =
|
|
496
|
+
var contentOperator = z3.enum(contentOperators);
|
|
497
|
+
var resultCountOperator = z3.enum(resultCountOperators);
|
|
498
|
+
var resultTagOperator = z3.enum(resultTagOperators);
|
|
499
|
+
var mutatorEvent = z3.enum(mutatorEvents);
|
|
500
|
+
var CABContentTrigger = z3.object({
|
|
492
501
|
operator: contentOperator.default(ContentOperator.is_empty),
|
|
493
|
-
type:
|
|
502
|
+
type: z3.literal("content")
|
|
494
503
|
});
|
|
495
|
-
var CABResultCountTrigger =
|
|
504
|
+
var CABResultCountTrigger = z3.object({
|
|
496
505
|
operator: resultCountOperator.default(ResultCountOperator.equals),
|
|
497
|
-
type:
|
|
498
|
-
value:
|
|
506
|
+
type: z3.literal("result_count"),
|
|
507
|
+
value: z3.number().default(0)
|
|
499
508
|
});
|
|
500
|
-
var CABResultTagTrigger =
|
|
509
|
+
var CABResultTagTrigger = z3.object({
|
|
501
510
|
operator: resultTagOperator.default(ResultTagOperator.contains),
|
|
502
|
-
type:
|
|
503
|
-
value:
|
|
511
|
+
type: z3.literal("result_tag"),
|
|
512
|
+
value: z3.string().min(1)
|
|
504
513
|
});
|
|
505
|
-
var CABEventTrigger =
|
|
514
|
+
var CABEventTrigger = z3.object({
|
|
506
515
|
event: mutatorEvent,
|
|
507
|
-
type:
|
|
516
|
+
type: z3.literal("event")
|
|
508
517
|
});
|
|
509
|
-
var CABVariableTrigger =
|
|
518
|
+
var CABVariableTrigger = z3.discriminatedUnion("type", [
|
|
510
519
|
CABContentTrigger,
|
|
511
520
|
CABEventTrigger,
|
|
512
521
|
CABResultCountTrigger,
|
|
513
522
|
CABResultTagTrigger
|
|
514
523
|
]);
|
|
515
|
-
var CABVariableMutator =
|
|
524
|
+
var CABVariableMutator = z3.object({
|
|
516
525
|
effect: variableEffect.default(VariableEffect.set_false),
|
|
517
|
-
variable:
|
|
526
|
+
variable: z3.string().min(1),
|
|
518
527
|
when: CABVariableTrigger
|
|
519
528
|
});
|
|
520
529
|
var CABVariableFields = {
|
|
521
|
-
mutators:
|
|
522
|
-
variables:
|
|
530
|
+
mutators: z3.array(CABVariableMutator).optional(),
|
|
531
|
+
variables: z3.array(CABVariable).refine((variables) => new Set(variables.map(({ name }) => name)).size === variables.length, {
|
|
523
532
|
message: "variable names must be unique within a section"
|
|
524
533
|
}).optional(),
|
|
525
534
|
visibility: CABVisibility.optional()
|
|
526
535
|
};
|
|
527
536
|
|
|
528
537
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
529
|
-
var CABImageSectionFields =
|
|
538
|
+
var CABImageSectionFields = z4.object({
|
|
530
539
|
...CABVariableFields,
|
|
531
|
-
altText:
|
|
540
|
+
altText: z4.string().refine(checkForHTML, NO_HTML).default(""),
|
|
532
541
|
/**
|
|
533
542
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
534
543
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
535
544
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
536
545
|
*/
|
|
537
|
-
aspectRatio:
|
|
538
|
-
border:
|
|
539
|
-
buttonField:
|
|
546
|
+
aspectRatio: z4.number().positive().nullable().default(null),
|
|
547
|
+
border: z4.lazy(() => CABBorder),
|
|
548
|
+
buttonField: z4.enum(buttonFields).optional(),
|
|
540
549
|
/**
|
|
541
550
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
542
551
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -555,29 +564,30 @@ var CABImageSectionFields = z3.object({
|
|
|
555
564
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
556
565
|
* the risky half.
|
|
557
566
|
*/
|
|
558
|
-
category:
|
|
567
|
+
category: z4.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
559
568
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
560
|
-
iconSize:
|
|
569
|
+
iconSize: z4.enum(iconSizes).nullable().default(null),
|
|
561
570
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
562
|
-
iconTone:
|
|
563
|
-
name:
|
|
564
|
-
naturalHeight:
|
|
565
|
-
naturalWidth:
|
|
571
|
+
iconTone: z4.enum(iconTones).nullable().default(null),
|
|
572
|
+
name: z4.string().optional(),
|
|
573
|
+
naturalHeight: z4.number().default(0),
|
|
574
|
+
naturalWidth: z4.number().default(0),
|
|
566
575
|
/**
|
|
567
576
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
568
577
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
569
578
|
*/
|
|
570
|
-
objectFit:
|
|
571
|
-
sectionId:
|
|
572
|
-
sectionType:
|
|
579
|
+
objectFit: z4.enum(objectFits).default(ObjectFit.contain),
|
|
580
|
+
sectionId: z4.uuid().default(() => uuidv7()),
|
|
581
|
+
sectionType: z4.literal(SectionType.image).default(SectionType.image),
|
|
573
582
|
/**
|
|
574
583
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
575
584
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
576
585
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
577
586
|
* server-chosen tier icon actually needs it.
|
|
578
587
|
*/
|
|
579
|
-
source:
|
|
580
|
-
|
|
588
|
+
source: z4.union([z4.url(), z4.literal(""), z4.string().regex(DYNAMIC_TOKEN_REGEX), z4.enum(iconNames)]).default(""),
|
|
589
|
+
thumbnails: CABImageThumbnails.optional(),
|
|
590
|
+
width: z4.number().default(100)
|
|
581
591
|
});
|
|
582
592
|
var iconNameSet = new Set(iconNames);
|
|
583
593
|
var isIconName = (source) => iconNameSet.has(source);
|
|
@@ -599,71 +609,71 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, c
|
|
|
599
609
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
600
610
|
import { forEach, isString as isString2 } from "es-toolkit/compat";
|
|
601
611
|
import { v7 as uuidv72 } from "uuid";
|
|
602
|
-
import { z as
|
|
603
|
-
var enumOrOmit = (...vals) =>
|
|
604
|
-
var TiptapText =
|
|
605
|
-
marks:
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
attrs:
|
|
612
|
-
class:
|
|
613
|
-
href:
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
612
|
+
import { z as z5 } from "zod";
|
|
613
|
+
var enumOrOmit = (...vals) => z5.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
614
|
+
var TiptapText = z5.object({
|
|
615
|
+
marks: z5.union([
|
|
616
|
+
z5.array(
|
|
617
|
+
z5.discriminatedUnion("type", [
|
|
618
|
+
z5.object({ type: z5.literal("bold") }),
|
|
619
|
+
z5.object({ type: z5.literal("italic") }),
|
|
620
|
+
z5.object({
|
|
621
|
+
attrs: z5.object({
|
|
622
|
+
class: z5.string().nullable(),
|
|
623
|
+
href: z5.union([
|
|
624
|
+
z5.url(),
|
|
625
|
+
z5.literal("#"),
|
|
626
|
+
z5.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
627
|
+
z5.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
618
628
|
]),
|
|
619
|
-
rel:
|
|
620
|
-
target:
|
|
629
|
+
rel: z5.string().default("noopener noreferrer nofollow"),
|
|
630
|
+
target: z5.string().default("_blank")
|
|
621
631
|
}),
|
|
622
|
-
type:
|
|
632
|
+
type: z5.literal("link")
|
|
623
633
|
}),
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
attrs:
|
|
634
|
+
z5.object({ type: z5.literal("strike") }),
|
|
635
|
+
z5.object({
|
|
636
|
+
attrs: z5.object({
|
|
627
637
|
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
628
638
|
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
629
639
|
}),
|
|
630
|
-
type:
|
|
640
|
+
type: z5.literal("textStyle")
|
|
631
641
|
})
|
|
632
642
|
])
|
|
633
643
|
),
|
|
634
|
-
|
|
644
|
+
z5.strictObject({}).transform(() => [])
|
|
635
645
|
]).optional(),
|
|
636
|
-
text:
|
|
637
|
-
type:
|
|
646
|
+
text: z5.string().default(""),
|
|
647
|
+
type: z5.literal("text").default("text")
|
|
638
648
|
});
|
|
639
|
-
var TiptapParagraph =
|
|
640
|
-
attrs:
|
|
649
|
+
var TiptapParagraph = z5.object({
|
|
650
|
+
attrs: z5.object({
|
|
641
651
|
textAlign: enumOrOmit(...textAlignments)
|
|
642
652
|
}).default({ textAlign: TextAlignment.start }),
|
|
643
|
-
content:
|
|
644
|
-
type:
|
|
653
|
+
content: z5.union([z5.array(TiptapText), z5.strictObject({}).transform(() => [])]).default(() => []),
|
|
654
|
+
type: z5.literal("paragraph").default("paragraph")
|
|
645
655
|
});
|
|
646
|
-
var TiptapDocument =
|
|
647
|
-
attrs:
|
|
656
|
+
var TiptapDocument = z5.object({
|
|
657
|
+
attrs: z5.object({
|
|
648
658
|
blockSpacing: enumOrOmit(...spacings)
|
|
649
659
|
}).default({ blockSpacing: Spacing.base }),
|
|
650
|
-
content:
|
|
651
|
-
type:
|
|
660
|
+
content: z5.union([z5.array(TiptapParagraph), z5.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
661
|
+
type: z5.literal("doc").default("doc")
|
|
652
662
|
});
|
|
653
|
-
var CABTextTier =
|
|
654
|
-
threshold:
|
|
655
|
-
thresholds:
|
|
656
|
-
tierId:
|
|
657
|
-
tierType:
|
|
663
|
+
var CABTextTier = z5.object({
|
|
664
|
+
threshold: z5.number().int().nonnegative(),
|
|
665
|
+
thresholds: z5.record(z5.string(), z5.number().int().nonnegative()).default(() => ({})),
|
|
666
|
+
tierId: z5.string().optional(),
|
|
667
|
+
tierType: z5.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
658
668
|
});
|
|
659
|
-
var CABTextSection =
|
|
669
|
+
var CABTextSection = z5.object({
|
|
660
670
|
...CABVariableFields,
|
|
661
|
-
buttonField:
|
|
662
|
-
content:
|
|
663
|
-
name:
|
|
664
|
-
optionId:
|
|
665
|
-
sectionId:
|
|
666
|
-
sectionType:
|
|
671
|
+
buttonField: z5.enum(buttonFields).optional(),
|
|
672
|
+
content: z5.record(z5.string(), z5.union([z5.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
673
|
+
name: z5.string().optional(),
|
|
674
|
+
optionId: z5.number().optional(),
|
|
675
|
+
sectionId: z5.uuid().default(() => uuidv72()),
|
|
676
|
+
sectionType: z5.literal(SectionType.text).default(SectionType.text),
|
|
667
677
|
tier: CABTextTier.optional()
|
|
668
678
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
669
679
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
@@ -685,35 +695,35 @@ var CABTextSection = z4.object({
|
|
|
685
695
|
});
|
|
686
696
|
|
|
687
697
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
688
|
-
var CABButtonContent =
|
|
689
|
-
() =>
|
|
698
|
+
var CABButtonContent = z6.lazy(
|
|
699
|
+
() => z6.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
690
700
|
);
|
|
691
|
-
var CABButtonSection =
|
|
701
|
+
var CABButtonSection = z6.object({
|
|
692
702
|
...CABVariableFields,
|
|
693
|
-
action:
|
|
694
|
-
buttonStyle:
|
|
695
|
-
custom:
|
|
696
|
-
color:
|
|
697
|
-
height:
|
|
698
|
-
width:
|
|
703
|
+
action: z6.union([z6.literal(""), z6.enum(buttonActions)]).default(""),
|
|
704
|
+
buttonStyle: z6.enum(buttonStyles).default(ButtonStyle.primary),
|
|
705
|
+
custom: z6.object({
|
|
706
|
+
color: z6.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
707
|
+
height: z6.number().default(52),
|
|
708
|
+
width: z6.number().default(300)
|
|
699
709
|
}).default({
|
|
700
710
|
color: "#005bd3",
|
|
701
711
|
height: 52,
|
|
702
712
|
width: 300
|
|
703
713
|
}),
|
|
704
|
-
disableDowngrade:
|
|
705
|
-
name:
|
|
706
|
-
optionId:
|
|
707
|
-
popover:
|
|
708
|
-
alignment:
|
|
709
|
-
position:
|
|
714
|
+
disableDowngrade: z6.boolean().default(false),
|
|
715
|
+
name: z6.string().optional(),
|
|
716
|
+
optionId: z6.number().optional(),
|
|
717
|
+
popover: z6.object({
|
|
718
|
+
alignment: z6.enum(textAlignments).default(TextAlignment.center),
|
|
719
|
+
position: z6.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
710
720
|
}).optional().default(() => ({
|
|
711
721
|
alignment: TextAlignment.center,
|
|
712
722
|
position: PopoverPosition.blockStart
|
|
713
723
|
})),
|
|
714
|
-
sectionId:
|
|
715
|
-
sections:
|
|
716
|
-
sectionType:
|
|
724
|
+
sectionId: z6.uuid().default(() => uuidv73()),
|
|
725
|
+
sections: z6.union([z6.array(CABButtonContent), z6.strictObject({}).transform(() => [])]).default(() => []),
|
|
726
|
+
sectionType: z6.literal(SectionType.button).default(SectionType.button),
|
|
717
727
|
/**
|
|
718
728
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
719
729
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -728,25 +738,25 @@ var CABButtonSection = z5.object({
|
|
|
728
738
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
729
739
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
730
740
|
*/
|
|
731
|
-
tier:
|
|
741
|
+
tier: z6.object({ tierId: z6.string().min(1) }).optional(),
|
|
732
742
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
733
|
-
trackingUrl:
|
|
743
|
+
trackingUrl: z6.string().optional(),
|
|
734
744
|
/**
|
|
735
745
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
736
746
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
737
747
|
*/
|
|
738
|
-
variableEffects:
|
|
748
|
+
variableEffects: z6.array(CABVariableEffect).optional()
|
|
739
749
|
});
|
|
740
750
|
|
|
741
751
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
742
|
-
import { z as
|
|
752
|
+
import { z as z11 } from "zod";
|
|
743
753
|
|
|
744
754
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
745
|
-
import { z as
|
|
755
|
+
import { z as z10 } from "zod";
|
|
746
756
|
|
|
747
757
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
748
758
|
import { v7 as uuidv74 } from "uuid";
|
|
749
|
-
import { z as
|
|
759
|
+
import { z as z7 } from "zod";
|
|
750
760
|
|
|
751
761
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
752
762
|
import { uniqBy } from "es-toolkit";
|
|
@@ -800,77 +810,77 @@ var targetAreas = {
|
|
|
800
810
|
};
|
|
801
811
|
|
|
802
812
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
803
|
-
var CABDiscount =
|
|
804
|
-
amount:
|
|
805
|
-
discountedBy:
|
|
806
|
-
discountedFrom:
|
|
807
|
-
type:
|
|
813
|
+
var CABDiscount = z7.object({
|
|
814
|
+
amount: z7.union([z7.number(), z7.string()]).catch(0),
|
|
815
|
+
discountedBy: z7.string().optional(),
|
|
816
|
+
discountedFrom: z7.enum(discountSources).optional().catch(void 0),
|
|
817
|
+
type: z7.enum(discountTypes).catch("none")
|
|
808
818
|
});
|
|
809
|
-
var CABIntegrations =
|
|
810
|
-
judgeme:
|
|
811
|
-
junip:
|
|
812
|
-
klaviyo:
|
|
813
|
-
loox:
|
|
814
|
-
okendo:
|
|
815
|
-
opinew:
|
|
816
|
-
reviewsio:
|
|
817
|
-
stamped:
|
|
818
|
-
yotpo:
|
|
819
|
+
var CABIntegrations = z7.object({
|
|
820
|
+
judgeme: z7.boolean().default(false),
|
|
821
|
+
junip: z7.boolean().default(false),
|
|
822
|
+
klaviyo: z7.boolean().default(false),
|
|
823
|
+
loox: z7.boolean().default(false),
|
|
824
|
+
okendo: z7.boolean().default(false),
|
|
825
|
+
opinew: z7.boolean().default(false),
|
|
826
|
+
reviewsio: z7.boolean().default(false),
|
|
827
|
+
stamped: z7.boolean().default(false),
|
|
828
|
+
yotpo: z7.boolean().default(false)
|
|
819
829
|
});
|
|
820
|
-
var CABVariantLabels =
|
|
821
|
-
variantOption:
|
|
822
|
-
variantOptions:
|
|
830
|
+
var CABVariantLabels = z7.object({
|
|
831
|
+
variantOption: z7.string().optional().catch(void 0),
|
|
832
|
+
variantOptions: z7.string().optional().catch(void 0)
|
|
823
833
|
});
|
|
824
|
-
var CABDataSourceSection =
|
|
825
|
-
dataSourceId:
|
|
826
|
-
dataSourcePath:
|
|
834
|
+
var CABDataSourceSection = z7.object({
|
|
835
|
+
dataSourceId: z7.number().nullable().default(null),
|
|
836
|
+
dataSourcePath: z7.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
827
837
|
discount: CABDiscount.optional(),
|
|
828
838
|
integrations: CABIntegrations.optional(),
|
|
829
|
-
limit:
|
|
830
|
-
matchVariant:
|
|
831
|
-
matchVariantOutOfStock:
|
|
832
|
-
name:
|
|
833
|
-
productType:
|
|
834
|
-
sectionId:
|
|
835
|
-
sectionType:
|
|
839
|
+
limit: z7.number().default(1),
|
|
840
|
+
matchVariant: z7.boolean().default(false),
|
|
841
|
+
matchVariantOutOfStock: z7.boolean().default(false),
|
|
842
|
+
name: z7.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
843
|
+
productType: z7.enum(productTypes).optional(),
|
|
844
|
+
sectionId: z7.uuid().default(() => uuidv74()),
|
|
845
|
+
sectionType: z7.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
836
846
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
837
|
-
subscriptionIsDefault:
|
|
838
|
-
treatAsGwp:
|
|
847
|
+
subscriptionIsDefault: z7.boolean().default(false),
|
|
848
|
+
treatAsGwp: z7.boolean().default(false),
|
|
839
849
|
variantLabels: CABVariantLabels.optional().catch(void 0)
|
|
840
850
|
});
|
|
841
851
|
|
|
842
852
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
843
853
|
import { v7 as uuidv76 } from "uuid";
|
|
844
|
-
import { z as
|
|
854
|
+
import { z as z9 } from "zod";
|
|
845
855
|
|
|
846
856
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
847
857
|
import { v7 as uuidv75 } from "uuid";
|
|
848
|
-
import { z as
|
|
849
|
-
var CABVariantContent =
|
|
850
|
-
() =>
|
|
858
|
+
import { z as z8 } from "zod";
|
|
859
|
+
var CABVariantContent = z8.lazy(
|
|
860
|
+
() => z8.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
851
861
|
);
|
|
852
|
-
var CABProductSection =
|
|
862
|
+
var CABProductSection = z8.object({
|
|
853
863
|
...CABVariableFields,
|
|
854
|
-
name:
|
|
855
|
-
productId:
|
|
856
|
-
sectionId:
|
|
857
|
-
sections:
|
|
858
|
-
sectionType:
|
|
859
|
-
selectors:
|
|
860
|
-
variantMode:
|
|
864
|
+
name: z8.string().optional(),
|
|
865
|
+
productId: z8.number().nullable().default(null),
|
|
866
|
+
sectionId: z8.uuid().default(() => uuidv75()),
|
|
867
|
+
sections: z8.union([z8.array(CABVariantContent), z8.strictObject({}).transform(() => [])]).default(() => []),
|
|
868
|
+
sectionType: z8.literal(SectionType.product).default(SectionType.product),
|
|
869
|
+
selectors: z8.record(z8.string(), z8.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
870
|
+
variantMode: z8.enum(variantModes).default(VariantMode.multiple)
|
|
861
871
|
});
|
|
862
872
|
|
|
863
873
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
864
|
-
var CABProductsSection =
|
|
874
|
+
var CABProductsSection = z9.object({
|
|
865
875
|
...CABVariableFields,
|
|
866
|
-
name:
|
|
867
|
-
sectionId:
|
|
868
|
-
sections:
|
|
869
|
-
sectionType:
|
|
876
|
+
name: z9.string().optional(),
|
|
877
|
+
sectionId: z9.uuid().default(() => uuidv76()),
|
|
878
|
+
sections: z9.union([z9.array(z9.lazy(() => CABProductSection)), z9.strictObject({}).transform(() => [])]).default(() => []),
|
|
879
|
+
sectionType: z9.literal(SectionType.products).default(SectionType.products)
|
|
870
880
|
});
|
|
871
881
|
|
|
872
882
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
873
|
-
var CABOffersSection =
|
|
883
|
+
var CABOffersSection = z10.lazy(
|
|
874
884
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
875
885
|
/**
|
|
876
886
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -878,8 +888,8 @@ var CABOffersSection = z9.lazy(
|
|
|
878
888
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
879
889
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
880
890
|
*/
|
|
881
|
-
divider:
|
|
882
|
-
sections:
|
|
891
|
+
divider: z10.boolean().optional(),
|
|
892
|
+
sections: z10.union([z10.array(z10.lazy(() => CABSection)), z10.strictObject({}).transform(() => [])]).default(() => [
|
|
883
893
|
CABBannerSection.parse({
|
|
884
894
|
buttonField: "undoAddToOrder",
|
|
885
895
|
color: "success",
|
|
@@ -893,77 +903,77 @@ var CABOffersSection = z9.lazy(
|
|
|
893
903
|
CABDataSourceSection.parse({}),
|
|
894
904
|
CABProductsSection.parse({})
|
|
895
905
|
]),
|
|
896
|
-
sectionType:
|
|
906
|
+
sectionType: z10.literal(SectionType.offers).default(SectionType.offers)
|
|
897
907
|
})
|
|
898
908
|
);
|
|
899
909
|
|
|
900
910
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
901
|
-
var CABCarouselSection =
|
|
911
|
+
var CABCarouselSection = z11.lazy(
|
|
902
912
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
903
|
-
autoAdvanceInterval:
|
|
904
|
-
itemsAtOnce:
|
|
913
|
+
autoAdvanceInterval: z11.number().default(0),
|
|
914
|
+
itemsAtOnce: z11.number().min(1).default(1),
|
|
905
915
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
906
|
-
offersDirection:
|
|
907
|
-
sections:
|
|
908
|
-
sectionType:
|
|
916
|
+
offersDirection: z11.enum(offersDirections).default("vertical"),
|
|
917
|
+
sections: z11.union([z11.array(z11.lazy(() => CABSection)), z11.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
918
|
+
sectionType: z11.literal(SectionType.carousel).default(SectionType.carousel)
|
|
909
919
|
})
|
|
910
920
|
);
|
|
911
921
|
|
|
912
922
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
913
|
-
import { z as
|
|
914
|
-
var CABCartLineSection =
|
|
923
|
+
import { z as z12 } from "zod";
|
|
924
|
+
var CABCartLineSection = z12.lazy(
|
|
915
925
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
916
|
-
sections:
|
|
917
|
-
sectionType:
|
|
926
|
+
sections: z12.union([z12.array(z12.lazy(() => CABSection)), z12.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
927
|
+
sectionType: z12.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
918
928
|
})
|
|
919
929
|
);
|
|
920
930
|
|
|
921
931
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
922
932
|
import { v7 as uuidv77 } from "uuid";
|
|
923
|
-
import { z as
|
|
924
|
-
var CABDiscountSection =
|
|
933
|
+
import { z as z13 } from "zod";
|
|
934
|
+
var CABDiscountSection = z13.object({
|
|
925
935
|
...CABVariableFields,
|
|
926
|
-
amount:
|
|
927
|
-
discountedBy:
|
|
928
|
-
discountedFrom:
|
|
929
|
-
message:
|
|
930
|
-
name:
|
|
931
|
-
quantity:
|
|
932
|
-
sectionId:
|
|
933
|
-
sectionType:
|
|
934
|
-
type:
|
|
936
|
+
amount: z13.union([z13.number(), z13.string()]).catch(0),
|
|
937
|
+
discountedBy: z13.string().optional(),
|
|
938
|
+
discountedFrom: z13.enum(discountSources).optional().catch(void 0),
|
|
939
|
+
message: z13.string().optional(),
|
|
940
|
+
name: z13.string().optional(),
|
|
941
|
+
quantity: z13.number().default(1),
|
|
942
|
+
sectionId: z13.uuid().default(() => uuidv77()),
|
|
943
|
+
sectionType: z13.literal(SectionType.discount).default(SectionType.discount),
|
|
944
|
+
type: z13.enum(discountTypes).catch("none")
|
|
935
945
|
});
|
|
936
946
|
|
|
937
947
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
938
948
|
import { v7 as uuidv78 } from "uuid";
|
|
939
|
-
import { z as
|
|
940
|
-
var CABMonetizeAds =
|
|
941
|
-
requestId:
|
|
949
|
+
import { z as z14 } from "zod";
|
|
950
|
+
var CABMonetizeAds = z14.object({
|
|
951
|
+
requestId: z14.string().optional(),
|
|
942
952
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
943
|
-
testing:
|
|
953
|
+
testing: z14.boolean().default(false)
|
|
944
954
|
});
|
|
945
|
-
var CABMonetizeSection =
|
|
955
|
+
var CABMonetizeSection = z14.object({
|
|
946
956
|
...CABVariableFields,
|
|
947
957
|
ads: CABMonetizeAds.optional(),
|
|
948
|
-
name:
|
|
958
|
+
name: z14.string().optional(),
|
|
949
959
|
/**
|
|
950
960
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
951
961
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
952
962
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
953
963
|
*/
|
|
954
|
-
offers:
|
|
964
|
+
offers: z14.array(z14.lazy(() => CABSection)).optional(),
|
|
955
965
|
/** 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. */
|
|
956
|
-
privacyPolicyUrl:
|
|
957
|
-
sectionId:
|
|
958
|
-
sectionType:
|
|
966
|
+
privacyPolicyUrl: z14.string().optional(),
|
|
967
|
+
sectionId: z14.uuid().default(() => uuidv78()),
|
|
968
|
+
sectionType: z14.literal(SectionType.monetize).default(SectionType.monetize),
|
|
959
969
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
960
|
-
subVertical:
|
|
970
|
+
subVertical: z14.string().optional(),
|
|
961
971
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
962
|
-
vertical:
|
|
972
|
+
vertical: z14.string().optional()
|
|
963
973
|
});
|
|
964
974
|
|
|
965
975
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
966
|
-
import { z as
|
|
976
|
+
import { z as z15 } from "zod";
|
|
967
977
|
|
|
968
978
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
969
979
|
var GIFT_LABELS = {
|
|
@@ -1082,34 +1092,34 @@ var GIFT_LABELS = {
|
|
|
1082
1092
|
};
|
|
1083
1093
|
|
|
1084
1094
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
1085
|
-
var CABProgressTierExclusion =
|
|
1086
|
-
collectionIds:
|
|
1087
|
-
productIds:
|
|
1088
|
-
tags:
|
|
1089
|
-
type:
|
|
1095
|
+
var CABProgressTierExclusion = z15.object({
|
|
1096
|
+
collectionIds: z15.array(z15.number().int().positive()).default(() => []),
|
|
1097
|
+
productIds: z15.array(z15.number().int().positive()).default(() => []),
|
|
1098
|
+
tags: z15.array(z15.string().min(1)).default(() => []),
|
|
1099
|
+
type: z15.enum(progressTierExclusionTypes)
|
|
1090
1100
|
});
|
|
1091
|
-
var CABProgressTier =
|
|
1101
|
+
var CABProgressTier = z15.object({
|
|
1092
1102
|
/**
|
|
1093
1103
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
1094
1104
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
1095
1105
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
1096
1106
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
1097
1107
|
*/
|
|
1098
|
-
discount:
|
|
1108
|
+
discount: z15.object({ amount: z15.number().nonnegative(), type: z15.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
1099
1109
|
/**
|
|
1100
1110
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
1101
1111
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
1102
1112
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
1103
1113
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
1104
1114
|
*/
|
|
1105
|
-
exclusions:
|
|
1115
|
+
exclusions: z15.array(CABProgressTierExclusion).default(() => []),
|
|
1106
1116
|
/**
|
|
1107
1117
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
1108
1118
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
1109
1119
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
1110
1120
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
1111
1121
|
*/
|
|
1112
|
-
filterOosVariants:
|
|
1122
|
+
filterOosVariants: z15.boolean().default(false),
|
|
1113
1123
|
/**
|
|
1114
1124
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
1115
1125
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -1117,10 +1127,10 @@ var CABProgressTier = z14.object({
|
|
|
1117
1127
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
1118
1128
|
* tree is complete.
|
|
1119
1129
|
*/
|
|
1120
|
-
gift:
|
|
1121
|
-
productId:
|
|
1122
|
-
title:
|
|
1123
|
-
variantIds:
|
|
1130
|
+
gift: z15.object({
|
|
1131
|
+
productId: z15.number().int().positive(),
|
|
1132
|
+
title: z15.string().optional(),
|
|
1133
|
+
variantIds: z15.array(z15.number().int().positive()).default(() => [])
|
|
1124
1134
|
}).optional(),
|
|
1125
1135
|
/**
|
|
1126
1136
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -1140,7 +1150,7 @@ var CABProgressTier = z14.object({
|
|
|
1140
1150
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
1141
1151
|
* React's size rather than the old hardcoded 20.
|
|
1142
1152
|
*/
|
|
1143
|
-
iconSizePx:
|
|
1153
|
+
iconSizePx: z15.number().int().min(1).max(64).default(18),
|
|
1144
1154
|
/**
|
|
1145
1155
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
1146
1156
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -1150,35 +1160,35 @@ var CABProgressTier = z14.object({
|
|
|
1150
1160
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
1151
1161
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
1152
1162
|
*/
|
|
1153
|
-
label:
|
|
1163
|
+
label: z15.record(z15.string(), z15.string()).optional(),
|
|
1154
1164
|
/**
|
|
1155
1165
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
1156
1166
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
1157
1167
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
1158
1168
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
1159
1169
|
*/
|
|
1160
|
-
productTierImage:
|
|
1170
|
+
productTierImage: z15.boolean().default(false),
|
|
1161
1171
|
/**
|
|
1162
1172
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
1163
1173
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
1164
1174
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
1165
1175
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
1166
1176
|
*/
|
|
1167
|
-
threshold:
|
|
1177
|
+
threshold: z15.number().int().nonnegative(),
|
|
1168
1178
|
/**
|
|
1169
1179
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
1170
1180
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
1171
1181
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
1172
1182
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
1173
1183
|
*/
|
|
1174
|
-
thresholds:
|
|
1184
|
+
thresholds: z15.record(z15.string(), z15.number().int().nonnegative()).default(() => ({})),
|
|
1175
1185
|
/**
|
|
1176
1186
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
1177
1187
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
1178
1188
|
* shipping bar (single unlabeled tier, no gift).
|
|
1179
1189
|
*/
|
|
1180
|
-
tierId:
|
|
1181
|
-
tierType:
|
|
1190
|
+
tierId: z15.string().optional(),
|
|
1191
|
+
tierType: z15.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
1182
1192
|
/**
|
|
1183
1193
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
1184
1194
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -1189,9 +1199,9 @@ var CABProgressTier = z14.object({
|
|
|
1189
1199
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
1190
1200
|
* template text supplies grammatically-neutral wording around the token.
|
|
1191
1201
|
*/
|
|
1192
|
-
unit:
|
|
1202
|
+
unit: z15.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
1193
1203
|
});
|
|
1194
|
-
var CABProgressBarSection =
|
|
1204
|
+
var CABProgressBarSection = z15.lazy(
|
|
1195
1205
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1196
1206
|
/**
|
|
1197
1207
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -1200,35 +1210,35 @@ var CABProgressBarSection = z14.lazy(
|
|
|
1200
1210
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
1201
1211
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
1202
1212
|
*/
|
|
1203
|
-
barId:
|
|
1213
|
+
barId: z15.string().optional(),
|
|
1204
1214
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
1205
|
-
countryCodes:
|
|
1215
|
+
countryCodes: z15.array(z15.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1206
1216
|
/**
|
|
1207
1217
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
1208
1218
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
1209
1219
|
*/
|
|
1210
|
-
excludeCountryCodes:
|
|
1220
|
+
excludeCountryCodes: z15.array(z15.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1211
1221
|
/**
|
|
1212
1222
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
1213
1223
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
1214
1224
|
* adds the cart's discount allocations back to the live subtotal.
|
|
1215
1225
|
*/
|
|
1216
|
-
excludeDiscountInSubtotal:
|
|
1226
|
+
excludeDiscountInSubtotal: z15.boolean().default(false),
|
|
1217
1227
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
1218
|
-
excludedVariantIds:
|
|
1228
|
+
excludedVariantIds: z15.array(z15.number().int().positive()).default(() => []),
|
|
1219
1229
|
/**
|
|
1220
1230
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
1221
1231
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
1222
1232
|
*/
|
|
1223
|
-
freeShippingOnSubscription:
|
|
1233
|
+
freeShippingOnSubscription: z15.boolean().default(false),
|
|
1224
1234
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
1225
|
-
giftAreaTitle:
|
|
1235
|
+
giftAreaTitle: z15.record(z15.string(), z15.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
1226
1236
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
1227
|
-
giftLabels:
|
|
1228
|
-
addGift:
|
|
1229
|
-
remove:
|
|
1230
|
-
selectOptions:
|
|
1231
|
-
yourGift:
|
|
1237
|
+
giftLabels: z15.object({
|
|
1238
|
+
addGift: z15.record(z15.string(), z15.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
1239
|
+
remove: z15.record(z15.string(), z15.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
1240
|
+
selectOptions: z15.record(z15.string(), z15.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
1241
|
+
yourGift: z15.record(z15.string(), z15.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
1232
1242
|
}).default(() => ({
|
|
1233
1243
|
addGift: { ...GIFT_LABELS.addGift },
|
|
1234
1244
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -1236,38 +1246,38 @@ var CABProgressBarSection = z14.lazy(
|
|
|
1236
1246
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
1237
1247
|
})),
|
|
1238
1248
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
1239
|
-
name:
|
|
1249
|
+
name: z15.string().default("Order progress"),
|
|
1240
1250
|
/**
|
|
1241
1251
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
1242
1252
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
1243
1253
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
1244
1254
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
1245
1255
|
*/
|
|
1246
|
-
progressColor:
|
|
1247
|
-
sectionType:
|
|
1256
|
+
progressColor: z15.string().optional(),
|
|
1257
|
+
sectionType: z15.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
1248
1258
|
/**
|
|
1249
1259
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
1250
1260
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
1251
1261
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
1252
1262
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
1253
1263
|
*/
|
|
1254
|
-
tiers:
|
|
1264
|
+
tiers: z15.union([z15.array(CABProgressTier), z15.strictObject({}).transform(() => [])]).default(() => [])
|
|
1255
1265
|
})
|
|
1256
1266
|
);
|
|
1257
1267
|
|
|
1258
1268
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
1259
1269
|
import { v7 as uuidv79 } from "uuid";
|
|
1260
|
-
import { z as
|
|
1261
|
-
var CABQuantitySection =
|
|
1270
|
+
import { z as z16 } from "zod";
|
|
1271
|
+
var CABQuantitySection = z16.object({
|
|
1262
1272
|
...CABVariableFields,
|
|
1263
|
-
errorMessages:
|
|
1264
|
-
|
|
1265
|
-
|
|
1273
|
+
errorMessages: z16.record(
|
|
1274
|
+
z16.string(),
|
|
1275
|
+
z16.object({
|
|
1266
1276
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
1267
|
-
increment:
|
|
1268
|
-
max:
|
|
1269
|
-
min:
|
|
1270
|
-
neg:
|
|
1277
|
+
increment: z16.string().optional(),
|
|
1278
|
+
max: z16.string().optional(),
|
|
1279
|
+
min: z16.string().optional(),
|
|
1280
|
+
neg: z16.string().optional()
|
|
1271
1281
|
})
|
|
1272
1282
|
).default({
|
|
1273
1283
|
en: {
|
|
@@ -1277,18 +1287,18 @@ var CABQuantitySection = z15.object({
|
|
|
1277
1287
|
neg: "Quantity cannot be negative"
|
|
1278
1288
|
}
|
|
1279
1289
|
}),
|
|
1280
|
-
inputType:
|
|
1281
|
-
max:
|
|
1282
|
-
min:
|
|
1290
|
+
inputType: z16.enum(quantityInputs).default(QuantityInput.select),
|
|
1291
|
+
max: z16.number().min(1).max(100).default(10),
|
|
1292
|
+
min: z16.number().min(1).default(1),
|
|
1283
1293
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
1284
|
-
name:
|
|
1285
|
-
sectionId:
|
|
1286
|
-
sectionType:
|
|
1294
|
+
name: z16.string().default("Quantity"),
|
|
1295
|
+
sectionId: z16.uuid().default(() => uuidv79()),
|
|
1296
|
+
sectionType: z16.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1287
1297
|
});
|
|
1288
1298
|
|
|
1289
1299
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1290
1300
|
import { v7 as uuidv710 } from "uuid";
|
|
1291
|
-
import { z as
|
|
1301
|
+
import { z as z17 } from "zod";
|
|
1292
1302
|
|
|
1293
1303
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
1294
1304
|
var REVIEW_LABELS = {
|
|
@@ -1351,68 +1361,69 @@ var REVIEW_LABELS = {
|
|
|
1351
1361
|
};
|
|
1352
1362
|
|
|
1353
1363
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1354
|
-
var CABReviewsSection =
|
|
1364
|
+
var CABReviewsSection = z17.object({
|
|
1355
1365
|
...CABVariableFields,
|
|
1356
|
-
color:
|
|
1366
|
+
color: z17.string().default("#fadb14"),
|
|
1357
1367
|
/**
|
|
1358
1368
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
1359
1369
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
1360
1370
|
* or merchant work.
|
|
1361
1371
|
*/
|
|
1362
|
-
countLabels:
|
|
1363
|
-
one:
|
|
1364
|
-
other:
|
|
1372
|
+
countLabels: z17.object({
|
|
1373
|
+
one: z17.record(z17.string(), z17.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
1374
|
+
other: z17.record(z17.string(), z17.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
1365
1375
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
1366
|
-
name:
|
|
1367
|
-
sectionId:
|
|
1368
|
-
sectionType:
|
|
1369
|
-
size:
|
|
1376
|
+
name: z17.string().optional(),
|
|
1377
|
+
sectionId: z17.uuid().default(() => uuidv710()),
|
|
1378
|
+
sectionType: z17.literal(SectionType.reviews).default(SectionType.reviews),
|
|
1379
|
+
size: z17.enum(reviewsSizes).default(ReviewsSize.default),
|
|
1370
1380
|
/**
|
|
1371
1381
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
1372
1382
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
1373
1383
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
1374
1384
|
* the whole reviews section.
|
|
1375
1385
|
*/
|
|
1376
|
-
strokeColor:
|
|
1386
|
+
strokeColor: z17.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
1377
1387
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
1378
|
-
strokeWidth:
|
|
1388
|
+
strokeWidth: z17.number().nonnegative().default(0)
|
|
1379
1389
|
});
|
|
1380
1390
|
|
|
1381
1391
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
1382
1392
|
import { v7 as uuidv711 } from "uuid";
|
|
1383
|
-
import { z as
|
|
1384
|
-
var CABSeparatorSection =
|
|
1393
|
+
import { z as z18 } from "zod";
|
|
1394
|
+
var CABSeparatorSection = z18.object({
|
|
1385
1395
|
...CABVariableFields,
|
|
1386
|
-
sectionId:
|
|
1387
|
-
sectionType:
|
|
1396
|
+
sectionId: z18.uuid().default(() => uuidv711()),
|
|
1397
|
+
sectionType: z18.literal(SectionType.separator).default(SectionType.separator)
|
|
1388
1398
|
});
|
|
1389
1399
|
|
|
1390
1400
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
1391
1401
|
import { slice } from "es-toolkit/compat";
|
|
1392
1402
|
import { v7 as uuidv712 } from "uuid";
|
|
1393
|
-
import { z as
|
|
1394
|
-
var CABVariantsSection =
|
|
1403
|
+
import { z as z19 } from "zod";
|
|
1404
|
+
var CABVariantsSection = z19.object({
|
|
1395
1405
|
...CABVariableFields,
|
|
1396
|
-
hideOutOfStockVariants:
|
|
1397
|
-
name:
|
|
1398
|
-
sectionId:
|
|
1399
|
-
sectionType:
|
|
1400
|
-
selector:
|
|
1401
|
-
|
|
1406
|
+
hideOutOfStockVariants: z19.boolean().default(false),
|
|
1407
|
+
name: z19.string().optional(),
|
|
1408
|
+
sectionId: z19.uuid().default(() => uuidv712()),
|
|
1409
|
+
sectionType: z19.literal(SectionType.variants).default(SectionType.variants),
|
|
1410
|
+
selector: z19.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
1411
|
+
/** `productGroup` is additive (REB-24817): a renderer without group support must render nothing for it. */
|
|
1412
|
+
variantMode: z19.enum(variantsModes).default(VariantsMode.multiple)
|
|
1402
1413
|
});
|
|
1403
1414
|
|
|
1404
1415
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
1405
|
-
var CABBorder =
|
|
1406
|
-
radius:
|
|
1407
|
-
style:
|
|
1408
|
-
width:
|
|
1416
|
+
var CABBorder = z20.object({
|
|
1417
|
+
radius: z20.enum(borderRadii).default(BorderRadius.base),
|
|
1418
|
+
style: z20.enum(borderStyles).default(BorderStyle.none),
|
|
1419
|
+
width: z20.enum(borderWidths).default(BorderWidth.base)
|
|
1409
1420
|
}).default({
|
|
1410
1421
|
radius: BorderRadius.base,
|
|
1411
1422
|
style: BorderStyle.none,
|
|
1412
1423
|
width: BorderWidth.base
|
|
1413
1424
|
});
|
|
1414
|
-
var CABSection =
|
|
1415
|
-
() =>
|
|
1425
|
+
var CABSection = z20.lazy(
|
|
1426
|
+
() => z20.discriminatedUnion("sectionType", [
|
|
1416
1427
|
CABBannerSection,
|
|
1417
1428
|
CABButtonSection,
|
|
1418
1429
|
CABCarouselSection,
|
|
@@ -1435,50 +1446,50 @@ var CABSection = z19.lazy(
|
|
|
1435
1446
|
);
|
|
1436
1447
|
|
|
1437
1448
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
1438
|
-
var GridItem =
|
|
1439
|
-
var CABLayoutWrapping =
|
|
1440
|
-
breakAt:
|
|
1441
|
-
maxPerLine:
|
|
1449
|
+
var GridItem = z21.union([z21.literal("auto"), z21.literal("fill"), z21.string().regex(/^\d+%$/), z21.number()]);
|
|
1450
|
+
var CABLayoutWrapping = z21.object({
|
|
1451
|
+
breakAt: z21.number().positive(),
|
|
1452
|
+
maxPerLine: z21.number().int().positive()
|
|
1442
1453
|
});
|
|
1443
|
-
var CABLayoutSection =
|
|
1454
|
+
var CABLayoutSection = z21.object({
|
|
1444
1455
|
...CABVariableFields,
|
|
1445
|
-
alignment:
|
|
1446
|
-
horizontal:
|
|
1447
|
-
vertical:
|
|
1456
|
+
alignment: z21.object({
|
|
1457
|
+
horizontal: z21.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
1458
|
+
vertical: z21.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
1448
1459
|
}).default({
|
|
1449
1460
|
horizontal: HorizontalAlignment.start,
|
|
1450
1461
|
vertical: VerticalAlignment.top
|
|
1451
1462
|
}),
|
|
1452
|
-
border:
|
|
1453
|
-
buttonField:
|
|
1454
|
-
direction:
|
|
1463
|
+
border: z21.lazy(() => CABBorder),
|
|
1464
|
+
buttonField: z21.enum(buttonFields).optional(),
|
|
1465
|
+
direction: z21.enum(directions).default(Direction.rows),
|
|
1455
1466
|
/**
|
|
1456
1467
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
1457
1468
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
1458
1469
|
*/
|
|
1459
|
-
frame:
|
|
1460
|
-
grid:
|
|
1461
|
-
columns:
|
|
1462
|
-
rows:
|
|
1470
|
+
frame: z21.enum(layoutFrames).optional(),
|
|
1471
|
+
grid: z21.object({
|
|
1472
|
+
columns: z21.union([z21.array(GridItem), z21.undefined()]).default(() => ["auto"]),
|
|
1473
|
+
rows: z21.union([z21.array(GridItem), z21.undefined()]).default(() => ["auto"])
|
|
1463
1474
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
1464
|
-
name:
|
|
1465
|
-
padding:
|
|
1466
|
-
sectionId:
|
|
1467
|
-
sections:
|
|
1468
|
-
sectionType:
|
|
1469
|
-
spacing:
|
|
1475
|
+
name: z21.string().optional(),
|
|
1476
|
+
padding: z21.enum(spacings).default(Spacing.none),
|
|
1477
|
+
sectionId: z21.uuid().default(() => uuidv713()),
|
|
1478
|
+
sections: z21.union([z21.array(z21.lazy(() => CABSection)), z21.strictObject({}).transform(() => [])]).default(() => []),
|
|
1479
|
+
sectionType: z21.literal(SectionType.layout).default(SectionType.layout),
|
|
1480
|
+
spacing: z21.enum(spacings).default(Spacing.base),
|
|
1470
1481
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
1471
|
-
viewUrl:
|
|
1472
|
-
width:
|
|
1482
|
+
viewUrl: z21.string().optional(),
|
|
1483
|
+
width: z21.number().default(100),
|
|
1473
1484
|
wrapping: CABLayoutWrapping.optional()
|
|
1474
1485
|
});
|
|
1475
1486
|
|
|
1476
1487
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
1477
|
-
var CABBannerSection =
|
|
1488
|
+
var CABBannerSection = z22.lazy(
|
|
1478
1489
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1479
|
-
buttonField:
|
|
1480
|
-
color:
|
|
1481
|
-
dismissible:
|
|
1490
|
+
buttonField: z22.enum(buttonFields).optional(),
|
|
1491
|
+
color: z22.enum(bannerColors).default("info"),
|
|
1492
|
+
dismissible: z22.boolean().default(true),
|
|
1482
1493
|
/**
|
|
1483
1494
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
1484
1495
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -1494,8 +1505,8 @@ var CABBannerSection = z21.lazy(
|
|
|
1494
1505
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
1495
1506
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
1496
1507
|
*/
|
|
1497
|
-
heading:
|
|
1498
|
-
sectionType:
|
|
1508
|
+
heading: z22.record(z22.string(), z22.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
1509
|
+
sectionType: z22.literal(SectionType.banner).default(SectionType.banner)
|
|
1499
1510
|
})
|
|
1500
1511
|
);
|
|
1501
1512
|
|
|
@@ -1732,7 +1743,7 @@ var OFFER_LABELS = {
|
|
|
1732
1743
|
};
|
|
1733
1744
|
|
|
1734
1745
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1735
|
-
import { z as
|
|
1746
|
+
import { z as z23 } from "zod";
|
|
1736
1747
|
|
|
1737
1748
|
// src/schema/widgets/checkout-and-beyond/uiLabels.ts
|
|
1738
1749
|
var UI_LABELS = {
|
|
@@ -1752,8 +1763,8 @@ var UI_LABELS = {
|
|
|
1752
1763
|
};
|
|
1753
1764
|
|
|
1754
1765
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1755
|
-
var localized = (fallback) =>
|
|
1756
|
-
var CABUILabels =
|
|
1766
|
+
var localized = (fallback) => z23.record(z23.string(), z23.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
1767
|
+
var CABUILabels = z23.object({
|
|
1757
1768
|
currentPage: localized(UI_LABELS.currentPage),
|
|
1758
1769
|
guest: localized(UI_LABELS.guest),
|
|
1759
1770
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -1778,37 +1789,37 @@ var CABUILabels = z22.object({
|
|
|
1778
1789
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
1779
1790
|
updating: { ...UI_LABELS.updating }
|
|
1780
1791
|
}));
|
|
1781
|
-
var TargetArea =
|
|
1782
|
-
fill:
|
|
1783
|
-
flip:
|
|
1784
|
-
icon:
|
|
1785
|
-
label:
|
|
1786
|
-
width:
|
|
1792
|
+
var TargetArea = z23.object({
|
|
1793
|
+
fill: z23.boolean().optional(),
|
|
1794
|
+
flip: z23.enum(["both", "horizontal", "vertical"]).optional(),
|
|
1795
|
+
icon: z23.string(),
|
|
1796
|
+
label: z23.string(),
|
|
1797
|
+
width: z23.string()
|
|
1787
1798
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
1788
|
-
var CABTracking =
|
|
1789
|
-
enableAttribution:
|
|
1790
|
-
enableSource:
|
|
1791
|
-
enableWidget:
|
|
1799
|
+
var CABTracking = z23.object({
|
|
1800
|
+
enableAttribution: z23.boolean().nullish().transform((value) => value ?? true),
|
|
1801
|
+
enableSource: z23.boolean().nullish().transform((value) => value ?? true),
|
|
1802
|
+
enableWidget: z23.boolean().nullish().transform((value) => value ?? true)
|
|
1792
1803
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
1793
|
-
var CABExperiment =
|
|
1794
|
-
elementId:
|
|
1795
|
-
experimentId:
|
|
1796
|
-
experimentType:
|
|
1797
|
-
selectedId:
|
|
1804
|
+
var CABExperiment = z23.object({
|
|
1805
|
+
elementId: z23.number(),
|
|
1806
|
+
experimentId: z23.number(),
|
|
1807
|
+
experimentType: z23.string(),
|
|
1808
|
+
selectedId: z23.number()
|
|
1798
1809
|
});
|
|
1799
1810
|
var CABRootSection = CABLayoutSection.extend({
|
|
1800
|
-
editorMode:
|
|
1811
|
+
editorMode: z23.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
1801
1812
|
experiment: CABExperiment.optional(),
|
|
1802
1813
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
1803
1814
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
1804
|
-
previewMode:
|
|
1805
|
-
storeId:
|
|
1815
|
+
previewMode: z23.boolean().nullish().transform((value) => value ?? false),
|
|
1816
|
+
storeId: z23.number().nullable().default(null),
|
|
1806
1817
|
targetArea: TargetArea.nullable(),
|
|
1807
1818
|
tracking: CABTracking,
|
|
1808
|
-
type:
|
|
1819
|
+
type: z23.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
1809
1820
|
uiLabels: CABUILabels,
|
|
1810
|
-
version:
|
|
1811
|
-
widgetId:
|
|
1821
|
+
version: z23.literal(2).default(2),
|
|
1822
|
+
widgetId: z23.number().nullable().default(null)
|
|
1812
1823
|
});
|
|
1813
1824
|
|
|
1814
1825
|
// src/schema/widgets/checkout-and-beyond/switchLabels.ts
|
|
@@ -1950,6 +1961,7 @@ export {
|
|
|
1950
1961
|
CABExperiment,
|
|
1951
1962
|
CABImageSection,
|
|
1952
1963
|
CABImageSectionFields,
|
|
1964
|
+
CABImageThumbnails,
|
|
1953
1965
|
CABIntegrations,
|
|
1954
1966
|
CABLayoutSection,
|
|
1955
1967
|
CABLayoutWrapping,
|
|
@@ -2042,6 +2054,7 @@ export {
|
|
|
2042
2054
|
VariableType,
|
|
2043
2055
|
VariantMode,
|
|
2044
2056
|
VariantSelector,
|
|
2057
|
+
VariantsMode,
|
|
2045
2058
|
VerticalAlignment,
|
|
2046
2059
|
WidgetType,
|
|
2047
2060
|
bannerColors,
|
|
@@ -2111,6 +2124,7 @@ export {
|
|
|
2111
2124
|
variableTypes,
|
|
2112
2125
|
variantModes,
|
|
2113
2126
|
variantSelectors,
|
|
2127
|
+
variantsModes,
|
|
2114
2128
|
verticalAlignments,
|
|
2115
2129
|
widgetTypes
|
|
2116
2130
|
};
|