@rebuy/rebuy 3.44.1 → 3.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +479 -449
- package/dist/index.mjs +480 -450
- package/dist/schema/checkout-and-beyond/index.cjs +21 -0
- package/dist/schema/checkout-and-beyond/index.mjs +22 -1
- package/dist/schema/postPurchaseFinish.d.ts +27 -0
- package/dist/schema/widget-data.cjs +21 -0
- package/dist/schema/widget-data.mjs +22 -1
- package/dist/schema/widgets/checkout-and-beyond/button.d.ts +4 -0
- package/dist/schema/widgets/checkout-and-beyond/variants.d.ts +1 -0
- package/dist/server/index.cjs +27 -2
- package/dist/server/index.mjs +28 -3
- package/dist/transforms/index.cjs +27 -2
- package/dist/transforms/index.mjs +28 -3
- package/dist/transforms/postPurchase/productCardControls.d.ts +2 -2
- package/dist/transforms/productCard/subscriptionToggle.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2704,7 +2704,7 @@ var ExitPolicySchema = z38.discriminatedUnion("status", [
|
|
|
2704
2704
|
]);
|
|
2705
2705
|
|
|
2706
2706
|
// src/schema/postPurchaseFinish.ts
|
|
2707
|
-
import { z as
|
|
2707
|
+
import { z as z47 } from "zod";
|
|
2708
2708
|
|
|
2709
2709
|
// src/schema/postPurchaseFollowups.ts
|
|
2710
2710
|
import { z as z43 } from "zod";
|
|
@@ -2866,39 +2866,80 @@ var SessionClosureSchema = z44.object({ closedAt: PostPurchaseTimestampSchema, s
|
|
|
2866
2866
|
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
2867
2867
|
var SessionCloseResponseSchema = z44.object({ data: SessionClosureSchema, successful: z44.literal(true) });
|
|
2868
2868
|
|
|
2869
|
+
// src/schema/postPurchaseTransition.ts
|
|
2870
|
+
import { z as z46 } from "zod";
|
|
2871
|
+
|
|
2872
|
+
// src/schema/postPurchaseSkipTrace.ts
|
|
2873
|
+
import { z as z45 } from "zod";
|
|
2874
|
+
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
2875
|
+
var PostPurchaseSkipTraceSchema = z45.array(
|
|
2876
|
+
z45.object({
|
|
2877
|
+
entry: DecisionEntrySchema,
|
|
2878
|
+
reason: PostPurchaseSkipReasonSchema
|
|
2879
|
+
})
|
|
2880
|
+
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
2881
|
+
|
|
2882
|
+
// src/schema/postPurchaseTransition.ts
|
|
2883
|
+
var OfferTransitionRequestSchema = DecideRequestSchema.extend({
|
|
2884
|
+
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
2885
|
+
progressRevision: PostPurchaseProgressSchema.shape.revision
|
|
2886
|
+
}).strict();
|
|
2887
|
+
var PostPurchaseEndReasonSchema = z46.enum(["no-child", "no-products", "accept-cap"]);
|
|
2888
|
+
var TransitionBaseSchema = z46.object({
|
|
2889
|
+
attemptedSkips: PostPurchaseSkipTraceSchema.optional(),
|
|
2890
|
+
progress: PostPurchaseProgressSchema
|
|
2891
|
+
});
|
|
2892
|
+
var OfferTransitionResponseSchema = z46.object({
|
|
2893
|
+
data: z46.discriminatedUnion("status", [
|
|
2894
|
+
TransitionBaseSchema.extend({ status: z46.enum(["advanced", "unavailable"]) }),
|
|
2895
|
+
TransitionBaseSchema.extend({
|
|
2896
|
+
endReason: PostPurchaseEndReasonSchema.optional(),
|
|
2897
|
+
status: z46.literal("no-child")
|
|
2898
|
+
})
|
|
2899
|
+
]),
|
|
2900
|
+
successful: z46.literal(true)
|
|
2901
|
+
});
|
|
2902
|
+
|
|
2869
2903
|
// src/schema/postPurchaseFinish.ts
|
|
2870
|
-
var FinishedPurchaseSchema =
|
|
2871
|
-
|
|
2872
|
-
|
|
2904
|
+
var FinishedPurchaseSchema = z47.union([
|
|
2905
|
+
z47.strictObject({ status: z47.literal("none") }),
|
|
2906
|
+
z47.strictObject({
|
|
2873
2907
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
2874
|
-
status:
|
|
2875
|
-
|
|
2908
|
+
status: z47.union([
|
|
2909
|
+
z47.literal("pending"),
|
|
2876
2910
|
...PurchaseObservationSchema.options.map((option) => option.shape.status)
|
|
2877
2911
|
])
|
|
2878
2912
|
})
|
|
2879
2913
|
]);
|
|
2880
|
-
var
|
|
2881
|
-
var
|
|
2914
|
+
var PostPurchaseFinishReasonSchema = z47.enum(["decline-all", "timer-expiry", "end", "unknown-result"]);
|
|
2915
|
+
var SessionFinishRequestSchema = DecideRequestSchema.extend({
|
|
2916
|
+
endReason: PostPurchaseEndReasonSchema.optional(),
|
|
2917
|
+
reason: PostPurchaseFinishReasonSchema.optional()
|
|
2918
|
+
}).strict().refine(({ endReason, reason }) => endReason === void 0 || reason === "end", {
|
|
2919
|
+
message: 'endReason is only valid with reason "end"',
|
|
2920
|
+
path: ["endReason"]
|
|
2921
|
+
});
|
|
2922
|
+
var SessionFinishResponseSchema = z47.object({
|
|
2882
2923
|
data: SessionClosureSchema.extend({
|
|
2883
2924
|
classification: ClassificationProgressSchema,
|
|
2884
2925
|
exitPolicy: ExitPolicySchema,
|
|
2885
2926
|
health: RequiredHealthSchema.nullable(),
|
|
2886
2927
|
purchase: FinishedPurchaseSchema
|
|
2887
2928
|
}),
|
|
2888
|
-
successful:
|
|
2929
|
+
successful: z47.literal(true)
|
|
2889
2930
|
});
|
|
2890
2931
|
|
|
2891
2932
|
// src/schema/postPurchaseQuantity.ts
|
|
2892
|
-
import { z as
|
|
2933
|
+
import { z as z71 } from "zod";
|
|
2893
2934
|
|
|
2894
2935
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
2895
|
-
import { z as
|
|
2936
|
+
import { z as z70 } from "zod";
|
|
2896
2937
|
|
|
2897
2938
|
// src/schema/postPurchaseProductView.ts
|
|
2898
|
-
import { z as
|
|
2939
|
+
import { z as z69 } from "zod";
|
|
2899
2940
|
|
|
2900
2941
|
// src/schema/postPurchaseGroupCatalog.ts
|
|
2901
|
-
import { z as
|
|
2942
|
+
import { z as z48 } from "zod";
|
|
2902
2943
|
var productId = PreparedPostPurchaseProduct.shape.selection.shape.productId;
|
|
2903
2944
|
var source = PostPurchaseProductSource.shape.data.element;
|
|
2904
2945
|
var PostPurchaseGroupDescription = source.pick({ description: true, id: true, image: true, images: true, title: true }).extend({
|
|
@@ -2906,17 +2947,17 @@ var PostPurchaseGroupDescription = source.pick({ description: true, id: true, im
|
|
|
2906
2947
|
image: source.shape.image.default(null),
|
|
2907
2948
|
options: PostPurchaseVariantCatalog.shape.options.default([])
|
|
2908
2949
|
});
|
|
2909
|
-
var PostPurchaseGroupCatalog =
|
|
2950
|
+
var PostPurchaseGroupCatalog = z48.object({
|
|
2910
2951
|
memberProductId: productId,
|
|
2911
|
-
options:
|
|
2952
|
+
options: z48.array(z48.object({ productId, title: z48.string(), variantCatalog: PostPurchaseVariantCatalog }))
|
|
2912
2953
|
});
|
|
2913
|
-
var PostPurchaseGroupSelection =
|
|
2954
|
+
var PostPurchaseGroupSelection = z48.object({
|
|
2914
2955
|
memberProductId: productId,
|
|
2915
2956
|
productId
|
|
2916
2957
|
});
|
|
2917
2958
|
|
|
2918
2959
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2919
|
-
import { z as
|
|
2960
|
+
import { z as z68 } from "zod";
|
|
2920
2961
|
|
|
2921
2962
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
2922
2963
|
import { uniqBy } from "es-toolkit";
|
|
@@ -2971,18 +3012,18 @@ var targetAreas = {
|
|
|
2971
3012
|
|
|
2972
3013
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
2973
3014
|
import { v7 as uuidv713 } from "uuid";
|
|
2974
|
-
import { z as
|
|
3015
|
+
import { z as z67 } from "zod";
|
|
2975
3016
|
|
|
2976
3017
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
2977
|
-
import { z as
|
|
3018
|
+
import { z as z66 } from "zod";
|
|
2978
3019
|
|
|
2979
3020
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
2980
|
-
import { z as
|
|
2981
|
-
var CABBannerSection =
|
|
3021
|
+
import { z as z49 } from "zod";
|
|
3022
|
+
var CABBannerSection = z49.lazy(
|
|
2982
3023
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2983
|
-
buttonField:
|
|
2984
|
-
color:
|
|
2985
|
-
dismissible:
|
|
3024
|
+
buttonField: z49.enum(buttonFields).optional(),
|
|
3025
|
+
color: z49.enum(bannerColors).default("info"),
|
|
3026
|
+
dismissible: z49.boolean().default(true),
|
|
2986
3027
|
/**
|
|
2987
3028
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
2988
3029
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -2998,18 +3039,18 @@ var CABBannerSection = z47.lazy(
|
|
|
2998
3039
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
2999
3040
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
3000
3041
|
*/
|
|
3001
|
-
heading:
|
|
3002
|
-
sectionType:
|
|
3042
|
+
heading: z49.record(z49.string(), z49.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
3043
|
+
sectionType: z49.literal(SectionType.banner).default(SectionType.banner)
|
|
3003
3044
|
})
|
|
3004
3045
|
);
|
|
3005
3046
|
|
|
3006
3047
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
3007
3048
|
import { v7 as uuidv73 } from "uuid";
|
|
3008
|
-
import { z as
|
|
3049
|
+
import { z as z52 } from "zod";
|
|
3009
3050
|
|
|
3010
3051
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
3011
3052
|
import { v7 as uuidv72 } from "uuid";
|
|
3012
|
-
import { z as
|
|
3053
|
+
import { z as z51 } from "zod";
|
|
3013
3054
|
|
|
3014
3055
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
3015
3056
|
var iconNames = [
|
|
@@ -3096,24 +3137,24 @@ var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "wa
|
|
|
3096
3137
|
var IconTone = freezeEnum(iconTones);
|
|
3097
3138
|
|
|
3098
3139
|
// src/schema/widgets/checkout-and-beyond/imageThumbnails.ts
|
|
3099
|
-
import { z as
|
|
3100
|
-
var CABImageThumbnails =
|
|
3101
|
-
limit:
|
|
3102
|
-
perLine:
|
|
3140
|
+
import { z as z50 } from "zod";
|
|
3141
|
+
var CABImageThumbnails = z50.object({
|
|
3142
|
+
limit: z50.number().int().min(1).default(8),
|
|
3143
|
+
perLine: z50.number().int().min(1).max(8).default(4)
|
|
3103
3144
|
});
|
|
3104
3145
|
|
|
3105
3146
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
3106
|
-
var CABImageSectionFields =
|
|
3147
|
+
var CABImageSectionFields = z51.object({
|
|
3107
3148
|
...CABVariableFields,
|
|
3108
|
-
altText:
|
|
3149
|
+
altText: z51.string().refine(checkForHTML, NO_HTML).default(""),
|
|
3109
3150
|
/**
|
|
3110
3151
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
3111
3152
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
3112
3153
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
3113
3154
|
*/
|
|
3114
|
-
aspectRatio:
|
|
3115
|
-
border:
|
|
3116
|
-
buttonField:
|
|
3155
|
+
aspectRatio: z51.number().positive().nullable().default(null),
|
|
3156
|
+
border: z51.lazy(() => CABBorder),
|
|
3157
|
+
buttonField: z51.enum(buttonFields).optional(),
|
|
3117
3158
|
/**
|
|
3118
3159
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
3119
3160
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -3132,30 +3173,30 @@ var CABImageSectionFields = z49.object({
|
|
|
3132
3173
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
3133
3174
|
* the risky half.
|
|
3134
3175
|
*/
|
|
3135
|
-
category:
|
|
3176
|
+
category: z51.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
3136
3177
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
3137
|
-
iconSize:
|
|
3178
|
+
iconSize: z51.enum(iconSizes).nullable().default(null),
|
|
3138
3179
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
3139
|
-
iconTone:
|
|
3140
|
-
name:
|
|
3141
|
-
naturalHeight:
|
|
3142
|
-
naturalWidth:
|
|
3180
|
+
iconTone: z51.enum(iconTones).nullable().default(null),
|
|
3181
|
+
name: z51.string().optional(),
|
|
3182
|
+
naturalHeight: z51.number().default(0),
|
|
3183
|
+
naturalWidth: z51.number().default(0),
|
|
3143
3184
|
/**
|
|
3144
3185
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
3145
3186
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
3146
3187
|
*/
|
|
3147
|
-
objectFit:
|
|
3148
|
-
sectionId:
|
|
3149
|
-
sectionType:
|
|
3188
|
+
objectFit: z51.enum(objectFits).default(ObjectFit.contain),
|
|
3189
|
+
sectionId: z51.uuid().default(() => uuidv72()),
|
|
3190
|
+
sectionType: z51.literal(SectionType.image).default(SectionType.image),
|
|
3150
3191
|
/**
|
|
3151
3192
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
3152
3193
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
3153
3194
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
3154
3195
|
* server-chosen tier icon actually needs it.
|
|
3155
3196
|
*/
|
|
3156
|
-
source:
|
|
3197
|
+
source: z51.union([z51.url(), z51.literal(""), z51.string().regex(DYNAMIC_TOKEN_REGEX), z51.enum(iconNames)]).default(""),
|
|
3157
3198
|
thumbnails: CABImageThumbnails.optional(),
|
|
3158
|
-
width:
|
|
3199
|
+
width: z51.number().default(100)
|
|
3159
3200
|
});
|
|
3160
3201
|
var iconNameSet = new Set(iconNames);
|
|
3161
3202
|
var isIconName = (source2) => iconNameSet.has(source2);
|
|
@@ -3175,35 +3216,42 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source: sou
|
|
|
3175
3216
|
});
|
|
3176
3217
|
|
|
3177
3218
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
3178
|
-
var CABButtonContent =
|
|
3179
|
-
() =>
|
|
3219
|
+
var CABButtonContent = z52.lazy(
|
|
3220
|
+
() => z52.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
3180
3221
|
);
|
|
3181
|
-
var CABButtonSection =
|
|
3222
|
+
var CABButtonSection = z52.object({
|
|
3182
3223
|
...CABVariableFields,
|
|
3183
|
-
action:
|
|
3184
|
-
buttonStyle:
|
|
3185
|
-
custom:
|
|
3186
|
-
color:
|
|
3187
|
-
height:
|
|
3188
|
-
width:
|
|
3224
|
+
action: z52.union([z52.literal(""), z52.enum(buttonActions)]).default(""),
|
|
3225
|
+
buttonStyle: z52.enum(buttonStyles).default(ButtonStyle.primary),
|
|
3226
|
+
custom: z52.object({
|
|
3227
|
+
color: z52.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
3228
|
+
height: z52.number().default(52),
|
|
3229
|
+
width: z52.number().default(300)
|
|
3189
3230
|
}).default({
|
|
3190
3231
|
color: "#005bd3",
|
|
3191
3232
|
height: 52,
|
|
3192
3233
|
width: 300
|
|
3193
3234
|
}),
|
|
3194
|
-
disableDowngrade:
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3235
|
+
disableDowngrade: z52.boolean().default(false),
|
|
3236
|
+
/**
|
|
3237
|
+
* What labels a `switchToSubscription` button's frequency options. `planName` shows the selling plan's
|
|
3238
|
+
* own name (legacy post-purchase, L115) and falls back to the `subscriptionOption` template for a plan
|
|
3239
|
+
* without one; absent or `template` is the template alone (the checkout card). Optional and additive
|
|
3240
|
+
* (REB-24846); an unknown value reads as absent.
|
|
3241
|
+
*/
|
|
3242
|
+
frequencyLabel: z52.enum(["planName", "template"]).optional().catch(void 0),
|
|
3243
|
+
name: z52.string().optional(),
|
|
3244
|
+
optionId: z52.number().optional(),
|
|
3245
|
+
popover: z52.object({
|
|
3246
|
+
alignment: z52.enum(textAlignments).default(TextAlignment.center),
|
|
3247
|
+
position: z52.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
3200
3248
|
}).optional().default(() => ({
|
|
3201
3249
|
alignment: TextAlignment.center,
|
|
3202
3250
|
position: PopoverPosition.blockStart
|
|
3203
3251
|
})),
|
|
3204
|
-
sectionId:
|
|
3205
|
-
sections:
|
|
3206
|
-
sectionType:
|
|
3252
|
+
sectionId: z52.uuid().default(() => uuidv73()),
|
|
3253
|
+
sections: z52.union([z52.array(CABButtonContent), z52.strictObject({}).transform(() => [])]).default(() => []),
|
|
3254
|
+
sectionType: z52.literal(SectionType.button).default(SectionType.button),
|
|
3207
3255
|
/**
|
|
3208
3256
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
3209
3257
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -3218,96 +3266,96 @@ var CABButtonSection = z50.object({
|
|
|
3218
3266
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
3219
3267
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
3220
3268
|
*/
|
|
3221
|
-
tier:
|
|
3269
|
+
tier: z52.object({ tierId: z52.string().min(1) }).optional(),
|
|
3222
3270
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
3223
|
-
trackingUrl:
|
|
3271
|
+
trackingUrl: z52.string().optional(),
|
|
3224
3272
|
/**
|
|
3225
3273
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
3226
3274
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
3227
3275
|
*/
|
|
3228
|
-
variableEffects:
|
|
3276
|
+
variableEffects: z52.array(CABVariableEffect).optional()
|
|
3229
3277
|
});
|
|
3230
3278
|
|
|
3231
3279
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3232
|
-
import { z as
|
|
3280
|
+
import { z as z57 } from "zod";
|
|
3233
3281
|
|
|
3234
3282
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3235
|
-
import { z as
|
|
3283
|
+
import { z as z56 } from "zod";
|
|
3236
3284
|
|
|
3237
3285
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
3238
3286
|
import { v7 as uuidv74 } from "uuid";
|
|
3239
|
-
import { z as
|
|
3240
|
-
var CABDiscount =
|
|
3241
|
-
amount:
|
|
3242
|
-
discountedBy:
|
|
3243
|
-
discountedFrom:
|
|
3244
|
-
type:
|
|
3245
|
-
});
|
|
3246
|
-
var CABIntegrations =
|
|
3247
|
-
judgeme:
|
|
3248
|
-
junip:
|
|
3249
|
-
klaviyo:
|
|
3250
|
-
loox:
|
|
3251
|
-
okendo:
|
|
3252
|
-
opinew:
|
|
3253
|
-
reviewsio:
|
|
3254
|
-
stamped:
|
|
3255
|
-
yotpo:
|
|
3256
|
-
});
|
|
3257
|
-
var CABVariantLabels =
|
|
3258
|
-
variantOption:
|
|
3259
|
-
variantOptions:
|
|
3260
|
-
});
|
|
3261
|
-
var CABDataSourceSection =
|
|
3262
|
-
dataSourceId:
|
|
3263
|
-
dataSourcePath:
|
|
3287
|
+
import { z as z53 } from "zod";
|
|
3288
|
+
var CABDiscount = z53.object({
|
|
3289
|
+
amount: z53.union([z53.number(), z53.string()]).catch(0),
|
|
3290
|
+
discountedBy: z53.string().optional(),
|
|
3291
|
+
discountedFrom: z53.enum(discountSources).optional().catch(void 0),
|
|
3292
|
+
type: z53.enum(discountTypes).catch("none")
|
|
3293
|
+
});
|
|
3294
|
+
var CABIntegrations = z53.object({
|
|
3295
|
+
judgeme: z53.boolean().default(false),
|
|
3296
|
+
junip: z53.boolean().default(false),
|
|
3297
|
+
klaviyo: z53.boolean().default(false),
|
|
3298
|
+
loox: z53.boolean().default(false),
|
|
3299
|
+
okendo: z53.boolean().default(false),
|
|
3300
|
+
opinew: z53.boolean().default(false),
|
|
3301
|
+
reviewsio: z53.boolean().default(false),
|
|
3302
|
+
stamped: z53.boolean().default(false),
|
|
3303
|
+
yotpo: z53.boolean().default(false)
|
|
3304
|
+
});
|
|
3305
|
+
var CABVariantLabels = z53.object({
|
|
3306
|
+
variantOption: z53.string().optional().catch(void 0),
|
|
3307
|
+
variantOptions: z53.string().optional().catch(void 0)
|
|
3308
|
+
});
|
|
3309
|
+
var CABDataSourceSection = z53.object({
|
|
3310
|
+
dataSourceId: z53.number().nullable().default(null),
|
|
3311
|
+
dataSourcePath: z53.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
3264
3312
|
discount: CABDiscount.optional(),
|
|
3265
3313
|
integrations: CABIntegrations.optional(),
|
|
3266
|
-
limit:
|
|
3267
|
-
matchVariant:
|
|
3268
|
-
matchVariantOutOfStock:
|
|
3269
|
-
name:
|
|
3270
|
-
productType:
|
|
3271
|
-
sectionId:
|
|
3272
|
-
sectionType:
|
|
3314
|
+
limit: z53.number().default(1),
|
|
3315
|
+
matchVariant: z53.boolean().default(false),
|
|
3316
|
+
matchVariantOutOfStock: z53.boolean().default(false),
|
|
3317
|
+
name: z53.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
3318
|
+
productType: z53.enum(productTypes).optional(),
|
|
3319
|
+
sectionId: z53.uuid().default(() => uuidv74()),
|
|
3320
|
+
sectionType: z53.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
3273
3321
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
3274
|
-
subscriptionIsDefault:
|
|
3275
|
-
treatAsGwp:
|
|
3322
|
+
subscriptionIsDefault: z53.boolean().default(false),
|
|
3323
|
+
treatAsGwp: z53.boolean().default(false),
|
|
3276
3324
|
variantLabels: CABVariantLabels.optional().catch(void 0)
|
|
3277
3325
|
});
|
|
3278
3326
|
|
|
3279
3327
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3280
3328
|
import { v7 as uuidv76 } from "uuid";
|
|
3281
|
-
import { z as
|
|
3329
|
+
import { z as z55 } from "zod";
|
|
3282
3330
|
|
|
3283
3331
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
3284
3332
|
import { v7 as uuidv75 } from "uuid";
|
|
3285
|
-
import { z as
|
|
3286
|
-
var CABVariantContent =
|
|
3287
|
-
() =>
|
|
3333
|
+
import { z as z54 } from "zod";
|
|
3334
|
+
var CABVariantContent = z54.lazy(
|
|
3335
|
+
() => z54.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
3288
3336
|
);
|
|
3289
|
-
var CABProductSection =
|
|
3337
|
+
var CABProductSection = z54.object({
|
|
3290
3338
|
...CABVariableFields,
|
|
3291
|
-
name:
|
|
3292
|
-
productId:
|
|
3293
|
-
sectionId:
|
|
3294
|
-
sections:
|
|
3295
|
-
sectionType:
|
|
3296
|
-
selectors:
|
|
3297
|
-
variantMode:
|
|
3339
|
+
name: z54.string().optional(),
|
|
3340
|
+
productId: z54.number().nullable().default(null),
|
|
3341
|
+
sectionId: z54.uuid().default(() => uuidv75()),
|
|
3342
|
+
sections: z54.union([z54.array(CABVariantContent), z54.strictObject({}).transform(() => [])]).default(() => []),
|
|
3343
|
+
sectionType: z54.literal(SectionType.product).default(SectionType.product),
|
|
3344
|
+
selectors: z54.record(z54.string(), z54.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
3345
|
+
variantMode: z54.enum(variantModes).default(VariantMode.multiple)
|
|
3298
3346
|
});
|
|
3299
3347
|
|
|
3300
3348
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3301
|
-
var CABProductsSection =
|
|
3349
|
+
var CABProductsSection = z55.object({
|
|
3302
3350
|
...CABVariableFields,
|
|
3303
|
-
name:
|
|
3304
|
-
sectionId:
|
|
3305
|
-
sections:
|
|
3306
|
-
sectionType:
|
|
3351
|
+
name: z55.string().optional(),
|
|
3352
|
+
sectionId: z55.uuid().default(() => uuidv76()),
|
|
3353
|
+
sections: z55.union([z55.array(z55.lazy(() => CABProductSection)), z55.strictObject({}).transform(() => [])]).default(() => []),
|
|
3354
|
+
sectionType: z55.literal(SectionType.products).default(SectionType.products)
|
|
3307
3355
|
});
|
|
3308
3356
|
|
|
3309
3357
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3310
|
-
var CABOffersSection =
|
|
3358
|
+
var CABOffersSection = z56.lazy(
|
|
3311
3359
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3312
3360
|
/**
|
|
3313
3361
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -3315,8 +3363,8 @@ var CABOffersSection = z54.lazy(
|
|
|
3315
3363
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
3316
3364
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
3317
3365
|
*/
|
|
3318
|
-
divider:
|
|
3319
|
-
sections:
|
|
3366
|
+
divider: z56.boolean().optional(),
|
|
3367
|
+
sections: z56.union([z56.array(z56.lazy(() => CABSection)), z56.strictObject({}).transform(() => [])]).default(() => [
|
|
3320
3368
|
CABBannerSection.parse({
|
|
3321
3369
|
buttonField: "undoAddToOrder",
|
|
3322
3370
|
color: "success",
|
|
@@ -3330,77 +3378,77 @@ var CABOffersSection = z54.lazy(
|
|
|
3330
3378
|
CABDataSourceSection.parse({}),
|
|
3331
3379
|
CABProductsSection.parse({})
|
|
3332
3380
|
]),
|
|
3333
|
-
sectionType:
|
|
3381
|
+
sectionType: z56.literal(SectionType.offers).default(SectionType.offers)
|
|
3334
3382
|
})
|
|
3335
3383
|
);
|
|
3336
3384
|
|
|
3337
3385
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3338
|
-
var CABCarouselSection =
|
|
3386
|
+
var CABCarouselSection = z57.lazy(
|
|
3339
3387
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3340
|
-
autoAdvanceInterval:
|
|
3341
|
-
itemsAtOnce:
|
|
3388
|
+
autoAdvanceInterval: z57.number().default(0),
|
|
3389
|
+
itemsAtOnce: z57.number().min(1).default(1),
|
|
3342
3390
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
3343
|
-
offersDirection:
|
|
3344
|
-
sections:
|
|
3345
|
-
sectionType:
|
|
3391
|
+
offersDirection: z57.enum(offersDirections).default("vertical"),
|
|
3392
|
+
sections: z57.union([z57.array(z57.lazy(() => CABSection)), z57.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
3393
|
+
sectionType: z57.literal(SectionType.carousel).default(SectionType.carousel)
|
|
3346
3394
|
})
|
|
3347
3395
|
);
|
|
3348
3396
|
|
|
3349
3397
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
3350
|
-
import { z as
|
|
3351
|
-
var CABCartLineSection =
|
|
3398
|
+
import { z as z58 } from "zod";
|
|
3399
|
+
var CABCartLineSection = z58.lazy(
|
|
3352
3400
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3353
|
-
sections:
|
|
3354
|
-
sectionType:
|
|
3401
|
+
sections: z58.union([z58.array(z58.lazy(() => CABSection)), z58.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
3402
|
+
sectionType: z58.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
3355
3403
|
})
|
|
3356
3404
|
);
|
|
3357
3405
|
|
|
3358
3406
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
3359
3407
|
import { v7 as uuidv77 } from "uuid";
|
|
3360
|
-
import { z as
|
|
3361
|
-
var CABDiscountSection =
|
|
3408
|
+
import { z as z59 } from "zod";
|
|
3409
|
+
var CABDiscountSection = z59.object({
|
|
3362
3410
|
...CABVariableFields,
|
|
3363
|
-
amount:
|
|
3364
|
-
discountedBy:
|
|
3365
|
-
discountedFrom:
|
|
3366
|
-
message:
|
|
3367
|
-
name:
|
|
3368
|
-
quantity:
|
|
3369
|
-
sectionId:
|
|
3370
|
-
sectionType:
|
|
3371
|
-
type:
|
|
3411
|
+
amount: z59.union([z59.number(), z59.string()]).catch(0),
|
|
3412
|
+
discountedBy: z59.string().optional(),
|
|
3413
|
+
discountedFrom: z59.enum(discountSources).optional().catch(void 0),
|
|
3414
|
+
message: z59.string().optional(),
|
|
3415
|
+
name: z59.string().optional(),
|
|
3416
|
+
quantity: z59.number().default(1),
|
|
3417
|
+
sectionId: z59.uuid().default(() => uuidv77()),
|
|
3418
|
+
sectionType: z59.literal(SectionType.discount).default(SectionType.discount),
|
|
3419
|
+
type: z59.enum(discountTypes).catch("none")
|
|
3372
3420
|
});
|
|
3373
3421
|
|
|
3374
3422
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
3375
3423
|
import { v7 as uuidv78 } from "uuid";
|
|
3376
|
-
import { z as
|
|
3377
|
-
var CABMonetizeAds =
|
|
3378
|
-
requestId:
|
|
3424
|
+
import { z as z60 } from "zod";
|
|
3425
|
+
var CABMonetizeAds = z60.object({
|
|
3426
|
+
requestId: z60.string().optional(),
|
|
3379
3427
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
3380
|
-
testing:
|
|
3428
|
+
testing: z60.boolean().default(false)
|
|
3381
3429
|
});
|
|
3382
|
-
var CABMonetizeSection =
|
|
3430
|
+
var CABMonetizeSection = z60.object({
|
|
3383
3431
|
...CABVariableFields,
|
|
3384
3432
|
ads: CABMonetizeAds.optional(),
|
|
3385
|
-
name:
|
|
3433
|
+
name: z60.string().optional(),
|
|
3386
3434
|
/**
|
|
3387
3435
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
3388
3436
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
3389
3437
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
3390
3438
|
*/
|
|
3391
|
-
offers:
|
|
3439
|
+
offers: z60.array(z60.lazy(() => CABSection)).optional(),
|
|
3392
3440
|
/** 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. */
|
|
3393
|
-
privacyPolicyUrl:
|
|
3394
|
-
sectionId:
|
|
3395
|
-
sectionType:
|
|
3441
|
+
privacyPolicyUrl: z60.string().optional(),
|
|
3442
|
+
sectionId: z60.uuid().default(() => uuidv78()),
|
|
3443
|
+
sectionType: z60.literal(SectionType.monetize).default(SectionType.monetize),
|
|
3396
3444
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
3397
|
-
subVertical:
|
|
3445
|
+
subVertical: z60.string().optional(),
|
|
3398
3446
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
3399
|
-
vertical:
|
|
3447
|
+
vertical: z60.string().optional()
|
|
3400
3448
|
});
|
|
3401
3449
|
|
|
3402
3450
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3403
|
-
import { z as
|
|
3451
|
+
import { z as z61 } from "zod";
|
|
3404
3452
|
|
|
3405
3453
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
3406
3454
|
var GIFT_LABELS = {
|
|
@@ -3519,34 +3567,34 @@ var GIFT_LABELS = {
|
|
|
3519
3567
|
};
|
|
3520
3568
|
|
|
3521
3569
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3522
|
-
var CABProgressTierExclusion =
|
|
3523
|
-
collectionIds:
|
|
3524
|
-
productIds:
|
|
3525
|
-
tags:
|
|
3526
|
-
type:
|
|
3570
|
+
var CABProgressTierExclusion = z61.object({
|
|
3571
|
+
collectionIds: z61.array(z61.number().int().positive()).default(() => []),
|
|
3572
|
+
productIds: z61.array(z61.number().int().positive()).default(() => []),
|
|
3573
|
+
tags: z61.array(z61.string().min(1)).default(() => []),
|
|
3574
|
+
type: z61.enum(progressTierExclusionTypes)
|
|
3527
3575
|
});
|
|
3528
|
-
var CABProgressTier =
|
|
3576
|
+
var CABProgressTier = z61.object({
|
|
3529
3577
|
/**
|
|
3530
3578
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
3531
3579
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
3532
3580
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
3533
3581
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
3534
3582
|
*/
|
|
3535
|
-
discount:
|
|
3583
|
+
discount: z61.object({ amount: z61.number().nonnegative(), type: z61.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
3536
3584
|
/**
|
|
3537
3585
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
3538
3586
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
3539
3587
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
3540
3588
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
3541
3589
|
*/
|
|
3542
|
-
exclusions:
|
|
3590
|
+
exclusions: z61.array(CABProgressTierExclusion).default(() => []),
|
|
3543
3591
|
/**
|
|
3544
3592
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
3545
3593
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
3546
3594
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
3547
3595
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
3548
3596
|
*/
|
|
3549
|
-
filterOosVariants:
|
|
3597
|
+
filterOosVariants: z61.boolean().default(false),
|
|
3550
3598
|
/**
|
|
3551
3599
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
3552
3600
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -3554,10 +3602,10 @@ var CABProgressTier = z59.object({
|
|
|
3554
3602
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
3555
3603
|
* tree is complete.
|
|
3556
3604
|
*/
|
|
3557
|
-
gift:
|
|
3558
|
-
productId:
|
|
3559
|
-
title:
|
|
3560
|
-
variantIds:
|
|
3605
|
+
gift: z61.object({
|
|
3606
|
+
productId: z61.number().int().positive(),
|
|
3607
|
+
title: z61.string().optional(),
|
|
3608
|
+
variantIds: z61.array(z61.number().int().positive()).default(() => [])
|
|
3561
3609
|
}).optional(),
|
|
3562
3610
|
/**
|
|
3563
3611
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -3577,7 +3625,7 @@ var CABProgressTier = z59.object({
|
|
|
3577
3625
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
3578
3626
|
* React's size rather than the old hardcoded 20.
|
|
3579
3627
|
*/
|
|
3580
|
-
iconSizePx:
|
|
3628
|
+
iconSizePx: z61.number().int().min(1).max(64).default(18),
|
|
3581
3629
|
/**
|
|
3582
3630
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
3583
3631
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -3587,35 +3635,35 @@ var CABProgressTier = z59.object({
|
|
|
3587
3635
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
3588
3636
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
3589
3637
|
*/
|
|
3590
|
-
label:
|
|
3638
|
+
label: z61.record(z61.string(), z61.string()).optional(),
|
|
3591
3639
|
/**
|
|
3592
3640
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
3593
3641
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
3594
3642
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
3595
3643
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
3596
3644
|
*/
|
|
3597
|
-
productTierImage:
|
|
3645
|
+
productTierImage: z61.boolean().default(false),
|
|
3598
3646
|
/**
|
|
3599
3647
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
3600
3648
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
3601
3649
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
3602
3650
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
3603
3651
|
*/
|
|
3604
|
-
threshold:
|
|
3652
|
+
threshold: z61.number().int().nonnegative(),
|
|
3605
3653
|
/**
|
|
3606
3654
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
3607
3655
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
3608
3656
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
3609
3657
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
3610
3658
|
*/
|
|
3611
|
-
thresholds:
|
|
3659
|
+
thresholds: z61.record(z61.string(), z61.number().int().nonnegative()).default(() => ({})),
|
|
3612
3660
|
/**
|
|
3613
3661
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
3614
3662
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
3615
3663
|
* shipping bar (single unlabeled tier, no gift).
|
|
3616
3664
|
*/
|
|
3617
|
-
tierId:
|
|
3618
|
-
tierType:
|
|
3665
|
+
tierId: z61.string().optional(),
|
|
3666
|
+
tierType: z61.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
3619
3667
|
/**
|
|
3620
3668
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
3621
3669
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -3626,9 +3674,9 @@ var CABProgressTier = z59.object({
|
|
|
3626
3674
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
3627
3675
|
* template text supplies grammatically-neutral wording around the token.
|
|
3628
3676
|
*/
|
|
3629
|
-
unit:
|
|
3677
|
+
unit: z61.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
3630
3678
|
});
|
|
3631
|
-
var CABProgressBarSection =
|
|
3679
|
+
var CABProgressBarSection = z61.lazy(
|
|
3632
3680
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3633
3681
|
/**
|
|
3634
3682
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -3637,35 +3685,35 @@ var CABProgressBarSection = z59.lazy(
|
|
|
3637
3685
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
3638
3686
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
3639
3687
|
*/
|
|
3640
|
-
barId:
|
|
3688
|
+
barId: z61.string().optional(),
|
|
3641
3689
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
3642
|
-
countryCodes:
|
|
3690
|
+
countryCodes: z61.array(z61.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3643
3691
|
/**
|
|
3644
3692
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
3645
3693
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
3646
3694
|
*/
|
|
3647
|
-
excludeCountryCodes:
|
|
3695
|
+
excludeCountryCodes: z61.array(z61.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3648
3696
|
/**
|
|
3649
3697
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
3650
3698
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
3651
3699
|
* adds the cart's discount allocations back to the live subtotal.
|
|
3652
3700
|
*/
|
|
3653
|
-
excludeDiscountInSubtotal:
|
|
3701
|
+
excludeDiscountInSubtotal: z61.boolean().default(false),
|
|
3654
3702
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
3655
|
-
excludedVariantIds:
|
|
3703
|
+
excludedVariantIds: z61.array(z61.number().int().positive()).default(() => []),
|
|
3656
3704
|
/**
|
|
3657
3705
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
3658
3706
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
3659
3707
|
*/
|
|
3660
|
-
freeShippingOnSubscription:
|
|
3708
|
+
freeShippingOnSubscription: z61.boolean().default(false),
|
|
3661
3709
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
3662
|
-
giftAreaTitle:
|
|
3710
|
+
giftAreaTitle: z61.record(z61.string(), z61.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
3663
3711
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
3664
|
-
giftLabels:
|
|
3665
|
-
addGift:
|
|
3666
|
-
remove:
|
|
3667
|
-
selectOptions:
|
|
3668
|
-
yourGift:
|
|
3712
|
+
giftLabels: z61.object({
|
|
3713
|
+
addGift: z61.record(z61.string(), z61.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
3714
|
+
remove: z61.record(z61.string(), z61.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
3715
|
+
selectOptions: z61.record(z61.string(), z61.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
3716
|
+
yourGift: z61.record(z61.string(), z61.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
3669
3717
|
}).default(() => ({
|
|
3670
3718
|
addGift: { ...GIFT_LABELS.addGift },
|
|
3671
3719
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -3673,38 +3721,38 @@ var CABProgressBarSection = z59.lazy(
|
|
|
3673
3721
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
3674
3722
|
})),
|
|
3675
3723
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
3676
|
-
name:
|
|
3724
|
+
name: z61.string().default("Order progress"),
|
|
3677
3725
|
/**
|
|
3678
3726
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
3679
3727
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
3680
3728
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
3681
3729
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
3682
3730
|
*/
|
|
3683
|
-
progressColor:
|
|
3684
|
-
sectionType:
|
|
3731
|
+
progressColor: z61.string().optional(),
|
|
3732
|
+
sectionType: z61.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
3685
3733
|
/**
|
|
3686
3734
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
3687
3735
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
3688
3736
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
3689
3737
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
3690
3738
|
*/
|
|
3691
|
-
tiers:
|
|
3739
|
+
tiers: z61.union([z61.array(CABProgressTier), z61.strictObject({}).transform(() => [])]).default(() => [])
|
|
3692
3740
|
})
|
|
3693
3741
|
);
|
|
3694
3742
|
|
|
3695
3743
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
3696
3744
|
import { v7 as uuidv79 } from "uuid";
|
|
3697
|
-
import { z as
|
|
3698
|
-
var CABQuantitySection =
|
|
3745
|
+
import { z as z62 } from "zod";
|
|
3746
|
+
var CABQuantitySection = z62.object({
|
|
3699
3747
|
...CABVariableFields,
|
|
3700
|
-
errorMessages:
|
|
3701
|
-
|
|
3702
|
-
|
|
3748
|
+
errorMessages: z62.record(
|
|
3749
|
+
z62.string(),
|
|
3750
|
+
z62.object({
|
|
3703
3751
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
3704
|
-
increment:
|
|
3705
|
-
max:
|
|
3706
|
-
min:
|
|
3707
|
-
neg:
|
|
3752
|
+
increment: z62.string().optional(),
|
|
3753
|
+
max: z62.string().optional(),
|
|
3754
|
+
min: z62.string().optional(),
|
|
3755
|
+
neg: z62.string().optional()
|
|
3708
3756
|
})
|
|
3709
3757
|
).default({
|
|
3710
3758
|
en: {
|
|
@@ -3714,18 +3762,18 @@ var CABQuantitySection = z60.object({
|
|
|
3714
3762
|
neg: "Quantity cannot be negative"
|
|
3715
3763
|
}
|
|
3716
3764
|
}),
|
|
3717
|
-
inputType:
|
|
3718
|
-
max:
|
|
3719
|
-
min:
|
|
3765
|
+
inputType: z62.enum(quantityInputs).default(QuantityInput.select),
|
|
3766
|
+
max: z62.number().min(1).max(100).default(10),
|
|
3767
|
+
min: z62.number().min(1).default(1),
|
|
3720
3768
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
3721
|
-
name:
|
|
3722
|
-
sectionId:
|
|
3723
|
-
sectionType:
|
|
3769
|
+
name: z62.string().default("Quantity"),
|
|
3770
|
+
sectionId: z62.uuid().default(() => uuidv79()),
|
|
3771
|
+
sectionType: z62.literal(SectionType.quantity).default(SectionType.quantity)
|
|
3724
3772
|
});
|
|
3725
3773
|
|
|
3726
3774
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3727
3775
|
import { v7 as uuidv710 } from "uuid";
|
|
3728
|
-
import { z as
|
|
3776
|
+
import { z as z63 } from "zod";
|
|
3729
3777
|
|
|
3730
3778
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
3731
3779
|
var REVIEW_LABELS = {
|
|
@@ -3788,69 +3836,83 @@ var REVIEW_LABELS = {
|
|
|
3788
3836
|
};
|
|
3789
3837
|
|
|
3790
3838
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3791
|
-
var CABReviewsSection =
|
|
3839
|
+
var CABReviewsSection = z63.object({
|
|
3792
3840
|
...CABVariableFields,
|
|
3793
|
-
color:
|
|
3841
|
+
color: z63.string().default("#fadb14"),
|
|
3794
3842
|
/**
|
|
3795
3843
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
3796
3844
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
3797
3845
|
* or merchant work.
|
|
3798
3846
|
*/
|
|
3799
|
-
countLabels:
|
|
3800
|
-
one:
|
|
3801
|
-
other:
|
|
3847
|
+
countLabels: z63.object({
|
|
3848
|
+
one: z63.record(z63.string(), z63.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
3849
|
+
other: z63.record(z63.string(), z63.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
3802
3850
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
3803
|
-
name:
|
|
3804
|
-
sectionId:
|
|
3805
|
-
sectionType:
|
|
3806
|
-
size:
|
|
3851
|
+
name: z63.string().optional(),
|
|
3852
|
+
sectionId: z63.uuid().default(() => uuidv710()),
|
|
3853
|
+
sectionType: z63.literal(SectionType.reviews).default(SectionType.reviews),
|
|
3854
|
+
size: z63.enum(reviewsSizes).default(ReviewsSize.default),
|
|
3807
3855
|
/**
|
|
3808
3856
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
3809
3857
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
3810
3858
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
3811
3859
|
* the whole reviews section.
|
|
3812
3860
|
*/
|
|
3813
|
-
strokeColor:
|
|
3861
|
+
strokeColor: z63.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
3814
3862
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
3815
|
-
strokeWidth:
|
|
3863
|
+
strokeWidth: z63.number().nonnegative().default(0)
|
|
3816
3864
|
});
|
|
3817
3865
|
|
|
3818
3866
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
3819
3867
|
import { v7 as uuidv711 } from "uuid";
|
|
3820
|
-
import { z as
|
|
3821
|
-
var CABSeparatorSection =
|
|
3868
|
+
import { z as z64 } from "zod";
|
|
3869
|
+
var CABSeparatorSection = z64.object({
|
|
3822
3870
|
...CABVariableFields,
|
|
3823
|
-
sectionId:
|
|
3824
|
-
sectionType:
|
|
3871
|
+
sectionId: z64.uuid().default(() => uuidv711()),
|
|
3872
|
+
sectionType: z64.literal(SectionType.separator).default(SectionType.separator)
|
|
3825
3873
|
});
|
|
3826
3874
|
|
|
3827
3875
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
3828
|
-
import { slice } from "es-toolkit/compat";
|
|
3876
|
+
import { isEmpty, pickBy, slice } from "es-toolkit/compat";
|
|
3829
3877
|
import { v7 as uuidv712 } from "uuid";
|
|
3830
|
-
import { z as
|
|
3831
|
-
var CABVariantsSection =
|
|
3878
|
+
import { z as z65 } from "zod";
|
|
3879
|
+
var CABVariantsSection = z65.object({
|
|
3832
3880
|
...CABVariableFields,
|
|
3833
|
-
hideOutOfStockVariants:
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3881
|
+
hideOutOfStockVariants: z65.boolean().default(false),
|
|
3882
|
+
/**
|
|
3883
|
+
* The menu's own label per buyer locale (`selectLanguage`), for the whole-variant (`single`) and the
|
|
3884
|
+
* product-group menus; `multiple` labels each option's menu by its name. Optional and additive
|
|
3885
|
+
* (REB-24846): absent, a renderer keeps its own label; the post-purchase converter sets legacy's
|
|
3886
|
+
* "Select Variant" and "Option" (L93, L97). A malformed label drops only itself.
|
|
3887
|
+
*
|
|
3888
|
+
* A blank (or whitespace-only) entry is dropped per locale, so that buyer falls back to `en` instead of
|
|
3889
|
+
* `selectLanguage` returning `''` — which a renderer's `??` fallback would show as an empty menu label.
|
|
3890
|
+
* A label left with no entries reads as absent.
|
|
3891
|
+
*/
|
|
3892
|
+
label: z65.record(z65.string(), z65.string()).transform((label) => {
|
|
3893
|
+
const filled = pickBy(label, (value) => value.trim() !== "");
|
|
3894
|
+
return isEmpty(filled) ? void 0 : filled;
|
|
3895
|
+
}).optional().catch(void 0),
|
|
3896
|
+
name: z65.string().optional(),
|
|
3897
|
+
sectionId: z65.uuid().default(() => uuidv712()),
|
|
3898
|
+
sectionType: z65.literal(SectionType.variants).default(SectionType.variants),
|
|
3899
|
+
selector: z65.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
3838
3900
|
/** `productGroup` is additive (REB-24817): a renderer without group support must render nothing for it. */
|
|
3839
|
-
variantMode:
|
|
3901
|
+
variantMode: z65.enum(variantsModes).default(VariantsMode.multiple)
|
|
3840
3902
|
});
|
|
3841
3903
|
|
|
3842
3904
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3843
|
-
var CABBorder =
|
|
3844
|
-
radius:
|
|
3845
|
-
style:
|
|
3846
|
-
width:
|
|
3905
|
+
var CABBorder = z66.object({
|
|
3906
|
+
radius: z66.enum(borderRadii).default(BorderRadius.base),
|
|
3907
|
+
style: z66.enum(borderStyles).default(BorderStyle.none),
|
|
3908
|
+
width: z66.enum(borderWidths).default(BorderWidth.base)
|
|
3847
3909
|
}).default({
|
|
3848
3910
|
radius: BorderRadius.base,
|
|
3849
3911
|
style: BorderStyle.none,
|
|
3850
3912
|
width: BorderWidth.base
|
|
3851
3913
|
});
|
|
3852
|
-
var CABSection =
|
|
3853
|
-
() =>
|
|
3914
|
+
var CABSection = z66.lazy(
|
|
3915
|
+
() => z66.discriminatedUnion("sectionType", [
|
|
3854
3916
|
CABBannerSection,
|
|
3855
3917
|
CABButtonSection,
|
|
3856
3918
|
CABCarouselSection,
|
|
@@ -3873,41 +3935,41 @@ var CABSection = z64.lazy(
|
|
|
3873
3935
|
);
|
|
3874
3936
|
|
|
3875
3937
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
3876
|
-
var GridItem =
|
|
3877
|
-
var CABLayoutWrapping =
|
|
3878
|
-
breakAt:
|
|
3879
|
-
maxPerLine:
|
|
3938
|
+
var GridItem = z67.union([z67.literal("auto"), z67.literal("fill"), z67.string().regex(/^\d+%$/), z67.number()]);
|
|
3939
|
+
var CABLayoutWrapping = z67.object({
|
|
3940
|
+
breakAt: z67.number().positive(),
|
|
3941
|
+
maxPerLine: z67.number().int().positive()
|
|
3880
3942
|
});
|
|
3881
|
-
var CABLayoutSection =
|
|
3943
|
+
var CABLayoutSection = z67.object({
|
|
3882
3944
|
...CABVariableFields,
|
|
3883
|
-
alignment:
|
|
3884
|
-
horizontal:
|
|
3885
|
-
vertical:
|
|
3945
|
+
alignment: z67.object({
|
|
3946
|
+
horizontal: z67.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
3947
|
+
vertical: z67.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
3886
3948
|
}).default({
|
|
3887
3949
|
horizontal: HorizontalAlignment.start,
|
|
3888
3950
|
vertical: VerticalAlignment.top
|
|
3889
3951
|
}),
|
|
3890
|
-
border:
|
|
3891
|
-
buttonField:
|
|
3892
|
-
direction:
|
|
3952
|
+
border: z67.lazy(() => CABBorder),
|
|
3953
|
+
buttonField: z67.enum(buttonFields).optional(),
|
|
3954
|
+
direction: z67.enum(directions).default(Direction.rows),
|
|
3893
3955
|
/**
|
|
3894
3956
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
3895
3957
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
3896
3958
|
*/
|
|
3897
|
-
frame:
|
|
3898
|
-
grid:
|
|
3899
|
-
columns:
|
|
3900
|
-
rows:
|
|
3959
|
+
frame: z67.enum(layoutFrames).optional(),
|
|
3960
|
+
grid: z67.object({
|
|
3961
|
+
columns: z67.union([z67.array(GridItem), z67.undefined()]).default(() => ["auto"]),
|
|
3962
|
+
rows: z67.union([z67.array(GridItem), z67.undefined()]).default(() => ["auto"])
|
|
3901
3963
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
3902
|
-
name:
|
|
3903
|
-
padding:
|
|
3904
|
-
sectionId:
|
|
3905
|
-
sections:
|
|
3906
|
-
sectionType:
|
|
3907
|
-
spacing:
|
|
3964
|
+
name: z67.string().optional(),
|
|
3965
|
+
padding: z67.enum(spacings).default(Spacing.none),
|
|
3966
|
+
sectionId: z67.uuid().default(() => uuidv713()),
|
|
3967
|
+
sections: z67.union([z67.array(z67.lazy(() => CABSection)), z67.strictObject({}).transform(() => [])]).default(() => []),
|
|
3968
|
+
sectionType: z67.literal(SectionType.layout).default(SectionType.layout),
|
|
3969
|
+
spacing: z67.enum(spacings).default(Spacing.base),
|
|
3908
3970
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
3909
|
-
viewUrl:
|
|
3910
|
-
width:
|
|
3971
|
+
viewUrl: z67.string().optional(),
|
|
3972
|
+
width: z67.number().default(100),
|
|
3911
3973
|
wrapping: CABLayoutWrapping.optional()
|
|
3912
3974
|
});
|
|
3913
3975
|
|
|
@@ -3929,8 +3991,8 @@ var UI_LABELS = {
|
|
|
3929
3991
|
};
|
|
3930
3992
|
|
|
3931
3993
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
3932
|
-
var localized = (fallback) =>
|
|
3933
|
-
var CABUILabels =
|
|
3994
|
+
var localized = (fallback) => z68.record(z68.string(), z68.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
3995
|
+
var CABUILabels = z68.object({
|
|
3934
3996
|
currentPage: localized(UI_LABELS.currentPage),
|
|
3935
3997
|
guest: localized(UI_LABELS.guest),
|
|
3936
3998
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -3955,49 +4017,49 @@ var CABUILabels = z66.object({
|
|
|
3955
4017
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
3956
4018
|
updating: { ...UI_LABELS.updating }
|
|
3957
4019
|
}));
|
|
3958
|
-
var TargetArea =
|
|
3959
|
-
fill:
|
|
3960
|
-
flip:
|
|
3961
|
-
icon:
|
|
3962
|
-
label:
|
|
3963
|
-
width:
|
|
4020
|
+
var TargetArea = z68.object({
|
|
4021
|
+
fill: z68.boolean().optional(),
|
|
4022
|
+
flip: z68.enum(["both", "horizontal", "vertical"]).optional(),
|
|
4023
|
+
icon: z68.string(),
|
|
4024
|
+
label: z68.string(),
|
|
4025
|
+
width: z68.string()
|
|
3964
4026
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
3965
|
-
var CABTracking =
|
|
3966
|
-
enableAttribution:
|
|
3967
|
-
enableSource:
|
|
3968
|
-
enableWidget:
|
|
4027
|
+
var CABTracking = z68.object({
|
|
4028
|
+
enableAttribution: z68.boolean().nullish().transform((value) => value ?? true),
|
|
4029
|
+
enableSource: z68.boolean().nullish().transform((value) => value ?? true),
|
|
4030
|
+
enableWidget: z68.boolean().nullish().transform((value) => value ?? true)
|
|
3969
4031
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
3970
|
-
var CABExperiment =
|
|
3971
|
-
elementId:
|
|
3972
|
-
experimentId:
|
|
3973
|
-
experimentType:
|
|
3974
|
-
selectedId:
|
|
4032
|
+
var CABExperiment = z68.object({
|
|
4033
|
+
elementId: z68.number(),
|
|
4034
|
+
experimentId: z68.number(),
|
|
4035
|
+
experimentType: z68.string(),
|
|
4036
|
+
selectedId: z68.number()
|
|
3975
4037
|
});
|
|
3976
4038
|
var CABRootSection = CABLayoutSection.extend({
|
|
3977
|
-
editorMode:
|
|
4039
|
+
editorMode: z68.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
3978
4040
|
experiment: CABExperiment.optional(),
|
|
3979
4041
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
3980
4042
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
3981
|
-
previewMode:
|
|
3982
|
-
storeId:
|
|
4043
|
+
previewMode: z68.boolean().nullish().transform((value) => value ?? false),
|
|
4044
|
+
storeId: z68.number().nullable().default(null),
|
|
3983
4045
|
targetArea: TargetArea.nullable(),
|
|
3984
4046
|
tracking: CABTracking,
|
|
3985
|
-
type:
|
|
4047
|
+
type: z68.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
3986
4048
|
uiLabels: CABUILabels,
|
|
3987
|
-
version:
|
|
3988
|
-
widgetId:
|
|
4049
|
+
version: z68.literal(2).default(2),
|
|
4050
|
+
widgetId: z68.number().nullable().default(null)
|
|
3989
4051
|
});
|
|
3990
4052
|
|
|
3991
4053
|
// src/schema/postPurchaseProductView.ts
|
|
3992
|
-
var PostPurchaseProductView =
|
|
3993
|
-
|
|
4054
|
+
var PostPurchaseProductView = z69.union([
|
|
4055
|
+
z69.object({
|
|
3994
4056
|
changeset: PostPurchaseProductChangeset.optional(),
|
|
3995
4057
|
displayPrice: PostPurchaseDisplayPrice.optional(),
|
|
3996
4058
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
3997
4059
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
3998
4060
|
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
3999
4061
|
preparation: PreparedPostPurchaseProduct.extend({
|
|
4000
|
-
display: PreparedPostPurchaseProduct.shape.display.extend({ description:
|
|
4062
|
+
display: PreparedPostPurchaseProduct.shape.display.extend({ description: z69.string().nullable() }).refine(
|
|
4001
4063
|
({ description, descriptionDocument }) => description === null === (descriptionDocument !== void 0),
|
|
4002
4064
|
"Exactly one of the plain and rich descriptions is shown"
|
|
4003
4065
|
)
|
|
@@ -4006,7 +4068,7 @@ var PostPurchaseProductView = z67.union([
|
|
|
4006
4068
|
sections: CABRootSection,
|
|
4007
4069
|
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
4008
4070
|
}),
|
|
4009
|
-
|
|
4071
|
+
z69.object({
|
|
4010
4072
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
4011
4073
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
4012
4074
|
/** The localized unavailable copy, for the choices still offered beneath an unprepared product. */
|
|
@@ -4021,21 +4083,21 @@ var PostPurchaseProductView = z67.union([
|
|
|
4021
4083
|
]);
|
|
4022
4084
|
|
|
4023
4085
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
4024
|
-
var PostPurchaseProductCollectionView =
|
|
4025
|
-
members:
|
|
4026
|
-
|
|
4086
|
+
var PostPurchaseProductCollectionView = z70.object({
|
|
4087
|
+
members: z70.array(
|
|
4088
|
+
z70.object({
|
|
4027
4089
|
productId: PostPurchaseProductId,
|
|
4028
|
-
productIndex:
|
|
4090
|
+
productIndex: z70.number().int().nonnegative(),
|
|
4029
4091
|
view: PostPurchaseProductView
|
|
4030
4092
|
})
|
|
4031
4093
|
)
|
|
4032
4094
|
});
|
|
4033
|
-
var PostPurchaseCollectionChoice =
|
|
4095
|
+
var PostPurchaseCollectionChoice = z70.object({
|
|
4034
4096
|
choice: PostPurchaseChoice.optional(),
|
|
4035
4097
|
productId: PostPurchaseProductId,
|
|
4036
4098
|
variantId: PostPurchaseVariantSelector.shape.variantId.optional()
|
|
4037
4099
|
}).strict();
|
|
4038
|
-
var PostPurchaseExcludedProductIds =
|
|
4100
|
+
var PostPurchaseExcludedProductIds = z70.array(PostPurchaseProductId).default([]);
|
|
4039
4101
|
var PostPurchaseMemberSelector = PostPurchaseProgressSchema.shape.members.element.pick({ productId: true }).extend({ progressRevision: PostPurchaseProgressSchema.shape.revision });
|
|
4040
4102
|
var PostPurchaseMemberPointer = PostPurchaseProgressSchema.shape.members.element.omit({ status: true }).extend({
|
|
4041
4103
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
@@ -4048,7 +4110,7 @@ var PostPurchaseQuantityChoice = PostPurchaseCollectionChoice.extend({ quantity:
|
|
|
4048
4110
|
var PostPurchaseQuantityPolicy = PostPurchaseSettings.shape.quantityInputs.omit({ defaultQuantity: true }).extend({
|
|
4049
4111
|
initialQuantity: quantity,
|
|
4050
4112
|
maxValue: quantity,
|
|
4051
|
-
minValue:
|
|
4113
|
+
minValue: z71.literal(0).transform(() => 1).or(quantity)
|
|
4052
4114
|
}).refine(({ maxValue, minValue }) => minValue <= maxValue, "Quantity bounds are reversed");
|
|
4053
4115
|
|
|
4054
4116
|
// src/schema/postPurchaseGroup.ts
|
|
@@ -4057,33 +4119,33 @@ var PostPurchaseGroupChoice = PostPurchaseQuantityChoice.extend({
|
|
|
4057
4119
|
});
|
|
4058
4120
|
|
|
4059
4121
|
// src/schema/postPurchaseHealth.ts
|
|
4060
|
-
import { z as
|
|
4122
|
+
import { z as z74 } from "zod";
|
|
4061
4123
|
|
|
4062
4124
|
// src/schema/postPurchaseHealthSchedule.ts
|
|
4063
|
-
import { z as
|
|
4125
|
+
import { z as z73 } from "zod";
|
|
4064
4126
|
|
|
4065
4127
|
// src/schema/postPurchaseReleaseSchedule.ts
|
|
4066
|
-
import { z as
|
|
4067
|
-
var postPurchaseTaskNameSchema = (queue, id) =>
|
|
4068
|
-
var SessionReleaseScheduleRequestSchema =
|
|
4128
|
+
import { z as z72 } from "zod";
|
|
4129
|
+
var postPurchaseTaskNameSchema = (queue, id) => z72.string().regex(new RegExp(`^projects/[a-zA-Z0-9.:-]+/locations/us-central1/queues/${queue}/tasks/${id}$`));
|
|
4130
|
+
var SessionReleaseScheduleRequestSchema = z72.strictObject({
|
|
4069
4131
|
deadline: PostPurchaseTimestampSchema,
|
|
4070
4132
|
orderId: PostPurchaseOrderIdSchema,
|
|
4071
4133
|
releaseOwner: ReleaseOwnerSchema,
|
|
4072
4134
|
sessionId: PostPurchaseSessionIdSchema
|
|
4073
4135
|
});
|
|
4074
|
-
var SessionReleaseScheduleResponseSchema =
|
|
4075
|
-
data:
|
|
4136
|
+
var SessionReleaseScheduleResponseSchema = z72.object({
|
|
4137
|
+
data: z72.discriminatedUnion("status", [
|
|
4076
4138
|
SessionReleaseScheduleRequestSchema.extend({
|
|
4077
|
-
releaseOwner:
|
|
4078
|
-
status:
|
|
4139
|
+
releaseOwner: z72.literal("rebuy"),
|
|
4140
|
+
status: z72.literal("queued"),
|
|
4079
4141
|
taskName: postPurchaseTaskNameSchema("post-purchase-order-hold-release", "[a-f0-9]{64}-release")
|
|
4080
4142
|
}),
|
|
4081
4143
|
SessionReleaseScheduleRequestSchema.extend({
|
|
4082
|
-
releaseOwner:
|
|
4083
|
-
status:
|
|
4144
|
+
releaseOwner: z72.literal("shopify"),
|
|
4145
|
+
status: z72.literal("native")
|
|
4084
4146
|
})
|
|
4085
4147
|
]),
|
|
4086
|
-
successful:
|
|
4148
|
+
successful: z72.literal(true)
|
|
4087
4149
|
});
|
|
4088
4150
|
|
|
4089
4151
|
// src/schema/postPurchaseHealthSchedule.ts
|
|
@@ -4092,15 +4154,15 @@ var PostPurchaseHealthTaskNameSchema = postPurchaseTaskNameSchema(
|
|
|
4092
4154
|
"post-purchase-health-check",
|
|
4093
4155
|
"[a-z0-9][a-z0-9-]*--[1-9][0-9]*"
|
|
4094
4156
|
);
|
|
4095
|
-
var HealthScheduleAcknowledgementSchema =
|
|
4157
|
+
var HealthScheduleAcknowledgementSchema = z73.strictObject({
|
|
4096
4158
|
data: HealthScheduleSchema.extend({
|
|
4097
|
-
status:
|
|
4159
|
+
status: z73.literal("queued"),
|
|
4098
4160
|
taskName: PostPurchaseHealthTaskNameSchema
|
|
4099
4161
|
}).refine(
|
|
4100
4162
|
(data) => data.taskName.endsWith(`/tasks/${postPurchaseHealthTaskId(data)}`),
|
|
4101
4163
|
"taskName must be this order's health task"
|
|
4102
4164
|
),
|
|
4103
|
-
successful:
|
|
4165
|
+
successful: z73.literal(true)
|
|
4104
4166
|
});
|
|
4105
4167
|
|
|
4106
4168
|
// src/schema/postPurchaseHealth.ts
|
|
@@ -4109,7 +4171,7 @@ var HealthFactSchema = HealthScheduleSchema.pick({
|
|
|
4109
4171
|
operationId: true,
|
|
4110
4172
|
removePartialOrder: true
|
|
4111
4173
|
});
|
|
4112
|
-
var HealthScheduleReceiptSchema =
|
|
4174
|
+
var HealthScheduleReceiptSchema = z74.strictObject({
|
|
4113
4175
|
recordedAt: PostPurchaseTimestampSchema,
|
|
4114
4176
|
taskName: PostPurchaseHealthTaskNameSchema
|
|
4115
4177
|
});
|
|
@@ -4119,150 +4181,138 @@ var StoredHealthFactSchema = HealthFactSchema.extend({
|
|
|
4119
4181
|
});
|
|
4120
4182
|
var HealthAttemptSchema = StoredHealthFactSchema.extend({
|
|
4121
4183
|
attemptedAt: PostPurchaseTimestampSchema,
|
|
4122
|
-
attemptId:
|
|
4123
|
-
status:
|
|
4184
|
+
attemptId: z74.uuid(),
|
|
4185
|
+
status: z74.literal("attempted")
|
|
4124
4186
|
});
|
|
4125
4187
|
var HealthResultSchema = HealthAttemptSchema.extend({
|
|
4126
4188
|
finishedAt: PostPurchaseTimestampSchema,
|
|
4127
|
-
status:
|
|
4189
|
+
status: z74.enum(["returned", "unknown"])
|
|
4128
4190
|
});
|
|
4129
|
-
var HealthStateSchema =
|
|
4130
|
-
StoredHealthFactSchema.extend({ status:
|
|
4191
|
+
var HealthStateSchema = z74.union([
|
|
4192
|
+
StoredHealthFactSchema.extend({ status: z74.literal("pending") }),
|
|
4131
4193
|
HealthAttemptSchema,
|
|
4132
4194
|
HealthResultSchema
|
|
4133
4195
|
]);
|
|
4134
4196
|
var HealthPrepareRequestSchema = DecideRequestSchema.extend({
|
|
4135
4197
|
operationId: HealthScheduleSchema.shape.operationId
|
|
4136
4198
|
}).strict();
|
|
4137
|
-
var HealthPrepareResponseSchema =
|
|
4138
|
-
var HealthClaimRequestSchema =
|
|
4199
|
+
var HealthPrepareResponseSchema = z74.object({ data: HealthScheduleSchema, successful: z74.literal(true) });
|
|
4200
|
+
var HealthClaimRequestSchema = z74.strictObject({
|
|
4139
4201
|
orderId: PostPurchaseOrderIdSchema,
|
|
4140
|
-
removePartialOrder:
|
|
4202
|
+
removePartialOrder: z74.boolean(),
|
|
4141
4203
|
shop: ShopifyDomainSchema
|
|
4142
4204
|
});
|
|
4143
4205
|
var HealthClaimFactSchema = HealthClaimRequestSchema.extend({
|
|
4144
4206
|
healthScheduledAt: HealthFactSchema.shape.healthScheduledAt
|
|
4145
4207
|
});
|
|
4146
|
-
var HealthClaimResponseSchema =
|
|
4147
|
-
data:
|
|
4148
|
-
|
|
4149
|
-
HealthClaimFactSchema.extend({ status:
|
|
4150
|
-
HealthClaimFactSchema.extend({ attemptId: HealthAttemptSchema.shape.attemptId, status:
|
|
4208
|
+
var HealthClaimResponseSchema = z74.object({
|
|
4209
|
+
data: z74.union([
|
|
4210
|
+
z74.strictObject({ status: z74.literal("missing") }),
|
|
4211
|
+
HealthClaimFactSchema.extend({ status: z74.enum(["pending", "attempted", "returned", "unknown"]) }),
|
|
4212
|
+
HealthClaimFactSchema.extend({ attemptId: HealthAttemptSchema.shape.attemptId, status: z74.literal("claimed") })
|
|
4151
4213
|
]),
|
|
4152
|
-
successful:
|
|
4214
|
+
successful: z74.literal(true)
|
|
4153
4215
|
});
|
|
4154
4216
|
var HealthResultRequestSchema = HealthClaimRequestSchema.extend({
|
|
4155
4217
|
attemptId: HealthAttemptSchema.shape.attemptId,
|
|
4156
4218
|
outcome: HealthResultSchema.shape.status
|
|
4157
4219
|
});
|
|
4158
|
-
var HealthResultResponseSchema =
|
|
4220
|
+
var HealthResultResponseSchema = z74.object({
|
|
4159
4221
|
data: HealthClaimFactSchema.extend({
|
|
4160
4222
|
finishedAt: HealthResultSchema.shape.finishedAt,
|
|
4161
4223
|
status: HealthResultSchema.shape.status
|
|
4162
4224
|
}),
|
|
4163
|
-
successful:
|
|
4225
|
+
successful: z74.literal(true)
|
|
4164
4226
|
});
|
|
4165
4227
|
|
|
4166
4228
|
// src/schema/postPurchaseLifecycle.ts
|
|
4167
|
-
import { z as
|
|
4168
|
-
var Presentation =
|
|
4229
|
+
import { z as z75 } from "zod";
|
|
4230
|
+
var Presentation = z75.strictObject({
|
|
4169
4231
|
member: PostPurchaseMemberIdentity,
|
|
4170
4232
|
selectedProductId: PostPurchaseMemberIdentity.shape.productId.optional(),
|
|
4171
4233
|
variant: PostPurchaseVariantSelector
|
|
4172
4234
|
});
|
|
4173
4235
|
var LifecycleObservationRequestSchema = DecideRequestSchema.extend({
|
|
4174
4236
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
4175
|
-
eventType:
|
|
4237
|
+
eventType: z75.enum(["OFFER_VIEWED", "OFFER_TIMER_EXPIRED"]),
|
|
4176
4238
|
presentation: Presentation.nullable(),
|
|
4177
4239
|
progressRevision: PostPurchaseProgressSchema.shape.revision,
|
|
4178
|
-
requestId:
|
|
4240
|
+
requestId: z75.uuid()
|
|
4179
4241
|
}).strict().refine(
|
|
4180
4242
|
({ eventType, presentation }) => eventType !== "OFFER_VIEWED" || presentation !== null,
|
|
4181
4243
|
"Viewed observations require a presented product"
|
|
4182
4244
|
);
|
|
4183
|
-
var LifecycleObservationResponseSchema =
|
|
4184
|
-
data:
|
|
4245
|
+
var LifecycleObservationResponseSchema = z75.object({
|
|
4246
|
+
data: z75.strictObject({
|
|
4185
4247
|
requestId: LifecycleObservationRequestSchema.shape.requestId,
|
|
4186
|
-
status:
|
|
4248
|
+
status: z75.union([AcceptedEventOutcomeSchema, z75.literal("unavailable")])
|
|
4187
4249
|
}),
|
|
4188
|
-
successful:
|
|
4250
|
+
successful: z75.literal(true)
|
|
4189
4251
|
});
|
|
4190
4252
|
|
|
4191
4253
|
// src/schema/postPurchaseOffer.ts
|
|
4192
|
-
import { z as
|
|
4193
|
-
|
|
4194
|
-
// src/schema/postPurchaseSkipTrace.ts
|
|
4195
|
-
import { z as z74 } from "zod";
|
|
4196
|
-
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
4197
|
-
var PostPurchaseSkipTraceSchema = z74.array(
|
|
4198
|
-
z74.object({
|
|
4199
|
-
entry: DecisionEntrySchema,
|
|
4200
|
-
reason: PostPurchaseSkipReasonSchema
|
|
4201
|
-
})
|
|
4202
|
-
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
4203
|
-
|
|
4204
|
-
// src/schema/postPurchaseOffer.ts
|
|
4254
|
+
import { z as z76 } from "zod";
|
|
4205
4255
|
var OfferPreparationRequestSchema = DecideRequestSchema.strict();
|
|
4206
|
-
var OfferPreparationResponseSchema =
|
|
4207
|
-
data:
|
|
4208
|
-
successful:
|
|
4256
|
+
var OfferPreparationResponseSchema = z76.object({
|
|
4257
|
+
data: z76.object({ attemptedSkips: PostPurchaseSkipTraceSchema.optional(), progress: PostPurchaseProgressSchema }),
|
|
4258
|
+
successful: z76.literal(true)
|
|
4209
4259
|
});
|
|
4210
4260
|
|
|
4211
4261
|
// src/schema/postPurchaseOfferEligibility.ts
|
|
4212
|
-
import { z as
|
|
4262
|
+
import { z as z77 } from "zod";
|
|
4213
4263
|
var selection2 = PreparedPostPurchaseProduct.shape.selection;
|
|
4214
|
-
var PostPurchaseOfferSkipReason =
|
|
4215
|
-
var PostPurchaseOfferEligibilityContext =
|
|
4264
|
+
var PostPurchaseOfferSkipReason = z77.enum(["empty", "no-eligible-subscription"]);
|
|
4265
|
+
var PostPurchaseOfferEligibilityContext = z77.object({
|
|
4216
4266
|
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
4217
|
-
originalLineItems:
|
|
4267
|
+
originalLineItems: z77.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
4218
4268
|
});
|
|
4219
|
-
var PostPurchaseOfferEligibility =
|
|
4220
|
-
|
|
4221
|
-
members:
|
|
4222
|
-
|
|
4269
|
+
var PostPurchaseOfferEligibility = z77.discriminatedUnion("status", [
|
|
4270
|
+
z77.object({
|
|
4271
|
+
members: z77.array(
|
|
4272
|
+
z77.object({ productId: selection2.shape.productId, productIndex: z77.number().int().nonnegative() })
|
|
4223
4273
|
),
|
|
4224
|
-
status:
|
|
4274
|
+
status: z77.literal("retain")
|
|
4225
4275
|
}),
|
|
4226
|
-
|
|
4227
|
-
|
|
4276
|
+
z77.object({ reason: PostPurchaseOfferSkipReason, status: z77.literal("skip") }),
|
|
4277
|
+
z77.object({ reason: z77.literal("eligible-upgrade").optional(), status: z77.literal("unavailable") })
|
|
4228
4278
|
]);
|
|
4229
4279
|
|
|
4230
4280
|
// src/schema/postPurchaseOfferPresentation.ts
|
|
4231
|
-
import { z as
|
|
4281
|
+
import { z as z78 } from "zod";
|
|
4232
4282
|
var language2 = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap();
|
|
4233
|
-
var PostPurchaseOfferPresentation =
|
|
4283
|
+
var PostPurchaseOfferPresentation = z78.strictObject({
|
|
4234
4284
|
labels: language2.pick({ declineAll: true, declineThisOffer: true }),
|
|
4235
4285
|
layout: PostPurchaseSettings.shape.offersLayout,
|
|
4236
4286
|
sections: CABRootSection.nullable(),
|
|
4237
4287
|
showDeclineAll: PostPurchaseSettings.shape.productOptions.shape.showDeclineAll
|
|
4238
4288
|
});
|
|
4239
4289
|
var OfferPresentationRequestSchema = DecideRequestSchema.strict();
|
|
4240
|
-
var OfferPresentationResponseSchema =
|
|
4241
|
-
data:
|
|
4290
|
+
var OfferPresentationResponseSchema = z78.object({
|
|
4291
|
+
data: z78.strictObject({
|
|
4242
4292
|
presentation: PostPurchaseOfferPresentation.nullable(),
|
|
4243
4293
|
progress: PostPurchaseProgressSchema.nullable(),
|
|
4244
4294
|
serverNow: PostPurchaseTimestampSchema
|
|
4245
4295
|
}),
|
|
4246
|
-
successful:
|
|
4296
|
+
successful: z78.literal(true)
|
|
4247
4297
|
});
|
|
4248
4298
|
|
|
4249
4299
|
// src/schema/postPurchaseOrderDecision.ts
|
|
4250
|
-
import { z as
|
|
4251
|
-
var OrderDecisionSchema =
|
|
4252
|
-
|
|
4253
|
-
|
|
4300
|
+
import { z as z79 } from "zod";
|
|
4301
|
+
var OrderDecisionSchema = z79.discriminatedUnion("owner", [
|
|
4302
|
+
z79.object({ owner: z79.literal("session"), sessionId: PostPurchaseSessionIdSchema }),
|
|
4303
|
+
z79.object({ owner: z79.literal("release"), sessionId: z79.null() })
|
|
4254
4304
|
]);
|
|
4255
4305
|
|
|
4256
4306
|
// src/schema/postPurchasePolicy.ts
|
|
4257
|
-
import { z as
|
|
4258
|
-
var HoldSettingSchema =
|
|
4259
|
-
|
|
4260
|
-
|
|
4307
|
+
import { z as z80 } from "zod";
|
|
4308
|
+
var HoldSettingSchema = z80.discriminatedUnion("enabled", [
|
|
4309
|
+
z80.object({ durationMinutes: z80.number().int().min(1).max(60), enabled: z80.literal(true) }),
|
|
4310
|
+
z80.object({ durationMinutes: z80.null(), enabled: z80.literal(false) })
|
|
4261
4311
|
]);
|
|
4262
|
-
var TimingSettingsSchema =
|
|
4312
|
+
var TimingSettingsSchema = z80.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
4263
4313
|
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
4264
|
-
durationMinutes:
|
|
4265
|
-
source:
|
|
4314
|
+
durationMinutes: z80.number().int().min(1).max(60).nullable(),
|
|
4315
|
+
source: z80.enum(["shop", "flow", "native"])
|
|
4266
4316
|
}).refine(
|
|
4267
4317
|
(policy) => {
|
|
4268
4318
|
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
@@ -4276,8 +4326,8 @@ var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
|
4276
4326
|
);
|
|
4277
4327
|
|
|
4278
4328
|
// src/schema/postPurchasePreparationOptions.ts
|
|
4279
|
-
import { z as
|
|
4280
|
-
var PostPurchasePreparationOptions =
|
|
4329
|
+
import { z as z81 } from "zod";
|
|
4330
|
+
var PostPurchasePreparationOptions = z81.object({
|
|
4281
4331
|
choice: PostPurchaseChoice.optional(),
|
|
4282
4332
|
member: PostPurchaseMemberSelector.strict().optional(),
|
|
4283
4333
|
quantity: PreparedPostPurchaseProduct.shape.selection.shape.quantity.optional(),
|
|
@@ -4289,8 +4339,8 @@ var PostPurchasePreparationOptions = z80.object({
|
|
|
4289
4339
|
);
|
|
4290
4340
|
|
|
4291
4341
|
// src/schema/postPurchaseProductSettings.ts
|
|
4292
|
-
import { z as
|
|
4293
|
-
var amount =
|
|
4342
|
+
import { z as z82 } from "zod";
|
|
4343
|
+
var amount = z82.union([z82.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
4294
4344
|
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
4295
4345
|
discountedFrom: true,
|
|
4296
4346
|
language: true,
|
|
@@ -4302,22 +4352,22 @@ var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
|
4302
4352
|
subscriptionIsDefault: true,
|
|
4303
4353
|
upgradeToSubscription: true
|
|
4304
4354
|
}).extend({
|
|
4305
|
-
advance:
|
|
4306
|
-
blocks:
|
|
4355
|
+
advance: z82.unknown().default({}),
|
|
4356
|
+
blocks: z82.array(z82.unknown()).optional(),
|
|
4307
4357
|
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
4308
|
-
integrations:
|
|
4358
|
+
integrations: z82.unknown().default({}),
|
|
4309
4359
|
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
4310
|
-
styles:
|
|
4360
|
+
styles: z82.unknown().default({}),
|
|
4311
4361
|
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
4312
|
-
subscription:
|
|
4362
|
+
subscription: z82.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
4313
4363
|
});
|
|
4314
4364
|
|
|
4315
4365
|
// src/schema/postPurchaseRecovery.ts
|
|
4316
|
-
import { z as
|
|
4366
|
+
import { z as z83 } from "zod";
|
|
4317
4367
|
var PurchaseRecoveryRequestSchema = DecideRequestSchema.strict();
|
|
4318
|
-
var PurchaseRecoveryResponseSchema =
|
|
4319
|
-
data:
|
|
4320
|
-
operation:
|
|
4368
|
+
var PurchaseRecoveryResponseSchema = z83.object({
|
|
4369
|
+
data: z83.object({
|
|
4370
|
+
operation: z83.object({
|
|
4321
4371
|
observation: RecordedPurchaseObservationSchema.nullable(),
|
|
4322
4372
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
4323
4373
|
upgrade: UpgradeProgressSchema.optional()
|
|
@@ -4327,41 +4377,41 @@ var PurchaseRecoveryResponseSchema = z82.object({
|
|
|
4327
4377
|
}).nullable(),
|
|
4328
4378
|
progress: PostPurchaseProgressSchema.nullable().optional()
|
|
4329
4379
|
}),
|
|
4330
|
-
successful:
|
|
4380
|
+
successful: z83.literal(true)
|
|
4331
4381
|
});
|
|
4332
4382
|
|
|
4333
4383
|
// src/schema/postPurchaseReleaseClaim.ts
|
|
4334
|
-
import { z as
|
|
4384
|
+
import { z as z84 } from "zod";
|
|
4335
4385
|
var ReleaseClaimRequestSchema = ReleaseAuthorityRequestSchema;
|
|
4336
|
-
var ReleaseClaimResponseSchema =
|
|
4337
|
-
data:
|
|
4338
|
-
|
|
4386
|
+
var ReleaseClaimResponseSchema = z84.object({
|
|
4387
|
+
data: z84.discriminatedUnion("status", [
|
|
4388
|
+
z84.object({ status: z84.literal("release-permitted") }),
|
|
4339
4389
|
PendingReleaseAuthoritySchema,
|
|
4340
4390
|
ReadyReleaseAuthoritySchema
|
|
4341
4391
|
]),
|
|
4342
|
-
successful:
|
|
4392
|
+
successful: z84.literal(true)
|
|
4343
4393
|
});
|
|
4344
4394
|
|
|
4345
4395
|
// src/schema/postPurchaseSelection.ts
|
|
4346
|
-
import { z as
|
|
4396
|
+
import { z as z85 } from "zod";
|
|
4347
4397
|
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
4348
4398
|
appId: PostPurchaseAppIdSchema,
|
|
4349
4399
|
entry: DecisionEntrySchema,
|
|
4350
|
-
iss:
|
|
4351
|
-
purpose:
|
|
4400
|
+
iss: z85.literal("rebuy-api"),
|
|
4401
|
+
purpose: z85.literal("post-purchase-selection")
|
|
4352
4402
|
});
|
|
4353
4403
|
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
4354
|
-
selectionToken:
|
|
4404
|
+
selectionToken: z85.string().min(1).max(8192).optional()
|
|
4355
4405
|
}).strict();
|
|
4356
4406
|
|
|
4357
4407
|
// src/schema/postPurchaseSession.ts
|
|
4358
|
-
import { z as
|
|
4408
|
+
import { z as z86 } from "zod";
|
|
4359
4409
|
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
4360
|
-
var SessionOrderTimingSchema =
|
|
4410
|
+
var SessionOrderTimingSchema = z86.object({
|
|
4361
4411
|
nativeDeadline: PostPurchaseTimestampSchema,
|
|
4362
4412
|
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
4363
4413
|
orderId: PostPurchaseOrderIdSchema,
|
|
4364
|
-
timingSource:
|
|
4414
|
+
timingSource: z86.literal("shopify-order-created-at")
|
|
4365
4415
|
});
|
|
4366
4416
|
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
4367
4417
|
deadline: PostPurchaseTimestampSchema,
|
|
@@ -4378,33 +4428,33 @@ var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
|
4378
4428
|
message: "deadline must not exceed nativeDeadline",
|
|
4379
4429
|
path: ["deadline"]
|
|
4380
4430
|
});
|
|
4381
|
-
var SessionStartResponseSchema =
|
|
4382
|
-
data:
|
|
4383
|
-
phase:
|
|
4431
|
+
var SessionStartResponseSchema = z86.object({
|
|
4432
|
+
data: z86.object({
|
|
4433
|
+
phase: z86.literal("render"),
|
|
4384
4434
|
serverNow: PostPurchaseTimestampSchema,
|
|
4385
4435
|
session: ReadySessionTimingSchema,
|
|
4386
|
-
workflowPhase:
|
|
4436
|
+
workflowPhase: z86.literal("start")
|
|
4387
4437
|
}),
|
|
4388
|
-
successful:
|
|
4438
|
+
successful: z86.literal(true)
|
|
4389
4439
|
});
|
|
4390
4440
|
|
|
4391
4441
|
// src/schema/postPurchaseShadow.ts
|
|
4392
|
-
import { z as
|
|
4393
|
-
var PostPurchaseShadowSelectionSchema =
|
|
4394
|
-
|
|
4395
|
-
|
|
4442
|
+
import { z as z87 } from "zod";
|
|
4443
|
+
var PostPurchaseShadowSelectionSchema = z87.discriminatedUnion("verdict", [
|
|
4444
|
+
z87.object({ entry: DecisionEntrySchema, verdict: z87.literal("render") }),
|
|
4445
|
+
z87.object({ verdict: z87.literal("skip") })
|
|
4396
4446
|
]);
|
|
4397
|
-
var PostPurchaseShadowReportFields =
|
|
4398
|
-
differences:
|
|
4447
|
+
var PostPurchaseShadowReportFields = z87.object({
|
|
4448
|
+
differences: z87.array(z87.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
4399
4449
|
message: "differences must not contain duplicate entries"
|
|
4400
4450
|
}),
|
|
4401
4451
|
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
4402
|
-
phase:
|
|
4403
|
-
sampleId:
|
|
4452
|
+
phase: z87.literal("shouldRender"),
|
|
4453
|
+
sampleId: z87.string(),
|
|
4404
4454
|
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
4405
|
-
status:
|
|
4406
|
-
targetingFlowIds:
|
|
4407
|
-
workflowPhase:
|
|
4455
|
+
status: z87.enum(["match", "diverged", "incomplete"]),
|
|
4456
|
+
targetingFlowIds: z87.array(z87.number().int().positive()),
|
|
4457
|
+
workflowPhase: z87.literal("decide")
|
|
4408
4458
|
});
|
|
4409
4459
|
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
4410
4460
|
(report) => report.status !== "match" || report.differences.length === 0,
|
|
@@ -4418,9 +4468,9 @@ var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
|
4418
4468
|
});
|
|
4419
4469
|
|
|
4420
4470
|
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
4421
|
-
import { z as
|
|
4471
|
+
import { z as z88 } from "zod";
|
|
4422
4472
|
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
4423
|
-
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId:
|
|
4473
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: z88.number().int().positive() }),
|
|
4424
4474
|
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
4425
4475
|
subscription: PostPurchaseSubscriptionTerms
|
|
4426
4476
|
}).refine(
|
|
@@ -4432,28 +4482,6 @@ var readPostPurchaseSubscription = (prepared) => {
|
|
|
4432
4482
|
return PreparedPostPurchaseSubscription.parse(prepared);
|
|
4433
4483
|
};
|
|
4434
4484
|
|
|
4435
|
-
// src/schema/postPurchaseTransition.ts
|
|
4436
|
-
import { z as z88 } from "zod";
|
|
4437
|
-
var OfferTransitionRequestSchema = DecideRequestSchema.extend({
|
|
4438
|
-
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
4439
|
-
progressRevision: PostPurchaseProgressSchema.shape.revision
|
|
4440
|
-
}).strict();
|
|
4441
|
-
var PostPurchaseEndReasonSchema = z88.enum(["no-child", "no-products", "accept-cap"]);
|
|
4442
|
-
var TransitionBaseSchema = z88.object({
|
|
4443
|
-
attemptedSkips: PostPurchaseSkipTraceSchema.optional(),
|
|
4444
|
-
progress: PostPurchaseProgressSchema
|
|
4445
|
-
});
|
|
4446
|
-
var OfferTransitionResponseSchema = z88.object({
|
|
4447
|
-
data: z88.discriminatedUnion("status", [
|
|
4448
|
-
TransitionBaseSchema.extend({ status: z88.enum(["advanced", "unavailable"]) }),
|
|
4449
|
-
TransitionBaseSchema.extend({
|
|
4450
|
-
endReason: PostPurchaseEndReasonSchema.optional(),
|
|
4451
|
-
status: z88.literal("no-child")
|
|
4452
|
-
})
|
|
4453
|
-
]),
|
|
4454
|
-
successful: z88.literal(true)
|
|
4455
|
-
});
|
|
4456
|
-
|
|
4457
4485
|
// src/schema/postPurchaseVariantDefault.ts
|
|
4458
4486
|
import { z as z89 } from "zod";
|
|
4459
4487
|
var values = PostPurchaseVariantValues.partial().extend({
|
|
@@ -5742,6 +5770,7 @@ var subscriptionToggle = (productType, labels = {}) => {
|
|
|
5742
5770
|
buttonStyle: "plain",
|
|
5743
5771
|
/** A `subscription` widget offers no one-time purchase; suppress the downgrade so the buyer can't switch to one-time. */
|
|
5744
5772
|
...productType === "subscription" && { disableDowngrade: true },
|
|
5773
|
+
...labels.frequencyLabel && { frequencyLabel: labels.frequencyLabel },
|
|
5745
5774
|
sections: [
|
|
5746
5775
|
slot("subscriptionOption", void 0),
|
|
5747
5776
|
slot("switchToOneTimePurchase", labels.oneTime),
|
|
@@ -6631,6 +6660,7 @@ export {
|
|
|
6631
6660
|
PostPurchaseDisplayPrice,
|
|
6632
6661
|
PostPurchaseEndReasonSchema,
|
|
6633
6662
|
PostPurchaseExcludedProductIds,
|
|
6663
|
+
PostPurchaseFinishReasonSchema,
|
|
6634
6664
|
PostPurchaseGroupCatalog,
|
|
6635
6665
|
PostPurchaseGroupChoice,
|
|
6636
6666
|
PostPurchaseGroupDescription,
|