@rebuy/rebuy 3.27.0 → 3.28.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 +376 -347
- package/dist/index.mjs +375 -346
- package/dist/schema/checkout-and-beyond/constants.cjs +5 -0
- package/dist/schema/checkout-and-beyond/constants.mjs +5 -0
- package/dist/schema/checkout-and-beyond/index.cjs +97 -68
- package/dist/schema/checkout-and-beyond/index.mjs +97 -68
- package/dist/schema/widget-data.cjs +160 -135
- package/dist/schema/widget-data.mjs +160 -135
- package/dist/schema/widgetData.d.ts +24 -0
- package/dist/schema/widgets/checkout-and-beyond/banner.d.ts +8 -0
- package/dist/schema/widgets/checkout-and-beyond/carousel.d.ts +8 -0
- package/dist/schema/widgets/checkout-and-beyond/cartLine.d.ts +8 -0
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts +13 -1
- package/dist/schema/widgets/checkout-and-beyond/index.d.ts +1 -0
- package/dist/schema/widgets/checkout-and-beyond/layout.d.ts +17 -1
- package/dist/schema/widgets/checkout-and-beyond/offers.d.ts +8 -0
- package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts +8 -0
- package/dist/schema/widgets/checkout-and-beyond/reviews.d.ts +2 -0
- package/dist/schema/widgets/checkout-and-beyond/root.d.ts +8 -0
- package/dist/schema/widgets/checkout-and-beyond/separator.d.ts +192 -0
- package/dist/schema/widgets/checkout-and-beyond/shared.d.ts +2 -1
- package/dist/schema/widgets/contentBlock.d.ts +8 -0
- package/dist/schema/widgets/lineItemEditor.d.ts +8 -0
- package/dist/schema/widgets/post-purchase-offer/constants.d.ts +2 -2
- package/dist/schema/widgets/rebuyButton.d.ts +8 -0
- package/dist/server/index.cjs +601 -188
- package/dist/server/index.mjs +601 -188
- package/dist/transforms/index.cjs +481 -59
- package/dist/transforms/index.d.ts +2 -0
- package/dist/transforms/index.mjs +481 -59
- package/dist/transforms/postPurchase/convertCalloutBlock.d.ts +8 -0
- package/dist/transforms/postPurchase/convertMessagePreview.d.ts +8 -0
- package/dist/transforms/postPurchase/convertPayButtonBlock.d.ts +4 -0
- package/dist/transforms/postPurchase/convertSeparatorBlock.d.ts +4 -0
- package/dist/transforms/postPurchase/convertTextBlock.d.ts +4 -0
- package/dist/transforms/postPurchase/convertTimerBlock.d.ts +4 -0
- package/dist/transforms/postPurchase/styledTextRun.d.ts +3 -0
- package/dist/transforms/postPurchase/types.d.ts +8 -0
- package/package.json +1 -1
|
@@ -35,6 +35,7 @@ __export(common_exports, {
|
|
|
35
35
|
HorizontalAlignment: () => HorizontalAlignment,
|
|
36
36
|
InlineTextSizeName: () => InlineTextSizeName,
|
|
37
37
|
LanguageKey: () => LanguageKey,
|
|
38
|
+
LayoutFrame: () => LayoutFrame,
|
|
38
39
|
MutatorEvent: () => MutatorEvent,
|
|
39
40
|
ObjectFit: () => ObjectFit,
|
|
40
41
|
OffersDirection: () => OffersDirection,
|
|
@@ -74,6 +75,7 @@ __export(common_exports, {
|
|
|
74
75
|
horizontalAlignments: () => horizontalAlignments,
|
|
75
76
|
inlineTextSizeNames: () => inlineTextSizeNames,
|
|
76
77
|
languageKeys: () => languageKeys,
|
|
78
|
+
layoutFrames: () => layoutFrames,
|
|
77
79
|
mutatorEvents: () => mutatorEvents,
|
|
78
80
|
objectFits: () => objectFits,
|
|
79
81
|
offersDirections: () => offersDirections,
|
|
@@ -206,6 +208,8 @@ var languageKeys = [
|
|
|
206
208
|
"zh"
|
|
207
209
|
];
|
|
208
210
|
var LanguageKey = freezeEnum(languageKeys);
|
|
211
|
+
var layoutFrames = ["callout", "offer-content"];
|
|
212
|
+
var LayoutFrame = freezeEnum(layoutFrames);
|
|
209
213
|
var mutatorEvents = ["item_added", "quantity_changed", "variant_selected"];
|
|
210
214
|
var MutatorEvent = freezeEnum(mutatorEvents);
|
|
211
215
|
var objectFits = ["cover", "contain"];
|
|
@@ -250,6 +254,7 @@ var sectionTypes = [
|
|
|
250
254
|
"progressBar",
|
|
251
255
|
"quantity",
|
|
252
256
|
"reviews",
|
|
257
|
+
"separator",
|
|
253
258
|
"text",
|
|
254
259
|
"variants"
|
|
255
260
|
];
|
|
@@ -105,6 +105,8 @@ var languageKeys = [
|
|
|
105
105
|
"zh"
|
|
106
106
|
];
|
|
107
107
|
var LanguageKey = freezeEnum(languageKeys);
|
|
108
|
+
var layoutFrames = ["callout", "offer-content"];
|
|
109
|
+
var LayoutFrame = freezeEnum(layoutFrames);
|
|
108
110
|
var mutatorEvents = ["item_added", "quantity_changed", "variant_selected"];
|
|
109
111
|
var MutatorEvent = freezeEnum(mutatorEvents);
|
|
110
112
|
var objectFits = ["cover", "contain"];
|
|
@@ -149,6 +151,7 @@ var sectionTypes = [
|
|
|
149
151
|
"progressBar",
|
|
150
152
|
"quantity",
|
|
151
153
|
"reviews",
|
|
154
|
+
"separator",
|
|
152
155
|
"text",
|
|
153
156
|
"variants"
|
|
154
157
|
];
|
|
@@ -216,6 +219,7 @@ export {
|
|
|
216
219
|
HorizontalAlignment,
|
|
217
220
|
InlineTextSizeName,
|
|
218
221
|
LanguageKey,
|
|
222
|
+
LayoutFrame,
|
|
219
223
|
MutatorEvent,
|
|
220
224
|
ObjectFit,
|
|
221
225
|
OffersDirection,
|
|
@@ -255,6 +259,7 @@ export {
|
|
|
255
259
|
horizontalAlignments,
|
|
256
260
|
inlineTextSizeNames,
|
|
257
261
|
languageKeys,
|
|
262
|
+
layoutFrames,
|
|
258
263
|
mutatorEvents,
|
|
259
264
|
objectFits,
|
|
260
265
|
offersDirections,
|
|
@@ -45,6 +45,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
45
45
|
CABImageSectionFields: () => CABImageSectionFields,
|
|
46
46
|
CABIntegrations: () => CABIntegrations,
|
|
47
47
|
CABLayoutSection: () => CABLayoutSection,
|
|
48
|
+
CABLayoutWrapping: () => CABLayoutWrapping,
|
|
48
49
|
CABMonetizeAds: () => CABMonetizeAds,
|
|
49
50
|
CABMonetizeSection: () => CABMonetizeSection,
|
|
50
51
|
CABNumberVariable: () => CABNumberVariable,
|
|
@@ -62,6 +63,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
62
63
|
CABRuleset: () => CABRuleset,
|
|
63
64
|
CABRulesetEntry: () => CABRulesetEntry,
|
|
64
65
|
CABSection: () => CABSection,
|
|
66
|
+
CABSeparatorSection: () => CABSeparatorSection,
|
|
65
67
|
CABTextSection: () => CABTextSection,
|
|
66
68
|
CABTextTier: () => CABTextTier,
|
|
67
69
|
CABTextVariable: () => CABTextVariable,
|
|
@@ -96,6 +98,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
96
98
|
IconTone: () => IconTone,
|
|
97
99
|
InlineTextSizeName: () => InlineTextSizeName,
|
|
98
100
|
LanguageKey: () => LanguageKey,
|
|
101
|
+
LayoutFrame: () => LayoutFrame,
|
|
99
102
|
MutatorEvent: () => MutatorEvent,
|
|
100
103
|
NO_HTML: () => NO_HTML,
|
|
101
104
|
OFFER_LABELS: () => OFFER_LABELS,
|
|
@@ -174,6 +177,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
174
177
|
isTextType: () => isTextType,
|
|
175
178
|
isVariantsType: () => isVariantsType,
|
|
176
179
|
languageKeys: () => languageKeys,
|
|
180
|
+
layoutFrames: () => layoutFrames,
|
|
177
181
|
mutatorEvents: () => mutatorEvents,
|
|
178
182
|
objectFits: () => objectFits,
|
|
179
183
|
offersDirections: () => offersDirections,
|
|
@@ -205,7 +209,7 @@ __export(checkout_and_beyond_exports, {
|
|
|
205
209
|
module.exports = __toCommonJS(checkout_and_beyond_exports);
|
|
206
210
|
|
|
207
211
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
208
|
-
var
|
|
212
|
+
var import_zod21 = require("zod");
|
|
209
213
|
|
|
210
214
|
// src/schema/widgets/checkout-and-beyond/common.ts
|
|
211
215
|
var freezeEnum = (values) => Object.freeze(Object.fromEntries(values.map((v) => [v, v])));
|
|
@@ -314,6 +318,8 @@ var languageKeys = [
|
|
|
314
318
|
"zh"
|
|
315
319
|
];
|
|
316
320
|
var LanguageKey = freezeEnum(languageKeys);
|
|
321
|
+
var layoutFrames = ["callout", "offer-content"];
|
|
322
|
+
var LayoutFrame = freezeEnum(layoutFrames);
|
|
317
323
|
var mutatorEvents = ["item_added", "quantity_changed", "variant_selected"];
|
|
318
324
|
var MutatorEvent = freezeEnum(mutatorEvents);
|
|
319
325
|
var objectFits = ["cover", "contain"];
|
|
@@ -358,6 +364,7 @@ var sectionTypes = [
|
|
|
358
364
|
"progressBar",
|
|
359
365
|
"quantity",
|
|
360
366
|
"reviews",
|
|
367
|
+
"separator",
|
|
361
368
|
"text",
|
|
362
369
|
"variants"
|
|
363
370
|
];
|
|
@@ -411,11 +418,11 @@ var widgetTypes = [
|
|
|
411
418
|
var WidgetType = freezeEnum(widgetTypes);
|
|
412
419
|
|
|
413
420
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
414
|
-
var
|
|
415
|
-
var
|
|
421
|
+
var import_uuid13 = require("uuid");
|
|
422
|
+
var import_zod20 = require("zod");
|
|
416
423
|
|
|
417
424
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
418
|
-
var
|
|
425
|
+
var import_zod19 = require("zod");
|
|
419
426
|
|
|
420
427
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
421
428
|
var import_uuid3 = require("uuid");
|
|
@@ -1564,35 +1571,46 @@ var CABReviewsSection = import_zod16.z.object({
|
|
|
1564
1571
|
name: import_zod16.z.string().optional(),
|
|
1565
1572
|
sectionId: import_zod16.z.uuid().default(() => (0, import_uuid10.v7)()),
|
|
1566
1573
|
sectionType: import_zod16.z.literal(SectionType.reviews).default(SectionType.reviews),
|
|
1567
|
-
size: import_zod16.z.enum(reviewsSizes).default(ReviewsSize.default)
|
|
1574
|
+
size: import_zod16.z.enum(reviewsSizes).default(ReviewsSize.default),
|
|
1575
|
+
strokeColor: import_zod16.z.string().default("#fadb14"),
|
|
1576
|
+
strokeWidth: import_zod16.z.number().nonnegative().default(0)
|
|
1568
1577
|
});
|
|
1569
1578
|
|
|
1570
|
-
// src/schema/widgets/checkout-and-beyond/
|
|
1571
|
-
var import_compat3 = require("es-toolkit/compat");
|
|
1579
|
+
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
1572
1580
|
var import_uuid11 = require("uuid");
|
|
1573
1581
|
var import_zod17 = require("zod");
|
|
1574
|
-
var
|
|
1582
|
+
var CABSeparatorSection = import_zod17.z.object({
|
|
1575
1583
|
...CABVariableFields,
|
|
1576
|
-
hideOutOfStockVariants: import_zod17.z.boolean().default(false),
|
|
1577
|
-
name: import_zod17.z.string().optional(),
|
|
1578
1584
|
sectionId: import_zod17.z.uuid().default(() => (0, import_uuid11.v7)()),
|
|
1579
|
-
sectionType: import_zod17.z.literal(SectionType.
|
|
1580
|
-
|
|
1581
|
-
|
|
1585
|
+
sectionType: import_zod17.z.literal(SectionType.separator).default(SectionType.separator)
|
|
1586
|
+
});
|
|
1587
|
+
|
|
1588
|
+
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
1589
|
+
var import_compat3 = require("es-toolkit/compat");
|
|
1590
|
+
var import_uuid12 = require("uuid");
|
|
1591
|
+
var import_zod18 = require("zod");
|
|
1592
|
+
var CABVariantsSection = import_zod18.z.object({
|
|
1593
|
+
...CABVariableFields,
|
|
1594
|
+
hideOutOfStockVariants: import_zod18.z.boolean().default(false),
|
|
1595
|
+
name: import_zod18.z.string().optional(),
|
|
1596
|
+
sectionId: import_zod18.z.uuid().default(() => (0, import_uuid12.v7)()),
|
|
1597
|
+
sectionType: import_zod18.z.literal(SectionType.variants).default(SectionType.variants),
|
|
1598
|
+
selector: import_zod18.z.enum((0, import_compat3.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
1599
|
+
variantMode: import_zod18.z.enum(variantModes).default(VariantMode.multiple)
|
|
1582
1600
|
});
|
|
1583
1601
|
|
|
1584
1602
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
1585
|
-
var CABBorder =
|
|
1586
|
-
radius:
|
|
1587
|
-
style:
|
|
1588
|
-
width:
|
|
1603
|
+
var CABBorder = import_zod19.z.object({
|
|
1604
|
+
radius: import_zod19.z.enum(borderRadii).default(BorderRadius.base),
|
|
1605
|
+
style: import_zod19.z.enum(borderStyles).default(BorderStyle.none),
|
|
1606
|
+
width: import_zod19.z.enum(borderWidths).default(BorderWidth.base)
|
|
1589
1607
|
}).default({
|
|
1590
1608
|
radius: BorderRadius.base,
|
|
1591
1609
|
style: BorderStyle.none,
|
|
1592
1610
|
width: BorderWidth.base
|
|
1593
1611
|
});
|
|
1594
|
-
var CABSection =
|
|
1595
|
-
() =>
|
|
1612
|
+
var CABSection = import_zod19.z.lazy(
|
|
1613
|
+
() => import_zod19.z.discriminatedUnion("sectionType", [
|
|
1596
1614
|
CABBannerSection,
|
|
1597
1615
|
CABButtonSection,
|
|
1598
1616
|
CABCarouselSection,
|
|
@@ -1608,46 +1626,57 @@ var CABSection = import_zod18.z.lazy(
|
|
|
1608
1626
|
CABProgressBarSection,
|
|
1609
1627
|
CABQuantitySection,
|
|
1610
1628
|
CABReviewsSection,
|
|
1629
|
+
CABSeparatorSection,
|
|
1611
1630
|
CABTextSection,
|
|
1612
1631
|
CABVariantsSection
|
|
1613
1632
|
])
|
|
1614
1633
|
);
|
|
1615
1634
|
|
|
1616
1635
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
1617
|
-
var GridItem =
|
|
1618
|
-
var
|
|
1636
|
+
var GridItem = import_zod20.z.union([import_zod20.z.literal("auto"), import_zod20.z.literal("fill"), import_zod20.z.string().regex(/^\d+%$/), import_zod20.z.number()]);
|
|
1637
|
+
var CABLayoutWrapping = import_zod20.z.object({
|
|
1638
|
+
breakAt: import_zod20.z.number().positive(),
|
|
1639
|
+
maxPerLine: import_zod20.z.number().int().positive()
|
|
1640
|
+
});
|
|
1641
|
+
var CABLayoutSection = import_zod20.z.object({
|
|
1619
1642
|
...CABVariableFields,
|
|
1620
|
-
alignment:
|
|
1621
|
-
horizontal:
|
|
1622
|
-
vertical:
|
|
1643
|
+
alignment: import_zod20.z.object({
|
|
1644
|
+
horizontal: import_zod20.z.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
1645
|
+
vertical: import_zod20.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
1623
1646
|
}).default({
|
|
1624
1647
|
horizontal: HorizontalAlignment.start,
|
|
1625
1648
|
vertical: VerticalAlignment.top
|
|
1626
1649
|
}),
|
|
1627
|
-
border:
|
|
1628
|
-
buttonField:
|
|
1629
|
-
direction:
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1650
|
+
border: import_zod20.z.lazy(() => CABBorder),
|
|
1651
|
+
buttonField: import_zod20.z.enum(buttonFields).optional(),
|
|
1652
|
+
direction: import_zod20.z.enum(directions).default(Direction.rows),
|
|
1653
|
+
/**
|
|
1654
|
+
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
1655
|
+
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
1656
|
+
*/
|
|
1657
|
+
frame: import_zod20.z.enum(layoutFrames).optional(),
|
|
1658
|
+
grid: import_zod20.z.object({
|
|
1659
|
+
columns: import_zod20.z.union([import_zod20.z.array(GridItem), import_zod20.z.undefined()]).default(() => ["auto"]),
|
|
1660
|
+
rows: import_zod20.z.union([import_zod20.z.array(GridItem), import_zod20.z.undefined()]).default(() => ["auto"])
|
|
1633
1661
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
1634
|
-
name:
|
|
1635
|
-
padding:
|
|
1636
|
-
sectionId:
|
|
1637
|
-
sections:
|
|
1638
|
-
sectionType:
|
|
1639
|
-
spacing:
|
|
1662
|
+
name: import_zod20.z.string().optional(),
|
|
1663
|
+
padding: import_zod20.z.enum(spacings).default(Spacing.none),
|
|
1664
|
+
sectionId: import_zod20.z.uuid().default(() => (0, import_uuid13.v7)()),
|
|
1665
|
+
sections: import_zod20.z.union([import_zod20.z.array(import_zod20.z.lazy(() => CABSection)), import_zod20.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
1666
|
+
sectionType: import_zod20.z.literal(SectionType.layout).default(SectionType.layout),
|
|
1667
|
+
spacing: import_zod20.z.enum(spacings).default(Spacing.base),
|
|
1640
1668
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
1641
|
-
viewUrl:
|
|
1642
|
-
width:
|
|
1669
|
+
viewUrl: import_zod20.z.string().optional(),
|
|
1670
|
+
width: import_zod20.z.number().default(100),
|
|
1671
|
+
wrapping: CABLayoutWrapping.optional()
|
|
1643
1672
|
});
|
|
1644
1673
|
|
|
1645
1674
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
1646
|
-
var CABBannerSection =
|
|
1675
|
+
var CABBannerSection = import_zod21.z.lazy(
|
|
1647
1676
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1648
|
-
buttonField:
|
|
1649
|
-
color:
|
|
1650
|
-
dismissible:
|
|
1677
|
+
buttonField: import_zod21.z.enum(buttonFields).optional(),
|
|
1678
|
+
color: import_zod21.z.enum(bannerColors).default("info"),
|
|
1679
|
+
dismissible: import_zod21.z.boolean().default(true),
|
|
1651
1680
|
/**
|
|
1652
1681
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
1653
1682
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -1663,8 +1692,8 @@ var CABBannerSection = import_zod20.z.lazy(
|
|
|
1663
1692
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
1664
1693
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
1665
1694
|
*/
|
|
1666
|
-
heading:
|
|
1667
|
-
sectionType:
|
|
1695
|
+
heading: import_zod21.z.record(import_zod21.z.string(), import_zod21.z.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
1696
|
+
sectionType: import_zod21.z.literal(SectionType.banner).default(SectionType.banner)
|
|
1668
1697
|
})
|
|
1669
1698
|
);
|
|
1670
1699
|
|
|
@@ -1901,7 +1930,7 @@ var OFFER_LABELS = {
|
|
|
1901
1930
|
};
|
|
1902
1931
|
|
|
1903
1932
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1904
|
-
var
|
|
1933
|
+
var import_zod22 = require("zod");
|
|
1905
1934
|
|
|
1906
1935
|
// src/schema/widgets/checkout-and-beyond/uiLabels.ts
|
|
1907
1936
|
var UI_LABELS = {
|
|
@@ -1921,8 +1950,8 @@ var UI_LABELS = {
|
|
|
1921
1950
|
};
|
|
1922
1951
|
|
|
1923
1952
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1924
|
-
var localized = (fallback) =>
|
|
1925
|
-
var CABUILabels =
|
|
1953
|
+
var localized = (fallback) => import_zod22.z.record(import_zod22.z.string(), import_zod22.z.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
1954
|
+
var CABUILabels = import_zod22.z.object({
|
|
1926
1955
|
currentPage: localized(UI_LABELS.currentPage),
|
|
1927
1956
|
guest: localized(UI_LABELS.guest),
|
|
1928
1957
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -1947,37 +1976,37 @@ var CABUILabels = import_zod21.z.object({
|
|
|
1947
1976
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
1948
1977
|
updating: { ...UI_LABELS.updating }
|
|
1949
1978
|
}));
|
|
1950
|
-
var TargetArea =
|
|
1951
|
-
fill:
|
|
1952
|
-
flip:
|
|
1953
|
-
icon:
|
|
1954
|
-
label:
|
|
1955
|
-
width:
|
|
1979
|
+
var TargetArea = import_zod22.z.object({
|
|
1980
|
+
fill: import_zod22.z.boolean().optional(),
|
|
1981
|
+
flip: import_zod22.z.enum(["both", "horizontal", "vertical"]).optional(),
|
|
1982
|
+
icon: import_zod22.z.string(),
|
|
1983
|
+
label: import_zod22.z.string(),
|
|
1984
|
+
width: import_zod22.z.string()
|
|
1956
1985
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
1957
|
-
var CABTracking =
|
|
1958
|
-
enableAttribution:
|
|
1959
|
-
enableSource:
|
|
1960
|
-
enableWidget:
|
|
1986
|
+
var CABTracking = import_zod22.z.object({
|
|
1987
|
+
enableAttribution: import_zod22.z.boolean().nullish().transform((value) => value ?? true),
|
|
1988
|
+
enableSource: import_zod22.z.boolean().nullish().transform((value) => value ?? true),
|
|
1989
|
+
enableWidget: import_zod22.z.boolean().nullish().transform((value) => value ?? true)
|
|
1961
1990
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
1962
|
-
var CABExperiment =
|
|
1963
|
-
elementId:
|
|
1964
|
-
experimentId:
|
|
1965
|
-
experimentType:
|
|
1966
|
-
selectedId:
|
|
1991
|
+
var CABExperiment = import_zod22.z.object({
|
|
1992
|
+
elementId: import_zod22.z.number(),
|
|
1993
|
+
experimentId: import_zod22.z.number(),
|
|
1994
|
+
experimentType: import_zod22.z.string(),
|
|
1995
|
+
selectedId: import_zod22.z.number()
|
|
1967
1996
|
});
|
|
1968
1997
|
var CABRootSection = CABLayoutSection.extend({
|
|
1969
|
-
editorMode:
|
|
1998
|
+
editorMode: import_zod22.z.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
1970
1999
|
experiment: CABExperiment.optional(),
|
|
1971
2000
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
1972
2001
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
1973
|
-
previewMode:
|
|
1974
|
-
storeId:
|
|
2002
|
+
previewMode: import_zod22.z.boolean().nullish().transform((value) => value ?? false),
|
|
2003
|
+
storeId: import_zod22.z.number().nullable().default(null),
|
|
1975
2004
|
targetArea: TargetArea.nullable(),
|
|
1976
2005
|
tracking: CABTracking,
|
|
1977
|
-
type:
|
|
2006
|
+
type: import_zod22.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
1978
2007
|
uiLabels: CABUILabels,
|
|
1979
|
-
version:
|
|
1980
|
-
widgetId:
|
|
2008
|
+
version: import_zod22.z.literal(2).default(2),
|
|
2009
|
+
widgetId: import_zod22.z.number().nullable().default(null)
|
|
1981
2010
|
});
|
|
1982
2011
|
|
|
1983
2012
|
// src/schema/widgets/checkout-and-beyond/switchLabels.ts
|