@rebuy/rebuy 3.5.0 → 3.6.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 +740 -647
- package/dist/index.mjs +740 -647
- 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/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 +492 -416
- package/dist/server/index.mjs +492 -416
- package/dist/transforms/index.cjs +393 -317
- package/dist/transforms/index.mjs +393 -317
- package/dist/transforms/monetizeV1/convertMonetizeToV2.d.ts +2 -2
- package/package.json +1 -1
|
@@ -57,7 +57,7 @@ module.exports = __toCommonJS(transforms_exports);
|
|
|
57
57
|
|
|
58
58
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
59
59
|
var import_uuid12 = require("uuid");
|
|
60
|
-
var
|
|
60
|
+
var import_zod20 = require("zod");
|
|
61
61
|
|
|
62
62
|
// src/schema/widgets/checkout-and-beyond/common.ts
|
|
63
63
|
var freezeEnum = (values) => Object.freeze(Object.fromEntries(values.map((v) => [v, v])));
|
|
@@ -164,6 +164,8 @@ var languageKeys = [
|
|
|
164
164
|
"zh"
|
|
165
165
|
];
|
|
166
166
|
var LanguageKey = freezeEnum(languageKeys);
|
|
167
|
+
var mutatorEvents = ["item_added", "quantity_changed", "variant_selected"];
|
|
168
|
+
var MutatorEvent = freezeEnum(mutatorEvents);
|
|
167
169
|
var objectFits = ["cover", "contain"];
|
|
168
170
|
var ObjectFit = freezeEnum(objectFits);
|
|
169
171
|
var popoverPositions = ["inlineStart", "inlineEnd", "blockStart", "blockEnd"];
|
|
@@ -176,6 +178,10 @@ var progressTierUnits = ["currency", "item"];
|
|
|
176
178
|
var ProgressTierUnit = freezeEnum(progressTierUnits);
|
|
177
179
|
var quantityInputs = ["select", "number"];
|
|
178
180
|
var QuantityInput = freezeEnum(quantityInputs);
|
|
181
|
+
var resultCountOperators = ["equals", "greater_than", "less_than"];
|
|
182
|
+
var ResultCountOperator = freezeEnum(resultCountOperators);
|
|
183
|
+
var resultTagOperators = ["contains", "does_not_contain"];
|
|
184
|
+
var ResultTagOperator = freezeEnum(resultTagOperators);
|
|
179
185
|
var reviewsSizes = ["small", "default", "large"];
|
|
180
186
|
var ReviewsSize = freezeEnum(reviewsSizes);
|
|
181
187
|
var sectionTypes = [
|
|
@@ -208,6 +214,8 @@ var inlineTextSizeNames = ["extraSmall", "small", "base", "medium", "large", "ex
|
|
|
208
214
|
var InlineTextSizeName = freezeEnum(inlineTextSizeNames);
|
|
209
215
|
var textSizeNames = [...inlineTextSizeNames, "heading"];
|
|
210
216
|
var TextSizeName = freezeEnum(textSizeNames);
|
|
217
|
+
var variableEffects = ["set_false", "set_true", "toggle"];
|
|
218
|
+
var VariableEffect = freezeEnum(variableEffects);
|
|
211
219
|
var variantModes = ["multiple", "single"];
|
|
212
220
|
var VariantMode = freezeEnum(variantModes);
|
|
213
221
|
var variantSelectors = ["menu", "radio", "button"];
|
|
@@ -305,6 +313,19 @@ var HEX_COLOR_REGEX = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
|
305
313
|
var ROOT_RELATIVE_PATH_REGEX = /^\/(?!\/)/;
|
|
306
314
|
var HTML_TAGS_REGEX = /<\/?[a-zA-Z][^>]*>/g;
|
|
307
315
|
|
|
316
|
+
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
317
|
+
var import_zod19 = require("zod");
|
|
318
|
+
|
|
319
|
+
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
320
|
+
var import_zod4 = require("zod");
|
|
321
|
+
|
|
322
|
+
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
323
|
+
var import_uuid = require("uuid");
|
|
324
|
+
var import_zod3 = require("zod");
|
|
325
|
+
|
|
326
|
+
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
327
|
+
var import_zod2 = require("zod");
|
|
328
|
+
|
|
308
329
|
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
309
330
|
var import_zod = require("zod");
|
|
310
331
|
var ruleTypes = [
|
|
@@ -351,62 +372,108 @@ var RuleCondition = import_zod.z.object({
|
|
|
351
372
|
var RuleLogicBlock = import_zod.z.object({
|
|
352
373
|
rules: import_zod.z.array(RuleCondition).default(() => [])
|
|
353
374
|
});
|
|
354
|
-
var
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
import_zod.z.
|
|
359
|
-
import_zod.z.
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
key: import_zod.z.string().default("should_show"),
|
|
365
|
-
type: import_zod.z.literal("data_json").default("data_json"),
|
|
366
|
-
value: import_zod.z.string().default("true")
|
|
367
|
-
})
|
|
368
|
-
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
369
|
-
})
|
|
370
|
-
),
|
|
371
|
-
import_zod.z.strictObject({}).transform(() => [])
|
|
372
|
-
]).default(() => [])
|
|
375
|
+
var CABRulesetEntry = import_zod.z.object({
|
|
376
|
+
exitIfMatched: import_zod.z.boolean().default(true),
|
|
377
|
+
logic: import_zod.z.array(RuleLogicBlock).default(() => []),
|
|
378
|
+
output: import_zod.z.array(
|
|
379
|
+
import_zod.z.object({
|
|
380
|
+
key: import_zod.z.string().default("should_show"),
|
|
381
|
+
type: import_zod.z.literal("data_json").default("data_json"),
|
|
382
|
+
value: import_zod.z.string().default("true")
|
|
383
|
+
})
|
|
384
|
+
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
373
385
|
});
|
|
386
|
+
var CABRuleset = import_zod.z.union([import_zod.z.array(CABRulesetEntry), import_zod.z.strictObject({}).transform(() => [])]).default(() => []);
|
|
374
387
|
|
|
375
|
-
// src/schema/widgets/checkout-and-beyond/
|
|
376
|
-
var
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
388
|
+
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
389
|
+
var variableEffect = import_zod2.z.enum(variableEffects);
|
|
390
|
+
var CABVariableSeed = import_zod2.z.object({
|
|
391
|
+
dataSourceId: import_zod2.z.number().nullable().default(null),
|
|
392
|
+
ruleset: CABRuleset
|
|
393
|
+
});
|
|
394
|
+
var CABVariable = import_zod2.z.object({
|
|
395
|
+
/**
|
|
396
|
+
* Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
|
|
397
|
+
* from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
|
|
398
|
+
* below; a cross-field default has no `.default()` spelling. An explicit value always wins.
|
|
399
|
+
*/
|
|
400
|
+
defaultValue: import_zod2.z.boolean().optional(),
|
|
401
|
+
name: import_zod2.z.string().min(1),
|
|
402
|
+
seed: CABVariableSeed.optional()
|
|
403
|
+
}).transform(({ defaultValue, ...variable }) => ({
|
|
404
|
+
defaultValue: defaultValue ?? variable.seed === void 0,
|
|
405
|
+
...variable
|
|
406
|
+
}));
|
|
407
|
+
var CABVariableEffect = import_zod2.z.object({
|
|
408
|
+
effect: variableEffect.default(VariableEffect.toggle),
|
|
409
|
+
variable: import_zod2.z.string().min(1)
|
|
410
|
+
});
|
|
411
|
+
var CABVisibility = import_zod2.z.object({
|
|
412
|
+
variable: import_zod2.z.string().min(1),
|
|
413
|
+
visibleWhen: import_zod2.z.boolean().default(true)
|
|
414
|
+
});
|
|
415
|
+
var resultCountOperator = import_zod2.z.enum(resultCountOperators);
|
|
416
|
+
var resultTagOperator = import_zod2.z.enum(resultTagOperators);
|
|
417
|
+
var mutatorEvent = import_zod2.z.enum(mutatorEvents);
|
|
418
|
+
var CABResultCountTrigger = import_zod2.z.object({
|
|
419
|
+
operator: resultCountOperator.default(ResultCountOperator.equals),
|
|
420
|
+
type: import_zod2.z.literal("result_count"),
|
|
421
|
+
value: import_zod2.z.number().default(0)
|
|
422
|
+
});
|
|
423
|
+
var CABResultTagTrigger = import_zod2.z.object({
|
|
424
|
+
operator: resultTagOperator.default(ResultTagOperator.contains),
|
|
425
|
+
type: import_zod2.z.literal("result_tag"),
|
|
426
|
+
value: import_zod2.z.string().min(1)
|
|
427
|
+
});
|
|
428
|
+
var CABEventTrigger = import_zod2.z.object({
|
|
429
|
+
event: mutatorEvent,
|
|
430
|
+
type: import_zod2.z.literal("event")
|
|
431
|
+
});
|
|
432
|
+
var CABVariableTrigger = import_zod2.z.discriminatedUnion("type", [
|
|
433
|
+
CABEventTrigger,
|
|
434
|
+
CABResultCountTrigger,
|
|
435
|
+
CABResultTagTrigger
|
|
436
|
+
]);
|
|
437
|
+
var CABVariableMutator = import_zod2.z.object({
|
|
438
|
+
effect: variableEffect.default(VariableEffect.set_false),
|
|
439
|
+
variable: import_zod2.z.string().min(1),
|
|
440
|
+
when: CABVariableTrigger
|
|
441
|
+
});
|
|
442
|
+
var CABVariableFields = {
|
|
443
|
+
mutators: import_zod2.z.array(CABVariableMutator).optional(),
|
|
444
|
+
variables: import_zod2.z.array(CABVariable).refine((variables) => new Set(variables.map(({ name }) => name)).size === variables.length, {
|
|
445
|
+
message: "variable names must be unique within a section"
|
|
446
|
+
}).optional(),
|
|
447
|
+
visibility: CABVisibility.optional()
|
|
448
|
+
};
|
|
380
449
|
|
|
381
450
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
382
|
-
var
|
|
383
|
-
var
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
vertical: import_zod2.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
451
|
+
var GridItem = import_zod3.z.union([import_zod3.z.literal("auto"), import_zod3.z.literal("fill"), import_zod3.z.string().regex(/^\d+%$/), import_zod3.z.number()]);
|
|
452
|
+
var CABLayoutSection = import_zod3.z.object({
|
|
453
|
+
...CABVariableFields,
|
|
454
|
+
alignment: import_zod3.z.object({
|
|
455
|
+
horizontal: import_zod3.z.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
456
|
+
vertical: import_zod3.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
389
457
|
}).default({
|
|
390
458
|
horizontal: HorizontalAlignment.start,
|
|
391
459
|
vertical: VerticalAlignment.top
|
|
392
460
|
}),
|
|
393
|
-
border:
|
|
394
|
-
buttonField:
|
|
395
|
-
direction:
|
|
396
|
-
grid:
|
|
397
|
-
columns:
|
|
398
|
-
rows:
|
|
461
|
+
border: import_zod3.z.lazy(() => CABBorder),
|
|
462
|
+
buttonField: import_zod3.z.enum(buttonFields).optional(),
|
|
463
|
+
direction: import_zod3.z.enum(directions).default(Direction.rows),
|
|
464
|
+
grid: import_zod3.z.object({
|
|
465
|
+
columns: import_zod3.z.union([import_zod3.z.array(GridItem), import_zod3.z.undefined()]).default(() => ["auto"]),
|
|
466
|
+
rows: import_zod3.z.union([import_zod3.z.array(GridItem), import_zod3.z.undefined()]).default(() => ["auto"])
|
|
399
467
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
400
|
-
name:
|
|
401
|
-
padding:
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
spacing: import_zod2.z.enum(spacings).default(Spacing.base),
|
|
468
|
+
name: import_zod3.z.string().optional(),
|
|
469
|
+
padding: import_zod3.z.enum(spacings).default(Spacing.none),
|
|
470
|
+
sectionId: import_zod3.z.uuid().default(() => (0, import_uuid.v7)()),
|
|
471
|
+
sections: import_zod3.z.union([import_zod3.z.array(import_zod3.z.lazy(() => CABSection)), import_zod3.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
472
|
+
sectionType: import_zod3.z.literal(SectionType.layout).default(SectionType.layout),
|
|
473
|
+
spacing: import_zod3.z.enum(spacings).default(Spacing.base),
|
|
407
474
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
408
|
-
viewUrl:
|
|
409
|
-
width:
|
|
475
|
+
viewUrl: import_zod3.z.string().optional(),
|
|
476
|
+
width: import_zod3.z.number().default(100)
|
|
410
477
|
});
|
|
411
478
|
|
|
412
479
|
// src/schema/widgets/checkout-and-beyond/utils.ts
|
|
@@ -476,11 +543,11 @@ var isTextType = isSectionType(SectionType.text);
|
|
|
476
543
|
var isVariantsType = isSectionType(SectionType.variants);
|
|
477
544
|
|
|
478
545
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
479
|
-
var CABBannerSection =
|
|
546
|
+
var CABBannerSection = import_zod4.z.lazy(
|
|
480
547
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
481
|
-
buttonField:
|
|
482
|
-
color:
|
|
483
|
-
dismissible:
|
|
548
|
+
buttonField: import_zod4.z.enum(buttonFields).optional(),
|
|
549
|
+
color: import_zod4.z.enum(bannerColors).default("info"),
|
|
550
|
+
dismissible: import_zod4.z.boolean().default(true),
|
|
484
551
|
/**
|
|
485
552
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
486
553
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -496,83 +563,83 @@ var CABBannerSection = import_zod3.z.lazy(
|
|
|
496
563
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
497
564
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
498
565
|
*/
|
|
499
|
-
heading:
|
|
500
|
-
sectionType:
|
|
566
|
+
heading: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
567
|
+
sectionType: import_zod4.z.literal(SectionType.banner).default(SectionType.banner)
|
|
501
568
|
})
|
|
502
569
|
);
|
|
503
570
|
|
|
504
571
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
505
572
|
var import_uuid3 = require("uuid");
|
|
506
|
-
var
|
|
573
|
+
var import_zod6 = require("zod");
|
|
507
574
|
|
|
508
575
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
509
576
|
var import_compat2 = require("es-toolkit/compat");
|
|
510
577
|
var import_uuid2 = require("uuid");
|
|
511
|
-
var
|
|
512
|
-
var enumOrOmit = (...vals) =>
|
|
513
|
-
var TiptapText =
|
|
514
|
-
marks:
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
attrs:
|
|
521
|
-
class:
|
|
522
|
-
href:
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
578
|
+
var import_zod5 = require("zod");
|
|
579
|
+
var enumOrOmit = (...vals) => import_zod5.z.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
580
|
+
var TiptapText = import_zod5.z.object({
|
|
581
|
+
marks: import_zod5.z.union([
|
|
582
|
+
import_zod5.z.array(
|
|
583
|
+
import_zod5.z.discriminatedUnion("type", [
|
|
584
|
+
import_zod5.z.object({ type: import_zod5.z.literal("bold") }),
|
|
585
|
+
import_zod5.z.object({ type: import_zod5.z.literal("italic") }),
|
|
586
|
+
import_zod5.z.object({
|
|
587
|
+
attrs: import_zod5.z.object({
|
|
588
|
+
class: import_zod5.z.string().nullable(),
|
|
589
|
+
href: import_zod5.z.union([
|
|
590
|
+
import_zod5.z.url(),
|
|
591
|
+
import_zod5.z.literal("#"),
|
|
592
|
+
import_zod5.z.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
593
|
+
import_zod5.z.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
527
594
|
]),
|
|
528
|
-
rel:
|
|
529
|
-
target:
|
|
595
|
+
rel: import_zod5.z.string().default("noopener noreferrer nofollow"),
|
|
596
|
+
target: import_zod5.z.string().default("_blank")
|
|
530
597
|
}),
|
|
531
|
-
type:
|
|
598
|
+
type: import_zod5.z.literal("link")
|
|
532
599
|
}),
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
attrs:
|
|
600
|
+
import_zod5.z.object({ type: import_zod5.z.literal("strike") }),
|
|
601
|
+
import_zod5.z.object({
|
|
602
|
+
attrs: import_zod5.z.object({
|
|
536
603
|
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
537
604
|
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
538
605
|
}),
|
|
539
|
-
type:
|
|
606
|
+
type: import_zod5.z.literal("textStyle")
|
|
540
607
|
})
|
|
541
608
|
])
|
|
542
609
|
),
|
|
543
|
-
|
|
610
|
+
import_zod5.z.strictObject({}).transform(() => [])
|
|
544
611
|
]).optional(),
|
|
545
|
-
text:
|
|
546
|
-
type:
|
|
612
|
+
text: import_zod5.z.string().default(""),
|
|
613
|
+
type: import_zod5.z.literal("text").default("text")
|
|
547
614
|
});
|
|
548
|
-
var TiptapParagraph =
|
|
549
|
-
attrs:
|
|
615
|
+
var TiptapParagraph = import_zod5.z.object({
|
|
616
|
+
attrs: import_zod5.z.object({
|
|
550
617
|
textAlign: enumOrOmit(...textAlignments)
|
|
551
618
|
}).default({ textAlign: TextAlignment.start }),
|
|
552
|
-
content:
|
|
553
|
-
type:
|
|
619
|
+
content: import_zod5.z.union([import_zod5.z.array(TiptapText), import_zod5.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
620
|
+
type: import_zod5.z.literal("paragraph").default("paragraph")
|
|
554
621
|
});
|
|
555
|
-
var TiptapDocument =
|
|
556
|
-
attrs:
|
|
622
|
+
var TiptapDocument = import_zod5.z.object({
|
|
623
|
+
attrs: import_zod5.z.object({
|
|
557
624
|
blockSpacing: enumOrOmit(...spacings)
|
|
558
625
|
}).default({ blockSpacing: Spacing.base }),
|
|
559
|
-
content:
|
|
560
|
-
type:
|
|
626
|
+
content: import_zod5.z.union([import_zod5.z.array(TiptapParagraph), import_zod5.z.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
627
|
+
type: import_zod5.z.literal("doc").default("doc")
|
|
561
628
|
});
|
|
562
|
-
var CABTextTier =
|
|
563
|
-
threshold:
|
|
564
|
-
thresholds:
|
|
565
|
-
tierId:
|
|
566
|
-
tierType:
|
|
629
|
+
var CABTextTier = import_zod5.z.object({
|
|
630
|
+
threshold: import_zod5.z.number().int().nonnegative(),
|
|
631
|
+
thresholds: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.number().int().nonnegative()).default(() => ({})),
|
|
632
|
+
tierId: import_zod5.z.string().optional(),
|
|
633
|
+
tierType: import_zod5.z.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
567
634
|
});
|
|
568
|
-
var CABTextSection =
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
sectionId:
|
|
575
|
-
sectionType:
|
|
635
|
+
var CABTextSection = import_zod5.z.object({
|
|
636
|
+
...CABVariableFields,
|
|
637
|
+
buttonField: import_zod5.z.enum(buttonFields).optional(),
|
|
638
|
+
content: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.union([import_zod5.z.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
639
|
+
name: import_zod5.z.string().optional(),
|
|
640
|
+
optionId: import_zod5.z.number().optional(),
|
|
641
|
+
sectionId: import_zod5.z.uuid().default(() => (0, import_uuid2.v7)()),
|
|
642
|
+
sectionType: import_zod5.z.literal(SectionType.text).default(SectionType.text),
|
|
576
643
|
tier: CABTextTier.optional()
|
|
577
644
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
578
645
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
@@ -594,35 +661,35 @@ var CABTextSection = import_zod4.z.object({
|
|
|
594
661
|
});
|
|
595
662
|
|
|
596
663
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
597
|
-
var CABButtonContent =
|
|
598
|
-
() =>
|
|
664
|
+
var CABButtonContent = import_zod6.z.lazy(
|
|
665
|
+
() => import_zod6.z.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
599
666
|
);
|
|
600
|
-
var CABButtonSection =
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
667
|
+
var CABButtonSection = import_zod6.z.object({
|
|
668
|
+
...CABVariableFields,
|
|
669
|
+
action: import_zod6.z.union([import_zod6.z.literal(""), import_zod6.z.enum(buttonActions)]).default(""),
|
|
670
|
+
buttonStyle: import_zod6.z.enum(buttonStyles).default(ButtonStyle.primary),
|
|
671
|
+
custom: import_zod6.z.object({
|
|
672
|
+
color: import_zod6.z.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
673
|
+
height: import_zod6.z.number().default(52),
|
|
674
|
+
width: import_zod6.z.number().default(300)
|
|
607
675
|
}).default({
|
|
608
676
|
color: "#005bd3",
|
|
609
677
|
height: 52,
|
|
610
678
|
width: 300
|
|
611
679
|
}),
|
|
612
|
-
disableDowngrade:
|
|
613
|
-
name:
|
|
614
|
-
optionId:
|
|
615
|
-
popover:
|
|
616
|
-
alignment:
|
|
617
|
-
position:
|
|
680
|
+
disableDowngrade: import_zod6.z.boolean().default(false),
|
|
681
|
+
name: import_zod6.z.string().optional(),
|
|
682
|
+
optionId: import_zod6.z.number().optional(),
|
|
683
|
+
popover: import_zod6.z.object({
|
|
684
|
+
alignment: import_zod6.z.enum(textAlignments).default(TextAlignment.center),
|
|
685
|
+
position: import_zod6.z.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
618
686
|
}).optional().default(() => ({
|
|
619
687
|
alignment: TextAlignment.center,
|
|
620
688
|
position: PopoverPosition.blockStart
|
|
621
689
|
})),
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
sectionType: import_zod5.z.literal(SectionType.button).default(SectionType.button),
|
|
690
|
+
sectionId: import_zod6.z.uuid().default(() => (0, import_uuid3.v7)()),
|
|
691
|
+
sections: import_zod6.z.union([import_zod6.z.array(CABButtonContent), import_zod6.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
692
|
+
sectionType: import_zod6.z.literal(SectionType.button).default(SectionType.button),
|
|
626
693
|
/**
|
|
627
694
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
628
695
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -637,20 +704,25 @@ var CABButtonSection = import_zod5.z.object({
|
|
|
637
704
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
638
705
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
639
706
|
*/
|
|
640
|
-
tier:
|
|
707
|
+
tier: import_zod6.z.object({ tierId: import_zod6.z.string().min(1) }).optional(),
|
|
641
708
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
642
|
-
trackingUrl:
|
|
709
|
+
trackingUrl: import_zod6.z.string().optional(),
|
|
710
|
+
/**
|
|
711
|
+
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
712
|
+
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
713
|
+
*/
|
|
714
|
+
variableEffects: import_zod6.z.array(CABVariableEffect).optional()
|
|
643
715
|
});
|
|
644
716
|
|
|
645
717
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
646
|
-
var
|
|
718
|
+
var import_zod11 = require("zod");
|
|
647
719
|
|
|
648
720
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
649
|
-
var
|
|
721
|
+
var import_zod10 = require("zod");
|
|
650
722
|
|
|
651
723
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
652
724
|
var import_uuid4 = require("uuid");
|
|
653
|
-
var
|
|
725
|
+
var import_zod7 = require("zod");
|
|
654
726
|
|
|
655
727
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
656
728
|
var import_es_toolkit3 = require("es-toolkit");
|
|
@@ -729,72 +801,74 @@ var widgetTypes = [
|
|
|
729
801
|
var WidgetType = freezeEnum(widgetTypes);
|
|
730
802
|
|
|
731
803
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
732
|
-
var CABDiscount =
|
|
733
|
-
amount:
|
|
734
|
-
discountedBy:
|
|
735
|
-
discountedFrom:
|
|
736
|
-
type:
|
|
804
|
+
var CABDiscount = import_zod7.z.object({
|
|
805
|
+
amount: import_zod7.z.union([import_zod7.z.number(), import_zod7.z.string()]).catch(0),
|
|
806
|
+
discountedBy: import_zod7.z.string().optional(),
|
|
807
|
+
discountedFrom: import_zod7.z.enum(discountSources).optional().catch(void 0),
|
|
808
|
+
type: import_zod7.z.enum(discountTypes).catch("none")
|
|
737
809
|
});
|
|
738
|
-
var CABIntegrations =
|
|
739
|
-
judgeme:
|
|
740
|
-
junip:
|
|
741
|
-
klaviyo:
|
|
742
|
-
loox:
|
|
743
|
-
okendo:
|
|
744
|
-
opinew:
|
|
745
|
-
reviewsio:
|
|
746
|
-
stamped:
|
|
747
|
-
yotpo:
|
|
810
|
+
var CABIntegrations = import_zod7.z.object({
|
|
811
|
+
judgeme: import_zod7.z.boolean().default(false),
|
|
812
|
+
junip: import_zod7.z.boolean().default(false),
|
|
813
|
+
klaviyo: import_zod7.z.boolean().default(false),
|
|
814
|
+
loox: import_zod7.z.boolean().default(false),
|
|
815
|
+
okendo: import_zod7.z.boolean().default(false),
|
|
816
|
+
opinew: import_zod7.z.boolean().default(false),
|
|
817
|
+
reviewsio: import_zod7.z.boolean().default(false),
|
|
818
|
+
stamped: import_zod7.z.boolean().default(false),
|
|
819
|
+
yotpo: import_zod7.z.boolean().default(false)
|
|
748
820
|
});
|
|
749
|
-
var CABDataSourceSection =
|
|
750
|
-
dataSourceId:
|
|
751
|
-
dataSourcePath:
|
|
821
|
+
var CABDataSourceSection = import_zod7.z.object({
|
|
822
|
+
dataSourceId: import_zod7.z.number().nullable().default(null),
|
|
823
|
+
dataSourcePath: import_zod7.z.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
752
824
|
discount: CABDiscount.optional(),
|
|
753
825
|
integrations: CABIntegrations.optional(),
|
|
754
|
-
limit:
|
|
755
|
-
matchVariant:
|
|
756
|
-
matchVariantOutOfStock:
|
|
757
|
-
name:
|
|
758
|
-
productType:
|
|
759
|
-
sectionId:
|
|
760
|
-
sectionType:
|
|
826
|
+
limit: import_zod7.z.number().default(1),
|
|
827
|
+
matchVariant: import_zod7.z.boolean().default(false),
|
|
828
|
+
matchVariantOutOfStock: import_zod7.z.boolean().default(false),
|
|
829
|
+
name: import_zod7.z.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
830
|
+
productType: import_zod7.z.enum(productTypes).optional(),
|
|
831
|
+
sectionId: import_zod7.z.uuid().default(() => (0, import_uuid4.v7)()),
|
|
832
|
+
sectionType: import_zod7.z.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
761
833
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
762
|
-
subscriptionIsDefault:
|
|
763
|
-
treatAsGwp:
|
|
834
|
+
subscriptionIsDefault: import_zod7.z.boolean().default(false),
|
|
835
|
+
treatAsGwp: import_zod7.z.boolean().default(false)
|
|
764
836
|
});
|
|
765
837
|
|
|
766
838
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
767
839
|
var import_uuid6 = require("uuid");
|
|
768
|
-
var
|
|
840
|
+
var import_zod9 = require("zod");
|
|
769
841
|
|
|
770
842
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
771
843
|
var import_uuid5 = require("uuid");
|
|
772
|
-
var
|
|
773
|
-
var CABVariantContent =
|
|
774
|
-
() =>
|
|
844
|
+
var import_zod8 = require("zod");
|
|
845
|
+
var CABVariantContent = import_zod8.z.lazy(
|
|
846
|
+
() => import_zod8.z.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
775
847
|
);
|
|
776
|
-
var CABProductSection =
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
848
|
+
var CABProductSection = import_zod8.z.object({
|
|
849
|
+
...CABVariableFields,
|
|
850
|
+
name: import_zod8.z.string().optional(),
|
|
851
|
+
productId: import_zod8.z.number().nullable().default(null),
|
|
852
|
+
sectionId: import_zod8.z.uuid().default(() => (0, import_uuid5.v7)()),
|
|
853
|
+
sections: import_zod8.z.union([import_zod8.z.array(CABVariantContent), import_zod8.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
854
|
+
sectionType: import_zod8.z.literal(SectionType.product).default(SectionType.product),
|
|
855
|
+
selectors: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
856
|
+
variantMode: import_zod8.z.enum(variantModes).default(VariantMode.multiple)
|
|
784
857
|
});
|
|
785
858
|
|
|
786
859
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
787
|
-
var CABProductsSection =
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
860
|
+
var CABProductsSection = import_zod9.z.object({
|
|
861
|
+
...CABVariableFields,
|
|
862
|
+
name: import_zod9.z.string().optional(),
|
|
863
|
+
sectionId: import_zod9.z.uuid().default(() => (0, import_uuid6.v7)()),
|
|
864
|
+
sections: import_zod9.z.union([import_zod9.z.array(import_zod9.z.lazy(() => CABProductSection)), import_zod9.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
865
|
+
sectionType: import_zod9.z.literal(SectionType.products).default(SectionType.products)
|
|
792
866
|
});
|
|
793
867
|
|
|
794
868
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
795
|
-
var CABOffersSection =
|
|
869
|
+
var CABOffersSection = import_zod10.z.lazy(
|
|
796
870
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
797
|
-
sections:
|
|
871
|
+
sections: import_zod10.z.union([import_zod10.z.array(import_zod10.z.lazy(() => CABSection)), import_zod10.z.strictObject({}).transform(() => [])]).default(() => [
|
|
798
872
|
CABBannerSection.parse({
|
|
799
873
|
buttonField: "undoAddToOrder",
|
|
800
874
|
color: "success",
|
|
@@ -808,64 +882,65 @@ var CABOffersSection = import_zod9.z.lazy(
|
|
|
808
882
|
CABDataSourceSection.parse({}),
|
|
809
883
|
CABProductsSection.parse({})
|
|
810
884
|
]),
|
|
811
|
-
sectionType:
|
|
885
|
+
sectionType: import_zod10.z.literal(SectionType.offers).default(SectionType.offers)
|
|
812
886
|
})
|
|
813
887
|
);
|
|
814
888
|
|
|
815
889
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
816
|
-
var CABCarouselSection =
|
|
890
|
+
var CABCarouselSection = import_zod11.z.lazy(
|
|
817
891
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
818
|
-
autoAdvanceInterval:
|
|
819
|
-
itemsAtOnce:
|
|
892
|
+
autoAdvanceInterval: import_zod11.z.number().default(0),
|
|
893
|
+
itemsAtOnce: import_zod11.z.number().min(1).default(1),
|
|
820
894
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
821
|
-
offersDirection:
|
|
822
|
-
sections:
|
|
823
|
-
sectionType:
|
|
895
|
+
offersDirection: import_zod11.z.enum(offersDirections).default("vertical"),
|
|
896
|
+
sections: import_zod11.z.union([import_zod11.z.array(import_zod11.z.lazy(() => CABSection)), import_zod11.z.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
897
|
+
sectionType: import_zod11.z.literal(SectionType.carousel).default(SectionType.carousel)
|
|
824
898
|
})
|
|
825
899
|
);
|
|
826
900
|
|
|
827
901
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
828
|
-
var
|
|
829
|
-
var CABCartLineSection =
|
|
902
|
+
var import_zod12 = require("zod");
|
|
903
|
+
var CABCartLineSection = import_zod12.z.lazy(
|
|
830
904
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
831
|
-
sections:
|
|
832
|
-
sectionType:
|
|
905
|
+
sections: import_zod12.z.union([import_zod12.z.array(import_zod12.z.lazy(() => CABSection)), import_zod12.z.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
906
|
+
sectionType: import_zod12.z.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
833
907
|
})
|
|
834
908
|
);
|
|
835
909
|
|
|
836
910
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
837
911
|
var import_uuid7 = require("uuid");
|
|
838
|
-
var
|
|
839
|
-
var CABDiscountSection =
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
912
|
+
var import_zod13 = require("zod");
|
|
913
|
+
var CABDiscountSection = import_zod13.z.object({
|
|
914
|
+
...CABVariableFields,
|
|
915
|
+
amount: import_zod13.z.union([import_zod13.z.number(), import_zod13.z.string()]).catch(0),
|
|
916
|
+
discountedBy: import_zod13.z.string().optional(),
|
|
917
|
+
discountedFrom: import_zod13.z.enum(discountSources).optional().catch(void 0),
|
|
918
|
+
message: import_zod13.z.string().optional(),
|
|
919
|
+
name: import_zod13.z.string().optional(),
|
|
920
|
+
quantity: import_zod13.z.number().default(1),
|
|
921
|
+
sectionId: import_zod13.z.uuid().default(() => (0, import_uuid7.v7)()),
|
|
922
|
+
sectionType: import_zod13.z.literal(SectionType.discount).default(SectionType.discount),
|
|
923
|
+
type: import_zod13.z.enum(discountTypes).catch("none")
|
|
849
924
|
});
|
|
850
925
|
|
|
851
926
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
852
927
|
var import_uuid8 = require("uuid");
|
|
853
|
-
var
|
|
854
|
-
var CABMonetizeSection =
|
|
855
|
-
|
|
928
|
+
var import_zod14 = require("zod");
|
|
929
|
+
var CABMonetizeSection = import_zod14.z.object({
|
|
930
|
+
...CABVariableFields,
|
|
931
|
+
name: import_zod14.z.string().optional(),
|
|
856
932
|
/** Privacy Policy footer href (the widget's `privacy_policy_url` setting); the client relays it to `/cab/monetize`. */
|
|
857
|
-
privacyPolicyUrl:
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
sectionType: import_zod13.z.literal(SectionType.monetize).default(SectionType.monetize),
|
|
933
|
+
privacyPolicyUrl: import_zod14.z.string().optional(),
|
|
934
|
+
sectionId: import_zod14.z.uuid().default(() => (0, import_uuid8.v7)()),
|
|
935
|
+
sectionType: import_zod14.z.literal(SectionType.monetize).default(SectionType.monetize),
|
|
861
936
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
862
|
-
subVertical:
|
|
937
|
+
subVertical: import_zod14.z.string().optional(),
|
|
863
938
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
864
|
-
vertical:
|
|
939
|
+
vertical: import_zod14.z.string().optional()
|
|
865
940
|
});
|
|
866
941
|
|
|
867
942
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
868
|
-
var
|
|
943
|
+
var import_zod15 = require("zod");
|
|
869
944
|
|
|
870
945
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
871
946
|
var GIFT_LABELS = {
|
|
@@ -984,21 +1059,21 @@ var GIFT_LABELS = {
|
|
|
984
1059
|
};
|
|
985
1060
|
|
|
986
1061
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
987
|
-
var CABProgressTier =
|
|
1062
|
+
var CABProgressTier = import_zod15.z.object({
|
|
988
1063
|
/**
|
|
989
1064
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
990
1065
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
991
1066
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
992
1067
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
993
1068
|
*/
|
|
994
|
-
discount:
|
|
1069
|
+
discount: import_zod15.z.object({ amount: import_zod15.z.number().nonnegative(), type: import_zod15.z.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
995
1070
|
/**
|
|
996
1071
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
997
1072
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
998
1073
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
999
1074
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
1000
1075
|
*/
|
|
1001
|
-
filterOosVariants:
|
|
1076
|
+
filterOosVariants: import_zod15.z.boolean().default(false),
|
|
1002
1077
|
/**
|
|
1003
1078
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
1004
1079
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -1006,10 +1081,10 @@ var CABProgressTier = import_zod14.z.object({
|
|
|
1006
1081
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
1007
1082
|
* tree is complete.
|
|
1008
1083
|
*/
|
|
1009
|
-
gift:
|
|
1010
|
-
productId:
|
|
1011
|
-
title:
|
|
1012
|
-
variantIds:
|
|
1084
|
+
gift: import_zod15.z.object({
|
|
1085
|
+
productId: import_zod15.z.number().int().positive(),
|
|
1086
|
+
title: import_zod15.z.string().optional(),
|
|
1087
|
+
variantIds: import_zod15.z.array(import_zod15.z.number().int().positive()).default(() => [])
|
|
1013
1088
|
}).optional(),
|
|
1014
1089
|
/**
|
|
1015
1090
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
@@ -1020,35 +1095,35 @@ var CABProgressTier = import_zod14.z.object({
|
|
|
1020
1095
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
1021
1096
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
1022
1097
|
*/
|
|
1023
|
-
label:
|
|
1098
|
+
label: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string()).optional(),
|
|
1024
1099
|
/**
|
|
1025
1100
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
1026
1101
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
1027
1102
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
1028
1103
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
1029
1104
|
*/
|
|
1030
|
-
productTierImage:
|
|
1105
|
+
productTierImage: import_zod15.z.boolean().default(false),
|
|
1031
1106
|
/**
|
|
1032
1107
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
1033
1108
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
1034
1109
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
1035
1110
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
1036
1111
|
*/
|
|
1037
|
-
threshold:
|
|
1112
|
+
threshold: import_zod15.z.number().int().nonnegative(),
|
|
1038
1113
|
/**
|
|
1039
1114
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
1040
1115
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
1041
1116
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
1042
1117
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
1043
1118
|
*/
|
|
1044
|
-
thresholds:
|
|
1119
|
+
thresholds: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.number().int().nonnegative()).default(() => ({})),
|
|
1045
1120
|
/**
|
|
1046
1121
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
1047
1122
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
1048
1123
|
* shipping bar (single unlabeled tier, no gift).
|
|
1049
1124
|
*/
|
|
1050
|
-
tierId:
|
|
1051
|
-
tierType:
|
|
1125
|
+
tierId: import_zod15.z.string().optional(),
|
|
1126
|
+
tierType: import_zod15.z.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
1052
1127
|
/**
|
|
1053
1128
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
1054
1129
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -1059,9 +1134,9 @@ var CABProgressTier = import_zod14.z.object({
|
|
|
1059
1134
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
1060
1135
|
* template text supplies grammatically-neutral wording around the token.
|
|
1061
1136
|
*/
|
|
1062
|
-
unit:
|
|
1137
|
+
unit: import_zod15.z.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
1063
1138
|
});
|
|
1064
|
-
var CABProgressBarSection =
|
|
1139
|
+
var CABProgressBarSection = import_zod15.z.lazy(
|
|
1065
1140
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1066
1141
|
/**
|
|
1067
1142
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -1070,35 +1145,35 @@ var CABProgressBarSection = import_zod14.z.lazy(
|
|
|
1070
1145
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
1071
1146
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
1072
1147
|
*/
|
|
1073
|
-
barId:
|
|
1148
|
+
barId: import_zod15.z.string().optional(),
|
|
1074
1149
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
1075
|
-
countryCodes:
|
|
1150
|
+
countryCodes: import_zod15.z.array(import_zod15.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1076
1151
|
/**
|
|
1077
1152
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
1078
1153
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
1079
1154
|
*/
|
|
1080
|
-
excludeCountryCodes:
|
|
1155
|
+
excludeCountryCodes: import_zod15.z.array(import_zod15.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
1081
1156
|
/**
|
|
1082
1157
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
1083
1158
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
1084
1159
|
* adds the cart's discount allocations back to the live subtotal.
|
|
1085
1160
|
*/
|
|
1086
|
-
excludeDiscountInSubtotal:
|
|
1161
|
+
excludeDiscountInSubtotal: import_zod15.z.boolean().default(false),
|
|
1087
1162
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
1088
|
-
excludedVariantIds:
|
|
1163
|
+
excludedVariantIds: import_zod15.z.array(import_zod15.z.number().int().positive()).default(() => []),
|
|
1089
1164
|
/**
|
|
1090
1165
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
1091
1166
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
1092
1167
|
*/
|
|
1093
|
-
freeShippingOnSubscription:
|
|
1168
|
+
freeShippingOnSubscription: import_zod15.z.boolean().default(false),
|
|
1094
1169
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
1095
|
-
giftAreaTitle:
|
|
1170
|
+
giftAreaTitle: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
1096
1171
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
1097
|
-
giftLabels:
|
|
1098
|
-
addGift:
|
|
1099
|
-
remove:
|
|
1100
|
-
selectOptions:
|
|
1101
|
-
yourGift:
|
|
1172
|
+
giftLabels: import_zod15.z.object({
|
|
1173
|
+
addGift: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
1174
|
+
remove: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
1175
|
+
selectOptions: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
1176
|
+
yourGift: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
1102
1177
|
}).default(() => ({
|
|
1103
1178
|
addGift: { ...GIFT_LABELS.addGift },
|
|
1104
1179
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -1106,37 +1181,38 @@ var CABProgressBarSection = import_zod14.z.lazy(
|
|
|
1106
1181
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
1107
1182
|
})),
|
|
1108
1183
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
1109
|
-
name:
|
|
1184
|
+
name: import_zod15.z.string().default("Order progress"),
|
|
1110
1185
|
/**
|
|
1111
1186
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
1112
1187
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
1113
1188
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
1114
1189
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
1115
1190
|
*/
|
|
1116
|
-
progressColor:
|
|
1117
|
-
sectionType:
|
|
1191
|
+
progressColor: import_zod15.z.string().optional(),
|
|
1192
|
+
sectionType: import_zod15.z.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
1118
1193
|
/**
|
|
1119
1194
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
1120
1195
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
1121
1196
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
1122
1197
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
1123
1198
|
*/
|
|
1124
|
-
tiers:
|
|
1199
|
+
tiers: import_zod15.z.union([import_zod15.z.array(CABProgressTier), import_zod15.z.strictObject({}).transform(() => [])]).default(() => [])
|
|
1125
1200
|
})
|
|
1126
1201
|
);
|
|
1127
1202
|
|
|
1128
1203
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
1129
1204
|
var import_uuid9 = require("uuid");
|
|
1130
|
-
var
|
|
1131
|
-
var CABQuantitySection =
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1205
|
+
var import_zod16 = require("zod");
|
|
1206
|
+
var CABQuantitySection = import_zod16.z.object({
|
|
1207
|
+
...CABVariableFields,
|
|
1208
|
+
errorMessages: import_zod16.z.record(
|
|
1209
|
+
import_zod16.z.string(),
|
|
1210
|
+
import_zod16.z.object({
|
|
1135
1211
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
1136
|
-
increment:
|
|
1137
|
-
max:
|
|
1138
|
-
min:
|
|
1139
|
-
neg:
|
|
1212
|
+
increment: import_zod16.z.string().optional(),
|
|
1213
|
+
max: import_zod16.z.string().optional(),
|
|
1214
|
+
min: import_zod16.z.string().optional(),
|
|
1215
|
+
neg: import_zod16.z.string().optional()
|
|
1140
1216
|
})
|
|
1141
1217
|
).default({
|
|
1142
1218
|
en: {
|
|
@@ -1146,19 +1222,18 @@ var CABQuantitySection = import_zod15.z.object({
|
|
|
1146
1222
|
neg: "Quantity cannot be negative"
|
|
1147
1223
|
}
|
|
1148
1224
|
}),
|
|
1149
|
-
inputType:
|
|
1150
|
-
max:
|
|
1151
|
-
min:
|
|
1225
|
+
inputType: import_zod16.z.enum(quantityInputs).default(QuantityInput.select),
|
|
1226
|
+
max: import_zod16.z.number().min(1).max(100).default(10),
|
|
1227
|
+
min: import_zod16.z.number().min(1).default(1),
|
|
1152
1228
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
1153
|
-
name:
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
sectionType: import_zod15.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1229
|
+
name: import_zod16.z.string().default("Quantity"),
|
|
1230
|
+
sectionId: import_zod16.z.uuid().default(() => (0, import_uuid9.v7)()),
|
|
1231
|
+
sectionType: import_zod16.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1157
1232
|
});
|
|
1158
1233
|
|
|
1159
1234
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1160
1235
|
var import_uuid10 = require("uuid");
|
|
1161
|
-
var
|
|
1236
|
+
var import_zod17 = require("zod");
|
|
1162
1237
|
|
|
1163
1238
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
1164
1239
|
var REVIEW_LABELS = {
|
|
@@ -1221,50 +1296,50 @@ var REVIEW_LABELS = {
|
|
|
1221
1296
|
};
|
|
1222
1297
|
|
|
1223
1298
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1224
|
-
var CABReviewsSection =
|
|
1225
|
-
|
|
1299
|
+
var CABReviewsSection = import_zod17.z.object({
|
|
1300
|
+
...CABVariableFields,
|
|
1301
|
+
color: import_zod17.z.string().default("#fadb14"),
|
|
1226
1302
|
/**
|
|
1227
1303
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
1228
1304
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
1229
1305
|
* or merchant work.
|
|
1230
1306
|
*/
|
|
1231
|
-
countLabels:
|
|
1232
|
-
one:
|
|
1233
|
-
other:
|
|
1307
|
+
countLabels: import_zod17.z.object({
|
|
1308
|
+
one: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
1309
|
+
other: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
1234
1310
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
1235
|
-
name:
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
size: import_zod16.z.enum(reviewsSizes).default(ReviewsSize.default)
|
|
1311
|
+
name: import_zod17.z.string().optional(),
|
|
1312
|
+
sectionId: import_zod17.z.uuid().default(() => (0, import_uuid10.v7)()),
|
|
1313
|
+
sectionType: import_zod17.z.literal(SectionType.reviews).default(SectionType.reviews),
|
|
1314
|
+
size: import_zod17.z.enum(reviewsSizes).default(ReviewsSize.default)
|
|
1240
1315
|
});
|
|
1241
1316
|
|
|
1242
1317
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
1243
1318
|
var import_compat3 = require("es-toolkit/compat");
|
|
1244
1319
|
var import_uuid11 = require("uuid");
|
|
1245
|
-
var
|
|
1246
|
-
var CABVariantsSection =
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
sectionId:
|
|
1251
|
-
sectionType:
|
|
1252
|
-
selector:
|
|
1253
|
-
variantMode:
|
|
1320
|
+
var import_zod18 = require("zod");
|
|
1321
|
+
var CABVariantsSection = import_zod18.z.object({
|
|
1322
|
+
...CABVariableFields,
|
|
1323
|
+
hideOutOfStockVariants: import_zod18.z.boolean().default(false),
|
|
1324
|
+
name: import_zod18.z.string().optional(),
|
|
1325
|
+
sectionId: import_zod18.z.uuid().default(() => (0, import_uuid11.v7)()),
|
|
1326
|
+
sectionType: import_zod18.z.literal(SectionType.variants).default(SectionType.variants),
|
|
1327
|
+
selector: import_zod18.z.enum((0, import_compat3.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
1328
|
+
variantMode: import_zod18.z.enum(variantModes).default(VariantMode.multiple)
|
|
1254
1329
|
});
|
|
1255
1330
|
|
|
1256
1331
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
1257
|
-
var CABBorder =
|
|
1258
|
-
radius:
|
|
1259
|
-
style:
|
|
1260
|
-
width:
|
|
1332
|
+
var CABBorder = import_zod19.z.object({
|
|
1333
|
+
radius: import_zod19.z.enum(borderRadii).default(BorderRadius.base),
|
|
1334
|
+
style: import_zod19.z.enum(borderStyles).default(BorderStyle.none),
|
|
1335
|
+
width: import_zod19.z.enum(borderWidths).default(BorderWidth.base)
|
|
1261
1336
|
}).default({
|
|
1262
1337
|
radius: BorderRadius.base,
|
|
1263
1338
|
style: BorderStyle.none,
|
|
1264
1339
|
width: BorderWidth.base
|
|
1265
1340
|
});
|
|
1266
|
-
var CABSection =
|
|
1267
|
-
() =>
|
|
1341
|
+
var CABSection = import_zod19.z.lazy(
|
|
1342
|
+
() => import_zod19.z.discriminatedUnion("sectionType", [
|
|
1268
1343
|
CABBannerSection,
|
|
1269
1344
|
CABButtonSection,
|
|
1270
1345
|
CABCarouselSection,
|
|
@@ -1286,16 +1361,17 @@ var CABSection = import_zod18.z.lazy(
|
|
|
1286
1361
|
);
|
|
1287
1362
|
|
|
1288
1363
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
1289
|
-
var CABImageSectionFields =
|
|
1290
|
-
|
|
1364
|
+
var CABImageSectionFields = import_zod20.z.object({
|
|
1365
|
+
...CABVariableFields,
|
|
1366
|
+
altText: import_zod20.z.string().refine(checkForHTML, NO_HTML).default(""),
|
|
1291
1367
|
/**
|
|
1292
1368
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
1293
1369
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
1294
1370
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
1295
1371
|
*/
|
|
1296
|
-
aspectRatio:
|
|
1297
|
-
border:
|
|
1298
|
-
buttonField:
|
|
1372
|
+
aspectRatio: import_zod20.z.number().positive().nullable().default(null),
|
|
1373
|
+
border: import_zod20.z.lazy(() => CABBorder),
|
|
1374
|
+
buttonField: import_zod20.z.enum(buttonFields).optional(),
|
|
1299
1375
|
/**
|
|
1300
1376
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
1301
1377
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -1314,30 +1390,29 @@ var CABImageSectionFields = import_zod19.z.object({
|
|
|
1314
1390
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
1315
1391
|
* the risky half.
|
|
1316
1392
|
*/
|
|
1317
|
-
category:
|
|
1393
|
+
category: import_zod20.z.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
1318
1394
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
1319
|
-
iconSize:
|
|
1395
|
+
iconSize: import_zod20.z.enum(iconSizes).nullable().default(null),
|
|
1320
1396
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
1321
|
-
iconTone:
|
|
1322
|
-
name:
|
|
1323
|
-
naturalHeight:
|
|
1324
|
-
naturalWidth:
|
|
1397
|
+
iconTone: import_zod20.z.enum(iconTones).nullable().default(null),
|
|
1398
|
+
name: import_zod20.z.string().optional(),
|
|
1399
|
+
naturalHeight: import_zod20.z.number().default(0),
|
|
1400
|
+
naturalWidth: import_zod20.z.number().default(0),
|
|
1325
1401
|
/**
|
|
1326
1402
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
1327
1403
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
1328
1404
|
*/
|
|
1329
|
-
objectFit:
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
sectionType: import_zod19.z.literal(SectionType.image).default(SectionType.image),
|
|
1405
|
+
objectFit: import_zod20.z.enum(objectFits).default(ObjectFit.contain),
|
|
1406
|
+
sectionId: import_zod20.z.uuid().default(() => (0, import_uuid12.v7)()),
|
|
1407
|
+
sectionType: import_zod20.z.literal(SectionType.image).default(SectionType.image),
|
|
1333
1408
|
/**
|
|
1334
1409
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
1335
1410
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
1336
1411
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
1337
1412
|
* server-chosen tier icon actually needs it.
|
|
1338
1413
|
*/
|
|
1339
|
-
source:
|
|
1340
|
-
width:
|
|
1414
|
+
source: import_zod20.z.union([import_zod20.z.url(), import_zod20.z.literal(""), import_zod20.z.string().regex(DYNAMIC_TOKEN_REGEX), import_zod20.z.enum(iconNames)]).default(""),
|
|
1415
|
+
width: import_zod20.z.number().default(100)
|
|
1341
1416
|
});
|
|
1342
1417
|
var iconNameSet = new Set(iconNames);
|
|
1343
1418
|
var isIconName = (source) => iconNameSet.has(source);
|
|
@@ -1487,7 +1562,7 @@ var convertContentBlockTextToV2 = (language) => {
|
|
|
1487
1562
|
};
|
|
1488
1563
|
|
|
1489
1564
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1490
|
-
var
|
|
1565
|
+
var import_zod21 = require("zod");
|
|
1491
1566
|
|
|
1492
1567
|
// src/schema/widgets/checkout-and-beyond/uiLabels.ts
|
|
1493
1568
|
var UI_LABELS = {
|
|
@@ -1503,8 +1578,8 @@ var UI_LABELS = {
|
|
|
1503
1578
|
};
|
|
1504
1579
|
|
|
1505
1580
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1506
|
-
var localized = (fallback) =>
|
|
1507
|
-
var CABUILabels =
|
|
1581
|
+
var localized = (fallback) => import_zod21.z.record(import_zod21.z.string(), import_zod21.z.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
1582
|
+
var CABUILabels = import_zod21.z.object({
|
|
1508
1583
|
currentPage: localized(UI_LABELS.currentPage),
|
|
1509
1584
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
1510
1585
|
nextPage: localized(UI_LABELS.nextPage),
|
|
@@ -1525,37 +1600,37 @@ var CABUILabels = import_zod20.z.object({
|
|
|
1525
1600
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
1526
1601
|
updating: { ...UI_LABELS.updating }
|
|
1527
1602
|
}));
|
|
1528
|
-
var TargetArea =
|
|
1529
|
-
fill:
|
|
1530
|
-
flip:
|
|
1531
|
-
icon:
|
|
1532
|
-
label:
|
|
1533
|
-
width:
|
|
1603
|
+
var TargetArea = import_zod21.z.object({
|
|
1604
|
+
fill: import_zod21.z.boolean().optional(),
|
|
1605
|
+
flip: import_zod21.z.enum(["both", "horizontal", "vertical"]).optional(),
|
|
1606
|
+
icon: import_zod21.z.string(),
|
|
1607
|
+
label: import_zod21.z.string(),
|
|
1608
|
+
width: import_zod21.z.string()
|
|
1534
1609
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
1535
|
-
var CABTracking =
|
|
1536
|
-
enableAttribution:
|
|
1537
|
-
enableSource:
|
|
1538
|
-
enableWidget:
|
|
1610
|
+
var CABTracking = import_zod21.z.object({
|
|
1611
|
+
enableAttribution: import_zod21.z.boolean().nullish().transform((value) => value ?? true),
|
|
1612
|
+
enableSource: import_zod21.z.boolean().nullish().transform((value) => value ?? true),
|
|
1613
|
+
enableWidget: import_zod21.z.boolean().nullish().transform((value) => value ?? true)
|
|
1539
1614
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
1540
|
-
var CABExperiment =
|
|
1541
|
-
elementId:
|
|
1542
|
-
experimentId:
|
|
1543
|
-
experimentType:
|
|
1544
|
-
selectedId:
|
|
1615
|
+
var CABExperiment = import_zod21.z.object({
|
|
1616
|
+
elementId: import_zod21.z.number(),
|
|
1617
|
+
experimentId: import_zod21.z.number(),
|
|
1618
|
+
experimentType: import_zod21.z.string(),
|
|
1619
|
+
selectedId: import_zod21.z.number()
|
|
1545
1620
|
});
|
|
1546
1621
|
var CABRootSection = CABLayoutSection.extend({
|
|
1547
|
-
editorMode:
|
|
1622
|
+
editorMode: import_zod21.z.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
1548
1623
|
experiment: CABExperiment.optional(),
|
|
1549
1624
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
1550
1625
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
1551
|
-
previewMode:
|
|
1552
|
-
storeId:
|
|
1626
|
+
previewMode: import_zod21.z.boolean().nullish().transform((value) => value ?? false),
|
|
1627
|
+
storeId: import_zod21.z.number().nullable().default(null),
|
|
1553
1628
|
targetArea: TargetArea.nullable(),
|
|
1554
1629
|
tracking: CABTracking,
|
|
1555
|
-
type:
|
|
1630
|
+
type: import_zod21.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
1556
1631
|
uiLabels: CABUILabels,
|
|
1557
|
-
version:
|
|
1558
|
-
widgetId:
|
|
1632
|
+
version: import_zod21.z.literal(2).default(2),
|
|
1633
|
+
widgetId: import_zod21.z.number().nullable().default(null)
|
|
1559
1634
|
});
|
|
1560
1635
|
|
|
1561
1636
|
// src/transforms/v1Location.ts
|
|
@@ -3140,6 +3215,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3140
3215
|
sectionType: "carousel"
|
|
3141
3216
|
};
|
|
3142
3217
|
return CABRootSection.parse({
|
|
3218
|
+
alignment: { horizontal: "center", vertical: "top" },
|
|
3143
3219
|
direction: "rows",
|
|
3144
3220
|
editorMode: LOCATION_TO_EDITOR_MODE[settings.location ?? "checkout"],
|
|
3145
3221
|
// The widget name is required by the admin save schema; carry the legacy widget's name through.
|