@rebuy/rebuy 3.27.0 → 3.28.1
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 +383 -347
- package/dist/index.mjs +382 -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 +104 -68
- package/dist/schema/checkout-and-beyond/index.mjs +104 -68
- package/dist/schema/widget-data.cjs +167 -135
- package/dist/schema/widget-data.mjs +167 -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 +606 -188
- package/dist/server/index.mjs +606 -188
- package/dist/transforms/index.cjs +486 -59
- package/dist/transforms/index.d.ts +2 -0
- package/dist/transforms/index.mjs +486 -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 +14 -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,53 @@ 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
|
+
/**
|
|
1576
|
+
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
1577
|
+
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
1578
|
+
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
1579
|
+
* the whole reviews section.
|
|
1580
|
+
*/
|
|
1581
|
+
strokeColor: import_zod16.z.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
1582
|
+
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
1583
|
+
strokeWidth: import_zod16.z.number().nonnegative().default(0)
|
|
1568
1584
|
});
|
|
1569
1585
|
|
|
1570
|
-
// src/schema/widgets/checkout-and-beyond/
|
|
1571
|
-
var import_compat3 = require("es-toolkit/compat");
|
|
1586
|
+
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
1572
1587
|
var import_uuid11 = require("uuid");
|
|
1573
1588
|
var import_zod17 = require("zod");
|
|
1574
|
-
var
|
|
1589
|
+
var CABSeparatorSection = import_zod17.z.object({
|
|
1575
1590
|
...CABVariableFields,
|
|
1576
|
-
hideOutOfStockVariants: import_zod17.z.boolean().default(false),
|
|
1577
|
-
name: import_zod17.z.string().optional(),
|
|
1578
1591
|
sectionId: import_zod17.z.uuid().default(() => (0, import_uuid11.v7)()),
|
|
1579
|
-
sectionType: import_zod17.z.literal(SectionType.
|
|
1580
|
-
|
|
1581
|
-
|
|
1592
|
+
sectionType: import_zod17.z.literal(SectionType.separator).default(SectionType.separator)
|
|
1593
|
+
});
|
|
1594
|
+
|
|
1595
|
+
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
1596
|
+
var import_compat3 = require("es-toolkit/compat");
|
|
1597
|
+
var import_uuid12 = require("uuid");
|
|
1598
|
+
var import_zod18 = require("zod");
|
|
1599
|
+
var CABVariantsSection = import_zod18.z.object({
|
|
1600
|
+
...CABVariableFields,
|
|
1601
|
+
hideOutOfStockVariants: import_zod18.z.boolean().default(false),
|
|
1602
|
+
name: import_zod18.z.string().optional(),
|
|
1603
|
+
sectionId: import_zod18.z.uuid().default(() => (0, import_uuid12.v7)()),
|
|
1604
|
+
sectionType: import_zod18.z.literal(SectionType.variants).default(SectionType.variants),
|
|
1605
|
+
selector: import_zod18.z.enum((0, import_compat3.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
1606
|
+
variantMode: import_zod18.z.enum(variantModes).default(VariantMode.multiple)
|
|
1582
1607
|
});
|
|
1583
1608
|
|
|
1584
1609
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
1585
|
-
var CABBorder =
|
|
1586
|
-
radius:
|
|
1587
|
-
style:
|
|
1588
|
-
width:
|
|
1610
|
+
var CABBorder = import_zod19.z.object({
|
|
1611
|
+
radius: import_zod19.z.enum(borderRadii).default(BorderRadius.base),
|
|
1612
|
+
style: import_zod19.z.enum(borderStyles).default(BorderStyle.none),
|
|
1613
|
+
width: import_zod19.z.enum(borderWidths).default(BorderWidth.base)
|
|
1589
1614
|
}).default({
|
|
1590
1615
|
radius: BorderRadius.base,
|
|
1591
1616
|
style: BorderStyle.none,
|
|
1592
1617
|
width: BorderWidth.base
|
|
1593
1618
|
});
|
|
1594
|
-
var CABSection =
|
|
1595
|
-
() =>
|
|
1619
|
+
var CABSection = import_zod19.z.lazy(
|
|
1620
|
+
() => import_zod19.z.discriminatedUnion("sectionType", [
|
|
1596
1621
|
CABBannerSection,
|
|
1597
1622
|
CABButtonSection,
|
|
1598
1623
|
CABCarouselSection,
|
|
@@ -1608,46 +1633,57 @@ var CABSection = import_zod18.z.lazy(
|
|
|
1608
1633
|
CABProgressBarSection,
|
|
1609
1634
|
CABQuantitySection,
|
|
1610
1635
|
CABReviewsSection,
|
|
1636
|
+
CABSeparatorSection,
|
|
1611
1637
|
CABTextSection,
|
|
1612
1638
|
CABVariantsSection
|
|
1613
1639
|
])
|
|
1614
1640
|
);
|
|
1615
1641
|
|
|
1616
1642
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
1617
|
-
var GridItem =
|
|
1618
|
-
var
|
|
1643
|
+
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()]);
|
|
1644
|
+
var CABLayoutWrapping = import_zod20.z.object({
|
|
1645
|
+
breakAt: import_zod20.z.number().positive(),
|
|
1646
|
+
maxPerLine: import_zod20.z.number().int().positive()
|
|
1647
|
+
});
|
|
1648
|
+
var CABLayoutSection = import_zod20.z.object({
|
|
1619
1649
|
...CABVariableFields,
|
|
1620
|
-
alignment:
|
|
1621
|
-
horizontal:
|
|
1622
|
-
vertical:
|
|
1650
|
+
alignment: import_zod20.z.object({
|
|
1651
|
+
horizontal: import_zod20.z.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
1652
|
+
vertical: import_zod20.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
1623
1653
|
}).default({
|
|
1624
1654
|
horizontal: HorizontalAlignment.start,
|
|
1625
1655
|
vertical: VerticalAlignment.top
|
|
1626
1656
|
}),
|
|
1627
|
-
border:
|
|
1628
|
-
buttonField:
|
|
1629
|
-
direction:
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1657
|
+
border: import_zod20.z.lazy(() => CABBorder),
|
|
1658
|
+
buttonField: import_zod20.z.enum(buttonFields).optional(),
|
|
1659
|
+
direction: import_zod20.z.enum(directions).default(Direction.rows),
|
|
1660
|
+
/**
|
|
1661
|
+
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
1662
|
+
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
1663
|
+
*/
|
|
1664
|
+
frame: import_zod20.z.enum(layoutFrames).optional(),
|
|
1665
|
+
grid: import_zod20.z.object({
|
|
1666
|
+
columns: import_zod20.z.union([import_zod20.z.array(GridItem), import_zod20.z.undefined()]).default(() => ["auto"]),
|
|
1667
|
+
rows: import_zod20.z.union([import_zod20.z.array(GridItem), import_zod20.z.undefined()]).default(() => ["auto"])
|
|
1633
1668
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
1634
|
-
name:
|
|
1635
|
-
padding:
|
|
1636
|
-
sectionId:
|
|
1637
|
-
sections:
|
|
1638
|
-
sectionType:
|
|
1639
|
-
spacing:
|
|
1669
|
+
name: import_zod20.z.string().optional(),
|
|
1670
|
+
padding: import_zod20.z.enum(spacings).default(Spacing.none),
|
|
1671
|
+
sectionId: import_zod20.z.uuid().default(() => (0, import_uuid13.v7)()),
|
|
1672
|
+
sections: import_zod20.z.union([import_zod20.z.array(import_zod20.z.lazy(() => CABSection)), import_zod20.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
1673
|
+
sectionType: import_zod20.z.literal(SectionType.layout).default(SectionType.layout),
|
|
1674
|
+
spacing: import_zod20.z.enum(spacings).default(Spacing.base),
|
|
1640
1675
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
1641
|
-
viewUrl:
|
|
1642
|
-
width:
|
|
1676
|
+
viewUrl: import_zod20.z.string().optional(),
|
|
1677
|
+
width: import_zod20.z.number().default(100),
|
|
1678
|
+
wrapping: CABLayoutWrapping.optional()
|
|
1643
1679
|
});
|
|
1644
1680
|
|
|
1645
1681
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
1646
|
-
var CABBannerSection =
|
|
1682
|
+
var CABBannerSection = import_zod21.z.lazy(
|
|
1647
1683
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
1648
|
-
buttonField:
|
|
1649
|
-
color:
|
|
1650
|
-
dismissible:
|
|
1684
|
+
buttonField: import_zod21.z.enum(buttonFields).optional(),
|
|
1685
|
+
color: import_zod21.z.enum(bannerColors).default("info"),
|
|
1686
|
+
dismissible: import_zod21.z.boolean().default(true),
|
|
1651
1687
|
/**
|
|
1652
1688
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
1653
1689
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -1663,8 +1699,8 @@ var CABBannerSection = import_zod20.z.lazy(
|
|
|
1663
1699
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
1664
1700
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
1665
1701
|
*/
|
|
1666
|
-
heading:
|
|
1667
|
-
sectionType:
|
|
1702
|
+
heading: import_zod21.z.record(import_zod21.z.string(), import_zod21.z.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
1703
|
+
sectionType: import_zod21.z.literal(SectionType.banner).default(SectionType.banner)
|
|
1668
1704
|
})
|
|
1669
1705
|
);
|
|
1670
1706
|
|
|
@@ -1901,7 +1937,7 @@ var OFFER_LABELS = {
|
|
|
1901
1937
|
};
|
|
1902
1938
|
|
|
1903
1939
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1904
|
-
var
|
|
1940
|
+
var import_zod22 = require("zod");
|
|
1905
1941
|
|
|
1906
1942
|
// src/schema/widgets/checkout-and-beyond/uiLabels.ts
|
|
1907
1943
|
var UI_LABELS = {
|
|
@@ -1921,8 +1957,8 @@ var UI_LABELS = {
|
|
|
1921
1957
|
};
|
|
1922
1958
|
|
|
1923
1959
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1924
|
-
var localized = (fallback) =>
|
|
1925
|
-
var CABUILabels =
|
|
1960
|
+
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 });
|
|
1961
|
+
var CABUILabels = import_zod22.z.object({
|
|
1926
1962
|
currentPage: localized(UI_LABELS.currentPage),
|
|
1927
1963
|
guest: localized(UI_LABELS.guest),
|
|
1928
1964
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -1947,37 +1983,37 @@ var CABUILabels = import_zod21.z.object({
|
|
|
1947
1983
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
1948
1984
|
updating: { ...UI_LABELS.updating }
|
|
1949
1985
|
}));
|
|
1950
|
-
var TargetArea =
|
|
1951
|
-
fill:
|
|
1952
|
-
flip:
|
|
1953
|
-
icon:
|
|
1954
|
-
label:
|
|
1955
|
-
width:
|
|
1986
|
+
var TargetArea = import_zod22.z.object({
|
|
1987
|
+
fill: import_zod22.z.boolean().optional(),
|
|
1988
|
+
flip: import_zod22.z.enum(["both", "horizontal", "vertical"]).optional(),
|
|
1989
|
+
icon: import_zod22.z.string(),
|
|
1990
|
+
label: import_zod22.z.string(),
|
|
1991
|
+
width: import_zod22.z.string()
|
|
1956
1992
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
1957
|
-
var CABTracking =
|
|
1958
|
-
enableAttribution:
|
|
1959
|
-
enableSource:
|
|
1960
|
-
enableWidget:
|
|
1993
|
+
var CABTracking = import_zod22.z.object({
|
|
1994
|
+
enableAttribution: import_zod22.z.boolean().nullish().transform((value) => value ?? true),
|
|
1995
|
+
enableSource: import_zod22.z.boolean().nullish().transform((value) => value ?? true),
|
|
1996
|
+
enableWidget: import_zod22.z.boolean().nullish().transform((value) => value ?? true)
|
|
1961
1997
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
1962
|
-
var CABExperiment =
|
|
1963
|
-
elementId:
|
|
1964
|
-
experimentId:
|
|
1965
|
-
experimentType:
|
|
1966
|
-
selectedId:
|
|
1998
|
+
var CABExperiment = import_zod22.z.object({
|
|
1999
|
+
elementId: import_zod22.z.number(),
|
|
2000
|
+
experimentId: import_zod22.z.number(),
|
|
2001
|
+
experimentType: import_zod22.z.string(),
|
|
2002
|
+
selectedId: import_zod22.z.number()
|
|
1967
2003
|
});
|
|
1968
2004
|
var CABRootSection = CABLayoutSection.extend({
|
|
1969
|
-
editorMode:
|
|
2005
|
+
editorMode: import_zod22.z.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
1970
2006
|
experiment: CABExperiment.optional(),
|
|
1971
2007
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
1972
2008
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
1973
|
-
previewMode:
|
|
1974
|
-
storeId:
|
|
2009
|
+
previewMode: import_zod22.z.boolean().nullish().transform((value) => value ?? false),
|
|
2010
|
+
storeId: import_zod22.z.number().nullable().default(null),
|
|
1975
2011
|
targetArea: TargetArea.nullable(),
|
|
1976
2012
|
tracking: CABTracking,
|
|
1977
|
-
type:
|
|
2013
|
+
type: import_zod22.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
1978
2014
|
uiLabels: CABUILabels,
|
|
1979
|
-
version:
|
|
1980
|
-
widgetId:
|
|
2015
|
+
version: import_zod22.z.literal(2).default(2),
|
|
2016
|
+
widgetId: import_zod22.z.number().nullable().default(null)
|
|
1981
2017
|
});
|
|
1982
2018
|
|
|
1983
2019
|
// src/schema/widgets/checkout-and-beyond/switchLabels.ts
|