@rebuy/rebuy 3.42.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 +899 -781
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +899 -781
- 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 +1 -0
- package/dist/schema/postPurchaseDisplayPrice.d.ts +31 -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 +24 -0
- package/dist/schema/postPurchaseProductView.d.ts +26 -1
- package/dist/schema/postPurchaseSubscriptionProduct.d.ts +2 -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 +1653 -1364
- package/dist/server/index.mjs +1575 -1286
- package/dist/server/postPurchasePlanCatalog.d.ts +4 -1
- package/dist/server/preparePostPurchaseAdmissionView.d.ts +21 -0
- package/dist/server/preparePostPurchaseCollectionGroup.d.ts +25 -0
- package/dist/server/preparePostPurchaseCollectionView.d.ts +21 -0
- package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +21 -0
- package/dist/server/preparePostPurchaseGroupDefault.d.ts +21 -0
- package/dist/server/preparePostPurchaseGroupView.d.ts +21 -0
- package/dist/server/preparePostPurchaseMemberView.d.ts +63 -0
- package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +21 -0
- package/dist/server/preparePostPurchaseQuantityView.d.ts +21 -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,
|
|
@@ -2528,6 +2531,8 @@ import { z as z29 } from "zod";
|
|
|
2528
2531
|
import { z as z28 } from "zod";
|
|
2529
2532
|
var PostPurchasePlanOption = z28.object({
|
|
2530
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(),
|
|
2531
2536
|
id: z28.number().int().positive(),
|
|
2532
2537
|
intervalFrequency: z28.string().regex(/^[1-9]\d*$/).optional(),
|
|
2533
2538
|
intervalLabel: z28.string().min(1),
|
|
@@ -2647,85 +2652,120 @@ var OfferDeclineResponseSchema = z34.object({
|
|
|
2647
2652
|
successful: z34.literal(true)
|
|
2648
2653
|
});
|
|
2649
2654
|
|
|
2650
|
-
// src/schema/
|
|
2655
|
+
// src/schema/postPurchaseDisplayPrice.ts
|
|
2656
|
+
import { z as z36 } from "zod";
|
|
2657
|
+
|
|
2658
|
+
// src/schema/postPurchaseSubscriptionDisplay.ts
|
|
2651
2659
|
import { z as z35 } from "zod";
|
|
2652
|
-
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"]);
|
|
2653
2693
|
|
|
2654
2694
|
// src/schema/postPurchaseExitPolicy.ts
|
|
2655
|
-
import { z as
|
|
2695
|
+
import { z as z38 } from "zod";
|
|
2656
2696
|
var EXIT_DELAY_MAX_MS = 60 * 60 * 1e3;
|
|
2657
|
-
var ExitPolicySchema =
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
delayMs:
|
|
2661
|
-
source:
|
|
2662
|
-
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")
|
|
2663
2703
|
})
|
|
2664
2704
|
]);
|
|
2665
2705
|
|
|
2666
2706
|
// src/schema/postPurchaseFinish.ts
|
|
2667
|
-
import { z as
|
|
2707
|
+
import { z as z45 } from "zod";
|
|
2668
2708
|
|
|
2669
2709
|
// src/schema/postPurchaseFollowups.ts
|
|
2670
|
-
import { z as
|
|
2710
|
+
import { z as z43 } from "zod";
|
|
2671
2711
|
|
|
2672
2712
|
// src/schema/postPurchaseHealthProgress.ts
|
|
2673
|
-
import { z as
|
|
2713
|
+
import { z as z40 } from "zod";
|
|
2674
2714
|
|
|
2675
2715
|
// src/schema/postPurchaseReleaseAuthority.ts
|
|
2676
|
-
import { z as
|
|
2677
|
-
var PostPurchaseSessionIdSchema =
|
|
2678
|
-
var ReleaseOwnerSchema =
|
|
2679
|
-
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({
|
|
2680
2720
|
orderId: PostPurchaseOrderIdSchema,
|
|
2681
2721
|
shop: ShopifyDomainSchema
|
|
2682
2722
|
});
|
|
2683
|
-
var ReadyReleaseAuthoritySchema =
|
|
2723
|
+
var ReadyReleaseAuthoritySchema = z39.object({
|
|
2684
2724
|
deadline: PostPurchaseTimestampSchema,
|
|
2685
2725
|
releaseOwner: ReleaseOwnerSchema,
|
|
2686
2726
|
sessionId: PostPurchaseSessionIdSchema,
|
|
2687
|
-
status:
|
|
2727
|
+
status: z39.literal("ready")
|
|
2688
2728
|
});
|
|
2689
|
-
var PendingReleaseAuthoritySchema =
|
|
2690
|
-
var ReleaseAuthorityResponseSchema =
|
|
2691
|
-
data:
|
|
2692
|
-
|
|
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") }),
|
|
2693
2733
|
PendingReleaseAuthoritySchema,
|
|
2694
2734
|
ReadyReleaseAuthoritySchema
|
|
2695
2735
|
]),
|
|
2696
|
-
successful:
|
|
2736
|
+
successful: z39.literal(true)
|
|
2697
2737
|
});
|
|
2698
2738
|
|
|
2699
2739
|
// src/schema/postPurchaseHealthProgress.ts
|
|
2700
|
-
var HealthScheduleSchema =
|
|
2740
|
+
var HealthScheduleSchema = z40.strictObject({
|
|
2701
2741
|
checkoutToken: DecideRequestSchema.shape.checkoutToken,
|
|
2702
2742
|
healthScheduledAt: PostPurchaseTimestampSchema,
|
|
2703
2743
|
operationId: PurchaseReceiptSchema.shape.operationId.regex(/^[a-f0-9-]{36}$/),
|
|
2704
2744
|
orderId: PostPurchaseOrderIdSchema,
|
|
2705
|
-
removePartialOrder:
|
|
2745
|
+
removePartialOrder: z40.boolean(),
|
|
2706
2746
|
sessionId: PostPurchaseSessionIdSchema,
|
|
2707
2747
|
shop: DecideRequestSchema.shape.shop
|
|
2708
2748
|
});
|
|
2709
|
-
var HealthSchedulingResponseSchema =
|
|
2710
|
-
data:
|
|
2711
|
-
callbackStatus:
|
|
2749
|
+
var HealthSchedulingResponseSchema = z40.object({
|
|
2750
|
+
data: z40.object({
|
|
2751
|
+
callbackStatus: z40.enum(["pending", "attempted", "returned", "unknown"]),
|
|
2712
2752
|
facts: HealthScheduleSchema,
|
|
2713
|
-
scheduling:
|
|
2714
|
-
|
|
2715
|
-
|
|
2753
|
+
scheduling: z40.union([
|
|
2754
|
+
z40.strictObject({ recordedAt: PostPurchaseTimestampSchema, status: z40.literal("verified") }),
|
|
2755
|
+
z40.strictObject({ status: z40.enum(["unavailable", "unverified"]) })
|
|
2716
2756
|
])
|
|
2717
2757
|
}),
|
|
2718
|
-
successful:
|
|
2758
|
+
successful: z40.literal(true)
|
|
2719
2759
|
});
|
|
2720
2760
|
|
|
2721
2761
|
// src/schema/postPurchaseObservation.ts
|
|
2722
|
-
import { z as
|
|
2723
|
-
var PurchaseObservationSchema =
|
|
2724
|
-
|
|
2725
|
-
changesetApplicationsRemaining:
|
|
2726
|
-
errors:
|
|
2727
|
-
|
|
2728
|
-
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([
|
|
2729
2769
|
"payment_required",
|
|
2730
2770
|
"insufficient_inventory",
|
|
2731
2771
|
"changeset_already_applied",
|
|
@@ -2739,41 +2779,41 @@ var PurchaseObservationSchema = z39.union([
|
|
|
2739
2779
|
"subscription_limit_error",
|
|
2740
2780
|
"order_released_error"
|
|
2741
2781
|
]),
|
|
2742
|
-
message:
|
|
2782
|
+
message: z41.string()
|
|
2743
2783
|
}).strict()
|
|
2744
2784
|
),
|
|
2745
|
-
status:
|
|
2785
|
+
status: z41.enum(["processed", "partially_processed", "unprocessed"])
|
|
2746
2786
|
}).strict(),
|
|
2747
|
-
|
|
2787
|
+
z41.object({ reason: z41.literal("application-error"), status: z41.literal("unknown") }).strict()
|
|
2748
2788
|
]);
|
|
2749
|
-
var RecordedPurchaseObservationSchema =
|
|
2789
|
+
var RecordedPurchaseObservationSchema = z41.object({
|
|
2750
2790
|
observation: PurchaseObservationSchema,
|
|
2751
2791
|
recordedAt: PostPurchaseTimestampSchema
|
|
2752
2792
|
}).strict();
|
|
2753
2793
|
var PurchaseObservationRequestSchema = DecideRequestSchema.extend({
|
|
2754
2794
|
observation: PurchaseObservationSchema,
|
|
2755
|
-
operationId:
|
|
2795
|
+
operationId: z41.uuid()
|
|
2756
2796
|
}).strict();
|
|
2757
|
-
var PurchaseObservationResponseSchema =
|
|
2758
|
-
data: RecordedPurchaseObservationSchema.extend({ operationId:
|
|
2759
|
-
successful:
|
|
2797
|
+
var PurchaseObservationResponseSchema = z41.object({
|
|
2798
|
+
data: RecordedPurchaseObservationSchema.extend({ operationId: z41.uuid() }),
|
|
2799
|
+
successful: z41.literal(true)
|
|
2760
2800
|
});
|
|
2761
2801
|
|
|
2762
2802
|
// src/schema/postPurchaseUpgrade.ts
|
|
2763
|
-
import { z as
|
|
2764
|
-
var AttemptSchema2 =
|
|
2803
|
+
import { z as z42 } from "zod";
|
|
2804
|
+
var AttemptSchema2 = z42.strictObject({ attemptedAt: PostPurchaseTimestampSchema, status: z42.literal("attempted") });
|
|
2765
2805
|
var FinishedSchema = AttemptSchema2.extend({ finishedAt: PostPurchaseTimestampSchema });
|
|
2766
|
-
var UpgradeRefundProgressSchema =
|
|
2806
|
+
var UpgradeRefundProgressSchema = z42.union([
|
|
2767
2807
|
AttemptSchema2,
|
|
2768
|
-
FinishedSchema.extend({ refundId:
|
|
2769
|
-
FinishedSchema.extend({ status:
|
|
2808
|
+
FinishedSchema.extend({ refundId: z42.string().min(1), status: z42.literal("refunded") }),
|
|
2809
|
+
FinishedSchema.extend({ status: z42.enum(["failed", "unknown"]) })
|
|
2770
2810
|
]);
|
|
2771
|
-
var UpgradeCompensationProgressSchema =
|
|
2811
|
+
var UpgradeCompensationProgressSchema = z42.union([
|
|
2772
2812
|
AttemptSchema2,
|
|
2773
|
-
FinishedSchema.extend({ status:
|
|
2813
|
+
FinishedSchema.extend({ status: z42.enum(["removed", "failed", "unknown"]) })
|
|
2774
2814
|
]);
|
|
2775
|
-
var UpgradeReviewReasonSchema =
|
|
2776
|
-
var UpgradeReviewProgressSchema =
|
|
2815
|
+
var UpgradeReviewReasonSchema = z42.enum(["refund-unknown", "compensation-failed", "compensation-unknown"]);
|
|
2816
|
+
var UpgradeReviewProgressSchema = z42.strictObject({
|
|
2777
2817
|
markedAt: PostPurchaseTimestampSchema,
|
|
2778
2818
|
marker: AcceptedMetafieldResultSchema.shape.status,
|
|
2779
2819
|
reason: UpgradeReviewReasonSchema
|
|
@@ -2784,7 +2824,7 @@ var reviewReason = (refund, compensation) => {
|
|
|
2784
2824
|
return `compensation-${compensation.status}`;
|
|
2785
2825
|
return null;
|
|
2786
2826
|
};
|
|
2787
|
-
var UpgradeProgressSchema =
|
|
2827
|
+
var UpgradeProgressSchema = z42.strictObject({
|
|
2788
2828
|
compensation: UpgradeCompensationProgressSchema.nullable(),
|
|
2789
2829
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
2790
2830
|
refund: UpgradeRefundProgressSchema.nullable(),
|
|
@@ -2798,15 +2838,15 @@ var UpgradeProgressSchema = z40.strictObject({
|
|
|
2798
2838
|
);
|
|
2799
2839
|
|
|
2800
2840
|
// src/schema/postPurchaseFollowups.ts
|
|
2801
|
-
var RequiredHealthSchema =
|
|
2841
|
+
var RequiredHealthSchema = z43.union([
|
|
2802
2842
|
HealthSchedulingResponseSchema.shape.data,
|
|
2803
|
-
|
|
2843
|
+
z43.strictObject({ status: z43.literal("unavailable") })
|
|
2804
2844
|
]);
|
|
2805
|
-
var AcceptedFollowupsResponseSchema =
|
|
2806
|
-
data:
|
|
2807
|
-
acceptedEvent:
|
|
2845
|
+
var AcceptedFollowupsResponseSchema = z43.object({
|
|
2846
|
+
data: z43.object({
|
|
2847
|
+
acceptedEvent: z43.union([
|
|
2808
2848
|
AcceptedEventResponseSchema.shape.data,
|
|
2809
|
-
|
|
2849
|
+
z43.strictObject({ status: z43.literal("unavailable") })
|
|
2810
2850
|
]),
|
|
2811
2851
|
acceptedMetafield: AcceptedMetafieldResultSchema,
|
|
2812
2852
|
health: RequiredHealthSchema,
|
|
@@ -2817,48 +2857,48 @@ var AcceptedFollowupsResponseSchema = z41.object({
|
|
|
2817
2857
|
message: "Upgrade progress belongs to its operation",
|
|
2818
2858
|
path: ["upgrade", "operationId"]
|
|
2819
2859
|
}),
|
|
2820
|
-
successful:
|
|
2860
|
+
successful: z43.literal(true)
|
|
2821
2861
|
});
|
|
2822
2862
|
|
|
2823
2863
|
// src/schema/postPurchaseSessionClose.ts
|
|
2824
|
-
import { z as
|
|
2825
|
-
var SessionClosureSchema =
|
|
2864
|
+
import { z as z44 } from "zod";
|
|
2865
|
+
var SessionClosureSchema = z44.object({ closedAt: PostPurchaseTimestampSchema, status: z44.literal("closed") });
|
|
2826
2866
|
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
2827
|
-
var SessionCloseResponseSchema =
|
|
2867
|
+
var SessionCloseResponseSchema = z44.object({ data: SessionClosureSchema, successful: z44.literal(true) });
|
|
2828
2868
|
|
|
2829
2869
|
// src/schema/postPurchaseFinish.ts
|
|
2830
|
-
var FinishedPurchaseSchema =
|
|
2831
|
-
|
|
2832
|
-
|
|
2870
|
+
var FinishedPurchaseSchema = z45.union([
|
|
2871
|
+
z45.strictObject({ status: z45.literal("none") }),
|
|
2872
|
+
z45.strictObject({
|
|
2833
2873
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
2834
|
-
status:
|
|
2835
|
-
|
|
2874
|
+
status: z45.union([
|
|
2875
|
+
z45.literal("pending"),
|
|
2836
2876
|
...PurchaseObservationSchema.options.map((option) => option.shape.status)
|
|
2837
2877
|
])
|
|
2838
2878
|
})
|
|
2839
2879
|
]);
|
|
2840
2880
|
var SessionFinishRequestSchema = DecideRequestSchema.strict();
|
|
2841
|
-
var SessionFinishResponseSchema =
|
|
2881
|
+
var SessionFinishResponseSchema = z45.object({
|
|
2842
2882
|
data: SessionClosureSchema.extend({
|
|
2843
2883
|
classification: ClassificationProgressSchema,
|
|
2844
2884
|
exitPolicy: ExitPolicySchema,
|
|
2845
2885
|
health: RequiredHealthSchema.nullable(),
|
|
2846
2886
|
purchase: FinishedPurchaseSchema
|
|
2847
2887
|
}),
|
|
2848
|
-
successful:
|
|
2888
|
+
successful: z45.literal(true)
|
|
2849
2889
|
});
|
|
2850
2890
|
|
|
2851
2891
|
// src/schema/postPurchaseQuantity.ts
|
|
2852
|
-
import { z as
|
|
2892
|
+
import { z as z69 } from "zod";
|
|
2853
2893
|
|
|
2854
2894
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
2855
|
-
import { z as
|
|
2895
|
+
import { z as z68 } from "zod";
|
|
2856
2896
|
|
|
2857
2897
|
// src/schema/postPurchaseProductView.ts
|
|
2858
|
-
import { z as
|
|
2898
|
+
import { z as z67 } from "zod";
|
|
2859
2899
|
|
|
2860
2900
|
// src/schema/postPurchaseGroupCatalog.ts
|
|
2861
|
-
import { z as
|
|
2901
|
+
import { z as z46 } from "zod";
|
|
2862
2902
|
var productId = PreparedPostPurchaseProduct.shape.selection.shape.productId;
|
|
2863
2903
|
var source = PostPurchaseProductSource.shape.data.element;
|
|
2864
2904
|
var PostPurchaseGroupDescription = source.pick({ description: true, id: true, image: true, images: true, title: true }).extend({
|
|
@@ -2866,17 +2906,17 @@ var PostPurchaseGroupDescription = source.pick({ description: true, id: true, im
|
|
|
2866
2906
|
image: source.shape.image.default(null),
|
|
2867
2907
|
options: PostPurchaseVariantCatalog.shape.options.default([])
|
|
2868
2908
|
});
|
|
2869
|
-
var PostPurchaseGroupCatalog =
|
|
2909
|
+
var PostPurchaseGroupCatalog = z46.object({
|
|
2870
2910
|
memberProductId: productId,
|
|
2871
|
-
options:
|
|
2911
|
+
options: z46.array(z46.object({ productId, title: z46.string(), variantCatalog: PostPurchaseVariantCatalog }))
|
|
2872
2912
|
});
|
|
2873
|
-
var PostPurchaseGroupSelection =
|
|
2913
|
+
var PostPurchaseGroupSelection = z46.object({
|
|
2874
2914
|
memberProductId: productId,
|
|
2875
2915
|
productId
|
|
2876
2916
|
});
|
|
2877
2917
|
|
|
2878
2918
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2879
|
-
import { z as
|
|
2919
|
+
import { z as z66 } from "zod";
|
|
2880
2920
|
|
|
2881
2921
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
2882
2922
|
import { uniqBy } from "es-toolkit";
|
|
@@ -2931,18 +2971,18 @@ var targetAreas = {
|
|
|
2931
2971
|
|
|
2932
2972
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
2933
2973
|
import { v7 as uuidv713 } from "uuid";
|
|
2934
|
-
import { z as
|
|
2974
|
+
import { z as z65 } from "zod";
|
|
2935
2975
|
|
|
2936
2976
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
2937
|
-
import { z as
|
|
2977
|
+
import { z as z64 } from "zod";
|
|
2938
2978
|
|
|
2939
2979
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
2940
|
-
import { z as
|
|
2941
|
-
var CABBannerSection =
|
|
2980
|
+
import { z as z47 } from "zod";
|
|
2981
|
+
var CABBannerSection = z47.lazy(
|
|
2942
2982
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2943
|
-
buttonField:
|
|
2944
|
-
color:
|
|
2945
|
-
dismissible:
|
|
2983
|
+
buttonField: z47.enum(buttonFields).optional(),
|
|
2984
|
+
color: z47.enum(bannerColors).default("info"),
|
|
2985
|
+
dismissible: z47.boolean().default(true),
|
|
2946
2986
|
/**
|
|
2947
2987
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
2948
2988
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -2958,18 +2998,18 @@ var CABBannerSection = z45.lazy(
|
|
|
2958
2998
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
2959
2999
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
2960
3000
|
*/
|
|
2961
|
-
heading:
|
|
2962
|
-
sectionType:
|
|
3001
|
+
heading: z47.record(z47.string(), z47.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
3002
|
+
sectionType: z47.literal(SectionType.banner).default(SectionType.banner)
|
|
2963
3003
|
})
|
|
2964
3004
|
);
|
|
2965
3005
|
|
|
2966
3006
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
2967
3007
|
import { v7 as uuidv73 } from "uuid";
|
|
2968
|
-
import { z as
|
|
3008
|
+
import { z as z50 } from "zod";
|
|
2969
3009
|
|
|
2970
3010
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
2971
3011
|
import { v7 as uuidv72 } from "uuid";
|
|
2972
|
-
import { z as
|
|
3012
|
+
import { z as z49 } from "zod";
|
|
2973
3013
|
|
|
2974
3014
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
2975
3015
|
var iconNames = [
|
|
@@ -3055,18 +3095,25 @@ var IconSize = freezeEnum(iconSizes);
|
|
|
3055
3095
|
var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "warning"];
|
|
3056
3096
|
var IconTone = freezeEnum(iconTones);
|
|
3057
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
|
+
|
|
3058
3105
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
3059
|
-
var CABImageSectionFields =
|
|
3106
|
+
var CABImageSectionFields = z49.object({
|
|
3060
3107
|
...CABVariableFields,
|
|
3061
|
-
altText:
|
|
3108
|
+
altText: z49.string().refine(checkForHTML, NO_HTML).default(""),
|
|
3062
3109
|
/**
|
|
3063
3110
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
3064
3111
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
3065
3112
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
3066
3113
|
*/
|
|
3067
|
-
aspectRatio:
|
|
3068
|
-
border:
|
|
3069
|
-
buttonField:
|
|
3114
|
+
aspectRatio: z49.number().positive().nullable().default(null),
|
|
3115
|
+
border: z49.lazy(() => CABBorder),
|
|
3116
|
+
buttonField: z49.enum(buttonFields).optional(),
|
|
3070
3117
|
/**
|
|
3071
3118
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
3072
3119
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -3085,29 +3132,30 @@ var CABImageSectionFields = z46.object({
|
|
|
3085
3132
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
3086
3133
|
* the risky half.
|
|
3087
3134
|
*/
|
|
3088
|
-
category:
|
|
3135
|
+
category: z49.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
3089
3136
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
3090
|
-
iconSize:
|
|
3137
|
+
iconSize: z49.enum(iconSizes).nullable().default(null),
|
|
3091
3138
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
3092
|
-
iconTone:
|
|
3093
|
-
name:
|
|
3094
|
-
naturalHeight:
|
|
3095
|
-
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),
|
|
3096
3143
|
/**
|
|
3097
3144
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
3098
3145
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
3099
3146
|
*/
|
|
3100
|
-
objectFit:
|
|
3101
|
-
sectionId:
|
|
3102
|
-
sectionType:
|
|
3147
|
+
objectFit: z49.enum(objectFits).default(ObjectFit.contain),
|
|
3148
|
+
sectionId: z49.uuid().default(() => uuidv72()),
|
|
3149
|
+
sectionType: z49.literal(SectionType.image).default(SectionType.image),
|
|
3103
3150
|
/**
|
|
3104
3151
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
3105
3152
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
3106
3153
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
3107
3154
|
* server-chosen tier icon actually needs it.
|
|
3108
3155
|
*/
|
|
3109
|
-
source:
|
|
3110
|
-
|
|
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)
|
|
3111
3159
|
});
|
|
3112
3160
|
var iconNameSet = new Set(iconNames);
|
|
3113
3161
|
var isIconName = (source2) => iconNameSet.has(source2);
|
|
@@ -3127,35 +3175,35 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source: sou
|
|
|
3127
3175
|
});
|
|
3128
3176
|
|
|
3129
3177
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
3130
|
-
var CABButtonContent =
|
|
3131
|
-
() =>
|
|
3178
|
+
var CABButtonContent = z50.lazy(
|
|
3179
|
+
() => z50.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
3132
3180
|
);
|
|
3133
|
-
var CABButtonSection =
|
|
3181
|
+
var CABButtonSection = z50.object({
|
|
3134
3182
|
...CABVariableFields,
|
|
3135
|
-
action:
|
|
3136
|
-
buttonStyle:
|
|
3137
|
-
custom:
|
|
3138
|
-
color:
|
|
3139
|
-
height:
|
|
3140
|
-
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)
|
|
3141
3189
|
}).default({
|
|
3142
3190
|
color: "#005bd3",
|
|
3143
3191
|
height: 52,
|
|
3144
3192
|
width: 300
|
|
3145
3193
|
}),
|
|
3146
|
-
disableDowngrade:
|
|
3147
|
-
name:
|
|
3148
|
-
optionId:
|
|
3149
|
-
popover:
|
|
3150
|
-
alignment:
|
|
3151
|
-
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)
|
|
3152
3200
|
}).optional().default(() => ({
|
|
3153
3201
|
alignment: TextAlignment.center,
|
|
3154
3202
|
position: PopoverPosition.blockStart
|
|
3155
3203
|
})),
|
|
3156
|
-
sectionId:
|
|
3157
|
-
sections:
|
|
3158
|
-
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),
|
|
3159
3207
|
/**
|
|
3160
3208
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
3161
3209
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -3170,96 +3218,96 @@ var CABButtonSection = z47.object({
|
|
|
3170
3218
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
3171
3219
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
3172
3220
|
*/
|
|
3173
|
-
tier:
|
|
3221
|
+
tier: z50.object({ tierId: z50.string().min(1) }).optional(),
|
|
3174
3222
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
3175
|
-
trackingUrl:
|
|
3223
|
+
trackingUrl: z50.string().optional(),
|
|
3176
3224
|
/**
|
|
3177
3225
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
3178
3226
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
3179
3227
|
*/
|
|
3180
|
-
variableEffects:
|
|
3228
|
+
variableEffects: z50.array(CABVariableEffect).optional()
|
|
3181
3229
|
});
|
|
3182
3230
|
|
|
3183
3231
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3184
|
-
import { z as
|
|
3232
|
+
import { z as z55 } from "zod";
|
|
3185
3233
|
|
|
3186
3234
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3187
|
-
import { z as
|
|
3235
|
+
import { z as z54 } from "zod";
|
|
3188
3236
|
|
|
3189
3237
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
3190
3238
|
import { v7 as uuidv74 } from "uuid";
|
|
3191
|
-
import { z as
|
|
3192
|
-
var CABDiscount =
|
|
3193
|
-
amount:
|
|
3194
|
-
discountedBy:
|
|
3195
|
-
discountedFrom:
|
|
3196
|
-
type:
|
|
3197
|
-
});
|
|
3198
|
-
var CABIntegrations =
|
|
3199
|
-
judgeme:
|
|
3200
|
-
junip:
|
|
3201
|
-
klaviyo:
|
|
3202
|
-
loox:
|
|
3203
|
-
okendo:
|
|
3204
|
-
opinew:
|
|
3205
|
-
reviewsio:
|
|
3206
|
-
stamped:
|
|
3207
|
-
yotpo:
|
|
3208
|
-
});
|
|
3209
|
-
var CABVariantLabels =
|
|
3210
|
-
variantOption:
|
|
3211
|
-
variantOptions:
|
|
3212
|
-
});
|
|
3213
|
-
var CABDataSourceSection =
|
|
3214
|
-
dataSourceId:
|
|
3215
|
-
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),
|
|
3216
3264
|
discount: CABDiscount.optional(),
|
|
3217
3265
|
integrations: CABIntegrations.optional(),
|
|
3218
|
-
limit:
|
|
3219
|
-
matchVariant:
|
|
3220
|
-
matchVariantOutOfStock:
|
|
3221
|
-
name:
|
|
3222
|
-
productType:
|
|
3223
|
-
sectionId:
|
|
3224
|
-
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),
|
|
3225
3273
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
3226
|
-
subscriptionIsDefault:
|
|
3227
|
-
treatAsGwp:
|
|
3274
|
+
subscriptionIsDefault: z51.boolean().default(false),
|
|
3275
|
+
treatAsGwp: z51.boolean().default(false),
|
|
3228
3276
|
variantLabels: CABVariantLabels.optional().catch(void 0)
|
|
3229
3277
|
});
|
|
3230
3278
|
|
|
3231
3279
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3232
3280
|
import { v7 as uuidv76 } from "uuid";
|
|
3233
|
-
import { z as
|
|
3281
|
+
import { z as z53 } from "zod";
|
|
3234
3282
|
|
|
3235
3283
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
3236
3284
|
import { v7 as uuidv75 } from "uuid";
|
|
3237
|
-
import { z as
|
|
3238
|
-
var CABVariantContent =
|
|
3239
|
-
() =>
|
|
3285
|
+
import { z as z52 } from "zod";
|
|
3286
|
+
var CABVariantContent = z52.lazy(
|
|
3287
|
+
() => z52.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
3240
3288
|
);
|
|
3241
|
-
var CABProductSection =
|
|
3289
|
+
var CABProductSection = z52.object({
|
|
3242
3290
|
...CABVariableFields,
|
|
3243
|
-
name:
|
|
3244
|
-
productId:
|
|
3245
|
-
sectionId:
|
|
3246
|
-
sections:
|
|
3247
|
-
sectionType:
|
|
3248
|
-
selectors:
|
|
3249
|
-
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)
|
|
3250
3298
|
});
|
|
3251
3299
|
|
|
3252
3300
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3253
|
-
var CABProductsSection =
|
|
3301
|
+
var CABProductsSection = z53.object({
|
|
3254
3302
|
...CABVariableFields,
|
|
3255
|
-
name:
|
|
3256
|
-
sectionId:
|
|
3257
|
-
sections:
|
|
3258
|
-
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)
|
|
3259
3307
|
});
|
|
3260
3308
|
|
|
3261
3309
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3262
|
-
var CABOffersSection =
|
|
3310
|
+
var CABOffersSection = z54.lazy(
|
|
3263
3311
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3264
3312
|
/**
|
|
3265
3313
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -3267,8 +3315,8 @@ var CABOffersSection = z51.lazy(
|
|
|
3267
3315
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
3268
3316
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
3269
3317
|
*/
|
|
3270
|
-
divider:
|
|
3271
|
-
sections:
|
|
3318
|
+
divider: z54.boolean().optional(),
|
|
3319
|
+
sections: z54.union([z54.array(z54.lazy(() => CABSection)), z54.strictObject({}).transform(() => [])]).default(() => [
|
|
3272
3320
|
CABBannerSection.parse({
|
|
3273
3321
|
buttonField: "undoAddToOrder",
|
|
3274
3322
|
color: "success",
|
|
@@ -3282,77 +3330,77 @@ var CABOffersSection = z51.lazy(
|
|
|
3282
3330
|
CABDataSourceSection.parse({}),
|
|
3283
3331
|
CABProductsSection.parse({})
|
|
3284
3332
|
]),
|
|
3285
|
-
sectionType:
|
|
3333
|
+
sectionType: z54.literal(SectionType.offers).default(SectionType.offers)
|
|
3286
3334
|
})
|
|
3287
3335
|
);
|
|
3288
3336
|
|
|
3289
3337
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3290
|
-
var CABCarouselSection =
|
|
3338
|
+
var CABCarouselSection = z55.lazy(
|
|
3291
3339
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3292
|
-
autoAdvanceInterval:
|
|
3293
|
-
itemsAtOnce:
|
|
3340
|
+
autoAdvanceInterval: z55.number().default(0),
|
|
3341
|
+
itemsAtOnce: z55.number().min(1).default(1),
|
|
3294
3342
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
3295
|
-
offersDirection:
|
|
3296
|
-
sections:
|
|
3297
|
-
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)
|
|
3298
3346
|
})
|
|
3299
3347
|
);
|
|
3300
3348
|
|
|
3301
3349
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
3302
|
-
import { z as
|
|
3303
|
-
var CABCartLineSection =
|
|
3350
|
+
import { z as z56 } from "zod";
|
|
3351
|
+
var CABCartLineSection = z56.lazy(
|
|
3304
3352
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3305
|
-
sections:
|
|
3306
|
-
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)
|
|
3307
3355
|
})
|
|
3308
3356
|
);
|
|
3309
3357
|
|
|
3310
3358
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
3311
3359
|
import { v7 as uuidv77 } from "uuid";
|
|
3312
|
-
import { z as
|
|
3313
|
-
var CABDiscountSection =
|
|
3360
|
+
import { z as z57 } from "zod";
|
|
3361
|
+
var CABDiscountSection = z57.object({
|
|
3314
3362
|
...CABVariableFields,
|
|
3315
|
-
amount:
|
|
3316
|
-
discountedBy:
|
|
3317
|
-
discountedFrom:
|
|
3318
|
-
message:
|
|
3319
|
-
name:
|
|
3320
|
-
quantity:
|
|
3321
|
-
sectionId:
|
|
3322
|
-
sectionType:
|
|
3323
|
-
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")
|
|
3324
3372
|
});
|
|
3325
3373
|
|
|
3326
3374
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
3327
3375
|
import { v7 as uuidv78 } from "uuid";
|
|
3328
|
-
import { z as
|
|
3329
|
-
var CABMonetizeAds =
|
|
3330
|
-
requestId:
|
|
3376
|
+
import { z as z58 } from "zod";
|
|
3377
|
+
var CABMonetizeAds = z58.object({
|
|
3378
|
+
requestId: z58.string().optional(),
|
|
3331
3379
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
3332
|
-
testing:
|
|
3380
|
+
testing: z58.boolean().default(false)
|
|
3333
3381
|
});
|
|
3334
|
-
var CABMonetizeSection =
|
|
3382
|
+
var CABMonetizeSection = z58.object({
|
|
3335
3383
|
...CABVariableFields,
|
|
3336
3384
|
ads: CABMonetizeAds.optional(),
|
|
3337
|
-
name:
|
|
3385
|
+
name: z58.string().optional(),
|
|
3338
3386
|
/**
|
|
3339
3387
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
3340
3388
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
3341
3389
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
3342
3390
|
*/
|
|
3343
|
-
offers:
|
|
3391
|
+
offers: z58.array(z58.lazy(() => CABSection)).optional(),
|
|
3344
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. */
|
|
3345
|
-
privacyPolicyUrl:
|
|
3346
|
-
sectionId:
|
|
3347
|
-
sectionType:
|
|
3393
|
+
privacyPolicyUrl: z58.string().optional(),
|
|
3394
|
+
sectionId: z58.uuid().default(() => uuidv78()),
|
|
3395
|
+
sectionType: z58.literal(SectionType.monetize).default(SectionType.monetize),
|
|
3348
3396
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
3349
|
-
subVertical:
|
|
3397
|
+
subVertical: z58.string().optional(),
|
|
3350
3398
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
3351
|
-
vertical:
|
|
3399
|
+
vertical: z58.string().optional()
|
|
3352
3400
|
});
|
|
3353
3401
|
|
|
3354
3402
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3355
|
-
import { z as
|
|
3403
|
+
import { z as z59 } from "zod";
|
|
3356
3404
|
|
|
3357
3405
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
3358
3406
|
var GIFT_LABELS = {
|
|
@@ -3471,34 +3519,34 @@ var GIFT_LABELS = {
|
|
|
3471
3519
|
};
|
|
3472
3520
|
|
|
3473
3521
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3474
|
-
var CABProgressTierExclusion =
|
|
3475
|
-
collectionIds:
|
|
3476
|
-
productIds:
|
|
3477
|
-
tags:
|
|
3478
|
-
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)
|
|
3479
3527
|
});
|
|
3480
|
-
var CABProgressTier =
|
|
3528
|
+
var CABProgressTier = z59.object({
|
|
3481
3529
|
/**
|
|
3482
3530
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
3483
3531
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
3484
3532
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
3485
3533
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
3486
3534
|
*/
|
|
3487
|
-
discount:
|
|
3535
|
+
discount: z59.object({ amount: z59.number().nonnegative(), type: z59.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
3488
3536
|
/**
|
|
3489
3537
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
3490
3538
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
3491
3539
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
3492
3540
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
3493
3541
|
*/
|
|
3494
|
-
exclusions:
|
|
3542
|
+
exclusions: z59.array(CABProgressTierExclusion).default(() => []),
|
|
3495
3543
|
/**
|
|
3496
3544
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
3497
3545
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
3498
3546
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
3499
3547
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
3500
3548
|
*/
|
|
3501
|
-
filterOosVariants:
|
|
3549
|
+
filterOosVariants: z59.boolean().default(false),
|
|
3502
3550
|
/**
|
|
3503
3551
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
3504
3552
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -3506,10 +3554,10 @@ var CABProgressTier = z56.object({
|
|
|
3506
3554
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
3507
3555
|
* tree is complete.
|
|
3508
3556
|
*/
|
|
3509
|
-
gift:
|
|
3510
|
-
productId:
|
|
3511
|
-
title:
|
|
3512
|
-
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(() => [])
|
|
3513
3561
|
}).optional(),
|
|
3514
3562
|
/**
|
|
3515
3563
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -3529,7 +3577,7 @@ var CABProgressTier = z56.object({
|
|
|
3529
3577
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
3530
3578
|
* React's size rather than the old hardcoded 20.
|
|
3531
3579
|
*/
|
|
3532
|
-
iconSizePx:
|
|
3580
|
+
iconSizePx: z59.number().int().min(1).max(64).default(18),
|
|
3533
3581
|
/**
|
|
3534
3582
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
3535
3583
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -3539,35 +3587,35 @@ var CABProgressTier = z56.object({
|
|
|
3539
3587
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
3540
3588
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
3541
3589
|
*/
|
|
3542
|
-
label:
|
|
3590
|
+
label: z59.record(z59.string(), z59.string()).optional(),
|
|
3543
3591
|
/**
|
|
3544
3592
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
3545
3593
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
3546
3594
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
3547
3595
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
3548
3596
|
*/
|
|
3549
|
-
productTierImage:
|
|
3597
|
+
productTierImage: z59.boolean().default(false),
|
|
3550
3598
|
/**
|
|
3551
3599
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
3552
3600
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
3553
3601
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
3554
3602
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
3555
3603
|
*/
|
|
3556
|
-
threshold:
|
|
3604
|
+
threshold: z59.number().int().nonnegative(),
|
|
3557
3605
|
/**
|
|
3558
3606
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
3559
3607
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
3560
3608
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
3561
3609
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
3562
3610
|
*/
|
|
3563
|
-
thresholds:
|
|
3611
|
+
thresholds: z59.record(z59.string(), z59.number().int().nonnegative()).default(() => ({})),
|
|
3564
3612
|
/**
|
|
3565
3613
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
3566
3614
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
3567
3615
|
* shipping bar (single unlabeled tier, no gift).
|
|
3568
3616
|
*/
|
|
3569
|
-
tierId:
|
|
3570
|
-
tierType:
|
|
3617
|
+
tierId: z59.string().optional(),
|
|
3618
|
+
tierType: z59.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
3571
3619
|
/**
|
|
3572
3620
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
3573
3621
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -3578,9 +3626,9 @@ var CABProgressTier = z56.object({
|
|
|
3578
3626
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
3579
3627
|
* template text supplies grammatically-neutral wording around the token.
|
|
3580
3628
|
*/
|
|
3581
|
-
unit:
|
|
3629
|
+
unit: z59.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
3582
3630
|
});
|
|
3583
|
-
var CABProgressBarSection =
|
|
3631
|
+
var CABProgressBarSection = z59.lazy(
|
|
3584
3632
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3585
3633
|
/**
|
|
3586
3634
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -3589,35 +3637,35 @@ var CABProgressBarSection = z56.lazy(
|
|
|
3589
3637
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
3590
3638
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
3591
3639
|
*/
|
|
3592
|
-
barId:
|
|
3640
|
+
barId: z59.string().optional(),
|
|
3593
3641
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
3594
|
-
countryCodes:
|
|
3642
|
+
countryCodes: z59.array(z59.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3595
3643
|
/**
|
|
3596
3644
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
3597
3645
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
3598
3646
|
*/
|
|
3599
|
-
excludeCountryCodes:
|
|
3647
|
+
excludeCountryCodes: z59.array(z59.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3600
3648
|
/**
|
|
3601
3649
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
3602
3650
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
3603
3651
|
* adds the cart's discount allocations back to the live subtotal.
|
|
3604
3652
|
*/
|
|
3605
|
-
excludeDiscountInSubtotal:
|
|
3653
|
+
excludeDiscountInSubtotal: z59.boolean().default(false),
|
|
3606
3654
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
3607
|
-
excludedVariantIds:
|
|
3655
|
+
excludedVariantIds: z59.array(z59.number().int().positive()).default(() => []),
|
|
3608
3656
|
/**
|
|
3609
3657
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
3610
3658
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
3611
3659
|
*/
|
|
3612
|
-
freeShippingOnSubscription:
|
|
3660
|
+
freeShippingOnSubscription: z59.boolean().default(false),
|
|
3613
3661
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
3614
|
-
giftAreaTitle:
|
|
3662
|
+
giftAreaTitle: z59.record(z59.string(), z59.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
3615
3663
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
3616
|
-
giftLabels:
|
|
3617
|
-
addGift:
|
|
3618
|
-
remove:
|
|
3619
|
-
selectOptions:
|
|
3620
|
-
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 }))
|
|
3621
3669
|
}).default(() => ({
|
|
3622
3670
|
addGift: { ...GIFT_LABELS.addGift },
|
|
3623
3671
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -3625,38 +3673,38 @@ var CABProgressBarSection = z56.lazy(
|
|
|
3625
3673
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
3626
3674
|
})),
|
|
3627
3675
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
3628
|
-
name:
|
|
3676
|
+
name: z59.string().default("Order progress"),
|
|
3629
3677
|
/**
|
|
3630
3678
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
3631
3679
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
3632
3680
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
3633
3681
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
3634
3682
|
*/
|
|
3635
|
-
progressColor:
|
|
3636
|
-
sectionType:
|
|
3683
|
+
progressColor: z59.string().optional(),
|
|
3684
|
+
sectionType: z59.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
3637
3685
|
/**
|
|
3638
3686
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
3639
3687
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
3640
3688
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
3641
3689
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
3642
3690
|
*/
|
|
3643
|
-
tiers:
|
|
3691
|
+
tiers: z59.union([z59.array(CABProgressTier), z59.strictObject({}).transform(() => [])]).default(() => [])
|
|
3644
3692
|
})
|
|
3645
3693
|
);
|
|
3646
3694
|
|
|
3647
3695
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
3648
3696
|
import { v7 as uuidv79 } from "uuid";
|
|
3649
|
-
import { z as
|
|
3650
|
-
var CABQuantitySection =
|
|
3697
|
+
import { z as z60 } from "zod";
|
|
3698
|
+
var CABQuantitySection = z60.object({
|
|
3651
3699
|
...CABVariableFields,
|
|
3652
|
-
errorMessages:
|
|
3653
|
-
|
|
3654
|
-
|
|
3700
|
+
errorMessages: z60.record(
|
|
3701
|
+
z60.string(),
|
|
3702
|
+
z60.object({
|
|
3655
3703
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
3656
|
-
increment:
|
|
3657
|
-
max:
|
|
3658
|
-
min:
|
|
3659
|
-
neg:
|
|
3704
|
+
increment: z60.string().optional(),
|
|
3705
|
+
max: z60.string().optional(),
|
|
3706
|
+
min: z60.string().optional(),
|
|
3707
|
+
neg: z60.string().optional()
|
|
3660
3708
|
})
|
|
3661
3709
|
).default({
|
|
3662
3710
|
en: {
|
|
@@ -3666,18 +3714,18 @@ var CABQuantitySection = z57.object({
|
|
|
3666
3714
|
neg: "Quantity cannot be negative"
|
|
3667
3715
|
}
|
|
3668
3716
|
}),
|
|
3669
|
-
inputType:
|
|
3670
|
-
max:
|
|
3671
|
-
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),
|
|
3672
3720
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
3673
|
-
name:
|
|
3674
|
-
sectionId:
|
|
3675
|
-
sectionType:
|
|
3721
|
+
name: z60.string().default("Quantity"),
|
|
3722
|
+
sectionId: z60.uuid().default(() => uuidv79()),
|
|
3723
|
+
sectionType: z60.literal(SectionType.quantity).default(SectionType.quantity)
|
|
3676
3724
|
});
|
|
3677
3725
|
|
|
3678
3726
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3679
3727
|
import { v7 as uuidv710 } from "uuid";
|
|
3680
|
-
import { z as
|
|
3728
|
+
import { z as z61 } from "zod";
|
|
3681
3729
|
|
|
3682
3730
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
3683
3731
|
var REVIEW_LABELS = {
|
|
@@ -3740,68 +3788,69 @@ var REVIEW_LABELS = {
|
|
|
3740
3788
|
};
|
|
3741
3789
|
|
|
3742
3790
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3743
|
-
var CABReviewsSection =
|
|
3791
|
+
var CABReviewsSection = z61.object({
|
|
3744
3792
|
...CABVariableFields,
|
|
3745
|
-
color:
|
|
3793
|
+
color: z61.string().default("#fadb14"),
|
|
3746
3794
|
/**
|
|
3747
3795
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
3748
3796
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
3749
3797
|
* or merchant work.
|
|
3750
3798
|
*/
|
|
3751
|
-
countLabels:
|
|
3752
|
-
one:
|
|
3753
|
-
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 }))
|
|
3754
3802
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
3755
|
-
name:
|
|
3756
|
-
sectionId:
|
|
3757
|
-
sectionType:
|
|
3758
|
-
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),
|
|
3759
3807
|
/**
|
|
3760
3808
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
3761
3809
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
3762
3810
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
3763
3811
|
* the whole reviews section.
|
|
3764
3812
|
*/
|
|
3765
|
-
strokeColor:
|
|
3813
|
+
strokeColor: z61.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
3766
3814
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
3767
|
-
strokeWidth:
|
|
3815
|
+
strokeWidth: z61.number().nonnegative().default(0)
|
|
3768
3816
|
});
|
|
3769
3817
|
|
|
3770
3818
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
3771
3819
|
import { v7 as uuidv711 } from "uuid";
|
|
3772
|
-
import { z as
|
|
3773
|
-
var CABSeparatorSection =
|
|
3820
|
+
import { z as z62 } from "zod";
|
|
3821
|
+
var CABSeparatorSection = z62.object({
|
|
3774
3822
|
...CABVariableFields,
|
|
3775
|
-
sectionId:
|
|
3776
|
-
sectionType:
|
|
3823
|
+
sectionId: z62.uuid().default(() => uuidv711()),
|
|
3824
|
+
sectionType: z62.literal(SectionType.separator).default(SectionType.separator)
|
|
3777
3825
|
});
|
|
3778
3826
|
|
|
3779
3827
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
3780
3828
|
import { slice } from "es-toolkit/compat";
|
|
3781
3829
|
import { v7 as uuidv712 } from "uuid";
|
|
3782
|
-
import { z as
|
|
3783
|
-
var CABVariantsSection =
|
|
3830
|
+
import { z as z63 } from "zod";
|
|
3831
|
+
var CABVariantsSection = z63.object({
|
|
3784
3832
|
...CABVariableFields,
|
|
3785
|
-
hideOutOfStockVariants:
|
|
3786
|
-
name:
|
|
3787
|
-
sectionId:
|
|
3788
|
-
sectionType:
|
|
3789
|
-
selector:
|
|
3790
|
-
|
|
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)
|
|
3791
3840
|
});
|
|
3792
3841
|
|
|
3793
3842
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3794
|
-
var CABBorder =
|
|
3795
|
-
radius:
|
|
3796
|
-
style:
|
|
3797
|
-
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)
|
|
3798
3847
|
}).default({
|
|
3799
3848
|
radius: BorderRadius.base,
|
|
3800
3849
|
style: BorderStyle.none,
|
|
3801
3850
|
width: BorderWidth.base
|
|
3802
3851
|
});
|
|
3803
|
-
var CABSection =
|
|
3804
|
-
() =>
|
|
3852
|
+
var CABSection = z64.lazy(
|
|
3853
|
+
() => z64.discriminatedUnion("sectionType", [
|
|
3805
3854
|
CABBannerSection,
|
|
3806
3855
|
CABButtonSection,
|
|
3807
3856
|
CABCarouselSection,
|
|
@@ -3824,41 +3873,41 @@ var CABSection = z61.lazy(
|
|
|
3824
3873
|
);
|
|
3825
3874
|
|
|
3826
3875
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
3827
|
-
var GridItem =
|
|
3828
|
-
var CABLayoutWrapping =
|
|
3829
|
-
breakAt:
|
|
3830
|
-
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()
|
|
3831
3880
|
});
|
|
3832
|
-
var CABLayoutSection =
|
|
3881
|
+
var CABLayoutSection = z65.object({
|
|
3833
3882
|
...CABVariableFields,
|
|
3834
|
-
alignment:
|
|
3835
|
-
horizontal:
|
|
3836
|
-
vertical:
|
|
3883
|
+
alignment: z65.object({
|
|
3884
|
+
horizontal: z65.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
3885
|
+
vertical: z65.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
3837
3886
|
}).default({
|
|
3838
3887
|
horizontal: HorizontalAlignment.start,
|
|
3839
3888
|
vertical: VerticalAlignment.top
|
|
3840
3889
|
}),
|
|
3841
|
-
border:
|
|
3842
|
-
buttonField:
|
|
3843
|
-
direction:
|
|
3890
|
+
border: z65.lazy(() => CABBorder),
|
|
3891
|
+
buttonField: z65.enum(buttonFields).optional(),
|
|
3892
|
+
direction: z65.enum(directions).default(Direction.rows),
|
|
3844
3893
|
/**
|
|
3845
3894
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
3846
3895
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
3847
3896
|
*/
|
|
3848
|
-
frame:
|
|
3849
|
-
grid:
|
|
3850
|
-
columns:
|
|
3851
|
-
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"])
|
|
3852
3901
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
3853
|
-
name:
|
|
3854
|
-
padding:
|
|
3855
|
-
sectionId:
|
|
3856
|
-
sections:
|
|
3857
|
-
sectionType:
|
|
3858
|
-
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),
|
|
3859
3908
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
3860
|
-
viewUrl:
|
|
3861
|
-
width:
|
|
3909
|
+
viewUrl: z65.string().optional(),
|
|
3910
|
+
width: z65.number().default(100),
|
|
3862
3911
|
wrapping: CABLayoutWrapping.optional()
|
|
3863
3912
|
});
|
|
3864
3913
|
|
|
@@ -3880,8 +3929,8 @@ var UI_LABELS = {
|
|
|
3880
3929
|
};
|
|
3881
3930
|
|
|
3882
3931
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
3883
|
-
var localized = (fallback) =>
|
|
3884
|
-
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({
|
|
3885
3934
|
currentPage: localized(UI_LABELS.currentPage),
|
|
3886
3935
|
guest: localized(UI_LABELS.guest),
|
|
3887
3936
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -3906,48 +3955,49 @@ var CABUILabels = z63.object({
|
|
|
3906
3955
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
3907
3956
|
updating: { ...UI_LABELS.updating }
|
|
3908
3957
|
}));
|
|
3909
|
-
var TargetArea =
|
|
3910
|
-
fill:
|
|
3911
|
-
flip:
|
|
3912
|
-
icon:
|
|
3913
|
-
label:
|
|
3914
|
-
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()
|
|
3915
3964
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
3916
|
-
var CABTracking =
|
|
3917
|
-
enableAttribution:
|
|
3918
|
-
enableSource:
|
|
3919
|
-
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)
|
|
3920
3969
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
3921
|
-
var CABExperiment =
|
|
3922
|
-
elementId:
|
|
3923
|
-
experimentId:
|
|
3924
|
-
experimentType:
|
|
3925
|
-
selectedId:
|
|
3970
|
+
var CABExperiment = z66.object({
|
|
3971
|
+
elementId: z66.number(),
|
|
3972
|
+
experimentId: z66.number(),
|
|
3973
|
+
experimentType: z66.string(),
|
|
3974
|
+
selectedId: z66.number()
|
|
3926
3975
|
});
|
|
3927
3976
|
var CABRootSection = CABLayoutSection.extend({
|
|
3928
|
-
editorMode:
|
|
3977
|
+
editorMode: z66.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
3929
3978
|
experiment: CABExperiment.optional(),
|
|
3930
3979
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
3931
3980
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
3932
|
-
previewMode:
|
|
3933
|
-
storeId:
|
|
3981
|
+
previewMode: z66.boolean().nullish().transform((value) => value ?? false),
|
|
3982
|
+
storeId: z66.number().nullable().default(null),
|
|
3934
3983
|
targetArea: TargetArea.nullable(),
|
|
3935
3984
|
tracking: CABTracking,
|
|
3936
|
-
type:
|
|
3985
|
+
type: z66.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
3937
3986
|
uiLabels: CABUILabels,
|
|
3938
|
-
version:
|
|
3939
|
-
widgetId:
|
|
3987
|
+
version: z66.literal(2).default(2),
|
|
3988
|
+
widgetId: z66.number().nullable().default(null)
|
|
3940
3989
|
});
|
|
3941
3990
|
|
|
3942
3991
|
// src/schema/postPurchaseProductView.ts
|
|
3943
|
-
var PostPurchaseProductView =
|
|
3944
|
-
|
|
3992
|
+
var PostPurchaseProductView = z67.union([
|
|
3993
|
+
z67.object({
|
|
3945
3994
|
changeset: PostPurchaseProductChangeset.optional(),
|
|
3995
|
+
displayPrice: PostPurchaseDisplayPrice.optional(),
|
|
3946
3996
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
3947
3997
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
3948
3998
|
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
3949
3999
|
preparation: PreparedPostPurchaseProduct.extend({
|
|
3950
|
-
display: PreparedPostPurchaseProduct.shape.display.extend({ description:
|
|
4000
|
+
display: PreparedPostPurchaseProduct.shape.display.extend({ description: z67.string().nullable() }).refine(
|
|
3951
4001
|
({ description, descriptionDocument }) => description === null === (descriptionDocument !== void 0),
|
|
3952
4002
|
"Exactly one of the plain and rich descriptions is shown"
|
|
3953
4003
|
)
|
|
@@ -3956,33 +4006,35 @@ var PostPurchaseProductView = z64.union([
|
|
|
3956
4006
|
sections: CABRootSection,
|
|
3957
4007
|
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
3958
4008
|
}),
|
|
3959
|
-
|
|
4009
|
+
z67.object({
|
|
3960
4010
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
3961
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(),
|
|
3962
4014
|
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
3963
4015
|
preparation: PostPurchasePreparation.options[1],
|
|
3964
4016
|
purchaseOptions: PostPurchaseOptions.optional(),
|
|
3965
|
-
sections:
|
|
4017
|
+
sections: z67.null(),
|
|
3966
4018
|
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
3967
4019
|
})
|
|
3968
4020
|
]);
|
|
3969
4021
|
|
|
3970
4022
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
3971
|
-
var PostPurchaseProductCollectionView =
|
|
3972
|
-
members:
|
|
3973
|
-
|
|
4023
|
+
var PostPurchaseProductCollectionView = z68.object({
|
|
4024
|
+
members: z68.array(
|
|
4025
|
+
z68.object({
|
|
3974
4026
|
productId: PostPurchaseProductId,
|
|
3975
|
-
productIndex:
|
|
4027
|
+
productIndex: z68.number().int().nonnegative(),
|
|
3976
4028
|
view: PostPurchaseProductView
|
|
3977
4029
|
})
|
|
3978
4030
|
)
|
|
3979
4031
|
});
|
|
3980
|
-
var PostPurchaseCollectionChoice =
|
|
4032
|
+
var PostPurchaseCollectionChoice = z68.object({
|
|
3981
4033
|
choice: PostPurchaseChoice.optional(),
|
|
3982
4034
|
productId: PostPurchaseProductId,
|
|
3983
4035
|
variantId: PostPurchaseVariantSelector.shape.variantId.optional()
|
|
3984
4036
|
}).strict();
|
|
3985
|
-
var PostPurchaseExcludedProductIds =
|
|
4037
|
+
var PostPurchaseExcludedProductIds = z68.array(PostPurchaseProductId).default([]);
|
|
3986
4038
|
var PostPurchaseMemberSelector = PostPurchaseProgressSchema.shape.members.element.pick({ productId: true }).extend({ progressRevision: PostPurchaseProgressSchema.shape.revision });
|
|
3987
4039
|
var PostPurchaseMemberPointer = PostPurchaseProgressSchema.shape.members.element.omit({ status: true }).extend({
|
|
3988
4040
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
@@ -3995,7 +4047,7 @@ var PostPurchaseQuantityChoice = PostPurchaseCollectionChoice.extend({ quantity:
|
|
|
3995
4047
|
var PostPurchaseQuantityPolicy = PostPurchaseSettings.shape.quantityInputs.omit({ defaultQuantity: true }).extend({
|
|
3996
4048
|
initialQuantity: quantity,
|
|
3997
4049
|
maxValue: quantity,
|
|
3998
|
-
minValue:
|
|
4050
|
+
minValue: z69.literal(0).transform(() => 1).or(quantity)
|
|
3999
4051
|
}).refine(({ maxValue, minValue }) => minValue <= maxValue, "Quantity bounds are reversed");
|
|
4000
4052
|
|
|
4001
4053
|
// src/schema/postPurchaseGroup.ts
|
|
@@ -4004,33 +4056,33 @@ var PostPurchaseGroupChoice = PostPurchaseQuantityChoice.extend({
|
|
|
4004
4056
|
});
|
|
4005
4057
|
|
|
4006
4058
|
// src/schema/postPurchaseHealth.ts
|
|
4007
|
-
import { z as
|
|
4059
|
+
import { z as z72 } from "zod";
|
|
4008
4060
|
|
|
4009
4061
|
// src/schema/postPurchaseHealthSchedule.ts
|
|
4010
|
-
import { z as
|
|
4062
|
+
import { z as z71 } from "zod";
|
|
4011
4063
|
|
|
4012
4064
|
// src/schema/postPurchaseReleaseSchedule.ts
|
|
4013
|
-
import { z as
|
|
4014
|
-
var postPurchaseTaskNameSchema = (queue, id) =>
|
|
4015
|
-
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({
|
|
4016
4068
|
deadline: PostPurchaseTimestampSchema,
|
|
4017
4069
|
orderId: PostPurchaseOrderIdSchema,
|
|
4018
4070
|
releaseOwner: ReleaseOwnerSchema,
|
|
4019
4071
|
sessionId: PostPurchaseSessionIdSchema
|
|
4020
4072
|
});
|
|
4021
|
-
var SessionReleaseScheduleResponseSchema =
|
|
4022
|
-
data:
|
|
4073
|
+
var SessionReleaseScheduleResponseSchema = z70.object({
|
|
4074
|
+
data: z70.discriminatedUnion("status", [
|
|
4023
4075
|
SessionReleaseScheduleRequestSchema.extend({
|
|
4024
|
-
releaseOwner:
|
|
4025
|
-
status:
|
|
4076
|
+
releaseOwner: z70.literal("rebuy"),
|
|
4077
|
+
status: z70.literal("queued"),
|
|
4026
4078
|
taskName: postPurchaseTaskNameSchema("post-purchase-order-hold-release", "[a-f0-9]{64}-release")
|
|
4027
4079
|
}),
|
|
4028
4080
|
SessionReleaseScheduleRequestSchema.extend({
|
|
4029
|
-
releaseOwner:
|
|
4030
|
-
status:
|
|
4081
|
+
releaseOwner: z70.literal("shopify"),
|
|
4082
|
+
status: z70.literal("native")
|
|
4031
4083
|
})
|
|
4032
4084
|
]),
|
|
4033
|
-
successful:
|
|
4085
|
+
successful: z70.literal(true)
|
|
4034
4086
|
});
|
|
4035
4087
|
|
|
4036
4088
|
// src/schema/postPurchaseHealthSchedule.ts
|
|
@@ -4039,15 +4091,15 @@ var PostPurchaseHealthTaskNameSchema = postPurchaseTaskNameSchema(
|
|
|
4039
4091
|
"post-purchase-health-check",
|
|
4040
4092
|
"[a-z0-9][a-z0-9-]*--[1-9][0-9]*"
|
|
4041
4093
|
);
|
|
4042
|
-
var HealthScheduleAcknowledgementSchema =
|
|
4094
|
+
var HealthScheduleAcknowledgementSchema = z71.strictObject({
|
|
4043
4095
|
data: HealthScheduleSchema.extend({
|
|
4044
|
-
status:
|
|
4096
|
+
status: z71.literal("queued"),
|
|
4045
4097
|
taskName: PostPurchaseHealthTaskNameSchema
|
|
4046
4098
|
}).refine(
|
|
4047
4099
|
(data) => data.taskName.endsWith(`/tasks/${postPurchaseHealthTaskId(data)}`),
|
|
4048
4100
|
"taskName must be this order's health task"
|
|
4049
4101
|
),
|
|
4050
|
-
successful:
|
|
4102
|
+
successful: z71.literal(true)
|
|
4051
4103
|
});
|
|
4052
4104
|
|
|
4053
4105
|
// src/schema/postPurchaseHealth.ts
|
|
@@ -4056,90 +4108,93 @@ var HealthFactSchema = HealthScheduleSchema.pick({
|
|
|
4056
4108
|
operationId: true,
|
|
4057
4109
|
removePartialOrder: true
|
|
4058
4110
|
});
|
|
4059
|
-
var HealthScheduleReceiptSchema =
|
|
4111
|
+
var HealthScheduleReceiptSchema = z72.strictObject({
|
|
4060
4112
|
recordedAt: PostPurchaseTimestampSchema,
|
|
4061
4113
|
taskName: PostPurchaseHealthTaskNameSchema
|
|
4062
4114
|
});
|
|
4063
|
-
var StoredHealthFactSchema = HealthFactSchema.extend({
|
|
4115
|
+
var StoredHealthFactSchema = HealthFactSchema.extend({
|
|
4116
|
+
checkoutToken: HealthScheduleSchema.shape.checkoutToken.optional(),
|
|
4117
|
+
scheduleReceipt: HealthScheduleReceiptSchema.optional()
|
|
4118
|
+
});
|
|
4064
4119
|
var HealthAttemptSchema = StoredHealthFactSchema.extend({
|
|
4065
4120
|
attemptedAt: PostPurchaseTimestampSchema,
|
|
4066
|
-
attemptId:
|
|
4067
|
-
status:
|
|
4121
|
+
attemptId: z72.uuid(),
|
|
4122
|
+
status: z72.literal("attempted")
|
|
4068
4123
|
});
|
|
4069
4124
|
var HealthResultSchema = HealthAttemptSchema.extend({
|
|
4070
4125
|
finishedAt: PostPurchaseTimestampSchema,
|
|
4071
|
-
status:
|
|
4126
|
+
status: z72.enum(["returned", "unknown"])
|
|
4072
4127
|
});
|
|
4073
|
-
var HealthStateSchema =
|
|
4074
|
-
StoredHealthFactSchema.extend({ status:
|
|
4128
|
+
var HealthStateSchema = z72.union([
|
|
4129
|
+
StoredHealthFactSchema.extend({ status: z72.literal("pending") }),
|
|
4075
4130
|
HealthAttemptSchema,
|
|
4076
4131
|
HealthResultSchema
|
|
4077
4132
|
]);
|
|
4078
4133
|
var HealthPrepareRequestSchema = DecideRequestSchema.extend({
|
|
4079
4134
|
operationId: HealthScheduleSchema.shape.operationId
|
|
4080
4135
|
}).strict();
|
|
4081
|
-
var HealthPrepareResponseSchema =
|
|
4082
|
-
var HealthClaimRequestSchema =
|
|
4136
|
+
var HealthPrepareResponseSchema = z72.object({ data: HealthScheduleSchema, successful: z72.literal(true) });
|
|
4137
|
+
var HealthClaimRequestSchema = z72.strictObject({
|
|
4083
4138
|
orderId: PostPurchaseOrderIdSchema,
|
|
4084
|
-
removePartialOrder:
|
|
4139
|
+
removePartialOrder: z72.boolean(),
|
|
4085
4140
|
shop: ShopifyDomainSchema
|
|
4086
4141
|
});
|
|
4087
4142
|
var HealthClaimFactSchema = HealthClaimRequestSchema.extend({
|
|
4088
4143
|
healthScheduledAt: HealthFactSchema.shape.healthScheduledAt
|
|
4089
4144
|
});
|
|
4090
|
-
var HealthClaimResponseSchema =
|
|
4091
|
-
data:
|
|
4092
|
-
|
|
4093
|
-
HealthClaimFactSchema.extend({ status:
|
|
4094
|
-
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") })
|
|
4095
4150
|
]),
|
|
4096
|
-
successful:
|
|
4151
|
+
successful: z72.literal(true)
|
|
4097
4152
|
});
|
|
4098
4153
|
var HealthResultRequestSchema = HealthClaimRequestSchema.extend({
|
|
4099
4154
|
attemptId: HealthAttemptSchema.shape.attemptId,
|
|
4100
4155
|
outcome: HealthResultSchema.shape.status
|
|
4101
4156
|
});
|
|
4102
|
-
var HealthResultResponseSchema =
|
|
4157
|
+
var HealthResultResponseSchema = z72.object({
|
|
4103
4158
|
data: HealthClaimFactSchema.extend({
|
|
4104
4159
|
finishedAt: HealthResultSchema.shape.finishedAt,
|
|
4105
4160
|
status: HealthResultSchema.shape.status
|
|
4106
4161
|
}),
|
|
4107
|
-
successful:
|
|
4162
|
+
successful: z72.literal(true)
|
|
4108
4163
|
});
|
|
4109
4164
|
|
|
4110
4165
|
// src/schema/postPurchaseLifecycle.ts
|
|
4111
|
-
import { z as
|
|
4112
|
-
var Presentation =
|
|
4166
|
+
import { z as z73 } from "zod";
|
|
4167
|
+
var Presentation = z73.strictObject({
|
|
4113
4168
|
member: PostPurchaseMemberIdentity,
|
|
4114
4169
|
selectedProductId: PostPurchaseMemberIdentity.shape.productId.optional(),
|
|
4115
4170
|
variant: PostPurchaseVariantSelector
|
|
4116
4171
|
});
|
|
4117
4172
|
var LifecycleObservationRequestSchema = DecideRequestSchema.extend({
|
|
4118
4173
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
4119
|
-
eventType:
|
|
4174
|
+
eventType: z73.enum(["OFFER_VIEWED", "OFFER_TIMER_EXPIRED"]),
|
|
4120
4175
|
presentation: Presentation.nullable(),
|
|
4121
4176
|
progressRevision: PostPurchaseProgressSchema.shape.revision,
|
|
4122
|
-
requestId:
|
|
4177
|
+
requestId: z73.uuid()
|
|
4123
4178
|
}).strict().refine(
|
|
4124
4179
|
({ eventType, presentation }) => eventType !== "OFFER_VIEWED" || presentation !== null,
|
|
4125
4180
|
"Viewed observations require a presented product"
|
|
4126
4181
|
);
|
|
4127
|
-
var LifecycleObservationResponseSchema =
|
|
4128
|
-
data:
|
|
4182
|
+
var LifecycleObservationResponseSchema = z73.object({
|
|
4183
|
+
data: z73.strictObject({
|
|
4129
4184
|
requestId: LifecycleObservationRequestSchema.shape.requestId,
|
|
4130
|
-
status:
|
|
4185
|
+
status: z73.union([AcceptedEventOutcomeSchema, z73.literal("unavailable")])
|
|
4131
4186
|
}),
|
|
4132
|
-
successful:
|
|
4187
|
+
successful: z73.literal(true)
|
|
4133
4188
|
});
|
|
4134
4189
|
|
|
4135
4190
|
// src/schema/postPurchaseOffer.ts
|
|
4136
|
-
import { z as
|
|
4191
|
+
import { z as z75 } from "zod";
|
|
4137
4192
|
|
|
4138
4193
|
// src/schema/postPurchaseSkipTrace.ts
|
|
4139
|
-
import { z as
|
|
4194
|
+
import { z as z74 } from "zod";
|
|
4140
4195
|
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
4141
|
-
var PostPurchaseSkipTraceSchema =
|
|
4142
|
-
|
|
4196
|
+
var PostPurchaseSkipTraceSchema = z74.array(
|
|
4197
|
+
z74.object({
|
|
4143
4198
|
entry: DecisionEntrySchema,
|
|
4144
4199
|
reason: PostPurchaseSkipReasonSchema
|
|
4145
4200
|
})
|
|
@@ -4147,66 +4202,66 @@ var PostPurchaseSkipTraceSchema = z71.array(
|
|
|
4147
4202
|
|
|
4148
4203
|
// src/schema/postPurchaseOffer.ts
|
|
4149
4204
|
var OfferPreparationRequestSchema = DecideRequestSchema.strict();
|
|
4150
|
-
var OfferPreparationResponseSchema =
|
|
4151
|
-
data:
|
|
4152
|
-
successful:
|
|
4205
|
+
var OfferPreparationResponseSchema = z75.object({
|
|
4206
|
+
data: z75.object({ attemptedSkips: PostPurchaseSkipTraceSchema.optional(), progress: PostPurchaseProgressSchema }),
|
|
4207
|
+
successful: z75.literal(true)
|
|
4153
4208
|
});
|
|
4154
4209
|
|
|
4155
4210
|
// src/schema/postPurchaseOfferEligibility.ts
|
|
4156
|
-
import { z as
|
|
4211
|
+
import { z as z76 } from "zod";
|
|
4157
4212
|
var selection2 = PreparedPostPurchaseProduct.shape.selection;
|
|
4158
|
-
var PostPurchaseOfferSkipReason =
|
|
4159
|
-
var PostPurchaseOfferEligibilityContext =
|
|
4213
|
+
var PostPurchaseOfferSkipReason = z76.enum(["empty", "no-eligible-subscription"]);
|
|
4214
|
+
var PostPurchaseOfferEligibilityContext = z76.object({
|
|
4160
4215
|
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
4161
|
-
originalLineItems:
|
|
4216
|
+
originalLineItems: z76.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
4162
4217
|
});
|
|
4163
|
-
var PostPurchaseOfferEligibility =
|
|
4164
|
-
|
|
4165
|
-
members:
|
|
4166
|
-
|
|
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() })
|
|
4167
4222
|
),
|
|
4168
|
-
status:
|
|
4223
|
+
status: z76.literal("retain")
|
|
4169
4224
|
}),
|
|
4170
|
-
|
|
4171
|
-
|
|
4225
|
+
z76.object({ reason: PostPurchaseOfferSkipReason, status: z76.literal("skip") }),
|
|
4226
|
+
z76.object({ reason: z76.literal("eligible-upgrade").optional(), status: z76.literal("unavailable") })
|
|
4172
4227
|
]);
|
|
4173
4228
|
|
|
4174
4229
|
// src/schema/postPurchaseOfferPresentation.ts
|
|
4175
|
-
import { z as
|
|
4230
|
+
import { z as z77 } from "zod";
|
|
4176
4231
|
var language2 = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap();
|
|
4177
|
-
var PostPurchaseOfferPresentation =
|
|
4232
|
+
var PostPurchaseOfferPresentation = z77.strictObject({
|
|
4178
4233
|
labels: language2.pick({ declineAll: true, declineThisOffer: true }),
|
|
4179
4234
|
layout: PostPurchaseSettings.shape.offersLayout,
|
|
4180
4235
|
sections: CABRootSection.nullable(),
|
|
4181
4236
|
showDeclineAll: PostPurchaseSettings.shape.productOptions.shape.showDeclineAll
|
|
4182
4237
|
});
|
|
4183
4238
|
var OfferPresentationRequestSchema = DecideRequestSchema.strict();
|
|
4184
|
-
var OfferPresentationResponseSchema =
|
|
4185
|
-
data:
|
|
4239
|
+
var OfferPresentationResponseSchema = z77.object({
|
|
4240
|
+
data: z77.strictObject({
|
|
4186
4241
|
presentation: PostPurchaseOfferPresentation.nullable(),
|
|
4187
4242
|
progress: PostPurchaseProgressSchema.nullable(),
|
|
4188
4243
|
serverNow: PostPurchaseTimestampSchema
|
|
4189
4244
|
}),
|
|
4190
|
-
successful:
|
|
4245
|
+
successful: z77.literal(true)
|
|
4191
4246
|
});
|
|
4192
4247
|
|
|
4193
4248
|
// src/schema/postPurchaseOrderDecision.ts
|
|
4194
|
-
import { z as
|
|
4195
|
-
var OrderDecisionSchema =
|
|
4196
|
-
|
|
4197
|
-
|
|
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() })
|
|
4198
4253
|
]);
|
|
4199
4254
|
|
|
4200
4255
|
// src/schema/postPurchasePolicy.ts
|
|
4201
|
-
import { z as
|
|
4202
|
-
var HoldSettingSchema =
|
|
4203
|
-
|
|
4204
|
-
|
|
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) })
|
|
4205
4260
|
]);
|
|
4206
|
-
var TimingSettingsSchema =
|
|
4261
|
+
var TimingSettingsSchema = z79.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
4207
4262
|
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
4208
|
-
durationMinutes:
|
|
4209
|
-
source:
|
|
4263
|
+
durationMinutes: z79.number().int().min(1).max(60).nullable(),
|
|
4264
|
+
source: z79.enum(["shop", "flow", "native"])
|
|
4210
4265
|
}).refine(
|
|
4211
4266
|
(policy) => {
|
|
4212
4267
|
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
@@ -4220,8 +4275,8 @@ var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
|
4220
4275
|
);
|
|
4221
4276
|
|
|
4222
4277
|
// src/schema/postPurchasePreparationOptions.ts
|
|
4223
|
-
import { z as
|
|
4224
|
-
var PostPurchasePreparationOptions =
|
|
4278
|
+
import { z as z80 } from "zod";
|
|
4279
|
+
var PostPurchasePreparationOptions = z80.object({
|
|
4225
4280
|
choice: PostPurchaseChoice.optional(),
|
|
4226
4281
|
member: PostPurchaseMemberSelector.strict().optional(),
|
|
4227
4282
|
quantity: PreparedPostPurchaseProduct.shape.selection.shape.quantity.optional(),
|
|
@@ -4233,8 +4288,8 @@ var PostPurchasePreparationOptions = z77.object({
|
|
|
4233
4288
|
);
|
|
4234
4289
|
|
|
4235
4290
|
// src/schema/postPurchaseProductSettings.ts
|
|
4236
|
-
import { z as
|
|
4237
|
-
var amount =
|
|
4291
|
+
import { z as z81 } from "zod";
|
|
4292
|
+
var amount = z81.union([z81.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
4238
4293
|
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
4239
4294
|
discountedFrom: true,
|
|
4240
4295
|
language: true,
|
|
@@ -4246,22 +4301,22 @@ var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
|
4246
4301
|
subscriptionIsDefault: true,
|
|
4247
4302
|
upgradeToSubscription: true
|
|
4248
4303
|
}).extend({
|
|
4249
|
-
advance:
|
|
4250
|
-
blocks:
|
|
4304
|
+
advance: z81.unknown().default({}),
|
|
4305
|
+
blocks: z81.array(z81.unknown()).optional(),
|
|
4251
4306
|
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
4252
|
-
integrations:
|
|
4307
|
+
integrations: z81.unknown().default({}),
|
|
4253
4308
|
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
4254
|
-
styles:
|
|
4309
|
+
styles: z81.unknown().default({}),
|
|
4255
4310
|
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
4256
|
-
subscription:
|
|
4311
|
+
subscription: z81.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
4257
4312
|
});
|
|
4258
4313
|
|
|
4259
4314
|
// src/schema/postPurchaseRecovery.ts
|
|
4260
|
-
import { z as
|
|
4315
|
+
import { z as z82 } from "zod";
|
|
4261
4316
|
var PurchaseRecoveryRequestSchema = DecideRequestSchema.strict();
|
|
4262
|
-
var PurchaseRecoveryResponseSchema =
|
|
4263
|
-
data:
|
|
4264
|
-
operation:
|
|
4317
|
+
var PurchaseRecoveryResponseSchema = z82.object({
|
|
4318
|
+
data: z82.object({
|
|
4319
|
+
operation: z82.object({
|
|
4265
4320
|
observation: RecordedPurchaseObservationSchema.nullable(),
|
|
4266
4321
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
4267
4322
|
upgrade: UpgradeProgressSchema.optional()
|
|
@@ -4271,41 +4326,41 @@ var PurchaseRecoveryResponseSchema = z79.object({
|
|
|
4271
4326
|
}).nullable(),
|
|
4272
4327
|
progress: PostPurchaseProgressSchema.nullable().optional()
|
|
4273
4328
|
}),
|
|
4274
|
-
successful:
|
|
4329
|
+
successful: z82.literal(true)
|
|
4275
4330
|
});
|
|
4276
4331
|
|
|
4277
4332
|
// src/schema/postPurchaseReleaseClaim.ts
|
|
4278
|
-
import { z as
|
|
4333
|
+
import { z as z83 } from "zod";
|
|
4279
4334
|
var ReleaseClaimRequestSchema = ReleaseAuthorityRequestSchema;
|
|
4280
|
-
var ReleaseClaimResponseSchema =
|
|
4281
|
-
data:
|
|
4282
|
-
|
|
4335
|
+
var ReleaseClaimResponseSchema = z83.object({
|
|
4336
|
+
data: z83.discriminatedUnion("status", [
|
|
4337
|
+
z83.object({ status: z83.literal("release-permitted") }),
|
|
4283
4338
|
PendingReleaseAuthoritySchema,
|
|
4284
4339
|
ReadyReleaseAuthoritySchema
|
|
4285
4340
|
]),
|
|
4286
|
-
successful:
|
|
4341
|
+
successful: z83.literal(true)
|
|
4287
4342
|
});
|
|
4288
4343
|
|
|
4289
4344
|
// src/schema/postPurchaseSelection.ts
|
|
4290
|
-
import { z as
|
|
4345
|
+
import { z as z84 } from "zod";
|
|
4291
4346
|
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
4292
4347
|
appId: PostPurchaseAppIdSchema,
|
|
4293
4348
|
entry: DecisionEntrySchema,
|
|
4294
|
-
iss:
|
|
4295
|
-
purpose:
|
|
4349
|
+
iss: z84.literal("rebuy-api"),
|
|
4350
|
+
purpose: z84.literal("post-purchase-selection")
|
|
4296
4351
|
});
|
|
4297
4352
|
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
4298
|
-
selectionToken:
|
|
4353
|
+
selectionToken: z84.string().min(1).max(8192).optional()
|
|
4299
4354
|
}).strict();
|
|
4300
4355
|
|
|
4301
4356
|
// src/schema/postPurchaseSession.ts
|
|
4302
|
-
import { z as
|
|
4357
|
+
import { z as z85 } from "zod";
|
|
4303
4358
|
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
4304
|
-
var SessionOrderTimingSchema =
|
|
4359
|
+
var SessionOrderTimingSchema = z85.object({
|
|
4305
4360
|
nativeDeadline: PostPurchaseTimestampSchema,
|
|
4306
4361
|
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
4307
4362
|
orderId: PostPurchaseOrderIdSchema,
|
|
4308
|
-
timingSource:
|
|
4363
|
+
timingSource: z85.literal("shopify-order-created-at")
|
|
4309
4364
|
});
|
|
4310
4365
|
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
4311
4366
|
deadline: PostPurchaseTimestampSchema,
|
|
@@ -4322,33 +4377,33 @@ var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
|
4322
4377
|
message: "deadline must not exceed nativeDeadline",
|
|
4323
4378
|
path: ["deadline"]
|
|
4324
4379
|
});
|
|
4325
|
-
var SessionStartResponseSchema =
|
|
4326
|
-
data:
|
|
4327
|
-
phase:
|
|
4380
|
+
var SessionStartResponseSchema = z85.object({
|
|
4381
|
+
data: z85.object({
|
|
4382
|
+
phase: z85.literal("render"),
|
|
4328
4383
|
serverNow: PostPurchaseTimestampSchema,
|
|
4329
4384
|
session: ReadySessionTimingSchema,
|
|
4330
|
-
workflowPhase:
|
|
4385
|
+
workflowPhase: z85.literal("start")
|
|
4331
4386
|
}),
|
|
4332
|
-
successful:
|
|
4387
|
+
successful: z85.literal(true)
|
|
4333
4388
|
});
|
|
4334
4389
|
|
|
4335
4390
|
// src/schema/postPurchaseShadow.ts
|
|
4336
|
-
import { z as
|
|
4337
|
-
var PostPurchaseShadowSelectionSchema =
|
|
4338
|
-
|
|
4339
|
-
|
|
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") })
|
|
4340
4395
|
]);
|
|
4341
|
-
var PostPurchaseShadowReportFields =
|
|
4342
|
-
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, {
|
|
4343
4398
|
message: "differences must not contain duplicate entries"
|
|
4344
4399
|
}),
|
|
4345
4400
|
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
4346
|
-
phase:
|
|
4347
|
-
sampleId:
|
|
4401
|
+
phase: z86.literal("shouldRender"),
|
|
4402
|
+
sampleId: z86.string(),
|
|
4348
4403
|
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
4349
|
-
status:
|
|
4350
|
-
targetingFlowIds:
|
|
4351
|
-
workflowPhase:
|
|
4404
|
+
status: z86.enum(["match", "diverged", "incomplete"]),
|
|
4405
|
+
targetingFlowIds: z86.array(z86.number().int().positive()),
|
|
4406
|
+
workflowPhase: z86.literal("decide")
|
|
4352
4407
|
});
|
|
4353
4408
|
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
4354
4409
|
(report) => report.status !== "match" || report.differences.length === 0,
|
|
@@ -4361,21 +4416,10 @@ var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
|
4361
4416
|
path: ["status"]
|
|
4362
4417
|
});
|
|
4363
4418
|
|
|
4364
|
-
// src/schema/postPurchaseSubscriptionDisplay.ts
|
|
4365
|
-
import { z as z84 } from "zod";
|
|
4366
|
-
var Minor2 = z84.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
4367
|
-
var PostPurchaseSubscriptionDisplay = z84.object({
|
|
4368
|
-
comparisonMinor: Minor2,
|
|
4369
|
-
currencyCode: z84.string().regex(/^[A-Z]{3}$/),
|
|
4370
|
-
priceMinor: Minor2,
|
|
4371
|
-
savingMinor: Minor2,
|
|
4372
|
-
savingPercent: z84.number().int().min(0).max(100)
|
|
4373
|
-
});
|
|
4374
|
-
|
|
4375
4419
|
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
4376
|
-
import { z as
|
|
4420
|
+
import { z as z87 } from "zod";
|
|
4377
4421
|
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
4378
|
-
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId:
|
|
4422
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: z87.number().int().positive() }),
|
|
4379
4423
|
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
4380
4424
|
subscription: PostPurchaseSubscriptionTerms
|
|
4381
4425
|
}).refine(
|
|
@@ -4388,108 +4432,108 @@ var readPostPurchaseSubscription = (prepared) => {
|
|
|
4388
4432
|
};
|
|
4389
4433
|
|
|
4390
4434
|
// src/schema/postPurchaseTransition.ts
|
|
4391
|
-
import { z as
|
|
4435
|
+
import { z as z88 } from "zod";
|
|
4392
4436
|
var OfferTransitionRequestSchema = DecideRequestSchema.extend({
|
|
4393
4437
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
4394
4438
|
progressRevision: PostPurchaseProgressSchema.shape.revision
|
|
4395
4439
|
}).strict();
|
|
4396
|
-
var OfferTransitionResponseSchema =
|
|
4397
|
-
data:
|
|
4440
|
+
var OfferTransitionResponseSchema = z88.object({
|
|
4441
|
+
data: z88.object({
|
|
4398
4442
|
attemptedSkips: PostPurchaseSkipTraceSchema.optional(),
|
|
4399
4443
|
progress: PostPurchaseProgressSchema,
|
|
4400
|
-
status:
|
|
4444
|
+
status: z88.enum(["advanced", "no-child", "unavailable"])
|
|
4401
4445
|
}),
|
|
4402
|
-
successful:
|
|
4446
|
+
successful: z88.literal(true)
|
|
4403
4447
|
});
|
|
4404
4448
|
|
|
4405
4449
|
// src/schema/postPurchaseVariantDefault.ts
|
|
4406
|
-
import { z as
|
|
4450
|
+
import { z as z89 } from "zod";
|
|
4407
4451
|
var values = PostPurchaseVariantValues.partial().extend({
|
|
4408
4452
|
option1: PostPurchaseVariantValues.shape.option1.nullish()
|
|
4409
4453
|
});
|
|
4410
4454
|
var variant = values.extend({
|
|
4411
4455
|
id: PostPurchaseVariantId,
|
|
4412
|
-
inventoryManagement:
|
|
4413
|
-
inventoryPolicy:
|
|
4414
|
-
inventoryQuantity:
|
|
4456
|
+
inventoryManagement: z89.string().nullable(),
|
|
4457
|
+
inventoryPolicy: z89.string(),
|
|
4458
|
+
inventoryQuantity: z89.number()
|
|
4415
4459
|
});
|
|
4416
|
-
var options =
|
|
4417
|
-
var PostPurchaseVariantDefaultProduct =
|
|
4460
|
+
var options = z89.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
|
|
4461
|
+
var PostPurchaseVariantDefaultProduct = z89.object({
|
|
4418
4462
|
id: PostPurchaseProductId,
|
|
4419
4463
|
options,
|
|
4420
4464
|
selectedVariant: variant.optional(),
|
|
4421
|
-
variants:
|
|
4465
|
+
variants: z89.array(variant)
|
|
4422
4466
|
});
|
|
4423
4467
|
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
4424
4468
|
hideOutOfStockVariants: true,
|
|
4425
4469
|
matchVariant: true
|
|
4426
4470
|
});
|
|
4427
|
-
var PostPurchaseOrderAttributes =
|
|
4428
|
-
var PostPurchaseOriginalVariants =
|
|
4429
|
-
|
|
4471
|
+
var PostPurchaseOrderAttributes = z89.record(z89.string(), z89.array(z89.string())).default({});
|
|
4472
|
+
var PostPurchaseOriginalVariants = z89.array(
|
|
4473
|
+
z89.object({ productId: PostPurchaseProductId, variantId: PostPurchaseVariantId })
|
|
4430
4474
|
);
|
|
4431
|
-
var PostPurchaseAttributeProducts =
|
|
4432
|
-
|
|
4475
|
+
var PostPurchaseAttributeProducts = z89.array(
|
|
4476
|
+
z89.object({ id: PostPurchaseProductId, options, variants: z89.array(values.extend({ id: PostPurchaseVariantId })) })
|
|
4433
4477
|
);
|
|
4434
4478
|
|
|
4435
4479
|
// src/schema/postPurchaseVariantDefaultContext.ts
|
|
4436
|
-
import { z as
|
|
4437
|
-
var PostPurchaseVariantDefaultContext =
|
|
4438
|
-
enrichedLineItems:
|
|
4480
|
+
import { z as z90 } from "zod";
|
|
4481
|
+
var PostPurchaseVariantDefaultContext = z90.object({
|
|
4482
|
+
enrichedLineItems: z90.unknown().optional(),
|
|
4439
4483
|
originalVariants: PostPurchaseOriginalVariants
|
|
4440
4484
|
});
|
|
4441
4485
|
|
|
4442
4486
|
// src/schema/shopConfig.ts
|
|
4443
|
-
import { z as
|
|
4444
|
-
var ShopConfig =
|
|
4445
|
-
activeExperiments:
|
|
4446
|
-
|
|
4447
|
-
data:
|
|
4448
|
-
|
|
4449
|
-
aliasName:
|
|
4450
|
-
cssInput:
|
|
4451
|
-
elementId:
|
|
4452
|
-
id:
|
|
4453
|
-
javascriptInput:
|
|
4454
|
-
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()
|
|
4455
4499
|
})
|
|
4456
4500
|
),
|
|
4457
|
-
id:
|
|
4458
|
-
name:
|
|
4459
|
-
pageTarget:
|
|
4460
|
-
pageTargetUrl:
|
|
4461
|
-
placeholderId:
|
|
4462
|
-
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()
|
|
4463
4507
|
})
|
|
4464
4508
|
),
|
|
4465
|
-
activePackages:
|
|
4466
|
-
|
|
4467
|
-
cancelledAt:
|
|
4468
|
-
id:
|
|
4469
|
-
installedAt:
|
|
4470
|
-
isActive:
|
|
4471
|
-
isBillable:
|
|
4472
|
-
packageId:
|
|
4473
|
-
packageName:
|
|
4474
|
-
shortName:
|
|
4475
|
-
trialDays:
|
|
4476
|
-
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()
|
|
4477
4521
|
})
|
|
4478
4522
|
),
|
|
4479
|
-
apiKey:
|
|
4480
|
-
billingVersion:
|
|
4481
|
-
cacheKey:
|
|
4482
|
-
carousel:
|
|
4483
|
-
currency:
|
|
4484
|
-
currencySymbol:
|
|
4485
|
-
domain:
|
|
4486
|
-
enabledJquery:
|
|
4487
|
-
enabledPresentmentCurrencies:
|
|
4488
|
-
hasSmartCollectionsEnabled:
|
|
4489
|
-
hasSmartSearchEnabled:
|
|
4490
|
-
id:
|
|
4491
|
-
integrations:
|
|
4492
|
-
|
|
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([
|
|
4493
4537
|
"attentive",
|
|
4494
4538
|
"judgeme",
|
|
4495
4539
|
"junip",
|
|
@@ -4502,170 +4546,170 @@ var ShopConfig = z89.object({
|
|
|
4502
4546
|
"stamped",
|
|
4503
4547
|
"yotpo"
|
|
4504
4548
|
]),
|
|
4505
|
-
|
|
4549
|
+
z91.union([z91.boolean(), z91.unknown()])
|
|
4506
4550
|
),
|
|
4507
|
-
markets:
|
|
4508
|
-
enabled:
|
|
4551
|
+
markets: z91.object({
|
|
4552
|
+
enabled: z91.boolean()
|
|
4509
4553
|
}),
|
|
4510
|
-
monetize:
|
|
4511
|
-
publisherKey:
|
|
4554
|
+
monetize: z91.object({
|
|
4555
|
+
publisherKey: z91.string().nullable()
|
|
4512
4556
|
}).nullish(),
|
|
4513
|
-
moneyFormat:
|
|
4514
|
-
myshopifyDomain:
|
|
4515
|
-
primaryLocale:
|
|
4516
|
-
productGroupsEnabled:
|
|
4517
|
-
rechargeCustomDomain:
|
|
4518
|
-
sellingPlansEnabled:
|
|
4519
|
-
shopId:
|
|
4520
|
-
shopifySellingPlansEnabled:
|
|
4521
|
-
shopName:
|
|
4522
|
-
storefrontAccessToken:
|
|
4523
|
-
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()
|
|
4524
4568
|
});
|
|
4525
4569
|
|
|
4526
4570
|
// src/schema/userConfig.ts
|
|
4527
|
-
import { z as
|
|
4528
|
-
var UserConfig =
|
|
4571
|
+
import { z as z92 } from "zod";
|
|
4572
|
+
var UserConfig = z92.object({
|
|
4529
4573
|
shop: ShopConfig,
|
|
4530
4574
|
/**
|
|
4531
4575
|
* `.catch(undefined)` is the safety bar: smart-cart shape drift can NEVER fail `fetchUserConfig`,
|
|
4532
4576
|
* which resolves the apiKey for every offers/monetize/analytics/gift request.
|
|
4533
4577
|
*/
|
|
4534
4578
|
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
4535
|
-
smartFlows:
|
|
4579
|
+
smartFlows: z92.array(z92.unknown())
|
|
4536
4580
|
});
|
|
4537
4581
|
|
|
4538
4582
|
// src/schema/widgetData.ts
|
|
4539
|
-
import { z as
|
|
4583
|
+
import { z as z101 } from "zod";
|
|
4540
4584
|
|
|
4541
4585
|
// src/schema/widgets/abTestingPlaceholder.ts
|
|
4542
|
-
import { z as
|
|
4543
|
-
var ABTestingPlaceholder =
|
|
4544
|
-
type:
|
|
4586
|
+
import { z as z93 } from "zod";
|
|
4587
|
+
var ABTestingPlaceholder = z93.looseObject({
|
|
4588
|
+
type: z93.literal("placeholder")
|
|
4545
4589
|
});
|
|
4546
4590
|
|
|
4547
4591
|
// src/schema/widgets/checkoutExtension.ts
|
|
4548
|
-
import { z as
|
|
4549
|
-
var CheckoutExtension =
|
|
4550
|
-
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)
|
|
4551
4595
|
});
|
|
4552
4596
|
|
|
4553
4597
|
// src/schema/widgets/contentBlock.ts
|
|
4554
|
-
import { z as
|
|
4555
|
-
var ContentBlockV1 =
|
|
4556
|
-
blockSpacing:
|
|
4557
|
-
imageBlocks:
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
altText:
|
|
4561
|
-
description:
|
|
4562
|
-
id:
|
|
4563
|
-
imagePlacement:
|
|
4564
|
-
imageSize:
|
|
4565
|
-
imageUrl:
|
|
4566
|
-
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"]),
|
|
4567
4611
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
4568
|
-
textSize:
|
|
4612
|
+
textSize: z95.enum(inlineTextSizeNames)
|
|
4569
4613
|
})
|
|
4570
4614
|
),
|
|
4571
|
-
|
|
4615
|
+
z95.strictObject({}).transform(() => [])
|
|
4572
4616
|
]).optional(),
|
|
4573
|
-
imageLayout:
|
|
4574
|
-
language:
|
|
4575
|
-
description:
|
|
4576
|
-
superTitle:
|
|
4577
|
-
title:
|
|
4617
|
+
imageLayout: z95.enum(["row", "column"]).optional(),
|
|
4618
|
+
language: z95.object({
|
|
4619
|
+
description: z95.string(),
|
|
4620
|
+
superTitle: z95.string(),
|
|
4621
|
+
title: z95.string()
|
|
4578
4622
|
}),
|
|
4579
|
-
previewMode:
|
|
4580
|
-
type:
|
|
4581
|
-
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)
|
|
4582
4626
|
});
|
|
4583
|
-
var ContentBlock =
|
|
4627
|
+
var ContentBlock = z95.discriminatedUnion("version", [
|
|
4584
4628
|
ContentBlockV1,
|
|
4585
4629
|
CABRootSection.extend({
|
|
4586
|
-
type:
|
|
4630
|
+
type: z95.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
4587
4631
|
})
|
|
4588
4632
|
]);
|
|
4589
4633
|
|
|
4590
4634
|
// src/schema/widgets/giftWithPurchase.ts
|
|
4591
|
-
import { z as
|
|
4592
|
-
var GiftWithPurchase =
|
|
4593
|
-
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)
|
|
4594
4638
|
});
|
|
4595
4639
|
|
|
4596
4640
|
// src/schema/widgets/lineItemEditor.ts
|
|
4597
|
-
import { z as
|
|
4598
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
4599
|
-
downgradeToOneTimeLabel:
|
|
4641
|
+
import { z as z97 } from "zod";
|
|
4642
|
+
var LineItemEditorSwitchLanguageV1 = z97.object({
|
|
4643
|
+
downgradeToOneTimeLabel: z97.string().optional(),
|
|
4600
4644
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
4601
|
-
subscriptionOptionLabel:
|
|
4602
|
-
upgradeToSubscriptionLabel:
|
|
4603
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
4645
|
+
subscriptionOptionLabel: z97.string().optional(),
|
|
4646
|
+
upgradeToSubscriptionLabel: z97.string().optional(),
|
|
4647
|
+
upgradeToSubscriptionWithoutDiscountLabel: z97.string().optional()
|
|
4604
4648
|
});
|
|
4605
|
-
var LineItemEditorV1 =
|
|
4649
|
+
var LineItemEditorV1 = z97.object({
|
|
4606
4650
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
4607
|
-
button:
|
|
4608
|
-
previewMode:
|
|
4609
|
-
switchToSubscription:
|
|
4610
|
-
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(),
|
|
4611
4655
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
4612
4656
|
}).optional(),
|
|
4613
|
-
switchToSubscriptionEnabled:
|
|
4614
|
-
tracking:
|
|
4615
|
-
enableAttribution:
|
|
4616
|
-
enableSource:
|
|
4617
|
-
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()
|
|
4618
4662
|
}).optional(),
|
|
4619
|
-
type:
|
|
4620
|
-
version:
|
|
4663
|
+
type: z97.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
4664
|
+
version: z97.literal(1)
|
|
4621
4665
|
});
|
|
4622
|
-
var LineItemEditor =
|
|
4666
|
+
var LineItemEditor = z97.discriminatedUnion("version", [
|
|
4623
4667
|
LineItemEditorV1,
|
|
4624
4668
|
CABRootSection.extend({
|
|
4625
|
-
type:
|
|
4669
|
+
type: z97.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
4626
4670
|
})
|
|
4627
4671
|
]);
|
|
4628
4672
|
|
|
4629
4673
|
// src/schema/widgets/progressBar.ts
|
|
4630
|
-
import { z as
|
|
4631
|
-
var ProgressBar =
|
|
4632
|
-
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)
|
|
4633
4677
|
});
|
|
4634
4678
|
|
|
4635
4679
|
// src/schema/widgets/rebuyButton.ts
|
|
4636
|
-
import { z as
|
|
4637
|
-
var RebuyButtonV1 =
|
|
4638
|
-
type:
|
|
4639
|
-
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)
|
|
4640
4684
|
});
|
|
4641
|
-
var RebuyButton =
|
|
4685
|
+
var RebuyButton = z99.discriminatedUnion("version", [
|
|
4642
4686
|
RebuyButtonV1,
|
|
4643
4687
|
CABRootSection.extend({
|
|
4644
|
-
type:
|
|
4688
|
+
type: z99.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
4645
4689
|
})
|
|
4646
4690
|
]);
|
|
4647
4691
|
|
|
4648
4692
|
// src/schema/widgets/rebuyMonetize.ts
|
|
4649
|
-
import { z as
|
|
4650
|
-
var RebuyMonetize =
|
|
4651
|
-
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)
|
|
4652
4696
|
});
|
|
4653
|
-
var RebuyMonetizeV1 =
|
|
4654
|
-
name:
|
|
4655
|
-
previewMode:
|
|
4697
|
+
var RebuyMonetizeV1 = z100.object({
|
|
4698
|
+
name: z100.string().nullable().optional(),
|
|
4699
|
+
previewMode: z100.boolean().optional(),
|
|
4656
4700
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
4657
|
-
privacyPolicyUrl:
|
|
4701
|
+
privacyPolicyUrl: z100.string().nullable().optional(),
|
|
4658
4702
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
4659
|
-
subVertical:
|
|
4660
|
-
tracking:
|
|
4661
|
-
enableAttribution:
|
|
4662
|
-
enableSource:
|
|
4663
|
-
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()
|
|
4664
4708
|
}).optional(),
|
|
4665
|
-
type:
|
|
4666
|
-
version:
|
|
4709
|
+
type: z100.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
4710
|
+
version: z100.literal(1),
|
|
4667
4711
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
4668
|
-
vertical:
|
|
4712
|
+
vertical: z100.string().nullable().optional()
|
|
4669
4713
|
});
|
|
4670
4714
|
|
|
4671
4715
|
// src/schema/widgetData.ts
|
|
@@ -4679,7 +4723,7 @@ var extensionWidgetTypes = [
|
|
|
4679
4723
|
WidgetType.ui_extension_line_item_editor,
|
|
4680
4724
|
WidgetType.ui_extension_progress_bar
|
|
4681
4725
|
];
|
|
4682
|
-
var WidgetData =
|
|
4726
|
+
var WidgetData = z101.discriminatedUnion("type", [
|
|
4683
4727
|
ABTestingPlaceholder,
|
|
4684
4728
|
CheckoutExtension,
|
|
4685
4729
|
ContentBlock,
|
|
@@ -5039,36 +5083,36 @@ var SWITCH_LABELS = {
|
|
|
5039
5083
|
};
|
|
5040
5084
|
|
|
5041
5085
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
5042
|
-
import { z as
|
|
5086
|
+
import { z as z103 } from "zod";
|
|
5043
5087
|
|
|
5044
5088
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
5045
|
-
import { z as
|
|
5046
|
-
var PostPurchaseWidgetLinkedFlow =
|
|
5047
|
-
id:
|
|
5048
|
-
name:
|
|
5049
|
-
});
|
|
5050
|
-
var PostPurchaseWidget =
|
|
5051
|
-
classification:
|
|
5052
|
-
createdAtTime:
|
|
5053
|
-
customEndpointName:
|
|
5054
|
-
id:
|
|
5055
|
-
lastViewed:
|
|
5056
|
-
linkedCustomEndpointId:
|
|
5057
|
-
linkedFlows:
|
|
5058
|
-
name:
|
|
5059
|
-
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(),
|
|
5060
5104
|
settings: PostPurchaseSettings
|
|
5061
5105
|
});
|
|
5062
5106
|
|
|
5063
5107
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
5064
|
-
var PostPurchaseOffer =
|
|
5065
|
-
|
|
5066
|
-
errors:
|
|
5067
|
-
message:
|
|
5068
|
-
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)
|
|
5069
5113
|
}),
|
|
5070
|
-
|
|
5071
|
-
successful:
|
|
5114
|
+
z103.strictObject({
|
|
5115
|
+
successful: z103.literal(true),
|
|
5072
5116
|
widget: PostPurchaseWidget
|
|
5073
5117
|
})
|
|
5074
5118
|
]);
|
|
@@ -5571,21 +5615,26 @@ var buildOfferTemplate = ({ location: location2, name } = {}) => CABRootSection.
|
|
|
5571
5615
|
type: SHOPIFY_CHECKOUT_EXTENSION
|
|
5572
5616
|
});
|
|
5573
5617
|
|
|
5574
|
-
// src/transforms/
|
|
5575
|
-
var
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
var
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
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 = () => ({
|
|
5589
5638
|
content: [
|
|
5590
5639
|
{
|
|
5591
5640
|
content: [
|
|
@@ -5611,6 +5660,64 @@ var buildPriceContent = () => ({
|
|
|
5611
5660
|
],
|
|
5612
5661
|
type: "doc"
|
|
5613
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
|
+
};
|
|
5614
5721
|
var buildReviews = (settings) => {
|
|
5615
5722
|
if (!settings.integrations || !Object.values(settings.integrations).some(Boolean)) return [];
|
|
5616
5723
|
const reviews = settings.displaySettings?.reviews;
|
|
@@ -5652,29 +5759,11 @@ var buildTitle = (settings) => ({
|
|
|
5652
5759
|
},
|
|
5653
5760
|
sectionType: "text"
|
|
5654
5761
|
});
|
|
5655
|
-
var buildPrice = () => ({
|
|
5656
|
-
content: { en: buildPriceContent() },
|
|
5657
|
-
sectionType: "text"
|
|
5658
|
-
});
|
|
5659
5762
|
var HAS_VARIANT_TITLE = "hasVariantTitle";
|
|
5660
5763
|
var buildVariantTitle = (settings) => {
|
|
5661
5764
|
const show = settings.productOptions?.showVariantTitle;
|
|
5662
5765
|
if (!show || show === "hide") return [];
|
|
5663
|
-
return [
|
|
5664
|
-
{
|
|
5665
|
-
content: { en: buildStyledText("{{variantTitle}}", settings.displaySettings?.variant) },
|
|
5666
|
-
mutators: [
|
|
5667
|
-
{ effect: "set_false", variable: HAS_VARIANT_TITLE, when: { operator: "is_empty", type: "content" } },
|
|
5668
|
-
{
|
|
5669
|
-
effect: "set_true",
|
|
5670
|
-
variable: HAS_VARIANT_TITLE,
|
|
5671
|
-
when: { operator: "is_not_empty", type: "content" }
|
|
5672
|
-
}
|
|
5673
|
-
],
|
|
5674
|
-
sectionType: "text",
|
|
5675
|
-
visibility: { variable: HAS_VARIANT_TITLE, visibleWhen: true }
|
|
5676
|
-
}
|
|
5677
|
-
];
|
|
5766
|
+
return [earnedText(HAS_VARIANT_TITLE, buildStyledText("{{variantTitle}}", settings.displaySettings?.variant))];
|
|
5678
5767
|
};
|
|
5679
5768
|
var detailBlock = (sections, horizontal, hasVariantTitleLine) => ({
|
|
5680
5769
|
alignment: { horizontal: horizontal ? "start" : "center", vertical: "top" },
|
|
@@ -5703,18 +5792,7 @@ var buildDescription = (settings) => {
|
|
|
5703
5792
|
},
|
|
5704
5793
|
{
|
|
5705
5794
|
content: { en: buildStyledText("{{productDescription}}", void 0) },
|
|
5706
|
-
mutators:
|
|
5707
|
-
{
|
|
5708
|
-
effect: "set_false",
|
|
5709
|
-
variable: HAS_DESCRIPTION,
|
|
5710
|
-
when: { operator: "is_empty", type: "content" }
|
|
5711
|
-
},
|
|
5712
|
-
{
|
|
5713
|
-
effect: "set_true",
|
|
5714
|
-
variable: HAS_DESCRIPTION,
|
|
5715
|
-
when: { operator: "is_not_empty", type: "content" }
|
|
5716
|
-
}
|
|
5717
|
-
],
|
|
5795
|
+
mutators: earnedFrom(HAS_DESCRIPTION),
|
|
5718
5796
|
sectionType: "text",
|
|
5719
5797
|
visibility: { variable: SHOW_DESCRIPTION, visibleWhen: true }
|
|
5720
5798
|
}
|
|
@@ -5730,7 +5808,7 @@ var buildDescription = (settings) => {
|
|
|
5730
5808
|
var SHOW_VARIANTS = "showVariants";
|
|
5731
5809
|
var REVEAL_PENDING = "revealPending";
|
|
5732
5810
|
var revealsVariants = (settings) => settings.viewOptions?.displayActions !== false && settings.productOptions?.showVariantOptions === "default";
|
|
5733
|
-
var
|
|
5811
|
+
var contentMutator2 = (effect, variable, operator) => ({
|
|
5734
5812
|
effect,
|
|
5735
5813
|
variable,
|
|
5736
5814
|
when: { operator, type: "content" }
|
|
@@ -5744,10 +5822,10 @@ var buildVariants = (settings) => {
|
|
|
5744
5822
|
hideOutOfStockVariants: !!settings.productOptions?.hideOutOfStockVariants,
|
|
5745
5823
|
...revealsVariants(settings) && {
|
|
5746
5824
|
mutators: [
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
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")
|
|
5751
5829
|
]
|
|
5752
5830
|
},
|
|
5753
5831
|
...selector && { selector: VARIANT_SELECTOR[selector] },
|
|
@@ -5772,43 +5850,20 @@ var buildQuantityErrors = (quantity2) => {
|
|
|
5772
5850
|
var buildQuantity = (settings) => {
|
|
5773
5851
|
const quantity2 = settings.quantityInputs;
|
|
5774
5852
|
if (!quantity2?.enabled) return [];
|
|
5775
|
-
const
|
|
5776
|
-
const max = Math.min(Math.max(quantity2.maxValue ?? 10, 1), 100);
|
|
5777
|
-
const min = Math.min(Math.max(quantity2.minValue ?? 1, 1), max);
|
|
5853
|
+
const errors = buildQuantityErrors(quantity2);
|
|
5778
5854
|
return [
|
|
5779
|
-
{
|
|
5780
|
-
...
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
}
|
|
5786
|
-
];
|
|
5787
|
-
};
|
|
5788
|
-
var buildSubscriptionButton = (settings) => {
|
|
5789
|
-
if (settings.productType !== "both" && settings.productType !== "subscription") return [];
|
|
5790
|
-
const language3 = settings.language;
|
|
5791
|
-
const slot = (buttonField, override) => ({
|
|
5792
|
-
buttonField,
|
|
5793
|
-
content: localizedContent(SWITCH_LABELS[buttonField], override, SWITCH_LABEL_TOKENS),
|
|
5794
|
-
sectionType: "text"
|
|
5795
|
-
});
|
|
5796
|
-
return [
|
|
5797
|
-
{
|
|
5798
|
-
action: "switchToSubscription",
|
|
5799
|
-
buttonStyle: "plain",
|
|
5800
|
-
/** A `subscription` widget offers no one-time purchase (legacy's offers checkbox renders only when `isProductTypeBoth`); suppress the downgrade so the buyer can't switch to one-time on a subscription-only offer. */
|
|
5801
|
-
...settings.productType === "subscription" && { disableDowngrade: true },
|
|
5802
|
-
sections: [
|
|
5803
|
-
slot("subscriptionOption", void 0),
|
|
5804
|
-
slot("switchToOneTimePurchase", language3?.cartSwitchToOnetime),
|
|
5805
|
-
slot("switchToSubscriptionNoDiscount", language3?.upgradeToSubscription),
|
|
5806
|
-
slot("switchToSubscriptionWithDiscount", language3?.upgradeToSubscription)
|
|
5807
|
-
],
|
|
5808
|
-
sectionType: "button"
|
|
5809
|
-
}
|
|
5855
|
+
quantitySection({
|
|
5856
|
+
...errors,
|
|
5857
|
+
inputType: quantity2.type ? QUANTITY_INPUT_TYPE[quantity2.type] : void 0,
|
|
5858
|
+
maxValue: quantity2.maxValue,
|
|
5859
|
+
minValue: quantity2.minValue
|
|
5860
|
+
})
|
|
5810
5861
|
];
|
|
5811
5862
|
};
|
|
5863
|
+
var buildSubscriptionButton = (settings) => subscriptionToggle(settings.productType, {
|
|
5864
|
+
oneTime: settings.language?.cartSwitchToOnetime,
|
|
5865
|
+
upgrade: settings.language?.upgradeToSubscription
|
|
5866
|
+
});
|
|
5812
5867
|
var BUTTON_KINDS = ["plain", "primary", "secondary"];
|
|
5813
5868
|
var buttonKind = (settings) => {
|
|
5814
5869
|
const kind = settings.button?.kind;
|
|
@@ -5854,7 +5909,7 @@ var buildOfferCard = (settings, horizontal) => {
|
|
|
5854
5909
|
const image = buildImage(settings);
|
|
5855
5910
|
const title = buildTitle(settings);
|
|
5856
5911
|
const variantTitle = buildVariantTitle(settings);
|
|
5857
|
-
const price =
|
|
5912
|
+
const price = priceText();
|
|
5858
5913
|
const description = buildDescription(settings);
|
|
5859
5914
|
const reviews = buildReviews(settings);
|
|
5860
5915
|
const variants = buildVariants(settings);
|
|
@@ -6267,29 +6322,87 @@ var postPurchaseCosts = (prepared, response, currencyCode) => {
|
|
|
6267
6322
|
});
|
|
6268
6323
|
};
|
|
6269
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
|
+
|
|
6270
6373
|
// src/pricing/postPurchaseSubscriptionDisplay.ts
|
|
6271
6374
|
var postPurchaseSubscriptionDisplay = (prepared, currencyCode) => {
|
|
6272
6375
|
const subscription = readPostPurchaseSubscription(prepared);
|
|
6273
6376
|
if (!subscription) return void 0;
|
|
6274
|
-
const
|
|
6275
|
-
const variant2 = subscription.product.variant;
|
|
6276
|
-
const regular = amountToCents2(variant2.price, decimals);
|
|
6277
|
-
const compareAt = amountToCents2(variant2.compareAtPrice, decimals);
|
|
6278
|
-
const comparisonMinor = subscription.display.discountedFrom === "compare_at_price" && compareAt > regular ? compareAt : regular;
|
|
6279
|
-
const adjustment = subscription.terms.subscription.adjustment;
|
|
6280
|
-
const reduce = (price, discount) => {
|
|
6281
|
-
const reduction = discount.type === "percentage" ? Math.round(price * discount.amount / 100) : discount.type === "fixed_amount" ? amountToCents2(discount.amount, decimals) : 0;
|
|
6282
|
-
return Math.max(0, price - reduction);
|
|
6283
|
-
};
|
|
6284
|
-
const planPrice = adjustment?.type === "price" ? amountToCents2(adjustment.amount, decimals) : adjustment ? reduce(regular, { amount: adjustment.amount, type: adjustment.type }) : regular;
|
|
6285
|
-
const priceMinor = reduce(planPrice, subscription.terms.discount);
|
|
6286
|
-
const savingMinor = Math.max(0, comparisonMinor - priceMinor);
|
|
6377
|
+
const { compareAtPrice, price } = subscription.product.variant;
|
|
6287
6378
|
return PostPurchaseSubscriptionDisplay.parse({
|
|
6288
|
-
|
|
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,
|
|
6289
6397
|
currencyCode,
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
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) }
|
|
6293
6406
|
});
|
|
6294
6407
|
};
|
|
6295
6408
|
export {
|
|
@@ -6329,6 +6442,7 @@ export {
|
|
|
6329
6442
|
CABExperiment,
|
|
6330
6443
|
CABImageSection,
|
|
6331
6444
|
CABImageSectionFields,
|
|
6445
|
+
CABImageThumbnails,
|
|
6332
6446
|
CABIntegrations,
|
|
6333
6447
|
CABLayoutSection,
|
|
6334
6448
|
CABLayoutWrapping,
|
|
@@ -6456,6 +6570,7 @@ export {
|
|
|
6456
6570
|
PostPurchaseCollectionChoice,
|
|
6457
6571
|
PostPurchaseCommonReviewRating,
|
|
6458
6572
|
PostPurchaseDiscount,
|
|
6573
|
+
PostPurchaseDisplayPrice,
|
|
6459
6574
|
PostPurchaseExcludedProductIds,
|
|
6460
6575
|
PostPurchaseGroupCatalog,
|
|
6461
6576
|
PostPurchaseGroupChoice,
|
|
@@ -6614,6 +6729,7 @@ export {
|
|
|
6614
6729
|
VariableType,
|
|
6615
6730
|
VariantMode,
|
|
6616
6731
|
VariantSelector,
|
|
6732
|
+
VariantsMode,
|
|
6617
6733
|
VerticalAlignment,
|
|
6618
6734
|
WidgetData,
|
|
6619
6735
|
WidgetType,
|
|
@@ -6692,6 +6808,7 @@ export {
|
|
|
6692
6808
|
popoverPositions,
|
|
6693
6809
|
postPurchaseChangeset,
|
|
6694
6810
|
postPurchaseCosts,
|
|
6811
|
+
postPurchaseDisplayPrice,
|
|
6695
6812
|
postPurchaseHealthTaskId,
|
|
6696
6813
|
postPurchaseSubscriptionDisplay,
|
|
6697
6814
|
postPurchaseTaskNameSchema,
|
|
@@ -6730,6 +6847,7 @@ export {
|
|
|
6730
6847
|
variantModes,
|
|
6731
6848
|
variantPriceObject,
|
|
6732
6849
|
variantSelectors,
|
|
6850
|
+
variantsModes,
|
|
6733
6851
|
verticalAlignments,
|
|
6734
6852
|
widgetTypes
|
|
6735
6853
|
};
|