@rebuy/rebuy 3.5.1 → 3.7.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 +762 -648
- package/dist/index.mjs +762 -648
- package/dist/schema/checkout-and-beyond/constants.cjs +16 -0
- package/dist/schema/checkout-and-beyond/constants.mjs +16 -0
- package/dist/schema/checkout-and-beyond/index.cjs +454 -362
- package/dist/schema/checkout-and-beyond/index.mjs +454 -362
- package/dist/schema/metadata.d.ts +3 -1
- package/dist/schema/widget-data.cjs +508 -435
- package/dist/schema/widget-data.mjs +508 -435
- package/dist/schema/widgetData.d.ts +438 -147
- package/dist/schema/widgets/checkout-and-beyond/banner.d.ts +145 -48
- package/dist/schema/widgets/checkout-and-beyond/button.d.ts +154 -49
- package/dist/schema/widgets/checkout-and-beyond/carousel.d.ts +145 -48
- package/dist/schema/widgets/checkout-and-beyond/cartLine.d.ts +145 -48
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts +29 -0
- package/dist/schema/widgets/checkout-and-beyond/discount.d.ts +146 -0
- package/dist/schema/widgets/checkout-and-beyond/icons.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/image.d.ts +294 -100
- package/dist/schema/widgets/checkout-and-beyond/index.d.ts +1 -0
- package/dist/schema/widgets/checkout-and-beyond/layout.d.ts +148 -52
- package/dist/schema/widgets/checkout-and-beyond/monetize.d.ts +146 -49
- package/dist/schema/widgets/checkout-and-beyond/offers.d.ts +145 -48
- package/dist/schema/widgets/checkout-and-beyond/product.d.ts +146 -0
- package/dist/schema/widgets/checkout-and-beyond/products.d.ts +292 -0
- package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts +145 -48
- package/dist/schema/widgets/checkout-and-beyond/quantity.d.ts +146 -49
- package/dist/schema/widgets/checkout-and-beyond/reviews.d.ts +146 -49
- package/dist/schema/widgets/checkout-and-beyond/root.d.ts +146 -49
- package/dist/schema/widgets/checkout-and-beyond/rule.d.ts +140 -68
- package/dist/schema/widgets/checkout-and-beyond/text.d.ts +146 -49
- package/dist/schema/widgets/checkout-and-beyond/variables.d.ts +470 -0
- package/dist/schema/widgets/checkout-and-beyond/variants.d.ts +146 -49
- package/dist/schema/widgets/contentBlock.d.ts +146 -49
- package/dist/schema/widgets/lineItemEditor.d.ts +146 -49
- package/dist/schema/widgets/rebuyButton.d.ts +146 -49
- package/dist/server/index.cjs +514 -417
- package/dist/server/index.mjs +514 -417
- package/dist/transforms/index.cjs +392 -317
- package/dist/transforms/index.mjs +392 -317
- package/dist/transforms/monetizeV1/convertMonetizeToV2.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
2
|
-
import { z as
|
|
2
|
+
import { z as z20 } from "zod";
|
|
3
3
|
|
|
4
4
|
// src/schema/widgets/checkout-and-beyond/common.ts
|
|
5
5
|
var freezeEnum = (values) => Object.freeze(Object.fromEntries(values.map((v) => [v, v])));
|
|
@@ -106,6 +106,8 @@ var languageKeys = [
|
|
|
106
106
|
"zh"
|
|
107
107
|
];
|
|
108
108
|
var LanguageKey = freezeEnum(languageKeys);
|
|
109
|
+
var mutatorEvents = ["item_added", "quantity_changed", "variant_selected"];
|
|
110
|
+
var MutatorEvent = freezeEnum(mutatorEvents);
|
|
109
111
|
var objectFits = ["cover", "contain"];
|
|
110
112
|
var ObjectFit = freezeEnum(objectFits);
|
|
111
113
|
var popoverPositions = ["inlineStart", "inlineEnd", "blockStart", "blockEnd"];
|
|
@@ -124,6 +126,10 @@ var progressTierUnits = ["currency", "item"];
|
|
|
124
126
|
var ProgressTierUnit = freezeEnum(progressTierUnits);
|
|
125
127
|
var quantityInputs = ["select", "number"];
|
|
126
128
|
var QuantityInput = freezeEnum(quantityInputs);
|
|
129
|
+
var resultCountOperators = ["equals", "greater_than", "less_than"];
|
|
130
|
+
var ResultCountOperator = freezeEnum(resultCountOperators);
|
|
131
|
+
var resultTagOperators = ["contains", "does_not_contain"];
|
|
132
|
+
var ResultTagOperator = freezeEnum(resultTagOperators);
|
|
127
133
|
var reviewsSizes = ["small", "default", "large"];
|
|
128
134
|
var ReviewsSize = freezeEnum(reviewsSizes);
|
|
129
135
|
var sectionTypes = [
|
|
@@ -156,6 +162,8 @@ var inlineTextSizeNames = ["extraSmall", "small", "base", "medium", "large", "ex
|
|
|
156
162
|
var InlineTextSizeName = freezeEnum(inlineTextSizeNames);
|
|
157
163
|
var textSizeNames = [...inlineTextSizeNames, "heading"];
|
|
158
164
|
var TextSizeName = freezeEnum(textSizeNames);
|
|
165
|
+
var variableEffects = ["set_false", "set_true", "toggle"];
|
|
166
|
+
var VariableEffect = freezeEnum(variableEffects);
|
|
159
167
|
var variantModes = ["multiple", "single"];
|
|
160
168
|
var VariantMode = freezeEnum(variantModes);
|
|
161
169
|
var variantSelectors = ["menu", "radio", "button"];
|
|
@@ -165,85 +173,18 @@ var VerticalAlignment = freezeEnum(verticalAlignments);
|
|
|
165
173
|
|
|
166
174
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
167
175
|
import { v7 as uuidv712 } from "uuid";
|
|
168
|
-
import { z as
|
|
169
|
-
|
|
170
|
-
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
171
|
-
import { z } from "zod";
|
|
172
|
-
var ruleTypes = [
|
|
173
|
-
"cart",
|
|
174
|
-
"cart_count",
|
|
175
|
-
"cart_item_count",
|
|
176
|
-
"cart_line_count",
|
|
177
|
-
"cart_subtotal",
|
|
178
|
-
"collection",
|
|
179
|
-
"customer",
|
|
180
|
-
"customer_order_count",
|
|
181
|
-
"customer_tag",
|
|
182
|
-
"customer_total_spent",
|
|
183
|
-
"date",
|
|
184
|
-
"product",
|
|
185
|
-
"product_tag",
|
|
186
|
-
"product_title",
|
|
187
|
-
"product_type",
|
|
188
|
-
"product_vendor"
|
|
189
|
-
];
|
|
190
|
-
var ruleType = z.enum(ruleTypes);
|
|
191
|
-
var RuleType = ruleType.enum;
|
|
192
|
-
var ruleOperators = [
|
|
193
|
-
"after",
|
|
194
|
-
"anything",
|
|
195
|
-
"before",
|
|
196
|
-
"contains",
|
|
197
|
-
"contains_any",
|
|
198
|
-
"does_not_contain",
|
|
199
|
-
"does_not_contain_any",
|
|
200
|
-
"equals",
|
|
201
|
-
"does_not_equal",
|
|
202
|
-
"greater_than",
|
|
203
|
-
"less_than"
|
|
204
|
-
];
|
|
205
|
-
var ruleOperator = z.enum(ruleOperators);
|
|
206
|
-
var RuleOperator = ruleOperator.enum;
|
|
207
|
-
var RuleCondition = z.object({
|
|
208
|
-
operator: z.enum(ruleOperators).default(RuleOperator.anything),
|
|
209
|
-
products: z.union([z.array(z.unknown()), z.strictObject({}).transform(() => [])]).default(() => []),
|
|
210
|
-
type: z.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
211
|
-
value: z.coerce.string().default("")
|
|
212
|
-
});
|
|
213
|
-
var RuleLogicBlock = z.object({
|
|
214
|
-
rules: z.array(RuleCondition).default(() => [])
|
|
215
|
-
});
|
|
216
|
-
var CABRule = z.object({
|
|
217
|
-
dataSourceId: z.number().nullable().default(null),
|
|
218
|
-
enabled: z.boolean().default(false),
|
|
219
|
-
ruleset: z.union([
|
|
220
|
-
z.array(
|
|
221
|
-
z.object({
|
|
222
|
-
exitIfMatched: z.boolean().default(true),
|
|
223
|
-
logic: z.array(RuleLogicBlock).default(() => []),
|
|
224
|
-
output: z.array(
|
|
225
|
-
z.object({
|
|
226
|
-
key: z.string().default("should_show"),
|
|
227
|
-
type: z.literal("data_json").default("data_json"),
|
|
228
|
-
value: z.string().default("true")
|
|
229
|
-
})
|
|
230
|
-
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
231
|
-
})
|
|
232
|
-
),
|
|
233
|
-
z.strictObject({}).transform(() => [])
|
|
234
|
-
]).default(() => [])
|
|
235
|
-
});
|
|
176
|
+
import { z as z19 } from "zod";
|
|
236
177
|
|
|
237
178
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
238
|
-
import { z as
|
|
179
|
+
import { z as z18 } from "zod";
|
|
239
180
|
|
|
240
181
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
241
182
|
import { v7 as uuidv73 } from "uuid";
|
|
242
|
-
import { z as
|
|
183
|
+
import { z as z5 } from "zod";
|
|
243
184
|
|
|
244
185
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
245
186
|
import { v7 as uuidv7 } from "uuid";
|
|
246
|
-
import { z as
|
|
187
|
+
import { z as z3 } from "zod";
|
|
247
188
|
|
|
248
189
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
249
190
|
var iconNames = [
|
|
@@ -403,17 +344,142 @@ var isReviewsType = isSectionType(SectionType.reviews);
|
|
|
403
344
|
var isTextType = isSectionType(SectionType.text);
|
|
404
345
|
var isVariantsType = isSectionType(SectionType.variants);
|
|
405
346
|
|
|
347
|
+
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
348
|
+
import { z as z2 } from "zod";
|
|
349
|
+
|
|
350
|
+
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
351
|
+
import { z } from "zod";
|
|
352
|
+
var ruleTypes = [
|
|
353
|
+
"cart",
|
|
354
|
+
"cart_count",
|
|
355
|
+
"cart_item_count",
|
|
356
|
+
"cart_line_count",
|
|
357
|
+
"cart_subtotal",
|
|
358
|
+
"collection",
|
|
359
|
+
"customer",
|
|
360
|
+
"customer_order_count",
|
|
361
|
+
"customer_tag",
|
|
362
|
+
"customer_total_spent",
|
|
363
|
+
"date",
|
|
364
|
+
"product",
|
|
365
|
+
"product_tag",
|
|
366
|
+
"product_title",
|
|
367
|
+
"product_type",
|
|
368
|
+
"product_vendor"
|
|
369
|
+
];
|
|
370
|
+
var ruleType = z.enum(ruleTypes);
|
|
371
|
+
var RuleType = ruleType.enum;
|
|
372
|
+
var ruleOperators = [
|
|
373
|
+
"after",
|
|
374
|
+
"anything",
|
|
375
|
+
"before",
|
|
376
|
+
"contains",
|
|
377
|
+
"contains_any",
|
|
378
|
+
"does_not_contain",
|
|
379
|
+
"does_not_contain_any",
|
|
380
|
+
"equals",
|
|
381
|
+
"does_not_equal",
|
|
382
|
+
"greater_than",
|
|
383
|
+
"less_than"
|
|
384
|
+
];
|
|
385
|
+
var ruleOperator = z.enum(ruleOperators);
|
|
386
|
+
var RuleOperator = ruleOperator.enum;
|
|
387
|
+
var RuleCondition = z.object({
|
|
388
|
+
operator: z.enum(ruleOperators).default(RuleOperator.anything),
|
|
389
|
+
products: z.union([z.array(z.unknown()), z.strictObject({}).transform(() => [])]).default(() => []),
|
|
390
|
+
type: z.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
391
|
+
value: z.coerce.string().default("")
|
|
392
|
+
});
|
|
393
|
+
var RuleLogicBlock = z.object({
|
|
394
|
+
rules: z.array(RuleCondition).default(() => [])
|
|
395
|
+
});
|
|
396
|
+
var CABRulesetEntry = z.object({
|
|
397
|
+
exitIfMatched: z.boolean().default(true),
|
|
398
|
+
logic: z.array(RuleLogicBlock).default(() => []),
|
|
399
|
+
output: z.array(
|
|
400
|
+
z.object({
|
|
401
|
+
key: z.string().default("should_show"),
|
|
402
|
+
type: z.literal("data_json").default("data_json"),
|
|
403
|
+
value: z.string().default("true")
|
|
404
|
+
})
|
|
405
|
+
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
406
|
+
});
|
|
407
|
+
var CABRuleset = z.union([z.array(CABRulesetEntry), z.strictObject({}).transform(() => [])]).default(() => []);
|
|
408
|
+
|
|
409
|
+
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
410
|
+
var variableEffect = z2.enum(variableEffects);
|
|
411
|
+
var CABVariableSeed = z2.object({
|
|
412
|
+
dataSourceId: z2.number().nullable().default(null),
|
|
413
|
+
ruleset: CABRuleset
|
|
414
|
+
});
|
|
415
|
+
var CABVariable = z2.object({
|
|
416
|
+
/**
|
|
417
|
+
* Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
|
|
418
|
+
* from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
|
|
419
|
+
* below; a cross-field default has no `.default()` spelling. An explicit value always wins.
|
|
420
|
+
*/
|
|
421
|
+
defaultValue: z2.boolean().optional(),
|
|
422
|
+
name: z2.string().min(1),
|
|
423
|
+
seed: CABVariableSeed.optional()
|
|
424
|
+
}).transform(({ defaultValue, ...variable }) => ({
|
|
425
|
+
defaultValue: defaultValue ?? variable.seed === void 0,
|
|
426
|
+
...variable
|
|
427
|
+
}));
|
|
428
|
+
var CABVariableEffect = z2.object({
|
|
429
|
+
effect: variableEffect.default(VariableEffect.toggle),
|
|
430
|
+
variable: z2.string().min(1)
|
|
431
|
+
});
|
|
432
|
+
var CABVisibility = z2.object({
|
|
433
|
+
variable: z2.string().min(1),
|
|
434
|
+
visibleWhen: z2.boolean().default(true)
|
|
435
|
+
});
|
|
436
|
+
var resultCountOperator = z2.enum(resultCountOperators);
|
|
437
|
+
var resultTagOperator = z2.enum(resultTagOperators);
|
|
438
|
+
var mutatorEvent = z2.enum(mutatorEvents);
|
|
439
|
+
var CABResultCountTrigger = z2.object({
|
|
440
|
+
operator: resultCountOperator.default(ResultCountOperator.equals),
|
|
441
|
+
type: z2.literal("result_count"),
|
|
442
|
+
value: z2.number().default(0)
|
|
443
|
+
});
|
|
444
|
+
var CABResultTagTrigger = z2.object({
|
|
445
|
+
operator: resultTagOperator.default(ResultTagOperator.contains),
|
|
446
|
+
type: z2.literal("result_tag"),
|
|
447
|
+
value: z2.string().min(1)
|
|
448
|
+
});
|
|
449
|
+
var CABEventTrigger = z2.object({
|
|
450
|
+
event: mutatorEvent,
|
|
451
|
+
type: z2.literal("event")
|
|
452
|
+
});
|
|
453
|
+
var CABVariableTrigger = z2.discriminatedUnion("type", [
|
|
454
|
+
CABEventTrigger,
|
|
455
|
+
CABResultCountTrigger,
|
|
456
|
+
CABResultTagTrigger
|
|
457
|
+
]);
|
|
458
|
+
var CABVariableMutator = z2.object({
|
|
459
|
+
effect: variableEffect.default(VariableEffect.set_false),
|
|
460
|
+
variable: z2.string().min(1),
|
|
461
|
+
when: CABVariableTrigger
|
|
462
|
+
});
|
|
463
|
+
var CABVariableFields = {
|
|
464
|
+
mutators: z2.array(CABVariableMutator).optional(),
|
|
465
|
+
variables: z2.array(CABVariable).refine((variables) => new Set(variables.map(({ name }) => name)).size === variables.length, {
|
|
466
|
+
message: "variable names must be unique within a section"
|
|
467
|
+
}).optional(),
|
|
468
|
+
visibility: CABVisibility.optional()
|
|
469
|
+
};
|
|
470
|
+
|
|
406
471
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
407
|
-
var CABImageSectionFields =
|
|
408
|
-
|
|
472
|
+
var CABImageSectionFields = z3.object({
|
|
473
|
+
...CABVariableFields,
|
|
474
|
+
altText: z3.string().refine(checkForHTML, NO_HTML).default(""),
|
|
409
475
|
/**
|
|
410
476
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
411
477
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
412
478
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
413
479
|
*/
|
|
414
|
-
aspectRatio:
|
|
415
|
-
border:
|
|
416
|
-
buttonField:
|
|
480
|
+
aspectRatio: z3.number().positive().nullable().default(null),
|
|
481
|
+
border: z3.lazy(() => CABBorder),
|
|
482
|
+
buttonField: z3.enum(buttonFields).optional(),
|
|
417
483
|
/**
|
|
418
484
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
419
485
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -432,30 +498,29 @@ var CABImageSectionFields = z2.object({
|
|
|
432
498
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
433
499
|
* the risky half.
|
|
434
500
|
*/
|
|
435
|
-
category:
|
|
501
|
+
category: z3.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
436
502
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
437
|
-
iconSize:
|
|
503
|
+
iconSize: z3.enum(iconSizes).nullable().default(null),
|
|
438
504
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
439
|
-
iconTone:
|
|
440
|
-
name:
|
|
441
|
-
naturalHeight:
|
|
442
|
-
naturalWidth:
|
|
505
|
+
iconTone: z3.enum(iconTones).nullable().default(null),
|
|
506
|
+
name: z3.string().optional(),
|
|
507
|
+
naturalHeight: z3.number().default(0),
|
|
508
|
+
naturalWidth: z3.number().default(0),
|
|
443
509
|
/**
|
|
444
510
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
445
511
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
446
512
|
*/
|
|
447
|
-
objectFit:
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
sectionType: z2.literal(SectionType.image).default(SectionType.image),
|
|
513
|
+
objectFit: z3.enum(objectFits).default(ObjectFit.contain),
|
|
514
|
+
sectionId: z3.uuid().default(() => uuidv7()),
|
|
515
|
+
sectionType: z3.literal(SectionType.image).default(SectionType.image),
|
|
451
516
|
/**
|
|
452
517
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
453
518
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
454
519
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
455
520
|
* server-chosen tier icon actually needs it.
|
|
456
521
|
*/
|
|
457
|
-
source:
|
|
458
|
-
width:
|
|
522
|
+
source: z3.union([z3.url(), z3.literal(""), z3.string().regex(DYNAMIC_TOKEN_REGEX), z3.enum(iconNames)]).default(""),
|
|
523
|
+
width: z3.number().default(100)
|
|
459
524
|
});
|
|
460
525
|
var iconNameSet = new Set(iconNames);
|
|
461
526
|
var isIconName = (source) => iconNameSet.has(source);
|
|
@@ -477,71 +542,71 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, c
|
|
|
477
542
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
478
543
|
import { forEach, isString as isString2 } from "es-toolkit/compat";
|
|
479
544
|
import { v7 as uuidv72 } from "uuid";
|
|
480
|
-
import { z as
|
|
481
|
-
var enumOrOmit = (...vals) =>
|
|
482
|
-
var TiptapText =
|
|
483
|
-
marks:
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
attrs:
|
|
490
|
-
class:
|
|
491
|
-
href:
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
545
|
+
import { z as z4 } from "zod";
|
|
546
|
+
var enumOrOmit = (...vals) => z4.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
547
|
+
var TiptapText = z4.object({
|
|
548
|
+
marks: z4.union([
|
|
549
|
+
z4.array(
|
|
550
|
+
z4.discriminatedUnion("type", [
|
|
551
|
+
z4.object({ type: z4.literal("bold") }),
|
|
552
|
+
z4.object({ type: z4.literal("italic") }),
|
|
553
|
+
z4.object({
|
|
554
|
+
attrs: z4.object({
|
|
555
|
+
class: z4.string().nullable(),
|
|
556
|
+
href: z4.union([
|
|
557
|
+
z4.url(),
|
|
558
|
+
z4.literal("#"),
|
|
559
|
+
z4.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
560
|
+
z4.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
496
561
|
]),
|
|
497
|
-
rel:
|
|
498
|
-
target:
|
|
562
|
+
rel: z4.string().default("noopener noreferrer nofollow"),
|
|
563
|
+
target: z4.string().default("_blank")
|
|
499
564
|
}),
|
|
500
|
-
type:
|
|
565
|
+
type: z4.literal("link")
|
|
501
566
|
}),
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
attrs:
|
|
567
|
+
z4.object({ type: z4.literal("strike") }),
|
|
568
|
+
z4.object({
|
|
569
|
+
attrs: z4.object({
|
|
505
570
|
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
506
571
|
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
507
572
|
}),
|
|
508
|
-
type:
|
|
573
|
+
type: z4.literal("textStyle")
|
|
509
574
|
})
|
|
510
575
|
])
|
|
511
576
|
),
|
|
512
|
-
|
|
577
|
+
z4.strictObject({}).transform(() => [])
|
|
513
578
|
]).optional(),
|
|
514
|
-
text:
|
|
515
|
-
type:
|
|
579
|
+
text: z4.string().default(""),
|
|
580
|
+
type: z4.literal("text").default("text")
|
|
516
581
|
});
|
|
517
|
-
var TiptapParagraph =
|
|
518
|
-
attrs:
|
|
582
|
+
var TiptapParagraph = z4.object({
|
|
583
|
+
attrs: z4.object({
|
|
519
584
|
textAlign: enumOrOmit(...textAlignments)
|
|
520
585
|
}).default({ textAlign: TextAlignment.start }),
|
|
521
|
-
content:
|
|
522
|
-
type:
|
|
586
|
+
content: z4.union([z4.array(TiptapText), z4.strictObject({}).transform(() => [])]).default(() => []),
|
|
587
|
+
type: z4.literal("paragraph").default("paragraph")
|
|
523
588
|
});
|
|
524
|
-
var TiptapDocument =
|
|
525
|
-
attrs:
|
|
589
|
+
var TiptapDocument = z4.object({
|
|
590
|
+
attrs: z4.object({
|
|
526
591
|
blockSpacing: enumOrOmit(...spacings)
|
|
527
592
|
}).default({ blockSpacing: Spacing.base }),
|
|
528
|
-
content:
|
|
529
|
-
type:
|
|
593
|
+
content: z4.union([z4.array(TiptapParagraph), z4.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
594
|
+
type: z4.literal("doc").default("doc")
|
|
530
595
|
});
|
|
531
|
-
var CABTextTier =
|
|
532
|
-
threshold:
|
|
533
|
-
thresholds:
|
|
534
|
-
tierId:
|
|
535
|
-
tierType:
|
|
596
|
+
var CABTextTier = z4.object({
|
|
597
|
+
threshold: z4.number().int().nonnegative(),
|
|
598
|
+
thresholds: z4.record(z4.string(), z4.number().int().nonnegative()).default(() => ({})),
|
|
599
|
+
tierId: z4.string().optional(),
|
|
600
|
+
tierType: z4.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
536
601
|
});
|
|
537
|
-
var CABTextSection =
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
sectionId:
|
|
544
|
-
sectionType:
|
|
602
|
+
var CABTextSection = z4.object({
|
|
603
|
+
...CABVariableFields,
|
|
604
|
+
buttonField: z4.enum(buttonFields).optional(),
|
|
605
|
+
content: z4.record(z4.string(), z4.union([z4.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
606
|
+
name: z4.string().optional(),
|
|
607
|
+
optionId: z4.number().optional(),
|
|
608
|
+
sectionId: z4.uuid().default(() => uuidv72()),
|
|
609
|
+
sectionType: z4.literal(SectionType.text).default(SectionType.text),
|
|
545
610
|
tier: CABTextTier.optional()
|
|
546
611
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
547
612
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
@@ -563,35 +628,35 @@ var CABTextSection = z3.object({
|
|
|
563
628
|
});
|
|
564
629
|
|
|
565
630
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
566
|
-
var CABButtonContent =
|
|
567
|
-
() =>
|
|
631
|
+
var CABButtonContent = z5.lazy(
|
|
632
|
+
() => z5.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
568
633
|
);
|
|
569
|
-
var CABButtonSection =
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
634
|
+
var CABButtonSection = z5.object({
|
|
635
|
+
...CABVariableFields,
|
|
636
|
+
action: z5.union([z5.literal(""), z5.enum(buttonActions)]).default(""),
|
|
637
|
+
buttonStyle: z5.enum(buttonStyles).default(ButtonStyle.primary),
|
|
638
|
+
custom: z5.object({
|
|
639
|
+
color: z5.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
640
|
+
height: z5.number().default(52),
|
|
641
|
+
width: z5.number().default(300)
|
|
576
642
|
}).default({
|
|
577
643
|
color: "#005bd3",
|
|
578
644
|
height: 52,
|
|
579
645
|
width: 300
|
|
580
646
|
}),
|
|
581
|
-
disableDowngrade:
|
|
582
|
-
name:
|
|
583
|
-
optionId:
|
|
584
|
-
popover:
|
|
585
|
-
alignment:
|
|
586
|
-
position:
|
|
647
|
+
disableDowngrade: z5.boolean().default(false),
|
|
648
|
+
name: z5.string().optional(),
|
|
649
|
+
optionId: z5.number().optional(),
|
|
650
|
+
popover: z5.object({
|
|
651
|
+
alignment: z5.enum(textAlignments).default(TextAlignment.center),
|
|
652
|
+
position: z5.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
587
653
|
}).optional().default(() => ({
|
|
588
654
|
alignment: TextAlignment.center,
|
|
589
655
|
position: PopoverPosition.blockStart
|
|
590
656
|
})),
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
sectionType: z4.literal(SectionType.button).default(SectionType.button),
|
|
657
|
+
sectionId: z5.uuid().default(() => uuidv73()),
|
|
658
|
+
sections: z5.union([z5.array(CABButtonContent), z5.strictObject({}).transform(() => [])]).default(() => []),
|
|
659
|
+
sectionType: z5.literal(SectionType.button).default(SectionType.button),
|
|
595
660
|
/**
|
|
596
661
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
597
662
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -606,20 +671,25 @@ var CABButtonSection = z4.object({
|
|
|
606
671
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
607
672
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
608
673
|
*/
|
|
609
|
-
tier:
|
|
674
|
+
tier: z5.object({ tierId: z5.string().min(1) }).optional(),
|
|
610
675
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
611
|
-
trackingUrl:
|
|
676
|
+
trackingUrl: z5.string().optional(),
|
|
677
|
+
/**
|
|
678
|
+
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
679
|
+
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
680
|
+
*/
|
|
681
|
+
variableEffects: z5.array(CABVariableEffect).optional()
|
|
612
682
|
});
|
|
613
683
|
|
|
614
684
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
615
|
-
import { z as
|
|
685
|
+
import { z as z10 } from "zod";
|
|
616
686
|
|
|
617
687
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
618
|
-
import { z as
|
|
688
|
+
import { z as z9 } from "zod";
|
|
619
689
|
|
|
620
690
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
621
691
|
import { v7 as uuidv74 } from "uuid";
|
|
622
|
-
import { z as
|
|
692
|
+
import { z as z6 } from "zod";
|
|
623
693
|
|
|
624
694
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
625
695
|
import { uniqBy } from "es-toolkit";
|
|
@@ -698,72 +768,74 @@ var widgetTypes = [
|
|
|
698
768
|
var WidgetType = freezeEnum(widgetTypes);
|
|
699
769
|
|
|
700
770
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
701
|
-
var CABDiscount =
|
|
702
|
-
amount:
|
|
703
|
-
discountedBy:
|
|
704
|
-
discountedFrom:
|
|
705
|
-
type:
|
|
771
|
+
var CABDiscount = z6.object({
|
|
772
|
+
amount: z6.union([z6.number(), z6.string()]).catch(0),
|
|
773
|
+
discountedBy: z6.string().optional(),
|
|
774
|
+
discountedFrom: z6.enum(discountSources).optional().catch(void 0),
|
|
775
|
+
type: z6.enum(discountTypes).catch("none")
|
|
706
776
|
});
|
|
707
|
-
var CABIntegrations =
|
|
708
|
-
judgeme:
|
|
709
|
-
junip:
|
|
710
|
-
klaviyo:
|
|
711
|
-
loox:
|
|
712
|
-
okendo:
|
|
713
|
-
opinew:
|
|
714
|
-
reviewsio:
|
|
715
|
-
stamped:
|
|
716
|
-
yotpo:
|
|
777
|
+
var CABIntegrations = z6.object({
|
|
778
|
+
judgeme: z6.boolean().default(false),
|
|
779
|
+
junip: z6.boolean().default(false),
|
|
780
|
+
klaviyo: z6.boolean().default(false),
|
|
781
|
+
loox: z6.boolean().default(false),
|
|
782
|
+
okendo: z6.boolean().default(false),
|
|
783
|
+
opinew: z6.boolean().default(false),
|
|
784
|
+
reviewsio: z6.boolean().default(false),
|
|
785
|
+
stamped: z6.boolean().default(false),
|
|
786
|
+
yotpo: z6.boolean().default(false)
|
|
717
787
|
});
|
|
718
|
-
var CABDataSourceSection =
|
|
719
|
-
dataSourceId:
|
|
720
|
-
dataSourcePath:
|
|
788
|
+
var CABDataSourceSection = z6.object({
|
|
789
|
+
dataSourceId: z6.number().nullable().default(null),
|
|
790
|
+
dataSourcePath: z6.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
721
791
|
discount: CABDiscount.optional(),
|
|
722
792
|
integrations: CABIntegrations.optional(),
|
|
723
|
-
limit:
|
|
724
|
-
matchVariant:
|
|
725
|
-
matchVariantOutOfStock:
|
|
726
|
-
name:
|
|
727
|
-
productType:
|
|
728
|
-
sectionId:
|
|
729
|
-
sectionType:
|
|
793
|
+
limit: z6.number().default(1),
|
|
794
|
+
matchVariant: z6.boolean().default(false),
|
|
795
|
+
matchVariantOutOfStock: z6.boolean().default(false),
|
|
796
|
+
name: z6.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
797
|
+
productType: z6.enum(productTypes).optional(),
|
|
798
|
+
sectionId: z6.uuid().default(() => uuidv74()),
|
|
799
|
+
sectionType: z6.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
730
800
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
731
|
-
subscriptionIsDefault:
|
|
732
|
-
treatAsGwp:
|
|
801
|
+
subscriptionIsDefault: z6.boolean().default(false),
|
|
802
|
+
treatAsGwp: z6.boolean().default(false)
|
|
733
803
|
});
|
|
734
804
|
|
|
735
805
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
736
806
|
import { v7 as uuidv76 } from "uuid";
|
|
737
|
-
import { z as
|
|
807
|
+
import { z as z8 } from "zod";
|
|
738
808
|
|
|
739
809
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
740
810
|
import { v7 as uuidv75 } from "uuid";
|
|
741
|
-
import { z as
|
|
742
|
-
var CABVariantContent =
|
|
743
|
-
() =>
|
|
811
|
+
import { z as z7 } from "zod";
|
|
812
|
+
var CABVariantContent = z7.lazy(
|
|
813
|
+
() => z7.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
744
814
|
);
|
|
745
|
-
var CABProductSection =
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
815
|
+
var CABProductSection = z7.object({
|
|
816
|
+
...CABVariableFields,
|
|
817
|
+
name: z7.string().optional(),
|
|
818
|
+
productId: z7.number().nullable().default(null),
|
|
819
|
+
sectionId: z7.uuid().default(() => uuidv75()),
|
|
820
|
+
sections: z7.union([z7.array(CABVariantContent), z7.strictObject({}).transform(() => [])]).default(() => []),
|
|
821
|
+
sectionType: z7.literal(SectionType.product).default(SectionType.product),
|
|
822
|
+
selectors: z7.record(z7.string(), z7.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
823
|
+
variantMode: z7.enum(variantModes).default(VariantMode.multiple)
|
|
753
824
|
});
|
|
754
825
|
|
|
755
826
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
756
|
-
var CABProductsSection =
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
827
|
+
var CABProductsSection = z8.object({
|
|
828
|
+
...CABVariableFields,
|
|
829
|
+
name: z8.string().optional(),
|
|
830
|
+
sectionId: z8.uuid().default(() => uuidv76()),
|
|
831
|
+
sections: z8.union([z8.array(z8.lazy(() => CABProductSection)), z8.strictObject({}).transform(() => [])]).default(() => []),
|
|
832
|
+
sectionType: z8.literal(SectionType.products).default(SectionType.products)
|
|
761
833
|
});
|
|
762
834
|
|
|
763
835
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
764
|
-
var CABOffersSection =
|
|
836
|
+
var CABOffersSection = z9.lazy(
|
|
765
837
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
766
|
-
sections:
|
|
838
|
+
sections: z9.union([z9.array(z9.lazy(() => CABSection)), z9.strictObject({}).transform(() => [])]).default(() => [
|
|
767
839
|
CABBannerSection.parse({
|
|
768
840
|
buttonField: "undoAddToOrder",
|
|
769
841
|
color: "success",
|
|
@@ -777,64 +849,65 @@ var CABOffersSection = z8.lazy(
|
|
|
777
849
|
CABDataSourceSection.parse({}),
|
|
778
850
|
CABProductsSection.parse({})
|
|
779
851
|
]),
|
|
780
|
-
sectionType:
|
|
852
|
+
sectionType: z9.literal(SectionType.offers).default(SectionType.offers)
|
|
781
853
|
})
|
|
782
854
|
);
|
|
783
855
|
|
|
784
856
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
785
|
-
var CABCarouselSection =
|
|
857
|
+
var CABCarouselSection = z10.lazy(
|
|
786
858
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
787
|
-
autoAdvanceInterval:
|
|
788
|
-
itemsAtOnce:
|
|
859
|
+
autoAdvanceInterval: z10.number().default(0),
|
|
860
|
+
itemsAtOnce: z10.number().min(1).default(1),
|
|
789
861
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
790
|
-
offersDirection:
|
|
791
|
-
sections:
|
|
792
|
-
sectionType:
|
|
862
|
+
offersDirection: z10.enum(offersDirections).default("vertical"),
|
|
863
|
+
sections: z10.union([z10.array(z10.lazy(() => CABSection)), z10.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
864
|
+
sectionType: z10.literal(SectionType.carousel).default(SectionType.carousel)
|
|
793
865
|
})
|
|
794
866
|
);
|
|
795
867
|
|
|
796
868
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
797
|
-
import { z as
|
|
798
|
-
var CABCartLineSection =
|
|
869
|
+
import { z as z11 } from "zod";
|
|
870
|
+
var CABCartLineSection = z11.lazy(
|
|
799
871
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
800
|
-
sections:
|
|
801
|
-
sectionType:
|
|
872
|
+
sections: z11.union([z11.array(z11.lazy(() => CABSection)), z11.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
873
|
+
sectionType: z11.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
802
874
|
})
|
|
803
875
|
);
|
|
804
876
|
|
|
805
877
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
806
878
|
import { v7 as uuidv77 } from "uuid";
|
|
807
|
-
import { z as
|
|
808
|
-
var CABDiscountSection =
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
879
|
+
import { z as z12 } from "zod";
|
|
880
|
+
var CABDiscountSection = z12.object({
|
|
881
|
+
...CABVariableFields,
|
|
882
|
+
amount: z12.union([z12.number(), z12.string()]).catch(0),
|
|
883
|
+
discountedBy: z12.string().optional(),
|
|
884
|
+
discountedFrom: z12.enum(discountSources).optional().catch(void 0),
|
|
885
|
+
message: z12.string().optional(),
|
|
886
|
+
name: z12.string().optional(),
|
|
887
|
+
quantity: z12.number().default(1),
|
|
888
|
+
sectionId: z12.uuid().default(() => uuidv77()),
|
|
889
|
+
sectionType: z12.literal(SectionType.discount).default(SectionType.discount),
|
|
890
|
+
type: z12.enum(discountTypes).catch("none")
|
|
818
891
|
});
|
|
819
892
|
|
|
820
893
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
821
894
|
import { v7 as uuidv78 } from "uuid";
|
|
822
|
-
import { z as
|
|
823
|
-
var CABMonetizeSection =
|
|
824
|
-
|
|
895
|
+
import { z as z13 } from "zod";
|
|
896
|
+
var CABMonetizeSection = z13.object({
|
|
897
|
+
...CABVariableFields,
|
|
898
|
+
name: z13.string().optional(),
|
|
825
899
|
/** Privacy Policy footer href (the widget's `privacy_policy_url` setting); the client relays it to `/cab/monetize`. */
|
|
826
|
-
privacyPolicyUrl:
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
sectionType: z12.literal(SectionType.monetize).default(SectionType.monetize),
|
|
900
|
+
privacyPolicyUrl: z13.string().optional(),
|
|
901
|
+
sectionId: z13.uuid().default(() => uuidv78()),
|
|
902
|
+
sectionType: z13.literal(SectionType.monetize).default(SectionType.monetize),
|
|
830
903
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
831
|
-
subVertical:
|
|
904
|
+
subVertical: z13.string().optional(),
|
|
832
905
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
833
|
-
vertical:
|
|
906
|
+
vertical: z13.string().optional()
|
|
834
907
|
});
|
|
835
908
|
|
|
836
909
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
837
|
-
import { z as
|
|
910
|
+
import { z as z14 } from "zod";
|
|
838
911
|
|
|
839
912
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
840
913
|
var GIFT_LABELS = {
|
|
@@ -953,21 +1026,21 @@ var GIFT_LABELS = {
|
|
|
953
1026
|
};
|
|
954
1027
|
|
|
955
1028
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
956
|
-
var CABProgressTier =
|
|
1029
|
+
var CABProgressTier = z14.object({
|
|
957
1030
|
/**
|
|
958
1031
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
959
1032
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
960
1033
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
961
1034
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
962
1035
|
*/
|
|
963
|
-
discount:
|
|
1036
|
+
discount: z14.object({ amount: z14.number().nonnegative(), type: z14.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
964
1037
|
/**
|
|
965
1038
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
966
1039
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
967
1040
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
968
1041
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
969
1042
|
*/
|
|
970
|
-
filterOosVariants:
|
|
1043
|
+
filterOosVariants: z14.boolean().default(false),
|
|
971
1044
|
/**
|
|
972
1045
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
973
1046
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -975,10 +1048,10 @@ var CABProgressTier = z13.object({
|
|
|
975
1048
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
976
1049
|
* tree is complete.
|
|
977
1050
|
*/
|
|
978
|
-
gift:
|
|
979
|
-
productId:
|
|
980
|
-
title:
|
|
981
|
-
variantIds:
|
|
1051
|
+
gift: z14.object({
|
|
1052
|
+
productId: z14.number().int().positive(),
|
|
1053
|
+
title: z14.string().optional(),
|
|
1054
|
+
variantIds: z14.array(z14.number().int().positive()).default(() => [])
|
|
982
1055
|
}).optional(),
|
|
983
1056
|
/**
|
|
984
1057
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
@@ -989,35 +1062,35 @@ var CABProgressTier = z13.object({
|
|
|
989
1062
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
990
1063
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
991
1064
|
*/
|
|
992
|
-
label:
|
|
1065
|
+
label: z14.record(z14.string(), z14.string()).optional(),
|
|
993
1066
|
/**
|
|
994
1067
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
995
1068
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
996
1069
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
997
1070
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
998
1071
|
*/
|
|
999
|
-
productTierImage:
|
|
1072
|
+
productTierImage: z14.boolean().default(false),
|
|
1000
1073
|
/**
|
|
1001
1074
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
1002
1075
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
1003
1076
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
1004
1077
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
1005
1078
|
*/
|
|
1006
|
-
threshold:
|
|
1079
|
+
threshold: z14.number().int().nonnegative(),
|
|
1007
1080
|
/**
|
|
1008
1081
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
1009
1082
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
1010
1083
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
1011
1084
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
1012
1085
|
*/
|
|
1013
|
-
thresholds:
|
|
1086
|
+
thresholds: z14.record(z14.string(), z14.number().int().nonnegative()).default(() => ({})),
|
|
1014
1087
|
/**
|
|
1015
1088
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
1016
1089
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
1017
1090
|
* shipping bar (single unlabeled tier, no gift).
|
|
1018
1091
|
*/
|
|
1019
|
-
tierId:
|
|
1020
|
-
tierType:
|
|
1092
|
+
tierId: z14.string().optional(),
|
|
1093
|
+
tierType: z14.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
1021
1094
|
/**
|
|
1022
1095
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
1023
1096
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -1028,9 +1101,9 @@ var CABProgressTier = z13.object({
|
|
|
1028
1101
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
1029
1102
|
* template text supplies grammatically-neutral wording around the token.
|
|
1030
1103
|
*/
|
|
1031
|
-
unit:
|
|
1104
|
+
unit: z14.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
1032
1105
|
});
|
|
1033
|
-
var CABProgressBarSection =
|
|
1106
|
+
var CABProgressBarSection = z14.lazy(
|
|
1034
1107
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1035
1108
|
/**
|
|
1036
1109
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -1039,35 +1112,35 @@ var CABProgressBarSection = z13.lazy(
|
|
|
1039
1112
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
1040
1113
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
1041
1114
|
*/
|
|
1042
|
-
barId:
|
|
1115
|
+
barId: z14.string().optional(),
|
|
1043
1116
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
1044
|
-
countryCodes:
|
|
1117
|
+
countryCodes: z14.array(z14.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1045
1118
|
/**
|
|
1046
1119
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
1047
1120
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
1048
1121
|
*/
|
|
1049
|
-
excludeCountryCodes:
|
|
1122
|
+
excludeCountryCodes: z14.array(z14.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1050
1123
|
/**
|
|
1051
1124
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
1052
1125
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
1053
1126
|
* adds the cart's discount allocations back to the live subtotal.
|
|
1054
1127
|
*/
|
|
1055
|
-
excludeDiscountInSubtotal:
|
|
1128
|
+
excludeDiscountInSubtotal: z14.boolean().default(false),
|
|
1056
1129
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
1057
|
-
excludedVariantIds:
|
|
1130
|
+
excludedVariantIds: z14.array(z14.number().int().positive()).default(() => []),
|
|
1058
1131
|
/**
|
|
1059
1132
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
1060
1133
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
1061
1134
|
*/
|
|
1062
|
-
freeShippingOnSubscription:
|
|
1135
|
+
freeShippingOnSubscription: z14.boolean().default(false),
|
|
1063
1136
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
1064
|
-
giftAreaTitle:
|
|
1137
|
+
giftAreaTitle: z14.record(z14.string(), z14.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
1065
1138
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
1066
|
-
giftLabels:
|
|
1067
|
-
addGift:
|
|
1068
|
-
remove:
|
|
1069
|
-
selectOptions:
|
|
1070
|
-
yourGift:
|
|
1139
|
+
giftLabels: z14.object({
|
|
1140
|
+
addGift: z14.record(z14.string(), z14.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
1141
|
+
remove: z14.record(z14.string(), z14.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
1142
|
+
selectOptions: z14.record(z14.string(), z14.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
1143
|
+
yourGift: z14.record(z14.string(), z14.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
1071
1144
|
}).default(() => ({
|
|
1072
1145
|
addGift: { ...GIFT_LABELS.addGift },
|
|
1073
1146
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -1075,37 +1148,38 @@ var CABProgressBarSection = z13.lazy(
|
|
|
1075
1148
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
1076
1149
|
})),
|
|
1077
1150
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
1078
|
-
name:
|
|
1151
|
+
name: z14.string().default("Order progress"),
|
|
1079
1152
|
/**
|
|
1080
1153
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
1081
1154
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
1082
1155
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
1083
1156
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
1084
1157
|
*/
|
|
1085
|
-
progressColor:
|
|
1086
|
-
sectionType:
|
|
1158
|
+
progressColor: z14.string().optional(),
|
|
1159
|
+
sectionType: z14.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
1087
1160
|
/**
|
|
1088
1161
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
1089
1162
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
1090
1163
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
1091
1164
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
1092
1165
|
*/
|
|
1093
|
-
tiers:
|
|
1166
|
+
tiers: z14.union([z14.array(CABProgressTier), z14.strictObject({}).transform(() => [])]).default(() => [])
|
|
1094
1167
|
})
|
|
1095
1168
|
);
|
|
1096
1169
|
|
|
1097
1170
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
1098
1171
|
import { v7 as uuidv79 } from "uuid";
|
|
1099
|
-
import { z as
|
|
1100
|
-
var CABQuantitySection =
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1172
|
+
import { z as z15 } from "zod";
|
|
1173
|
+
var CABQuantitySection = z15.object({
|
|
1174
|
+
...CABVariableFields,
|
|
1175
|
+
errorMessages: z15.record(
|
|
1176
|
+
z15.string(),
|
|
1177
|
+
z15.object({
|
|
1104
1178
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
1105
|
-
increment:
|
|
1106
|
-
max:
|
|
1107
|
-
min:
|
|
1108
|
-
neg:
|
|
1179
|
+
increment: z15.string().optional(),
|
|
1180
|
+
max: z15.string().optional(),
|
|
1181
|
+
min: z15.string().optional(),
|
|
1182
|
+
neg: z15.string().optional()
|
|
1109
1183
|
})
|
|
1110
1184
|
).default({
|
|
1111
1185
|
en: {
|
|
@@ -1115,19 +1189,18 @@ var CABQuantitySection = z14.object({
|
|
|
1115
1189
|
neg: "Quantity cannot be negative"
|
|
1116
1190
|
}
|
|
1117
1191
|
}),
|
|
1118
|
-
inputType:
|
|
1119
|
-
max:
|
|
1120
|
-
min:
|
|
1192
|
+
inputType: z15.enum(quantityInputs).default(QuantityInput.select),
|
|
1193
|
+
max: z15.number().min(1).max(100).default(10),
|
|
1194
|
+
min: z15.number().min(1).default(1),
|
|
1121
1195
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
1122
|
-
name:
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
sectionType: z14.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1196
|
+
name: z15.string().default("Quantity"),
|
|
1197
|
+
sectionId: z15.uuid().default(() => uuidv79()),
|
|
1198
|
+
sectionType: z15.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1126
1199
|
});
|
|
1127
1200
|
|
|
1128
1201
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1129
1202
|
import { v7 as uuidv710 } from "uuid";
|
|
1130
|
-
import { z as
|
|
1203
|
+
import { z as z16 } from "zod";
|
|
1131
1204
|
|
|
1132
1205
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
1133
1206
|
var REVIEW_LABELS = {
|
|
@@ -1190,50 +1263,50 @@ var REVIEW_LABELS = {
|
|
|
1190
1263
|
};
|
|
1191
1264
|
|
|
1192
1265
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1193
|
-
var CABReviewsSection =
|
|
1194
|
-
|
|
1266
|
+
var CABReviewsSection = z16.object({
|
|
1267
|
+
...CABVariableFields,
|
|
1268
|
+
color: z16.string().default("#fadb14"),
|
|
1195
1269
|
/**
|
|
1196
1270
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
1197
1271
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
1198
1272
|
* or merchant work.
|
|
1199
1273
|
*/
|
|
1200
|
-
countLabels:
|
|
1201
|
-
one:
|
|
1202
|
-
other:
|
|
1274
|
+
countLabels: z16.object({
|
|
1275
|
+
one: z16.record(z16.string(), z16.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
1276
|
+
other: z16.record(z16.string(), z16.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
1203
1277
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
1204
|
-
name:
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
size: z15.enum(reviewsSizes).default(ReviewsSize.default)
|
|
1278
|
+
name: z16.string().optional(),
|
|
1279
|
+
sectionId: z16.uuid().default(() => uuidv710()),
|
|
1280
|
+
sectionType: z16.literal(SectionType.reviews).default(SectionType.reviews),
|
|
1281
|
+
size: z16.enum(reviewsSizes).default(ReviewsSize.default)
|
|
1209
1282
|
});
|
|
1210
1283
|
|
|
1211
1284
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
1212
1285
|
import { slice } from "es-toolkit/compat";
|
|
1213
1286
|
import { v7 as uuidv711 } from "uuid";
|
|
1214
|
-
import { z as
|
|
1215
|
-
var CABVariantsSection =
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
sectionId:
|
|
1220
|
-
sectionType:
|
|
1221
|
-
selector:
|
|
1222
|
-
variantMode:
|
|
1287
|
+
import { z as z17 } from "zod";
|
|
1288
|
+
var CABVariantsSection = z17.object({
|
|
1289
|
+
...CABVariableFields,
|
|
1290
|
+
hideOutOfStockVariants: z17.boolean().default(false),
|
|
1291
|
+
name: z17.string().optional(),
|
|
1292
|
+
sectionId: z17.uuid().default(() => uuidv711()),
|
|
1293
|
+
sectionType: z17.literal(SectionType.variants).default(SectionType.variants),
|
|
1294
|
+
selector: z17.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
1295
|
+
variantMode: z17.enum(variantModes).default(VariantMode.multiple)
|
|
1223
1296
|
});
|
|
1224
1297
|
|
|
1225
1298
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
1226
|
-
var CABBorder =
|
|
1227
|
-
radius:
|
|
1228
|
-
style:
|
|
1229
|
-
width:
|
|
1299
|
+
var CABBorder = z18.object({
|
|
1300
|
+
radius: z18.enum(borderRadii).default(BorderRadius.base),
|
|
1301
|
+
style: z18.enum(borderStyles).default(BorderStyle.none),
|
|
1302
|
+
width: z18.enum(borderWidths).default(BorderWidth.base)
|
|
1230
1303
|
}).default({
|
|
1231
1304
|
radius: BorderRadius.base,
|
|
1232
1305
|
style: BorderStyle.none,
|
|
1233
1306
|
width: BorderWidth.base
|
|
1234
1307
|
});
|
|
1235
|
-
var CABSection =
|
|
1236
|
-
() =>
|
|
1308
|
+
var CABSection = z18.lazy(
|
|
1309
|
+
() => z18.discriminatedUnion("sectionType", [
|
|
1237
1310
|
CABBannerSection,
|
|
1238
1311
|
CABButtonSection,
|
|
1239
1312
|
CABCarouselSection,
|
|
@@ -1255,40 +1328,40 @@ var CABSection = z17.lazy(
|
|
|
1255
1328
|
);
|
|
1256
1329
|
|
|
1257
1330
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
1258
|
-
var GridItem =
|
|
1259
|
-
var CABLayoutSection =
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1331
|
+
var GridItem = z19.union([z19.literal("auto"), z19.literal("fill"), z19.string().regex(/^\d+%$/), z19.number()]);
|
|
1332
|
+
var CABLayoutSection = z19.object({
|
|
1333
|
+
...CABVariableFields,
|
|
1334
|
+
alignment: z19.object({
|
|
1335
|
+
horizontal: z19.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
1336
|
+
vertical: z19.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
1263
1337
|
}).default({
|
|
1264
1338
|
horizontal: HorizontalAlignment.start,
|
|
1265
1339
|
vertical: VerticalAlignment.top
|
|
1266
1340
|
}),
|
|
1267
|
-
border:
|
|
1268
|
-
buttonField:
|
|
1269
|
-
direction:
|
|
1270
|
-
grid:
|
|
1271
|
-
columns:
|
|
1272
|
-
rows:
|
|
1341
|
+
border: z19.lazy(() => CABBorder),
|
|
1342
|
+
buttonField: z19.enum(buttonFields).optional(),
|
|
1343
|
+
direction: z19.enum(directions).default(Direction.rows),
|
|
1344
|
+
grid: z19.object({
|
|
1345
|
+
columns: z19.union([z19.array(GridItem), z19.undefined()]).default(() => ["auto"]),
|
|
1346
|
+
rows: z19.union([z19.array(GridItem), z19.undefined()]).default(() => ["auto"])
|
|
1273
1347
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
1274
|
-
name:
|
|
1275
|
-
padding:
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
spacing: z18.enum(spacings).default(Spacing.base),
|
|
1348
|
+
name: z19.string().optional(),
|
|
1349
|
+
padding: z19.enum(spacings).default(Spacing.none),
|
|
1350
|
+
sectionId: z19.uuid().default(() => uuidv712()),
|
|
1351
|
+
sections: z19.union([z19.array(z19.lazy(() => CABSection)), z19.strictObject({}).transform(() => [])]).default(() => []),
|
|
1352
|
+
sectionType: z19.literal(SectionType.layout).default(SectionType.layout),
|
|
1353
|
+
spacing: z19.enum(spacings).default(Spacing.base),
|
|
1281
1354
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
1282
|
-
viewUrl:
|
|
1283
|
-
width:
|
|
1355
|
+
viewUrl: z19.string().optional(),
|
|
1356
|
+
width: z19.number().default(100)
|
|
1284
1357
|
});
|
|
1285
1358
|
|
|
1286
1359
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
1287
|
-
var CABBannerSection =
|
|
1360
|
+
var CABBannerSection = z20.lazy(
|
|
1288
1361
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1289
|
-
buttonField:
|
|
1290
|
-
color:
|
|
1291
|
-
dismissible:
|
|
1362
|
+
buttonField: z20.enum(buttonFields).optional(),
|
|
1363
|
+
color: z20.enum(bannerColors).default("info"),
|
|
1364
|
+
dismissible: z20.boolean().default(true),
|
|
1292
1365
|
/**
|
|
1293
1366
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
1294
1367
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -1304,8 +1377,8 @@ var CABBannerSection = z19.lazy(
|
|
|
1304
1377
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
1305
1378
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
1306
1379
|
*/
|
|
1307
|
-
heading:
|
|
1308
|
-
sectionType:
|
|
1380
|
+
heading: z20.record(z20.string(), z20.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
1381
|
+
sectionType: z20.literal(SectionType.banner).default(SectionType.banner)
|
|
1309
1382
|
})
|
|
1310
1383
|
);
|
|
1311
1384
|
|
|
@@ -1510,7 +1583,7 @@ var OFFER_LABELS = {
|
|
|
1510
1583
|
};
|
|
1511
1584
|
|
|
1512
1585
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1513
|
-
import { z as
|
|
1586
|
+
import { z as z21 } from "zod";
|
|
1514
1587
|
|
|
1515
1588
|
// src/schema/widgets/checkout-and-beyond/uiLabels.ts
|
|
1516
1589
|
var UI_LABELS = {
|
|
@@ -1526,8 +1599,8 @@ var UI_LABELS = {
|
|
|
1526
1599
|
};
|
|
1527
1600
|
|
|
1528
1601
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1529
|
-
var localized = (fallback) =>
|
|
1530
|
-
var CABUILabels =
|
|
1602
|
+
var localized = (fallback) => z21.record(z21.string(), z21.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
1603
|
+
var CABUILabels = z21.object({
|
|
1531
1604
|
currentPage: localized(UI_LABELS.currentPage),
|
|
1532
1605
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
1533
1606
|
nextPage: localized(UI_LABELS.nextPage),
|
|
@@ -1548,37 +1621,37 @@ var CABUILabels = z20.object({
|
|
|
1548
1621
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
1549
1622
|
updating: { ...UI_LABELS.updating }
|
|
1550
1623
|
}));
|
|
1551
|
-
var TargetArea =
|
|
1552
|
-
fill:
|
|
1553
|
-
flip:
|
|
1554
|
-
icon:
|
|
1555
|
-
label:
|
|
1556
|
-
width:
|
|
1624
|
+
var TargetArea = z21.object({
|
|
1625
|
+
fill: z21.boolean().optional(),
|
|
1626
|
+
flip: z21.enum(["both", "horizontal", "vertical"]).optional(),
|
|
1627
|
+
icon: z21.string(),
|
|
1628
|
+
label: z21.string(),
|
|
1629
|
+
width: z21.string()
|
|
1557
1630
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
1558
|
-
var CABTracking =
|
|
1559
|
-
enableAttribution:
|
|
1560
|
-
enableSource:
|
|
1561
|
-
enableWidget:
|
|
1631
|
+
var CABTracking = z21.object({
|
|
1632
|
+
enableAttribution: z21.boolean().nullish().transform((value) => value ?? true),
|
|
1633
|
+
enableSource: z21.boolean().nullish().transform((value) => value ?? true),
|
|
1634
|
+
enableWidget: z21.boolean().nullish().transform((value) => value ?? true)
|
|
1562
1635
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
1563
|
-
var CABExperiment =
|
|
1564
|
-
elementId:
|
|
1565
|
-
experimentId:
|
|
1566
|
-
experimentType:
|
|
1567
|
-
selectedId:
|
|
1636
|
+
var CABExperiment = z21.object({
|
|
1637
|
+
elementId: z21.number(),
|
|
1638
|
+
experimentId: z21.number(),
|
|
1639
|
+
experimentType: z21.string(),
|
|
1640
|
+
selectedId: z21.number()
|
|
1568
1641
|
});
|
|
1569
1642
|
var CABRootSection = CABLayoutSection.extend({
|
|
1570
|
-
editorMode:
|
|
1643
|
+
editorMode: z21.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
1571
1644
|
experiment: CABExperiment.optional(),
|
|
1572
1645
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
1573
1646
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
1574
|
-
previewMode:
|
|
1575
|
-
storeId:
|
|
1647
|
+
previewMode: z21.boolean().nullish().transform((value) => value ?? false),
|
|
1648
|
+
storeId: z21.number().nullable().default(null),
|
|
1576
1649
|
targetArea: TargetArea.nullable(),
|
|
1577
1650
|
tracking: CABTracking,
|
|
1578
|
-
type:
|
|
1651
|
+
type: z21.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
1579
1652
|
uiLabels: CABUILabels,
|
|
1580
|
-
version:
|
|
1581
|
-
widgetId:
|
|
1653
|
+
version: z21.literal(2).default(2),
|
|
1654
|
+
widgetId: z21.number().nullable().default(null)
|
|
1582
1655
|
});
|
|
1583
1656
|
|
|
1584
1657
|
// src/schema/widgets/checkout-and-beyond/switchLabels.ts
|
|
@@ -1714,6 +1787,7 @@ export {
|
|
|
1714
1787
|
CABDataSourceSection,
|
|
1715
1788
|
CABDiscount,
|
|
1716
1789
|
CABDiscountSection,
|
|
1790
|
+
CABEventTrigger,
|
|
1717
1791
|
CABExperiment,
|
|
1718
1792
|
CABImageSection,
|
|
1719
1793
|
CABImageSectionFields,
|
|
@@ -1726,16 +1800,26 @@ export {
|
|
|
1726
1800
|
CABProgressBarSection,
|
|
1727
1801
|
CABProgressTier,
|
|
1728
1802
|
CABQuantitySection,
|
|
1803
|
+
CABResultCountTrigger,
|
|
1804
|
+
CABResultTagTrigger,
|
|
1729
1805
|
CABReviewsSection,
|
|
1730
1806
|
CABRootSection,
|
|
1731
|
-
|
|
1807
|
+
CABRuleset,
|
|
1808
|
+
CABRulesetEntry,
|
|
1732
1809
|
CABSection,
|
|
1733
1810
|
CABTextSection,
|
|
1734
1811
|
CABTextTier,
|
|
1735
1812
|
CABTracking,
|
|
1736
1813
|
CABUILabels,
|
|
1814
|
+
CABVariable,
|
|
1815
|
+
CABVariableEffect,
|
|
1816
|
+
CABVariableFields,
|
|
1817
|
+
CABVariableMutator,
|
|
1818
|
+
CABVariableSeed,
|
|
1819
|
+
CABVariableTrigger,
|
|
1737
1820
|
CABVariantContent,
|
|
1738
1821
|
CABVariantsSection,
|
|
1822
|
+
CABVisibility,
|
|
1739
1823
|
COMBINED_ENDPOINTS,
|
|
1740
1824
|
DEFAULT_ENDPOINTS,
|
|
1741
1825
|
DYNAMIC_TOKEN_REGEX,
|
|
@@ -1753,6 +1837,7 @@ export {
|
|
|
1753
1837
|
IconTone,
|
|
1754
1838
|
InlineTextSizeName,
|
|
1755
1839
|
LanguageKey,
|
|
1840
|
+
MutatorEvent,
|
|
1756
1841
|
NO_HTML,
|
|
1757
1842
|
OFFER_LABELS,
|
|
1758
1843
|
ObjectFit,
|
|
@@ -1764,6 +1849,8 @@ export {
|
|
|
1764
1849
|
QuantityInput,
|
|
1765
1850
|
REVIEW_LABELS,
|
|
1766
1851
|
ROOT_RELATIVE_PATH_REGEX,
|
|
1852
|
+
ResultCountOperator,
|
|
1853
|
+
ResultTagOperator,
|
|
1767
1854
|
ReviewsSize,
|
|
1768
1855
|
RuleCondition,
|
|
1769
1856
|
RuleLogicBlock,
|
|
@@ -1780,6 +1867,7 @@ export {
|
|
|
1780
1867
|
TiptapParagraph,
|
|
1781
1868
|
TiptapText,
|
|
1782
1869
|
UI_LABELS,
|
|
1870
|
+
VariableEffect,
|
|
1783
1871
|
VariantMode,
|
|
1784
1872
|
VariantSelector,
|
|
1785
1873
|
VerticalAlignment,
|
|
@@ -1824,6 +1912,7 @@ export {
|
|
|
1824
1912
|
isTextType,
|
|
1825
1913
|
isVariantsType,
|
|
1826
1914
|
languageKeys,
|
|
1915
|
+
mutatorEvents,
|
|
1827
1916
|
objectFits,
|
|
1828
1917
|
offersDirections,
|
|
1829
1918
|
popoverPositionMap,
|
|
@@ -1832,6 +1921,8 @@ export {
|
|
|
1832
1921
|
progressTierTypes,
|
|
1833
1922
|
progressTierUnits,
|
|
1834
1923
|
quantityInputs,
|
|
1924
|
+
resultCountOperators,
|
|
1925
|
+
resultTagOperators,
|
|
1835
1926
|
reviewsSizes,
|
|
1836
1927
|
ruleOperators,
|
|
1837
1928
|
ruleTypes,
|
|
@@ -1841,6 +1932,7 @@ export {
|
|
|
1841
1932
|
textAlignments,
|
|
1842
1933
|
textColorNames,
|
|
1843
1934
|
textSizeNames,
|
|
1935
|
+
variableEffects,
|
|
1844
1936
|
variantModes,
|
|
1845
1937
|
variantSelectors,
|
|
1846
1938
|
verticalAlignments,
|