@rebuy/rebuy 3.44.1 → 3.46.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 +479 -449
- package/dist/index.mjs +480 -450
- package/dist/schema/checkout-and-beyond/index.cjs +21 -0
- package/dist/schema/checkout-and-beyond/index.mjs +22 -1
- package/dist/schema/postPurchaseFinish.d.ts +27 -0
- package/dist/schema/widget-data.cjs +21 -0
- package/dist/schema/widget-data.mjs +22 -1
- package/dist/schema/widgets/checkout-and-beyond/button.d.ts +4 -0
- package/dist/schema/widgets/checkout-and-beyond/variants.d.ts +1 -0
- package/dist/server/index.cjs +27 -2
- package/dist/server/index.mjs +28 -3
- package/dist/transforms/index.cjs +27 -2
- package/dist/transforms/index.mjs +28 -3
- package/dist/transforms/postPurchase/productCardControls.d.ts +2 -2
- package/dist/transforms/productCard/subscriptionToggle.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -187,6 +187,7 @@ __export(src_exports, {
|
|
|
187
187
|
PostPurchaseDisplayPrice: () => PostPurchaseDisplayPrice,
|
|
188
188
|
PostPurchaseEndReasonSchema: () => PostPurchaseEndReasonSchema,
|
|
189
189
|
PostPurchaseExcludedProductIds: () => PostPurchaseExcludedProductIds,
|
|
190
|
+
PostPurchaseFinishReasonSchema: () => PostPurchaseFinishReasonSchema,
|
|
190
191
|
PostPurchaseGroupCatalog: () => PostPurchaseGroupCatalog,
|
|
191
192
|
PostPurchaseGroupChoice: () => PostPurchaseGroupChoice,
|
|
192
193
|
PostPurchaseGroupDescription: () => PostPurchaseGroupDescription,
|
|
@@ -3174,7 +3175,7 @@ var ExitPolicySchema = import_zod38.z.discriminatedUnion("status", [
|
|
|
3174
3175
|
]);
|
|
3175
3176
|
|
|
3176
3177
|
// src/schema/postPurchaseFinish.ts
|
|
3177
|
-
var
|
|
3178
|
+
var import_zod47 = require("zod");
|
|
3178
3179
|
|
|
3179
3180
|
// src/schema/postPurchaseFollowups.ts
|
|
3180
3181
|
var import_zod43 = require("zod");
|
|
@@ -3336,39 +3337,80 @@ var SessionClosureSchema = import_zod44.z.object({ closedAt: PostPurchaseTimesta
|
|
|
3336
3337
|
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
3337
3338
|
var SessionCloseResponseSchema = import_zod44.z.object({ data: SessionClosureSchema, successful: import_zod44.z.literal(true) });
|
|
3338
3339
|
|
|
3340
|
+
// src/schema/postPurchaseTransition.ts
|
|
3341
|
+
var import_zod46 = require("zod");
|
|
3342
|
+
|
|
3343
|
+
// src/schema/postPurchaseSkipTrace.ts
|
|
3344
|
+
var import_zod45 = require("zod");
|
|
3345
|
+
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
3346
|
+
var PostPurchaseSkipTraceSchema = import_zod45.z.array(
|
|
3347
|
+
import_zod45.z.object({
|
|
3348
|
+
entry: DecisionEntrySchema,
|
|
3349
|
+
reason: PostPurchaseSkipReasonSchema
|
|
3350
|
+
})
|
|
3351
|
+
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
3352
|
+
|
|
3353
|
+
// src/schema/postPurchaseTransition.ts
|
|
3354
|
+
var OfferTransitionRequestSchema = DecideRequestSchema.extend({
|
|
3355
|
+
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
3356
|
+
progressRevision: PostPurchaseProgressSchema.shape.revision
|
|
3357
|
+
}).strict();
|
|
3358
|
+
var PostPurchaseEndReasonSchema = import_zod46.z.enum(["no-child", "no-products", "accept-cap"]);
|
|
3359
|
+
var TransitionBaseSchema = import_zod46.z.object({
|
|
3360
|
+
attemptedSkips: PostPurchaseSkipTraceSchema.optional(),
|
|
3361
|
+
progress: PostPurchaseProgressSchema
|
|
3362
|
+
});
|
|
3363
|
+
var OfferTransitionResponseSchema = import_zod46.z.object({
|
|
3364
|
+
data: import_zod46.z.discriminatedUnion("status", [
|
|
3365
|
+
TransitionBaseSchema.extend({ status: import_zod46.z.enum(["advanced", "unavailable"]) }),
|
|
3366
|
+
TransitionBaseSchema.extend({
|
|
3367
|
+
endReason: PostPurchaseEndReasonSchema.optional(),
|
|
3368
|
+
status: import_zod46.z.literal("no-child")
|
|
3369
|
+
})
|
|
3370
|
+
]),
|
|
3371
|
+
successful: import_zod46.z.literal(true)
|
|
3372
|
+
});
|
|
3373
|
+
|
|
3339
3374
|
// src/schema/postPurchaseFinish.ts
|
|
3340
|
-
var FinishedPurchaseSchema =
|
|
3341
|
-
|
|
3342
|
-
|
|
3375
|
+
var FinishedPurchaseSchema = import_zod47.z.union([
|
|
3376
|
+
import_zod47.z.strictObject({ status: import_zod47.z.literal("none") }),
|
|
3377
|
+
import_zod47.z.strictObject({
|
|
3343
3378
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
3344
|
-
status:
|
|
3345
|
-
|
|
3379
|
+
status: import_zod47.z.union([
|
|
3380
|
+
import_zod47.z.literal("pending"),
|
|
3346
3381
|
...PurchaseObservationSchema.options.map((option) => option.shape.status)
|
|
3347
3382
|
])
|
|
3348
3383
|
})
|
|
3349
3384
|
]);
|
|
3350
|
-
var
|
|
3351
|
-
var
|
|
3385
|
+
var PostPurchaseFinishReasonSchema = import_zod47.z.enum(["decline-all", "timer-expiry", "end", "unknown-result"]);
|
|
3386
|
+
var SessionFinishRequestSchema = DecideRequestSchema.extend({
|
|
3387
|
+
endReason: PostPurchaseEndReasonSchema.optional(),
|
|
3388
|
+
reason: PostPurchaseFinishReasonSchema.optional()
|
|
3389
|
+
}).strict().refine(({ endReason, reason }) => endReason === void 0 || reason === "end", {
|
|
3390
|
+
message: 'endReason is only valid with reason "end"',
|
|
3391
|
+
path: ["endReason"]
|
|
3392
|
+
});
|
|
3393
|
+
var SessionFinishResponseSchema = import_zod47.z.object({
|
|
3352
3394
|
data: SessionClosureSchema.extend({
|
|
3353
3395
|
classification: ClassificationProgressSchema,
|
|
3354
3396
|
exitPolicy: ExitPolicySchema,
|
|
3355
3397
|
health: RequiredHealthSchema.nullable(),
|
|
3356
3398
|
purchase: FinishedPurchaseSchema
|
|
3357
3399
|
}),
|
|
3358
|
-
successful:
|
|
3400
|
+
successful: import_zod47.z.literal(true)
|
|
3359
3401
|
});
|
|
3360
3402
|
|
|
3361
3403
|
// src/schema/postPurchaseQuantity.ts
|
|
3362
|
-
var
|
|
3404
|
+
var import_zod71 = require("zod");
|
|
3363
3405
|
|
|
3364
3406
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
3365
|
-
var
|
|
3407
|
+
var import_zod70 = require("zod");
|
|
3366
3408
|
|
|
3367
3409
|
// src/schema/postPurchaseProductView.ts
|
|
3368
|
-
var
|
|
3410
|
+
var import_zod69 = require("zod");
|
|
3369
3411
|
|
|
3370
3412
|
// src/schema/postPurchaseGroupCatalog.ts
|
|
3371
|
-
var
|
|
3413
|
+
var import_zod48 = require("zod");
|
|
3372
3414
|
var productId = PreparedPostPurchaseProduct.shape.selection.shape.productId;
|
|
3373
3415
|
var source = PostPurchaseProductSource.shape.data.element;
|
|
3374
3416
|
var PostPurchaseGroupDescription = source.pick({ description: true, id: true, image: true, images: true, title: true }).extend({
|
|
@@ -3376,17 +3418,17 @@ var PostPurchaseGroupDescription = source.pick({ description: true, id: true, im
|
|
|
3376
3418
|
image: source.shape.image.default(null),
|
|
3377
3419
|
options: PostPurchaseVariantCatalog.shape.options.default([])
|
|
3378
3420
|
});
|
|
3379
|
-
var PostPurchaseGroupCatalog =
|
|
3421
|
+
var PostPurchaseGroupCatalog = import_zod48.z.object({
|
|
3380
3422
|
memberProductId: productId,
|
|
3381
|
-
options:
|
|
3423
|
+
options: import_zod48.z.array(import_zod48.z.object({ productId, title: import_zod48.z.string(), variantCatalog: PostPurchaseVariantCatalog }))
|
|
3382
3424
|
});
|
|
3383
|
-
var PostPurchaseGroupSelection =
|
|
3425
|
+
var PostPurchaseGroupSelection = import_zod48.z.object({
|
|
3384
3426
|
memberProductId: productId,
|
|
3385
3427
|
productId
|
|
3386
3428
|
});
|
|
3387
3429
|
|
|
3388
3430
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
3389
|
-
var
|
|
3431
|
+
var import_zod68 = require("zod");
|
|
3390
3432
|
|
|
3391
3433
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
3392
3434
|
var import_es_toolkit3 = require("es-toolkit");
|
|
@@ -3441,18 +3483,18 @@ var targetAreas = {
|
|
|
3441
3483
|
|
|
3442
3484
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
3443
3485
|
var import_uuid15 = require("uuid");
|
|
3444
|
-
var
|
|
3486
|
+
var import_zod67 = require("zod");
|
|
3445
3487
|
|
|
3446
3488
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3447
|
-
var
|
|
3489
|
+
var import_zod66 = require("zod");
|
|
3448
3490
|
|
|
3449
3491
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
3450
|
-
var
|
|
3451
|
-
var CABBannerSection =
|
|
3492
|
+
var import_zod49 = require("zod");
|
|
3493
|
+
var CABBannerSection = import_zod49.z.lazy(
|
|
3452
3494
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3453
|
-
buttonField:
|
|
3454
|
-
color:
|
|
3455
|
-
dismissible:
|
|
3495
|
+
buttonField: import_zod49.z.enum(buttonFields).optional(),
|
|
3496
|
+
color: import_zod49.z.enum(bannerColors).default("info"),
|
|
3497
|
+
dismissible: import_zod49.z.boolean().default(true),
|
|
3456
3498
|
/**
|
|
3457
3499
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
3458
3500
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -3468,18 +3510,18 @@ var CABBannerSection = import_zod47.z.lazy(
|
|
|
3468
3510
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
3469
3511
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
3470
3512
|
*/
|
|
3471
|
-
heading:
|
|
3472
|
-
sectionType:
|
|
3513
|
+
heading: import_zod49.z.record(import_zod49.z.string(), import_zod49.z.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
3514
|
+
sectionType: import_zod49.z.literal(SectionType.banner).default(SectionType.banner)
|
|
3473
3515
|
})
|
|
3474
3516
|
);
|
|
3475
3517
|
|
|
3476
3518
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
3477
3519
|
var import_uuid5 = require("uuid");
|
|
3478
|
-
var
|
|
3520
|
+
var import_zod52 = require("zod");
|
|
3479
3521
|
|
|
3480
3522
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
3481
3523
|
var import_uuid4 = require("uuid");
|
|
3482
|
-
var
|
|
3524
|
+
var import_zod51 = require("zod");
|
|
3483
3525
|
|
|
3484
3526
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
3485
3527
|
var iconNames = [
|
|
@@ -3566,24 +3608,24 @@ var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "wa
|
|
|
3566
3608
|
var IconTone = freezeEnum(iconTones);
|
|
3567
3609
|
|
|
3568
3610
|
// src/schema/widgets/checkout-and-beyond/imageThumbnails.ts
|
|
3569
|
-
var
|
|
3570
|
-
var CABImageThumbnails =
|
|
3571
|
-
limit:
|
|
3572
|
-
perLine:
|
|
3611
|
+
var import_zod50 = require("zod");
|
|
3612
|
+
var CABImageThumbnails = import_zod50.z.object({
|
|
3613
|
+
limit: import_zod50.z.number().int().min(1).default(8),
|
|
3614
|
+
perLine: import_zod50.z.number().int().min(1).max(8).default(4)
|
|
3573
3615
|
});
|
|
3574
3616
|
|
|
3575
3617
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
3576
|
-
var CABImageSectionFields =
|
|
3618
|
+
var CABImageSectionFields = import_zod51.z.object({
|
|
3577
3619
|
...CABVariableFields,
|
|
3578
|
-
altText:
|
|
3620
|
+
altText: import_zod51.z.string().refine(checkForHTML, NO_HTML).default(""),
|
|
3579
3621
|
/**
|
|
3580
3622
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
3581
3623
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
3582
3624
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
3583
3625
|
*/
|
|
3584
|
-
aspectRatio:
|
|
3585
|
-
border:
|
|
3586
|
-
buttonField:
|
|
3626
|
+
aspectRatio: import_zod51.z.number().positive().nullable().default(null),
|
|
3627
|
+
border: import_zod51.z.lazy(() => CABBorder),
|
|
3628
|
+
buttonField: import_zod51.z.enum(buttonFields).optional(),
|
|
3587
3629
|
/**
|
|
3588
3630
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
3589
3631
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -3602,30 +3644,30 @@ var CABImageSectionFields = import_zod49.z.object({
|
|
|
3602
3644
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
3603
3645
|
* the risky half.
|
|
3604
3646
|
*/
|
|
3605
|
-
category:
|
|
3647
|
+
category: import_zod51.z.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
3606
3648
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
3607
|
-
iconSize:
|
|
3649
|
+
iconSize: import_zod51.z.enum(iconSizes).nullable().default(null),
|
|
3608
3650
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
3609
|
-
iconTone:
|
|
3610
|
-
name:
|
|
3611
|
-
naturalHeight:
|
|
3612
|
-
naturalWidth:
|
|
3651
|
+
iconTone: import_zod51.z.enum(iconTones).nullable().default(null),
|
|
3652
|
+
name: import_zod51.z.string().optional(),
|
|
3653
|
+
naturalHeight: import_zod51.z.number().default(0),
|
|
3654
|
+
naturalWidth: import_zod51.z.number().default(0),
|
|
3613
3655
|
/**
|
|
3614
3656
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
3615
3657
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
3616
3658
|
*/
|
|
3617
|
-
objectFit:
|
|
3618
|
-
sectionId:
|
|
3619
|
-
sectionType:
|
|
3659
|
+
objectFit: import_zod51.z.enum(objectFits).default(ObjectFit.contain),
|
|
3660
|
+
sectionId: import_zod51.z.uuid().default(() => (0, import_uuid4.v7)()),
|
|
3661
|
+
sectionType: import_zod51.z.literal(SectionType.image).default(SectionType.image),
|
|
3620
3662
|
/**
|
|
3621
3663
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
3622
3664
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
3623
3665
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
3624
3666
|
* server-chosen tier icon actually needs it.
|
|
3625
3667
|
*/
|
|
3626
|
-
source:
|
|
3668
|
+
source: import_zod51.z.union([import_zod51.z.url(), import_zod51.z.literal(""), import_zod51.z.string().regex(DYNAMIC_TOKEN_REGEX), import_zod51.z.enum(iconNames)]).default(""),
|
|
3627
3669
|
thumbnails: CABImageThumbnails.optional(),
|
|
3628
|
-
width:
|
|
3670
|
+
width: import_zod51.z.number().default(100)
|
|
3629
3671
|
});
|
|
3630
3672
|
var iconNameSet = new Set(iconNames);
|
|
3631
3673
|
var isIconName = (source2) => iconNameSet.has(source2);
|
|
@@ -3645,35 +3687,42 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source: sou
|
|
|
3645
3687
|
});
|
|
3646
3688
|
|
|
3647
3689
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
3648
|
-
var CABButtonContent =
|
|
3649
|
-
() =>
|
|
3690
|
+
var CABButtonContent = import_zod52.z.lazy(
|
|
3691
|
+
() => import_zod52.z.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
3650
3692
|
);
|
|
3651
|
-
var CABButtonSection =
|
|
3693
|
+
var CABButtonSection = import_zod52.z.object({
|
|
3652
3694
|
...CABVariableFields,
|
|
3653
|
-
action:
|
|
3654
|
-
buttonStyle:
|
|
3655
|
-
custom:
|
|
3656
|
-
color:
|
|
3657
|
-
height:
|
|
3658
|
-
width:
|
|
3695
|
+
action: import_zod52.z.union([import_zod52.z.literal(""), import_zod52.z.enum(buttonActions)]).default(""),
|
|
3696
|
+
buttonStyle: import_zod52.z.enum(buttonStyles).default(ButtonStyle.primary),
|
|
3697
|
+
custom: import_zod52.z.object({
|
|
3698
|
+
color: import_zod52.z.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
3699
|
+
height: import_zod52.z.number().default(52),
|
|
3700
|
+
width: import_zod52.z.number().default(300)
|
|
3659
3701
|
}).default({
|
|
3660
3702
|
color: "#005bd3",
|
|
3661
3703
|
height: 52,
|
|
3662
3704
|
width: 300
|
|
3663
3705
|
}),
|
|
3664
|
-
disableDowngrade:
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3706
|
+
disableDowngrade: import_zod52.z.boolean().default(false),
|
|
3707
|
+
/**
|
|
3708
|
+
* What labels a `switchToSubscription` button's frequency options. `planName` shows the selling plan's
|
|
3709
|
+
* own name (legacy post-purchase, L115) and falls back to the `subscriptionOption` template for a plan
|
|
3710
|
+
* without one; absent or `template` is the template alone (the checkout card). Optional and additive
|
|
3711
|
+
* (REB-24846); an unknown value reads as absent.
|
|
3712
|
+
*/
|
|
3713
|
+
frequencyLabel: import_zod52.z.enum(["planName", "template"]).optional().catch(void 0),
|
|
3714
|
+
name: import_zod52.z.string().optional(),
|
|
3715
|
+
optionId: import_zod52.z.number().optional(),
|
|
3716
|
+
popover: import_zod52.z.object({
|
|
3717
|
+
alignment: import_zod52.z.enum(textAlignments).default(TextAlignment.center),
|
|
3718
|
+
position: import_zod52.z.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
3670
3719
|
}).optional().default(() => ({
|
|
3671
3720
|
alignment: TextAlignment.center,
|
|
3672
3721
|
position: PopoverPosition.blockStart
|
|
3673
3722
|
})),
|
|
3674
|
-
sectionId:
|
|
3675
|
-
sections:
|
|
3676
|
-
sectionType:
|
|
3723
|
+
sectionId: import_zod52.z.uuid().default(() => (0, import_uuid5.v7)()),
|
|
3724
|
+
sections: import_zod52.z.union([import_zod52.z.array(CABButtonContent), import_zod52.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3725
|
+
sectionType: import_zod52.z.literal(SectionType.button).default(SectionType.button),
|
|
3677
3726
|
/**
|
|
3678
3727
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
3679
3728
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -3688,96 +3737,96 @@ var CABButtonSection = import_zod50.z.object({
|
|
|
3688
3737
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
3689
3738
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
3690
3739
|
*/
|
|
3691
|
-
tier:
|
|
3740
|
+
tier: import_zod52.z.object({ tierId: import_zod52.z.string().min(1) }).optional(),
|
|
3692
3741
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
3693
|
-
trackingUrl:
|
|
3742
|
+
trackingUrl: import_zod52.z.string().optional(),
|
|
3694
3743
|
/**
|
|
3695
3744
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
3696
3745
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
3697
3746
|
*/
|
|
3698
|
-
variableEffects:
|
|
3747
|
+
variableEffects: import_zod52.z.array(CABVariableEffect).optional()
|
|
3699
3748
|
});
|
|
3700
3749
|
|
|
3701
3750
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3702
|
-
var
|
|
3751
|
+
var import_zod57 = require("zod");
|
|
3703
3752
|
|
|
3704
3753
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3705
|
-
var
|
|
3754
|
+
var import_zod56 = require("zod");
|
|
3706
3755
|
|
|
3707
3756
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
3708
3757
|
var import_uuid6 = require("uuid");
|
|
3709
|
-
var
|
|
3710
|
-
var CABDiscount =
|
|
3711
|
-
amount:
|
|
3712
|
-
discountedBy:
|
|
3713
|
-
discountedFrom:
|
|
3714
|
-
type:
|
|
3715
|
-
});
|
|
3716
|
-
var CABIntegrations =
|
|
3717
|
-
judgeme:
|
|
3718
|
-
junip:
|
|
3719
|
-
klaviyo:
|
|
3720
|
-
loox:
|
|
3721
|
-
okendo:
|
|
3722
|
-
opinew:
|
|
3723
|
-
reviewsio:
|
|
3724
|
-
stamped:
|
|
3725
|
-
yotpo:
|
|
3726
|
-
});
|
|
3727
|
-
var CABVariantLabels =
|
|
3728
|
-
variantOption:
|
|
3729
|
-
variantOptions:
|
|
3730
|
-
});
|
|
3731
|
-
var CABDataSourceSection =
|
|
3732
|
-
dataSourceId:
|
|
3733
|
-
dataSourcePath:
|
|
3758
|
+
var import_zod53 = require("zod");
|
|
3759
|
+
var CABDiscount = import_zod53.z.object({
|
|
3760
|
+
amount: import_zod53.z.union([import_zod53.z.number(), import_zod53.z.string()]).catch(0),
|
|
3761
|
+
discountedBy: import_zod53.z.string().optional(),
|
|
3762
|
+
discountedFrom: import_zod53.z.enum(discountSources).optional().catch(void 0),
|
|
3763
|
+
type: import_zod53.z.enum(discountTypes).catch("none")
|
|
3764
|
+
});
|
|
3765
|
+
var CABIntegrations = import_zod53.z.object({
|
|
3766
|
+
judgeme: import_zod53.z.boolean().default(false),
|
|
3767
|
+
junip: import_zod53.z.boolean().default(false),
|
|
3768
|
+
klaviyo: import_zod53.z.boolean().default(false),
|
|
3769
|
+
loox: import_zod53.z.boolean().default(false),
|
|
3770
|
+
okendo: import_zod53.z.boolean().default(false),
|
|
3771
|
+
opinew: import_zod53.z.boolean().default(false),
|
|
3772
|
+
reviewsio: import_zod53.z.boolean().default(false),
|
|
3773
|
+
stamped: import_zod53.z.boolean().default(false),
|
|
3774
|
+
yotpo: import_zod53.z.boolean().default(false)
|
|
3775
|
+
});
|
|
3776
|
+
var CABVariantLabels = import_zod53.z.object({
|
|
3777
|
+
variantOption: import_zod53.z.string().optional().catch(void 0),
|
|
3778
|
+
variantOptions: import_zod53.z.string().optional().catch(void 0)
|
|
3779
|
+
});
|
|
3780
|
+
var CABDataSourceSection = import_zod53.z.object({
|
|
3781
|
+
dataSourceId: import_zod53.z.number().nullable().default(null),
|
|
3782
|
+
dataSourcePath: import_zod53.z.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
3734
3783
|
discount: CABDiscount.optional(),
|
|
3735
3784
|
integrations: CABIntegrations.optional(),
|
|
3736
|
-
limit:
|
|
3737
|
-
matchVariant:
|
|
3738
|
-
matchVariantOutOfStock:
|
|
3739
|
-
name:
|
|
3740
|
-
productType:
|
|
3741
|
-
sectionId:
|
|
3742
|
-
sectionType:
|
|
3785
|
+
limit: import_zod53.z.number().default(1),
|
|
3786
|
+
matchVariant: import_zod53.z.boolean().default(false),
|
|
3787
|
+
matchVariantOutOfStock: import_zod53.z.boolean().default(false),
|
|
3788
|
+
name: import_zod53.z.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
3789
|
+
productType: import_zod53.z.enum(productTypes).optional(),
|
|
3790
|
+
sectionId: import_zod53.z.uuid().default(() => (0, import_uuid6.v7)()),
|
|
3791
|
+
sectionType: import_zod53.z.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
3743
3792
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
3744
|
-
subscriptionIsDefault:
|
|
3745
|
-
treatAsGwp:
|
|
3793
|
+
subscriptionIsDefault: import_zod53.z.boolean().default(false),
|
|
3794
|
+
treatAsGwp: import_zod53.z.boolean().default(false),
|
|
3746
3795
|
variantLabels: CABVariantLabels.optional().catch(void 0)
|
|
3747
3796
|
});
|
|
3748
3797
|
|
|
3749
3798
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3750
3799
|
var import_uuid8 = require("uuid");
|
|
3751
|
-
var
|
|
3800
|
+
var import_zod55 = require("zod");
|
|
3752
3801
|
|
|
3753
3802
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
3754
3803
|
var import_uuid7 = require("uuid");
|
|
3755
|
-
var
|
|
3756
|
-
var CABVariantContent =
|
|
3757
|
-
() =>
|
|
3804
|
+
var import_zod54 = require("zod");
|
|
3805
|
+
var CABVariantContent = import_zod54.z.lazy(
|
|
3806
|
+
() => import_zod54.z.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
3758
3807
|
);
|
|
3759
|
-
var CABProductSection =
|
|
3808
|
+
var CABProductSection = import_zod54.z.object({
|
|
3760
3809
|
...CABVariableFields,
|
|
3761
|
-
name:
|
|
3762
|
-
productId:
|
|
3763
|
-
sectionId:
|
|
3764
|
-
sections:
|
|
3765
|
-
sectionType:
|
|
3766
|
-
selectors:
|
|
3767
|
-
variantMode:
|
|
3810
|
+
name: import_zod54.z.string().optional(),
|
|
3811
|
+
productId: import_zod54.z.number().nullable().default(null),
|
|
3812
|
+
sectionId: import_zod54.z.uuid().default(() => (0, import_uuid7.v7)()),
|
|
3813
|
+
sections: import_zod54.z.union([import_zod54.z.array(CABVariantContent), import_zod54.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3814
|
+
sectionType: import_zod54.z.literal(SectionType.product).default(SectionType.product),
|
|
3815
|
+
selectors: import_zod54.z.record(import_zod54.z.string(), import_zod54.z.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
3816
|
+
variantMode: import_zod54.z.enum(variantModes).default(VariantMode.multiple)
|
|
3768
3817
|
});
|
|
3769
3818
|
|
|
3770
3819
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3771
|
-
var CABProductsSection =
|
|
3820
|
+
var CABProductsSection = import_zod55.z.object({
|
|
3772
3821
|
...CABVariableFields,
|
|
3773
|
-
name:
|
|
3774
|
-
sectionId:
|
|
3775
|
-
sections:
|
|
3776
|
-
sectionType:
|
|
3822
|
+
name: import_zod55.z.string().optional(),
|
|
3823
|
+
sectionId: import_zod55.z.uuid().default(() => (0, import_uuid8.v7)()),
|
|
3824
|
+
sections: import_zod55.z.union([import_zod55.z.array(import_zod55.z.lazy(() => CABProductSection)), import_zod55.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3825
|
+
sectionType: import_zod55.z.literal(SectionType.products).default(SectionType.products)
|
|
3777
3826
|
});
|
|
3778
3827
|
|
|
3779
3828
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3780
|
-
var CABOffersSection =
|
|
3829
|
+
var CABOffersSection = import_zod56.z.lazy(
|
|
3781
3830
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3782
3831
|
/**
|
|
3783
3832
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -3785,8 +3834,8 @@ var CABOffersSection = import_zod54.z.lazy(
|
|
|
3785
3834
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
3786
3835
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
3787
3836
|
*/
|
|
3788
|
-
divider:
|
|
3789
|
-
sections:
|
|
3837
|
+
divider: import_zod56.z.boolean().optional(),
|
|
3838
|
+
sections: import_zod56.z.union([import_zod56.z.array(import_zod56.z.lazy(() => CABSection)), import_zod56.z.strictObject({}).transform(() => [])]).default(() => [
|
|
3790
3839
|
CABBannerSection.parse({
|
|
3791
3840
|
buttonField: "undoAddToOrder",
|
|
3792
3841
|
color: "success",
|
|
@@ -3800,77 +3849,77 @@ var CABOffersSection = import_zod54.z.lazy(
|
|
|
3800
3849
|
CABDataSourceSection.parse({}),
|
|
3801
3850
|
CABProductsSection.parse({})
|
|
3802
3851
|
]),
|
|
3803
|
-
sectionType:
|
|
3852
|
+
sectionType: import_zod56.z.literal(SectionType.offers).default(SectionType.offers)
|
|
3804
3853
|
})
|
|
3805
3854
|
);
|
|
3806
3855
|
|
|
3807
3856
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3808
|
-
var CABCarouselSection =
|
|
3857
|
+
var CABCarouselSection = import_zod57.z.lazy(
|
|
3809
3858
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3810
|
-
autoAdvanceInterval:
|
|
3811
|
-
itemsAtOnce:
|
|
3859
|
+
autoAdvanceInterval: import_zod57.z.number().default(0),
|
|
3860
|
+
itemsAtOnce: import_zod57.z.number().min(1).default(1),
|
|
3812
3861
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
3813
|
-
offersDirection:
|
|
3814
|
-
sections:
|
|
3815
|
-
sectionType:
|
|
3862
|
+
offersDirection: import_zod57.z.enum(offersDirections).default("vertical"),
|
|
3863
|
+
sections: import_zod57.z.union([import_zod57.z.array(import_zod57.z.lazy(() => CABSection)), import_zod57.z.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
3864
|
+
sectionType: import_zod57.z.literal(SectionType.carousel).default(SectionType.carousel)
|
|
3816
3865
|
})
|
|
3817
3866
|
);
|
|
3818
3867
|
|
|
3819
3868
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
3820
|
-
var
|
|
3821
|
-
var CABCartLineSection =
|
|
3869
|
+
var import_zod58 = require("zod");
|
|
3870
|
+
var CABCartLineSection = import_zod58.z.lazy(
|
|
3822
3871
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3823
|
-
sections:
|
|
3824
|
-
sectionType:
|
|
3872
|
+
sections: import_zod58.z.union([import_zod58.z.array(import_zod58.z.lazy(() => CABSection)), import_zod58.z.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
3873
|
+
sectionType: import_zod58.z.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
3825
3874
|
})
|
|
3826
3875
|
);
|
|
3827
3876
|
|
|
3828
3877
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
3829
3878
|
var import_uuid9 = require("uuid");
|
|
3830
|
-
var
|
|
3831
|
-
var CABDiscountSection =
|
|
3879
|
+
var import_zod59 = require("zod");
|
|
3880
|
+
var CABDiscountSection = import_zod59.z.object({
|
|
3832
3881
|
...CABVariableFields,
|
|
3833
|
-
amount:
|
|
3834
|
-
discountedBy:
|
|
3835
|
-
discountedFrom:
|
|
3836
|
-
message:
|
|
3837
|
-
name:
|
|
3838
|
-
quantity:
|
|
3839
|
-
sectionId:
|
|
3840
|
-
sectionType:
|
|
3841
|
-
type:
|
|
3882
|
+
amount: import_zod59.z.union([import_zod59.z.number(), import_zod59.z.string()]).catch(0),
|
|
3883
|
+
discountedBy: import_zod59.z.string().optional(),
|
|
3884
|
+
discountedFrom: import_zod59.z.enum(discountSources).optional().catch(void 0),
|
|
3885
|
+
message: import_zod59.z.string().optional(),
|
|
3886
|
+
name: import_zod59.z.string().optional(),
|
|
3887
|
+
quantity: import_zod59.z.number().default(1),
|
|
3888
|
+
sectionId: import_zod59.z.uuid().default(() => (0, import_uuid9.v7)()),
|
|
3889
|
+
sectionType: import_zod59.z.literal(SectionType.discount).default(SectionType.discount),
|
|
3890
|
+
type: import_zod59.z.enum(discountTypes).catch("none")
|
|
3842
3891
|
});
|
|
3843
3892
|
|
|
3844
3893
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
3845
3894
|
var import_uuid10 = require("uuid");
|
|
3846
|
-
var
|
|
3847
|
-
var CABMonetizeAds =
|
|
3848
|
-
requestId:
|
|
3895
|
+
var import_zod60 = require("zod");
|
|
3896
|
+
var CABMonetizeAds = import_zod60.z.object({
|
|
3897
|
+
requestId: import_zod60.z.string().optional(),
|
|
3849
3898
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
3850
|
-
testing:
|
|
3899
|
+
testing: import_zod60.z.boolean().default(false)
|
|
3851
3900
|
});
|
|
3852
|
-
var CABMonetizeSection =
|
|
3901
|
+
var CABMonetizeSection = import_zod60.z.object({
|
|
3853
3902
|
...CABVariableFields,
|
|
3854
3903
|
ads: CABMonetizeAds.optional(),
|
|
3855
|
-
name:
|
|
3904
|
+
name: import_zod60.z.string().optional(),
|
|
3856
3905
|
/**
|
|
3857
3906
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
3858
3907
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
3859
3908
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
3860
3909
|
*/
|
|
3861
|
-
offers:
|
|
3910
|
+
offers: import_zod60.z.array(import_zod60.z.lazy(() => CABSection)).optional(),
|
|
3862
3911
|
/** 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. */
|
|
3863
|
-
privacyPolicyUrl:
|
|
3864
|
-
sectionId:
|
|
3865
|
-
sectionType:
|
|
3912
|
+
privacyPolicyUrl: import_zod60.z.string().optional(),
|
|
3913
|
+
sectionId: import_zod60.z.uuid().default(() => (0, import_uuid10.v7)()),
|
|
3914
|
+
sectionType: import_zod60.z.literal(SectionType.monetize).default(SectionType.monetize),
|
|
3866
3915
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
3867
|
-
subVertical:
|
|
3916
|
+
subVertical: import_zod60.z.string().optional(),
|
|
3868
3917
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
3869
|
-
vertical:
|
|
3918
|
+
vertical: import_zod60.z.string().optional()
|
|
3870
3919
|
});
|
|
3871
3920
|
|
|
3872
3921
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3873
|
-
var
|
|
3922
|
+
var import_zod61 = require("zod");
|
|
3874
3923
|
|
|
3875
3924
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
3876
3925
|
var GIFT_LABELS = {
|
|
@@ -3989,34 +4038,34 @@ var GIFT_LABELS = {
|
|
|
3989
4038
|
};
|
|
3990
4039
|
|
|
3991
4040
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3992
|
-
var CABProgressTierExclusion =
|
|
3993
|
-
collectionIds:
|
|
3994
|
-
productIds:
|
|
3995
|
-
tags:
|
|
3996
|
-
type:
|
|
4041
|
+
var CABProgressTierExclusion = import_zod61.z.object({
|
|
4042
|
+
collectionIds: import_zod61.z.array(import_zod61.z.number().int().positive()).default(() => []),
|
|
4043
|
+
productIds: import_zod61.z.array(import_zod61.z.number().int().positive()).default(() => []),
|
|
4044
|
+
tags: import_zod61.z.array(import_zod61.z.string().min(1)).default(() => []),
|
|
4045
|
+
type: import_zod61.z.enum(progressTierExclusionTypes)
|
|
3997
4046
|
});
|
|
3998
|
-
var CABProgressTier =
|
|
4047
|
+
var CABProgressTier = import_zod61.z.object({
|
|
3999
4048
|
/**
|
|
4000
4049
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
4001
4050
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
4002
4051
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
4003
4052
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
4004
4053
|
*/
|
|
4005
|
-
discount:
|
|
4054
|
+
discount: import_zod61.z.object({ amount: import_zod61.z.number().nonnegative(), type: import_zod61.z.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
4006
4055
|
/**
|
|
4007
4056
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
4008
4057
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
4009
4058
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
4010
4059
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
4011
4060
|
*/
|
|
4012
|
-
exclusions:
|
|
4061
|
+
exclusions: import_zod61.z.array(CABProgressTierExclusion).default(() => []),
|
|
4013
4062
|
/**
|
|
4014
4063
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
4015
4064
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
4016
4065
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
4017
4066
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
4018
4067
|
*/
|
|
4019
|
-
filterOosVariants:
|
|
4068
|
+
filterOosVariants: import_zod61.z.boolean().default(false),
|
|
4020
4069
|
/**
|
|
4021
4070
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
4022
4071
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -4024,10 +4073,10 @@ var CABProgressTier = import_zod59.z.object({
|
|
|
4024
4073
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
4025
4074
|
* tree is complete.
|
|
4026
4075
|
*/
|
|
4027
|
-
gift:
|
|
4028
|
-
productId:
|
|
4029
|
-
title:
|
|
4030
|
-
variantIds:
|
|
4076
|
+
gift: import_zod61.z.object({
|
|
4077
|
+
productId: import_zod61.z.number().int().positive(),
|
|
4078
|
+
title: import_zod61.z.string().optional(),
|
|
4079
|
+
variantIds: import_zod61.z.array(import_zod61.z.number().int().positive()).default(() => [])
|
|
4031
4080
|
}).optional(),
|
|
4032
4081
|
/**
|
|
4033
4082
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -4047,7 +4096,7 @@ var CABProgressTier = import_zod59.z.object({
|
|
|
4047
4096
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
4048
4097
|
* React's size rather than the old hardcoded 20.
|
|
4049
4098
|
*/
|
|
4050
|
-
iconSizePx:
|
|
4099
|
+
iconSizePx: import_zod61.z.number().int().min(1).max(64).default(18),
|
|
4051
4100
|
/**
|
|
4052
4101
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
4053
4102
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -4057,35 +4106,35 @@ var CABProgressTier = import_zod59.z.object({
|
|
|
4057
4106
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
4058
4107
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
4059
4108
|
*/
|
|
4060
|
-
label:
|
|
4109
|
+
label: import_zod61.z.record(import_zod61.z.string(), import_zod61.z.string()).optional(),
|
|
4061
4110
|
/**
|
|
4062
4111
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
4063
4112
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
4064
4113
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
4065
4114
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
4066
4115
|
*/
|
|
4067
|
-
productTierImage:
|
|
4116
|
+
productTierImage: import_zod61.z.boolean().default(false),
|
|
4068
4117
|
/**
|
|
4069
4118
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
4070
4119
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
4071
4120
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
4072
4121
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
4073
4122
|
*/
|
|
4074
|
-
threshold:
|
|
4123
|
+
threshold: import_zod61.z.number().int().nonnegative(),
|
|
4075
4124
|
/**
|
|
4076
4125
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
4077
4126
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
4078
4127
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
4079
4128
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
4080
4129
|
*/
|
|
4081
|
-
thresholds:
|
|
4130
|
+
thresholds: import_zod61.z.record(import_zod61.z.string(), import_zod61.z.number().int().nonnegative()).default(() => ({})),
|
|
4082
4131
|
/**
|
|
4083
4132
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
4084
4133
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
4085
4134
|
* shipping bar (single unlabeled tier, no gift).
|
|
4086
4135
|
*/
|
|
4087
|
-
tierId:
|
|
4088
|
-
tierType:
|
|
4136
|
+
tierId: import_zod61.z.string().optional(),
|
|
4137
|
+
tierType: import_zod61.z.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
4089
4138
|
/**
|
|
4090
4139
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
4091
4140
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -4096,9 +4145,9 @@ var CABProgressTier = import_zod59.z.object({
|
|
|
4096
4145
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
4097
4146
|
* template text supplies grammatically-neutral wording around the token.
|
|
4098
4147
|
*/
|
|
4099
|
-
unit:
|
|
4148
|
+
unit: import_zod61.z.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
4100
4149
|
});
|
|
4101
|
-
var CABProgressBarSection =
|
|
4150
|
+
var CABProgressBarSection = import_zod61.z.lazy(
|
|
4102
4151
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
4103
4152
|
/**
|
|
4104
4153
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -4107,35 +4156,35 @@ var CABProgressBarSection = import_zod59.z.lazy(
|
|
|
4107
4156
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
4108
4157
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
4109
4158
|
*/
|
|
4110
|
-
barId:
|
|
4159
|
+
barId: import_zod61.z.string().optional(),
|
|
4111
4160
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
4112
|
-
countryCodes:
|
|
4161
|
+
countryCodes: import_zod61.z.array(import_zod61.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
4113
4162
|
/**
|
|
4114
4163
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
4115
4164
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
4116
4165
|
*/
|
|
4117
|
-
excludeCountryCodes:
|
|
4166
|
+
excludeCountryCodes: import_zod61.z.array(import_zod61.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
4118
4167
|
/**
|
|
4119
4168
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
4120
4169
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
4121
4170
|
* adds the cart's discount allocations back to the live subtotal.
|
|
4122
4171
|
*/
|
|
4123
|
-
excludeDiscountInSubtotal:
|
|
4172
|
+
excludeDiscountInSubtotal: import_zod61.z.boolean().default(false),
|
|
4124
4173
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
4125
|
-
excludedVariantIds:
|
|
4174
|
+
excludedVariantIds: import_zod61.z.array(import_zod61.z.number().int().positive()).default(() => []),
|
|
4126
4175
|
/**
|
|
4127
4176
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
4128
4177
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
4129
4178
|
*/
|
|
4130
|
-
freeShippingOnSubscription:
|
|
4179
|
+
freeShippingOnSubscription: import_zod61.z.boolean().default(false),
|
|
4131
4180
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
4132
|
-
giftAreaTitle:
|
|
4181
|
+
giftAreaTitle: import_zod61.z.record(import_zod61.z.string(), import_zod61.z.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
4133
4182
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
4134
|
-
giftLabels:
|
|
4135
|
-
addGift:
|
|
4136
|
-
remove:
|
|
4137
|
-
selectOptions:
|
|
4138
|
-
yourGift:
|
|
4183
|
+
giftLabels: import_zod61.z.object({
|
|
4184
|
+
addGift: import_zod61.z.record(import_zod61.z.string(), import_zod61.z.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
4185
|
+
remove: import_zod61.z.record(import_zod61.z.string(), import_zod61.z.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
4186
|
+
selectOptions: import_zod61.z.record(import_zod61.z.string(), import_zod61.z.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
4187
|
+
yourGift: import_zod61.z.record(import_zod61.z.string(), import_zod61.z.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
4139
4188
|
}).default(() => ({
|
|
4140
4189
|
addGift: { ...GIFT_LABELS.addGift },
|
|
4141
4190
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -4143,38 +4192,38 @@ var CABProgressBarSection = import_zod59.z.lazy(
|
|
|
4143
4192
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
4144
4193
|
})),
|
|
4145
4194
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
4146
|
-
name:
|
|
4195
|
+
name: import_zod61.z.string().default("Order progress"),
|
|
4147
4196
|
/**
|
|
4148
4197
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
4149
4198
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
4150
4199
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
4151
4200
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
4152
4201
|
*/
|
|
4153
|
-
progressColor:
|
|
4154
|
-
sectionType:
|
|
4202
|
+
progressColor: import_zod61.z.string().optional(),
|
|
4203
|
+
sectionType: import_zod61.z.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
4155
4204
|
/**
|
|
4156
4205
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
4157
4206
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
4158
4207
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
4159
4208
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
4160
4209
|
*/
|
|
4161
|
-
tiers:
|
|
4210
|
+
tiers: import_zod61.z.union([import_zod61.z.array(CABProgressTier), import_zod61.z.strictObject({}).transform(() => [])]).default(() => [])
|
|
4162
4211
|
})
|
|
4163
4212
|
);
|
|
4164
4213
|
|
|
4165
4214
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
4166
4215
|
var import_uuid11 = require("uuid");
|
|
4167
|
-
var
|
|
4168
|
-
var CABQuantitySection =
|
|
4216
|
+
var import_zod62 = require("zod");
|
|
4217
|
+
var CABQuantitySection = import_zod62.z.object({
|
|
4169
4218
|
...CABVariableFields,
|
|
4170
|
-
errorMessages:
|
|
4171
|
-
|
|
4172
|
-
|
|
4219
|
+
errorMessages: import_zod62.z.record(
|
|
4220
|
+
import_zod62.z.string(),
|
|
4221
|
+
import_zod62.z.object({
|
|
4173
4222
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
4174
|
-
increment:
|
|
4175
|
-
max:
|
|
4176
|
-
min:
|
|
4177
|
-
neg:
|
|
4223
|
+
increment: import_zod62.z.string().optional(),
|
|
4224
|
+
max: import_zod62.z.string().optional(),
|
|
4225
|
+
min: import_zod62.z.string().optional(),
|
|
4226
|
+
neg: import_zod62.z.string().optional()
|
|
4178
4227
|
})
|
|
4179
4228
|
).default({
|
|
4180
4229
|
en: {
|
|
@@ -4184,18 +4233,18 @@ var CABQuantitySection = import_zod60.z.object({
|
|
|
4184
4233
|
neg: "Quantity cannot be negative"
|
|
4185
4234
|
}
|
|
4186
4235
|
}),
|
|
4187
|
-
inputType:
|
|
4188
|
-
max:
|
|
4189
|
-
min:
|
|
4236
|
+
inputType: import_zod62.z.enum(quantityInputs).default(QuantityInput.select),
|
|
4237
|
+
max: import_zod62.z.number().min(1).max(100).default(10),
|
|
4238
|
+
min: import_zod62.z.number().min(1).default(1),
|
|
4190
4239
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
4191
|
-
name:
|
|
4192
|
-
sectionId:
|
|
4193
|
-
sectionType:
|
|
4240
|
+
name: import_zod62.z.string().default("Quantity"),
|
|
4241
|
+
sectionId: import_zod62.z.uuid().default(() => (0, import_uuid11.v7)()),
|
|
4242
|
+
sectionType: import_zod62.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
4194
4243
|
});
|
|
4195
4244
|
|
|
4196
4245
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
4197
4246
|
var import_uuid12 = require("uuid");
|
|
4198
|
-
var
|
|
4247
|
+
var import_zod63 = require("zod");
|
|
4199
4248
|
|
|
4200
4249
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
4201
4250
|
var REVIEW_LABELS = {
|
|
@@ -4258,69 +4307,83 @@ var REVIEW_LABELS = {
|
|
|
4258
4307
|
};
|
|
4259
4308
|
|
|
4260
4309
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
4261
|
-
var CABReviewsSection =
|
|
4310
|
+
var CABReviewsSection = import_zod63.z.object({
|
|
4262
4311
|
...CABVariableFields,
|
|
4263
|
-
color:
|
|
4312
|
+
color: import_zod63.z.string().default("#fadb14"),
|
|
4264
4313
|
/**
|
|
4265
4314
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
4266
4315
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
4267
4316
|
* or merchant work.
|
|
4268
4317
|
*/
|
|
4269
|
-
countLabels:
|
|
4270
|
-
one:
|
|
4271
|
-
other:
|
|
4318
|
+
countLabels: import_zod63.z.object({
|
|
4319
|
+
one: import_zod63.z.record(import_zod63.z.string(), import_zod63.z.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
4320
|
+
other: import_zod63.z.record(import_zod63.z.string(), import_zod63.z.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
4272
4321
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
4273
|
-
name:
|
|
4274
|
-
sectionId:
|
|
4275
|
-
sectionType:
|
|
4276
|
-
size:
|
|
4322
|
+
name: import_zod63.z.string().optional(),
|
|
4323
|
+
sectionId: import_zod63.z.uuid().default(() => (0, import_uuid12.v7)()),
|
|
4324
|
+
sectionType: import_zod63.z.literal(SectionType.reviews).default(SectionType.reviews),
|
|
4325
|
+
size: import_zod63.z.enum(reviewsSizes).default(ReviewsSize.default),
|
|
4277
4326
|
/**
|
|
4278
4327
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
4279
4328
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
4280
4329
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
4281
4330
|
* the whole reviews section.
|
|
4282
4331
|
*/
|
|
4283
|
-
strokeColor:
|
|
4332
|
+
strokeColor: import_zod63.z.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
4284
4333
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
4285
|
-
strokeWidth:
|
|
4334
|
+
strokeWidth: import_zod63.z.number().nonnegative().default(0)
|
|
4286
4335
|
});
|
|
4287
4336
|
|
|
4288
4337
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
4289
4338
|
var import_uuid13 = require("uuid");
|
|
4290
|
-
var
|
|
4291
|
-
var CABSeparatorSection =
|
|
4339
|
+
var import_zod64 = require("zod");
|
|
4340
|
+
var CABSeparatorSection = import_zod64.z.object({
|
|
4292
4341
|
...CABVariableFields,
|
|
4293
|
-
sectionId:
|
|
4294
|
-
sectionType:
|
|
4342
|
+
sectionId: import_zod64.z.uuid().default(() => (0, import_uuid13.v7)()),
|
|
4343
|
+
sectionType: import_zod64.z.literal(SectionType.separator).default(SectionType.separator)
|
|
4295
4344
|
});
|
|
4296
4345
|
|
|
4297
4346
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
4298
4347
|
var import_compat5 = require("es-toolkit/compat");
|
|
4299
4348
|
var import_uuid14 = require("uuid");
|
|
4300
|
-
var
|
|
4301
|
-
var CABVariantsSection =
|
|
4349
|
+
var import_zod65 = require("zod");
|
|
4350
|
+
var CABVariantsSection = import_zod65.z.object({
|
|
4302
4351
|
...CABVariableFields,
|
|
4303
|
-
hideOutOfStockVariants:
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4352
|
+
hideOutOfStockVariants: import_zod65.z.boolean().default(false),
|
|
4353
|
+
/**
|
|
4354
|
+
* The menu's own label per buyer locale (`selectLanguage`), for the whole-variant (`single`) and the
|
|
4355
|
+
* product-group menus; `multiple` labels each option's menu by its name. Optional and additive
|
|
4356
|
+
* (REB-24846): absent, a renderer keeps its own label; the post-purchase converter sets legacy's
|
|
4357
|
+
* "Select Variant" and "Option" (L93, L97). A malformed label drops only itself.
|
|
4358
|
+
*
|
|
4359
|
+
* A blank (or whitespace-only) entry is dropped per locale, so that buyer falls back to `en` instead of
|
|
4360
|
+
* `selectLanguage` returning `''` — which a renderer's `??` fallback would show as an empty menu label.
|
|
4361
|
+
* A label left with no entries reads as absent.
|
|
4362
|
+
*/
|
|
4363
|
+
label: import_zod65.z.record(import_zod65.z.string(), import_zod65.z.string()).transform((label) => {
|
|
4364
|
+
const filled = (0, import_compat5.pickBy)(label, (value) => value.trim() !== "");
|
|
4365
|
+
return (0, import_compat5.isEmpty)(filled) ? void 0 : filled;
|
|
4366
|
+
}).optional().catch(void 0),
|
|
4367
|
+
name: import_zod65.z.string().optional(),
|
|
4368
|
+
sectionId: import_zod65.z.uuid().default(() => (0, import_uuid14.v7)()),
|
|
4369
|
+
sectionType: import_zod65.z.literal(SectionType.variants).default(SectionType.variants),
|
|
4370
|
+
selector: import_zod65.z.enum((0, import_compat5.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
4308
4371
|
/** `productGroup` is additive (REB-24817): a renderer without group support must render nothing for it. */
|
|
4309
|
-
variantMode:
|
|
4372
|
+
variantMode: import_zod65.z.enum(variantsModes).default(VariantsMode.multiple)
|
|
4310
4373
|
});
|
|
4311
4374
|
|
|
4312
4375
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
4313
|
-
var CABBorder =
|
|
4314
|
-
radius:
|
|
4315
|
-
style:
|
|
4316
|
-
width:
|
|
4376
|
+
var CABBorder = import_zod66.z.object({
|
|
4377
|
+
radius: import_zod66.z.enum(borderRadii).default(BorderRadius.base),
|
|
4378
|
+
style: import_zod66.z.enum(borderStyles).default(BorderStyle.none),
|
|
4379
|
+
width: import_zod66.z.enum(borderWidths).default(BorderWidth.base)
|
|
4317
4380
|
}).default({
|
|
4318
4381
|
radius: BorderRadius.base,
|
|
4319
4382
|
style: BorderStyle.none,
|
|
4320
4383
|
width: BorderWidth.base
|
|
4321
4384
|
});
|
|
4322
|
-
var CABSection =
|
|
4323
|
-
() =>
|
|
4385
|
+
var CABSection = import_zod66.z.lazy(
|
|
4386
|
+
() => import_zod66.z.discriminatedUnion("sectionType", [
|
|
4324
4387
|
CABBannerSection,
|
|
4325
4388
|
CABButtonSection,
|
|
4326
4389
|
CABCarouselSection,
|
|
@@ -4343,41 +4406,41 @@ var CABSection = import_zod64.z.lazy(
|
|
|
4343
4406
|
);
|
|
4344
4407
|
|
|
4345
4408
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
4346
|
-
var GridItem =
|
|
4347
|
-
var CABLayoutWrapping =
|
|
4348
|
-
breakAt:
|
|
4349
|
-
maxPerLine:
|
|
4409
|
+
var GridItem = import_zod67.z.union([import_zod67.z.literal("auto"), import_zod67.z.literal("fill"), import_zod67.z.string().regex(/^\d+%$/), import_zod67.z.number()]);
|
|
4410
|
+
var CABLayoutWrapping = import_zod67.z.object({
|
|
4411
|
+
breakAt: import_zod67.z.number().positive(),
|
|
4412
|
+
maxPerLine: import_zod67.z.number().int().positive()
|
|
4350
4413
|
});
|
|
4351
|
-
var CABLayoutSection =
|
|
4414
|
+
var CABLayoutSection = import_zod67.z.object({
|
|
4352
4415
|
...CABVariableFields,
|
|
4353
|
-
alignment:
|
|
4354
|
-
horizontal:
|
|
4355
|
-
vertical:
|
|
4416
|
+
alignment: import_zod67.z.object({
|
|
4417
|
+
horizontal: import_zod67.z.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
4418
|
+
vertical: import_zod67.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
4356
4419
|
}).default({
|
|
4357
4420
|
horizontal: HorizontalAlignment.start,
|
|
4358
4421
|
vertical: VerticalAlignment.top
|
|
4359
4422
|
}),
|
|
4360
|
-
border:
|
|
4361
|
-
buttonField:
|
|
4362
|
-
direction:
|
|
4423
|
+
border: import_zod67.z.lazy(() => CABBorder),
|
|
4424
|
+
buttonField: import_zod67.z.enum(buttonFields).optional(),
|
|
4425
|
+
direction: import_zod67.z.enum(directions).default(Direction.rows),
|
|
4363
4426
|
/**
|
|
4364
4427
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
4365
4428
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
4366
4429
|
*/
|
|
4367
|
-
frame:
|
|
4368
|
-
grid:
|
|
4369
|
-
columns:
|
|
4370
|
-
rows:
|
|
4430
|
+
frame: import_zod67.z.enum(layoutFrames).optional(),
|
|
4431
|
+
grid: import_zod67.z.object({
|
|
4432
|
+
columns: import_zod67.z.union([import_zod67.z.array(GridItem), import_zod67.z.undefined()]).default(() => ["auto"]),
|
|
4433
|
+
rows: import_zod67.z.union([import_zod67.z.array(GridItem), import_zod67.z.undefined()]).default(() => ["auto"])
|
|
4371
4434
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
4372
|
-
name:
|
|
4373
|
-
padding:
|
|
4374
|
-
sectionId:
|
|
4375
|
-
sections:
|
|
4376
|
-
sectionType:
|
|
4377
|
-
spacing:
|
|
4435
|
+
name: import_zod67.z.string().optional(),
|
|
4436
|
+
padding: import_zod67.z.enum(spacings).default(Spacing.none),
|
|
4437
|
+
sectionId: import_zod67.z.uuid().default(() => (0, import_uuid15.v7)()),
|
|
4438
|
+
sections: import_zod67.z.union([import_zod67.z.array(import_zod67.z.lazy(() => CABSection)), import_zod67.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
4439
|
+
sectionType: import_zod67.z.literal(SectionType.layout).default(SectionType.layout),
|
|
4440
|
+
spacing: import_zod67.z.enum(spacings).default(Spacing.base),
|
|
4378
4441
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
4379
|
-
viewUrl:
|
|
4380
|
-
width:
|
|
4442
|
+
viewUrl: import_zod67.z.string().optional(),
|
|
4443
|
+
width: import_zod67.z.number().default(100),
|
|
4381
4444
|
wrapping: CABLayoutWrapping.optional()
|
|
4382
4445
|
});
|
|
4383
4446
|
|
|
@@ -4399,8 +4462,8 @@ var UI_LABELS = {
|
|
|
4399
4462
|
};
|
|
4400
4463
|
|
|
4401
4464
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
4402
|
-
var localized = (fallback) =>
|
|
4403
|
-
var CABUILabels =
|
|
4465
|
+
var localized = (fallback) => import_zod68.z.record(import_zod68.z.string(), import_zod68.z.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
4466
|
+
var CABUILabels = import_zod68.z.object({
|
|
4404
4467
|
currentPage: localized(UI_LABELS.currentPage),
|
|
4405
4468
|
guest: localized(UI_LABELS.guest),
|
|
4406
4469
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -4425,49 +4488,49 @@ var CABUILabels = import_zod66.z.object({
|
|
|
4425
4488
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
4426
4489
|
updating: { ...UI_LABELS.updating }
|
|
4427
4490
|
}));
|
|
4428
|
-
var TargetArea =
|
|
4429
|
-
fill:
|
|
4430
|
-
flip:
|
|
4431
|
-
icon:
|
|
4432
|
-
label:
|
|
4433
|
-
width:
|
|
4491
|
+
var TargetArea = import_zod68.z.object({
|
|
4492
|
+
fill: import_zod68.z.boolean().optional(),
|
|
4493
|
+
flip: import_zod68.z.enum(["both", "horizontal", "vertical"]).optional(),
|
|
4494
|
+
icon: import_zod68.z.string(),
|
|
4495
|
+
label: import_zod68.z.string(),
|
|
4496
|
+
width: import_zod68.z.string()
|
|
4434
4497
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
4435
|
-
var CABTracking =
|
|
4436
|
-
enableAttribution:
|
|
4437
|
-
enableSource:
|
|
4438
|
-
enableWidget:
|
|
4498
|
+
var CABTracking = import_zod68.z.object({
|
|
4499
|
+
enableAttribution: import_zod68.z.boolean().nullish().transform((value) => value ?? true),
|
|
4500
|
+
enableSource: import_zod68.z.boolean().nullish().transform((value) => value ?? true),
|
|
4501
|
+
enableWidget: import_zod68.z.boolean().nullish().transform((value) => value ?? true)
|
|
4439
4502
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
4440
|
-
var CABExperiment =
|
|
4441
|
-
elementId:
|
|
4442
|
-
experimentId:
|
|
4443
|
-
experimentType:
|
|
4444
|
-
selectedId:
|
|
4503
|
+
var CABExperiment = import_zod68.z.object({
|
|
4504
|
+
elementId: import_zod68.z.number(),
|
|
4505
|
+
experimentId: import_zod68.z.number(),
|
|
4506
|
+
experimentType: import_zod68.z.string(),
|
|
4507
|
+
selectedId: import_zod68.z.number()
|
|
4445
4508
|
});
|
|
4446
4509
|
var CABRootSection = CABLayoutSection.extend({
|
|
4447
|
-
editorMode:
|
|
4510
|
+
editorMode: import_zod68.z.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
4448
4511
|
experiment: CABExperiment.optional(),
|
|
4449
4512
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
4450
4513
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
4451
|
-
previewMode:
|
|
4452
|
-
storeId:
|
|
4514
|
+
previewMode: import_zod68.z.boolean().nullish().transform((value) => value ?? false),
|
|
4515
|
+
storeId: import_zod68.z.number().nullable().default(null),
|
|
4453
4516
|
targetArea: TargetArea.nullable(),
|
|
4454
4517
|
tracking: CABTracking,
|
|
4455
|
-
type:
|
|
4518
|
+
type: import_zod68.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
4456
4519
|
uiLabels: CABUILabels,
|
|
4457
|
-
version:
|
|
4458
|
-
widgetId:
|
|
4520
|
+
version: import_zod68.z.literal(2).default(2),
|
|
4521
|
+
widgetId: import_zod68.z.number().nullable().default(null)
|
|
4459
4522
|
});
|
|
4460
4523
|
|
|
4461
4524
|
// src/schema/postPurchaseProductView.ts
|
|
4462
|
-
var PostPurchaseProductView =
|
|
4463
|
-
|
|
4525
|
+
var PostPurchaseProductView = import_zod69.z.union([
|
|
4526
|
+
import_zod69.z.object({
|
|
4464
4527
|
changeset: PostPurchaseProductChangeset.optional(),
|
|
4465
4528
|
displayPrice: PostPurchaseDisplayPrice.optional(),
|
|
4466
4529
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
4467
4530
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
4468
4531
|
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
4469
4532
|
preparation: PreparedPostPurchaseProduct.extend({
|
|
4470
|
-
display: PreparedPostPurchaseProduct.shape.display.extend({ description:
|
|
4533
|
+
display: PreparedPostPurchaseProduct.shape.display.extend({ description: import_zod69.z.string().nullable() }).refine(
|
|
4471
4534
|
({ description, descriptionDocument }) => description === null === (descriptionDocument !== void 0),
|
|
4472
4535
|
"Exactly one of the plain and rich descriptions is shown"
|
|
4473
4536
|
)
|
|
@@ -4476,7 +4539,7 @@ var PostPurchaseProductView = import_zod67.z.union([
|
|
|
4476
4539
|
sections: CABRootSection,
|
|
4477
4540
|
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
4478
4541
|
}),
|
|
4479
|
-
|
|
4542
|
+
import_zod69.z.object({
|
|
4480
4543
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
4481
4544
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
4482
4545
|
/** The localized unavailable copy, for the choices still offered beneath an unprepared product. */
|
|
@@ -4491,21 +4554,21 @@ var PostPurchaseProductView = import_zod67.z.union([
|
|
|
4491
4554
|
]);
|
|
4492
4555
|
|
|
4493
4556
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
4494
|
-
var PostPurchaseProductCollectionView =
|
|
4495
|
-
members:
|
|
4496
|
-
|
|
4557
|
+
var PostPurchaseProductCollectionView = import_zod70.z.object({
|
|
4558
|
+
members: import_zod70.z.array(
|
|
4559
|
+
import_zod70.z.object({
|
|
4497
4560
|
productId: PostPurchaseProductId,
|
|
4498
|
-
productIndex:
|
|
4561
|
+
productIndex: import_zod70.z.number().int().nonnegative(),
|
|
4499
4562
|
view: PostPurchaseProductView
|
|
4500
4563
|
})
|
|
4501
4564
|
)
|
|
4502
4565
|
});
|
|
4503
|
-
var PostPurchaseCollectionChoice =
|
|
4566
|
+
var PostPurchaseCollectionChoice = import_zod70.z.object({
|
|
4504
4567
|
choice: PostPurchaseChoice.optional(),
|
|
4505
4568
|
productId: PostPurchaseProductId,
|
|
4506
4569
|
variantId: PostPurchaseVariantSelector.shape.variantId.optional()
|
|
4507
4570
|
}).strict();
|
|
4508
|
-
var PostPurchaseExcludedProductIds =
|
|
4571
|
+
var PostPurchaseExcludedProductIds = import_zod70.z.array(PostPurchaseProductId).default([]);
|
|
4509
4572
|
var PostPurchaseMemberSelector = PostPurchaseProgressSchema.shape.members.element.pick({ productId: true }).extend({ progressRevision: PostPurchaseProgressSchema.shape.revision });
|
|
4510
4573
|
var PostPurchaseMemberPointer = PostPurchaseProgressSchema.shape.members.element.omit({ status: true }).extend({
|
|
4511
4574
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
@@ -4518,7 +4581,7 @@ var PostPurchaseQuantityChoice = PostPurchaseCollectionChoice.extend({ quantity:
|
|
|
4518
4581
|
var PostPurchaseQuantityPolicy = PostPurchaseSettings.shape.quantityInputs.omit({ defaultQuantity: true }).extend({
|
|
4519
4582
|
initialQuantity: quantity,
|
|
4520
4583
|
maxValue: quantity,
|
|
4521
|
-
minValue:
|
|
4584
|
+
minValue: import_zod71.z.literal(0).transform(() => 1).or(quantity)
|
|
4522
4585
|
}).refine(({ maxValue, minValue }) => minValue <= maxValue, "Quantity bounds are reversed");
|
|
4523
4586
|
|
|
4524
4587
|
// src/schema/postPurchaseGroup.ts
|
|
@@ -4527,33 +4590,33 @@ var PostPurchaseGroupChoice = PostPurchaseQuantityChoice.extend({
|
|
|
4527
4590
|
});
|
|
4528
4591
|
|
|
4529
4592
|
// src/schema/postPurchaseHealth.ts
|
|
4530
|
-
var
|
|
4593
|
+
var import_zod74 = require("zod");
|
|
4531
4594
|
|
|
4532
4595
|
// src/schema/postPurchaseHealthSchedule.ts
|
|
4533
|
-
var
|
|
4596
|
+
var import_zod73 = require("zod");
|
|
4534
4597
|
|
|
4535
4598
|
// src/schema/postPurchaseReleaseSchedule.ts
|
|
4536
|
-
var
|
|
4537
|
-
var postPurchaseTaskNameSchema = (queue, id) =>
|
|
4538
|
-
var SessionReleaseScheduleRequestSchema =
|
|
4599
|
+
var import_zod72 = require("zod");
|
|
4600
|
+
var postPurchaseTaskNameSchema = (queue, id) => import_zod72.z.string().regex(new RegExp(`^projects/[a-zA-Z0-9.:-]+/locations/us-central1/queues/${queue}/tasks/${id}$`));
|
|
4601
|
+
var SessionReleaseScheduleRequestSchema = import_zod72.z.strictObject({
|
|
4539
4602
|
deadline: PostPurchaseTimestampSchema,
|
|
4540
4603
|
orderId: PostPurchaseOrderIdSchema,
|
|
4541
4604
|
releaseOwner: ReleaseOwnerSchema,
|
|
4542
4605
|
sessionId: PostPurchaseSessionIdSchema
|
|
4543
4606
|
});
|
|
4544
|
-
var SessionReleaseScheduleResponseSchema =
|
|
4545
|
-
data:
|
|
4607
|
+
var SessionReleaseScheduleResponseSchema = import_zod72.z.object({
|
|
4608
|
+
data: import_zod72.z.discriminatedUnion("status", [
|
|
4546
4609
|
SessionReleaseScheduleRequestSchema.extend({
|
|
4547
|
-
releaseOwner:
|
|
4548
|
-
status:
|
|
4610
|
+
releaseOwner: import_zod72.z.literal("rebuy"),
|
|
4611
|
+
status: import_zod72.z.literal("queued"),
|
|
4549
4612
|
taskName: postPurchaseTaskNameSchema("post-purchase-order-hold-release", "[a-f0-9]{64}-release")
|
|
4550
4613
|
}),
|
|
4551
4614
|
SessionReleaseScheduleRequestSchema.extend({
|
|
4552
|
-
releaseOwner:
|
|
4553
|
-
status:
|
|
4615
|
+
releaseOwner: import_zod72.z.literal("shopify"),
|
|
4616
|
+
status: import_zod72.z.literal("native")
|
|
4554
4617
|
})
|
|
4555
4618
|
]),
|
|
4556
|
-
successful:
|
|
4619
|
+
successful: import_zod72.z.literal(true)
|
|
4557
4620
|
});
|
|
4558
4621
|
|
|
4559
4622
|
// src/schema/postPurchaseHealthSchedule.ts
|
|
@@ -4562,15 +4625,15 @@ var PostPurchaseHealthTaskNameSchema = postPurchaseTaskNameSchema(
|
|
|
4562
4625
|
"post-purchase-health-check",
|
|
4563
4626
|
"[a-z0-9][a-z0-9-]*--[1-9][0-9]*"
|
|
4564
4627
|
);
|
|
4565
|
-
var HealthScheduleAcknowledgementSchema =
|
|
4628
|
+
var HealthScheduleAcknowledgementSchema = import_zod73.z.strictObject({
|
|
4566
4629
|
data: HealthScheduleSchema.extend({
|
|
4567
|
-
status:
|
|
4630
|
+
status: import_zod73.z.literal("queued"),
|
|
4568
4631
|
taskName: PostPurchaseHealthTaskNameSchema
|
|
4569
4632
|
}).refine(
|
|
4570
4633
|
(data) => data.taskName.endsWith(`/tasks/${postPurchaseHealthTaskId(data)}`),
|
|
4571
4634
|
"taskName must be this order's health task"
|
|
4572
4635
|
),
|
|
4573
|
-
successful:
|
|
4636
|
+
successful: import_zod73.z.literal(true)
|
|
4574
4637
|
});
|
|
4575
4638
|
|
|
4576
4639
|
// src/schema/postPurchaseHealth.ts
|
|
@@ -4579,7 +4642,7 @@ var HealthFactSchema = HealthScheduleSchema.pick({
|
|
|
4579
4642
|
operationId: true,
|
|
4580
4643
|
removePartialOrder: true
|
|
4581
4644
|
});
|
|
4582
|
-
var HealthScheduleReceiptSchema =
|
|
4645
|
+
var HealthScheduleReceiptSchema = import_zod74.z.strictObject({
|
|
4583
4646
|
recordedAt: PostPurchaseTimestampSchema,
|
|
4584
4647
|
taskName: PostPurchaseHealthTaskNameSchema
|
|
4585
4648
|
});
|
|
@@ -4589,150 +4652,138 @@ var StoredHealthFactSchema = HealthFactSchema.extend({
|
|
|
4589
4652
|
});
|
|
4590
4653
|
var HealthAttemptSchema = StoredHealthFactSchema.extend({
|
|
4591
4654
|
attemptedAt: PostPurchaseTimestampSchema,
|
|
4592
|
-
attemptId:
|
|
4593
|
-
status:
|
|
4655
|
+
attemptId: import_zod74.z.uuid(),
|
|
4656
|
+
status: import_zod74.z.literal("attempted")
|
|
4594
4657
|
});
|
|
4595
4658
|
var HealthResultSchema = HealthAttemptSchema.extend({
|
|
4596
4659
|
finishedAt: PostPurchaseTimestampSchema,
|
|
4597
|
-
status:
|
|
4660
|
+
status: import_zod74.z.enum(["returned", "unknown"])
|
|
4598
4661
|
});
|
|
4599
|
-
var HealthStateSchema =
|
|
4600
|
-
StoredHealthFactSchema.extend({ status:
|
|
4662
|
+
var HealthStateSchema = import_zod74.z.union([
|
|
4663
|
+
StoredHealthFactSchema.extend({ status: import_zod74.z.literal("pending") }),
|
|
4601
4664
|
HealthAttemptSchema,
|
|
4602
4665
|
HealthResultSchema
|
|
4603
4666
|
]);
|
|
4604
4667
|
var HealthPrepareRequestSchema = DecideRequestSchema.extend({
|
|
4605
4668
|
operationId: HealthScheduleSchema.shape.operationId
|
|
4606
4669
|
}).strict();
|
|
4607
|
-
var HealthPrepareResponseSchema =
|
|
4608
|
-
var HealthClaimRequestSchema =
|
|
4670
|
+
var HealthPrepareResponseSchema = import_zod74.z.object({ data: HealthScheduleSchema, successful: import_zod74.z.literal(true) });
|
|
4671
|
+
var HealthClaimRequestSchema = import_zod74.z.strictObject({
|
|
4609
4672
|
orderId: PostPurchaseOrderIdSchema,
|
|
4610
|
-
removePartialOrder:
|
|
4673
|
+
removePartialOrder: import_zod74.z.boolean(),
|
|
4611
4674
|
shop: ShopifyDomainSchema
|
|
4612
4675
|
});
|
|
4613
4676
|
var HealthClaimFactSchema = HealthClaimRequestSchema.extend({
|
|
4614
4677
|
healthScheduledAt: HealthFactSchema.shape.healthScheduledAt
|
|
4615
4678
|
});
|
|
4616
|
-
var HealthClaimResponseSchema =
|
|
4617
|
-
data:
|
|
4618
|
-
|
|
4619
|
-
HealthClaimFactSchema.extend({ status:
|
|
4620
|
-
HealthClaimFactSchema.extend({ attemptId: HealthAttemptSchema.shape.attemptId, status:
|
|
4679
|
+
var HealthClaimResponseSchema = import_zod74.z.object({
|
|
4680
|
+
data: import_zod74.z.union([
|
|
4681
|
+
import_zod74.z.strictObject({ status: import_zod74.z.literal("missing") }),
|
|
4682
|
+
HealthClaimFactSchema.extend({ status: import_zod74.z.enum(["pending", "attempted", "returned", "unknown"]) }),
|
|
4683
|
+
HealthClaimFactSchema.extend({ attemptId: HealthAttemptSchema.shape.attemptId, status: import_zod74.z.literal("claimed") })
|
|
4621
4684
|
]),
|
|
4622
|
-
successful:
|
|
4685
|
+
successful: import_zod74.z.literal(true)
|
|
4623
4686
|
});
|
|
4624
4687
|
var HealthResultRequestSchema = HealthClaimRequestSchema.extend({
|
|
4625
4688
|
attemptId: HealthAttemptSchema.shape.attemptId,
|
|
4626
4689
|
outcome: HealthResultSchema.shape.status
|
|
4627
4690
|
});
|
|
4628
|
-
var HealthResultResponseSchema =
|
|
4691
|
+
var HealthResultResponseSchema = import_zod74.z.object({
|
|
4629
4692
|
data: HealthClaimFactSchema.extend({
|
|
4630
4693
|
finishedAt: HealthResultSchema.shape.finishedAt,
|
|
4631
4694
|
status: HealthResultSchema.shape.status
|
|
4632
4695
|
}),
|
|
4633
|
-
successful:
|
|
4696
|
+
successful: import_zod74.z.literal(true)
|
|
4634
4697
|
});
|
|
4635
4698
|
|
|
4636
4699
|
// src/schema/postPurchaseLifecycle.ts
|
|
4637
|
-
var
|
|
4638
|
-
var Presentation =
|
|
4700
|
+
var import_zod75 = require("zod");
|
|
4701
|
+
var Presentation = import_zod75.z.strictObject({
|
|
4639
4702
|
member: PostPurchaseMemberIdentity,
|
|
4640
4703
|
selectedProductId: PostPurchaseMemberIdentity.shape.productId.optional(),
|
|
4641
4704
|
variant: PostPurchaseVariantSelector
|
|
4642
4705
|
});
|
|
4643
4706
|
var LifecycleObservationRequestSchema = DecideRequestSchema.extend({
|
|
4644
4707
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
4645
|
-
eventType:
|
|
4708
|
+
eventType: import_zod75.z.enum(["OFFER_VIEWED", "OFFER_TIMER_EXPIRED"]),
|
|
4646
4709
|
presentation: Presentation.nullable(),
|
|
4647
4710
|
progressRevision: PostPurchaseProgressSchema.shape.revision,
|
|
4648
|
-
requestId:
|
|
4711
|
+
requestId: import_zod75.z.uuid()
|
|
4649
4712
|
}).strict().refine(
|
|
4650
4713
|
({ eventType, presentation }) => eventType !== "OFFER_VIEWED" || presentation !== null,
|
|
4651
4714
|
"Viewed observations require a presented product"
|
|
4652
4715
|
);
|
|
4653
|
-
var LifecycleObservationResponseSchema =
|
|
4654
|
-
data:
|
|
4716
|
+
var LifecycleObservationResponseSchema = import_zod75.z.object({
|
|
4717
|
+
data: import_zod75.z.strictObject({
|
|
4655
4718
|
requestId: LifecycleObservationRequestSchema.shape.requestId,
|
|
4656
|
-
status:
|
|
4719
|
+
status: import_zod75.z.union([AcceptedEventOutcomeSchema, import_zod75.z.literal("unavailable")])
|
|
4657
4720
|
}),
|
|
4658
|
-
successful:
|
|
4721
|
+
successful: import_zod75.z.literal(true)
|
|
4659
4722
|
});
|
|
4660
4723
|
|
|
4661
4724
|
// src/schema/postPurchaseOffer.ts
|
|
4662
|
-
var
|
|
4663
|
-
|
|
4664
|
-
// src/schema/postPurchaseSkipTrace.ts
|
|
4665
|
-
var import_zod74 = require("zod");
|
|
4666
|
-
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
4667
|
-
var PostPurchaseSkipTraceSchema = import_zod74.z.array(
|
|
4668
|
-
import_zod74.z.object({
|
|
4669
|
-
entry: DecisionEntrySchema,
|
|
4670
|
-
reason: PostPurchaseSkipReasonSchema
|
|
4671
|
-
})
|
|
4672
|
-
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
4673
|
-
|
|
4674
|
-
// src/schema/postPurchaseOffer.ts
|
|
4725
|
+
var import_zod76 = require("zod");
|
|
4675
4726
|
var OfferPreparationRequestSchema = DecideRequestSchema.strict();
|
|
4676
|
-
var OfferPreparationResponseSchema =
|
|
4677
|
-
data:
|
|
4678
|
-
successful:
|
|
4727
|
+
var OfferPreparationResponseSchema = import_zod76.z.object({
|
|
4728
|
+
data: import_zod76.z.object({ attemptedSkips: PostPurchaseSkipTraceSchema.optional(), progress: PostPurchaseProgressSchema }),
|
|
4729
|
+
successful: import_zod76.z.literal(true)
|
|
4679
4730
|
});
|
|
4680
4731
|
|
|
4681
4732
|
// src/schema/postPurchaseOfferEligibility.ts
|
|
4682
|
-
var
|
|
4733
|
+
var import_zod77 = require("zod");
|
|
4683
4734
|
var selection2 = PreparedPostPurchaseProduct.shape.selection;
|
|
4684
|
-
var PostPurchaseOfferSkipReason =
|
|
4685
|
-
var PostPurchaseOfferEligibilityContext =
|
|
4735
|
+
var PostPurchaseOfferSkipReason = import_zod77.z.enum(["empty", "no-eligible-subscription"]);
|
|
4736
|
+
var PostPurchaseOfferEligibilityContext = import_zod77.z.object({
|
|
4686
4737
|
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
4687
|
-
originalLineItems:
|
|
4738
|
+
originalLineItems: import_zod77.z.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
4688
4739
|
});
|
|
4689
|
-
var PostPurchaseOfferEligibility =
|
|
4690
|
-
|
|
4691
|
-
members:
|
|
4692
|
-
|
|
4740
|
+
var PostPurchaseOfferEligibility = import_zod77.z.discriminatedUnion("status", [
|
|
4741
|
+
import_zod77.z.object({
|
|
4742
|
+
members: import_zod77.z.array(
|
|
4743
|
+
import_zod77.z.object({ productId: selection2.shape.productId, productIndex: import_zod77.z.number().int().nonnegative() })
|
|
4693
4744
|
),
|
|
4694
|
-
status:
|
|
4745
|
+
status: import_zod77.z.literal("retain")
|
|
4695
4746
|
}),
|
|
4696
|
-
|
|
4697
|
-
|
|
4747
|
+
import_zod77.z.object({ reason: PostPurchaseOfferSkipReason, status: import_zod77.z.literal("skip") }),
|
|
4748
|
+
import_zod77.z.object({ reason: import_zod77.z.literal("eligible-upgrade").optional(), status: import_zod77.z.literal("unavailable") })
|
|
4698
4749
|
]);
|
|
4699
4750
|
|
|
4700
4751
|
// src/schema/postPurchaseOfferPresentation.ts
|
|
4701
|
-
var
|
|
4752
|
+
var import_zod78 = require("zod");
|
|
4702
4753
|
var language2 = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap();
|
|
4703
|
-
var PostPurchaseOfferPresentation =
|
|
4754
|
+
var PostPurchaseOfferPresentation = import_zod78.z.strictObject({
|
|
4704
4755
|
labels: language2.pick({ declineAll: true, declineThisOffer: true }),
|
|
4705
4756
|
layout: PostPurchaseSettings.shape.offersLayout,
|
|
4706
4757
|
sections: CABRootSection.nullable(),
|
|
4707
4758
|
showDeclineAll: PostPurchaseSettings.shape.productOptions.shape.showDeclineAll
|
|
4708
4759
|
});
|
|
4709
4760
|
var OfferPresentationRequestSchema = DecideRequestSchema.strict();
|
|
4710
|
-
var OfferPresentationResponseSchema =
|
|
4711
|
-
data:
|
|
4761
|
+
var OfferPresentationResponseSchema = import_zod78.z.object({
|
|
4762
|
+
data: import_zod78.z.strictObject({
|
|
4712
4763
|
presentation: PostPurchaseOfferPresentation.nullable(),
|
|
4713
4764
|
progress: PostPurchaseProgressSchema.nullable(),
|
|
4714
4765
|
serverNow: PostPurchaseTimestampSchema
|
|
4715
4766
|
}),
|
|
4716
|
-
successful:
|
|
4767
|
+
successful: import_zod78.z.literal(true)
|
|
4717
4768
|
});
|
|
4718
4769
|
|
|
4719
4770
|
// src/schema/postPurchaseOrderDecision.ts
|
|
4720
|
-
var
|
|
4721
|
-
var OrderDecisionSchema =
|
|
4722
|
-
|
|
4723
|
-
|
|
4771
|
+
var import_zod79 = require("zod");
|
|
4772
|
+
var OrderDecisionSchema = import_zod79.z.discriminatedUnion("owner", [
|
|
4773
|
+
import_zod79.z.object({ owner: import_zod79.z.literal("session"), sessionId: PostPurchaseSessionIdSchema }),
|
|
4774
|
+
import_zod79.z.object({ owner: import_zod79.z.literal("release"), sessionId: import_zod79.z.null() })
|
|
4724
4775
|
]);
|
|
4725
4776
|
|
|
4726
4777
|
// src/schema/postPurchasePolicy.ts
|
|
4727
|
-
var
|
|
4728
|
-
var HoldSettingSchema =
|
|
4729
|
-
|
|
4730
|
-
|
|
4778
|
+
var import_zod80 = require("zod");
|
|
4779
|
+
var HoldSettingSchema = import_zod80.z.discriminatedUnion("enabled", [
|
|
4780
|
+
import_zod80.z.object({ durationMinutes: import_zod80.z.number().int().min(1).max(60), enabled: import_zod80.z.literal(true) }),
|
|
4781
|
+
import_zod80.z.object({ durationMinutes: import_zod80.z.null(), enabled: import_zod80.z.literal(false) })
|
|
4731
4782
|
]);
|
|
4732
|
-
var TimingSettingsSchema =
|
|
4783
|
+
var TimingSettingsSchema = import_zod80.z.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
4733
4784
|
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
4734
|
-
durationMinutes:
|
|
4735
|
-
source:
|
|
4785
|
+
durationMinutes: import_zod80.z.number().int().min(1).max(60).nullable(),
|
|
4786
|
+
source: import_zod80.z.enum(["shop", "flow", "native"])
|
|
4736
4787
|
}).refine(
|
|
4737
4788
|
(policy) => {
|
|
4738
4789
|
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
@@ -4746,8 +4797,8 @@ var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
|
4746
4797
|
);
|
|
4747
4798
|
|
|
4748
4799
|
// src/schema/postPurchasePreparationOptions.ts
|
|
4749
|
-
var
|
|
4750
|
-
var PostPurchasePreparationOptions =
|
|
4800
|
+
var import_zod81 = require("zod");
|
|
4801
|
+
var PostPurchasePreparationOptions = import_zod81.z.object({
|
|
4751
4802
|
choice: PostPurchaseChoice.optional(),
|
|
4752
4803
|
member: PostPurchaseMemberSelector.strict().optional(),
|
|
4753
4804
|
quantity: PreparedPostPurchaseProduct.shape.selection.shape.quantity.optional(),
|
|
@@ -4759,8 +4810,8 @@ var PostPurchasePreparationOptions = import_zod80.z.object({
|
|
|
4759
4810
|
);
|
|
4760
4811
|
|
|
4761
4812
|
// src/schema/postPurchaseProductSettings.ts
|
|
4762
|
-
var
|
|
4763
|
-
var amount =
|
|
4813
|
+
var import_zod82 = require("zod");
|
|
4814
|
+
var amount = import_zod82.z.union([import_zod82.z.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
4764
4815
|
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
4765
4816
|
discountedFrom: true,
|
|
4766
4817
|
language: true,
|
|
@@ -4772,22 +4823,22 @@ var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
|
4772
4823
|
subscriptionIsDefault: true,
|
|
4773
4824
|
upgradeToSubscription: true
|
|
4774
4825
|
}).extend({
|
|
4775
|
-
advance:
|
|
4776
|
-
blocks:
|
|
4826
|
+
advance: import_zod82.z.unknown().default({}),
|
|
4827
|
+
blocks: import_zod82.z.array(import_zod82.z.unknown()).optional(),
|
|
4777
4828
|
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
4778
|
-
integrations:
|
|
4829
|
+
integrations: import_zod82.z.unknown().default({}),
|
|
4779
4830
|
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
4780
|
-
styles:
|
|
4831
|
+
styles: import_zod82.z.unknown().default({}),
|
|
4781
4832
|
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
4782
|
-
subscription:
|
|
4833
|
+
subscription: import_zod82.z.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
4783
4834
|
});
|
|
4784
4835
|
|
|
4785
4836
|
// src/schema/postPurchaseRecovery.ts
|
|
4786
|
-
var
|
|
4837
|
+
var import_zod83 = require("zod");
|
|
4787
4838
|
var PurchaseRecoveryRequestSchema = DecideRequestSchema.strict();
|
|
4788
|
-
var PurchaseRecoveryResponseSchema =
|
|
4789
|
-
data:
|
|
4790
|
-
operation:
|
|
4839
|
+
var PurchaseRecoveryResponseSchema = import_zod83.z.object({
|
|
4840
|
+
data: import_zod83.z.object({
|
|
4841
|
+
operation: import_zod83.z.object({
|
|
4791
4842
|
observation: RecordedPurchaseObservationSchema.nullable(),
|
|
4792
4843
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
4793
4844
|
upgrade: UpgradeProgressSchema.optional()
|
|
@@ -4797,41 +4848,41 @@ var PurchaseRecoveryResponseSchema = import_zod82.z.object({
|
|
|
4797
4848
|
}).nullable(),
|
|
4798
4849
|
progress: PostPurchaseProgressSchema.nullable().optional()
|
|
4799
4850
|
}),
|
|
4800
|
-
successful:
|
|
4851
|
+
successful: import_zod83.z.literal(true)
|
|
4801
4852
|
});
|
|
4802
4853
|
|
|
4803
4854
|
// src/schema/postPurchaseReleaseClaim.ts
|
|
4804
|
-
var
|
|
4855
|
+
var import_zod84 = require("zod");
|
|
4805
4856
|
var ReleaseClaimRequestSchema = ReleaseAuthorityRequestSchema;
|
|
4806
|
-
var ReleaseClaimResponseSchema =
|
|
4807
|
-
data:
|
|
4808
|
-
|
|
4857
|
+
var ReleaseClaimResponseSchema = import_zod84.z.object({
|
|
4858
|
+
data: import_zod84.z.discriminatedUnion("status", [
|
|
4859
|
+
import_zod84.z.object({ status: import_zod84.z.literal("release-permitted") }),
|
|
4809
4860
|
PendingReleaseAuthoritySchema,
|
|
4810
4861
|
ReadyReleaseAuthoritySchema
|
|
4811
4862
|
]),
|
|
4812
|
-
successful:
|
|
4863
|
+
successful: import_zod84.z.literal(true)
|
|
4813
4864
|
});
|
|
4814
4865
|
|
|
4815
4866
|
// src/schema/postPurchaseSelection.ts
|
|
4816
|
-
var
|
|
4867
|
+
var import_zod85 = require("zod");
|
|
4817
4868
|
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
4818
4869
|
appId: PostPurchaseAppIdSchema,
|
|
4819
4870
|
entry: DecisionEntrySchema,
|
|
4820
|
-
iss:
|
|
4821
|
-
purpose:
|
|
4871
|
+
iss: import_zod85.z.literal("rebuy-api"),
|
|
4872
|
+
purpose: import_zod85.z.literal("post-purchase-selection")
|
|
4822
4873
|
});
|
|
4823
4874
|
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
4824
|
-
selectionToken:
|
|
4875
|
+
selectionToken: import_zod85.z.string().min(1).max(8192).optional()
|
|
4825
4876
|
}).strict();
|
|
4826
4877
|
|
|
4827
4878
|
// src/schema/postPurchaseSession.ts
|
|
4828
|
-
var
|
|
4879
|
+
var import_zod86 = require("zod");
|
|
4829
4880
|
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
4830
|
-
var SessionOrderTimingSchema =
|
|
4881
|
+
var SessionOrderTimingSchema = import_zod86.z.object({
|
|
4831
4882
|
nativeDeadline: PostPurchaseTimestampSchema,
|
|
4832
4883
|
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
4833
4884
|
orderId: PostPurchaseOrderIdSchema,
|
|
4834
|
-
timingSource:
|
|
4885
|
+
timingSource: import_zod86.z.literal("shopify-order-created-at")
|
|
4835
4886
|
});
|
|
4836
4887
|
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
4837
4888
|
deadline: PostPurchaseTimestampSchema,
|
|
@@ -4848,33 +4899,33 @@ var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
|
4848
4899
|
message: "deadline must not exceed nativeDeadline",
|
|
4849
4900
|
path: ["deadline"]
|
|
4850
4901
|
});
|
|
4851
|
-
var SessionStartResponseSchema =
|
|
4852
|
-
data:
|
|
4853
|
-
phase:
|
|
4902
|
+
var SessionStartResponseSchema = import_zod86.z.object({
|
|
4903
|
+
data: import_zod86.z.object({
|
|
4904
|
+
phase: import_zod86.z.literal("render"),
|
|
4854
4905
|
serverNow: PostPurchaseTimestampSchema,
|
|
4855
4906
|
session: ReadySessionTimingSchema,
|
|
4856
|
-
workflowPhase:
|
|
4907
|
+
workflowPhase: import_zod86.z.literal("start")
|
|
4857
4908
|
}),
|
|
4858
|
-
successful:
|
|
4909
|
+
successful: import_zod86.z.literal(true)
|
|
4859
4910
|
});
|
|
4860
4911
|
|
|
4861
4912
|
// src/schema/postPurchaseShadow.ts
|
|
4862
|
-
var
|
|
4863
|
-
var PostPurchaseShadowSelectionSchema =
|
|
4864
|
-
|
|
4865
|
-
|
|
4913
|
+
var import_zod87 = require("zod");
|
|
4914
|
+
var PostPurchaseShadowSelectionSchema = import_zod87.z.discriminatedUnion("verdict", [
|
|
4915
|
+
import_zod87.z.object({ entry: DecisionEntrySchema, verdict: import_zod87.z.literal("render") }),
|
|
4916
|
+
import_zod87.z.object({ verdict: import_zod87.z.literal("skip") })
|
|
4866
4917
|
]);
|
|
4867
|
-
var PostPurchaseShadowReportFields =
|
|
4868
|
-
differences:
|
|
4918
|
+
var PostPurchaseShadowReportFields = import_zod87.z.object({
|
|
4919
|
+
differences: import_zod87.z.array(import_zod87.z.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
4869
4920
|
message: "differences must not contain duplicate entries"
|
|
4870
4921
|
}),
|
|
4871
4922
|
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
4872
|
-
phase:
|
|
4873
|
-
sampleId:
|
|
4923
|
+
phase: import_zod87.z.literal("shouldRender"),
|
|
4924
|
+
sampleId: import_zod87.z.string(),
|
|
4874
4925
|
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
4875
|
-
status:
|
|
4876
|
-
targetingFlowIds:
|
|
4877
|
-
workflowPhase:
|
|
4926
|
+
status: import_zod87.z.enum(["match", "diverged", "incomplete"]),
|
|
4927
|
+
targetingFlowIds: import_zod87.z.array(import_zod87.z.number().int().positive()),
|
|
4928
|
+
workflowPhase: import_zod87.z.literal("decide")
|
|
4878
4929
|
});
|
|
4879
4930
|
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
4880
4931
|
(report) => report.status !== "match" || report.differences.length === 0,
|
|
@@ -4888,9 +4939,9 @@ var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
|
4888
4939
|
});
|
|
4889
4940
|
|
|
4890
4941
|
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
4891
|
-
var
|
|
4942
|
+
var import_zod88 = require("zod");
|
|
4892
4943
|
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
4893
|
-
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId:
|
|
4944
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: import_zod88.z.number().int().positive() }),
|
|
4894
4945
|
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
4895
4946
|
subscription: PostPurchaseSubscriptionTerms
|
|
4896
4947
|
}).refine(
|
|
@@ -4902,28 +4953,6 @@ var readPostPurchaseSubscription = (prepared) => {
|
|
|
4902
4953
|
return PreparedPostPurchaseSubscription.parse(prepared);
|
|
4903
4954
|
};
|
|
4904
4955
|
|
|
4905
|
-
// src/schema/postPurchaseTransition.ts
|
|
4906
|
-
var import_zod88 = require("zod");
|
|
4907
|
-
var OfferTransitionRequestSchema = DecideRequestSchema.extend({
|
|
4908
|
-
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
4909
|
-
progressRevision: PostPurchaseProgressSchema.shape.revision
|
|
4910
|
-
}).strict();
|
|
4911
|
-
var PostPurchaseEndReasonSchema = import_zod88.z.enum(["no-child", "no-products", "accept-cap"]);
|
|
4912
|
-
var TransitionBaseSchema = import_zod88.z.object({
|
|
4913
|
-
attemptedSkips: PostPurchaseSkipTraceSchema.optional(),
|
|
4914
|
-
progress: PostPurchaseProgressSchema
|
|
4915
|
-
});
|
|
4916
|
-
var OfferTransitionResponseSchema = import_zod88.z.object({
|
|
4917
|
-
data: import_zod88.z.discriminatedUnion("status", [
|
|
4918
|
-
TransitionBaseSchema.extend({ status: import_zod88.z.enum(["advanced", "unavailable"]) }),
|
|
4919
|
-
TransitionBaseSchema.extend({
|
|
4920
|
-
endReason: PostPurchaseEndReasonSchema.optional(),
|
|
4921
|
-
status: import_zod88.z.literal("no-child")
|
|
4922
|
-
})
|
|
4923
|
-
]),
|
|
4924
|
-
successful: import_zod88.z.literal(true)
|
|
4925
|
-
});
|
|
4926
|
-
|
|
4927
4956
|
// src/schema/postPurchaseVariantDefault.ts
|
|
4928
4957
|
var import_zod89 = require("zod");
|
|
4929
4958
|
var values = PostPurchaseVariantValues.partial().extend({
|
|
@@ -6212,6 +6241,7 @@ var subscriptionToggle = (productType, labels = {}) => {
|
|
|
6212
6241
|
buttonStyle: "plain",
|
|
6213
6242
|
/** A `subscription` widget offers no one-time purchase; suppress the downgrade so the buyer can't switch to one-time. */
|
|
6214
6243
|
...productType === "subscription" && { disableDowngrade: true },
|
|
6244
|
+
...labels.frequencyLabel && { frequencyLabel: labels.frequencyLabel },
|
|
6215
6245
|
sections: [
|
|
6216
6246
|
slot("subscriptionOption", void 0),
|
|
6217
6247
|
slot("switchToOneTimePurchase", labels.oneTime),
|