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