@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
package/dist/index.mjs
CHANGED
|
@@ -1530,6 +1530,8 @@ var variableTypes = ["boolean", "number", "text"];
|
|
|
1530
1530
|
var VariableType = freezeEnum(variableTypes);
|
|
1531
1531
|
var variantModes = ["multiple", "single"];
|
|
1532
1532
|
var VariantMode = freezeEnum(variantModes);
|
|
1533
|
+
var variantsModes = [...variantModes, "productGroup"];
|
|
1534
|
+
var VariantsMode = freezeEnum(variantsModes);
|
|
1533
1535
|
var variantSelectors = ["menu", "radio", "button"];
|
|
1534
1536
|
var VariantSelector = freezeEnum(variantSelectors);
|
|
1535
1537
|
var verticalAlignments = ["top", "middle", "bottom"];
|
|
@@ -2325,6 +2327,7 @@ var PreparedPostPurchaseProduct = z22.object({
|
|
|
2325
2327
|
labels: z22.object({
|
|
2326
2328
|
declineAll: global.declineAll,
|
|
2327
2329
|
free: z22.string(),
|
|
2330
|
+
notAvailable: global.notAvailable,
|
|
2328
2331
|
payNow: z22.string(),
|
|
2329
2332
|
quantity: z22.string(),
|
|
2330
2333
|
recurringShipping: global.recurringShipping,
|
|
@@ -2427,6 +2430,8 @@ var PostPurchaseProductChangeset = z23.object({
|
|
|
2427
2430
|
});
|
|
2428
2431
|
|
|
2429
2432
|
// src/schema/postPurchaseAdmission.ts
|
|
2433
|
+
var PurchaseAdmissionModeSchema = z24.enum(["purchase", "upgrade"]);
|
|
2434
|
+
var selection = PreparedPostPurchaseProduct.shape.selection;
|
|
2430
2435
|
var PurchaseExpectedSchema = z24.object({
|
|
2431
2436
|
buyerConsentToSubscriptions: z24.boolean().optional(),
|
|
2432
2437
|
changeset: PostPurchaseProductChangeset.extend({
|
|
@@ -2434,16 +2439,20 @@ var PurchaseExpectedSchema = z24.object({
|
|
|
2434
2439
|
}),
|
|
2435
2440
|
entry: DecisionEntrySchema,
|
|
2436
2441
|
member: PostPurchaseMemberIdentity.optional(),
|
|
2442
|
+
mode: PurchaseAdmissionModeSchema.optional(),
|
|
2437
2443
|
progressRevision: z24.number().int().nonnegative().optional(),
|
|
2438
|
-
selection
|
|
2444
|
+
selection
|
|
2439
2445
|
}).refine(
|
|
2440
2446
|
({ member, progressRevision }) => !member || progressRevision !== void 0,
|
|
2441
2447
|
"Captured member requires progress"
|
|
2442
|
-
).refine(
|
|
2448
|
+
).refine(
|
|
2449
|
+
({ mode, selection: { sellingPlanId } }) => mode !== "upgrade" || sellingPlanId !== void 0,
|
|
2450
|
+
"An upgrade selects a subscription"
|
|
2451
|
+
).refine(({ buyerConsentToSubscriptions: consent, changeset, selection: selection3 }) => {
|
|
2443
2452
|
const [change, shipping] = changeset.changes;
|
|
2444
|
-
if (
|
|
2445
|
-
return consent !== true && change?.type === "add_variant" && change.variantId ===
|
|
2446
|
-
return consent === true && changeset.changes.length === 1 && change.type === "add_subscription" && change.sellingPlanId ===
|
|
2453
|
+
if (selection3.sellingPlanId === void 0)
|
|
2454
|
+
return consent !== true && change?.type === "add_variant" && change.variantId === selection3.variantId && change.quantity === selection3.quantity && (shipping === void 0 || shipping.type === "add_shipping_line");
|
|
2455
|
+
return consent === true && changeset.changes.length === 1 && change.type === "add_subscription" && change.sellingPlanId === selection3.sellingPlanId && change.variantId === selection3.variantId && change.quantity === selection3.quantity;
|
|
2447
2456
|
}, "Selection, change and buyer consent must agree");
|
|
2448
2457
|
var PurchaseRequestSchema = DecideRequestSchema.extend({
|
|
2449
2458
|
expected: PurchaseExpectedSchema,
|
|
@@ -2452,12 +2461,18 @@ var PurchaseRequestSchema = DecideRequestSchema.extend({
|
|
|
2452
2461
|
var PurchaseReceiptSchema = z24.object({
|
|
2453
2462
|
admittedAt: PostPurchaseTimestampSchema,
|
|
2454
2463
|
changesetToken: z24.string().min(1),
|
|
2464
|
+
mode: PurchaseAdmissionModeSchema.optional(),
|
|
2455
2465
|
operationId: z24.uuid(),
|
|
2466
|
+
/** The server-bound one-time line an upgrade refunds; its quantity is the order's, not the selection's. */
|
|
2467
|
+
originalLine: z24.strictObject({ quantity: selection.shape.quantity, variantId: selection.shape.variantId }).optional(),
|
|
2456
2468
|
requiresSubscriptionConsent: z24.boolean(),
|
|
2457
|
-
selection
|
|
2469
|
+
selection
|
|
2458
2470
|
}).refine(
|
|
2459
|
-
({ requiresSubscriptionConsent, selection:
|
|
2471
|
+
({ requiresSubscriptionConsent, selection: selection3 }) => requiresSubscriptionConsent === (selection3.sellingPlanId !== void 0),
|
|
2460
2472
|
"Receipt consent must match its selected plan"
|
|
2473
|
+
).refine(
|
|
2474
|
+
({ mode, originalLine, selection: { sellingPlanId, variantId } }) => mode === "upgrade" ? sellingPlanId !== void 0 && originalLine?.variantId === variantId : originalLine === void 0,
|
|
2475
|
+
"An upgrade Receipt binds the original line of its subscribed variant, and only an upgrade does"
|
|
2461
2476
|
);
|
|
2462
2477
|
var PurchaseResponseSchema = z24.object({ data: PurchaseReceiptSchema, successful: z24.literal(true) });
|
|
2463
2478
|
|
|
@@ -2516,6 +2531,8 @@ import { z as z29 } from "zod";
|
|
|
2516
2531
|
import { z as z28 } from "zod";
|
|
2517
2532
|
var PostPurchasePlanOption = z28.object({
|
|
2518
2533
|
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
2534
|
+
/** cab-checkout's `discountPercentage`: the plan's own whole-percent saving on the regular price (`{{subscriptionDiscount}}`). */
|
|
2535
|
+
discountPercentage: z28.number().int().min(0).max(100).optional(),
|
|
2519
2536
|
id: z28.number().int().positive(),
|
|
2520
2537
|
intervalFrequency: z28.string().regex(/^[1-9]\d*$/).optional(),
|
|
2521
2538
|
intervalLabel: z28.string().min(1),
|
|
@@ -2635,85 +2652,120 @@ var OfferDeclineResponseSchema = z34.object({
|
|
|
2635
2652
|
successful: z34.literal(true)
|
|
2636
2653
|
});
|
|
2637
2654
|
|
|
2638
|
-
// src/schema/
|
|
2655
|
+
// src/schema/postPurchaseDisplayPrice.ts
|
|
2656
|
+
import { z as z36 } from "zod";
|
|
2657
|
+
|
|
2658
|
+
// src/schema/postPurchaseSubscriptionDisplay.ts
|
|
2639
2659
|
import { z as z35 } from "zod";
|
|
2640
|
-
var
|
|
2660
|
+
var Minor2 = z35.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
2661
|
+
var PostPurchaseSubscriptionDisplay = z35.object({
|
|
2662
|
+
comparisonMinor: Minor2,
|
|
2663
|
+
currencyCode: z35.string().regex(/^[A-Z]{3}$/),
|
|
2664
|
+
priceMinor: Minor2,
|
|
2665
|
+
savingMinor: Minor2,
|
|
2666
|
+
savingPercent: z35.number().int().min(0).max(100)
|
|
2667
|
+
});
|
|
2668
|
+
|
|
2669
|
+
// src/schema/postPurchaseDisplayPrice.ts
|
|
2670
|
+
var { currencyCode: CurrencyCode, priceMinor: Minor3, savingPercent: Percent } = PostPurchaseSubscriptionDisplay.shape;
|
|
2671
|
+
var PostPurchaseDisplayPrice = z36.object({
|
|
2672
|
+
currencyCode: CurrencyCode,
|
|
2673
|
+
savingFormat: z36.enum(["amount", "percent"]),
|
|
2674
|
+
savingMinor: Minor3,
|
|
2675
|
+
savingPercent: Percent,
|
|
2676
|
+
subscriptionUnit: PostPurchaseSubscriptionDisplay.optional(),
|
|
2677
|
+
variantCompareAtPriceMinor: Minor3.nullable(),
|
|
2678
|
+
variantPriceMinor: Minor3
|
|
2679
|
+
}).refine(
|
|
2680
|
+
({ variantCompareAtPriceMinor: struck, variantPriceMinor: price }) => struck === null || struck > price,
|
|
2681
|
+
"A compare-at price is struck only above the price"
|
|
2682
|
+
).refine(
|
|
2683
|
+
({ savingMinor, savingPercent, variantCompareAtPriceMinor: struck, variantPriceMinor: price }) => savingMinor === (struck ?? price) - price && (savingMinor > 0 || savingPercent === 0),
|
|
2684
|
+
"The saving is the struck price minus the price"
|
|
2685
|
+
).refine(
|
|
2686
|
+
({ subscriptionUnit: unit, ...facts }) => !unit || unit.currencyCode === facts.currencyCode && unit.priceMinor === facts.variantPriceMinor && unit.savingMinor === facts.savingMinor && unit.savingPercent === facts.savingPercent && unit.savingMinor === Math.max(0, unit.comparisonMinor - unit.priceMinor),
|
|
2687
|
+
"The subscription unit estimate restates the plan facts in the same currency"
|
|
2688
|
+
);
|
|
2689
|
+
|
|
2690
|
+
// src/schema/postPurchaseEligibility.ts
|
|
2691
|
+
import { z as z37 } from "zod";
|
|
2692
|
+
var PostPurchaseSkipReasonSchema = z37.enum(["empty", "no-eligible-subscription"]);
|
|
2641
2693
|
|
|
2642
2694
|
// src/schema/postPurchaseExitPolicy.ts
|
|
2643
|
-
import { z as
|
|
2695
|
+
import { z as z38 } from "zod";
|
|
2644
2696
|
var EXIT_DELAY_MAX_MS = 60 * 60 * 1e3;
|
|
2645
|
-
var ExitPolicySchema =
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
delayMs:
|
|
2649
|
-
source:
|
|
2650
|
-
status:
|
|
2697
|
+
var ExitPolicySchema = z38.discriminatedUnion("status", [
|
|
2698
|
+
z38.strictObject({ status: z38.literal("unavailable") }),
|
|
2699
|
+
z38.strictObject({
|
|
2700
|
+
delayMs: z38.number().int().nonnegative().max(EXIT_DELAY_MAX_MS),
|
|
2701
|
+
source: z38.enum(["admitted", "selected-flow"]),
|
|
2702
|
+
status: z38.literal("available")
|
|
2651
2703
|
})
|
|
2652
2704
|
]);
|
|
2653
2705
|
|
|
2654
2706
|
// src/schema/postPurchaseFinish.ts
|
|
2655
|
-
import { z as
|
|
2707
|
+
import { z as z45 } from "zod";
|
|
2656
2708
|
|
|
2657
2709
|
// src/schema/postPurchaseFollowups.ts
|
|
2658
|
-
import { z as
|
|
2710
|
+
import { z as z43 } from "zod";
|
|
2659
2711
|
|
|
2660
2712
|
// src/schema/postPurchaseHealthProgress.ts
|
|
2661
|
-
import { z as
|
|
2713
|
+
import { z as z40 } from "zod";
|
|
2662
2714
|
|
|
2663
2715
|
// src/schema/postPurchaseReleaseAuthority.ts
|
|
2664
|
-
import { z as
|
|
2665
|
-
var PostPurchaseSessionIdSchema =
|
|
2666
|
-
var ReleaseOwnerSchema =
|
|
2667
|
-
var ReleaseAuthorityRequestSchema =
|
|
2716
|
+
import { z as z39 } from "zod";
|
|
2717
|
+
var PostPurchaseSessionIdSchema = z39.string().regex(/^[a-f0-9]{64}$/);
|
|
2718
|
+
var ReleaseOwnerSchema = z39.enum(["rebuy", "shopify"]);
|
|
2719
|
+
var ReleaseAuthorityRequestSchema = z39.strictObject({
|
|
2668
2720
|
orderId: PostPurchaseOrderIdSchema,
|
|
2669
2721
|
shop: ShopifyDomainSchema
|
|
2670
2722
|
});
|
|
2671
|
-
var ReadyReleaseAuthoritySchema =
|
|
2723
|
+
var ReadyReleaseAuthoritySchema = z39.object({
|
|
2672
2724
|
deadline: PostPurchaseTimestampSchema,
|
|
2673
2725
|
releaseOwner: ReleaseOwnerSchema,
|
|
2674
2726
|
sessionId: PostPurchaseSessionIdSchema,
|
|
2675
|
-
status:
|
|
2727
|
+
status: z39.literal("ready")
|
|
2676
2728
|
});
|
|
2677
|
-
var PendingReleaseAuthoritySchema =
|
|
2678
|
-
var ReleaseAuthorityResponseSchema =
|
|
2679
|
-
data:
|
|
2680
|
-
|
|
2729
|
+
var PendingReleaseAuthoritySchema = z39.object({ status: z39.literal("pending") });
|
|
2730
|
+
var ReleaseAuthorityResponseSchema = z39.object({
|
|
2731
|
+
data: z39.discriminatedUnion("status", [
|
|
2732
|
+
z39.object({ status: z39.literal("unknown") }),
|
|
2681
2733
|
PendingReleaseAuthoritySchema,
|
|
2682
2734
|
ReadyReleaseAuthoritySchema
|
|
2683
2735
|
]),
|
|
2684
|
-
successful:
|
|
2736
|
+
successful: z39.literal(true)
|
|
2685
2737
|
});
|
|
2686
2738
|
|
|
2687
2739
|
// src/schema/postPurchaseHealthProgress.ts
|
|
2688
|
-
var HealthScheduleSchema =
|
|
2740
|
+
var HealthScheduleSchema = z40.strictObject({
|
|
2689
2741
|
checkoutToken: DecideRequestSchema.shape.checkoutToken,
|
|
2690
2742
|
healthScheduledAt: PostPurchaseTimestampSchema,
|
|
2691
2743
|
operationId: PurchaseReceiptSchema.shape.operationId.regex(/^[a-f0-9-]{36}$/),
|
|
2692
2744
|
orderId: PostPurchaseOrderIdSchema,
|
|
2693
|
-
removePartialOrder:
|
|
2745
|
+
removePartialOrder: z40.boolean(),
|
|
2694
2746
|
sessionId: PostPurchaseSessionIdSchema,
|
|
2695
2747
|
shop: DecideRequestSchema.shape.shop
|
|
2696
2748
|
});
|
|
2697
|
-
var HealthSchedulingResponseSchema =
|
|
2698
|
-
data:
|
|
2699
|
-
callbackStatus:
|
|
2749
|
+
var HealthSchedulingResponseSchema = z40.object({
|
|
2750
|
+
data: z40.object({
|
|
2751
|
+
callbackStatus: z40.enum(["pending", "attempted", "returned", "unknown"]),
|
|
2700
2752
|
facts: HealthScheduleSchema,
|
|
2701
|
-
scheduling:
|
|
2702
|
-
|
|
2703
|
-
|
|
2753
|
+
scheduling: z40.union([
|
|
2754
|
+
z40.strictObject({ recordedAt: PostPurchaseTimestampSchema, status: z40.literal("verified") }),
|
|
2755
|
+
z40.strictObject({ status: z40.enum(["unavailable", "unverified"]) })
|
|
2704
2756
|
])
|
|
2705
2757
|
}),
|
|
2706
|
-
successful:
|
|
2758
|
+
successful: z40.literal(true)
|
|
2707
2759
|
});
|
|
2708
2760
|
|
|
2709
2761
|
// src/schema/postPurchaseObservation.ts
|
|
2710
|
-
import { z as
|
|
2711
|
-
var PurchaseObservationSchema =
|
|
2712
|
-
|
|
2713
|
-
changesetApplicationsRemaining:
|
|
2714
|
-
errors:
|
|
2715
|
-
|
|
2716
|
-
code:
|
|
2762
|
+
import { z as z41 } from "zod";
|
|
2763
|
+
var PurchaseObservationSchema = z41.union([
|
|
2764
|
+
z41.object({
|
|
2765
|
+
changesetApplicationsRemaining: z41.number().int().nonnegative(),
|
|
2766
|
+
errors: z41.array(
|
|
2767
|
+
z41.object({
|
|
2768
|
+
code: z41.enum([
|
|
2717
2769
|
"payment_required",
|
|
2718
2770
|
"insufficient_inventory",
|
|
2719
2771
|
"changeset_already_applied",
|
|
@@ -2727,83 +2779,126 @@ var PurchaseObservationSchema = z39.union([
|
|
|
2727
2779
|
"subscription_limit_error",
|
|
2728
2780
|
"order_released_error"
|
|
2729
2781
|
]),
|
|
2730
|
-
message:
|
|
2782
|
+
message: z41.string()
|
|
2731
2783
|
}).strict()
|
|
2732
2784
|
),
|
|
2733
|
-
status:
|
|
2785
|
+
status: z41.enum(["processed", "partially_processed", "unprocessed"])
|
|
2734
2786
|
}).strict(),
|
|
2735
|
-
|
|
2787
|
+
z41.object({ reason: z41.literal("application-error"), status: z41.literal("unknown") }).strict()
|
|
2736
2788
|
]);
|
|
2737
|
-
var RecordedPurchaseObservationSchema =
|
|
2789
|
+
var RecordedPurchaseObservationSchema = z41.object({
|
|
2738
2790
|
observation: PurchaseObservationSchema,
|
|
2739
2791
|
recordedAt: PostPurchaseTimestampSchema
|
|
2740
2792
|
}).strict();
|
|
2741
2793
|
var PurchaseObservationRequestSchema = DecideRequestSchema.extend({
|
|
2742
2794
|
observation: PurchaseObservationSchema,
|
|
2743
|
-
operationId:
|
|
2795
|
+
operationId: z41.uuid()
|
|
2744
2796
|
}).strict();
|
|
2745
|
-
var PurchaseObservationResponseSchema =
|
|
2746
|
-
data: RecordedPurchaseObservationSchema.extend({ operationId:
|
|
2747
|
-
successful:
|
|
2797
|
+
var PurchaseObservationResponseSchema = z41.object({
|
|
2798
|
+
data: RecordedPurchaseObservationSchema.extend({ operationId: z41.uuid() }),
|
|
2799
|
+
successful: z41.literal(true)
|
|
2748
2800
|
});
|
|
2749
2801
|
|
|
2802
|
+
// src/schema/postPurchaseUpgrade.ts
|
|
2803
|
+
import { z as z42 } from "zod";
|
|
2804
|
+
var AttemptSchema2 = z42.strictObject({ attemptedAt: PostPurchaseTimestampSchema, status: z42.literal("attempted") });
|
|
2805
|
+
var FinishedSchema = AttemptSchema2.extend({ finishedAt: PostPurchaseTimestampSchema });
|
|
2806
|
+
var UpgradeRefundProgressSchema = z42.union([
|
|
2807
|
+
AttemptSchema2,
|
|
2808
|
+
FinishedSchema.extend({ refundId: z42.string().min(1), status: z42.literal("refunded") }),
|
|
2809
|
+
FinishedSchema.extend({ status: z42.enum(["failed", "unknown"]) })
|
|
2810
|
+
]);
|
|
2811
|
+
var UpgradeCompensationProgressSchema = z42.union([
|
|
2812
|
+
AttemptSchema2,
|
|
2813
|
+
FinishedSchema.extend({ status: z42.enum(["removed", "failed", "unknown"]) })
|
|
2814
|
+
]);
|
|
2815
|
+
var UpgradeReviewReasonSchema = z42.enum(["refund-unknown", "compensation-failed", "compensation-unknown"]);
|
|
2816
|
+
var UpgradeReviewProgressSchema = z42.strictObject({
|
|
2817
|
+
markedAt: PostPurchaseTimestampSchema,
|
|
2818
|
+
marker: AcceptedMetafieldResultSchema.shape.status,
|
|
2819
|
+
reason: UpgradeReviewReasonSchema
|
|
2820
|
+
});
|
|
2821
|
+
var reviewReason = (refund, compensation) => {
|
|
2822
|
+
if (refund?.status === "unknown") return "refund-unknown";
|
|
2823
|
+
if (compensation?.status === "failed" || compensation?.status === "unknown")
|
|
2824
|
+
return `compensation-${compensation.status}`;
|
|
2825
|
+
return null;
|
|
2826
|
+
};
|
|
2827
|
+
var UpgradeProgressSchema = z42.strictObject({
|
|
2828
|
+
compensation: UpgradeCompensationProgressSchema.nullable(),
|
|
2829
|
+
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
2830
|
+
refund: UpgradeRefundProgressSchema.nullable(),
|
|
2831
|
+
review: UpgradeReviewProgressSchema.nullable()
|
|
2832
|
+
}).refine(
|
|
2833
|
+
({ compensation, refund }) => compensation === null || refund?.status === "failed",
|
|
2834
|
+
"Compensation follows a known refund failure only"
|
|
2835
|
+
).refine(
|
|
2836
|
+
({ compensation, refund, review }) => (review?.reason ?? null) === reviewReason(refund, compensation),
|
|
2837
|
+
"Review must match the unresolved outcome"
|
|
2838
|
+
);
|
|
2839
|
+
|
|
2750
2840
|
// src/schema/postPurchaseFollowups.ts
|
|
2751
|
-
var RequiredHealthSchema =
|
|
2841
|
+
var RequiredHealthSchema = z43.union([
|
|
2752
2842
|
HealthSchedulingResponseSchema.shape.data,
|
|
2753
|
-
|
|
2843
|
+
z43.strictObject({ status: z43.literal("unavailable") })
|
|
2754
2844
|
]);
|
|
2755
|
-
var AcceptedFollowupsResponseSchema =
|
|
2756
|
-
data:
|
|
2757
|
-
acceptedEvent:
|
|
2845
|
+
var AcceptedFollowupsResponseSchema = z43.object({
|
|
2846
|
+
data: z43.object({
|
|
2847
|
+
acceptedEvent: z43.union([
|
|
2758
2848
|
AcceptedEventResponseSchema.shape.data,
|
|
2759
|
-
|
|
2849
|
+
z43.strictObject({ status: z43.literal("unavailable") })
|
|
2760
2850
|
]),
|
|
2761
2851
|
acceptedMetafield: AcceptedMetafieldResultSchema,
|
|
2762
2852
|
health: RequiredHealthSchema,
|
|
2763
|
-
purchase: PurchaseObservationResponseSchema.shape.data
|
|
2853
|
+
purchase: PurchaseObservationResponseSchema.shape.data,
|
|
2854
|
+
/** Present only for an upgrade admission, and always for the same operation as `purchase`. */
|
|
2855
|
+
upgrade: UpgradeProgressSchema.optional()
|
|
2856
|
+
}).refine(({ purchase, upgrade }) => !upgrade || upgrade.operationId === purchase.operationId, {
|
|
2857
|
+
message: "Upgrade progress belongs to its operation",
|
|
2858
|
+
path: ["upgrade", "operationId"]
|
|
2764
2859
|
}),
|
|
2765
|
-
successful:
|
|
2860
|
+
successful: z43.literal(true)
|
|
2766
2861
|
});
|
|
2767
2862
|
|
|
2768
2863
|
// src/schema/postPurchaseSessionClose.ts
|
|
2769
|
-
import { z as
|
|
2770
|
-
var SessionClosureSchema =
|
|
2864
|
+
import { z as z44 } from "zod";
|
|
2865
|
+
var SessionClosureSchema = z44.object({ closedAt: PostPurchaseTimestampSchema, status: z44.literal("closed") });
|
|
2771
2866
|
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
2772
|
-
var SessionCloseResponseSchema =
|
|
2867
|
+
var SessionCloseResponseSchema = z44.object({ data: SessionClosureSchema, successful: z44.literal(true) });
|
|
2773
2868
|
|
|
2774
2869
|
// src/schema/postPurchaseFinish.ts
|
|
2775
|
-
var FinishedPurchaseSchema =
|
|
2776
|
-
|
|
2777
|
-
|
|
2870
|
+
var FinishedPurchaseSchema = z45.union([
|
|
2871
|
+
z45.strictObject({ status: z45.literal("none") }),
|
|
2872
|
+
z45.strictObject({
|
|
2778
2873
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
2779
|
-
status:
|
|
2780
|
-
|
|
2874
|
+
status: z45.union([
|
|
2875
|
+
z45.literal("pending"),
|
|
2781
2876
|
...PurchaseObservationSchema.options.map((option) => option.shape.status)
|
|
2782
2877
|
])
|
|
2783
2878
|
})
|
|
2784
2879
|
]);
|
|
2785
2880
|
var SessionFinishRequestSchema = DecideRequestSchema.strict();
|
|
2786
|
-
var SessionFinishResponseSchema =
|
|
2881
|
+
var SessionFinishResponseSchema = z45.object({
|
|
2787
2882
|
data: SessionClosureSchema.extend({
|
|
2788
2883
|
classification: ClassificationProgressSchema,
|
|
2789
2884
|
exitPolicy: ExitPolicySchema,
|
|
2790
2885
|
health: RequiredHealthSchema.nullable(),
|
|
2791
2886
|
purchase: FinishedPurchaseSchema
|
|
2792
2887
|
}),
|
|
2793
|
-
successful:
|
|
2888
|
+
successful: z45.literal(true)
|
|
2794
2889
|
});
|
|
2795
2890
|
|
|
2796
2891
|
// src/schema/postPurchaseQuantity.ts
|
|
2797
|
-
import { z as
|
|
2892
|
+
import { z as z69 } from "zod";
|
|
2798
2893
|
|
|
2799
2894
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
2800
|
-
import { z as
|
|
2895
|
+
import { z as z68 } from "zod";
|
|
2801
2896
|
|
|
2802
2897
|
// src/schema/postPurchaseProductView.ts
|
|
2803
|
-
import { z as
|
|
2898
|
+
import { z as z67 } from "zod";
|
|
2804
2899
|
|
|
2805
2900
|
// src/schema/postPurchaseGroupCatalog.ts
|
|
2806
|
-
import { z as
|
|
2901
|
+
import { z as z46 } from "zod";
|
|
2807
2902
|
var productId = PreparedPostPurchaseProduct.shape.selection.shape.productId;
|
|
2808
2903
|
var source = PostPurchaseProductSource.shape.data.element;
|
|
2809
2904
|
var PostPurchaseGroupDescription = source.pick({ description: true, id: true, image: true, images: true, title: true }).extend({
|
|
@@ -2811,17 +2906,17 @@ var PostPurchaseGroupDescription = source.pick({ description: true, id: true, im
|
|
|
2811
2906
|
image: source.shape.image.default(null),
|
|
2812
2907
|
options: PostPurchaseVariantCatalog.shape.options.default([])
|
|
2813
2908
|
});
|
|
2814
|
-
var PostPurchaseGroupCatalog =
|
|
2909
|
+
var PostPurchaseGroupCatalog = z46.object({
|
|
2815
2910
|
memberProductId: productId,
|
|
2816
|
-
options:
|
|
2911
|
+
options: z46.array(z46.object({ productId, title: z46.string(), variantCatalog: PostPurchaseVariantCatalog }))
|
|
2817
2912
|
});
|
|
2818
|
-
var PostPurchaseGroupSelection =
|
|
2913
|
+
var PostPurchaseGroupSelection = z46.object({
|
|
2819
2914
|
memberProductId: productId,
|
|
2820
2915
|
productId
|
|
2821
2916
|
});
|
|
2822
2917
|
|
|
2823
2918
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2824
|
-
import { z as
|
|
2919
|
+
import { z as z66 } from "zod";
|
|
2825
2920
|
|
|
2826
2921
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
2827
2922
|
import { uniqBy } from "es-toolkit";
|
|
@@ -2876,18 +2971,18 @@ var targetAreas = {
|
|
|
2876
2971
|
|
|
2877
2972
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
2878
2973
|
import { v7 as uuidv713 } from "uuid";
|
|
2879
|
-
import { z as
|
|
2974
|
+
import { z as z65 } from "zod";
|
|
2880
2975
|
|
|
2881
2976
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
2882
|
-
import { z as
|
|
2977
|
+
import { z as z64 } from "zod";
|
|
2883
2978
|
|
|
2884
2979
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
2885
|
-
import { z as
|
|
2886
|
-
var CABBannerSection =
|
|
2980
|
+
import { z as z47 } from "zod";
|
|
2981
|
+
var CABBannerSection = z47.lazy(
|
|
2887
2982
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2888
|
-
buttonField:
|
|
2889
|
-
color:
|
|
2890
|
-
dismissible:
|
|
2983
|
+
buttonField: z47.enum(buttonFields).optional(),
|
|
2984
|
+
color: z47.enum(bannerColors).default("info"),
|
|
2985
|
+
dismissible: z47.boolean().default(true),
|
|
2891
2986
|
/**
|
|
2892
2987
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
2893
2988
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -2903,18 +2998,18 @@ var CABBannerSection = z44.lazy(
|
|
|
2903
2998
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
2904
2999
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
2905
3000
|
*/
|
|
2906
|
-
heading:
|
|
2907
|
-
sectionType:
|
|
3001
|
+
heading: z47.record(z47.string(), z47.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
3002
|
+
sectionType: z47.literal(SectionType.banner).default(SectionType.banner)
|
|
2908
3003
|
})
|
|
2909
3004
|
);
|
|
2910
3005
|
|
|
2911
3006
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
2912
3007
|
import { v7 as uuidv73 } from "uuid";
|
|
2913
|
-
import { z as
|
|
3008
|
+
import { z as z50 } from "zod";
|
|
2914
3009
|
|
|
2915
3010
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
2916
3011
|
import { v7 as uuidv72 } from "uuid";
|
|
2917
|
-
import { z as
|
|
3012
|
+
import { z as z49 } from "zod";
|
|
2918
3013
|
|
|
2919
3014
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
2920
3015
|
var iconNames = [
|
|
@@ -3000,18 +3095,25 @@ var IconSize = freezeEnum(iconSizes);
|
|
|
3000
3095
|
var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "warning"];
|
|
3001
3096
|
var IconTone = freezeEnum(iconTones);
|
|
3002
3097
|
|
|
3098
|
+
// src/schema/widgets/checkout-and-beyond/imageThumbnails.ts
|
|
3099
|
+
import { z as z48 } from "zod";
|
|
3100
|
+
var CABImageThumbnails = z48.object({
|
|
3101
|
+
limit: z48.number().int().min(1).default(8),
|
|
3102
|
+
perLine: z48.number().int().min(1).max(8).default(4)
|
|
3103
|
+
});
|
|
3104
|
+
|
|
3003
3105
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
3004
|
-
var CABImageSectionFields =
|
|
3106
|
+
var CABImageSectionFields = z49.object({
|
|
3005
3107
|
...CABVariableFields,
|
|
3006
|
-
altText:
|
|
3108
|
+
altText: z49.string().refine(checkForHTML, NO_HTML).default(""),
|
|
3007
3109
|
/**
|
|
3008
3110
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
3009
3111
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
3010
3112
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
3011
3113
|
*/
|
|
3012
|
-
aspectRatio:
|
|
3013
|
-
border:
|
|
3014
|
-
buttonField:
|
|
3114
|
+
aspectRatio: z49.number().positive().nullable().default(null),
|
|
3115
|
+
border: z49.lazy(() => CABBorder),
|
|
3116
|
+
buttonField: z49.enum(buttonFields).optional(),
|
|
3015
3117
|
/**
|
|
3016
3118
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
3017
3119
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -3030,29 +3132,30 @@ var CABImageSectionFields = z45.object({
|
|
|
3030
3132
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
3031
3133
|
* the risky half.
|
|
3032
3134
|
*/
|
|
3033
|
-
category:
|
|
3135
|
+
category: z49.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
3034
3136
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
3035
|
-
iconSize:
|
|
3137
|
+
iconSize: z49.enum(iconSizes).nullable().default(null),
|
|
3036
3138
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
3037
|
-
iconTone:
|
|
3038
|
-
name:
|
|
3039
|
-
naturalHeight:
|
|
3040
|
-
naturalWidth:
|
|
3139
|
+
iconTone: z49.enum(iconTones).nullable().default(null),
|
|
3140
|
+
name: z49.string().optional(),
|
|
3141
|
+
naturalHeight: z49.number().default(0),
|
|
3142
|
+
naturalWidth: z49.number().default(0),
|
|
3041
3143
|
/**
|
|
3042
3144
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
3043
3145
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
3044
3146
|
*/
|
|
3045
|
-
objectFit:
|
|
3046
|
-
sectionId:
|
|
3047
|
-
sectionType:
|
|
3147
|
+
objectFit: z49.enum(objectFits).default(ObjectFit.contain),
|
|
3148
|
+
sectionId: z49.uuid().default(() => uuidv72()),
|
|
3149
|
+
sectionType: z49.literal(SectionType.image).default(SectionType.image),
|
|
3048
3150
|
/**
|
|
3049
3151
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
3050
3152
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
3051
3153
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
3052
3154
|
* server-chosen tier icon actually needs it.
|
|
3053
3155
|
*/
|
|
3054
|
-
source:
|
|
3055
|
-
|
|
3156
|
+
source: z49.union([z49.url(), z49.literal(""), z49.string().regex(DYNAMIC_TOKEN_REGEX), z49.enum(iconNames)]).default(""),
|
|
3157
|
+
thumbnails: CABImageThumbnails.optional(),
|
|
3158
|
+
width: z49.number().default(100)
|
|
3056
3159
|
});
|
|
3057
3160
|
var iconNameSet = new Set(iconNames);
|
|
3058
3161
|
var isIconName = (source2) => iconNameSet.has(source2);
|
|
@@ -3072,35 +3175,35 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source: sou
|
|
|
3072
3175
|
});
|
|
3073
3176
|
|
|
3074
3177
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
3075
|
-
var CABButtonContent =
|
|
3076
|
-
() =>
|
|
3178
|
+
var CABButtonContent = z50.lazy(
|
|
3179
|
+
() => z50.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
3077
3180
|
);
|
|
3078
|
-
var CABButtonSection =
|
|
3181
|
+
var CABButtonSection = z50.object({
|
|
3079
3182
|
...CABVariableFields,
|
|
3080
|
-
action:
|
|
3081
|
-
buttonStyle:
|
|
3082
|
-
custom:
|
|
3083
|
-
color:
|
|
3084
|
-
height:
|
|
3085
|
-
width:
|
|
3183
|
+
action: z50.union([z50.literal(""), z50.enum(buttonActions)]).default(""),
|
|
3184
|
+
buttonStyle: z50.enum(buttonStyles).default(ButtonStyle.primary),
|
|
3185
|
+
custom: z50.object({
|
|
3186
|
+
color: z50.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
3187
|
+
height: z50.number().default(52),
|
|
3188
|
+
width: z50.number().default(300)
|
|
3086
3189
|
}).default({
|
|
3087
3190
|
color: "#005bd3",
|
|
3088
3191
|
height: 52,
|
|
3089
3192
|
width: 300
|
|
3090
3193
|
}),
|
|
3091
|
-
disableDowngrade:
|
|
3092
|
-
name:
|
|
3093
|
-
optionId:
|
|
3094
|
-
popover:
|
|
3095
|
-
alignment:
|
|
3096
|
-
position:
|
|
3194
|
+
disableDowngrade: z50.boolean().default(false),
|
|
3195
|
+
name: z50.string().optional(),
|
|
3196
|
+
optionId: z50.number().optional(),
|
|
3197
|
+
popover: z50.object({
|
|
3198
|
+
alignment: z50.enum(textAlignments).default(TextAlignment.center),
|
|
3199
|
+
position: z50.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
3097
3200
|
}).optional().default(() => ({
|
|
3098
3201
|
alignment: TextAlignment.center,
|
|
3099
3202
|
position: PopoverPosition.blockStart
|
|
3100
3203
|
})),
|
|
3101
|
-
sectionId:
|
|
3102
|
-
sections:
|
|
3103
|
-
sectionType:
|
|
3204
|
+
sectionId: z50.uuid().default(() => uuidv73()),
|
|
3205
|
+
sections: z50.union([z50.array(CABButtonContent), z50.strictObject({}).transform(() => [])]).default(() => []),
|
|
3206
|
+
sectionType: z50.literal(SectionType.button).default(SectionType.button),
|
|
3104
3207
|
/**
|
|
3105
3208
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
3106
3209
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -3115,96 +3218,96 @@ var CABButtonSection = z46.object({
|
|
|
3115
3218
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
3116
3219
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
3117
3220
|
*/
|
|
3118
|
-
tier:
|
|
3221
|
+
tier: z50.object({ tierId: z50.string().min(1) }).optional(),
|
|
3119
3222
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
3120
|
-
trackingUrl:
|
|
3223
|
+
trackingUrl: z50.string().optional(),
|
|
3121
3224
|
/**
|
|
3122
3225
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
3123
3226
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
3124
3227
|
*/
|
|
3125
|
-
variableEffects:
|
|
3228
|
+
variableEffects: z50.array(CABVariableEffect).optional()
|
|
3126
3229
|
});
|
|
3127
3230
|
|
|
3128
3231
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3129
|
-
import { z as
|
|
3232
|
+
import { z as z55 } from "zod";
|
|
3130
3233
|
|
|
3131
3234
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3132
|
-
import { z as
|
|
3235
|
+
import { z as z54 } from "zod";
|
|
3133
3236
|
|
|
3134
3237
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
3135
3238
|
import { v7 as uuidv74 } from "uuid";
|
|
3136
|
-
import { z as
|
|
3137
|
-
var CABDiscount =
|
|
3138
|
-
amount:
|
|
3139
|
-
discountedBy:
|
|
3140
|
-
discountedFrom:
|
|
3141
|
-
type:
|
|
3142
|
-
});
|
|
3143
|
-
var CABIntegrations =
|
|
3144
|
-
judgeme:
|
|
3145
|
-
junip:
|
|
3146
|
-
klaviyo:
|
|
3147
|
-
loox:
|
|
3148
|
-
okendo:
|
|
3149
|
-
opinew:
|
|
3150
|
-
reviewsio:
|
|
3151
|
-
stamped:
|
|
3152
|
-
yotpo:
|
|
3153
|
-
});
|
|
3154
|
-
var CABVariantLabels =
|
|
3155
|
-
variantOption:
|
|
3156
|
-
variantOptions:
|
|
3157
|
-
});
|
|
3158
|
-
var CABDataSourceSection =
|
|
3159
|
-
dataSourceId:
|
|
3160
|
-
dataSourcePath:
|
|
3239
|
+
import { z as z51 } from "zod";
|
|
3240
|
+
var CABDiscount = z51.object({
|
|
3241
|
+
amount: z51.union([z51.number(), z51.string()]).catch(0),
|
|
3242
|
+
discountedBy: z51.string().optional(),
|
|
3243
|
+
discountedFrom: z51.enum(discountSources).optional().catch(void 0),
|
|
3244
|
+
type: z51.enum(discountTypes).catch("none")
|
|
3245
|
+
});
|
|
3246
|
+
var CABIntegrations = z51.object({
|
|
3247
|
+
judgeme: z51.boolean().default(false),
|
|
3248
|
+
junip: z51.boolean().default(false),
|
|
3249
|
+
klaviyo: z51.boolean().default(false),
|
|
3250
|
+
loox: z51.boolean().default(false),
|
|
3251
|
+
okendo: z51.boolean().default(false),
|
|
3252
|
+
opinew: z51.boolean().default(false),
|
|
3253
|
+
reviewsio: z51.boolean().default(false),
|
|
3254
|
+
stamped: z51.boolean().default(false),
|
|
3255
|
+
yotpo: z51.boolean().default(false)
|
|
3256
|
+
});
|
|
3257
|
+
var CABVariantLabels = z51.object({
|
|
3258
|
+
variantOption: z51.string().optional().catch(void 0),
|
|
3259
|
+
variantOptions: z51.string().optional().catch(void 0)
|
|
3260
|
+
});
|
|
3261
|
+
var CABDataSourceSection = z51.object({
|
|
3262
|
+
dataSourceId: z51.number().nullable().default(null),
|
|
3263
|
+
dataSourcePath: z51.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
3161
3264
|
discount: CABDiscount.optional(),
|
|
3162
3265
|
integrations: CABIntegrations.optional(),
|
|
3163
|
-
limit:
|
|
3164
|
-
matchVariant:
|
|
3165
|
-
matchVariantOutOfStock:
|
|
3166
|
-
name:
|
|
3167
|
-
productType:
|
|
3168
|
-
sectionId:
|
|
3169
|
-
sectionType:
|
|
3266
|
+
limit: z51.number().default(1),
|
|
3267
|
+
matchVariant: z51.boolean().default(false),
|
|
3268
|
+
matchVariantOutOfStock: z51.boolean().default(false),
|
|
3269
|
+
name: z51.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
3270
|
+
productType: z51.enum(productTypes).optional(),
|
|
3271
|
+
sectionId: z51.uuid().default(() => uuidv74()),
|
|
3272
|
+
sectionType: z51.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
3170
3273
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
3171
|
-
subscriptionIsDefault:
|
|
3172
|
-
treatAsGwp:
|
|
3274
|
+
subscriptionIsDefault: z51.boolean().default(false),
|
|
3275
|
+
treatAsGwp: z51.boolean().default(false),
|
|
3173
3276
|
variantLabels: CABVariantLabels.optional().catch(void 0)
|
|
3174
3277
|
});
|
|
3175
3278
|
|
|
3176
3279
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3177
3280
|
import { v7 as uuidv76 } from "uuid";
|
|
3178
|
-
import { z as
|
|
3281
|
+
import { z as z53 } from "zod";
|
|
3179
3282
|
|
|
3180
3283
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
3181
3284
|
import { v7 as uuidv75 } from "uuid";
|
|
3182
|
-
import { z as
|
|
3183
|
-
var CABVariantContent =
|
|
3184
|
-
() =>
|
|
3285
|
+
import { z as z52 } from "zod";
|
|
3286
|
+
var CABVariantContent = z52.lazy(
|
|
3287
|
+
() => z52.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
3185
3288
|
);
|
|
3186
|
-
var CABProductSection =
|
|
3289
|
+
var CABProductSection = z52.object({
|
|
3187
3290
|
...CABVariableFields,
|
|
3188
|
-
name:
|
|
3189
|
-
productId:
|
|
3190
|
-
sectionId:
|
|
3191
|
-
sections:
|
|
3192
|
-
sectionType:
|
|
3193
|
-
selectors:
|
|
3194
|
-
variantMode:
|
|
3291
|
+
name: z52.string().optional(),
|
|
3292
|
+
productId: z52.number().nullable().default(null),
|
|
3293
|
+
sectionId: z52.uuid().default(() => uuidv75()),
|
|
3294
|
+
sections: z52.union([z52.array(CABVariantContent), z52.strictObject({}).transform(() => [])]).default(() => []),
|
|
3295
|
+
sectionType: z52.literal(SectionType.product).default(SectionType.product),
|
|
3296
|
+
selectors: z52.record(z52.string(), z52.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
3297
|
+
variantMode: z52.enum(variantModes).default(VariantMode.multiple)
|
|
3195
3298
|
});
|
|
3196
3299
|
|
|
3197
3300
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3198
|
-
var CABProductsSection =
|
|
3301
|
+
var CABProductsSection = z53.object({
|
|
3199
3302
|
...CABVariableFields,
|
|
3200
|
-
name:
|
|
3201
|
-
sectionId:
|
|
3202
|
-
sections:
|
|
3203
|
-
sectionType:
|
|
3303
|
+
name: z53.string().optional(),
|
|
3304
|
+
sectionId: z53.uuid().default(() => uuidv76()),
|
|
3305
|
+
sections: z53.union([z53.array(z53.lazy(() => CABProductSection)), z53.strictObject({}).transform(() => [])]).default(() => []),
|
|
3306
|
+
sectionType: z53.literal(SectionType.products).default(SectionType.products)
|
|
3204
3307
|
});
|
|
3205
3308
|
|
|
3206
3309
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3207
|
-
var CABOffersSection =
|
|
3310
|
+
var CABOffersSection = z54.lazy(
|
|
3208
3311
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3209
3312
|
/**
|
|
3210
3313
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -3212,8 +3315,8 @@ var CABOffersSection = z50.lazy(
|
|
|
3212
3315
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
3213
3316
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
3214
3317
|
*/
|
|
3215
|
-
divider:
|
|
3216
|
-
sections:
|
|
3318
|
+
divider: z54.boolean().optional(),
|
|
3319
|
+
sections: z54.union([z54.array(z54.lazy(() => CABSection)), z54.strictObject({}).transform(() => [])]).default(() => [
|
|
3217
3320
|
CABBannerSection.parse({
|
|
3218
3321
|
buttonField: "undoAddToOrder",
|
|
3219
3322
|
color: "success",
|
|
@@ -3227,77 +3330,77 @@ var CABOffersSection = z50.lazy(
|
|
|
3227
3330
|
CABDataSourceSection.parse({}),
|
|
3228
3331
|
CABProductsSection.parse({})
|
|
3229
3332
|
]),
|
|
3230
|
-
sectionType:
|
|
3333
|
+
sectionType: z54.literal(SectionType.offers).default(SectionType.offers)
|
|
3231
3334
|
})
|
|
3232
3335
|
);
|
|
3233
3336
|
|
|
3234
3337
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3235
|
-
var CABCarouselSection =
|
|
3338
|
+
var CABCarouselSection = z55.lazy(
|
|
3236
3339
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3237
|
-
autoAdvanceInterval:
|
|
3238
|
-
itemsAtOnce:
|
|
3340
|
+
autoAdvanceInterval: z55.number().default(0),
|
|
3341
|
+
itemsAtOnce: z55.number().min(1).default(1),
|
|
3239
3342
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
3240
|
-
offersDirection:
|
|
3241
|
-
sections:
|
|
3242
|
-
sectionType:
|
|
3343
|
+
offersDirection: z55.enum(offersDirections).default("vertical"),
|
|
3344
|
+
sections: z55.union([z55.array(z55.lazy(() => CABSection)), z55.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
3345
|
+
sectionType: z55.literal(SectionType.carousel).default(SectionType.carousel)
|
|
3243
3346
|
})
|
|
3244
3347
|
);
|
|
3245
3348
|
|
|
3246
3349
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
3247
|
-
import { z as
|
|
3248
|
-
var CABCartLineSection =
|
|
3350
|
+
import { z as z56 } from "zod";
|
|
3351
|
+
var CABCartLineSection = z56.lazy(
|
|
3249
3352
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3250
|
-
sections:
|
|
3251
|
-
sectionType:
|
|
3353
|
+
sections: z56.union([z56.array(z56.lazy(() => CABSection)), z56.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
3354
|
+
sectionType: z56.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
3252
3355
|
})
|
|
3253
3356
|
);
|
|
3254
3357
|
|
|
3255
3358
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
3256
3359
|
import { v7 as uuidv77 } from "uuid";
|
|
3257
|
-
import { z as
|
|
3258
|
-
var CABDiscountSection =
|
|
3360
|
+
import { z as z57 } from "zod";
|
|
3361
|
+
var CABDiscountSection = z57.object({
|
|
3259
3362
|
...CABVariableFields,
|
|
3260
|
-
amount:
|
|
3261
|
-
discountedBy:
|
|
3262
|
-
discountedFrom:
|
|
3263
|
-
message:
|
|
3264
|
-
name:
|
|
3265
|
-
quantity:
|
|
3266
|
-
sectionId:
|
|
3267
|
-
sectionType:
|
|
3268
|
-
type:
|
|
3363
|
+
amount: z57.union([z57.number(), z57.string()]).catch(0),
|
|
3364
|
+
discountedBy: z57.string().optional(),
|
|
3365
|
+
discountedFrom: z57.enum(discountSources).optional().catch(void 0),
|
|
3366
|
+
message: z57.string().optional(),
|
|
3367
|
+
name: z57.string().optional(),
|
|
3368
|
+
quantity: z57.number().default(1),
|
|
3369
|
+
sectionId: z57.uuid().default(() => uuidv77()),
|
|
3370
|
+
sectionType: z57.literal(SectionType.discount).default(SectionType.discount),
|
|
3371
|
+
type: z57.enum(discountTypes).catch("none")
|
|
3269
3372
|
});
|
|
3270
3373
|
|
|
3271
3374
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
3272
3375
|
import { v7 as uuidv78 } from "uuid";
|
|
3273
|
-
import { z as
|
|
3274
|
-
var CABMonetizeAds =
|
|
3275
|
-
requestId:
|
|
3376
|
+
import { z as z58 } from "zod";
|
|
3377
|
+
var CABMonetizeAds = z58.object({
|
|
3378
|
+
requestId: z58.string().optional(),
|
|
3276
3379
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
3277
|
-
testing:
|
|
3380
|
+
testing: z58.boolean().default(false)
|
|
3278
3381
|
});
|
|
3279
|
-
var CABMonetizeSection =
|
|
3382
|
+
var CABMonetizeSection = z58.object({
|
|
3280
3383
|
...CABVariableFields,
|
|
3281
3384
|
ads: CABMonetizeAds.optional(),
|
|
3282
|
-
name:
|
|
3385
|
+
name: z58.string().optional(),
|
|
3283
3386
|
/**
|
|
3284
3387
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
3285
3388
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
3286
3389
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
3287
3390
|
*/
|
|
3288
|
-
offers:
|
|
3391
|
+
offers: z58.array(z58.lazy(() => CABSection)).optional(),
|
|
3289
3392
|
/** 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. */
|
|
3290
|
-
privacyPolicyUrl:
|
|
3291
|
-
sectionId:
|
|
3292
|
-
sectionType:
|
|
3393
|
+
privacyPolicyUrl: z58.string().optional(),
|
|
3394
|
+
sectionId: z58.uuid().default(() => uuidv78()),
|
|
3395
|
+
sectionType: z58.literal(SectionType.monetize).default(SectionType.monetize),
|
|
3293
3396
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
3294
|
-
subVertical:
|
|
3397
|
+
subVertical: z58.string().optional(),
|
|
3295
3398
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
3296
|
-
vertical:
|
|
3399
|
+
vertical: z58.string().optional()
|
|
3297
3400
|
});
|
|
3298
3401
|
|
|
3299
3402
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3300
|
-
import { z as
|
|
3403
|
+
import { z as z59 } from "zod";
|
|
3301
3404
|
|
|
3302
3405
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
3303
3406
|
var GIFT_LABELS = {
|
|
@@ -3416,34 +3519,34 @@ var GIFT_LABELS = {
|
|
|
3416
3519
|
};
|
|
3417
3520
|
|
|
3418
3521
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3419
|
-
var CABProgressTierExclusion =
|
|
3420
|
-
collectionIds:
|
|
3421
|
-
productIds:
|
|
3422
|
-
tags:
|
|
3423
|
-
type:
|
|
3522
|
+
var CABProgressTierExclusion = z59.object({
|
|
3523
|
+
collectionIds: z59.array(z59.number().int().positive()).default(() => []),
|
|
3524
|
+
productIds: z59.array(z59.number().int().positive()).default(() => []),
|
|
3525
|
+
tags: z59.array(z59.string().min(1)).default(() => []),
|
|
3526
|
+
type: z59.enum(progressTierExclusionTypes)
|
|
3424
3527
|
});
|
|
3425
|
-
var CABProgressTier =
|
|
3528
|
+
var CABProgressTier = z59.object({
|
|
3426
3529
|
/**
|
|
3427
3530
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
3428
3531
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
3429
3532
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
3430
3533
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
3431
3534
|
*/
|
|
3432
|
-
discount:
|
|
3535
|
+
discount: z59.object({ amount: z59.number().nonnegative(), type: z59.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
3433
3536
|
/**
|
|
3434
3537
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
3435
3538
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
3436
3539
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
3437
3540
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
3438
3541
|
*/
|
|
3439
|
-
exclusions:
|
|
3542
|
+
exclusions: z59.array(CABProgressTierExclusion).default(() => []),
|
|
3440
3543
|
/**
|
|
3441
3544
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
3442
3545
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
3443
3546
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
3444
3547
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
3445
3548
|
*/
|
|
3446
|
-
filterOosVariants:
|
|
3549
|
+
filterOosVariants: z59.boolean().default(false),
|
|
3447
3550
|
/**
|
|
3448
3551
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
3449
3552
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -3451,10 +3554,10 @@ var CABProgressTier = z55.object({
|
|
|
3451
3554
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
3452
3555
|
* tree is complete.
|
|
3453
3556
|
*/
|
|
3454
|
-
gift:
|
|
3455
|
-
productId:
|
|
3456
|
-
title:
|
|
3457
|
-
variantIds:
|
|
3557
|
+
gift: z59.object({
|
|
3558
|
+
productId: z59.number().int().positive(),
|
|
3559
|
+
title: z59.string().optional(),
|
|
3560
|
+
variantIds: z59.array(z59.number().int().positive()).default(() => [])
|
|
3458
3561
|
}).optional(),
|
|
3459
3562
|
/**
|
|
3460
3563
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -3474,7 +3577,7 @@ var CABProgressTier = z55.object({
|
|
|
3474
3577
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
3475
3578
|
* React's size rather than the old hardcoded 20.
|
|
3476
3579
|
*/
|
|
3477
|
-
iconSizePx:
|
|
3580
|
+
iconSizePx: z59.number().int().min(1).max(64).default(18),
|
|
3478
3581
|
/**
|
|
3479
3582
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
3480
3583
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -3484,35 +3587,35 @@ var CABProgressTier = z55.object({
|
|
|
3484
3587
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
3485
3588
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
3486
3589
|
*/
|
|
3487
|
-
label:
|
|
3590
|
+
label: z59.record(z59.string(), z59.string()).optional(),
|
|
3488
3591
|
/**
|
|
3489
3592
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
3490
3593
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
3491
3594
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
3492
3595
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
3493
3596
|
*/
|
|
3494
|
-
productTierImage:
|
|
3597
|
+
productTierImage: z59.boolean().default(false),
|
|
3495
3598
|
/**
|
|
3496
3599
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
3497
3600
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
3498
3601
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
3499
3602
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
3500
3603
|
*/
|
|
3501
|
-
threshold:
|
|
3604
|
+
threshold: z59.number().int().nonnegative(),
|
|
3502
3605
|
/**
|
|
3503
3606
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
3504
3607
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
3505
3608
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
3506
3609
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
3507
3610
|
*/
|
|
3508
|
-
thresholds:
|
|
3611
|
+
thresholds: z59.record(z59.string(), z59.number().int().nonnegative()).default(() => ({})),
|
|
3509
3612
|
/**
|
|
3510
3613
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
3511
3614
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
3512
3615
|
* shipping bar (single unlabeled tier, no gift).
|
|
3513
3616
|
*/
|
|
3514
|
-
tierId:
|
|
3515
|
-
tierType:
|
|
3617
|
+
tierId: z59.string().optional(),
|
|
3618
|
+
tierType: z59.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
3516
3619
|
/**
|
|
3517
3620
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
3518
3621
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -3523,9 +3626,9 @@ var CABProgressTier = z55.object({
|
|
|
3523
3626
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
3524
3627
|
* template text supplies grammatically-neutral wording around the token.
|
|
3525
3628
|
*/
|
|
3526
|
-
unit:
|
|
3629
|
+
unit: z59.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
3527
3630
|
});
|
|
3528
|
-
var CABProgressBarSection =
|
|
3631
|
+
var CABProgressBarSection = z59.lazy(
|
|
3529
3632
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3530
3633
|
/**
|
|
3531
3634
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -3534,35 +3637,35 @@ var CABProgressBarSection = z55.lazy(
|
|
|
3534
3637
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
3535
3638
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
3536
3639
|
*/
|
|
3537
|
-
barId:
|
|
3640
|
+
barId: z59.string().optional(),
|
|
3538
3641
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
3539
|
-
countryCodes:
|
|
3642
|
+
countryCodes: z59.array(z59.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3540
3643
|
/**
|
|
3541
3644
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
3542
3645
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
3543
3646
|
*/
|
|
3544
|
-
excludeCountryCodes:
|
|
3647
|
+
excludeCountryCodes: z59.array(z59.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3545
3648
|
/**
|
|
3546
3649
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
3547
3650
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
3548
3651
|
* adds the cart's discount allocations back to the live subtotal.
|
|
3549
3652
|
*/
|
|
3550
|
-
excludeDiscountInSubtotal:
|
|
3653
|
+
excludeDiscountInSubtotal: z59.boolean().default(false),
|
|
3551
3654
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
3552
|
-
excludedVariantIds:
|
|
3655
|
+
excludedVariantIds: z59.array(z59.number().int().positive()).default(() => []),
|
|
3553
3656
|
/**
|
|
3554
3657
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
3555
3658
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
3556
3659
|
*/
|
|
3557
|
-
freeShippingOnSubscription:
|
|
3660
|
+
freeShippingOnSubscription: z59.boolean().default(false),
|
|
3558
3661
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
3559
|
-
giftAreaTitle:
|
|
3662
|
+
giftAreaTitle: z59.record(z59.string(), z59.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
3560
3663
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
3561
|
-
giftLabels:
|
|
3562
|
-
addGift:
|
|
3563
|
-
remove:
|
|
3564
|
-
selectOptions:
|
|
3565
|
-
yourGift:
|
|
3664
|
+
giftLabels: z59.object({
|
|
3665
|
+
addGift: z59.record(z59.string(), z59.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
3666
|
+
remove: z59.record(z59.string(), z59.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
3667
|
+
selectOptions: z59.record(z59.string(), z59.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
3668
|
+
yourGift: z59.record(z59.string(), z59.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
3566
3669
|
}).default(() => ({
|
|
3567
3670
|
addGift: { ...GIFT_LABELS.addGift },
|
|
3568
3671
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -3570,38 +3673,38 @@ var CABProgressBarSection = z55.lazy(
|
|
|
3570
3673
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
3571
3674
|
})),
|
|
3572
3675
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
3573
|
-
name:
|
|
3676
|
+
name: z59.string().default("Order progress"),
|
|
3574
3677
|
/**
|
|
3575
3678
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
3576
3679
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
3577
3680
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
3578
3681
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
3579
3682
|
*/
|
|
3580
|
-
progressColor:
|
|
3581
|
-
sectionType:
|
|
3683
|
+
progressColor: z59.string().optional(),
|
|
3684
|
+
sectionType: z59.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
3582
3685
|
/**
|
|
3583
3686
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
3584
3687
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
3585
3688
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
3586
3689
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
3587
3690
|
*/
|
|
3588
|
-
tiers:
|
|
3691
|
+
tiers: z59.union([z59.array(CABProgressTier), z59.strictObject({}).transform(() => [])]).default(() => [])
|
|
3589
3692
|
})
|
|
3590
3693
|
);
|
|
3591
3694
|
|
|
3592
3695
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
3593
3696
|
import { v7 as uuidv79 } from "uuid";
|
|
3594
|
-
import { z as
|
|
3595
|
-
var CABQuantitySection =
|
|
3697
|
+
import { z as z60 } from "zod";
|
|
3698
|
+
var CABQuantitySection = z60.object({
|
|
3596
3699
|
...CABVariableFields,
|
|
3597
|
-
errorMessages:
|
|
3598
|
-
|
|
3599
|
-
|
|
3700
|
+
errorMessages: z60.record(
|
|
3701
|
+
z60.string(),
|
|
3702
|
+
z60.object({
|
|
3600
3703
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
3601
|
-
increment:
|
|
3602
|
-
max:
|
|
3603
|
-
min:
|
|
3604
|
-
neg:
|
|
3704
|
+
increment: z60.string().optional(),
|
|
3705
|
+
max: z60.string().optional(),
|
|
3706
|
+
min: z60.string().optional(),
|
|
3707
|
+
neg: z60.string().optional()
|
|
3605
3708
|
})
|
|
3606
3709
|
).default({
|
|
3607
3710
|
en: {
|
|
@@ -3611,18 +3714,18 @@ var CABQuantitySection = z56.object({
|
|
|
3611
3714
|
neg: "Quantity cannot be negative"
|
|
3612
3715
|
}
|
|
3613
3716
|
}),
|
|
3614
|
-
inputType:
|
|
3615
|
-
max:
|
|
3616
|
-
min:
|
|
3717
|
+
inputType: z60.enum(quantityInputs).default(QuantityInput.select),
|
|
3718
|
+
max: z60.number().min(1).max(100).default(10),
|
|
3719
|
+
min: z60.number().min(1).default(1),
|
|
3617
3720
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
3618
|
-
name:
|
|
3619
|
-
sectionId:
|
|
3620
|
-
sectionType:
|
|
3721
|
+
name: z60.string().default("Quantity"),
|
|
3722
|
+
sectionId: z60.uuid().default(() => uuidv79()),
|
|
3723
|
+
sectionType: z60.literal(SectionType.quantity).default(SectionType.quantity)
|
|
3621
3724
|
});
|
|
3622
3725
|
|
|
3623
3726
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3624
3727
|
import { v7 as uuidv710 } from "uuid";
|
|
3625
|
-
import { z as
|
|
3728
|
+
import { z as z61 } from "zod";
|
|
3626
3729
|
|
|
3627
3730
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
3628
3731
|
var REVIEW_LABELS = {
|
|
@@ -3685,68 +3788,69 @@ var REVIEW_LABELS = {
|
|
|
3685
3788
|
};
|
|
3686
3789
|
|
|
3687
3790
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3688
|
-
var CABReviewsSection =
|
|
3791
|
+
var CABReviewsSection = z61.object({
|
|
3689
3792
|
...CABVariableFields,
|
|
3690
|
-
color:
|
|
3793
|
+
color: z61.string().default("#fadb14"),
|
|
3691
3794
|
/**
|
|
3692
3795
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
3693
3796
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
3694
3797
|
* or merchant work.
|
|
3695
3798
|
*/
|
|
3696
|
-
countLabels:
|
|
3697
|
-
one:
|
|
3698
|
-
other:
|
|
3799
|
+
countLabels: z61.object({
|
|
3800
|
+
one: z61.record(z61.string(), z61.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
3801
|
+
other: z61.record(z61.string(), z61.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
3699
3802
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
3700
|
-
name:
|
|
3701
|
-
sectionId:
|
|
3702
|
-
sectionType:
|
|
3703
|
-
size:
|
|
3803
|
+
name: z61.string().optional(),
|
|
3804
|
+
sectionId: z61.uuid().default(() => uuidv710()),
|
|
3805
|
+
sectionType: z61.literal(SectionType.reviews).default(SectionType.reviews),
|
|
3806
|
+
size: z61.enum(reviewsSizes).default(ReviewsSize.default),
|
|
3704
3807
|
/**
|
|
3705
3808
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
3706
3809
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
3707
3810
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
3708
3811
|
* the whole reviews section.
|
|
3709
3812
|
*/
|
|
3710
|
-
strokeColor:
|
|
3813
|
+
strokeColor: z61.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
3711
3814
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
3712
|
-
strokeWidth:
|
|
3815
|
+
strokeWidth: z61.number().nonnegative().default(0)
|
|
3713
3816
|
});
|
|
3714
3817
|
|
|
3715
3818
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
3716
3819
|
import { v7 as uuidv711 } from "uuid";
|
|
3717
|
-
import { z as
|
|
3718
|
-
var CABSeparatorSection =
|
|
3820
|
+
import { z as z62 } from "zod";
|
|
3821
|
+
var CABSeparatorSection = z62.object({
|
|
3719
3822
|
...CABVariableFields,
|
|
3720
|
-
sectionId:
|
|
3721
|
-
sectionType:
|
|
3823
|
+
sectionId: z62.uuid().default(() => uuidv711()),
|
|
3824
|
+
sectionType: z62.literal(SectionType.separator).default(SectionType.separator)
|
|
3722
3825
|
});
|
|
3723
3826
|
|
|
3724
3827
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
3725
3828
|
import { slice } from "es-toolkit/compat";
|
|
3726
3829
|
import { v7 as uuidv712 } from "uuid";
|
|
3727
|
-
import { z as
|
|
3728
|
-
var CABVariantsSection =
|
|
3830
|
+
import { z as z63 } from "zod";
|
|
3831
|
+
var CABVariantsSection = z63.object({
|
|
3729
3832
|
...CABVariableFields,
|
|
3730
|
-
hideOutOfStockVariants:
|
|
3731
|
-
name:
|
|
3732
|
-
sectionId:
|
|
3733
|
-
sectionType:
|
|
3734
|
-
selector:
|
|
3735
|
-
|
|
3833
|
+
hideOutOfStockVariants: z63.boolean().default(false),
|
|
3834
|
+
name: z63.string().optional(),
|
|
3835
|
+
sectionId: z63.uuid().default(() => uuidv712()),
|
|
3836
|
+
sectionType: z63.literal(SectionType.variants).default(SectionType.variants),
|
|
3837
|
+
selector: z63.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
3838
|
+
/** `productGroup` is additive (REB-24817): a renderer without group support must render nothing for it. */
|
|
3839
|
+
variantMode: z63.enum(variantsModes).default(VariantsMode.multiple)
|
|
3736
3840
|
});
|
|
3737
3841
|
|
|
3738
3842
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3739
|
-
var CABBorder =
|
|
3740
|
-
radius:
|
|
3741
|
-
style:
|
|
3742
|
-
width:
|
|
3843
|
+
var CABBorder = z64.object({
|
|
3844
|
+
radius: z64.enum(borderRadii).default(BorderRadius.base),
|
|
3845
|
+
style: z64.enum(borderStyles).default(BorderStyle.none),
|
|
3846
|
+
width: z64.enum(borderWidths).default(BorderWidth.base)
|
|
3743
3847
|
}).default({
|
|
3744
3848
|
radius: BorderRadius.base,
|
|
3745
3849
|
style: BorderStyle.none,
|
|
3746
3850
|
width: BorderWidth.base
|
|
3747
3851
|
});
|
|
3748
|
-
var CABSection =
|
|
3749
|
-
() =>
|
|
3852
|
+
var CABSection = z64.lazy(
|
|
3853
|
+
() => z64.discriminatedUnion("sectionType", [
|
|
3750
3854
|
CABBannerSection,
|
|
3751
3855
|
CABButtonSection,
|
|
3752
3856
|
CABCarouselSection,
|
|
@@ -3769,41 +3873,41 @@ var CABSection = z60.lazy(
|
|
|
3769
3873
|
);
|
|
3770
3874
|
|
|
3771
3875
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
3772
|
-
var GridItem =
|
|
3773
|
-
var CABLayoutWrapping =
|
|
3774
|
-
breakAt:
|
|
3775
|
-
maxPerLine:
|
|
3876
|
+
var GridItem = z65.union([z65.literal("auto"), z65.literal("fill"), z65.string().regex(/^\d+%$/), z65.number()]);
|
|
3877
|
+
var CABLayoutWrapping = z65.object({
|
|
3878
|
+
breakAt: z65.number().positive(),
|
|
3879
|
+
maxPerLine: z65.number().int().positive()
|
|
3776
3880
|
});
|
|
3777
|
-
var CABLayoutSection =
|
|
3881
|
+
var CABLayoutSection = z65.object({
|
|
3778
3882
|
...CABVariableFields,
|
|
3779
|
-
alignment:
|
|
3780
|
-
horizontal:
|
|
3781
|
-
vertical:
|
|
3883
|
+
alignment: z65.object({
|
|
3884
|
+
horizontal: z65.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
3885
|
+
vertical: z65.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
3782
3886
|
}).default({
|
|
3783
3887
|
horizontal: HorizontalAlignment.start,
|
|
3784
3888
|
vertical: VerticalAlignment.top
|
|
3785
3889
|
}),
|
|
3786
|
-
border:
|
|
3787
|
-
buttonField:
|
|
3788
|
-
direction:
|
|
3890
|
+
border: z65.lazy(() => CABBorder),
|
|
3891
|
+
buttonField: z65.enum(buttonFields).optional(),
|
|
3892
|
+
direction: z65.enum(directions).default(Direction.rows),
|
|
3789
3893
|
/**
|
|
3790
3894
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
3791
3895
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
3792
3896
|
*/
|
|
3793
|
-
frame:
|
|
3794
|
-
grid:
|
|
3795
|
-
columns:
|
|
3796
|
-
rows:
|
|
3897
|
+
frame: z65.enum(layoutFrames).optional(),
|
|
3898
|
+
grid: z65.object({
|
|
3899
|
+
columns: z65.union([z65.array(GridItem), z65.undefined()]).default(() => ["auto"]),
|
|
3900
|
+
rows: z65.union([z65.array(GridItem), z65.undefined()]).default(() => ["auto"])
|
|
3797
3901
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
3798
|
-
name:
|
|
3799
|
-
padding:
|
|
3800
|
-
sectionId:
|
|
3801
|
-
sections:
|
|
3802
|
-
sectionType:
|
|
3803
|
-
spacing:
|
|
3902
|
+
name: z65.string().optional(),
|
|
3903
|
+
padding: z65.enum(spacings).default(Spacing.none),
|
|
3904
|
+
sectionId: z65.uuid().default(() => uuidv713()),
|
|
3905
|
+
sections: z65.union([z65.array(z65.lazy(() => CABSection)), z65.strictObject({}).transform(() => [])]).default(() => []),
|
|
3906
|
+
sectionType: z65.literal(SectionType.layout).default(SectionType.layout),
|
|
3907
|
+
spacing: z65.enum(spacings).default(Spacing.base),
|
|
3804
3908
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
3805
|
-
viewUrl:
|
|
3806
|
-
width:
|
|
3909
|
+
viewUrl: z65.string().optional(),
|
|
3910
|
+
width: z65.number().default(100),
|
|
3807
3911
|
wrapping: CABLayoutWrapping.optional()
|
|
3808
3912
|
});
|
|
3809
3913
|
|
|
@@ -3825,8 +3929,8 @@ var UI_LABELS = {
|
|
|
3825
3929
|
};
|
|
3826
3930
|
|
|
3827
3931
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
3828
|
-
var localized = (fallback) =>
|
|
3829
|
-
var CABUILabels =
|
|
3932
|
+
var localized = (fallback) => z66.record(z66.string(), z66.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
3933
|
+
var CABUILabels = z66.object({
|
|
3830
3934
|
currentPage: localized(UI_LABELS.currentPage),
|
|
3831
3935
|
guest: localized(UI_LABELS.guest),
|
|
3832
3936
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -3851,47 +3955,49 @@ var CABUILabels = z62.object({
|
|
|
3851
3955
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
3852
3956
|
updating: { ...UI_LABELS.updating }
|
|
3853
3957
|
}));
|
|
3854
|
-
var TargetArea =
|
|
3855
|
-
fill:
|
|
3856
|
-
flip:
|
|
3857
|
-
icon:
|
|
3858
|
-
label:
|
|
3859
|
-
width:
|
|
3958
|
+
var TargetArea = z66.object({
|
|
3959
|
+
fill: z66.boolean().optional(),
|
|
3960
|
+
flip: z66.enum(["both", "horizontal", "vertical"]).optional(),
|
|
3961
|
+
icon: z66.string(),
|
|
3962
|
+
label: z66.string(),
|
|
3963
|
+
width: z66.string()
|
|
3860
3964
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
3861
|
-
var CABTracking =
|
|
3862
|
-
enableAttribution:
|
|
3863
|
-
enableSource:
|
|
3864
|
-
enableWidget:
|
|
3965
|
+
var CABTracking = z66.object({
|
|
3966
|
+
enableAttribution: z66.boolean().nullish().transform((value) => value ?? true),
|
|
3967
|
+
enableSource: z66.boolean().nullish().transform((value) => value ?? true),
|
|
3968
|
+
enableWidget: z66.boolean().nullish().transform((value) => value ?? true)
|
|
3865
3969
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
3866
|
-
var CABExperiment =
|
|
3867
|
-
elementId:
|
|
3868
|
-
experimentId:
|
|
3869
|
-
experimentType:
|
|
3870
|
-
selectedId:
|
|
3970
|
+
var CABExperiment = z66.object({
|
|
3971
|
+
elementId: z66.number(),
|
|
3972
|
+
experimentId: z66.number(),
|
|
3973
|
+
experimentType: z66.string(),
|
|
3974
|
+
selectedId: z66.number()
|
|
3871
3975
|
});
|
|
3872
3976
|
var CABRootSection = CABLayoutSection.extend({
|
|
3873
|
-
editorMode:
|
|
3977
|
+
editorMode: z66.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
3874
3978
|
experiment: CABExperiment.optional(),
|
|
3875
3979
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
3876
3980
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
3877
|
-
previewMode:
|
|
3878
|
-
storeId:
|
|
3981
|
+
previewMode: z66.boolean().nullish().transform((value) => value ?? false),
|
|
3982
|
+
storeId: z66.number().nullable().default(null),
|
|
3879
3983
|
targetArea: TargetArea.nullable(),
|
|
3880
3984
|
tracking: CABTracking,
|
|
3881
|
-
type:
|
|
3985
|
+
type: z66.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
3882
3986
|
uiLabels: CABUILabels,
|
|
3883
|
-
version:
|
|
3884
|
-
widgetId:
|
|
3987
|
+
version: z66.literal(2).default(2),
|
|
3988
|
+
widgetId: z66.number().nullable().default(null)
|
|
3885
3989
|
});
|
|
3886
3990
|
|
|
3887
3991
|
// src/schema/postPurchaseProductView.ts
|
|
3888
|
-
var PostPurchaseProductView =
|
|
3889
|
-
|
|
3992
|
+
var PostPurchaseProductView = z67.union([
|
|
3993
|
+
z67.object({
|
|
3994
|
+
changeset: PostPurchaseProductChangeset.optional(),
|
|
3995
|
+
displayPrice: PostPurchaseDisplayPrice.optional(),
|
|
3890
3996
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
3891
3997
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
3892
3998
|
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
3893
3999
|
preparation: PreparedPostPurchaseProduct.extend({
|
|
3894
|
-
display: PreparedPostPurchaseProduct.shape.display.extend({ description:
|
|
4000
|
+
display: PreparedPostPurchaseProduct.shape.display.extend({ description: z67.string().nullable() }).refine(
|
|
3895
4001
|
({ description, descriptionDocument }) => description === null === (descriptionDocument !== void 0),
|
|
3896
4002
|
"Exactly one of the plain and rich descriptions is shown"
|
|
3897
4003
|
)
|
|
@@ -3900,33 +4006,35 @@ var PostPurchaseProductView = z63.union([
|
|
|
3900
4006
|
sections: CABRootSection,
|
|
3901
4007
|
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
3902
4008
|
}),
|
|
3903
|
-
|
|
4009
|
+
z67.object({
|
|
3904
4010
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
3905
4011
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
4012
|
+
/** The localized unavailable copy, for the choices still offered beneath an unprepared product. */
|
|
4013
|
+
labels: PreparedPostPurchaseProduct.shape.labels.pick({ notAvailable: true }).optional(),
|
|
3906
4014
|
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
3907
4015
|
preparation: PostPurchasePreparation.options[1],
|
|
3908
4016
|
purchaseOptions: PostPurchaseOptions.optional(),
|
|
3909
|
-
sections:
|
|
4017
|
+
sections: z67.null(),
|
|
3910
4018
|
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
3911
4019
|
})
|
|
3912
4020
|
]);
|
|
3913
4021
|
|
|
3914
4022
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
3915
|
-
var PostPurchaseProductCollectionView =
|
|
3916
|
-
members:
|
|
3917
|
-
|
|
4023
|
+
var PostPurchaseProductCollectionView = z68.object({
|
|
4024
|
+
members: z68.array(
|
|
4025
|
+
z68.object({
|
|
3918
4026
|
productId: PostPurchaseProductId,
|
|
3919
|
-
productIndex:
|
|
4027
|
+
productIndex: z68.number().int().nonnegative(),
|
|
3920
4028
|
view: PostPurchaseProductView
|
|
3921
4029
|
})
|
|
3922
4030
|
)
|
|
3923
4031
|
});
|
|
3924
|
-
var PostPurchaseCollectionChoice =
|
|
4032
|
+
var PostPurchaseCollectionChoice = z68.object({
|
|
3925
4033
|
choice: PostPurchaseChoice.optional(),
|
|
3926
4034
|
productId: PostPurchaseProductId,
|
|
3927
4035
|
variantId: PostPurchaseVariantSelector.shape.variantId.optional()
|
|
3928
4036
|
}).strict();
|
|
3929
|
-
var PostPurchaseExcludedProductIds =
|
|
4037
|
+
var PostPurchaseExcludedProductIds = z68.array(PostPurchaseProductId).default([]);
|
|
3930
4038
|
var PostPurchaseMemberSelector = PostPurchaseProgressSchema.shape.members.element.pick({ productId: true }).extend({ progressRevision: PostPurchaseProgressSchema.shape.revision });
|
|
3931
4039
|
var PostPurchaseMemberPointer = PostPurchaseProgressSchema.shape.members.element.omit({ status: true }).extend({
|
|
3932
4040
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
@@ -3939,7 +4047,7 @@ var PostPurchaseQuantityChoice = PostPurchaseCollectionChoice.extend({ quantity:
|
|
|
3939
4047
|
var PostPurchaseQuantityPolicy = PostPurchaseSettings.shape.quantityInputs.omit({ defaultQuantity: true }).extend({
|
|
3940
4048
|
initialQuantity: quantity,
|
|
3941
4049
|
maxValue: quantity,
|
|
3942
|
-
minValue:
|
|
4050
|
+
minValue: z69.literal(0).transform(() => 1).or(quantity)
|
|
3943
4051
|
}).refine(({ maxValue, minValue }) => minValue <= maxValue, "Quantity bounds are reversed");
|
|
3944
4052
|
|
|
3945
4053
|
// src/schema/postPurchaseGroup.ts
|
|
@@ -3948,33 +4056,33 @@ var PostPurchaseGroupChoice = PostPurchaseQuantityChoice.extend({
|
|
|
3948
4056
|
});
|
|
3949
4057
|
|
|
3950
4058
|
// src/schema/postPurchaseHealth.ts
|
|
3951
|
-
import { z as
|
|
4059
|
+
import { z as z72 } from "zod";
|
|
3952
4060
|
|
|
3953
4061
|
// src/schema/postPurchaseHealthSchedule.ts
|
|
3954
|
-
import { z as
|
|
4062
|
+
import { z as z71 } from "zod";
|
|
3955
4063
|
|
|
3956
4064
|
// src/schema/postPurchaseReleaseSchedule.ts
|
|
3957
|
-
import { z as
|
|
3958
|
-
var postPurchaseTaskNameSchema = (queue, id) =>
|
|
3959
|
-
var SessionReleaseScheduleRequestSchema =
|
|
4065
|
+
import { z as z70 } from "zod";
|
|
4066
|
+
var postPurchaseTaskNameSchema = (queue, id) => z70.string().regex(new RegExp(`^projects/[a-zA-Z0-9.:-]+/locations/us-central1/queues/${queue}/tasks/${id}$`));
|
|
4067
|
+
var SessionReleaseScheduleRequestSchema = z70.strictObject({
|
|
3960
4068
|
deadline: PostPurchaseTimestampSchema,
|
|
3961
4069
|
orderId: PostPurchaseOrderIdSchema,
|
|
3962
4070
|
releaseOwner: ReleaseOwnerSchema,
|
|
3963
4071
|
sessionId: PostPurchaseSessionIdSchema
|
|
3964
4072
|
});
|
|
3965
|
-
var SessionReleaseScheduleResponseSchema =
|
|
3966
|
-
data:
|
|
4073
|
+
var SessionReleaseScheduleResponseSchema = z70.object({
|
|
4074
|
+
data: z70.discriminatedUnion("status", [
|
|
3967
4075
|
SessionReleaseScheduleRequestSchema.extend({
|
|
3968
|
-
releaseOwner:
|
|
3969
|
-
status:
|
|
4076
|
+
releaseOwner: z70.literal("rebuy"),
|
|
4077
|
+
status: z70.literal("queued"),
|
|
3970
4078
|
taskName: postPurchaseTaskNameSchema("post-purchase-order-hold-release", "[a-f0-9]{64}-release")
|
|
3971
4079
|
}),
|
|
3972
4080
|
SessionReleaseScheduleRequestSchema.extend({
|
|
3973
|
-
releaseOwner:
|
|
3974
|
-
status:
|
|
4081
|
+
releaseOwner: z70.literal("shopify"),
|
|
4082
|
+
status: z70.literal("native")
|
|
3975
4083
|
})
|
|
3976
4084
|
]),
|
|
3977
|
-
successful:
|
|
4085
|
+
successful: z70.literal(true)
|
|
3978
4086
|
});
|
|
3979
4087
|
|
|
3980
4088
|
// src/schema/postPurchaseHealthSchedule.ts
|
|
@@ -3983,15 +4091,15 @@ var PostPurchaseHealthTaskNameSchema = postPurchaseTaskNameSchema(
|
|
|
3983
4091
|
"post-purchase-health-check",
|
|
3984
4092
|
"[a-z0-9][a-z0-9-]*--[1-9][0-9]*"
|
|
3985
4093
|
);
|
|
3986
|
-
var HealthScheduleAcknowledgementSchema =
|
|
4094
|
+
var HealthScheduleAcknowledgementSchema = z71.strictObject({
|
|
3987
4095
|
data: HealthScheduleSchema.extend({
|
|
3988
|
-
status:
|
|
4096
|
+
status: z71.literal("queued"),
|
|
3989
4097
|
taskName: PostPurchaseHealthTaskNameSchema
|
|
3990
4098
|
}).refine(
|
|
3991
4099
|
(data) => data.taskName.endsWith(`/tasks/${postPurchaseHealthTaskId(data)}`),
|
|
3992
4100
|
"taskName must be this order's health task"
|
|
3993
4101
|
),
|
|
3994
|
-
successful:
|
|
4102
|
+
successful: z71.literal(true)
|
|
3995
4103
|
});
|
|
3996
4104
|
|
|
3997
4105
|
// src/schema/postPurchaseHealth.ts
|
|
@@ -4000,90 +4108,93 @@ var HealthFactSchema = HealthScheduleSchema.pick({
|
|
|
4000
4108
|
operationId: true,
|
|
4001
4109
|
removePartialOrder: true
|
|
4002
4110
|
});
|
|
4003
|
-
var HealthScheduleReceiptSchema =
|
|
4111
|
+
var HealthScheduleReceiptSchema = z72.strictObject({
|
|
4004
4112
|
recordedAt: PostPurchaseTimestampSchema,
|
|
4005
4113
|
taskName: PostPurchaseHealthTaskNameSchema
|
|
4006
4114
|
});
|
|
4007
|
-
var StoredHealthFactSchema = HealthFactSchema.extend({
|
|
4115
|
+
var StoredHealthFactSchema = HealthFactSchema.extend({
|
|
4116
|
+
checkoutToken: HealthScheduleSchema.shape.checkoutToken.optional(),
|
|
4117
|
+
scheduleReceipt: HealthScheduleReceiptSchema.optional()
|
|
4118
|
+
});
|
|
4008
4119
|
var HealthAttemptSchema = StoredHealthFactSchema.extend({
|
|
4009
4120
|
attemptedAt: PostPurchaseTimestampSchema,
|
|
4010
|
-
attemptId:
|
|
4011
|
-
status:
|
|
4121
|
+
attemptId: z72.uuid(),
|
|
4122
|
+
status: z72.literal("attempted")
|
|
4012
4123
|
});
|
|
4013
4124
|
var HealthResultSchema = HealthAttemptSchema.extend({
|
|
4014
4125
|
finishedAt: PostPurchaseTimestampSchema,
|
|
4015
|
-
status:
|
|
4126
|
+
status: z72.enum(["returned", "unknown"])
|
|
4016
4127
|
});
|
|
4017
|
-
var HealthStateSchema =
|
|
4018
|
-
StoredHealthFactSchema.extend({ status:
|
|
4128
|
+
var HealthStateSchema = z72.union([
|
|
4129
|
+
StoredHealthFactSchema.extend({ status: z72.literal("pending") }),
|
|
4019
4130
|
HealthAttemptSchema,
|
|
4020
4131
|
HealthResultSchema
|
|
4021
4132
|
]);
|
|
4022
4133
|
var HealthPrepareRequestSchema = DecideRequestSchema.extend({
|
|
4023
4134
|
operationId: HealthScheduleSchema.shape.operationId
|
|
4024
4135
|
}).strict();
|
|
4025
|
-
var HealthPrepareResponseSchema =
|
|
4026
|
-
var HealthClaimRequestSchema =
|
|
4136
|
+
var HealthPrepareResponseSchema = z72.object({ data: HealthScheduleSchema, successful: z72.literal(true) });
|
|
4137
|
+
var HealthClaimRequestSchema = z72.strictObject({
|
|
4027
4138
|
orderId: PostPurchaseOrderIdSchema,
|
|
4028
|
-
removePartialOrder:
|
|
4139
|
+
removePartialOrder: z72.boolean(),
|
|
4029
4140
|
shop: ShopifyDomainSchema
|
|
4030
4141
|
});
|
|
4031
4142
|
var HealthClaimFactSchema = HealthClaimRequestSchema.extend({
|
|
4032
4143
|
healthScheduledAt: HealthFactSchema.shape.healthScheduledAt
|
|
4033
4144
|
});
|
|
4034
|
-
var HealthClaimResponseSchema =
|
|
4035
|
-
data:
|
|
4036
|
-
|
|
4037
|
-
HealthClaimFactSchema.extend({ status:
|
|
4038
|
-
HealthClaimFactSchema.extend({ attemptId: HealthAttemptSchema.shape.attemptId, status:
|
|
4145
|
+
var HealthClaimResponseSchema = z72.object({
|
|
4146
|
+
data: z72.union([
|
|
4147
|
+
z72.strictObject({ status: z72.literal("missing") }),
|
|
4148
|
+
HealthClaimFactSchema.extend({ status: z72.enum(["pending", "attempted", "returned", "unknown"]) }),
|
|
4149
|
+
HealthClaimFactSchema.extend({ attemptId: HealthAttemptSchema.shape.attemptId, status: z72.literal("claimed") })
|
|
4039
4150
|
]),
|
|
4040
|
-
successful:
|
|
4151
|
+
successful: z72.literal(true)
|
|
4041
4152
|
});
|
|
4042
4153
|
var HealthResultRequestSchema = HealthClaimRequestSchema.extend({
|
|
4043
4154
|
attemptId: HealthAttemptSchema.shape.attemptId,
|
|
4044
4155
|
outcome: HealthResultSchema.shape.status
|
|
4045
4156
|
});
|
|
4046
|
-
var HealthResultResponseSchema =
|
|
4157
|
+
var HealthResultResponseSchema = z72.object({
|
|
4047
4158
|
data: HealthClaimFactSchema.extend({
|
|
4048
4159
|
finishedAt: HealthResultSchema.shape.finishedAt,
|
|
4049
4160
|
status: HealthResultSchema.shape.status
|
|
4050
4161
|
}),
|
|
4051
|
-
successful:
|
|
4162
|
+
successful: z72.literal(true)
|
|
4052
4163
|
});
|
|
4053
4164
|
|
|
4054
4165
|
// src/schema/postPurchaseLifecycle.ts
|
|
4055
|
-
import { z as
|
|
4056
|
-
var Presentation =
|
|
4166
|
+
import { z as z73 } from "zod";
|
|
4167
|
+
var Presentation = z73.strictObject({
|
|
4057
4168
|
member: PostPurchaseMemberIdentity,
|
|
4058
4169
|
selectedProductId: PostPurchaseMemberIdentity.shape.productId.optional(),
|
|
4059
4170
|
variant: PostPurchaseVariantSelector
|
|
4060
4171
|
});
|
|
4061
4172
|
var LifecycleObservationRequestSchema = DecideRequestSchema.extend({
|
|
4062
4173
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
4063
|
-
eventType:
|
|
4174
|
+
eventType: z73.enum(["OFFER_VIEWED", "OFFER_TIMER_EXPIRED"]),
|
|
4064
4175
|
presentation: Presentation.nullable(),
|
|
4065
4176
|
progressRevision: PostPurchaseProgressSchema.shape.revision,
|
|
4066
|
-
requestId:
|
|
4177
|
+
requestId: z73.uuid()
|
|
4067
4178
|
}).strict().refine(
|
|
4068
4179
|
({ eventType, presentation }) => eventType !== "OFFER_VIEWED" || presentation !== null,
|
|
4069
4180
|
"Viewed observations require a presented product"
|
|
4070
4181
|
);
|
|
4071
|
-
var LifecycleObservationResponseSchema =
|
|
4072
|
-
data:
|
|
4182
|
+
var LifecycleObservationResponseSchema = z73.object({
|
|
4183
|
+
data: z73.strictObject({
|
|
4073
4184
|
requestId: LifecycleObservationRequestSchema.shape.requestId,
|
|
4074
|
-
status:
|
|
4185
|
+
status: z73.union([AcceptedEventOutcomeSchema, z73.literal("unavailable")])
|
|
4075
4186
|
}),
|
|
4076
|
-
successful:
|
|
4187
|
+
successful: z73.literal(true)
|
|
4077
4188
|
});
|
|
4078
4189
|
|
|
4079
4190
|
// src/schema/postPurchaseOffer.ts
|
|
4080
|
-
import { z as
|
|
4191
|
+
import { z as z75 } from "zod";
|
|
4081
4192
|
|
|
4082
4193
|
// src/schema/postPurchaseSkipTrace.ts
|
|
4083
|
-
import { z as
|
|
4194
|
+
import { z as z74 } from "zod";
|
|
4084
4195
|
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
4085
|
-
var PostPurchaseSkipTraceSchema =
|
|
4086
|
-
|
|
4196
|
+
var PostPurchaseSkipTraceSchema = z74.array(
|
|
4197
|
+
z74.object({
|
|
4087
4198
|
entry: DecisionEntrySchema,
|
|
4088
4199
|
reason: PostPurchaseSkipReasonSchema
|
|
4089
4200
|
})
|
|
@@ -4091,66 +4202,66 @@ var PostPurchaseSkipTraceSchema = z70.array(
|
|
|
4091
4202
|
|
|
4092
4203
|
// src/schema/postPurchaseOffer.ts
|
|
4093
4204
|
var OfferPreparationRequestSchema = DecideRequestSchema.strict();
|
|
4094
|
-
var OfferPreparationResponseSchema =
|
|
4095
|
-
data:
|
|
4096
|
-
successful:
|
|
4205
|
+
var OfferPreparationResponseSchema = z75.object({
|
|
4206
|
+
data: z75.object({ attemptedSkips: PostPurchaseSkipTraceSchema.optional(), progress: PostPurchaseProgressSchema }),
|
|
4207
|
+
successful: z75.literal(true)
|
|
4097
4208
|
});
|
|
4098
4209
|
|
|
4099
4210
|
// src/schema/postPurchaseOfferEligibility.ts
|
|
4100
|
-
import { z as
|
|
4101
|
-
var
|
|
4102
|
-
var PostPurchaseOfferSkipReason =
|
|
4103
|
-
var PostPurchaseOfferEligibilityContext =
|
|
4211
|
+
import { z as z76 } from "zod";
|
|
4212
|
+
var selection2 = PreparedPostPurchaseProduct.shape.selection;
|
|
4213
|
+
var PostPurchaseOfferSkipReason = z76.enum(["empty", "no-eligible-subscription"]);
|
|
4214
|
+
var PostPurchaseOfferEligibilityContext = z76.object({
|
|
4104
4215
|
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
4105
|
-
originalLineItems:
|
|
4216
|
+
originalLineItems: z76.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
4106
4217
|
});
|
|
4107
|
-
var PostPurchaseOfferEligibility =
|
|
4108
|
-
|
|
4109
|
-
members:
|
|
4110
|
-
|
|
4218
|
+
var PostPurchaseOfferEligibility = z76.discriminatedUnion("status", [
|
|
4219
|
+
z76.object({
|
|
4220
|
+
members: z76.array(
|
|
4221
|
+
z76.object({ productId: selection2.shape.productId, productIndex: z76.number().int().nonnegative() })
|
|
4111
4222
|
),
|
|
4112
|
-
status:
|
|
4223
|
+
status: z76.literal("retain")
|
|
4113
4224
|
}),
|
|
4114
|
-
|
|
4115
|
-
|
|
4225
|
+
z76.object({ reason: PostPurchaseOfferSkipReason, status: z76.literal("skip") }),
|
|
4226
|
+
z76.object({ reason: z76.literal("eligible-upgrade").optional(), status: z76.literal("unavailable") })
|
|
4116
4227
|
]);
|
|
4117
4228
|
|
|
4118
4229
|
// src/schema/postPurchaseOfferPresentation.ts
|
|
4119
|
-
import { z as
|
|
4230
|
+
import { z as z77 } from "zod";
|
|
4120
4231
|
var language2 = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap();
|
|
4121
|
-
var PostPurchaseOfferPresentation =
|
|
4232
|
+
var PostPurchaseOfferPresentation = z77.strictObject({
|
|
4122
4233
|
labels: language2.pick({ declineAll: true, declineThisOffer: true }),
|
|
4123
4234
|
layout: PostPurchaseSettings.shape.offersLayout,
|
|
4124
4235
|
sections: CABRootSection.nullable(),
|
|
4125
4236
|
showDeclineAll: PostPurchaseSettings.shape.productOptions.shape.showDeclineAll
|
|
4126
4237
|
});
|
|
4127
4238
|
var OfferPresentationRequestSchema = DecideRequestSchema.strict();
|
|
4128
|
-
var OfferPresentationResponseSchema =
|
|
4129
|
-
data:
|
|
4239
|
+
var OfferPresentationResponseSchema = z77.object({
|
|
4240
|
+
data: z77.strictObject({
|
|
4130
4241
|
presentation: PostPurchaseOfferPresentation.nullable(),
|
|
4131
4242
|
progress: PostPurchaseProgressSchema.nullable(),
|
|
4132
4243
|
serverNow: PostPurchaseTimestampSchema
|
|
4133
4244
|
}),
|
|
4134
|
-
successful:
|
|
4245
|
+
successful: z77.literal(true)
|
|
4135
4246
|
});
|
|
4136
4247
|
|
|
4137
4248
|
// src/schema/postPurchaseOrderDecision.ts
|
|
4138
|
-
import { z as
|
|
4139
|
-
var OrderDecisionSchema =
|
|
4140
|
-
|
|
4141
|
-
|
|
4249
|
+
import { z as z78 } from "zod";
|
|
4250
|
+
var OrderDecisionSchema = z78.discriminatedUnion("owner", [
|
|
4251
|
+
z78.object({ owner: z78.literal("session"), sessionId: PostPurchaseSessionIdSchema }),
|
|
4252
|
+
z78.object({ owner: z78.literal("release"), sessionId: z78.null() })
|
|
4142
4253
|
]);
|
|
4143
4254
|
|
|
4144
4255
|
// src/schema/postPurchasePolicy.ts
|
|
4145
|
-
import { z as
|
|
4146
|
-
var HoldSettingSchema =
|
|
4147
|
-
|
|
4148
|
-
|
|
4256
|
+
import { z as z79 } from "zod";
|
|
4257
|
+
var HoldSettingSchema = z79.discriminatedUnion("enabled", [
|
|
4258
|
+
z79.object({ durationMinutes: z79.number().int().min(1).max(60), enabled: z79.literal(true) }),
|
|
4259
|
+
z79.object({ durationMinutes: z79.null(), enabled: z79.literal(false) })
|
|
4149
4260
|
]);
|
|
4150
|
-
var TimingSettingsSchema =
|
|
4261
|
+
var TimingSettingsSchema = z79.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
4151
4262
|
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
4152
|
-
durationMinutes:
|
|
4153
|
-
source:
|
|
4263
|
+
durationMinutes: z79.number().int().min(1).max(60).nullable(),
|
|
4264
|
+
source: z79.enum(["shop", "flow", "native"])
|
|
4154
4265
|
}).refine(
|
|
4155
4266
|
(policy) => {
|
|
4156
4267
|
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
@@ -4164,8 +4275,8 @@ var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
|
4164
4275
|
);
|
|
4165
4276
|
|
|
4166
4277
|
// src/schema/postPurchasePreparationOptions.ts
|
|
4167
|
-
import { z as
|
|
4168
|
-
var PostPurchasePreparationOptions =
|
|
4278
|
+
import { z as z80 } from "zod";
|
|
4279
|
+
var PostPurchasePreparationOptions = z80.object({
|
|
4169
4280
|
choice: PostPurchaseChoice.optional(),
|
|
4170
4281
|
member: PostPurchaseMemberSelector.strict().optional(),
|
|
4171
4282
|
quantity: PreparedPostPurchaseProduct.shape.selection.shape.quantity.optional(),
|
|
@@ -4177,8 +4288,8 @@ var PostPurchasePreparationOptions = z76.object({
|
|
|
4177
4288
|
);
|
|
4178
4289
|
|
|
4179
4290
|
// src/schema/postPurchaseProductSettings.ts
|
|
4180
|
-
import { z as
|
|
4181
|
-
var amount =
|
|
4291
|
+
import { z as z81 } from "zod";
|
|
4292
|
+
var amount = z81.union([z81.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
4182
4293
|
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
4183
4294
|
discountedFrom: true,
|
|
4184
4295
|
language: true,
|
|
@@ -4190,62 +4301,66 @@ var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
|
4190
4301
|
subscriptionIsDefault: true,
|
|
4191
4302
|
upgradeToSubscription: true
|
|
4192
4303
|
}).extend({
|
|
4193
|
-
advance:
|
|
4194
|
-
blocks:
|
|
4304
|
+
advance: z81.unknown().default({}),
|
|
4305
|
+
blocks: z81.array(z81.unknown()).optional(),
|
|
4195
4306
|
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
4196
|
-
integrations:
|
|
4307
|
+
integrations: z81.unknown().default({}),
|
|
4197
4308
|
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
4198
|
-
styles:
|
|
4309
|
+
styles: z81.unknown().default({}),
|
|
4199
4310
|
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
4200
|
-
subscription:
|
|
4311
|
+
subscription: z81.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
4201
4312
|
});
|
|
4202
4313
|
|
|
4203
4314
|
// src/schema/postPurchaseRecovery.ts
|
|
4204
|
-
import { z as
|
|
4315
|
+
import { z as z82 } from "zod";
|
|
4205
4316
|
var PurchaseRecoveryRequestSchema = DecideRequestSchema.strict();
|
|
4206
|
-
var PurchaseRecoveryResponseSchema =
|
|
4207
|
-
data:
|
|
4208
|
-
operation:
|
|
4317
|
+
var PurchaseRecoveryResponseSchema = z82.object({
|
|
4318
|
+
data: z82.object({
|
|
4319
|
+
operation: z82.object({
|
|
4209
4320
|
observation: RecordedPurchaseObservationSchema.nullable(),
|
|
4210
|
-
operationId: PurchaseReceiptSchema.shape.operationId
|
|
4211
|
-
|
|
4321
|
+
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
4322
|
+
upgrade: UpgradeProgressSchema.optional()
|
|
4323
|
+
}).strict().refine(({ operationId, upgrade }) => !upgrade || upgrade.operationId === operationId, {
|
|
4324
|
+
message: "Upgrade progress belongs to its operation",
|
|
4325
|
+
path: ["upgrade", "operationId"]
|
|
4326
|
+
}).nullable(),
|
|
4212
4327
|
progress: PostPurchaseProgressSchema.nullable().optional()
|
|
4213
4328
|
}),
|
|
4214
|
-
successful:
|
|
4329
|
+
successful: z82.literal(true)
|
|
4215
4330
|
});
|
|
4216
4331
|
|
|
4217
4332
|
// src/schema/postPurchaseReleaseClaim.ts
|
|
4218
|
-
import { z as
|
|
4333
|
+
import { z as z83 } from "zod";
|
|
4219
4334
|
var ReleaseClaimRequestSchema = ReleaseAuthorityRequestSchema;
|
|
4220
|
-
var ReleaseClaimResponseSchema =
|
|
4221
|
-
data:
|
|
4222
|
-
|
|
4335
|
+
var ReleaseClaimResponseSchema = z83.object({
|
|
4336
|
+
data: z83.discriminatedUnion("status", [
|
|
4337
|
+
z83.object({ status: z83.literal("release-permitted") }),
|
|
4223
4338
|
PendingReleaseAuthoritySchema,
|
|
4224
4339
|
ReadyReleaseAuthoritySchema
|
|
4225
4340
|
]),
|
|
4226
|
-
successful:
|
|
4341
|
+
successful: z83.literal(true)
|
|
4227
4342
|
});
|
|
4228
4343
|
|
|
4229
4344
|
// src/schema/postPurchaseSelection.ts
|
|
4230
|
-
import { z as
|
|
4345
|
+
import { z as z84 } from "zod";
|
|
4231
4346
|
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
4232
4347
|
appId: PostPurchaseAppIdSchema,
|
|
4233
4348
|
entry: DecisionEntrySchema,
|
|
4234
|
-
iss:
|
|
4235
|
-
purpose:
|
|
4349
|
+
iss: z84.literal("rebuy-api"),
|
|
4350
|
+
purpose: z84.literal("post-purchase-selection")
|
|
4236
4351
|
});
|
|
4237
4352
|
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
4238
|
-
selectionToken:
|
|
4353
|
+
selectionToken: z84.string().min(1).max(8192).optional()
|
|
4239
4354
|
}).strict();
|
|
4240
4355
|
|
|
4241
4356
|
// src/schema/postPurchaseSession.ts
|
|
4242
|
-
import { z as
|
|
4357
|
+
import { z as z85 } from "zod";
|
|
4243
4358
|
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
4244
|
-
var SessionOrderTimingSchema =
|
|
4359
|
+
var SessionOrderTimingSchema = z85.object({
|
|
4245
4360
|
nativeDeadline: PostPurchaseTimestampSchema,
|
|
4246
4361
|
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
4247
4362
|
orderId: PostPurchaseOrderIdSchema,
|
|
4248
|
-
timingSource:
|
|
4363
|
+
timingSource: z85.literal("shopify-order-created-at")
|
|
4249
4364
|
});
|
|
4250
4365
|
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
4251
4366
|
deadline: PostPurchaseTimestampSchema,
|
|
@@ -4262,33 +4377,33 @@ var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
|
4262
4377
|
message: "deadline must not exceed nativeDeadline",
|
|
4263
4378
|
path: ["deadline"]
|
|
4264
4379
|
});
|
|
4265
|
-
var SessionStartResponseSchema =
|
|
4266
|
-
data:
|
|
4267
|
-
phase:
|
|
4380
|
+
var SessionStartResponseSchema = z85.object({
|
|
4381
|
+
data: z85.object({
|
|
4382
|
+
phase: z85.literal("render"),
|
|
4268
4383
|
serverNow: PostPurchaseTimestampSchema,
|
|
4269
4384
|
session: ReadySessionTimingSchema,
|
|
4270
|
-
workflowPhase:
|
|
4385
|
+
workflowPhase: z85.literal("start")
|
|
4271
4386
|
}),
|
|
4272
|
-
successful:
|
|
4387
|
+
successful: z85.literal(true)
|
|
4273
4388
|
});
|
|
4274
4389
|
|
|
4275
4390
|
// src/schema/postPurchaseShadow.ts
|
|
4276
|
-
import { z as
|
|
4277
|
-
var PostPurchaseShadowSelectionSchema =
|
|
4278
|
-
|
|
4279
|
-
|
|
4391
|
+
import { z as z86 } from "zod";
|
|
4392
|
+
var PostPurchaseShadowSelectionSchema = z86.discriminatedUnion("verdict", [
|
|
4393
|
+
z86.object({ entry: DecisionEntrySchema, verdict: z86.literal("render") }),
|
|
4394
|
+
z86.object({ verdict: z86.literal("skip") })
|
|
4280
4395
|
]);
|
|
4281
|
-
var PostPurchaseShadowReportFields =
|
|
4282
|
-
differences:
|
|
4396
|
+
var PostPurchaseShadowReportFields = z86.object({
|
|
4397
|
+
differences: z86.array(z86.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
4283
4398
|
message: "differences must not contain duplicate entries"
|
|
4284
4399
|
}),
|
|
4285
4400
|
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
4286
|
-
phase:
|
|
4287
|
-
sampleId:
|
|
4401
|
+
phase: z86.literal("shouldRender"),
|
|
4402
|
+
sampleId: z86.string(),
|
|
4288
4403
|
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
4289
|
-
status:
|
|
4290
|
-
targetingFlowIds:
|
|
4291
|
-
workflowPhase:
|
|
4404
|
+
status: z86.enum(["match", "diverged", "incomplete"]),
|
|
4405
|
+
targetingFlowIds: z86.array(z86.number().int().positive()),
|
|
4406
|
+
workflowPhase: z86.literal("decide")
|
|
4292
4407
|
});
|
|
4293
4408
|
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
4294
4409
|
(report) => report.status !== "match" || report.differences.length === 0,
|
|
@@ -4301,21 +4416,10 @@ var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
|
4301
4416
|
path: ["status"]
|
|
4302
4417
|
});
|
|
4303
4418
|
|
|
4304
|
-
// src/schema/postPurchaseSubscriptionDisplay.ts
|
|
4305
|
-
import { z as z83 } from "zod";
|
|
4306
|
-
var Minor2 = z83.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
4307
|
-
var PostPurchaseSubscriptionDisplay = z83.object({
|
|
4308
|
-
comparisonMinor: Minor2,
|
|
4309
|
-
currencyCode: z83.string().regex(/^[A-Z]{3}$/),
|
|
4310
|
-
priceMinor: Minor2,
|
|
4311
|
-
savingMinor: Minor2,
|
|
4312
|
-
savingPercent: z83.number().int().min(0).max(100)
|
|
4313
|
-
});
|
|
4314
|
-
|
|
4315
4419
|
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
4316
|
-
import { z as
|
|
4420
|
+
import { z as z87 } from "zod";
|
|
4317
4421
|
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
4318
|
-
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId:
|
|
4422
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: z87.number().int().positive() }),
|
|
4319
4423
|
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
4320
4424
|
subscription: PostPurchaseSubscriptionTerms
|
|
4321
4425
|
}).refine(
|
|
@@ -4328,108 +4432,108 @@ var readPostPurchaseSubscription = (prepared) => {
|
|
|
4328
4432
|
};
|
|
4329
4433
|
|
|
4330
4434
|
// src/schema/postPurchaseTransition.ts
|
|
4331
|
-
import { z as
|
|
4435
|
+
import { z as z88 } from "zod";
|
|
4332
4436
|
var OfferTransitionRequestSchema = DecideRequestSchema.extend({
|
|
4333
4437
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
4334
4438
|
progressRevision: PostPurchaseProgressSchema.shape.revision
|
|
4335
4439
|
}).strict();
|
|
4336
|
-
var OfferTransitionResponseSchema =
|
|
4337
|
-
data:
|
|
4440
|
+
var OfferTransitionResponseSchema = z88.object({
|
|
4441
|
+
data: z88.object({
|
|
4338
4442
|
attemptedSkips: PostPurchaseSkipTraceSchema.optional(),
|
|
4339
4443
|
progress: PostPurchaseProgressSchema,
|
|
4340
|
-
status:
|
|
4444
|
+
status: z88.enum(["advanced", "no-child", "unavailable"])
|
|
4341
4445
|
}),
|
|
4342
|
-
successful:
|
|
4446
|
+
successful: z88.literal(true)
|
|
4343
4447
|
});
|
|
4344
4448
|
|
|
4345
4449
|
// src/schema/postPurchaseVariantDefault.ts
|
|
4346
|
-
import { z as
|
|
4450
|
+
import { z as z89 } from "zod";
|
|
4347
4451
|
var values = PostPurchaseVariantValues.partial().extend({
|
|
4348
4452
|
option1: PostPurchaseVariantValues.shape.option1.nullish()
|
|
4349
4453
|
});
|
|
4350
4454
|
var variant = values.extend({
|
|
4351
4455
|
id: PostPurchaseVariantId,
|
|
4352
|
-
inventoryManagement:
|
|
4353
|
-
inventoryPolicy:
|
|
4354
|
-
inventoryQuantity:
|
|
4456
|
+
inventoryManagement: z89.string().nullable(),
|
|
4457
|
+
inventoryPolicy: z89.string(),
|
|
4458
|
+
inventoryQuantity: z89.number()
|
|
4355
4459
|
});
|
|
4356
|
-
var options =
|
|
4357
|
-
var PostPurchaseVariantDefaultProduct =
|
|
4460
|
+
var options = z89.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
|
|
4461
|
+
var PostPurchaseVariantDefaultProduct = z89.object({
|
|
4358
4462
|
id: PostPurchaseProductId,
|
|
4359
4463
|
options,
|
|
4360
4464
|
selectedVariant: variant.optional(),
|
|
4361
|
-
variants:
|
|
4465
|
+
variants: z89.array(variant)
|
|
4362
4466
|
});
|
|
4363
4467
|
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
4364
4468
|
hideOutOfStockVariants: true,
|
|
4365
4469
|
matchVariant: true
|
|
4366
4470
|
});
|
|
4367
|
-
var PostPurchaseOrderAttributes =
|
|
4368
|
-
var PostPurchaseOriginalVariants =
|
|
4369
|
-
|
|
4471
|
+
var PostPurchaseOrderAttributes = z89.record(z89.string(), z89.array(z89.string())).default({});
|
|
4472
|
+
var PostPurchaseOriginalVariants = z89.array(
|
|
4473
|
+
z89.object({ productId: PostPurchaseProductId, variantId: PostPurchaseVariantId })
|
|
4370
4474
|
);
|
|
4371
|
-
var PostPurchaseAttributeProducts =
|
|
4372
|
-
|
|
4475
|
+
var PostPurchaseAttributeProducts = z89.array(
|
|
4476
|
+
z89.object({ id: PostPurchaseProductId, options, variants: z89.array(values.extend({ id: PostPurchaseVariantId })) })
|
|
4373
4477
|
);
|
|
4374
4478
|
|
|
4375
4479
|
// src/schema/postPurchaseVariantDefaultContext.ts
|
|
4376
|
-
import { z as
|
|
4377
|
-
var PostPurchaseVariantDefaultContext =
|
|
4378
|
-
enrichedLineItems:
|
|
4480
|
+
import { z as z90 } from "zod";
|
|
4481
|
+
var PostPurchaseVariantDefaultContext = z90.object({
|
|
4482
|
+
enrichedLineItems: z90.unknown().optional(),
|
|
4379
4483
|
originalVariants: PostPurchaseOriginalVariants
|
|
4380
4484
|
});
|
|
4381
4485
|
|
|
4382
4486
|
// src/schema/shopConfig.ts
|
|
4383
|
-
import { z as
|
|
4384
|
-
var ShopConfig =
|
|
4385
|
-
activeExperiments:
|
|
4386
|
-
|
|
4387
|
-
data:
|
|
4388
|
-
|
|
4389
|
-
aliasName:
|
|
4390
|
-
cssInput:
|
|
4391
|
-
elementId:
|
|
4392
|
-
id:
|
|
4393
|
-
javascriptInput:
|
|
4394
|
-
traffic:
|
|
4487
|
+
import { z as z91 } from "zod";
|
|
4488
|
+
var ShopConfig = z91.object({
|
|
4489
|
+
activeExperiments: z91.array(
|
|
4490
|
+
z91.object({
|
|
4491
|
+
data: z91.array(
|
|
4492
|
+
z91.object({
|
|
4493
|
+
aliasName: z91.string(),
|
|
4494
|
+
cssInput: z91.string().nullish(),
|
|
4495
|
+
elementId: z91.coerce.number(),
|
|
4496
|
+
id: z91.coerce.number(),
|
|
4497
|
+
javascriptInput: z91.string().nullish(),
|
|
4498
|
+
traffic: z91.coerce.number()
|
|
4395
4499
|
})
|
|
4396
4500
|
),
|
|
4397
|
-
id:
|
|
4398
|
-
name:
|
|
4399
|
-
pageTarget:
|
|
4400
|
-
pageTargetUrl:
|
|
4401
|
-
placeholderId:
|
|
4402
|
-
type:
|
|
4501
|
+
id: z91.coerce.number(),
|
|
4502
|
+
name: z91.string(),
|
|
4503
|
+
pageTarget: z91.string().nullable(),
|
|
4504
|
+
pageTargetUrl: z91.string().nullable(),
|
|
4505
|
+
placeholderId: z91.coerce.number().nullable(),
|
|
4506
|
+
type: z91.string()
|
|
4403
4507
|
})
|
|
4404
4508
|
),
|
|
4405
|
-
activePackages:
|
|
4406
|
-
|
|
4407
|
-
cancelledAt:
|
|
4408
|
-
id:
|
|
4409
|
-
installedAt:
|
|
4410
|
-
isActive:
|
|
4411
|
-
isBillable:
|
|
4412
|
-
packageId:
|
|
4413
|
-
packageName:
|
|
4414
|
-
shortName:
|
|
4415
|
-
trialDays:
|
|
4416
|
-
uninstalledAt:
|
|
4509
|
+
activePackages: z91.array(
|
|
4510
|
+
z91.object({
|
|
4511
|
+
cancelledAt: z91.string().nullable(),
|
|
4512
|
+
id: z91.number(),
|
|
4513
|
+
installedAt: z91.string().nullable(),
|
|
4514
|
+
isActive: z91.boolean(),
|
|
4515
|
+
isBillable: z91.boolean(),
|
|
4516
|
+
packageId: z91.number(),
|
|
4517
|
+
packageName: z91.string(),
|
|
4518
|
+
shortName: z91.string(),
|
|
4519
|
+
trialDays: z91.number(),
|
|
4520
|
+
uninstalledAt: z91.string().nullable()
|
|
4417
4521
|
})
|
|
4418
4522
|
),
|
|
4419
|
-
apiKey:
|
|
4420
|
-
billingVersion:
|
|
4421
|
-
cacheKey:
|
|
4422
|
-
carousel:
|
|
4423
|
-
currency:
|
|
4424
|
-
currencySymbol:
|
|
4425
|
-
domain:
|
|
4426
|
-
enabledJquery:
|
|
4427
|
-
enabledPresentmentCurrencies:
|
|
4428
|
-
hasSmartCollectionsEnabled:
|
|
4429
|
-
hasSmartSearchEnabled:
|
|
4430
|
-
id:
|
|
4431
|
-
integrations:
|
|
4432
|
-
|
|
4523
|
+
apiKey: z91.string(),
|
|
4524
|
+
billingVersion: z91.string().nullable(),
|
|
4525
|
+
cacheKey: z91.coerce.number(),
|
|
4526
|
+
carousel: z91.enum(["flickity", "splide"]),
|
|
4527
|
+
currency: z91.string(),
|
|
4528
|
+
currencySymbol: z91.string(),
|
|
4529
|
+
domain: z91.string(),
|
|
4530
|
+
enabledJquery: z91.boolean(),
|
|
4531
|
+
enabledPresentmentCurrencies: z91.array(z91.string()),
|
|
4532
|
+
hasSmartCollectionsEnabled: z91.boolean(),
|
|
4533
|
+
hasSmartSearchEnabled: z91.boolean(),
|
|
4534
|
+
id: z91.coerce.number(),
|
|
4535
|
+
integrations: z91.record(
|
|
4536
|
+
z91.enum([
|
|
4433
4537
|
"attentive",
|
|
4434
4538
|
"judgeme",
|
|
4435
4539
|
"junip",
|
|
@@ -4442,170 +4546,170 @@ var ShopConfig = z88.object({
|
|
|
4442
4546
|
"stamped",
|
|
4443
4547
|
"yotpo"
|
|
4444
4548
|
]),
|
|
4445
|
-
|
|
4549
|
+
z91.union([z91.boolean(), z91.unknown()])
|
|
4446
4550
|
),
|
|
4447
|
-
markets:
|
|
4448
|
-
enabled:
|
|
4551
|
+
markets: z91.object({
|
|
4552
|
+
enabled: z91.boolean()
|
|
4449
4553
|
}),
|
|
4450
|
-
monetize:
|
|
4451
|
-
publisherKey:
|
|
4554
|
+
monetize: z91.object({
|
|
4555
|
+
publisherKey: z91.string().nullable()
|
|
4452
4556
|
}).nullish(),
|
|
4453
|
-
moneyFormat:
|
|
4454
|
-
myshopifyDomain:
|
|
4455
|
-
primaryLocale:
|
|
4456
|
-
productGroupsEnabled:
|
|
4457
|
-
rechargeCustomDomain:
|
|
4458
|
-
sellingPlansEnabled:
|
|
4459
|
-
shopId:
|
|
4460
|
-
shopifySellingPlansEnabled:
|
|
4461
|
-
shopName:
|
|
4462
|
-
storefrontAccessToken:
|
|
4463
|
-
useRebuyIcons:
|
|
4557
|
+
moneyFormat: z91.string(),
|
|
4558
|
+
myshopifyDomain: z91.string(),
|
|
4559
|
+
primaryLocale: z91.string(),
|
|
4560
|
+
productGroupsEnabled: z91.enum(["no", "yes"]).transform((value) => value === "yes"),
|
|
4561
|
+
rechargeCustomDomain: z91.string().nullable(),
|
|
4562
|
+
sellingPlansEnabled: z91.boolean(),
|
|
4563
|
+
shopId: z91.number(),
|
|
4564
|
+
shopifySellingPlansEnabled: z91.boolean(),
|
|
4565
|
+
shopName: z91.string(),
|
|
4566
|
+
storefrontAccessToken: z91.string().nullable(),
|
|
4567
|
+
useRebuyIcons: z91.boolean()
|
|
4464
4568
|
});
|
|
4465
4569
|
|
|
4466
4570
|
// src/schema/userConfig.ts
|
|
4467
|
-
import { z as
|
|
4468
|
-
var UserConfig =
|
|
4571
|
+
import { z as z92 } from "zod";
|
|
4572
|
+
var UserConfig = z92.object({
|
|
4469
4573
|
shop: ShopConfig,
|
|
4470
4574
|
/**
|
|
4471
4575
|
* `.catch(undefined)` is the safety bar: smart-cart shape drift can NEVER fail `fetchUserConfig`,
|
|
4472
4576
|
* which resolves the apiKey for every offers/monetize/analytics/gift request.
|
|
4473
4577
|
*/
|
|
4474
4578
|
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
4475
|
-
smartFlows:
|
|
4579
|
+
smartFlows: z92.array(z92.unknown())
|
|
4476
4580
|
});
|
|
4477
4581
|
|
|
4478
4582
|
// src/schema/widgetData.ts
|
|
4479
|
-
import { z as
|
|
4583
|
+
import { z as z101 } from "zod";
|
|
4480
4584
|
|
|
4481
4585
|
// src/schema/widgets/abTestingPlaceholder.ts
|
|
4482
|
-
import { z as
|
|
4483
|
-
var ABTestingPlaceholder =
|
|
4484
|
-
type:
|
|
4586
|
+
import { z as z93 } from "zod";
|
|
4587
|
+
var ABTestingPlaceholder = z93.looseObject({
|
|
4588
|
+
type: z93.literal("placeholder")
|
|
4485
4589
|
});
|
|
4486
4590
|
|
|
4487
4591
|
// src/schema/widgets/checkoutExtension.ts
|
|
4488
|
-
import { z as
|
|
4489
|
-
var CheckoutExtension =
|
|
4490
|
-
type:
|
|
4592
|
+
import { z as z94 } from "zod";
|
|
4593
|
+
var CheckoutExtension = z94.looseObject({
|
|
4594
|
+
type: z94.literal(WidgetType.shopify_checkout_extension).default(WidgetType.shopify_checkout_extension)
|
|
4491
4595
|
});
|
|
4492
4596
|
|
|
4493
4597
|
// src/schema/widgets/contentBlock.ts
|
|
4494
|
-
import { z as
|
|
4495
|
-
var ContentBlockV1 =
|
|
4496
|
-
blockSpacing:
|
|
4497
|
-
imageBlocks:
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
altText:
|
|
4501
|
-
description:
|
|
4502
|
-
id:
|
|
4503
|
-
imagePlacement:
|
|
4504
|
-
imageSize:
|
|
4505
|
-
imageUrl:
|
|
4506
|
-
textAlignment:
|
|
4598
|
+
import { z as z95 } from "zod";
|
|
4599
|
+
var ContentBlockV1 = z95.object({
|
|
4600
|
+
blockSpacing: z95.enum(spacings).optional(),
|
|
4601
|
+
imageBlocks: z95.union([
|
|
4602
|
+
z95.array(
|
|
4603
|
+
z95.object({
|
|
4604
|
+
altText: z95.string().nullable(),
|
|
4605
|
+
description: z95.string().nullable(),
|
|
4606
|
+
id: z95.uuid(),
|
|
4607
|
+
imagePlacement: z95.enum(["top", "right", "bottom", "left"]),
|
|
4608
|
+
imageSize: z95.number(),
|
|
4609
|
+
imageUrl: z95.url(),
|
|
4610
|
+
textAlignment: z95.enum(["left", "center", "right"]),
|
|
4507
4611
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
4508
|
-
textSize:
|
|
4612
|
+
textSize: z95.enum(inlineTextSizeNames)
|
|
4509
4613
|
})
|
|
4510
4614
|
),
|
|
4511
|
-
|
|
4615
|
+
z95.strictObject({}).transform(() => [])
|
|
4512
4616
|
]).optional(),
|
|
4513
|
-
imageLayout:
|
|
4514
|
-
language:
|
|
4515
|
-
description:
|
|
4516
|
-
superTitle:
|
|
4517
|
-
title:
|
|
4617
|
+
imageLayout: z95.enum(["row", "column"]).optional(),
|
|
4618
|
+
language: z95.object({
|
|
4619
|
+
description: z95.string(),
|
|
4620
|
+
superTitle: z95.string(),
|
|
4621
|
+
title: z95.string()
|
|
4518
4622
|
}),
|
|
4519
|
-
previewMode:
|
|
4520
|
-
type:
|
|
4521
|
-
version:
|
|
4623
|
+
previewMode: z95.boolean(),
|
|
4624
|
+
type: z95.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block),
|
|
4625
|
+
version: z95.literal(1)
|
|
4522
4626
|
});
|
|
4523
|
-
var ContentBlock =
|
|
4627
|
+
var ContentBlock = z95.discriminatedUnion("version", [
|
|
4524
4628
|
ContentBlockV1,
|
|
4525
4629
|
CABRootSection.extend({
|
|
4526
|
-
type:
|
|
4630
|
+
type: z95.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
4527
4631
|
})
|
|
4528
4632
|
]);
|
|
4529
4633
|
|
|
4530
4634
|
// src/schema/widgets/giftWithPurchase.ts
|
|
4531
|
-
import { z as
|
|
4532
|
-
var GiftWithPurchase =
|
|
4533
|
-
type:
|
|
4635
|
+
import { z as z96 } from "zod";
|
|
4636
|
+
var GiftWithPurchase = z96.looseObject({
|
|
4637
|
+
type: z96.literal(WidgetType.gift_with_purchase).default(WidgetType.gift_with_purchase)
|
|
4534
4638
|
});
|
|
4535
4639
|
|
|
4536
4640
|
// src/schema/widgets/lineItemEditor.ts
|
|
4537
|
-
import { z as
|
|
4538
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
4539
|
-
downgradeToOneTimeLabel:
|
|
4641
|
+
import { z as z97 } from "zod";
|
|
4642
|
+
var LineItemEditorSwitchLanguageV1 = z97.object({
|
|
4643
|
+
downgradeToOneTimeLabel: z97.string().optional(),
|
|
4540
4644
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
4541
|
-
subscriptionOptionLabel:
|
|
4542
|
-
upgradeToSubscriptionLabel:
|
|
4543
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
4645
|
+
subscriptionOptionLabel: z97.string().optional(),
|
|
4646
|
+
upgradeToSubscriptionLabel: z97.string().optional(),
|
|
4647
|
+
upgradeToSubscriptionWithoutDiscountLabel: z97.string().optional()
|
|
4544
4648
|
});
|
|
4545
|
-
var LineItemEditorV1 =
|
|
4649
|
+
var LineItemEditorV1 = z97.object({
|
|
4546
4650
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
4547
|
-
button:
|
|
4548
|
-
previewMode:
|
|
4549
|
-
switchToSubscription:
|
|
4550
|
-
disableDowngrade:
|
|
4651
|
+
button: z97.object({ kind: z97.enum(["plain", "primary", "secondary"]).optional() }).optional(),
|
|
4652
|
+
previewMode: z97.boolean().optional(),
|
|
4653
|
+
switchToSubscription: z97.object({
|
|
4654
|
+
disableDowngrade: z97.boolean().optional(),
|
|
4551
4655
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
4552
4656
|
}).optional(),
|
|
4553
|
-
switchToSubscriptionEnabled:
|
|
4554
|
-
tracking:
|
|
4555
|
-
enableAttribution:
|
|
4556
|
-
enableSource:
|
|
4557
|
-
enableWidget:
|
|
4657
|
+
switchToSubscriptionEnabled: z97.boolean().optional(),
|
|
4658
|
+
tracking: z97.object({
|
|
4659
|
+
enableAttribution: z97.boolean().optional(),
|
|
4660
|
+
enableSource: z97.boolean().optional(),
|
|
4661
|
+
enableWidget: z97.boolean().optional()
|
|
4558
4662
|
}).optional(),
|
|
4559
|
-
type:
|
|
4560
|
-
version:
|
|
4663
|
+
type: z97.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
4664
|
+
version: z97.literal(1)
|
|
4561
4665
|
});
|
|
4562
|
-
var LineItemEditor =
|
|
4666
|
+
var LineItemEditor = z97.discriminatedUnion("version", [
|
|
4563
4667
|
LineItemEditorV1,
|
|
4564
4668
|
CABRootSection.extend({
|
|
4565
|
-
type:
|
|
4669
|
+
type: z97.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
4566
4670
|
})
|
|
4567
4671
|
]);
|
|
4568
4672
|
|
|
4569
4673
|
// src/schema/widgets/progressBar.ts
|
|
4570
|
-
import { z as
|
|
4571
|
-
var ProgressBar =
|
|
4572
|
-
type:
|
|
4674
|
+
import { z as z98 } from "zod";
|
|
4675
|
+
var ProgressBar = z98.looseObject({
|
|
4676
|
+
type: z98.literal(WidgetType.ui_extension_progress_bar).default(WidgetType.ui_extension_progress_bar)
|
|
4573
4677
|
});
|
|
4574
4678
|
|
|
4575
4679
|
// src/schema/widgets/rebuyButton.ts
|
|
4576
|
-
import { z as
|
|
4577
|
-
var RebuyButtonV1 =
|
|
4578
|
-
type:
|
|
4579
|
-
version:
|
|
4680
|
+
import { z as z99 } from "zod";
|
|
4681
|
+
var RebuyButtonV1 = z99.looseObject({
|
|
4682
|
+
type: z99.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button),
|
|
4683
|
+
version: z99.literal(1)
|
|
4580
4684
|
});
|
|
4581
|
-
var RebuyButton =
|
|
4685
|
+
var RebuyButton = z99.discriminatedUnion("version", [
|
|
4582
4686
|
RebuyButtonV1,
|
|
4583
4687
|
CABRootSection.extend({
|
|
4584
|
-
type:
|
|
4688
|
+
type: z99.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
4585
4689
|
})
|
|
4586
4690
|
]);
|
|
4587
4691
|
|
|
4588
4692
|
// src/schema/widgets/rebuyMonetize.ts
|
|
4589
|
-
import { z as
|
|
4590
|
-
var RebuyMonetize =
|
|
4591
|
-
type:
|
|
4693
|
+
import { z as z100 } from "zod";
|
|
4694
|
+
var RebuyMonetize = z100.looseObject({
|
|
4695
|
+
type: z100.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad)
|
|
4592
4696
|
});
|
|
4593
|
-
var RebuyMonetizeV1 =
|
|
4594
|
-
name:
|
|
4595
|
-
previewMode:
|
|
4697
|
+
var RebuyMonetizeV1 = z100.object({
|
|
4698
|
+
name: z100.string().nullable().optional(),
|
|
4699
|
+
previewMode: z100.boolean().optional(),
|
|
4596
4700
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
4597
|
-
privacyPolicyUrl:
|
|
4701
|
+
privacyPolicyUrl: z100.string().nullable().optional(),
|
|
4598
4702
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
4599
|
-
subVertical:
|
|
4600
|
-
tracking:
|
|
4601
|
-
enableAttribution:
|
|
4602
|
-
enableSource:
|
|
4603
|
-
enableWidget:
|
|
4703
|
+
subVertical: z100.string().nullable().optional(),
|
|
4704
|
+
tracking: z100.object({
|
|
4705
|
+
enableAttribution: z100.boolean().optional(),
|
|
4706
|
+
enableSource: z100.boolean().optional(),
|
|
4707
|
+
enableWidget: z100.boolean().optional()
|
|
4604
4708
|
}).optional(),
|
|
4605
|
-
type:
|
|
4606
|
-
version:
|
|
4709
|
+
type: z100.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
4710
|
+
version: z100.literal(1),
|
|
4607
4711
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
4608
|
-
vertical:
|
|
4712
|
+
vertical: z100.string().nullable().optional()
|
|
4609
4713
|
});
|
|
4610
4714
|
|
|
4611
4715
|
// src/schema/widgetData.ts
|
|
@@ -4619,7 +4723,7 @@ var extensionWidgetTypes = [
|
|
|
4619
4723
|
WidgetType.ui_extension_line_item_editor,
|
|
4620
4724
|
WidgetType.ui_extension_progress_bar
|
|
4621
4725
|
];
|
|
4622
|
-
var WidgetData =
|
|
4726
|
+
var WidgetData = z101.discriminatedUnion("type", [
|
|
4623
4727
|
ABTestingPlaceholder,
|
|
4624
4728
|
CheckoutExtension,
|
|
4625
4729
|
ContentBlock,
|
|
@@ -4979,36 +5083,36 @@ var SWITCH_LABELS = {
|
|
|
4979
5083
|
};
|
|
4980
5084
|
|
|
4981
5085
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4982
|
-
import { z as
|
|
5086
|
+
import { z as z103 } from "zod";
|
|
4983
5087
|
|
|
4984
5088
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
4985
|
-
import { z as
|
|
4986
|
-
var PostPurchaseWidgetLinkedFlow =
|
|
4987
|
-
id:
|
|
4988
|
-
name:
|
|
4989
|
-
});
|
|
4990
|
-
var PostPurchaseWidget =
|
|
4991
|
-
classification:
|
|
4992
|
-
createdAtTime:
|
|
4993
|
-
customEndpointName:
|
|
4994
|
-
id:
|
|
4995
|
-
lastViewed:
|
|
4996
|
-
linkedCustomEndpointId:
|
|
4997
|
-
linkedFlows:
|
|
4998
|
-
name:
|
|
4999
|
-
owner:
|
|
5089
|
+
import { z as z102 } from "zod";
|
|
5090
|
+
var PostPurchaseWidgetLinkedFlow = z102.object({
|
|
5091
|
+
id: z102.number(),
|
|
5092
|
+
name: z102.string()
|
|
5093
|
+
});
|
|
5094
|
+
var PostPurchaseWidget = z102.object({
|
|
5095
|
+
classification: z102.literal("post_purchase_offer_page").default("post_purchase_offer_page"),
|
|
5096
|
+
createdAtTime: z102.iso.datetime({ offset: true }).optional(),
|
|
5097
|
+
customEndpointName: z102.string().nullish(),
|
|
5098
|
+
id: z102.number().default(0),
|
|
5099
|
+
lastViewed: z102.iso.datetime({ offset: true }).nullish(),
|
|
5100
|
+
linkedCustomEndpointId: z102.number().nullish(),
|
|
5101
|
+
linkedFlows: z102.array(PostPurchaseWidgetLinkedFlow).optional(),
|
|
5102
|
+
name: z102.string().default(""),
|
|
5103
|
+
owner: z102.number().nullish(),
|
|
5000
5104
|
settings: PostPurchaseSettings
|
|
5001
5105
|
});
|
|
5002
5106
|
|
|
5003
5107
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
5004
|
-
var PostPurchaseOffer =
|
|
5005
|
-
|
|
5006
|
-
errors:
|
|
5007
|
-
message:
|
|
5008
|
-
successful:
|
|
5108
|
+
var PostPurchaseOffer = z103.discriminatedUnion("successful", [
|
|
5109
|
+
z103.strictObject({
|
|
5110
|
+
errors: z103.array(z103.object({ message: z103.string() })),
|
|
5111
|
+
message: z103.string(),
|
|
5112
|
+
successful: z103.literal(false)
|
|
5009
5113
|
}),
|
|
5010
|
-
|
|
5011
|
-
successful:
|
|
5114
|
+
z103.strictObject({
|
|
5115
|
+
successful: z103.literal(true),
|
|
5012
5116
|
widget: PostPurchaseWidget
|
|
5013
5117
|
})
|
|
5014
5118
|
]);
|
|
@@ -5511,21 +5615,26 @@ var buildOfferTemplate = ({ location: location2, name } = {}) => CABRootSection.
|
|
|
5511
5615
|
type: SHOPIFY_CHECKOUT_EXTENSION
|
|
5512
5616
|
});
|
|
5513
5617
|
|
|
5514
|
-
// src/transforms/
|
|
5515
|
-
var
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
var
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5618
|
+
// src/transforms/productCard/earnedText.ts
|
|
5619
|
+
var contentMutator = (effect, variable, operator) => ({
|
|
5620
|
+
effect,
|
|
5621
|
+
variable,
|
|
5622
|
+
when: { operator, type: "content" }
|
|
5623
|
+
});
|
|
5624
|
+
var earnedFrom = (variable) => [
|
|
5625
|
+
contentMutator("set_false", variable, "is_empty"),
|
|
5626
|
+
contentMutator("set_true", variable, "is_not_empty")
|
|
5627
|
+
];
|
|
5628
|
+
var shownWhile = (variable) => ({ variable, visibleWhen: true });
|
|
5629
|
+
var earnedText = (variable, content) => ({
|
|
5630
|
+
content: { en: content },
|
|
5631
|
+
mutators: earnedFrom(variable),
|
|
5632
|
+
sectionType: "text",
|
|
5633
|
+
visibility: shownWhile(variable)
|
|
5634
|
+
});
|
|
5635
|
+
|
|
5636
|
+
// src/transforms/productCard/priceText.ts
|
|
5637
|
+
var priceContent = () => ({
|
|
5529
5638
|
content: [
|
|
5530
5639
|
{
|
|
5531
5640
|
content: [
|
|
@@ -5551,6 +5660,64 @@ var buildPriceContent = () => ({
|
|
|
5551
5660
|
],
|
|
5552
5661
|
type: "doc"
|
|
5553
5662
|
});
|
|
5663
|
+
var priceText = () => ({
|
|
5664
|
+
content: { en: priceContent() },
|
|
5665
|
+
sectionType: "text"
|
|
5666
|
+
});
|
|
5667
|
+
|
|
5668
|
+
// src/transforms/productCard/quantitySection.ts
|
|
5669
|
+
var quantitySection = ({ errorMessages, inputType, maxValue, minValue, name }) => {
|
|
5670
|
+
const max = Math.min(Math.max(maxValue ?? 10, 1), 100);
|
|
5671
|
+
const min = Math.min(Math.max(minValue ?? 1, 1), max);
|
|
5672
|
+
return {
|
|
5673
|
+
...errorMessages && { errorMessages },
|
|
5674
|
+
...inputType && { inputType },
|
|
5675
|
+
max,
|
|
5676
|
+
min,
|
|
5677
|
+
...name && { name },
|
|
5678
|
+
sectionType: "quantity"
|
|
5679
|
+
};
|
|
5680
|
+
};
|
|
5681
|
+
|
|
5682
|
+
// src/transforms/productCard/subscriptionToggle.ts
|
|
5683
|
+
var SWITCH_LABEL_TOKENS = ["subscriptionDiscount", "frequency", "interval"];
|
|
5684
|
+
var subscriptionToggle = (productType, labels = {}) => {
|
|
5685
|
+
if (productType !== "both" && productType !== "subscription") return [];
|
|
5686
|
+
const slot = (buttonField, override) => ({
|
|
5687
|
+
buttonField,
|
|
5688
|
+
content: localizedContent(SWITCH_LABELS[buttonField], override, SWITCH_LABEL_TOKENS),
|
|
5689
|
+
sectionType: "text"
|
|
5690
|
+
});
|
|
5691
|
+
return [
|
|
5692
|
+
{
|
|
5693
|
+
action: "switchToSubscription",
|
|
5694
|
+
buttonStyle: "plain",
|
|
5695
|
+
/** A `subscription` widget offers no one-time purchase; suppress the downgrade so the buyer can't switch to one-time. */
|
|
5696
|
+
...productType === "subscription" && { disableDowngrade: true },
|
|
5697
|
+
sections: [
|
|
5698
|
+
slot("subscriptionOption", void 0),
|
|
5699
|
+
slot("switchToOneTimePurchase", labels.oneTime),
|
|
5700
|
+
slot("switchToSubscriptionNoDiscount", labels.upgrade),
|
|
5701
|
+
slot("switchToSubscriptionWithDiscount", labels.upgrade)
|
|
5702
|
+
],
|
|
5703
|
+
sectionType: "button"
|
|
5704
|
+
}
|
|
5705
|
+
];
|
|
5706
|
+
};
|
|
5707
|
+
|
|
5708
|
+
// src/transforms/offerV1/offerCard.ts
|
|
5709
|
+
var borderToken = (tokens, value) => value !== void 0 && tokens.includes(value) ? value : "base";
|
|
5710
|
+
var GRID_CARD_IMAGE_PX = 120;
|
|
5711
|
+
var COMPACT_CARD_IMAGE_PX = 64;
|
|
5712
|
+
var ADD_LABEL_TOKENS = ["quantity", "price", "total"];
|
|
5713
|
+
var QUANTITY_ERROR_TOKENS = ["max", "min", "step"];
|
|
5714
|
+
var VARIANT_SELECTOR = { button: "button", radio: "radio", select: "menu" };
|
|
5715
|
+
var buildStyledText = (token, style, fontSize = style?.textSize ?? "base") => {
|
|
5716
|
+
const marks = [{ attrs: { color: "base", fontSize }, type: "textStyle" }];
|
|
5717
|
+
if (style?.textEmphasis === "bold") marks.push({ type: "bold" });
|
|
5718
|
+
if (style?.textEmphasis === "italic") marks.push({ type: "italic" });
|
|
5719
|
+
return { content: [{ content: [{ marks, text: token, type: "text" }], type: "paragraph" }], type: "doc" };
|
|
5720
|
+
};
|
|
5554
5721
|
var buildReviews = (settings) => {
|
|
5555
5722
|
if (!settings.integrations || !Object.values(settings.integrations).some(Boolean)) return [];
|
|
5556
5723
|
const reviews = settings.displaySettings?.reviews;
|
|
@@ -5592,29 +5759,11 @@ var buildTitle = (settings) => ({
|
|
|
5592
5759
|
},
|
|
5593
5760
|
sectionType: "text"
|
|
5594
5761
|
});
|
|
5595
|
-
var buildPrice = () => ({
|
|
5596
|
-
content: { en: buildPriceContent() },
|
|
5597
|
-
sectionType: "text"
|
|
5598
|
-
});
|
|
5599
5762
|
var HAS_VARIANT_TITLE = "hasVariantTitle";
|
|
5600
5763
|
var buildVariantTitle = (settings) => {
|
|
5601
5764
|
const show = settings.productOptions?.showVariantTitle;
|
|
5602
5765
|
if (!show || show === "hide") return [];
|
|
5603
|
-
return [
|
|
5604
|
-
{
|
|
5605
|
-
content: { en: buildStyledText("{{variantTitle}}", settings.displaySettings?.variant) },
|
|
5606
|
-
mutators: [
|
|
5607
|
-
{ effect: "set_false", variable: HAS_VARIANT_TITLE, when: { operator: "is_empty", type: "content" } },
|
|
5608
|
-
{
|
|
5609
|
-
effect: "set_true",
|
|
5610
|
-
variable: HAS_VARIANT_TITLE,
|
|
5611
|
-
when: { operator: "is_not_empty", type: "content" }
|
|
5612
|
-
}
|
|
5613
|
-
],
|
|
5614
|
-
sectionType: "text",
|
|
5615
|
-
visibility: { variable: HAS_VARIANT_TITLE, visibleWhen: true }
|
|
5616
|
-
}
|
|
5617
|
-
];
|
|
5766
|
+
return [earnedText(HAS_VARIANT_TITLE, buildStyledText("{{variantTitle}}", settings.displaySettings?.variant))];
|
|
5618
5767
|
};
|
|
5619
5768
|
var detailBlock = (sections, horizontal, hasVariantTitleLine) => ({
|
|
5620
5769
|
alignment: { horizontal: horizontal ? "start" : "center", vertical: "top" },
|
|
@@ -5643,18 +5792,7 @@ var buildDescription = (settings) => {
|
|
|
5643
5792
|
},
|
|
5644
5793
|
{
|
|
5645
5794
|
content: { en: buildStyledText("{{productDescription}}", void 0) },
|
|
5646
|
-
mutators:
|
|
5647
|
-
{
|
|
5648
|
-
effect: "set_false",
|
|
5649
|
-
variable: HAS_DESCRIPTION,
|
|
5650
|
-
when: { operator: "is_empty", type: "content" }
|
|
5651
|
-
},
|
|
5652
|
-
{
|
|
5653
|
-
effect: "set_true",
|
|
5654
|
-
variable: HAS_DESCRIPTION,
|
|
5655
|
-
when: { operator: "is_not_empty", type: "content" }
|
|
5656
|
-
}
|
|
5657
|
-
],
|
|
5795
|
+
mutators: earnedFrom(HAS_DESCRIPTION),
|
|
5658
5796
|
sectionType: "text",
|
|
5659
5797
|
visibility: { variable: SHOW_DESCRIPTION, visibleWhen: true }
|
|
5660
5798
|
}
|
|
@@ -5670,7 +5808,7 @@ var buildDescription = (settings) => {
|
|
|
5670
5808
|
var SHOW_VARIANTS = "showVariants";
|
|
5671
5809
|
var REVEAL_PENDING = "revealPending";
|
|
5672
5810
|
var revealsVariants = (settings) => settings.viewOptions?.displayActions !== false && settings.productOptions?.showVariantOptions === "default";
|
|
5673
|
-
var
|
|
5811
|
+
var contentMutator2 = (effect, variable, operator) => ({
|
|
5674
5812
|
effect,
|
|
5675
5813
|
variable,
|
|
5676
5814
|
when: { operator, type: "content" }
|
|
@@ -5684,10 +5822,10 @@ var buildVariants = (settings) => {
|
|
|
5684
5822
|
hideOutOfStockVariants: !!settings.productOptions?.hideOutOfStockVariants,
|
|
5685
5823
|
...revealsVariants(settings) && {
|
|
5686
5824
|
mutators: [
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5825
|
+
contentMutator2("set_true", SHOW_VARIANTS, "is_empty"),
|
|
5826
|
+
contentMutator2("set_false", REVEAL_PENDING, "is_empty"),
|
|
5827
|
+
contentMutator2("set_true", REVEAL_PENDING, "is_not_empty"),
|
|
5828
|
+
contentMutator2("set_false", SHOW_VARIANTS, "is_not_empty")
|
|
5691
5829
|
]
|
|
5692
5830
|
},
|
|
5693
5831
|
...selector && { selector: VARIANT_SELECTOR[selector] },
|
|
@@ -5712,43 +5850,20 @@ var buildQuantityErrors = (quantity2) => {
|
|
|
5712
5850
|
var buildQuantity = (settings) => {
|
|
5713
5851
|
const quantity2 = settings.quantityInputs;
|
|
5714
5852
|
if (!quantity2?.enabled) return [];
|
|
5715
|
-
const
|
|
5716
|
-
const max = Math.min(Math.max(quantity2.maxValue ?? 10, 1), 100);
|
|
5717
|
-
const min = Math.min(Math.max(quantity2.minValue ?? 1, 1), max);
|
|
5718
|
-
return [
|
|
5719
|
-
{
|
|
5720
|
-
...buildQuantityErrors(quantity2),
|
|
5721
|
-
...inputType && { inputType },
|
|
5722
|
-
max,
|
|
5723
|
-
min,
|
|
5724
|
-
sectionType: "quantity"
|
|
5725
|
-
}
|
|
5726
|
-
];
|
|
5727
|
-
};
|
|
5728
|
-
var buildSubscriptionButton = (settings) => {
|
|
5729
|
-
if (settings.productType !== "both" && settings.productType !== "subscription") return [];
|
|
5730
|
-
const language3 = settings.language;
|
|
5731
|
-
const slot = (buttonField, override) => ({
|
|
5732
|
-
buttonField,
|
|
5733
|
-
content: localizedContent(SWITCH_LABELS[buttonField], override, SWITCH_LABEL_TOKENS),
|
|
5734
|
-
sectionType: "text"
|
|
5735
|
-
});
|
|
5853
|
+
const errors = buildQuantityErrors(quantity2);
|
|
5736
5854
|
return [
|
|
5737
|
-
{
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
slot("subscriptionOption", void 0),
|
|
5744
|
-
slot("switchToOneTimePurchase", language3?.cartSwitchToOnetime),
|
|
5745
|
-
slot("switchToSubscriptionNoDiscount", language3?.upgradeToSubscription),
|
|
5746
|
-
slot("switchToSubscriptionWithDiscount", language3?.upgradeToSubscription)
|
|
5747
|
-
],
|
|
5748
|
-
sectionType: "button"
|
|
5749
|
-
}
|
|
5855
|
+
quantitySection({
|
|
5856
|
+
...errors,
|
|
5857
|
+
inputType: quantity2.type ? QUANTITY_INPUT_TYPE[quantity2.type] : void 0,
|
|
5858
|
+
maxValue: quantity2.maxValue,
|
|
5859
|
+
minValue: quantity2.minValue
|
|
5860
|
+
})
|
|
5750
5861
|
];
|
|
5751
5862
|
};
|
|
5863
|
+
var buildSubscriptionButton = (settings) => subscriptionToggle(settings.productType, {
|
|
5864
|
+
oneTime: settings.language?.cartSwitchToOnetime,
|
|
5865
|
+
upgrade: settings.language?.upgradeToSubscription
|
|
5866
|
+
});
|
|
5752
5867
|
var BUTTON_KINDS = ["plain", "primary", "secondary"];
|
|
5753
5868
|
var buttonKind = (settings) => {
|
|
5754
5869
|
const kind = settings.button?.kind;
|
|
@@ -5794,7 +5909,7 @@ var buildOfferCard = (settings, horizontal) => {
|
|
|
5794
5909
|
const image = buildImage(settings);
|
|
5795
5910
|
const title = buildTitle(settings);
|
|
5796
5911
|
const variantTitle = buildVariantTitle(settings);
|
|
5797
|
-
const price =
|
|
5912
|
+
const price = priceText();
|
|
5798
5913
|
const description = buildDescription(settings);
|
|
5799
5914
|
const reviews = buildReviews(settings);
|
|
5800
5915
|
const variants = buildVariants(settings);
|
|
@@ -6096,7 +6211,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
6096
6211
|
|
|
6097
6212
|
// src/pricing/postPurchaseChangeset.ts
|
|
6098
6213
|
var postPurchaseChangeset = (prepared) => {
|
|
6099
|
-
const { selection:
|
|
6214
|
+
const { selection: selection3, terms } = prepared;
|
|
6100
6215
|
const subscription = readPostPurchaseSubscription(prepared);
|
|
6101
6216
|
const { discount, shipping } = terms;
|
|
6102
6217
|
const changesetDiscount = discount.type === "none" ? void 0 : {
|
|
@@ -6111,21 +6226,21 @@ var postPurchaseChangeset = (prepared) => {
|
|
|
6111
6226
|
{
|
|
6112
6227
|
...changesetDiscount ? { discount: changesetDiscount } : {},
|
|
6113
6228
|
initialShippingPrice,
|
|
6114
|
-
quantity:
|
|
6229
|
+
quantity: selection3.quantity,
|
|
6115
6230
|
recurringShippingPrice,
|
|
6116
6231
|
sellingPlanId: subscription.selection.sellingPlanId,
|
|
6117
6232
|
shippingOption,
|
|
6118
6233
|
type: "add_subscription",
|
|
6119
|
-
variantId:
|
|
6234
|
+
variantId: selection3.variantId
|
|
6120
6235
|
}
|
|
6121
6236
|
]
|
|
6122
6237
|
});
|
|
6123
6238
|
}
|
|
6124
6239
|
const changes = [
|
|
6125
6240
|
{
|
|
6126
|
-
quantity:
|
|
6241
|
+
quantity: selection3.quantity,
|
|
6127
6242
|
type: "add_variant",
|
|
6128
|
-
variantId:
|
|
6243
|
+
variantId: selection3.variantId,
|
|
6129
6244
|
...changesetDiscount && changesetDiscount.value > 0 ? { discount: changesetDiscount } : {}
|
|
6130
6245
|
}
|
|
6131
6246
|
];
|
|
@@ -6207,29 +6322,87 @@ var postPurchaseCosts = (prepared, response, currencyCode) => {
|
|
|
6207
6322
|
});
|
|
6208
6323
|
};
|
|
6209
6324
|
|
|
6325
|
+
// src/pricing/postPurchaseReduction.ts
|
|
6326
|
+
var reducePostPurchaseMinor = (priceMinor, { amount: amount2, type }, decimals) => {
|
|
6327
|
+
if (type === "price") return amountToCents2(amount2, decimals);
|
|
6328
|
+
const reduction = type === "percentage" ? Math.round(priceMinor * (amount2 / 100)) : type === "fixed_amount" ? amountToCents2(amount2, decimals) : 0;
|
|
6329
|
+
return Math.max(0, priceMinor - reduction);
|
|
6330
|
+
};
|
|
6331
|
+
|
|
6332
|
+
// src/pricing/postPurchaseDisplayFacts.ts
|
|
6333
|
+
var wholePercent = (savingMinor, struckMinor) => {
|
|
6334
|
+
const percent = savingMinor / struckMinor * 100;
|
|
6335
|
+
return Math.round(percent.toString().length > 5 ? Number(percent.toFixed(2)) : percent);
|
|
6336
|
+
};
|
|
6337
|
+
var postPurchaseDisplayPricing = ({
|
|
6338
|
+
compareAtPrice,
|
|
6339
|
+
currencyCode,
|
|
6340
|
+
discount,
|
|
6341
|
+
discountedFrom,
|
|
6342
|
+
plan,
|
|
6343
|
+
price
|
|
6344
|
+
}) => {
|
|
6345
|
+
const decimals = currencyDecimals(currencyCode);
|
|
6346
|
+
const regularMinor = amountToCents2(price, decimals);
|
|
6347
|
+
const compareAtMinor = amountToCents2(compareAtPrice, decimals);
|
|
6348
|
+
const fromCompareAt = discountedFrom === "compare_at_price" || discount.type === "none" && !plan;
|
|
6349
|
+
const comparisonMinor = fromCompareAt && compareAtMinor > regularMinor ? compareAtMinor : regularMinor;
|
|
6350
|
+
const planMinor = plan ? reducePostPurchaseMinor(regularMinor, plan, decimals) : regularMinor;
|
|
6351
|
+
const priceMinor = reducePostPurchaseMinor(planMinor, discount, decimals);
|
|
6352
|
+
const savingMinor = Math.max(0, comparisonMinor - priceMinor);
|
|
6353
|
+
return {
|
|
6354
|
+
comparisonMinor,
|
|
6355
|
+
priceMinor,
|
|
6356
|
+
savingMinor,
|
|
6357
|
+
savingPercent: savingMinor && wholePercent(savingMinor, comparisonMinor)
|
|
6358
|
+
};
|
|
6359
|
+
};
|
|
6360
|
+
var postPurchaseDisplayFacts = (input) => {
|
|
6361
|
+
const { comparisonMinor, priceMinor, savingMinor, savingPercent } = postPurchaseDisplayPricing(input);
|
|
6362
|
+
const percentPlan = input.plan?.type === "fixed_amount" || input.plan?.type === "price";
|
|
6363
|
+
return {
|
|
6364
|
+
currencyCode: input.currencyCode,
|
|
6365
|
+
savingFormat: !percentPlan && input.discount.type === "fixed_amount" ? "amount" : "percent",
|
|
6366
|
+
savingMinor,
|
|
6367
|
+
savingPercent,
|
|
6368
|
+
variantCompareAtPriceMinor: savingMinor > 0 ? comparisonMinor : null,
|
|
6369
|
+
variantPriceMinor: priceMinor
|
|
6370
|
+
};
|
|
6371
|
+
};
|
|
6372
|
+
|
|
6210
6373
|
// src/pricing/postPurchaseSubscriptionDisplay.ts
|
|
6211
6374
|
var postPurchaseSubscriptionDisplay = (prepared, currencyCode) => {
|
|
6212
6375
|
const subscription = readPostPurchaseSubscription(prepared);
|
|
6213
6376
|
if (!subscription) return void 0;
|
|
6214
|
-
const
|
|
6215
|
-
const variant2 = subscription.product.variant;
|
|
6216
|
-
const regular = amountToCents2(variant2.price, decimals);
|
|
6217
|
-
const compareAt = amountToCents2(variant2.compareAtPrice, decimals);
|
|
6218
|
-
const comparisonMinor = subscription.display.discountedFrom === "compare_at_price" && compareAt > regular ? compareAt : regular;
|
|
6219
|
-
const adjustment = subscription.terms.subscription.adjustment;
|
|
6220
|
-
const reduce = (price, discount) => {
|
|
6221
|
-
const reduction = discount.type === "percentage" ? Math.round(price * discount.amount / 100) : discount.type === "fixed_amount" ? amountToCents2(discount.amount, decimals) : 0;
|
|
6222
|
-
return Math.max(0, price - reduction);
|
|
6223
|
-
};
|
|
6224
|
-
const planPrice = adjustment?.type === "price" ? amountToCents2(adjustment.amount, decimals) : adjustment ? reduce(regular, { amount: adjustment.amount, type: adjustment.type }) : regular;
|
|
6225
|
-
const priceMinor = reduce(planPrice, subscription.terms.discount);
|
|
6226
|
-
const savingMinor = Math.max(0, comparisonMinor - priceMinor);
|
|
6377
|
+
const { compareAtPrice, price } = subscription.product.variant;
|
|
6227
6378
|
return PostPurchaseSubscriptionDisplay.parse({
|
|
6228
|
-
|
|
6379
|
+
...postPurchaseDisplayPricing({
|
|
6380
|
+
compareAtPrice,
|
|
6381
|
+
currencyCode,
|
|
6382
|
+
discount: subscription.terms.discount,
|
|
6383
|
+
discountedFrom: subscription.display.discountedFrom,
|
|
6384
|
+
plan: subscription.terms.subscription.adjustment,
|
|
6385
|
+
price
|
|
6386
|
+
}),
|
|
6387
|
+
currencyCode
|
|
6388
|
+
});
|
|
6389
|
+
};
|
|
6390
|
+
|
|
6391
|
+
// src/pricing/postPurchaseDisplayPrice.ts
|
|
6392
|
+
var postPurchaseDisplayPrice = (prepared, currencyCode) => {
|
|
6393
|
+
const subscription = readPostPurchaseSubscription(prepared);
|
|
6394
|
+
const { compareAtPrice, price } = prepared.product.variant;
|
|
6395
|
+
const facts = postPurchaseDisplayFacts({
|
|
6396
|
+
compareAtPrice,
|
|
6229
6397
|
currencyCode,
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6398
|
+
discount: prepared.terms.discount,
|
|
6399
|
+
discountedFrom: prepared.display.discountedFrom,
|
|
6400
|
+
plan: subscription?.terms.subscription.adjustment,
|
|
6401
|
+
price
|
|
6402
|
+
});
|
|
6403
|
+
return PostPurchaseDisplayPrice.parse({
|
|
6404
|
+
...facts,
|
|
6405
|
+
...subscription && { subscriptionUnit: postPurchaseSubscriptionDisplay(subscription, currencyCode) }
|
|
6233
6406
|
});
|
|
6234
6407
|
};
|
|
6235
6408
|
export {
|
|
@@ -6269,6 +6442,7 @@ export {
|
|
|
6269
6442
|
CABExperiment,
|
|
6270
6443
|
CABImageSection,
|
|
6271
6444
|
CABImageSectionFields,
|
|
6445
|
+
CABImageThumbnails,
|
|
6272
6446
|
CABIntegrations,
|
|
6273
6447
|
CABLayoutSection,
|
|
6274
6448
|
CABLayoutWrapping,
|
|
@@ -6396,6 +6570,7 @@ export {
|
|
|
6396
6570
|
PostPurchaseCollectionChoice,
|
|
6397
6571
|
PostPurchaseCommonReviewRating,
|
|
6398
6572
|
PostPurchaseDiscount,
|
|
6573
|
+
PostPurchaseDisplayPrice,
|
|
6399
6574
|
PostPurchaseExcludedProductIds,
|
|
6400
6575
|
PostPurchaseGroupCatalog,
|
|
6401
6576
|
PostPurchaseGroupChoice,
|
|
@@ -6467,6 +6642,7 @@ export {
|
|
|
6467
6642
|
ProgressTierExclusionType,
|
|
6468
6643
|
ProgressTierType,
|
|
6469
6644
|
ProgressTierUnit,
|
|
6645
|
+
PurchaseAdmissionModeSchema,
|
|
6470
6646
|
PurchaseAnalyticsRequestSchema,
|
|
6471
6647
|
PurchaseAnalyticsResponseSchema,
|
|
6472
6648
|
PurchaseAnalyticsStatusSchema,
|
|
@@ -6543,11 +6719,17 @@ export {
|
|
|
6543
6719
|
TiptapParagraph,
|
|
6544
6720
|
TiptapText,
|
|
6545
6721
|
UI_LABELS,
|
|
6722
|
+
UpgradeCompensationProgressSchema,
|
|
6723
|
+
UpgradeProgressSchema,
|
|
6724
|
+
UpgradeRefundProgressSchema,
|
|
6725
|
+
UpgradeReviewProgressSchema,
|
|
6726
|
+
UpgradeReviewReasonSchema,
|
|
6546
6727
|
UserConfig,
|
|
6547
6728
|
VariableEffect,
|
|
6548
6729
|
VariableType,
|
|
6549
6730
|
VariantMode,
|
|
6550
6731
|
VariantSelector,
|
|
6732
|
+
VariantsMode,
|
|
6551
6733
|
VerticalAlignment,
|
|
6552
6734
|
WidgetData,
|
|
6553
6735
|
WidgetType,
|
|
@@ -6626,6 +6808,7 @@ export {
|
|
|
6626
6808
|
popoverPositions,
|
|
6627
6809
|
postPurchaseChangeset,
|
|
6628
6810
|
postPurchaseCosts,
|
|
6811
|
+
postPurchaseDisplayPrice,
|
|
6629
6812
|
postPurchaseHealthTaskId,
|
|
6630
6813
|
postPurchaseSubscriptionDisplay,
|
|
6631
6814
|
postPurchaseTaskNameSchema,
|
|
@@ -6664,6 +6847,7 @@ export {
|
|
|
6664
6847
|
variantModes,
|
|
6665
6848
|
variantPriceObject,
|
|
6666
6849
|
variantSelectors,
|
|
6850
|
+
variantsModes,
|
|
6667
6851
|
verticalAlignments,
|
|
6668
6852
|
widgetTypes
|
|
6669
6853
|
};
|