@rebuy/rebuy 3.44.1 → 3.45.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 +457 -449
- package/dist/index.mjs +457 -449
- package/dist/schema/postPurchaseFinish.d.ts +27 -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,35 @@ 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
|
-
name:
|
|
3196
|
-
optionId:
|
|
3197
|
-
popover:
|
|
3198
|
-
alignment:
|
|
3199
|
-
position:
|
|
3235
|
+
disableDowngrade: z52.boolean().default(false),
|
|
3236
|
+
name: z52.string().optional(),
|
|
3237
|
+
optionId: z52.number().optional(),
|
|
3238
|
+
popover: z52.object({
|
|
3239
|
+
alignment: z52.enum(textAlignments).default(TextAlignment.center),
|
|
3240
|
+
position: z52.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
3200
3241
|
}).optional().default(() => ({
|
|
3201
3242
|
alignment: TextAlignment.center,
|
|
3202
3243
|
position: PopoverPosition.blockStart
|
|
3203
3244
|
})),
|
|
3204
|
-
sectionId:
|
|
3205
|
-
sections:
|
|
3206
|
-
sectionType:
|
|
3245
|
+
sectionId: z52.uuid().default(() => uuidv73()),
|
|
3246
|
+
sections: z52.union([z52.array(CABButtonContent), z52.strictObject({}).transform(() => [])]).default(() => []),
|
|
3247
|
+
sectionType: z52.literal(SectionType.button).default(SectionType.button),
|
|
3207
3248
|
/**
|
|
3208
3249
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
3209
3250
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -3218,96 +3259,96 @@ var CABButtonSection = z50.object({
|
|
|
3218
3259
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
3219
3260
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
3220
3261
|
*/
|
|
3221
|
-
tier:
|
|
3262
|
+
tier: z52.object({ tierId: z52.string().min(1) }).optional(),
|
|
3222
3263
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
3223
|
-
trackingUrl:
|
|
3264
|
+
trackingUrl: z52.string().optional(),
|
|
3224
3265
|
/**
|
|
3225
3266
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
3226
3267
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
3227
3268
|
*/
|
|
3228
|
-
variableEffects:
|
|
3269
|
+
variableEffects: z52.array(CABVariableEffect).optional()
|
|
3229
3270
|
});
|
|
3230
3271
|
|
|
3231
3272
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3232
|
-
import { z as
|
|
3273
|
+
import { z as z57 } from "zod";
|
|
3233
3274
|
|
|
3234
3275
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3235
|
-
import { z as
|
|
3276
|
+
import { z as z56 } from "zod";
|
|
3236
3277
|
|
|
3237
3278
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
3238
3279
|
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:
|
|
3280
|
+
import { z as z53 } from "zod";
|
|
3281
|
+
var CABDiscount = z53.object({
|
|
3282
|
+
amount: z53.union([z53.number(), z53.string()]).catch(0),
|
|
3283
|
+
discountedBy: z53.string().optional(),
|
|
3284
|
+
discountedFrom: z53.enum(discountSources).optional().catch(void 0),
|
|
3285
|
+
type: z53.enum(discountTypes).catch("none")
|
|
3286
|
+
});
|
|
3287
|
+
var CABIntegrations = z53.object({
|
|
3288
|
+
judgeme: z53.boolean().default(false),
|
|
3289
|
+
junip: z53.boolean().default(false),
|
|
3290
|
+
klaviyo: z53.boolean().default(false),
|
|
3291
|
+
loox: z53.boolean().default(false),
|
|
3292
|
+
okendo: z53.boolean().default(false),
|
|
3293
|
+
opinew: z53.boolean().default(false),
|
|
3294
|
+
reviewsio: z53.boolean().default(false),
|
|
3295
|
+
stamped: z53.boolean().default(false),
|
|
3296
|
+
yotpo: z53.boolean().default(false)
|
|
3297
|
+
});
|
|
3298
|
+
var CABVariantLabels = z53.object({
|
|
3299
|
+
variantOption: z53.string().optional().catch(void 0),
|
|
3300
|
+
variantOptions: z53.string().optional().catch(void 0)
|
|
3301
|
+
});
|
|
3302
|
+
var CABDataSourceSection = z53.object({
|
|
3303
|
+
dataSourceId: z53.number().nullable().default(null),
|
|
3304
|
+
dataSourcePath: z53.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
3264
3305
|
discount: CABDiscount.optional(),
|
|
3265
3306
|
integrations: CABIntegrations.optional(),
|
|
3266
|
-
limit:
|
|
3267
|
-
matchVariant:
|
|
3268
|
-
matchVariantOutOfStock:
|
|
3269
|
-
name:
|
|
3270
|
-
productType:
|
|
3271
|
-
sectionId:
|
|
3272
|
-
sectionType:
|
|
3307
|
+
limit: z53.number().default(1),
|
|
3308
|
+
matchVariant: z53.boolean().default(false),
|
|
3309
|
+
matchVariantOutOfStock: z53.boolean().default(false),
|
|
3310
|
+
name: z53.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
3311
|
+
productType: z53.enum(productTypes).optional(),
|
|
3312
|
+
sectionId: z53.uuid().default(() => uuidv74()),
|
|
3313
|
+
sectionType: z53.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
3273
3314
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
3274
|
-
subscriptionIsDefault:
|
|
3275
|
-
treatAsGwp:
|
|
3315
|
+
subscriptionIsDefault: z53.boolean().default(false),
|
|
3316
|
+
treatAsGwp: z53.boolean().default(false),
|
|
3276
3317
|
variantLabels: CABVariantLabels.optional().catch(void 0)
|
|
3277
3318
|
});
|
|
3278
3319
|
|
|
3279
3320
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3280
3321
|
import { v7 as uuidv76 } from "uuid";
|
|
3281
|
-
import { z as
|
|
3322
|
+
import { z as z55 } from "zod";
|
|
3282
3323
|
|
|
3283
3324
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
3284
3325
|
import { v7 as uuidv75 } from "uuid";
|
|
3285
|
-
import { z as
|
|
3286
|
-
var CABVariantContent =
|
|
3287
|
-
() =>
|
|
3326
|
+
import { z as z54 } from "zod";
|
|
3327
|
+
var CABVariantContent = z54.lazy(
|
|
3328
|
+
() => z54.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
3288
3329
|
);
|
|
3289
|
-
var CABProductSection =
|
|
3330
|
+
var CABProductSection = z54.object({
|
|
3290
3331
|
...CABVariableFields,
|
|
3291
|
-
name:
|
|
3292
|
-
productId:
|
|
3293
|
-
sectionId:
|
|
3294
|
-
sections:
|
|
3295
|
-
sectionType:
|
|
3296
|
-
selectors:
|
|
3297
|
-
variantMode:
|
|
3332
|
+
name: z54.string().optional(),
|
|
3333
|
+
productId: z54.number().nullable().default(null),
|
|
3334
|
+
sectionId: z54.uuid().default(() => uuidv75()),
|
|
3335
|
+
sections: z54.union([z54.array(CABVariantContent), z54.strictObject({}).transform(() => [])]).default(() => []),
|
|
3336
|
+
sectionType: z54.literal(SectionType.product).default(SectionType.product),
|
|
3337
|
+
selectors: z54.record(z54.string(), z54.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
3338
|
+
variantMode: z54.enum(variantModes).default(VariantMode.multiple)
|
|
3298
3339
|
});
|
|
3299
3340
|
|
|
3300
3341
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3301
|
-
var CABProductsSection =
|
|
3342
|
+
var CABProductsSection = z55.object({
|
|
3302
3343
|
...CABVariableFields,
|
|
3303
|
-
name:
|
|
3304
|
-
sectionId:
|
|
3305
|
-
sections:
|
|
3306
|
-
sectionType:
|
|
3344
|
+
name: z55.string().optional(),
|
|
3345
|
+
sectionId: z55.uuid().default(() => uuidv76()),
|
|
3346
|
+
sections: z55.union([z55.array(z55.lazy(() => CABProductSection)), z55.strictObject({}).transform(() => [])]).default(() => []),
|
|
3347
|
+
sectionType: z55.literal(SectionType.products).default(SectionType.products)
|
|
3307
3348
|
});
|
|
3308
3349
|
|
|
3309
3350
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3310
|
-
var CABOffersSection =
|
|
3351
|
+
var CABOffersSection = z56.lazy(
|
|
3311
3352
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3312
3353
|
/**
|
|
3313
3354
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -3315,8 +3356,8 @@ var CABOffersSection = z54.lazy(
|
|
|
3315
3356
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
3316
3357
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
3317
3358
|
*/
|
|
3318
|
-
divider:
|
|
3319
|
-
sections:
|
|
3359
|
+
divider: z56.boolean().optional(),
|
|
3360
|
+
sections: z56.union([z56.array(z56.lazy(() => CABSection)), z56.strictObject({}).transform(() => [])]).default(() => [
|
|
3320
3361
|
CABBannerSection.parse({
|
|
3321
3362
|
buttonField: "undoAddToOrder",
|
|
3322
3363
|
color: "success",
|
|
@@ -3330,77 +3371,77 @@ var CABOffersSection = z54.lazy(
|
|
|
3330
3371
|
CABDataSourceSection.parse({}),
|
|
3331
3372
|
CABProductsSection.parse({})
|
|
3332
3373
|
]),
|
|
3333
|
-
sectionType:
|
|
3374
|
+
sectionType: z56.literal(SectionType.offers).default(SectionType.offers)
|
|
3334
3375
|
})
|
|
3335
3376
|
);
|
|
3336
3377
|
|
|
3337
3378
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3338
|
-
var CABCarouselSection =
|
|
3379
|
+
var CABCarouselSection = z57.lazy(
|
|
3339
3380
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3340
|
-
autoAdvanceInterval:
|
|
3341
|
-
itemsAtOnce:
|
|
3381
|
+
autoAdvanceInterval: z57.number().default(0),
|
|
3382
|
+
itemsAtOnce: z57.number().min(1).default(1),
|
|
3342
3383
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
3343
|
-
offersDirection:
|
|
3344
|
-
sections:
|
|
3345
|
-
sectionType:
|
|
3384
|
+
offersDirection: z57.enum(offersDirections).default("vertical"),
|
|
3385
|
+
sections: z57.union([z57.array(z57.lazy(() => CABSection)), z57.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
3386
|
+
sectionType: z57.literal(SectionType.carousel).default(SectionType.carousel)
|
|
3346
3387
|
})
|
|
3347
3388
|
);
|
|
3348
3389
|
|
|
3349
3390
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
3350
|
-
import { z as
|
|
3351
|
-
var CABCartLineSection =
|
|
3391
|
+
import { z as z58 } from "zod";
|
|
3392
|
+
var CABCartLineSection = z58.lazy(
|
|
3352
3393
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3353
|
-
sections:
|
|
3354
|
-
sectionType:
|
|
3394
|
+
sections: z58.union([z58.array(z58.lazy(() => CABSection)), z58.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
3395
|
+
sectionType: z58.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
3355
3396
|
})
|
|
3356
3397
|
);
|
|
3357
3398
|
|
|
3358
3399
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
3359
3400
|
import { v7 as uuidv77 } from "uuid";
|
|
3360
|
-
import { z as
|
|
3361
|
-
var CABDiscountSection =
|
|
3401
|
+
import { z as z59 } from "zod";
|
|
3402
|
+
var CABDiscountSection = z59.object({
|
|
3362
3403
|
...CABVariableFields,
|
|
3363
|
-
amount:
|
|
3364
|
-
discountedBy:
|
|
3365
|
-
discountedFrom:
|
|
3366
|
-
message:
|
|
3367
|
-
name:
|
|
3368
|
-
quantity:
|
|
3369
|
-
sectionId:
|
|
3370
|
-
sectionType:
|
|
3371
|
-
type:
|
|
3404
|
+
amount: z59.union([z59.number(), z59.string()]).catch(0),
|
|
3405
|
+
discountedBy: z59.string().optional(),
|
|
3406
|
+
discountedFrom: z59.enum(discountSources).optional().catch(void 0),
|
|
3407
|
+
message: z59.string().optional(),
|
|
3408
|
+
name: z59.string().optional(),
|
|
3409
|
+
quantity: z59.number().default(1),
|
|
3410
|
+
sectionId: z59.uuid().default(() => uuidv77()),
|
|
3411
|
+
sectionType: z59.literal(SectionType.discount).default(SectionType.discount),
|
|
3412
|
+
type: z59.enum(discountTypes).catch("none")
|
|
3372
3413
|
});
|
|
3373
3414
|
|
|
3374
3415
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
3375
3416
|
import { v7 as uuidv78 } from "uuid";
|
|
3376
|
-
import { z as
|
|
3377
|
-
var CABMonetizeAds =
|
|
3378
|
-
requestId:
|
|
3417
|
+
import { z as z60 } from "zod";
|
|
3418
|
+
var CABMonetizeAds = z60.object({
|
|
3419
|
+
requestId: z60.string().optional(),
|
|
3379
3420
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
3380
|
-
testing:
|
|
3421
|
+
testing: z60.boolean().default(false)
|
|
3381
3422
|
});
|
|
3382
|
-
var CABMonetizeSection =
|
|
3423
|
+
var CABMonetizeSection = z60.object({
|
|
3383
3424
|
...CABVariableFields,
|
|
3384
3425
|
ads: CABMonetizeAds.optional(),
|
|
3385
|
-
name:
|
|
3426
|
+
name: z60.string().optional(),
|
|
3386
3427
|
/**
|
|
3387
3428
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
3388
3429
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
3389
3430
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
3390
3431
|
*/
|
|
3391
|
-
offers:
|
|
3432
|
+
offers: z60.array(z60.lazy(() => CABSection)).optional(),
|
|
3392
3433
|
/** 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:
|
|
3434
|
+
privacyPolicyUrl: z60.string().optional(),
|
|
3435
|
+
sectionId: z60.uuid().default(() => uuidv78()),
|
|
3436
|
+
sectionType: z60.literal(SectionType.monetize).default(SectionType.monetize),
|
|
3396
3437
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
3397
|
-
subVertical:
|
|
3438
|
+
subVertical: z60.string().optional(),
|
|
3398
3439
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
3399
|
-
vertical:
|
|
3440
|
+
vertical: z60.string().optional()
|
|
3400
3441
|
});
|
|
3401
3442
|
|
|
3402
3443
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3403
|
-
import { z as
|
|
3444
|
+
import { z as z61 } from "zod";
|
|
3404
3445
|
|
|
3405
3446
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
3406
3447
|
var GIFT_LABELS = {
|
|
@@ -3519,34 +3560,34 @@ var GIFT_LABELS = {
|
|
|
3519
3560
|
};
|
|
3520
3561
|
|
|
3521
3562
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3522
|
-
var CABProgressTierExclusion =
|
|
3523
|
-
collectionIds:
|
|
3524
|
-
productIds:
|
|
3525
|
-
tags:
|
|
3526
|
-
type:
|
|
3563
|
+
var CABProgressTierExclusion = z61.object({
|
|
3564
|
+
collectionIds: z61.array(z61.number().int().positive()).default(() => []),
|
|
3565
|
+
productIds: z61.array(z61.number().int().positive()).default(() => []),
|
|
3566
|
+
tags: z61.array(z61.string().min(1)).default(() => []),
|
|
3567
|
+
type: z61.enum(progressTierExclusionTypes)
|
|
3527
3568
|
});
|
|
3528
|
-
var CABProgressTier =
|
|
3569
|
+
var CABProgressTier = z61.object({
|
|
3529
3570
|
/**
|
|
3530
3571
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
3531
3572
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
3532
3573
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
3533
3574
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
3534
3575
|
*/
|
|
3535
|
-
discount:
|
|
3576
|
+
discount: z61.object({ amount: z61.number().nonnegative(), type: z61.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
3536
3577
|
/**
|
|
3537
3578
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
3538
3579
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
3539
3580
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
3540
3581
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
3541
3582
|
*/
|
|
3542
|
-
exclusions:
|
|
3583
|
+
exclusions: z61.array(CABProgressTierExclusion).default(() => []),
|
|
3543
3584
|
/**
|
|
3544
3585
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
3545
3586
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
3546
3587
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
3547
3588
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
3548
3589
|
*/
|
|
3549
|
-
filterOosVariants:
|
|
3590
|
+
filterOosVariants: z61.boolean().default(false),
|
|
3550
3591
|
/**
|
|
3551
3592
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
3552
3593
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -3554,10 +3595,10 @@ var CABProgressTier = z59.object({
|
|
|
3554
3595
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
3555
3596
|
* tree is complete.
|
|
3556
3597
|
*/
|
|
3557
|
-
gift:
|
|
3558
|
-
productId:
|
|
3559
|
-
title:
|
|
3560
|
-
variantIds:
|
|
3598
|
+
gift: z61.object({
|
|
3599
|
+
productId: z61.number().int().positive(),
|
|
3600
|
+
title: z61.string().optional(),
|
|
3601
|
+
variantIds: z61.array(z61.number().int().positive()).default(() => [])
|
|
3561
3602
|
}).optional(),
|
|
3562
3603
|
/**
|
|
3563
3604
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -3577,7 +3618,7 @@ var CABProgressTier = z59.object({
|
|
|
3577
3618
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
3578
3619
|
* React's size rather than the old hardcoded 20.
|
|
3579
3620
|
*/
|
|
3580
|
-
iconSizePx:
|
|
3621
|
+
iconSizePx: z61.number().int().min(1).max(64).default(18),
|
|
3581
3622
|
/**
|
|
3582
3623
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
3583
3624
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -3587,35 +3628,35 @@ var CABProgressTier = z59.object({
|
|
|
3587
3628
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
3588
3629
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
3589
3630
|
*/
|
|
3590
|
-
label:
|
|
3631
|
+
label: z61.record(z61.string(), z61.string()).optional(),
|
|
3591
3632
|
/**
|
|
3592
3633
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
3593
3634
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
3594
3635
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
3595
3636
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
3596
3637
|
*/
|
|
3597
|
-
productTierImage:
|
|
3638
|
+
productTierImage: z61.boolean().default(false),
|
|
3598
3639
|
/**
|
|
3599
3640
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
3600
3641
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
3601
3642
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
3602
3643
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
3603
3644
|
*/
|
|
3604
|
-
threshold:
|
|
3645
|
+
threshold: z61.number().int().nonnegative(),
|
|
3605
3646
|
/**
|
|
3606
3647
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
3607
3648
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
3608
3649
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
3609
3650
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
3610
3651
|
*/
|
|
3611
|
-
thresholds:
|
|
3652
|
+
thresholds: z61.record(z61.string(), z61.number().int().nonnegative()).default(() => ({})),
|
|
3612
3653
|
/**
|
|
3613
3654
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
3614
3655
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
3615
3656
|
* shipping bar (single unlabeled tier, no gift).
|
|
3616
3657
|
*/
|
|
3617
|
-
tierId:
|
|
3618
|
-
tierType:
|
|
3658
|
+
tierId: z61.string().optional(),
|
|
3659
|
+
tierType: z61.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
3619
3660
|
/**
|
|
3620
3661
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
3621
3662
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -3626,9 +3667,9 @@ var CABProgressTier = z59.object({
|
|
|
3626
3667
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
3627
3668
|
* template text supplies grammatically-neutral wording around the token.
|
|
3628
3669
|
*/
|
|
3629
|
-
unit:
|
|
3670
|
+
unit: z61.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
3630
3671
|
});
|
|
3631
|
-
var CABProgressBarSection =
|
|
3672
|
+
var CABProgressBarSection = z61.lazy(
|
|
3632
3673
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3633
3674
|
/**
|
|
3634
3675
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -3637,35 +3678,35 @@ var CABProgressBarSection = z59.lazy(
|
|
|
3637
3678
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
3638
3679
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
3639
3680
|
*/
|
|
3640
|
-
barId:
|
|
3681
|
+
barId: z61.string().optional(),
|
|
3641
3682
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
3642
|
-
countryCodes:
|
|
3683
|
+
countryCodes: z61.array(z61.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3643
3684
|
/**
|
|
3644
3685
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
3645
3686
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
3646
3687
|
*/
|
|
3647
|
-
excludeCountryCodes:
|
|
3688
|
+
excludeCountryCodes: z61.array(z61.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3648
3689
|
/**
|
|
3649
3690
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
3650
3691
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
3651
3692
|
* adds the cart's discount allocations back to the live subtotal.
|
|
3652
3693
|
*/
|
|
3653
|
-
excludeDiscountInSubtotal:
|
|
3694
|
+
excludeDiscountInSubtotal: z61.boolean().default(false),
|
|
3654
3695
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
3655
|
-
excludedVariantIds:
|
|
3696
|
+
excludedVariantIds: z61.array(z61.number().int().positive()).default(() => []),
|
|
3656
3697
|
/**
|
|
3657
3698
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
3658
3699
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
3659
3700
|
*/
|
|
3660
|
-
freeShippingOnSubscription:
|
|
3701
|
+
freeShippingOnSubscription: z61.boolean().default(false),
|
|
3661
3702
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
3662
|
-
giftAreaTitle:
|
|
3703
|
+
giftAreaTitle: z61.record(z61.string(), z61.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
3663
3704
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
3664
|
-
giftLabels:
|
|
3665
|
-
addGift:
|
|
3666
|
-
remove:
|
|
3667
|
-
selectOptions:
|
|
3668
|
-
yourGift:
|
|
3705
|
+
giftLabels: z61.object({
|
|
3706
|
+
addGift: z61.record(z61.string(), z61.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
3707
|
+
remove: z61.record(z61.string(), z61.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
3708
|
+
selectOptions: z61.record(z61.string(), z61.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
3709
|
+
yourGift: z61.record(z61.string(), z61.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
3669
3710
|
}).default(() => ({
|
|
3670
3711
|
addGift: { ...GIFT_LABELS.addGift },
|
|
3671
3712
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -3673,38 +3714,38 @@ var CABProgressBarSection = z59.lazy(
|
|
|
3673
3714
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
3674
3715
|
})),
|
|
3675
3716
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
3676
|
-
name:
|
|
3717
|
+
name: z61.string().default("Order progress"),
|
|
3677
3718
|
/**
|
|
3678
3719
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
3679
3720
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
3680
3721
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
3681
3722
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
3682
3723
|
*/
|
|
3683
|
-
progressColor:
|
|
3684
|
-
sectionType:
|
|
3724
|
+
progressColor: z61.string().optional(),
|
|
3725
|
+
sectionType: z61.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
3685
3726
|
/**
|
|
3686
3727
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
3687
3728
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
3688
3729
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
3689
3730
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
3690
3731
|
*/
|
|
3691
|
-
tiers:
|
|
3732
|
+
tiers: z61.union([z61.array(CABProgressTier), z61.strictObject({}).transform(() => [])]).default(() => [])
|
|
3692
3733
|
})
|
|
3693
3734
|
);
|
|
3694
3735
|
|
|
3695
3736
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
3696
3737
|
import { v7 as uuidv79 } from "uuid";
|
|
3697
|
-
import { z as
|
|
3698
|
-
var CABQuantitySection =
|
|
3738
|
+
import { z as z62 } from "zod";
|
|
3739
|
+
var CABQuantitySection = z62.object({
|
|
3699
3740
|
...CABVariableFields,
|
|
3700
|
-
errorMessages:
|
|
3701
|
-
|
|
3702
|
-
|
|
3741
|
+
errorMessages: z62.record(
|
|
3742
|
+
z62.string(),
|
|
3743
|
+
z62.object({
|
|
3703
3744
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
3704
|
-
increment:
|
|
3705
|
-
max:
|
|
3706
|
-
min:
|
|
3707
|
-
neg:
|
|
3745
|
+
increment: z62.string().optional(),
|
|
3746
|
+
max: z62.string().optional(),
|
|
3747
|
+
min: z62.string().optional(),
|
|
3748
|
+
neg: z62.string().optional()
|
|
3708
3749
|
})
|
|
3709
3750
|
).default({
|
|
3710
3751
|
en: {
|
|
@@ -3714,18 +3755,18 @@ var CABQuantitySection = z60.object({
|
|
|
3714
3755
|
neg: "Quantity cannot be negative"
|
|
3715
3756
|
}
|
|
3716
3757
|
}),
|
|
3717
|
-
inputType:
|
|
3718
|
-
max:
|
|
3719
|
-
min:
|
|
3758
|
+
inputType: z62.enum(quantityInputs).default(QuantityInput.select),
|
|
3759
|
+
max: z62.number().min(1).max(100).default(10),
|
|
3760
|
+
min: z62.number().min(1).default(1),
|
|
3720
3761
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
3721
|
-
name:
|
|
3722
|
-
sectionId:
|
|
3723
|
-
sectionType:
|
|
3762
|
+
name: z62.string().default("Quantity"),
|
|
3763
|
+
sectionId: z62.uuid().default(() => uuidv79()),
|
|
3764
|
+
sectionType: z62.literal(SectionType.quantity).default(SectionType.quantity)
|
|
3724
3765
|
});
|
|
3725
3766
|
|
|
3726
3767
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3727
3768
|
import { v7 as uuidv710 } from "uuid";
|
|
3728
|
-
import { z as
|
|
3769
|
+
import { z as z63 } from "zod";
|
|
3729
3770
|
|
|
3730
3771
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
3731
3772
|
var REVIEW_LABELS = {
|
|
@@ -3788,69 +3829,69 @@ var REVIEW_LABELS = {
|
|
|
3788
3829
|
};
|
|
3789
3830
|
|
|
3790
3831
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3791
|
-
var CABReviewsSection =
|
|
3832
|
+
var CABReviewsSection = z63.object({
|
|
3792
3833
|
...CABVariableFields,
|
|
3793
|
-
color:
|
|
3834
|
+
color: z63.string().default("#fadb14"),
|
|
3794
3835
|
/**
|
|
3795
3836
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
3796
3837
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
3797
3838
|
* or merchant work.
|
|
3798
3839
|
*/
|
|
3799
|
-
countLabels:
|
|
3800
|
-
one:
|
|
3801
|
-
other:
|
|
3840
|
+
countLabels: z63.object({
|
|
3841
|
+
one: z63.record(z63.string(), z63.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
3842
|
+
other: z63.record(z63.string(), z63.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
3802
3843
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
3803
|
-
name:
|
|
3804
|
-
sectionId:
|
|
3805
|
-
sectionType:
|
|
3806
|
-
size:
|
|
3844
|
+
name: z63.string().optional(),
|
|
3845
|
+
sectionId: z63.uuid().default(() => uuidv710()),
|
|
3846
|
+
sectionType: z63.literal(SectionType.reviews).default(SectionType.reviews),
|
|
3847
|
+
size: z63.enum(reviewsSizes).default(ReviewsSize.default),
|
|
3807
3848
|
/**
|
|
3808
3849
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
3809
3850
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
3810
3851
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
3811
3852
|
* the whole reviews section.
|
|
3812
3853
|
*/
|
|
3813
|
-
strokeColor:
|
|
3854
|
+
strokeColor: z63.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
3814
3855
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
3815
|
-
strokeWidth:
|
|
3856
|
+
strokeWidth: z63.number().nonnegative().default(0)
|
|
3816
3857
|
});
|
|
3817
3858
|
|
|
3818
3859
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
3819
3860
|
import { v7 as uuidv711 } from "uuid";
|
|
3820
|
-
import { z as
|
|
3821
|
-
var CABSeparatorSection =
|
|
3861
|
+
import { z as z64 } from "zod";
|
|
3862
|
+
var CABSeparatorSection = z64.object({
|
|
3822
3863
|
...CABVariableFields,
|
|
3823
|
-
sectionId:
|
|
3824
|
-
sectionType:
|
|
3864
|
+
sectionId: z64.uuid().default(() => uuidv711()),
|
|
3865
|
+
sectionType: z64.literal(SectionType.separator).default(SectionType.separator)
|
|
3825
3866
|
});
|
|
3826
3867
|
|
|
3827
3868
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
3828
3869
|
import { slice } from "es-toolkit/compat";
|
|
3829
3870
|
import { v7 as uuidv712 } from "uuid";
|
|
3830
|
-
import { z as
|
|
3831
|
-
var CABVariantsSection =
|
|
3871
|
+
import { z as z65 } from "zod";
|
|
3872
|
+
var CABVariantsSection = z65.object({
|
|
3832
3873
|
...CABVariableFields,
|
|
3833
|
-
hideOutOfStockVariants:
|
|
3834
|
-
name:
|
|
3835
|
-
sectionId:
|
|
3836
|
-
sectionType:
|
|
3837
|
-
selector:
|
|
3874
|
+
hideOutOfStockVariants: z65.boolean().default(false),
|
|
3875
|
+
name: z65.string().optional(),
|
|
3876
|
+
sectionId: z65.uuid().default(() => uuidv712()),
|
|
3877
|
+
sectionType: z65.literal(SectionType.variants).default(SectionType.variants),
|
|
3878
|
+
selector: z65.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
3838
3879
|
/** `productGroup` is additive (REB-24817): a renderer without group support must render nothing for it. */
|
|
3839
|
-
variantMode:
|
|
3880
|
+
variantMode: z65.enum(variantsModes).default(VariantsMode.multiple)
|
|
3840
3881
|
});
|
|
3841
3882
|
|
|
3842
3883
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3843
|
-
var CABBorder =
|
|
3844
|
-
radius:
|
|
3845
|
-
style:
|
|
3846
|
-
width:
|
|
3884
|
+
var CABBorder = z66.object({
|
|
3885
|
+
radius: z66.enum(borderRadii).default(BorderRadius.base),
|
|
3886
|
+
style: z66.enum(borderStyles).default(BorderStyle.none),
|
|
3887
|
+
width: z66.enum(borderWidths).default(BorderWidth.base)
|
|
3847
3888
|
}).default({
|
|
3848
3889
|
radius: BorderRadius.base,
|
|
3849
3890
|
style: BorderStyle.none,
|
|
3850
3891
|
width: BorderWidth.base
|
|
3851
3892
|
});
|
|
3852
|
-
var CABSection =
|
|
3853
|
-
() =>
|
|
3893
|
+
var CABSection = z66.lazy(
|
|
3894
|
+
() => z66.discriminatedUnion("sectionType", [
|
|
3854
3895
|
CABBannerSection,
|
|
3855
3896
|
CABButtonSection,
|
|
3856
3897
|
CABCarouselSection,
|
|
@@ -3873,41 +3914,41 @@ var CABSection = z64.lazy(
|
|
|
3873
3914
|
);
|
|
3874
3915
|
|
|
3875
3916
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
3876
|
-
var GridItem =
|
|
3877
|
-
var CABLayoutWrapping =
|
|
3878
|
-
breakAt:
|
|
3879
|
-
maxPerLine:
|
|
3917
|
+
var GridItem = z67.union([z67.literal("auto"), z67.literal("fill"), z67.string().regex(/^\d+%$/), z67.number()]);
|
|
3918
|
+
var CABLayoutWrapping = z67.object({
|
|
3919
|
+
breakAt: z67.number().positive(),
|
|
3920
|
+
maxPerLine: z67.number().int().positive()
|
|
3880
3921
|
});
|
|
3881
|
-
var CABLayoutSection =
|
|
3922
|
+
var CABLayoutSection = z67.object({
|
|
3882
3923
|
...CABVariableFields,
|
|
3883
|
-
alignment:
|
|
3884
|
-
horizontal:
|
|
3885
|
-
vertical:
|
|
3924
|
+
alignment: z67.object({
|
|
3925
|
+
horizontal: z67.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
3926
|
+
vertical: z67.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
3886
3927
|
}).default({
|
|
3887
3928
|
horizontal: HorizontalAlignment.start,
|
|
3888
3929
|
vertical: VerticalAlignment.top
|
|
3889
3930
|
}),
|
|
3890
|
-
border:
|
|
3891
|
-
buttonField:
|
|
3892
|
-
direction:
|
|
3931
|
+
border: z67.lazy(() => CABBorder),
|
|
3932
|
+
buttonField: z67.enum(buttonFields).optional(),
|
|
3933
|
+
direction: z67.enum(directions).default(Direction.rows),
|
|
3893
3934
|
/**
|
|
3894
3935
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
3895
3936
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
3896
3937
|
*/
|
|
3897
|
-
frame:
|
|
3898
|
-
grid:
|
|
3899
|
-
columns:
|
|
3900
|
-
rows:
|
|
3938
|
+
frame: z67.enum(layoutFrames).optional(),
|
|
3939
|
+
grid: z67.object({
|
|
3940
|
+
columns: z67.union([z67.array(GridItem), z67.undefined()]).default(() => ["auto"]),
|
|
3941
|
+
rows: z67.union([z67.array(GridItem), z67.undefined()]).default(() => ["auto"])
|
|
3901
3942
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
3902
|
-
name:
|
|
3903
|
-
padding:
|
|
3904
|
-
sectionId:
|
|
3905
|
-
sections:
|
|
3906
|
-
sectionType:
|
|
3907
|
-
spacing:
|
|
3943
|
+
name: z67.string().optional(),
|
|
3944
|
+
padding: z67.enum(spacings).default(Spacing.none),
|
|
3945
|
+
sectionId: z67.uuid().default(() => uuidv713()),
|
|
3946
|
+
sections: z67.union([z67.array(z67.lazy(() => CABSection)), z67.strictObject({}).transform(() => [])]).default(() => []),
|
|
3947
|
+
sectionType: z67.literal(SectionType.layout).default(SectionType.layout),
|
|
3948
|
+
spacing: z67.enum(spacings).default(Spacing.base),
|
|
3908
3949
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
3909
|
-
viewUrl:
|
|
3910
|
-
width:
|
|
3950
|
+
viewUrl: z67.string().optional(),
|
|
3951
|
+
width: z67.number().default(100),
|
|
3911
3952
|
wrapping: CABLayoutWrapping.optional()
|
|
3912
3953
|
});
|
|
3913
3954
|
|
|
@@ -3929,8 +3970,8 @@ var UI_LABELS = {
|
|
|
3929
3970
|
};
|
|
3930
3971
|
|
|
3931
3972
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
3932
|
-
var localized = (fallback) =>
|
|
3933
|
-
var CABUILabels =
|
|
3973
|
+
var localized = (fallback) => z68.record(z68.string(), z68.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
3974
|
+
var CABUILabels = z68.object({
|
|
3934
3975
|
currentPage: localized(UI_LABELS.currentPage),
|
|
3935
3976
|
guest: localized(UI_LABELS.guest),
|
|
3936
3977
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -3955,49 +3996,49 @@ var CABUILabels = z66.object({
|
|
|
3955
3996
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
3956
3997
|
updating: { ...UI_LABELS.updating }
|
|
3957
3998
|
}));
|
|
3958
|
-
var TargetArea =
|
|
3959
|
-
fill:
|
|
3960
|
-
flip:
|
|
3961
|
-
icon:
|
|
3962
|
-
label:
|
|
3963
|
-
width:
|
|
3999
|
+
var TargetArea = z68.object({
|
|
4000
|
+
fill: z68.boolean().optional(),
|
|
4001
|
+
flip: z68.enum(["both", "horizontal", "vertical"]).optional(),
|
|
4002
|
+
icon: z68.string(),
|
|
4003
|
+
label: z68.string(),
|
|
4004
|
+
width: z68.string()
|
|
3964
4005
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
3965
|
-
var CABTracking =
|
|
3966
|
-
enableAttribution:
|
|
3967
|
-
enableSource:
|
|
3968
|
-
enableWidget:
|
|
4006
|
+
var CABTracking = z68.object({
|
|
4007
|
+
enableAttribution: z68.boolean().nullish().transform((value) => value ?? true),
|
|
4008
|
+
enableSource: z68.boolean().nullish().transform((value) => value ?? true),
|
|
4009
|
+
enableWidget: z68.boolean().nullish().transform((value) => value ?? true)
|
|
3969
4010
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
3970
|
-
var CABExperiment =
|
|
3971
|
-
elementId:
|
|
3972
|
-
experimentId:
|
|
3973
|
-
experimentType:
|
|
3974
|
-
selectedId:
|
|
4011
|
+
var CABExperiment = z68.object({
|
|
4012
|
+
elementId: z68.number(),
|
|
4013
|
+
experimentId: z68.number(),
|
|
4014
|
+
experimentType: z68.string(),
|
|
4015
|
+
selectedId: z68.number()
|
|
3975
4016
|
});
|
|
3976
4017
|
var CABRootSection = CABLayoutSection.extend({
|
|
3977
|
-
editorMode:
|
|
4018
|
+
editorMode: z68.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
3978
4019
|
experiment: CABExperiment.optional(),
|
|
3979
4020
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
3980
4021
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
3981
|
-
previewMode:
|
|
3982
|
-
storeId:
|
|
4022
|
+
previewMode: z68.boolean().nullish().transform((value) => value ?? false),
|
|
4023
|
+
storeId: z68.number().nullable().default(null),
|
|
3983
4024
|
targetArea: TargetArea.nullable(),
|
|
3984
4025
|
tracking: CABTracking,
|
|
3985
|
-
type:
|
|
4026
|
+
type: z68.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
3986
4027
|
uiLabels: CABUILabels,
|
|
3987
|
-
version:
|
|
3988
|
-
widgetId:
|
|
4028
|
+
version: z68.literal(2).default(2),
|
|
4029
|
+
widgetId: z68.number().nullable().default(null)
|
|
3989
4030
|
});
|
|
3990
4031
|
|
|
3991
4032
|
// src/schema/postPurchaseProductView.ts
|
|
3992
|
-
var PostPurchaseProductView =
|
|
3993
|
-
|
|
4033
|
+
var PostPurchaseProductView = z69.union([
|
|
4034
|
+
z69.object({
|
|
3994
4035
|
changeset: PostPurchaseProductChangeset.optional(),
|
|
3995
4036
|
displayPrice: PostPurchaseDisplayPrice.optional(),
|
|
3996
4037
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
3997
4038
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
3998
4039
|
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
3999
4040
|
preparation: PreparedPostPurchaseProduct.extend({
|
|
4000
|
-
display: PreparedPostPurchaseProduct.shape.display.extend({ description:
|
|
4041
|
+
display: PreparedPostPurchaseProduct.shape.display.extend({ description: z69.string().nullable() }).refine(
|
|
4001
4042
|
({ description, descriptionDocument }) => description === null === (descriptionDocument !== void 0),
|
|
4002
4043
|
"Exactly one of the plain and rich descriptions is shown"
|
|
4003
4044
|
)
|
|
@@ -4006,7 +4047,7 @@ var PostPurchaseProductView = z67.union([
|
|
|
4006
4047
|
sections: CABRootSection,
|
|
4007
4048
|
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
4008
4049
|
}),
|
|
4009
|
-
|
|
4050
|
+
z69.object({
|
|
4010
4051
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
4011
4052
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
4012
4053
|
/** The localized unavailable copy, for the choices still offered beneath an unprepared product. */
|
|
@@ -4021,21 +4062,21 @@ var PostPurchaseProductView = z67.union([
|
|
|
4021
4062
|
]);
|
|
4022
4063
|
|
|
4023
4064
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
4024
|
-
var PostPurchaseProductCollectionView =
|
|
4025
|
-
members:
|
|
4026
|
-
|
|
4065
|
+
var PostPurchaseProductCollectionView = z70.object({
|
|
4066
|
+
members: z70.array(
|
|
4067
|
+
z70.object({
|
|
4027
4068
|
productId: PostPurchaseProductId,
|
|
4028
|
-
productIndex:
|
|
4069
|
+
productIndex: z70.number().int().nonnegative(),
|
|
4029
4070
|
view: PostPurchaseProductView
|
|
4030
4071
|
})
|
|
4031
4072
|
)
|
|
4032
4073
|
});
|
|
4033
|
-
var PostPurchaseCollectionChoice =
|
|
4074
|
+
var PostPurchaseCollectionChoice = z70.object({
|
|
4034
4075
|
choice: PostPurchaseChoice.optional(),
|
|
4035
4076
|
productId: PostPurchaseProductId,
|
|
4036
4077
|
variantId: PostPurchaseVariantSelector.shape.variantId.optional()
|
|
4037
4078
|
}).strict();
|
|
4038
|
-
var PostPurchaseExcludedProductIds =
|
|
4079
|
+
var PostPurchaseExcludedProductIds = z70.array(PostPurchaseProductId).default([]);
|
|
4039
4080
|
var PostPurchaseMemberSelector = PostPurchaseProgressSchema.shape.members.element.pick({ productId: true }).extend({ progressRevision: PostPurchaseProgressSchema.shape.revision });
|
|
4040
4081
|
var PostPurchaseMemberPointer = PostPurchaseProgressSchema.shape.members.element.omit({ status: true }).extend({
|
|
4041
4082
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
@@ -4048,7 +4089,7 @@ var PostPurchaseQuantityChoice = PostPurchaseCollectionChoice.extend({ quantity:
|
|
|
4048
4089
|
var PostPurchaseQuantityPolicy = PostPurchaseSettings.shape.quantityInputs.omit({ defaultQuantity: true }).extend({
|
|
4049
4090
|
initialQuantity: quantity,
|
|
4050
4091
|
maxValue: quantity,
|
|
4051
|
-
minValue:
|
|
4092
|
+
minValue: z71.literal(0).transform(() => 1).or(quantity)
|
|
4052
4093
|
}).refine(({ maxValue, minValue }) => minValue <= maxValue, "Quantity bounds are reversed");
|
|
4053
4094
|
|
|
4054
4095
|
// src/schema/postPurchaseGroup.ts
|
|
@@ -4057,33 +4098,33 @@ var PostPurchaseGroupChoice = PostPurchaseQuantityChoice.extend({
|
|
|
4057
4098
|
});
|
|
4058
4099
|
|
|
4059
4100
|
// src/schema/postPurchaseHealth.ts
|
|
4060
|
-
import { z as
|
|
4101
|
+
import { z as z74 } from "zod";
|
|
4061
4102
|
|
|
4062
4103
|
// src/schema/postPurchaseHealthSchedule.ts
|
|
4063
|
-
import { z as
|
|
4104
|
+
import { z as z73 } from "zod";
|
|
4064
4105
|
|
|
4065
4106
|
// src/schema/postPurchaseReleaseSchedule.ts
|
|
4066
|
-
import { z as
|
|
4067
|
-
var postPurchaseTaskNameSchema = (queue, id) =>
|
|
4068
|
-
var SessionReleaseScheduleRequestSchema =
|
|
4107
|
+
import { z as z72 } from "zod";
|
|
4108
|
+
var postPurchaseTaskNameSchema = (queue, id) => z72.string().regex(new RegExp(`^projects/[a-zA-Z0-9.:-]+/locations/us-central1/queues/${queue}/tasks/${id}$`));
|
|
4109
|
+
var SessionReleaseScheduleRequestSchema = z72.strictObject({
|
|
4069
4110
|
deadline: PostPurchaseTimestampSchema,
|
|
4070
4111
|
orderId: PostPurchaseOrderIdSchema,
|
|
4071
4112
|
releaseOwner: ReleaseOwnerSchema,
|
|
4072
4113
|
sessionId: PostPurchaseSessionIdSchema
|
|
4073
4114
|
});
|
|
4074
|
-
var SessionReleaseScheduleResponseSchema =
|
|
4075
|
-
data:
|
|
4115
|
+
var SessionReleaseScheduleResponseSchema = z72.object({
|
|
4116
|
+
data: z72.discriminatedUnion("status", [
|
|
4076
4117
|
SessionReleaseScheduleRequestSchema.extend({
|
|
4077
|
-
releaseOwner:
|
|
4078
|
-
status:
|
|
4118
|
+
releaseOwner: z72.literal("rebuy"),
|
|
4119
|
+
status: z72.literal("queued"),
|
|
4079
4120
|
taskName: postPurchaseTaskNameSchema("post-purchase-order-hold-release", "[a-f0-9]{64}-release")
|
|
4080
4121
|
}),
|
|
4081
4122
|
SessionReleaseScheduleRequestSchema.extend({
|
|
4082
|
-
releaseOwner:
|
|
4083
|
-
status:
|
|
4123
|
+
releaseOwner: z72.literal("shopify"),
|
|
4124
|
+
status: z72.literal("native")
|
|
4084
4125
|
})
|
|
4085
4126
|
]),
|
|
4086
|
-
successful:
|
|
4127
|
+
successful: z72.literal(true)
|
|
4087
4128
|
});
|
|
4088
4129
|
|
|
4089
4130
|
// src/schema/postPurchaseHealthSchedule.ts
|
|
@@ -4092,15 +4133,15 @@ var PostPurchaseHealthTaskNameSchema = postPurchaseTaskNameSchema(
|
|
|
4092
4133
|
"post-purchase-health-check",
|
|
4093
4134
|
"[a-z0-9][a-z0-9-]*--[1-9][0-9]*"
|
|
4094
4135
|
);
|
|
4095
|
-
var HealthScheduleAcknowledgementSchema =
|
|
4136
|
+
var HealthScheduleAcknowledgementSchema = z73.strictObject({
|
|
4096
4137
|
data: HealthScheduleSchema.extend({
|
|
4097
|
-
status:
|
|
4138
|
+
status: z73.literal("queued"),
|
|
4098
4139
|
taskName: PostPurchaseHealthTaskNameSchema
|
|
4099
4140
|
}).refine(
|
|
4100
4141
|
(data) => data.taskName.endsWith(`/tasks/${postPurchaseHealthTaskId(data)}`),
|
|
4101
4142
|
"taskName must be this order's health task"
|
|
4102
4143
|
),
|
|
4103
|
-
successful:
|
|
4144
|
+
successful: z73.literal(true)
|
|
4104
4145
|
});
|
|
4105
4146
|
|
|
4106
4147
|
// src/schema/postPurchaseHealth.ts
|
|
@@ -4109,7 +4150,7 @@ var HealthFactSchema = HealthScheduleSchema.pick({
|
|
|
4109
4150
|
operationId: true,
|
|
4110
4151
|
removePartialOrder: true
|
|
4111
4152
|
});
|
|
4112
|
-
var HealthScheduleReceiptSchema =
|
|
4153
|
+
var HealthScheduleReceiptSchema = z74.strictObject({
|
|
4113
4154
|
recordedAt: PostPurchaseTimestampSchema,
|
|
4114
4155
|
taskName: PostPurchaseHealthTaskNameSchema
|
|
4115
4156
|
});
|
|
@@ -4119,150 +4160,138 @@ var StoredHealthFactSchema = HealthFactSchema.extend({
|
|
|
4119
4160
|
});
|
|
4120
4161
|
var HealthAttemptSchema = StoredHealthFactSchema.extend({
|
|
4121
4162
|
attemptedAt: PostPurchaseTimestampSchema,
|
|
4122
|
-
attemptId:
|
|
4123
|
-
status:
|
|
4163
|
+
attemptId: z74.uuid(),
|
|
4164
|
+
status: z74.literal("attempted")
|
|
4124
4165
|
});
|
|
4125
4166
|
var HealthResultSchema = HealthAttemptSchema.extend({
|
|
4126
4167
|
finishedAt: PostPurchaseTimestampSchema,
|
|
4127
|
-
status:
|
|
4168
|
+
status: z74.enum(["returned", "unknown"])
|
|
4128
4169
|
});
|
|
4129
|
-
var HealthStateSchema =
|
|
4130
|
-
StoredHealthFactSchema.extend({ status:
|
|
4170
|
+
var HealthStateSchema = z74.union([
|
|
4171
|
+
StoredHealthFactSchema.extend({ status: z74.literal("pending") }),
|
|
4131
4172
|
HealthAttemptSchema,
|
|
4132
4173
|
HealthResultSchema
|
|
4133
4174
|
]);
|
|
4134
4175
|
var HealthPrepareRequestSchema = DecideRequestSchema.extend({
|
|
4135
4176
|
operationId: HealthScheduleSchema.shape.operationId
|
|
4136
4177
|
}).strict();
|
|
4137
|
-
var HealthPrepareResponseSchema =
|
|
4138
|
-
var HealthClaimRequestSchema =
|
|
4178
|
+
var HealthPrepareResponseSchema = z74.object({ data: HealthScheduleSchema, successful: z74.literal(true) });
|
|
4179
|
+
var HealthClaimRequestSchema = z74.strictObject({
|
|
4139
4180
|
orderId: PostPurchaseOrderIdSchema,
|
|
4140
|
-
removePartialOrder:
|
|
4181
|
+
removePartialOrder: z74.boolean(),
|
|
4141
4182
|
shop: ShopifyDomainSchema
|
|
4142
4183
|
});
|
|
4143
4184
|
var HealthClaimFactSchema = HealthClaimRequestSchema.extend({
|
|
4144
4185
|
healthScheduledAt: HealthFactSchema.shape.healthScheduledAt
|
|
4145
4186
|
});
|
|
4146
|
-
var HealthClaimResponseSchema =
|
|
4147
|
-
data:
|
|
4148
|
-
|
|
4149
|
-
HealthClaimFactSchema.extend({ status:
|
|
4150
|
-
HealthClaimFactSchema.extend({ attemptId: HealthAttemptSchema.shape.attemptId, status:
|
|
4187
|
+
var HealthClaimResponseSchema = z74.object({
|
|
4188
|
+
data: z74.union([
|
|
4189
|
+
z74.strictObject({ status: z74.literal("missing") }),
|
|
4190
|
+
HealthClaimFactSchema.extend({ status: z74.enum(["pending", "attempted", "returned", "unknown"]) }),
|
|
4191
|
+
HealthClaimFactSchema.extend({ attemptId: HealthAttemptSchema.shape.attemptId, status: z74.literal("claimed") })
|
|
4151
4192
|
]),
|
|
4152
|
-
successful:
|
|
4193
|
+
successful: z74.literal(true)
|
|
4153
4194
|
});
|
|
4154
4195
|
var HealthResultRequestSchema = HealthClaimRequestSchema.extend({
|
|
4155
4196
|
attemptId: HealthAttemptSchema.shape.attemptId,
|
|
4156
4197
|
outcome: HealthResultSchema.shape.status
|
|
4157
4198
|
});
|
|
4158
|
-
var HealthResultResponseSchema =
|
|
4199
|
+
var HealthResultResponseSchema = z74.object({
|
|
4159
4200
|
data: HealthClaimFactSchema.extend({
|
|
4160
4201
|
finishedAt: HealthResultSchema.shape.finishedAt,
|
|
4161
4202
|
status: HealthResultSchema.shape.status
|
|
4162
4203
|
}),
|
|
4163
|
-
successful:
|
|
4204
|
+
successful: z74.literal(true)
|
|
4164
4205
|
});
|
|
4165
4206
|
|
|
4166
4207
|
// src/schema/postPurchaseLifecycle.ts
|
|
4167
|
-
import { z as
|
|
4168
|
-
var Presentation =
|
|
4208
|
+
import { z as z75 } from "zod";
|
|
4209
|
+
var Presentation = z75.strictObject({
|
|
4169
4210
|
member: PostPurchaseMemberIdentity,
|
|
4170
4211
|
selectedProductId: PostPurchaseMemberIdentity.shape.productId.optional(),
|
|
4171
4212
|
variant: PostPurchaseVariantSelector
|
|
4172
4213
|
});
|
|
4173
4214
|
var LifecycleObservationRequestSchema = DecideRequestSchema.extend({
|
|
4174
4215
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
4175
|
-
eventType:
|
|
4216
|
+
eventType: z75.enum(["OFFER_VIEWED", "OFFER_TIMER_EXPIRED"]),
|
|
4176
4217
|
presentation: Presentation.nullable(),
|
|
4177
4218
|
progressRevision: PostPurchaseProgressSchema.shape.revision,
|
|
4178
|
-
requestId:
|
|
4219
|
+
requestId: z75.uuid()
|
|
4179
4220
|
}).strict().refine(
|
|
4180
4221
|
({ eventType, presentation }) => eventType !== "OFFER_VIEWED" || presentation !== null,
|
|
4181
4222
|
"Viewed observations require a presented product"
|
|
4182
4223
|
);
|
|
4183
|
-
var LifecycleObservationResponseSchema =
|
|
4184
|
-
data:
|
|
4224
|
+
var LifecycleObservationResponseSchema = z75.object({
|
|
4225
|
+
data: z75.strictObject({
|
|
4185
4226
|
requestId: LifecycleObservationRequestSchema.shape.requestId,
|
|
4186
|
-
status:
|
|
4227
|
+
status: z75.union([AcceptedEventOutcomeSchema, z75.literal("unavailable")])
|
|
4187
4228
|
}),
|
|
4188
|
-
successful:
|
|
4229
|
+
successful: z75.literal(true)
|
|
4189
4230
|
});
|
|
4190
4231
|
|
|
4191
4232
|
// 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
|
|
4233
|
+
import { z as z76 } from "zod";
|
|
4205
4234
|
var OfferPreparationRequestSchema = DecideRequestSchema.strict();
|
|
4206
|
-
var OfferPreparationResponseSchema =
|
|
4207
|
-
data:
|
|
4208
|
-
successful:
|
|
4235
|
+
var OfferPreparationResponseSchema = z76.object({
|
|
4236
|
+
data: z76.object({ attemptedSkips: PostPurchaseSkipTraceSchema.optional(), progress: PostPurchaseProgressSchema }),
|
|
4237
|
+
successful: z76.literal(true)
|
|
4209
4238
|
});
|
|
4210
4239
|
|
|
4211
4240
|
// src/schema/postPurchaseOfferEligibility.ts
|
|
4212
|
-
import { z as
|
|
4241
|
+
import { z as z77 } from "zod";
|
|
4213
4242
|
var selection2 = PreparedPostPurchaseProduct.shape.selection;
|
|
4214
|
-
var PostPurchaseOfferSkipReason =
|
|
4215
|
-
var PostPurchaseOfferEligibilityContext =
|
|
4243
|
+
var PostPurchaseOfferSkipReason = z77.enum(["empty", "no-eligible-subscription"]);
|
|
4244
|
+
var PostPurchaseOfferEligibilityContext = z77.object({
|
|
4216
4245
|
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
4217
|
-
originalLineItems:
|
|
4246
|
+
originalLineItems: z77.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
4218
4247
|
});
|
|
4219
|
-
var PostPurchaseOfferEligibility =
|
|
4220
|
-
|
|
4221
|
-
members:
|
|
4222
|
-
|
|
4248
|
+
var PostPurchaseOfferEligibility = z77.discriminatedUnion("status", [
|
|
4249
|
+
z77.object({
|
|
4250
|
+
members: z77.array(
|
|
4251
|
+
z77.object({ productId: selection2.shape.productId, productIndex: z77.number().int().nonnegative() })
|
|
4223
4252
|
),
|
|
4224
|
-
status:
|
|
4253
|
+
status: z77.literal("retain")
|
|
4225
4254
|
}),
|
|
4226
|
-
|
|
4227
|
-
|
|
4255
|
+
z77.object({ reason: PostPurchaseOfferSkipReason, status: z77.literal("skip") }),
|
|
4256
|
+
z77.object({ reason: z77.literal("eligible-upgrade").optional(), status: z77.literal("unavailable") })
|
|
4228
4257
|
]);
|
|
4229
4258
|
|
|
4230
4259
|
// src/schema/postPurchaseOfferPresentation.ts
|
|
4231
|
-
import { z as
|
|
4260
|
+
import { z as z78 } from "zod";
|
|
4232
4261
|
var language2 = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap();
|
|
4233
|
-
var PostPurchaseOfferPresentation =
|
|
4262
|
+
var PostPurchaseOfferPresentation = z78.strictObject({
|
|
4234
4263
|
labels: language2.pick({ declineAll: true, declineThisOffer: true }),
|
|
4235
4264
|
layout: PostPurchaseSettings.shape.offersLayout,
|
|
4236
4265
|
sections: CABRootSection.nullable(),
|
|
4237
4266
|
showDeclineAll: PostPurchaseSettings.shape.productOptions.shape.showDeclineAll
|
|
4238
4267
|
});
|
|
4239
4268
|
var OfferPresentationRequestSchema = DecideRequestSchema.strict();
|
|
4240
|
-
var OfferPresentationResponseSchema =
|
|
4241
|
-
data:
|
|
4269
|
+
var OfferPresentationResponseSchema = z78.object({
|
|
4270
|
+
data: z78.strictObject({
|
|
4242
4271
|
presentation: PostPurchaseOfferPresentation.nullable(),
|
|
4243
4272
|
progress: PostPurchaseProgressSchema.nullable(),
|
|
4244
4273
|
serverNow: PostPurchaseTimestampSchema
|
|
4245
4274
|
}),
|
|
4246
|
-
successful:
|
|
4275
|
+
successful: z78.literal(true)
|
|
4247
4276
|
});
|
|
4248
4277
|
|
|
4249
4278
|
// src/schema/postPurchaseOrderDecision.ts
|
|
4250
|
-
import { z as
|
|
4251
|
-
var OrderDecisionSchema =
|
|
4252
|
-
|
|
4253
|
-
|
|
4279
|
+
import { z as z79 } from "zod";
|
|
4280
|
+
var OrderDecisionSchema = z79.discriminatedUnion("owner", [
|
|
4281
|
+
z79.object({ owner: z79.literal("session"), sessionId: PostPurchaseSessionIdSchema }),
|
|
4282
|
+
z79.object({ owner: z79.literal("release"), sessionId: z79.null() })
|
|
4254
4283
|
]);
|
|
4255
4284
|
|
|
4256
4285
|
// src/schema/postPurchasePolicy.ts
|
|
4257
|
-
import { z as
|
|
4258
|
-
var HoldSettingSchema =
|
|
4259
|
-
|
|
4260
|
-
|
|
4286
|
+
import { z as z80 } from "zod";
|
|
4287
|
+
var HoldSettingSchema = z80.discriminatedUnion("enabled", [
|
|
4288
|
+
z80.object({ durationMinutes: z80.number().int().min(1).max(60), enabled: z80.literal(true) }),
|
|
4289
|
+
z80.object({ durationMinutes: z80.null(), enabled: z80.literal(false) })
|
|
4261
4290
|
]);
|
|
4262
|
-
var TimingSettingsSchema =
|
|
4291
|
+
var TimingSettingsSchema = z80.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
4263
4292
|
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
4264
|
-
durationMinutes:
|
|
4265
|
-
source:
|
|
4293
|
+
durationMinutes: z80.number().int().min(1).max(60).nullable(),
|
|
4294
|
+
source: z80.enum(["shop", "flow", "native"])
|
|
4266
4295
|
}).refine(
|
|
4267
4296
|
(policy) => {
|
|
4268
4297
|
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
@@ -4276,8 +4305,8 @@ var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
|
4276
4305
|
);
|
|
4277
4306
|
|
|
4278
4307
|
// src/schema/postPurchasePreparationOptions.ts
|
|
4279
|
-
import { z as
|
|
4280
|
-
var PostPurchasePreparationOptions =
|
|
4308
|
+
import { z as z81 } from "zod";
|
|
4309
|
+
var PostPurchasePreparationOptions = z81.object({
|
|
4281
4310
|
choice: PostPurchaseChoice.optional(),
|
|
4282
4311
|
member: PostPurchaseMemberSelector.strict().optional(),
|
|
4283
4312
|
quantity: PreparedPostPurchaseProduct.shape.selection.shape.quantity.optional(),
|
|
@@ -4289,8 +4318,8 @@ var PostPurchasePreparationOptions = z80.object({
|
|
|
4289
4318
|
);
|
|
4290
4319
|
|
|
4291
4320
|
// src/schema/postPurchaseProductSettings.ts
|
|
4292
|
-
import { z as
|
|
4293
|
-
var amount =
|
|
4321
|
+
import { z as z82 } from "zod";
|
|
4322
|
+
var amount = z82.union([z82.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
4294
4323
|
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
4295
4324
|
discountedFrom: true,
|
|
4296
4325
|
language: true,
|
|
@@ -4302,22 +4331,22 @@ var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
|
4302
4331
|
subscriptionIsDefault: true,
|
|
4303
4332
|
upgradeToSubscription: true
|
|
4304
4333
|
}).extend({
|
|
4305
|
-
advance:
|
|
4306
|
-
blocks:
|
|
4334
|
+
advance: z82.unknown().default({}),
|
|
4335
|
+
blocks: z82.array(z82.unknown()).optional(),
|
|
4307
4336
|
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
4308
|
-
integrations:
|
|
4337
|
+
integrations: z82.unknown().default({}),
|
|
4309
4338
|
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
4310
|
-
styles:
|
|
4339
|
+
styles: z82.unknown().default({}),
|
|
4311
4340
|
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
4312
|
-
subscription:
|
|
4341
|
+
subscription: z82.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
4313
4342
|
});
|
|
4314
4343
|
|
|
4315
4344
|
// src/schema/postPurchaseRecovery.ts
|
|
4316
|
-
import { z as
|
|
4345
|
+
import { z as z83 } from "zod";
|
|
4317
4346
|
var PurchaseRecoveryRequestSchema = DecideRequestSchema.strict();
|
|
4318
|
-
var PurchaseRecoveryResponseSchema =
|
|
4319
|
-
data:
|
|
4320
|
-
operation:
|
|
4347
|
+
var PurchaseRecoveryResponseSchema = z83.object({
|
|
4348
|
+
data: z83.object({
|
|
4349
|
+
operation: z83.object({
|
|
4321
4350
|
observation: RecordedPurchaseObservationSchema.nullable(),
|
|
4322
4351
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
4323
4352
|
upgrade: UpgradeProgressSchema.optional()
|
|
@@ -4327,41 +4356,41 @@ var PurchaseRecoveryResponseSchema = z82.object({
|
|
|
4327
4356
|
}).nullable(),
|
|
4328
4357
|
progress: PostPurchaseProgressSchema.nullable().optional()
|
|
4329
4358
|
}),
|
|
4330
|
-
successful:
|
|
4359
|
+
successful: z83.literal(true)
|
|
4331
4360
|
});
|
|
4332
4361
|
|
|
4333
4362
|
// src/schema/postPurchaseReleaseClaim.ts
|
|
4334
|
-
import { z as
|
|
4363
|
+
import { z as z84 } from "zod";
|
|
4335
4364
|
var ReleaseClaimRequestSchema = ReleaseAuthorityRequestSchema;
|
|
4336
|
-
var ReleaseClaimResponseSchema =
|
|
4337
|
-
data:
|
|
4338
|
-
|
|
4365
|
+
var ReleaseClaimResponseSchema = z84.object({
|
|
4366
|
+
data: z84.discriminatedUnion("status", [
|
|
4367
|
+
z84.object({ status: z84.literal("release-permitted") }),
|
|
4339
4368
|
PendingReleaseAuthoritySchema,
|
|
4340
4369
|
ReadyReleaseAuthoritySchema
|
|
4341
4370
|
]),
|
|
4342
|
-
successful:
|
|
4371
|
+
successful: z84.literal(true)
|
|
4343
4372
|
});
|
|
4344
4373
|
|
|
4345
4374
|
// src/schema/postPurchaseSelection.ts
|
|
4346
|
-
import { z as
|
|
4375
|
+
import { z as z85 } from "zod";
|
|
4347
4376
|
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
4348
4377
|
appId: PostPurchaseAppIdSchema,
|
|
4349
4378
|
entry: DecisionEntrySchema,
|
|
4350
|
-
iss:
|
|
4351
|
-
purpose:
|
|
4379
|
+
iss: z85.literal("rebuy-api"),
|
|
4380
|
+
purpose: z85.literal("post-purchase-selection")
|
|
4352
4381
|
});
|
|
4353
4382
|
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
4354
|
-
selectionToken:
|
|
4383
|
+
selectionToken: z85.string().min(1).max(8192).optional()
|
|
4355
4384
|
}).strict();
|
|
4356
4385
|
|
|
4357
4386
|
// src/schema/postPurchaseSession.ts
|
|
4358
|
-
import { z as
|
|
4387
|
+
import { z as z86 } from "zod";
|
|
4359
4388
|
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
4360
|
-
var SessionOrderTimingSchema =
|
|
4389
|
+
var SessionOrderTimingSchema = z86.object({
|
|
4361
4390
|
nativeDeadline: PostPurchaseTimestampSchema,
|
|
4362
4391
|
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
4363
4392
|
orderId: PostPurchaseOrderIdSchema,
|
|
4364
|
-
timingSource:
|
|
4393
|
+
timingSource: z86.literal("shopify-order-created-at")
|
|
4365
4394
|
});
|
|
4366
4395
|
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
4367
4396
|
deadline: PostPurchaseTimestampSchema,
|
|
@@ -4378,33 +4407,33 @@ var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
|
4378
4407
|
message: "deadline must not exceed nativeDeadline",
|
|
4379
4408
|
path: ["deadline"]
|
|
4380
4409
|
});
|
|
4381
|
-
var SessionStartResponseSchema =
|
|
4382
|
-
data:
|
|
4383
|
-
phase:
|
|
4410
|
+
var SessionStartResponseSchema = z86.object({
|
|
4411
|
+
data: z86.object({
|
|
4412
|
+
phase: z86.literal("render"),
|
|
4384
4413
|
serverNow: PostPurchaseTimestampSchema,
|
|
4385
4414
|
session: ReadySessionTimingSchema,
|
|
4386
|
-
workflowPhase:
|
|
4415
|
+
workflowPhase: z86.literal("start")
|
|
4387
4416
|
}),
|
|
4388
|
-
successful:
|
|
4417
|
+
successful: z86.literal(true)
|
|
4389
4418
|
});
|
|
4390
4419
|
|
|
4391
4420
|
// src/schema/postPurchaseShadow.ts
|
|
4392
|
-
import { z as
|
|
4393
|
-
var PostPurchaseShadowSelectionSchema =
|
|
4394
|
-
|
|
4395
|
-
|
|
4421
|
+
import { z as z87 } from "zod";
|
|
4422
|
+
var PostPurchaseShadowSelectionSchema = z87.discriminatedUnion("verdict", [
|
|
4423
|
+
z87.object({ entry: DecisionEntrySchema, verdict: z87.literal("render") }),
|
|
4424
|
+
z87.object({ verdict: z87.literal("skip") })
|
|
4396
4425
|
]);
|
|
4397
|
-
var PostPurchaseShadowReportFields =
|
|
4398
|
-
differences:
|
|
4426
|
+
var PostPurchaseShadowReportFields = z87.object({
|
|
4427
|
+
differences: z87.array(z87.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
4399
4428
|
message: "differences must not contain duplicate entries"
|
|
4400
4429
|
}),
|
|
4401
4430
|
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
4402
|
-
phase:
|
|
4403
|
-
sampleId:
|
|
4431
|
+
phase: z87.literal("shouldRender"),
|
|
4432
|
+
sampleId: z87.string(),
|
|
4404
4433
|
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
4405
|
-
status:
|
|
4406
|
-
targetingFlowIds:
|
|
4407
|
-
workflowPhase:
|
|
4434
|
+
status: z87.enum(["match", "diverged", "incomplete"]),
|
|
4435
|
+
targetingFlowIds: z87.array(z87.number().int().positive()),
|
|
4436
|
+
workflowPhase: z87.literal("decide")
|
|
4408
4437
|
});
|
|
4409
4438
|
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
4410
4439
|
(report) => report.status !== "match" || report.differences.length === 0,
|
|
@@ -4418,9 +4447,9 @@ var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
|
4418
4447
|
});
|
|
4419
4448
|
|
|
4420
4449
|
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
4421
|
-
import { z as
|
|
4450
|
+
import { z as z88 } from "zod";
|
|
4422
4451
|
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
4423
|
-
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId:
|
|
4452
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: z88.number().int().positive() }),
|
|
4424
4453
|
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
4425
4454
|
subscription: PostPurchaseSubscriptionTerms
|
|
4426
4455
|
}).refine(
|
|
@@ -4432,28 +4461,6 @@ var readPostPurchaseSubscription = (prepared) => {
|
|
|
4432
4461
|
return PreparedPostPurchaseSubscription.parse(prepared);
|
|
4433
4462
|
};
|
|
4434
4463
|
|
|
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
4464
|
// src/schema/postPurchaseVariantDefault.ts
|
|
4458
4465
|
import { z as z89 } from "zod";
|
|
4459
4466
|
var values = PostPurchaseVariantValues.partial().extend({
|
|
@@ -6631,6 +6638,7 @@ export {
|
|
|
6631
6638
|
PostPurchaseDisplayPrice,
|
|
6632
6639
|
PostPurchaseEndReasonSchema,
|
|
6633
6640
|
PostPurchaseExcludedProductIds,
|
|
6641
|
+
PostPurchaseFinishReasonSchema,
|
|
6634
6642
|
PostPurchaseGroupCatalog,
|
|
6635
6643
|
PostPurchaseGroupChoice,
|
|
6636
6644
|
PostPurchaseGroupDescription,
|