@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
|
@@ -24,7 +24,7 @@ __export(widgetData_exports, {
|
|
|
24
24
|
extensionWidgetTypes: () => extensionWidgetTypes
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(widgetData_exports);
|
|
27
|
-
var
|
|
27
|
+
var import_zod30 = require("zod");
|
|
28
28
|
|
|
29
29
|
// src/schema/widgets/abTestingPlaceholder.ts
|
|
30
30
|
var import_zod = require("zod");
|
|
@@ -140,6 +140,8 @@ var languageKeys = [
|
|
|
140
140
|
"zh"
|
|
141
141
|
];
|
|
142
142
|
var LanguageKey = freezeEnum(languageKeys);
|
|
143
|
+
var mutatorEvents = ["item_added", "quantity_changed", "variant_selected"];
|
|
144
|
+
var MutatorEvent = freezeEnum(mutatorEvents);
|
|
143
145
|
var objectFits = ["cover", "contain"];
|
|
144
146
|
var ObjectFit = freezeEnum(objectFits);
|
|
145
147
|
var popoverPositions = ["inlineStart", "inlineEnd", "blockStart", "blockEnd"];
|
|
@@ -152,6 +154,10 @@ var progressTierUnits = ["currency", "item"];
|
|
|
152
154
|
var ProgressTierUnit = freezeEnum(progressTierUnits);
|
|
153
155
|
var quantityInputs = ["select", "number"];
|
|
154
156
|
var QuantityInput = freezeEnum(quantityInputs);
|
|
157
|
+
var resultCountOperators = ["equals", "greater_than", "less_than"];
|
|
158
|
+
var ResultCountOperator = freezeEnum(resultCountOperators);
|
|
159
|
+
var resultTagOperators = ["contains", "does_not_contain"];
|
|
160
|
+
var ResultTagOperator = freezeEnum(resultTagOperators);
|
|
155
161
|
var reviewsSizes = ["small", "default", "large"];
|
|
156
162
|
var ReviewsSize = freezeEnum(reviewsSizes);
|
|
157
163
|
var sectionTypes = [
|
|
@@ -184,6 +190,8 @@ var inlineTextSizeNames = ["extraSmall", "small", "base", "medium", "large", "ex
|
|
|
184
190
|
var InlineTextSizeName = freezeEnum(inlineTextSizeNames);
|
|
185
191
|
var textSizeNames = [...inlineTextSizeNames, "heading"];
|
|
186
192
|
var TextSizeName = freezeEnum(textSizeNames);
|
|
193
|
+
var variableEffects = ["set_false", "set_true", "toggle"];
|
|
194
|
+
var VariableEffect = freezeEnum(variableEffects);
|
|
187
195
|
var variantModes = ["multiple", "single"];
|
|
188
196
|
var VariantMode = freezeEnum(variantModes);
|
|
189
197
|
var variantSelectors = ["menu", "radio", "button"];
|
|
@@ -273,87 +281,20 @@ var CheckoutExtension = import_zod2.z.looseObject({
|
|
|
273
281
|
});
|
|
274
282
|
|
|
275
283
|
// src/schema/widgets/contentBlock.ts
|
|
276
|
-
var
|
|
284
|
+
var import_zod24 = require("zod");
|
|
277
285
|
|
|
278
286
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
279
|
-
var
|
|
287
|
+
var import_zod23 = require("zod");
|
|
280
288
|
|
|
281
289
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
282
290
|
var import_uuid12 = require("uuid");
|
|
283
|
-
var
|
|
284
|
-
|
|
285
|
-
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
286
|
-
var import_zod3 = require("zod");
|
|
287
|
-
var ruleTypes = [
|
|
288
|
-
"cart",
|
|
289
|
-
"cart_count",
|
|
290
|
-
"cart_item_count",
|
|
291
|
-
"cart_line_count",
|
|
292
|
-
"cart_subtotal",
|
|
293
|
-
"collection",
|
|
294
|
-
"customer",
|
|
295
|
-
"customer_order_count",
|
|
296
|
-
"customer_tag",
|
|
297
|
-
"customer_total_spent",
|
|
298
|
-
"date",
|
|
299
|
-
"product",
|
|
300
|
-
"product_tag",
|
|
301
|
-
"product_title",
|
|
302
|
-
"product_type",
|
|
303
|
-
"product_vendor"
|
|
304
|
-
];
|
|
305
|
-
var ruleType = import_zod3.z.enum(ruleTypes);
|
|
306
|
-
var RuleType = ruleType.enum;
|
|
307
|
-
var ruleOperators = [
|
|
308
|
-
"after",
|
|
309
|
-
"anything",
|
|
310
|
-
"before",
|
|
311
|
-
"contains",
|
|
312
|
-
"contains_any",
|
|
313
|
-
"does_not_contain",
|
|
314
|
-
"does_not_contain_any",
|
|
315
|
-
"equals",
|
|
316
|
-
"does_not_equal",
|
|
317
|
-
"greater_than",
|
|
318
|
-
"less_than"
|
|
319
|
-
];
|
|
320
|
-
var ruleOperator = import_zod3.z.enum(ruleOperators);
|
|
321
|
-
var RuleOperator = ruleOperator.enum;
|
|
322
|
-
var RuleCondition = import_zod3.z.object({
|
|
323
|
-
operator: import_zod3.z.enum(ruleOperators).default(RuleOperator.anything),
|
|
324
|
-
products: import_zod3.z.union([import_zod3.z.array(import_zod3.z.unknown()), import_zod3.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
325
|
-
type: import_zod3.z.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
326
|
-
value: import_zod3.z.coerce.string().default("")
|
|
327
|
-
});
|
|
328
|
-
var RuleLogicBlock = import_zod3.z.object({
|
|
329
|
-
rules: import_zod3.z.array(RuleCondition).default(() => [])
|
|
330
|
-
});
|
|
331
|
-
var CABRule = import_zod3.z.object({
|
|
332
|
-
dataSourceId: import_zod3.z.number().nullable().default(null),
|
|
333
|
-
enabled: import_zod3.z.boolean().default(false),
|
|
334
|
-
ruleset: import_zod3.z.union([
|
|
335
|
-
import_zod3.z.array(
|
|
336
|
-
import_zod3.z.object({
|
|
337
|
-
exitIfMatched: import_zod3.z.boolean().default(true),
|
|
338
|
-
logic: import_zod3.z.array(RuleLogicBlock).default(() => []),
|
|
339
|
-
output: import_zod3.z.array(
|
|
340
|
-
import_zod3.z.object({
|
|
341
|
-
key: import_zod3.z.string().default("should_show"),
|
|
342
|
-
type: import_zod3.z.literal("data_json").default("data_json"),
|
|
343
|
-
value: import_zod3.z.string().default("true")
|
|
344
|
-
})
|
|
345
|
-
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
346
|
-
})
|
|
347
|
-
),
|
|
348
|
-
import_zod3.z.strictObject({}).transform(() => [])
|
|
349
|
-
]).default(() => [])
|
|
350
|
-
});
|
|
291
|
+
var import_zod22 = require("zod");
|
|
351
292
|
|
|
352
293
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
353
|
-
var
|
|
294
|
+
var import_zod21 = require("zod");
|
|
354
295
|
|
|
355
296
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
356
|
-
var
|
|
297
|
+
var import_zod3 = require("zod");
|
|
357
298
|
|
|
358
299
|
// src/schema/widgets/checkout-and-beyond/utils.ts
|
|
359
300
|
var import_es_toolkit2 = require("es-toolkit");
|
|
@@ -402,11 +343,11 @@ var isTextType = isSectionType(SectionType.text);
|
|
|
402
343
|
var isVariantsType = isSectionType(SectionType.variants);
|
|
403
344
|
|
|
404
345
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
405
|
-
var CABBannerSection =
|
|
346
|
+
var CABBannerSection = import_zod3.z.lazy(
|
|
406
347
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
407
|
-
buttonField:
|
|
408
|
-
color:
|
|
409
|
-
dismissible:
|
|
348
|
+
buttonField: import_zod3.z.enum(buttonFields).optional(),
|
|
349
|
+
color: import_zod3.z.enum(bannerColors).default("info"),
|
|
350
|
+
dismissible: import_zod3.z.boolean().default(true),
|
|
410
351
|
/**
|
|
411
352
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
412
353
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -422,18 +363,18 @@ var CABBannerSection = import_zod4.z.lazy(
|
|
|
422
363
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
423
364
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
424
365
|
*/
|
|
425
|
-
heading:
|
|
426
|
-
sectionType:
|
|
366
|
+
heading: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
367
|
+
sectionType: import_zod3.z.literal(SectionType.banner).default(SectionType.banner)
|
|
427
368
|
})
|
|
428
369
|
);
|
|
429
370
|
|
|
430
371
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
431
372
|
var import_uuid3 = require("uuid");
|
|
432
|
-
var
|
|
373
|
+
var import_zod8 = require("zod");
|
|
433
374
|
|
|
434
375
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
435
376
|
var import_uuid = require("uuid");
|
|
436
|
-
var
|
|
377
|
+
var import_zod6 = require("zod");
|
|
437
378
|
|
|
438
379
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
439
380
|
var iconNames = [
|
|
@@ -519,17 +460,142 @@ var IconSize = freezeEnum(iconSizes);
|
|
|
519
460
|
var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "warning"];
|
|
520
461
|
var IconTone = freezeEnum(iconTones);
|
|
521
462
|
|
|
463
|
+
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
464
|
+
var import_zod5 = require("zod");
|
|
465
|
+
|
|
466
|
+
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
467
|
+
var import_zod4 = require("zod");
|
|
468
|
+
var ruleTypes = [
|
|
469
|
+
"cart",
|
|
470
|
+
"cart_count",
|
|
471
|
+
"cart_item_count",
|
|
472
|
+
"cart_line_count",
|
|
473
|
+
"cart_subtotal",
|
|
474
|
+
"collection",
|
|
475
|
+
"customer",
|
|
476
|
+
"customer_order_count",
|
|
477
|
+
"customer_tag",
|
|
478
|
+
"customer_total_spent",
|
|
479
|
+
"date",
|
|
480
|
+
"product",
|
|
481
|
+
"product_tag",
|
|
482
|
+
"product_title",
|
|
483
|
+
"product_type",
|
|
484
|
+
"product_vendor"
|
|
485
|
+
];
|
|
486
|
+
var ruleType = import_zod4.z.enum(ruleTypes);
|
|
487
|
+
var RuleType = ruleType.enum;
|
|
488
|
+
var ruleOperators = [
|
|
489
|
+
"after",
|
|
490
|
+
"anything",
|
|
491
|
+
"before",
|
|
492
|
+
"contains",
|
|
493
|
+
"contains_any",
|
|
494
|
+
"does_not_contain",
|
|
495
|
+
"does_not_contain_any",
|
|
496
|
+
"equals",
|
|
497
|
+
"does_not_equal",
|
|
498
|
+
"greater_than",
|
|
499
|
+
"less_than"
|
|
500
|
+
];
|
|
501
|
+
var ruleOperator = import_zod4.z.enum(ruleOperators);
|
|
502
|
+
var RuleOperator = ruleOperator.enum;
|
|
503
|
+
var RuleCondition = import_zod4.z.object({
|
|
504
|
+
operator: import_zod4.z.enum(ruleOperators).default(RuleOperator.anything),
|
|
505
|
+
products: import_zod4.z.union([import_zod4.z.array(import_zod4.z.unknown()), import_zod4.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
506
|
+
type: import_zod4.z.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
507
|
+
value: import_zod4.z.coerce.string().default("")
|
|
508
|
+
});
|
|
509
|
+
var RuleLogicBlock = import_zod4.z.object({
|
|
510
|
+
rules: import_zod4.z.array(RuleCondition).default(() => [])
|
|
511
|
+
});
|
|
512
|
+
var CABRulesetEntry = import_zod4.z.object({
|
|
513
|
+
exitIfMatched: import_zod4.z.boolean().default(true),
|
|
514
|
+
logic: import_zod4.z.array(RuleLogicBlock).default(() => []),
|
|
515
|
+
output: import_zod4.z.array(
|
|
516
|
+
import_zod4.z.object({
|
|
517
|
+
key: import_zod4.z.string().default("should_show"),
|
|
518
|
+
type: import_zod4.z.literal("data_json").default("data_json"),
|
|
519
|
+
value: import_zod4.z.string().default("true")
|
|
520
|
+
})
|
|
521
|
+
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
522
|
+
});
|
|
523
|
+
var CABRuleset = import_zod4.z.union([import_zod4.z.array(CABRulesetEntry), import_zod4.z.strictObject({}).transform(() => [])]).default(() => []);
|
|
524
|
+
|
|
525
|
+
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
526
|
+
var variableEffect = import_zod5.z.enum(variableEffects);
|
|
527
|
+
var CABVariableSeed = import_zod5.z.object({
|
|
528
|
+
dataSourceId: import_zod5.z.number().nullable().default(null),
|
|
529
|
+
ruleset: CABRuleset
|
|
530
|
+
});
|
|
531
|
+
var CABVariable = import_zod5.z.object({
|
|
532
|
+
/**
|
|
533
|
+
* Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
|
|
534
|
+
* from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
|
|
535
|
+
* below; a cross-field default has no `.default()` spelling. An explicit value always wins.
|
|
536
|
+
*/
|
|
537
|
+
defaultValue: import_zod5.z.boolean().optional(),
|
|
538
|
+
name: import_zod5.z.string().min(1),
|
|
539
|
+
seed: CABVariableSeed.optional()
|
|
540
|
+
}).transform(({ defaultValue, ...variable }) => ({
|
|
541
|
+
defaultValue: defaultValue ?? variable.seed === void 0,
|
|
542
|
+
...variable
|
|
543
|
+
}));
|
|
544
|
+
var CABVariableEffect = import_zod5.z.object({
|
|
545
|
+
effect: variableEffect.default(VariableEffect.toggle),
|
|
546
|
+
variable: import_zod5.z.string().min(1)
|
|
547
|
+
});
|
|
548
|
+
var CABVisibility = import_zod5.z.object({
|
|
549
|
+
variable: import_zod5.z.string().min(1),
|
|
550
|
+
visibleWhen: import_zod5.z.boolean().default(true)
|
|
551
|
+
});
|
|
552
|
+
var resultCountOperator = import_zod5.z.enum(resultCountOperators);
|
|
553
|
+
var resultTagOperator = import_zod5.z.enum(resultTagOperators);
|
|
554
|
+
var mutatorEvent = import_zod5.z.enum(mutatorEvents);
|
|
555
|
+
var CABResultCountTrigger = import_zod5.z.object({
|
|
556
|
+
operator: resultCountOperator.default(ResultCountOperator.equals),
|
|
557
|
+
type: import_zod5.z.literal("result_count"),
|
|
558
|
+
value: import_zod5.z.number().default(0)
|
|
559
|
+
});
|
|
560
|
+
var CABResultTagTrigger = import_zod5.z.object({
|
|
561
|
+
operator: resultTagOperator.default(ResultTagOperator.contains),
|
|
562
|
+
type: import_zod5.z.literal("result_tag"),
|
|
563
|
+
value: import_zod5.z.string().min(1)
|
|
564
|
+
});
|
|
565
|
+
var CABEventTrigger = import_zod5.z.object({
|
|
566
|
+
event: mutatorEvent,
|
|
567
|
+
type: import_zod5.z.literal("event")
|
|
568
|
+
});
|
|
569
|
+
var CABVariableTrigger = import_zod5.z.discriminatedUnion("type", [
|
|
570
|
+
CABEventTrigger,
|
|
571
|
+
CABResultCountTrigger,
|
|
572
|
+
CABResultTagTrigger
|
|
573
|
+
]);
|
|
574
|
+
var CABVariableMutator = import_zod5.z.object({
|
|
575
|
+
effect: variableEffect.default(VariableEffect.set_false),
|
|
576
|
+
variable: import_zod5.z.string().min(1),
|
|
577
|
+
when: CABVariableTrigger
|
|
578
|
+
});
|
|
579
|
+
var CABVariableFields = {
|
|
580
|
+
mutators: import_zod5.z.array(CABVariableMutator).optional(),
|
|
581
|
+
variables: import_zod5.z.array(CABVariable).refine((variables) => new Set(variables.map(({ name }) => name)).size === variables.length, {
|
|
582
|
+
message: "variable names must be unique within a section"
|
|
583
|
+
}).optional(),
|
|
584
|
+
visibility: CABVisibility.optional()
|
|
585
|
+
};
|
|
586
|
+
|
|
522
587
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
523
|
-
var CABImageSectionFields =
|
|
524
|
-
|
|
588
|
+
var CABImageSectionFields = import_zod6.z.object({
|
|
589
|
+
...CABVariableFields,
|
|
590
|
+
altText: import_zod6.z.string().refine(checkForHTML, NO_HTML).default(""),
|
|
525
591
|
/**
|
|
526
592
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
527
593
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
528
594
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
529
595
|
*/
|
|
530
|
-
aspectRatio:
|
|
531
|
-
border:
|
|
532
|
-
buttonField:
|
|
596
|
+
aspectRatio: import_zod6.z.number().positive().nullable().default(null),
|
|
597
|
+
border: import_zod6.z.lazy(() => CABBorder),
|
|
598
|
+
buttonField: import_zod6.z.enum(buttonFields).optional(),
|
|
533
599
|
/**
|
|
534
600
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
535
601
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -548,30 +614,29 @@ var CABImageSectionFields = import_zod5.z.object({
|
|
|
548
614
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
549
615
|
* the risky half.
|
|
550
616
|
*/
|
|
551
|
-
category:
|
|
617
|
+
category: import_zod6.z.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
552
618
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
553
|
-
iconSize:
|
|
619
|
+
iconSize: import_zod6.z.enum(iconSizes).nullable().default(null),
|
|
554
620
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
555
|
-
iconTone:
|
|
556
|
-
name:
|
|
557
|
-
naturalHeight:
|
|
558
|
-
naturalWidth:
|
|
621
|
+
iconTone: import_zod6.z.enum(iconTones).nullable().default(null),
|
|
622
|
+
name: import_zod6.z.string().optional(),
|
|
623
|
+
naturalHeight: import_zod6.z.number().default(0),
|
|
624
|
+
naturalWidth: import_zod6.z.number().default(0),
|
|
559
625
|
/**
|
|
560
626
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
561
627
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
562
628
|
*/
|
|
563
|
-
objectFit:
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
sectionType: import_zod5.z.literal(SectionType.image).default(SectionType.image),
|
|
629
|
+
objectFit: import_zod6.z.enum(objectFits).default(ObjectFit.contain),
|
|
630
|
+
sectionId: import_zod6.z.uuid().default(() => (0, import_uuid.v7)()),
|
|
631
|
+
sectionType: import_zod6.z.literal(SectionType.image).default(SectionType.image),
|
|
567
632
|
/**
|
|
568
633
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
569
634
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
570
635
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
571
636
|
* server-chosen tier icon actually needs it.
|
|
572
637
|
*/
|
|
573
|
-
source:
|
|
574
|
-
width:
|
|
638
|
+
source: import_zod6.z.union([import_zod6.z.url(), import_zod6.z.literal(""), import_zod6.z.string().regex(DYNAMIC_TOKEN_REGEX), import_zod6.z.enum(iconNames)]).default(""),
|
|
639
|
+
width: import_zod6.z.number().default(100)
|
|
575
640
|
});
|
|
576
641
|
var iconNameSet = new Set(iconNames);
|
|
577
642
|
var isIconName = (source) => iconNameSet.has(source);
|
|
@@ -593,71 +658,71 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, c
|
|
|
593
658
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
594
659
|
var import_compat2 = require("es-toolkit/compat");
|
|
595
660
|
var import_uuid2 = require("uuid");
|
|
596
|
-
var
|
|
597
|
-
var enumOrOmit = (...vals) =>
|
|
598
|
-
var TiptapText =
|
|
599
|
-
marks:
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
attrs:
|
|
606
|
-
class:
|
|
607
|
-
href:
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
661
|
+
var import_zod7 = require("zod");
|
|
662
|
+
var enumOrOmit = (...vals) => import_zod7.z.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
663
|
+
var TiptapText = import_zod7.z.object({
|
|
664
|
+
marks: import_zod7.z.union([
|
|
665
|
+
import_zod7.z.array(
|
|
666
|
+
import_zod7.z.discriminatedUnion("type", [
|
|
667
|
+
import_zod7.z.object({ type: import_zod7.z.literal("bold") }),
|
|
668
|
+
import_zod7.z.object({ type: import_zod7.z.literal("italic") }),
|
|
669
|
+
import_zod7.z.object({
|
|
670
|
+
attrs: import_zod7.z.object({
|
|
671
|
+
class: import_zod7.z.string().nullable(),
|
|
672
|
+
href: import_zod7.z.union([
|
|
673
|
+
import_zod7.z.url(),
|
|
674
|
+
import_zod7.z.literal("#"),
|
|
675
|
+
import_zod7.z.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
676
|
+
import_zod7.z.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
612
677
|
]),
|
|
613
|
-
rel:
|
|
614
|
-
target:
|
|
678
|
+
rel: import_zod7.z.string().default("noopener noreferrer nofollow"),
|
|
679
|
+
target: import_zod7.z.string().default("_blank")
|
|
615
680
|
}),
|
|
616
|
-
type:
|
|
681
|
+
type: import_zod7.z.literal("link")
|
|
617
682
|
}),
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
attrs:
|
|
683
|
+
import_zod7.z.object({ type: import_zod7.z.literal("strike") }),
|
|
684
|
+
import_zod7.z.object({
|
|
685
|
+
attrs: import_zod7.z.object({
|
|
621
686
|
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
622
687
|
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
623
688
|
}),
|
|
624
|
-
type:
|
|
689
|
+
type: import_zod7.z.literal("textStyle")
|
|
625
690
|
})
|
|
626
691
|
])
|
|
627
692
|
),
|
|
628
|
-
|
|
693
|
+
import_zod7.z.strictObject({}).transform(() => [])
|
|
629
694
|
]).optional(),
|
|
630
|
-
text:
|
|
631
|
-
type:
|
|
695
|
+
text: import_zod7.z.string().default(""),
|
|
696
|
+
type: import_zod7.z.literal("text").default("text")
|
|
632
697
|
});
|
|
633
|
-
var TiptapParagraph =
|
|
634
|
-
attrs:
|
|
698
|
+
var TiptapParagraph = import_zod7.z.object({
|
|
699
|
+
attrs: import_zod7.z.object({
|
|
635
700
|
textAlign: enumOrOmit(...textAlignments)
|
|
636
701
|
}).default({ textAlign: TextAlignment.start }),
|
|
637
|
-
content:
|
|
638
|
-
type:
|
|
702
|
+
content: import_zod7.z.union([import_zod7.z.array(TiptapText), import_zod7.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
703
|
+
type: import_zod7.z.literal("paragraph").default("paragraph")
|
|
639
704
|
});
|
|
640
|
-
var TiptapDocument =
|
|
641
|
-
attrs:
|
|
705
|
+
var TiptapDocument = import_zod7.z.object({
|
|
706
|
+
attrs: import_zod7.z.object({
|
|
642
707
|
blockSpacing: enumOrOmit(...spacings)
|
|
643
708
|
}).default({ blockSpacing: Spacing.base }),
|
|
644
|
-
content:
|
|
645
|
-
type:
|
|
709
|
+
content: import_zod7.z.union([import_zod7.z.array(TiptapParagraph), import_zod7.z.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
710
|
+
type: import_zod7.z.literal("doc").default("doc")
|
|
646
711
|
});
|
|
647
|
-
var CABTextTier =
|
|
648
|
-
threshold:
|
|
649
|
-
thresholds:
|
|
650
|
-
tierId:
|
|
651
|
-
tierType:
|
|
712
|
+
var CABTextTier = import_zod7.z.object({
|
|
713
|
+
threshold: import_zod7.z.number().int().nonnegative(),
|
|
714
|
+
thresholds: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.number().int().nonnegative()).default(() => ({})),
|
|
715
|
+
tierId: import_zod7.z.string().optional(),
|
|
716
|
+
tierType: import_zod7.z.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
652
717
|
});
|
|
653
|
-
var CABTextSection =
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
sectionId:
|
|
660
|
-
sectionType:
|
|
718
|
+
var CABTextSection = import_zod7.z.object({
|
|
719
|
+
...CABVariableFields,
|
|
720
|
+
buttonField: import_zod7.z.enum(buttonFields).optional(),
|
|
721
|
+
content: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.union([import_zod7.z.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
722
|
+
name: import_zod7.z.string().optional(),
|
|
723
|
+
optionId: import_zod7.z.number().optional(),
|
|
724
|
+
sectionId: import_zod7.z.uuid().default(() => (0, import_uuid2.v7)()),
|
|
725
|
+
sectionType: import_zod7.z.literal(SectionType.text).default(SectionType.text),
|
|
661
726
|
tier: CABTextTier.optional()
|
|
662
727
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
663
728
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
@@ -679,35 +744,35 @@ var CABTextSection = import_zod6.z.object({
|
|
|
679
744
|
});
|
|
680
745
|
|
|
681
746
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
682
|
-
var CABButtonContent =
|
|
683
|
-
() =>
|
|
747
|
+
var CABButtonContent = import_zod8.z.lazy(
|
|
748
|
+
() => import_zod8.z.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
684
749
|
);
|
|
685
|
-
var CABButtonSection =
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
750
|
+
var CABButtonSection = import_zod8.z.object({
|
|
751
|
+
...CABVariableFields,
|
|
752
|
+
action: import_zod8.z.union([import_zod8.z.literal(""), import_zod8.z.enum(buttonActions)]).default(""),
|
|
753
|
+
buttonStyle: import_zod8.z.enum(buttonStyles).default(ButtonStyle.primary),
|
|
754
|
+
custom: import_zod8.z.object({
|
|
755
|
+
color: import_zod8.z.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
756
|
+
height: import_zod8.z.number().default(52),
|
|
757
|
+
width: import_zod8.z.number().default(300)
|
|
692
758
|
}).default({
|
|
693
759
|
color: "#005bd3",
|
|
694
760
|
height: 52,
|
|
695
761
|
width: 300
|
|
696
762
|
}),
|
|
697
|
-
disableDowngrade:
|
|
698
|
-
name:
|
|
699
|
-
optionId:
|
|
700
|
-
popover:
|
|
701
|
-
alignment:
|
|
702
|
-
position:
|
|
763
|
+
disableDowngrade: import_zod8.z.boolean().default(false),
|
|
764
|
+
name: import_zod8.z.string().optional(),
|
|
765
|
+
optionId: import_zod8.z.number().optional(),
|
|
766
|
+
popover: import_zod8.z.object({
|
|
767
|
+
alignment: import_zod8.z.enum(textAlignments).default(TextAlignment.center),
|
|
768
|
+
position: import_zod8.z.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
703
769
|
}).optional().default(() => ({
|
|
704
770
|
alignment: TextAlignment.center,
|
|
705
771
|
position: PopoverPosition.blockStart
|
|
706
772
|
})),
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
sectionType: import_zod7.z.literal(SectionType.button).default(SectionType.button),
|
|
773
|
+
sectionId: import_zod8.z.uuid().default(() => (0, import_uuid3.v7)()),
|
|
774
|
+
sections: import_zod8.z.union([import_zod8.z.array(CABButtonContent), import_zod8.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
775
|
+
sectionType: import_zod8.z.literal(SectionType.button).default(SectionType.button),
|
|
711
776
|
/**
|
|
712
777
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
713
778
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -722,86 +787,93 @@ var CABButtonSection = import_zod7.z.object({
|
|
|
722
787
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
723
788
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
724
789
|
*/
|
|
725
|
-
tier:
|
|
790
|
+
tier: import_zod8.z.object({ tierId: import_zod8.z.string().min(1) }).optional(),
|
|
726
791
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
727
|
-
trackingUrl:
|
|
792
|
+
trackingUrl: import_zod8.z.string().optional(),
|
|
793
|
+
/**
|
|
794
|
+
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
795
|
+
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
796
|
+
*/
|
|
797
|
+
variableEffects: import_zod8.z.array(CABVariableEffect).optional()
|
|
728
798
|
});
|
|
729
799
|
|
|
730
800
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
731
|
-
var
|
|
801
|
+
var import_zod13 = require("zod");
|
|
732
802
|
|
|
733
803
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
734
|
-
var
|
|
804
|
+
var import_zod12 = require("zod");
|
|
735
805
|
|
|
736
806
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
737
807
|
var import_uuid4 = require("uuid");
|
|
738
|
-
var
|
|
739
|
-
var CABDiscount =
|
|
740
|
-
amount:
|
|
741
|
-
discountedBy:
|
|
742
|
-
discountedFrom:
|
|
743
|
-
type:
|
|
808
|
+
var import_zod9 = require("zod");
|
|
809
|
+
var CABDiscount = import_zod9.z.object({
|
|
810
|
+
amount: import_zod9.z.union([import_zod9.z.number(), import_zod9.z.string()]).catch(0),
|
|
811
|
+
discountedBy: import_zod9.z.string().optional(),
|
|
812
|
+
discountedFrom: import_zod9.z.enum(discountSources).optional().catch(void 0),
|
|
813
|
+
type: import_zod9.z.enum(discountTypes).catch("none")
|
|
744
814
|
});
|
|
745
|
-
var CABIntegrations =
|
|
746
|
-
judgeme:
|
|
747
|
-
junip:
|
|
748
|
-
klaviyo:
|
|
749
|
-
loox:
|
|
750
|
-
okendo:
|
|
751
|
-
opinew:
|
|
752
|
-
reviewsio:
|
|
753
|
-
stamped:
|
|
754
|
-
yotpo:
|
|
815
|
+
var CABIntegrations = import_zod9.z.object({
|
|
816
|
+
judgeme: import_zod9.z.boolean().default(false),
|
|
817
|
+
junip: import_zod9.z.boolean().default(false),
|
|
818
|
+
klaviyo: import_zod9.z.boolean().default(false),
|
|
819
|
+
loox: import_zod9.z.boolean().default(false),
|
|
820
|
+
okendo: import_zod9.z.boolean().default(false),
|
|
821
|
+
opinew: import_zod9.z.boolean().default(false),
|
|
822
|
+
reviewsio: import_zod9.z.boolean().default(false),
|
|
823
|
+
stamped: import_zod9.z.boolean().default(false),
|
|
824
|
+
yotpo: import_zod9.z.boolean().default(false)
|
|
755
825
|
});
|
|
756
|
-
var CABDataSourceSection =
|
|
757
|
-
dataSourceId:
|
|
758
|
-
dataSourcePath:
|
|
826
|
+
var CABDataSourceSection = import_zod9.z.object({
|
|
827
|
+
dataSourceId: import_zod9.z.number().nullable().default(null),
|
|
828
|
+
dataSourcePath: import_zod9.z.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
759
829
|
discount: CABDiscount.optional(),
|
|
760
830
|
integrations: CABIntegrations.optional(),
|
|
761
|
-
limit:
|
|
762
|
-
matchVariant:
|
|
763
|
-
matchVariantOutOfStock:
|
|
764
|
-
name:
|
|
765
|
-
productType:
|
|
766
|
-
sectionId:
|
|
767
|
-
sectionType:
|
|
831
|
+
limit: import_zod9.z.number().default(1),
|
|
832
|
+
matchVariant: import_zod9.z.boolean().default(false),
|
|
833
|
+
matchVariantOutOfStock: import_zod9.z.boolean().default(false),
|
|
834
|
+
name: import_zod9.z.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
835
|
+
productType: import_zod9.z.enum(productTypes).optional(),
|
|
836
|
+
sectionId: import_zod9.z.uuid().default(() => (0, import_uuid4.v7)()),
|
|
837
|
+
sectionType: import_zod9.z.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
768
838
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
769
|
-
subscriptionIsDefault:
|
|
770
|
-
treatAsGwp:
|
|
839
|
+
subscriptionIsDefault: import_zod9.z.boolean().default(false),
|
|
840
|
+
treatAsGwp: import_zod9.z.boolean().default(false)
|
|
771
841
|
});
|
|
772
842
|
|
|
773
843
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
774
844
|
var import_uuid6 = require("uuid");
|
|
775
|
-
var
|
|
845
|
+
var import_zod11 = require("zod");
|
|
776
846
|
|
|
777
847
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
778
848
|
var import_uuid5 = require("uuid");
|
|
779
|
-
var
|
|
780
|
-
var CABVariantContent =
|
|
781
|
-
() =>
|
|
849
|
+
var import_zod10 = require("zod");
|
|
850
|
+
var CABVariantContent = import_zod10.z.lazy(
|
|
851
|
+
() => import_zod10.z.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
782
852
|
);
|
|
783
|
-
var CABProductSection =
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
853
|
+
var CABProductSection = import_zod10.z.object({
|
|
854
|
+
...CABVariableFields,
|
|
855
|
+
name: import_zod10.z.string().optional(),
|
|
856
|
+
productId: import_zod10.z.number().nullable().default(null),
|
|
857
|
+
sectionId: import_zod10.z.uuid().default(() => (0, import_uuid5.v7)()),
|
|
858
|
+
sections: import_zod10.z.union([import_zod10.z.array(CABVariantContent), import_zod10.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
859
|
+
sectionType: import_zod10.z.literal(SectionType.product).default(SectionType.product),
|
|
860
|
+
selectors: import_zod10.z.record(import_zod10.z.string(), import_zod10.z.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
861
|
+
variantMode: import_zod10.z.enum(variantModes).default(VariantMode.multiple)
|
|
791
862
|
});
|
|
792
863
|
|
|
793
864
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
794
|
-
var CABProductsSection =
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
865
|
+
var CABProductsSection = import_zod11.z.object({
|
|
866
|
+
...CABVariableFields,
|
|
867
|
+
name: import_zod11.z.string().optional(),
|
|
868
|
+
sectionId: import_zod11.z.uuid().default(() => (0, import_uuid6.v7)()),
|
|
869
|
+
sections: import_zod11.z.union([import_zod11.z.array(import_zod11.z.lazy(() => CABProductSection)), import_zod11.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
870
|
+
sectionType: import_zod11.z.literal(SectionType.products).default(SectionType.products)
|
|
799
871
|
});
|
|
800
872
|
|
|
801
873
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
802
|
-
var CABOffersSection =
|
|
874
|
+
var CABOffersSection = import_zod12.z.lazy(
|
|
803
875
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
804
|
-
sections:
|
|
876
|
+
sections: import_zod12.z.union([import_zod12.z.array(import_zod12.z.lazy(() => CABSection)), import_zod12.z.strictObject({}).transform(() => [])]).default(() => [
|
|
805
877
|
CABBannerSection.parse({
|
|
806
878
|
buttonField: "undoAddToOrder",
|
|
807
879
|
color: "success",
|
|
@@ -815,64 +887,65 @@ var CABOffersSection = import_zod11.z.lazy(
|
|
|
815
887
|
CABDataSourceSection.parse({}),
|
|
816
888
|
CABProductsSection.parse({})
|
|
817
889
|
]),
|
|
818
|
-
sectionType:
|
|
890
|
+
sectionType: import_zod12.z.literal(SectionType.offers).default(SectionType.offers)
|
|
819
891
|
})
|
|
820
892
|
);
|
|
821
893
|
|
|
822
894
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
823
|
-
var CABCarouselSection =
|
|
895
|
+
var CABCarouselSection = import_zod13.z.lazy(
|
|
824
896
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
825
|
-
autoAdvanceInterval:
|
|
826
|
-
itemsAtOnce:
|
|
897
|
+
autoAdvanceInterval: import_zod13.z.number().default(0),
|
|
898
|
+
itemsAtOnce: import_zod13.z.number().min(1).default(1),
|
|
827
899
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
828
|
-
offersDirection:
|
|
829
|
-
sections:
|
|
830
|
-
sectionType:
|
|
900
|
+
offersDirection: import_zod13.z.enum(offersDirections).default("vertical"),
|
|
901
|
+
sections: import_zod13.z.union([import_zod13.z.array(import_zod13.z.lazy(() => CABSection)), import_zod13.z.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
902
|
+
sectionType: import_zod13.z.literal(SectionType.carousel).default(SectionType.carousel)
|
|
831
903
|
})
|
|
832
904
|
);
|
|
833
905
|
|
|
834
906
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
835
|
-
var
|
|
836
|
-
var CABCartLineSection =
|
|
907
|
+
var import_zod14 = require("zod");
|
|
908
|
+
var CABCartLineSection = import_zod14.z.lazy(
|
|
837
909
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
838
|
-
sections:
|
|
839
|
-
sectionType:
|
|
910
|
+
sections: import_zod14.z.union([import_zod14.z.array(import_zod14.z.lazy(() => CABSection)), import_zod14.z.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
911
|
+
sectionType: import_zod14.z.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
840
912
|
})
|
|
841
913
|
);
|
|
842
914
|
|
|
843
915
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
844
916
|
var import_uuid7 = require("uuid");
|
|
845
|
-
var
|
|
846
|
-
var CABDiscountSection =
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
917
|
+
var import_zod15 = require("zod");
|
|
918
|
+
var CABDiscountSection = import_zod15.z.object({
|
|
919
|
+
...CABVariableFields,
|
|
920
|
+
amount: import_zod15.z.union([import_zod15.z.number(), import_zod15.z.string()]).catch(0),
|
|
921
|
+
discountedBy: import_zod15.z.string().optional(),
|
|
922
|
+
discountedFrom: import_zod15.z.enum(discountSources).optional().catch(void 0),
|
|
923
|
+
message: import_zod15.z.string().optional(),
|
|
924
|
+
name: import_zod15.z.string().optional(),
|
|
925
|
+
quantity: import_zod15.z.number().default(1),
|
|
926
|
+
sectionId: import_zod15.z.uuid().default(() => (0, import_uuid7.v7)()),
|
|
927
|
+
sectionType: import_zod15.z.literal(SectionType.discount).default(SectionType.discount),
|
|
928
|
+
type: import_zod15.z.enum(discountTypes).catch("none")
|
|
856
929
|
});
|
|
857
930
|
|
|
858
931
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
859
932
|
var import_uuid8 = require("uuid");
|
|
860
|
-
var
|
|
861
|
-
var CABMonetizeSection =
|
|
862
|
-
|
|
933
|
+
var import_zod16 = require("zod");
|
|
934
|
+
var CABMonetizeSection = import_zod16.z.object({
|
|
935
|
+
...CABVariableFields,
|
|
936
|
+
name: import_zod16.z.string().optional(),
|
|
863
937
|
/** Privacy Policy footer href (the widget's `privacy_policy_url` setting); the client relays it to `/cab/monetize`. */
|
|
864
|
-
privacyPolicyUrl:
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
sectionType: import_zod15.z.literal(SectionType.monetize).default(SectionType.monetize),
|
|
938
|
+
privacyPolicyUrl: import_zod16.z.string().optional(),
|
|
939
|
+
sectionId: import_zod16.z.uuid().default(() => (0, import_uuid8.v7)()),
|
|
940
|
+
sectionType: import_zod16.z.literal(SectionType.monetize).default(SectionType.monetize),
|
|
868
941
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
869
|
-
subVertical:
|
|
942
|
+
subVertical: import_zod16.z.string().optional(),
|
|
870
943
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
871
|
-
vertical:
|
|
944
|
+
vertical: import_zod16.z.string().optional()
|
|
872
945
|
});
|
|
873
946
|
|
|
874
947
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
875
|
-
var
|
|
948
|
+
var import_zod17 = require("zod");
|
|
876
949
|
|
|
877
950
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
878
951
|
var GIFT_LABELS = {
|
|
@@ -991,21 +1064,21 @@ var GIFT_LABELS = {
|
|
|
991
1064
|
};
|
|
992
1065
|
|
|
993
1066
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
994
|
-
var CABProgressTier =
|
|
1067
|
+
var CABProgressTier = import_zod17.z.object({
|
|
995
1068
|
/**
|
|
996
1069
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
997
1070
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
998
1071
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
999
1072
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
1000
1073
|
*/
|
|
1001
|
-
discount:
|
|
1074
|
+
discount: import_zod17.z.object({ amount: import_zod17.z.number().nonnegative(), type: import_zod17.z.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
1002
1075
|
/**
|
|
1003
1076
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
1004
1077
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
1005
1078
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
1006
1079
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
1007
1080
|
*/
|
|
1008
|
-
filterOosVariants:
|
|
1081
|
+
filterOosVariants: import_zod17.z.boolean().default(false),
|
|
1009
1082
|
/**
|
|
1010
1083
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
1011
1084
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -1013,10 +1086,10 @@ var CABProgressTier = import_zod16.z.object({
|
|
|
1013
1086
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
1014
1087
|
* tree is complete.
|
|
1015
1088
|
*/
|
|
1016
|
-
gift:
|
|
1017
|
-
productId:
|
|
1018
|
-
title:
|
|
1019
|
-
variantIds:
|
|
1089
|
+
gift: import_zod17.z.object({
|
|
1090
|
+
productId: import_zod17.z.number().int().positive(),
|
|
1091
|
+
title: import_zod17.z.string().optional(),
|
|
1092
|
+
variantIds: import_zod17.z.array(import_zod17.z.number().int().positive()).default(() => [])
|
|
1020
1093
|
}).optional(),
|
|
1021
1094
|
/**
|
|
1022
1095
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
@@ -1027,35 +1100,35 @@ var CABProgressTier = import_zod16.z.object({
|
|
|
1027
1100
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
1028
1101
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
1029
1102
|
*/
|
|
1030
|
-
label:
|
|
1103
|
+
label: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.string()).optional(),
|
|
1031
1104
|
/**
|
|
1032
1105
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
1033
1106
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
1034
1107
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
1035
1108
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
1036
1109
|
*/
|
|
1037
|
-
productTierImage:
|
|
1110
|
+
productTierImage: import_zod17.z.boolean().default(false),
|
|
1038
1111
|
/**
|
|
1039
1112
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
1040
1113
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
1041
1114
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
1042
1115
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
1043
1116
|
*/
|
|
1044
|
-
threshold:
|
|
1117
|
+
threshold: import_zod17.z.number().int().nonnegative(),
|
|
1045
1118
|
/**
|
|
1046
1119
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
1047
1120
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
1048
1121
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
1049
1122
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
1050
1123
|
*/
|
|
1051
|
-
thresholds:
|
|
1124
|
+
thresholds: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.number().int().nonnegative()).default(() => ({})),
|
|
1052
1125
|
/**
|
|
1053
1126
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
1054
1127
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
1055
1128
|
* shipping bar (single unlabeled tier, no gift).
|
|
1056
1129
|
*/
|
|
1057
|
-
tierId:
|
|
1058
|
-
tierType:
|
|
1130
|
+
tierId: import_zod17.z.string().optional(),
|
|
1131
|
+
tierType: import_zod17.z.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
1059
1132
|
/**
|
|
1060
1133
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
1061
1134
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -1066,9 +1139,9 @@ var CABProgressTier = import_zod16.z.object({
|
|
|
1066
1139
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
1067
1140
|
* template text supplies grammatically-neutral wording around the token.
|
|
1068
1141
|
*/
|
|
1069
|
-
unit:
|
|
1142
|
+
unit: import_zod17.z.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
1070
1143
|
});
|
|
1071
|
-
var CABProgressBarSection =
|
|
1144
|
+
var CABProgressBarSection = import_zod17.z.lazy(
|
|
1072
1145
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1073
1146
|
/**
|
|
1074
1147
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -1077,35 +1150,35 @@ var CABProgressBarSection = import_zod16.z.lazy(
|
|
|
1077
1150
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
1078
1151
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
1079
1152
|
*/
|
|
1080
|
-
barId:
|
|
1153
|
+
barId: import_zod17.z.string().optional(),
|
|
1081
1154
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
1082
|
-
countryCodes:
|
|
1155
|
+
countryCodes: import_zod17.z.array(import_zod17.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1083
1156
|
/**
|
|
1084
1157
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
1085
1158
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
1086
1159
|
*/
|
|
1087
|
-
excludeCountryCodes:
|
|
1160
|
+
excludeCountryCodes: import_zod17.z.array(import_zod17.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1088
1161
|
/**
|
|
1089
1162
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
1090
1163
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
1091
1164
|
* adds the cart's discount allocations back to the live subtotal.
|
|
1092
1165
|
*/
|
|
1093
|
-
excludeDiscountInSubtotal:
|
|
1166
|
+
excludeDiscountInSubtotal: import_zod17.z.boolean().default(false),
|
|
1094
1167
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
1095
|
-
excludedVariantIds:
|
|
1168
|
+
excludedVariantIds: import_zod17.z.array(import_zod17.z.number().int().positive()).default(() => []),
|
|
1096
1169
|
/**
|
|
1097
1170
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
1098
1171
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
1099
1172
|
*/
|
|
1100
|
-
freeShippingOnSubscription:
|
|
1173
|
+
freeShippingOnSubscription: import_zod17.z.boolean().default(false),
|
|
1101
1174
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
1102
|
-
giftAreaTitle:
|
|
1175
|
+
giftAreaTitle: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
1103
1176
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
1104
|
-
giftLabels:
|
|
1105
|
-
addGift:
|
|
1106
|
-
remove:
|
|
1107
|
-
selectOptions:
|
|
1108
|
-
yourGift:
|
|
1177
|
+
giftLabels: import_zod17.z.object({
|
|
1178
|
+
addGift: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
1179
|
+
remove: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
1180
|
+
selectOptions: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
1181
|
+
yourGift: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
1109
1182
|
}).default(() => ({
|
|
1110
1183
|
addGift: { ...GIFT_LABELS.addGift },
|
|
1111
1184
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -1113,37 +1186,38 @@ var CABProgressBarSection = import_zod16.z.lazy(
|
|
|
1113
1186
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
1114
1187
|
})),
|
|
1115
1188
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
1116
|
-
name:
|
|
1189
|
+
name: import_zod17.z.string().default("Order progress"),
|
|
1117
1190
|
/**
|
|
1118
1191
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
1119
1192
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
1120
1193
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
1121
1194
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
1122
1195
|
*/
|
|
1123
|
-
progressColor:
|
|
1124
|
-
sectionType:
|
|
1196
|
+
progressColor: import_zod17.z.string().optional(),
|
|
1197
|
+
sectionType: import_zod17.z.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
1125
1198
|
/**
|
|
1126
1199
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
1127
1200
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
1128
1201
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
1129
1202
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
1130
1203
|
*/
|
|
1131
|
-
tiers:
|
|
1204
|
+
tiers: import_zod17.z.union([import_zod17.z.array(CABProgressTier), import_zod17.z.strictObject({}).transform(() => [])]).default(() => [])
|
|
1132
1205
|
})
|
|
1133
1206
|
);
|
|
1134
1207
|
|
|
1135
1208
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
1136
1209
|
var import_uuid9 = require("uuid");
|
|
1137
|
-
var
|
|
1138
|
-
var CABQuantitySection =
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1210
|
+
var import_zod18 = require("zod");
|
|
1211
|
+
var CABQuantitySection = import_zod18.z.object({
|
|
1212
|
+
...CABVariableFields,
|
|
1213
|
+
errorMessages: import_zod18.z.record(
|
|
1214
|
+
import_zod18.z.string(),
|
|
1215
|
+
import_zod18.z.object({
|
|
1142
1216
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
1143
|
-
increment:
|
|
1144
|
-
max:
|
|
1145
|
-
min:
|
|
1146
|
-
neg:
|
|
1217
|
+
increment: import_zod18.z.string().optional(),
|
|
1218
|
+
max: import_zod18.z.string().optional(),
|
|
1219
|
+
min: import_zod18.z.string().optional(),
|
|
1220
|
+
neg: import_zod18.z.string().optional()
|
|
1147
1221
|
})
|
|
1148
1222
|
).default({
|
|
1149
1223
|
en: {
|
|
@@ -1153,19 +1227,18 @@ var CABQuantitySection = import_zod17.z.object({
|
|
|
1153
1227
|
neg: "Quantity cannot be negative"
|
|
1154
1228
|
}
|
|
1155
1229
|
}),
|
|
1156
|
-
inputType:
|
|
1157
|
-
max:
|
|
1158
|
-
min:
|
|
1230
|
+
inputType: import_zod18.z.enum(quantityInputs).default(QuantityInput.select),
|
|
1231
|
+
max: import_zod18.z.number().min(1).max(100).default(10),
|
|
1232
|
+
min: import_zod18.z.number().min(1).default(1),
|
|
1159
1233
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
1160
|
-
name:
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
sectionType: import_zod17.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1234
|
+
name: import_zod18.z.string().default("Quantity"),
|
|
1235
|
+
sectionId: import_zod18.z.uuid().default(() => (0, import_uuid9.v7)()),
|
|
1236
|
+
sectionType: import_zod18.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1164
1237
|
});
|
|
1165
1238
|
|
|
1166
1239
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1167
1240
|
var import_uuid10 = require("uuid");
|
|
1168
|
-
var
|
|
1241
|
+
var import_zod19 = require("zod");
|
|
1169
1242
|
|
|
1170
1243
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
1171
1244
|
var REVIEW_LABELS = {
|
|
@@ -1228,50 +1301,50 @@ var REVIEW_LABELS = {
|
|
|
1228
1301
|
};
|
|
1229
1302
|
|
|
1230
1303
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1231
|
-
var CABReviewsSection =
|
|
1232
|
-
|
|
1304
|
+
var CABReviewsSection = import_zod19.z.object({
|
|
1305
|
+
...CABVariableFields,
|
|
1306
|
+
color: import_zod19.z.string().default("#fadb14"),
|
|
1233
1307
|
/**
|
|
1234
1308
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
1235
1309
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
1236
1310
|
* or merchant work.
|
|
1237
1311
|
*/
|
|
1238
|
-
countLabels:
|
|
1239
|
-
one:
|
|
1240
|
-
other:
|
|
1312
|
+
countLabels: import_zod19.z.object({
|
|
1313
|
+
one: import_zod19.z.record(import_zod19.z.string(), import_zod19.z.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
1314
|
+
other: import_zod19.z.record(import_zod19.z.string(), import_zod19.z.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
1241
1315
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
1242
|
-
name:
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
size: import_zod18.z.enum(reviewsSizes).default(ReviewsSize.default)
|
|
1316
|
+
name: import_zod19.z.string().optional(),
|
|
1317
|
+
sectionId: import_zod19.z.uuid().default(() => (0, import_uuid10.v7)()),
|
|
1318
|
+
sectionType: import_zod19.z.literal(SectionType.reviews).default(SectionType.reviews),
|
|
1319
|
+
size: import_zod19.z.enum(reviewsSizes).default(ReviewsSize.default)
|
|
1247
1320
|
});
|
|
1248
1321
|
|
|
1249
1322
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
1250
1323
|
var import_compat3 = require("es-toolkit/compat");
|
|
1251
1324
|
var import_uuid11 = require("uuid");
|
|
1252
|
-
var
|
|
1253
|
-
var CABVariantsSection =
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
sectionId:
|
|
1258
|
-
sectionType:
|
|
1259
|
-
selector:
|
|
1260
|
-
variantMode:
|
|
1325
|
+
var import_zod20 = require("zod");
|
|
1326
|
+
var CABVariantsSection = import_zod20.z.object({
|
|
1327
|
+
...CABVariableFields,
|
|
1328
|
+
hideOutOfStockVariants: import_zod20.z.boolean().default(false),
|
|
1329
|
+
name: import_zod20.z.string().optional(),
|
|
1330
|
+
sectionId: import_zod20.z.uuid().default(() => (0, import_uuid11.v7)()),
|
|
1331
|
+
sectionType: import_zod20.z.literal(SectionType.variants).default(SectionType.variants),
|
|
1332
|
+
selector: import_zod20.z.enum((0, import_compat3.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
1333
|
+
variantMode: import_zod20.z.enum(variantModes).default(VariantMode.multiple)
|
|
1261
1334
|
});
|
|
1262
1335
|
|
|
1263
1336
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
1264
|
-
var CABBorder =
|
|
1265
|
-
radius:
|
|
1266
|
-
style:
|
|
1267
|
-
width:
|
|
1337
|
+
var CABBorder = import_zod21.z.object({
|
|
1338
|
+
radius: import_zod21.z.enum(borderRadii).default(BorderRadius.base),
|
|
1339
|
+
style: import_zod21.z.enum(borderStyles).default(BorderStyle.none),
|
|
1340
|
+
width: import_zod21.z.enum(borderWidths).default(BorderWidth.base)
|
|
1268
1341
|
}).default({
|
|
1269
1342
|
radius: BorderRadius.base,
|
|
1270
1343
|
style: BorderStyle.none,
|
|
1271
1344
|
width: BorderWidth.base
|
|
1272
1345
|
});
|
|
1273
|
-
var CABSection =
|
|
1274
|
-
() =>
|
|
1346
|
+
var CABSection = import_zod21.z.lazy(
|
|
1347
|
+
() => import_zod21.z.discriminatedUnion("sectionType", [
|
|
1275
1348
|
CABBannerSection,
|
|
1276
1349
|
CABButtonSection,
|
|
1277
1350
|
CABCarouselSection,
|
|
@@ -1293,32 +1366,32 @@ var CABSection = import_zod20.z.lazy(
|
|
|
1293
1366
|
);
|
|
1294
1367
|
|
|
1295
1368
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
1296
|
-
var GridItem =
|
|
1297
|
-
var CABLayoutSection =
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1369
|
+
var GridItem = import_zod22.z.union([import_zod22.z.literal("auto"), import_zod22.z.literal("fill"), import_zod22.z.string().regex(/^\d+%$/), import_zod22.z.number()]);
|
|
1370
|
+
var CABLayoutSection = import_zod22.z.object({
|
|
1371
|
+
...CABVariableFields,
|
|
1372
|
+
alignment: import_zod22.z.object({
|
|
1373
|
+
horizontal: import_zod22.z.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
1374
|
+
vertical: import_zod22.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
1301
1375
|
}).default({
|
|
1302
1376
|
horizontal: HorizontalAlignment.start,
|
|
1303
1377
|
vertical: VerticalAlignment.top
|
|
1304
1378
|
}),
|
|
1305
|
-
border:
|
|
1306
|
-
buttonField:
|
|
1307
|
-
direction:
|
|
1308
|
-
grid:
|
|
1309
|
-
columns:
|
|
1310
|
-
rows:
|
|
1379
|
+
border: import_zod22.z.lazy(() => CABBorder),
|
|
1380
|
+
buttonField: import_zod22.z.enum(buttonFields).optional(),
|
|
1381
|
+
direction: import_zod22.z.enum(directions).default(Direction.rows),
|
|
1382
|
+
grid: import_zod22.z.object({
|
|
1383
|
+
columns: import_zod22.z.union([import_zod22.z.array(GridItem), import_zod22.z.undefined()]).default(() => ["auto"]),
|
|
1384
|
+
rows: import_zod22.z.union([import_zod22.z.array(GridItem), import_zod22.z.undefined()]).default(() => ["auto"])
|
|
1311
1385
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
1312
|
-
name:
|
|
1313
|
-
padding:
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
spacing: import_zod21.z.enum(spacings).default(Spacing.base),
|
|
1386
|
+
name: import_zod22.z.string().optional(),
|
|
1387
|
+
padding: import_zod22.z.enum(spacings).default(Spacing.none),
|
|
1388
|
+
sectionId: import_zod22.z.uuid().default(() => (0, import_uuid12.v7)()),
|
|
1389
|
+
sections: import_zod22.z.union([import_zod22.z.array(import_zod22.z.lazy(() => CABSection)), import_zod22.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
1390
|
+
sectionType: import_zod22.z.literal(SectionType.layout).default(SectionType.layout),
|
|
1391
|
+
spacing: import_zod22.z.enum(spacings).default(Spacing.base),
|
|
1319
1392
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
1320
|
-
viewUrl:
|
|
1321
|
-
width:
|
|
1393
|
+
viewUrl: import_zod22.z.string().optional(),
|
|
1394
|
+
width: import_zod22.z.number().default(100)
|
|
1322
1395
|
});
|
|
1323
1396
|
|
|
1324
1397
|
// src/schema/widgets/checkout-and-beyond/uiLabels.ts
|
|
@@ -1335,8 +1408,8 @@ var UI_LABELS = {
|
|
|
1335
1408
|
};
|
|
1336
1409
|
|
|
1337
1410
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1338
|
-
var localized = (fallback) =>
|
|
1339
|
-
var CABUILabels =
|
|
1411
|
+
var localized = (fallback) => import_zod23.z.record(import_zod23.z.string(), import_zod23.z.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
1412
|
+
var CABUILabels = import_zod23.z.object({
|
|
1340
1413
|
currentPage: localized(UI_LABELS.currentPage),
|
|
1341
1414
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
1342
1415
|
nextPage: localized(UI_LABELS.nextPage),
|
|
@@ -1357,154 +1430,154 @@ var CABUILabels = import_zod22.z.object({
|
|
|
1357
1430
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
1358
1431
|
updating: { ...UI_LABELS.updating }
|
|
1359
1432
|
}));
|
|
1360
|
-
var TargetArea =
|
|
1361
|
-
fill:
|
|
1362
|
-
flip:
|
|
1363
|
-
icon:
|
|
1364
|
-
label:
|
|
1365
|
-
width:
|
|
1433
|
+
var TargetArea = import_zod23.z.object({
|
|
1434
|
+
fill: import_zod23.z.boolean().optional(),
|
|
1435
|
+
flip: import_zod23.z.enum(["both", "horizontal", "vertical"]).optional(),
|
|
1436
|
+
icon: import_zod23.z.string(),
|
|
1437
|
+
label: import_zod23.z.string(),
|
|
1438
|
+
width: import_zod23.z.string()
|
|
1366
1439
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
1367
|
-
var CABTracking =
|
|
1368
|
-
enableAttribution:
|
|
1369
|
-
enableSource:
|
|
1370
|
-
enableWidget:
|
|
1440
|
+
var CABTracking = import_zod23.z.object({
|
|
1441
|
+
enableAttribution: import_zod23.z.boolean().nullish().transform((value) => value ?? true),
|
|
1442
|
+
enableSource: import_zod23.z.boolean().nullish().transform((value) => value ?? true),
|
|
1443
|
+
enableWidget: import_zod23.z.boolean().nullish().transform((value) => value ?? true)
|
|
1371
1444
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
1372
|
-
var CABExperiment =
|
|
1373
|
-
elementId:
|
|
1374
|
-
experimentId:
|
|
1375
|
-
experimentType:
|
|
1376
|
-
selectedId:
|
|
1445
|
+
var CABExperiment = import_zod23.z.object({
|
|
1446
|
+
elementId: import_zod23.z.number(),
|
|
1447
|
+
experimentId: import_zod23.z.number(),
|
|
1448
|
+
experimentType: import_zod23.z.string(),
|
|
1449
|
+
selectedId: import_zod23.z.number()
|
|
1377
1450
|
});
|
|
1378
1451
|
var CABRootSection = CABLayoutSection.extend({
|
|
1379
|
-
editorMode:
|
|
1452
|
+
editorMode: import_zod23.z.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
1380
1453
|
experiment: CABExperiment.optional(),
|
|
1381
1454
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
1382
1455
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
1383
|
-
previewMode:
|
|
1384
|
-
storeId:
|
|
1456
|
+
previewMode: import_zod23.z.boolean().nullish().transform((value) => value ?? false),
|
|
1457
|
+
storeId: import_zod23.z.number().nullable().default(null),
|
|
1385
1458
|
targetArea: TargetArea.nullable(),
|
|
1386
1459
|
tracking: CABTracking,
|
|
1387
|
-
type:
|
|
1460
|
+
type: import_zod23.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
1388
1461
|
uiLabels: CABUILabels,
|
|
1389
|
-
version:
|
|
1390
|
-
widgetId:
|
|
1462
|
+
version: import_zod23.z.literal(2).default(2),
|
|
1463
|
+
widgetId: import_zod23.z.number().nullable().default(null)
|
|
1391
1464
|
});
|
|
1392
1465
|
|
|
1393
1466
|
// src/schema/widgets/contentBlock.ts
|
|
1394
|
-
var ContentBlockV1 =
|
|
1395
|
-
blockSpacing:
|
|
1396
|
-
imageBlocks:
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
altText:
|
|
1400
|
-
description:
|
|
1401
|
-
id:
|
|
1402
|
-
imagePlacement:
|
|
1403
|
-
imageSize:
|
|
1404
|
-
imageUrl:
|
|
1405
|
-
textAlignment:
|
|
1467
|
+
var ContentBlockV1 = import_zod24.z.object({
|
|
1468
|
+
blockSpacing: import_zod24.z.enum(spacings).optional(),
|
|
1469
|
+
imageBlocks: import_zod24.z.union([
|
|
1470
|
+
import_zod24.z.array(
|
|
1471
|
+
import_zod24.z.object({
|
|
1472
|
+
altText: import_zod24.z.string().nullable(),
|
|
1473
|
+
description: import_zod24.z.string().nullable(),
|
|
1474
|
+
id: import_zod24.z.uuid(),
|
|
1475
|
+
imagePlacement: import_zod24.z.enum(["top", "right", "bottom", "left"]),
|
|
1476
|
+
imageSize: import_zod24.z.number(),
|
|
1477
|
+
imageUrl: import_zod24.z.url(),
|
|
1478
|
+
textAlignment: import_zod24.z.enum(["left", "center", "right"]),
|
|
1406
1479
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
1407
|
-
textSize:
|
|
1480
|
+
textSize: import_zod24.z.enum(inlineTextSizeNames)
|
|
1408
1481
|
})
|
|
1409
1482
|
),
|
|
1410
|
-
|
|
1483
|
+
import_zod24.z.strictObject({}).transform(() => [])
|
|
1411
1484
|
]).optional(),
|
|
1412
|
-
imageLayout:
|
|
1413
|
-
language:
|
|
1414
|
-
description:
|
|
1415
|
-
superTitle:
|
|
1416
|
-
title:
|
|
1485
|
+
imageLayout: import_zod24.z.enum(["row", "column"]).optional(),
|
|
1486
|
+
language: import_zod24.z.object({
|
|
1487
|
+
description: import_zod24.z.string(),
|
|
1488
|
+
superTitle: import_zod24.z.string(),
|
|
1489
|
+
title: import_zod24.z.string()
|
|
1417
1490
|
}),
|
|
1418
|
-
previewMode:
|
|
1419
|
-
type:
|
|
1420
|
-
version:
|
|
1491
|
+
previewMode: import_zod24.z.boolean(),
|
|
1492
|
+
type: import_zod24.z.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block),
|
|
1493
|
+
version: import_zod24.z.literal(1)
|
|
1421
1494
|
});
|
|
1422
|
-
var ContentBlock =
|
|
1495
|
+
var ContentBlock = import_zod24.z.discriminatedUnion("version", [
|
|
1423
1496
|
ContentBlockV1,
|
|
1424
1497
|
CABRootSection.extend({
|
|
1425
|
-
type:
|
|
1498
|
+
type: import_zod24.z.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
1426
1499
|
})
|
|
1427
1500
|
]);
|
|
1428
1501
|
|
|
1429
1502
|
// src/schema/widgets/giftWithPurchase.ts
|
|
1430
|
-
var
|
|
1431
|
-
var GiftWithPurchase =
|
|
1432
|
-
type:
|
|
1503
|
+
var import_zod25 = require("zod");
|
|
1504
|
+
var GiftWithPurchase = import_zod25.z.looseObject({
|
|
1505
|
+
type: import_zod25.z.literal(WidgetType.gift_with_purchase).default(WidgetType.gift_with_purchase)
|
|
1433
1506
|
});
|
|
1434
1507
|
|
|
1435
1508
|
// src/schema/widgets/lineItemEditor.ts
|
|
1436
|
-
var
|
|
1437
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
1438
|
-
downgradeToOneTimeLabel:
|
|
1509
|
+
var import_zod26 = require("zod");
|
|
1510
|
+
var LineItemEditorSwitchLanguageV1 = import_zod26.z.object({
|
|
1511
|
+
downgradeToOneTimeLabel: import_zod26.z.string().optional(),
|
|
1439
1512
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
1440
|
-
subscriptionOptionLabel:
|
|
1441
|
-
upgradeToSubscriptionLabel:
|
|
1442
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
1513
|
+
subscriptionOptionLabel: import_zod26.z.string().optional(),
|
|
1514
|
+
upgradeToSubscriptionLabel: import_zod26.z.string().optional(),
|
|
1515
|
+
upgradeToSubscriptionWithoutDiscountLabel: import_zod26.z.string().optional()
|
|
1443
1516
|
});
|
|
1444
|
-
var LineItemEditorV1 =
|
|
1517
|
+
var LineItemEditorV1 = import_zod26.z.object({
|
|
1445
1518
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
1446
|
-
button:
|
|
1447
|
-
previewMode:
|
|
1448
|
-
switchToSubscription:
|
|
1449
|
-
disableDowngrade:
|
|
1519
|
+
button: import_zod26.z.object({ kind: import_zod26.z.enum(["plain", "primary", "secondary"]).optional() }).optional(),
|
|
1520
|
+
previewMode: import_zod26.z.boolean().optional(),
|
|
1521
|
+
switchToSubscription: import_zod26.z.object({
|
|
1522
|
+
disableDowngrade: import_zod26.z.boolean().optional(),
|
|
1450
1523
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
1451
1524
|
}).optional(),
|
|
1452
|
-
switchToSubscriptionEnabled:
|
|
1453
|
-
tracking:
|
|
1454
|
-
enableAttribution:
|
|
1455
|
-
enableSource:
|
|
1456
|
-
enableWidget:
|
|
1525
|
+
switchToSubscriptionEnabled: import_zod26.z.boolean().optional(),
|
|
1526
|
+
tracking: import_zod26.z.object({
|
|
1527
|
+
enableAttribution: import_zod26.z.boolean().optional(),
|
|
1528
|
+
enableSource: import_zod26.z.boolean().optional(),
|
|
1529
|
+
enableWidget: import_zod26.z.boolean().optional()
|
|
1457
1530
|
}).optional(),
|
|
1458
|
-
type:
|
|
1459
|
-
version:
|
|
1531
|
+
type: import_zod26.z.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
1532
|
+
version: import_zod26.z.literal(1)
|
|
1460
1533
|
});
|
|
1461
|
-
var LineItemEditor =
|
|
1534
|
+
var LineItemEditor = import_zod26.z.discriminatedUnion("version", [
|
|
1462
1535
|
LineItemEditorV1,
|
|
1463
1536
|
CABRootSection.extend({
|
|
1464
|
-
type:
|
|
1537
|
+
type: import_zod26.z.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
1465
1538
|
})
|
|
1466
1539
|
]);
|
|
1467
1540
|
|
|
1468
1541
|
// src/schema/widgets/progressBar.ts
|
|
1469
|
-
var
|
|
1470
|
-
var ProgressBar =
|
|
1471
|
-
type:
|
|
1542
|
+
var import_zod27 = require("zod");
|
|
1543
|
+
var ProgressBar = import_zod27.z.looseObject({
|
|
1544
|
+
type: import_zod27.z.literal(WidgetType.ui_extension_progress_bar).default(WidgetType.ui_extension_progress_bar)
|
|
1472
1545
|
});
|
|
1473
1546
|
|
|
1474
1547
|
// src/schema/widgets/rebuyButton.ts
|
|
1475
|
-
var
|
|
1476
|
-
var RebuyButtonV1 =
|
|
1477
|
-
type:
|
|
1478
|
-
version:
|
|
1548
|
+
var import_zod28 = require("zod");
|
|
1549
|
+
var RebuyButtonV1 = import_zod28.z.looseObject({
|
|
1550
|
+
type: import_zod28.z.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button),
|
|
1551
|
+
version: import_zod28.z.literal(1)
|
|
1479
1552
|
});
|
|
1480
|
-
var RebuyButton =
|
|
1553
|
+
var RebuyButton = import_zod28.z.discriminatedUnion("version", [
|
|
1481
1554
|
RebuyButtonV1,
|
|
1482
1555
|
CABRootSection.extend({
|
|
1483
|
-
type:
|
|
1556
|
+
type: import_zod28.z.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
1484
1557
|
})
|
|
1485
1558
|
]);
|
|
1486
1559
|
|
|
1487
1560
|
// src/schema/widgets/rebuyMonetize.ts
|
|
1488
|
-
var
|
|
1489
|
-
var RebuyMonetize =
|
|
1490
|
-
type:
|
|
1561
|
+
var import_zod29 = require("zod");
|
|
1562
|
+
var RebuyMonetize = import_zod29.z.looseObject({
|
|
1563
|
+
type: import_zod29.z.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad)
|
|
1491
1564
|
});
|
|
1492
|
-
var RebuyMonetizeV1 =
|
|
1493
|
-
name:
|
|
1494
|
-
previewMode:
|
|
1565
|
+
var RebuyMonetizeV1 = import_zod29.z.object({
|
|
1566
|
+
name: import_zod29.z.string().nullable().optional(),
|
|
1567
|
+
previewMode: import_zod29.z.boolean().optional(),
|
|
1495
1568
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
1496
|
-
privacyPolicyUrl:
|
|
1569
|
+
privacyPolicyUrl: import_zod29.z.string().nullable().optional(),
|
|
1497
1570
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
1498
|
-
subVertical:
|
|
1499
|
-
tracking:
|
|
1500
|
-
enableAttribution:
|
|
1501
|
-
enableSource:
|
|
1502
|
-
enableWidget:
|
|
1571
|
+
subVertical: import_zod29.z.string().nullable().optional(),
|
|
1572
|
+
tracking: import_zod29.z.object({
|
|
1573
|
+
enableAttribution: import_zod29.z.boolean().optional(),
|
|
1574
|
+
enableSource: import_zod29.z.boolean().optional(),
|
|
1575
|
+
enableWidget: import_zod29.z.boolean().optional()
|
|
1503
1576
|
}).optional(),
|
|
1504
|
-
type:
|
|
1505
|
-
version:
|
|
1577
|
+
type: import_zod29.z.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
1578
|
+
version: import_zod29.z.literal(1),
|
|
1506
1579
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
1507
|
-
vertical:
|
|
1580
|
+
vertical: import_zod29.z.string().nullable().optional()
|
|
1508
1581
|
});
|
|
1509
1582
|
|
|
1510
1583
|
// src/schema/widgetData.ts
|
|
@@ -1518,7 +1591,7 @@ var extensionWidgetTypes = [
|
|
|
1518
1591
|
WidgetType.ui_extension_line_item_editor,
|
|
1519
1592
|
WidgetType.ui_extension_progress_bar
|
|
1520
1593
|
];
|
|
1521
|
-
var WidgetData =
|
|
1594
|
+
var WidgetData = import_zod30.z.discriminatedUnion("type", [
|
|
1522
1595
|
ABTestingPlaceholder,
|
|
1523
1596
|
CheckoutExtension,
|
|
1524
1597
|
ContentBlock,
|