@rebuy/rebuy 2.28.0 → 2.29.0-rc.2
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.js +286 -43
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +277 -34
- package/dist/index.mjs.map +4 -4
- package/dist/pricing/amountToCents.d.ts +10 -0
- package/dist/pricing/amountToCents.d.ts.map +1 -0
- package/dist/pricing/computeCompareAtPrice.d.ts +10 -0
- package/dist/pricing/computeCompareAtPrice.d.ts.map +1 -0
- package/dist/pricing/computeDisplayPrice.d.ts +17 -0
- package/dist/pricing/computeDisplayPrice.d.ts.map +1 -0
- package/dist/pricing/currencyDecimals.d.ts +12 -0
- package/dist/pricing/currencyDecimals.d.ts.map +1 -0
- package/dist/pricing/index.d.ts +7 -0
- package/dist/pricing/index.d.ts.map +1 -0
- package/dist/pricing/index.js +109 -0
- package/dist/pricing/index.js.map +7 -0
- package/dist/pricing/index.mjs +86 -0
- package/dist/pricing/index.mjs.map +7 -0
- package/dist/pricing/priceVariant.d.ts +10 -0
- package/dist/pricing/priceVariant.d.ts.map +1 -0
- package/dist/pricing/types.d.ts +30 -0
- package/dist/pricing/types.d.ts.map +1 -0
- package/dist/schema/checkout-and-beyond/constants.js +3 -2
- package/dist/schema/checkout-and-beyond/constants.js.map +2 -2
- package/dist/schema/checkout-and-beyond/constants.mjs +3 -2
- package/dist/schema/checkout-and-beyond/constants.mjs.map +2 -2
- package/dist/schema/checkout-and-beyond/index.js +237 -23
- package/dist/schema/checkout-and-beyond/index.js.map +4 -4
- package/dist/schema/checkout-and-beyond/index.mjs +237 -23
- package/dist/schema/checkout-and-beyond/index.mjs.map +4 -4
- package/dist/schema/widget-data.js +207 -23
- package/dist/schema/widget-data.js.map +4 -4
- package/dist/schema/widget-data.mjs +207 -23
- package/dist/schema/widget-data.mjs.map +4 -4
- package/dist/schema/widgetData.d.ts +6 -3
- package/dist/schema/widgetData.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/banner.d.ts +2 -1
- package/dist/schema/widgets/checkout-and-beyond/banner.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/button.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/carousel.d.ts +2 -1
- package/dist/schema/widgets/checkout-and-beyond/carousel.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/cartLine.d.ts +2 -1
- package/dist/schema/widgets/checkout-and-beyond/cartLine.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts +5 -4
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/dataSource.d.ts +1 -0
- package/dist/schema/widgets/checkout-and-beyond/dataSource.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/giftLabels.d.ts +121 -0
- package/dist/schema/widgets/checkout-and-beyond/giftLabels.d.ts.map +1 -0
- package/dist/schema/widgets/checkout-and-beyond/image.d.ts +2 -1
- package/dist/schema/widgets/checkout-and-beyond/image.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/index.d.ts +1 -0
- package/dist/schema/widgets/checkout-and-beyond/index.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/layout.d.ts +2 -1
- package/dist/schema/widgets/checkout-and-beyond/layout.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/offerLabels.d.ts +28 -0
- package/dist/schema/widgets/checkout-and-beyond/offerLabels.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/offers.d.ts +2 -1
- package/dist/schema/widgets/checkout-and-beyond/offers.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts +147 -129
- package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/regex.d.ts +13 -1
- package/dist/schema/widgets/checkout-and-beyond/regex.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/root.d.ts +2 -1
- package/dist/schema/widgets/checkout-and-beyond/root.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/text.d.ts +5 -3
- package/dist/schema/widgets/checkout-and-beyond/text.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/utils.d.ts.map +1 -1
- package/dist/schema/widgets/contentBlock.d.ts +2 -1
- package/dist/schema/widgets/contentBlock.d.ts.map +1 -1
- package/dist/schema/widgets/lineItemEditor.d.ts +2 -1
- package/dist/schema/widgets/lineItemEditor.d.ts.map +1 -1
- package/dist/schema/widgets/rebuyButton.d.ts +2 -1
- package/dist/schema/widgets/rebuyButton.d.ts.map +1 -1
- package/dist/server/dataSourceResults.d.ts.map +1 -1
- package/dist/server/index.js +349 -43
- package/dist/server/index.js.map +4 -4
- package/dist/server/index.mjs +349 -43
- package/dist/server/index.mjs.map +4 -4
- package/dist/server/widgetSettings.d.ts.map +1 -1
- package/dist/transforms/index.d.ts +2 -0
- package/dist/transforms/index.d.ts.map +1 -1
- package/dist/transforms/index.js +530 -207
- package/dist/transforms/index.js.map +4 -4
- package/dist/transforms/index.mjs +530 -207
- package/dist/transforms/index.mjs.map +4 -4
- package/dist/transforms/normalizeTokens.d.ts.map +1 -1
- package/dist/transforms/offerV1/convertOfferToV2.d.ts.map +1 -1
- package/dist/transforms/offerV1/offerCard.d.ts.map +1 -1
- package/dist/transforms/offerV1/offerTemplateSeed.d.ts +100 -3
- package/dist/transforms/offerV1/offerTemplateSeed.d.ts.map +1 -1
- package/dist/transforms/offerV1/types.d.ts +4 -1
- package/dist/transforms/offerV1/types.d.ts.map +1 -1
- package/dist/transforms/progressBarV1/convertProgressBarToV2.d.ts +24 -0
- package/dist/transforms/progressBarV1/convertProgressBarToV2.d.ts.map +1 -0
- package/dist/transforms/progressBarV1/types.d.ts +44 -0
- package/dist/transforms/progressBarV1/types.d.ts.map +1 -0
- package/package.json +6 -1
package/dist/index.js
CHANGED
|
@@ -55,6 +55,7 @@ __export(src_exports, {
|
|
|
55
55
|
CABRule: () => CABRule,
|
|
56
56
|
CABSection: () => CABSection,
|
|
57
57
|
CABTextSection: () => CABTextSection,
|
|
58
|
+
CABTextTier: () => CABTextTier,
|
|
58
59
|
CABTracking: () => CABTracking,
|
|
59
60
|
CABVariantContent: () => CABVariantContent,
|
|
60
61
|
CABVariantsSection: () => CABVariantsSection,
|
|
@@ -70,6 +71,7 @@ __export(src_exports, {
|
|
|
70
71
|
DiscountSource: () => DiscountSource,
|
|
71
72
|
DiscountType: () => DiscountType,
|
|
72
73
|
EditorMode: () => EditorMode,
|
|
74
|
+
GIFT_LABELS: () => GIFT_LABELS,
|
|
73
75
|
Geolocation: () => Geolocation,
|
|
74
76
|
GiftWithPurchase: () => GiftWithPurchase,
|
|
75
77
|
GridItem: () => GridItem,
|
|
@@ -1323,7 +1325,7 @@ var buttonActions = [
|
|
|
1323
1325
|
"goToNextPage",
|
|
1324
1326
|
"goToPrevPage",
|
|
1325
1327
|
"goToURL",
|
|
1326
|
-
"
|
|
1328
|
+
"removeFromOrder",
|
|
1327
1329
|
"selectVariant",
|
|
1328
1330
|
"showPagination",
|
|
1329
1331
|
"switchToSubscription",
|
|
@@ -1344,7 +1346,8 @@ var buttonFields = [
|
|
|
1344
1346
|
"payNow",
|
|
1345
1347
|
"progressReached",
|
|
1346
1348
|
"progressRemaining",
|
|
1347
|
-
"
|
|
1349
|
+
"redirectToCheckout",
|
|
1350
|
+
"removeFromOrder",
|
|
1348
1351
|
"showVariant",
|
|
1349
1352
|
"showVariants",
|
|
1350
1353
|
"soldOut",
|
|
@@ -1544,7 +1547,7 @@ var import_v427 = require("zod/v4");
|
|
|
1544
1547
|
var import_v426 = require("zod/v4");
|
|
1545
1548
|
|
|
1546
1549
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
1547
|
-
var
|
|
1550
|
+
var import_uuid12 = require("uuid");
|
|
1548
1551
|
var import_v425 = require("zod/v4");
|
|
1549
1552
|
|
|
1550
1553
|
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
@@ -1640,7 +1643,7 @@ var import_v49 = require("zod/v4");
|
|
|
1640
1643
|
var ARRAY_INDEX_STRING = /^(0|[1-9]\d*)$/;
|
|
1641
1644
|
var DYNAMIC_TOKEN_REGEX = /^\{\{\s*[A-Za-z]+\s*\}\}$/;
|
|
1642
1645
|
var HEX_COLOR_REGEX = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
1643
|
-
var HTML_TAGS_REGEX = /<\/?[^>]
|
|
1646
|
+
var HTML_TAGS_REGEX = /<\/?[a-zA-Z][^>]*>/g;
|
|
1644
1647
|
|
|
1645
1648
|
// src/schema/widgets/checkout-and-beyond/utils.ts
|
|
1646
1649
|
var import_es_toolkit2 = require("es-toolkit");
|
|
@@ -1652,7 +1655,7 @@ var isHTML = (html = "") => {
|
|
|
1652
1655
|
const hasHTML = (nodeList) => Array.from(nodeList).some((node) => node.nodeType === 1);
|
|
1653
1656
|
return hasHTML(doc.body.childNodes) || hasHTML(doc.head.childNodes);
|
|
1654
1657
|
}
|
|
1655
|
-
return
|
|
1658
|
+
return html.search(HTML_TAGS_REGEX) !== -1;
|
|
1656
1659
|
};
|
|
1657
1660
|
var hasHTMLInDoc = (doc) => doc.content.some(({ content = [] }) => content.some(({ text }) => isHTML(text)));
|
|
1658
1661
|
var checkForHTML = (input) => !((0, import_compat.isString)(input) && isHTML(input) || (0, import_es_toolkit2.isPlainObject)(input) && hasHTMLInDoc(input));
|
|
@@ -1757,7 +1760,7 @@ var TiptapDocument = import_v410.z.object({
|
|
|
1757
1760
|
content: import_v410.z.union([import_v410.z.array(TiptapParagraph), import_v410.z.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
1758
1761
|
type: import_v410.z.literal("doc").default("doc")
|
|
1759
1762
|
});
|
|
1760
|
-
var
|
|
1763
|
+
var CABTextTier = import_v410.z.object({
|
|
1761
1764
|
threshold: import_v410.z.number().int().nonnegative(),
|
|
1762
1765
|
thresholds: import_v410.z.record(import_v410.z.string(), import_v410.z.number().int().nonnegative()).default(() => ({})),
|
|
1763
1766
|
tierType: import_v410.z.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
@@ -1770,7 +1773,7 @@ var CABTextSection = import_v410.z.object({
|
|
|
1770
1773
|
rule: CABRule.optional(),
|
|
1771
1774
|
sectionId: import_v410.z.uuid().default(() => (0, import_uuid2.v7)()),
|
|
1772
1775
|
sectionType: import_v410.z.literal(SectionType.text).default(SectionType.text),
|
|
1773
|
-
tier:
|
|
1776
|
+
tier: CABTextTier.optional()
|
|
1774
1777
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
1775
1778
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
1776
1779
|
(0, import_compat2.forEach)(content, (value, lang) => {
|
|
@@ -1862,6 +1865,8 @@ var CABDataSourceSection = import_v412.z.object({
|
|
|
1862
1865
|
productType: import_v412.z.enum(productTypes).optional(),
|
|
1863
1866
|
sectionId: import_v412.z.uuid().default(() => (0, import_uuid4.v7)()),
|
|
1864
1867
|
sectionType: import_v412.z.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
1868
|
+
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
1869
|
+
subscriptionIsDefault: import_v412.z.boolean().default(false),
|
|
1865
1870
|
treatAsGwp: import_v412.z.boolean().default(false)
|
|
1866
1871
|
});
|
|
1867
1872
|
|
|
@@ -1959,20 +1964,201 @@ var CABMonetizeSection = import_v419.z.object({
|
|
|
1959
1964
|
});
|
|
1960
1965
|
|
|
1961
1966
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
1962
|
-
var import_uuid9 = require("uuid");
|
|
1963
1967
|
var import_v420 = require("zod/v4");
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1968
|
+
|
|
1969
|
+
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
1970
|
+
var GIFT_LABELS = {
|
|
1971
|
+
addGift: {
|
|
1972
|
+
ar: "\u0623\u0636\u0641 \u0627\u0644\u0647\u062F\u064A\u0629",
|
|
1973
|
+
cs: "P\u0159idat d\xE1rek",
|
|
1974
|
+
da: "Tilf\xF8j gave",
|
|
1975
|
+
de: "Geschenk hinzuf\xFCgen",
|
|
1976
|
+
en: "Add gift",
|
|
1977
|
+
es: "A\xF1adir regalo",
|
|
1978
|
+
fi: "Lis\xE4\xE4 lahja",
|
|
1979
|
+
fr: "Ajouter le cadeau",
|
|
1980
|
+
ga: "Cuir bronntanas leis",
|
|
1981
|
+
he: "\u05D4\u05D5\u05E1\u05E3 \u05DE\u05EA\u05E0\u05D4",
|
|
1982
|
+
hi: "\u0909\u092A\u0939\u093E\u0930 \u091C\u094B\u0921\u093C\u0947\u0902",
|
|
1983
|
+
id: "Tambahkan hadiah",
|
|
1984
|
+
it: "Aggiungi regalo",
|
|
1985
|
+
ja: "\u30AE\u30D5\u30C8\u3092\u8FFD\u52A0",
|
|
1986
|
+
ko: "\uC0AC\uC740\uD488 \uCD94\uAC00",
|
|
1987
|
+
nl: "Cadeau toevoegen",
|
|
1988
|
+
no: "Legg til gave",
|
|
1989
|
+
pl: "Dodaj prezent",
|
|
1990
|
+
pt: "Adicionar presente",
|
|
1991
|
+
ru: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u0434\u0430\u0440\u043E\u043A",
|
|
1992
|
+
sv: "L\xE4gg till g\xE5va",
|
|
1993
|
+
th: "\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E02\u0E2D\u0E07\u0E02\u0E27\u0E31\u0E0D",
|
|
1994
|
+
tr: "Hediye ekle",
|
|
1995
|
+
uk: "\u0414\u043E\u0434\u0430\u0442\u0438 \u043F\u043E\u0434\u0430\u0440\u0443\u043D\u043E\u043A",
|
|
1996
|
+
vi: "Th\xEAm qu\xE0 t\u1EB7ng",
|
|
1997
|
+
zh: "\u6DFB\u52A0\u8D60\u54C1"
|
|
1998
|
+
},
|
|
1999
|
+
remove: {
|
|
2000
|
+
ar: "\u0625\u0632\u0627\u0644\u0629",
|
|
2001
|
+
cs: "Odebrat",
|
|
2002
|
+
da: "Fjern",
|
|
2003
|
+
de: "Entfernen",
|
|
2004
|
+
en: "Remove",
|
|
2005
|
+
es: "Eliminar",
|
|
2006
|
+
fi: "Poista",
|
|
2007
|
+
fr: "Retirer",
|
|
2008
|
+
ga: "Bain",
|
|
2009
|
+
he: "\u05D4\u05E1\u05E8",
|
|
2010
|
+
hi: "\u0939\u091F\u093E\u090F\u0901",
|
|
2011
|
+
id: "Hapus",
|
|
2012
|
+
it: "Rimuovi",
|
|
2013
|
+
ja: "\u524A\u9664",
|
|
2014
|
+
ko: "\uC81C\uAC70",
|
|
2015
|
+
nl: "Verwijderen",
|
|
2016
|
+
no: "Fjern",
|
|
2017
|
+
pl: "Usu\u0144",
|
|
2018
|
+
pt: "Remover",
|
|
2019
|
+
ru: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C",
|
|
2020
|
+
sv: "Ta bort",
|
|
2021
|
+
th: "\u0E19\u0E33\u0E2D\u0E2D\u0E01",
|
|
2022
|
+
tr: "Kald\u0131r",
|
|
2023
|
+
uk: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438",
|
|
2024
|
+
vi: "X\xF3a",
|
|
2025
|
+
zh: "\u79FB\u9664"
|
|
2026
|
+
},
|
|
2027
|
+
selectOptions: {
|
|
2028
|
+
ar: "\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",
|
|
2029
|
+
cs: "Vyberte mo\u017Enosti",
|
|
2030
|
+
da: "V\xE6lg muligheder",
|
|
2031
|
+
de: "Optionen w\xE4hlen",
|
|
2032
|
+
en: "Select Options",
|
|
2033
|
+
es: "Seleccionar opciones",
|
|
2034
|
+
fi: "Valitse vaihtoehdot",
|
|
2035
|
+
fr: "Choisir les options",
|
|
2036
|
+
ga: "Roghnaigh roghanna",
|
|
2037
|
+
he: "\u05D1\u05D7\u05E8 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",
|
|
2038
|
+
hi: "\u0935\u093F\u0915\u0932\u094D\u092A \u091A\u0941\u0928\u0947\u0902",
|
|
2039
|
+
id: "Pilih opsi",
|
|
2040
|
+
it: "Seleziona le opzioni",
|
|
2041
|
+
ja: "\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E",
|
|
2042
|
+
ko: "\uC635\uC158 \uC120\uD0DD",
|
|
2043
|
+
nl: "Opties kiezen",
|
|
2044
|
+
no: "Velg alternativer",
|
|
2045
|
+
pl: "Wybierz opcje",
|
|
2046
|
+
pt: "Selecionar op\xE7\xF5es",
|
|
2047
|
+
ru: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B",
|
|
2048
|
+
sv: "V\xE4lj alternativ",
|
|
2049
|
+
th: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01",
|
|
2050
|
+
tr: "Se\xE7enekleri se\xE7",
|
|
2051
|
+
uk: "\u0412\u0438\u0431\u0440\u0430\u0442\u0438 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0438",
|
|
2052
|
+
vi: "Ch\u1ECDn t\xF9y ch\u1ECDn",
|
|
2053
|
+
zh: "\u9009\u62E9\u9009\u9879"
|
|
2054
|
+
},
|
|
2055
|
+
yourGift: {
|
|
2056
|
+
ar: "\u0647\u062F\u064A\u062A\u0643",
|
|
2057
|
+
cs: "V\xE1\u0161 d\xE1rek",
|
|
2058
|
+
da: "Din gave",
|
|
2059
|
+
de: "Ihr Geschenk",
|
|
2060
|
+
en: "Your gift",
|
|
2061
|
+
es: "Tu regalo",
|
|
2062
|
+
fi: "Lahjasi",
|
|
2063
|
+
fr: "Votre cadeau",
|
|
2064
|
+
ga: "Do bhronntanas",
|
|
2065
|
+
he: "\u05D4\u05DE\u05EA\u05E0\u05D4 \u05E9\u05DC\u05DA",
|
|
2066
|
+
hi: "\u0906\u092A\u0915\u093E \u0909\u092A\u0939\u093E\u0930",
|
|
2067
|
+
id: "Hadiah Anda",
|
|
2068
|
+
it: "Il tuo regalo",
|
|
2069
|
+
ja: "\u3042\u306A\u305F\u306E\u30AE\u30D5\u30C8",
|
|
2070
|
+
ko: "\uACE0\uAC1D\uB2D8\uC758 \uC0AC\uC740\uD488",
|
|
2071
|
+
nl: "Uw cadeau",
|
|
2072
|
+
no: "Din gave",
|
|
2073
|
+
pl: "Tw\xF3j prezent",
|
|
2074
|
+
pt: "Seu presente",
|
|
2075
|
+
ru: "\u0412\u0430\u0448 \u043F\u043E\u0434\u0430\u0440\u043E\u043A",
|
|
2076
|
+
sv: "Din g\xE5va",
|
|
2077
|
+
th: "\u0E02\u0E2D\u0E07\u0E02\u0E27\u0E31\u0E0D\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13",
|
|
2078
|
+
tr: "Hediyeniz",
|
|
2079
|
+
uk: "\u0412\u0430\u0448 \u043F\u043E\u0434\u0430\u0440\u0443\u043D\u043E\u043A",
|
|
2080
|
+
vi: "Qu\xE0 c\u1EE7a b\u1EA1n",
|
|
2081
|
+
zh: "\u60A8\u7684\u8D60\u54C1"
|
|
2082
|
+
}
|
|
2083
|
+
};
|
|
2084
|
+
|
|
2085
|
+
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
2086
|
+
var CABProgressTier = import_v420.z.object({
|
|
2087
|
+
/**
|
|
2088
|
+
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
2089
|
+
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
2090
|
+
* when the tier is reached (attribution `_tier` = {@link CABProgressTier.tierId}). Absent on shipping
|
|
2091
|
+
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
2092
|
+
* tree is complete.
|
|
2093
|
+
*/
|
|
2094
|
+
gift: import_v420.z.object({
|
|
2095
|
+
productId: import_v420.z.number().int().positive(),
|
|
2096
|
+
title: import_v420.z.string().optional(),
|
|
2097
|
+
variantIds: import_v420.z.array(import_v420.z.number().int().positive()).default(() => [])
|
|
2098
|
+
}).optional(),
|
|
2099
|
+
/**
|
|
2100
|
+
* The tier's goal in the SHOP's base currency, in cents. Always present — the canonical fallback:
|
|
2101
|
+
* when the buyer's presentment currency has no entry in `thresholds`, the client multiplies this by
|
|
2102
|
+
* the live FX rate. (Converter maps the v1 `unlock_price`, e.g. `75` → `7500`.)
|
|
2103
|
+
*/
|
|
2104
|
+
threshold: import_v420.z.number().int().nonnegative(),
|
|
2105
|
+
/**
|
|
2106
|
+
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
2107
|
+
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
2108
|
+
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
2109
|
+
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
2110
|
+
*/
|
|
2111
|
+
thresholds: import_v420.z.record(import_v420.z.string(), import_v420.z.number().int().nonnegative()).default(() => ({})),
|
|
2112
|
+
/**
|
|
2113
|
+
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
2114
|
+
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
2115
|
+
* shipping bar (single unlabeled tier, no gift).
|
|
2116
|
+
*/
|
|
2117
|
+
tierId: import_v420.z.string().optional(),
|
|
2118
|
+
tierType: import_v420.z.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
1972
2119
|
});
|
|
2120
|
+
var CABProgressBarSection = import_v420.z.lazy(
|
|
2121
|
+
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2122
|
+
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
2123
|
+
countryCodes: import_v420.z.array(import_v420.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
2124
|
+
/**
|
|
2125
|
+
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
2126
|
+
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
2127
|
+
*/
|
|
2128
|
+
excludeCountryCodes: import_v420.z.array(import_v420.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
2129
|
+
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
2130
|
+
excludedVariantIds: import_v420.z.array(import_v420.z.number().int().positive()).default(() => []),
|
|
2131
|
+
/**
|
|
2132
|
+
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
2133
|
+
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
2134
|
+
*/
|
|
2135
|
+
freeShippingOnSubscription: import_v420.z.boolean().default(false),
|
|
2136
|
+
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
2137
|
+
giftLabels: import_v420.z.object({
|
|
2138
|
+
addGift: import_v420.z.record(import_v420.z.string(), import_v420.z.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
2139
|
+
remove: import_v420.z.record(import_v420.z.string(), import_v420.z.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
2140
|
+
selectOptions: import_v420.z.record(import_v420.z.string(), import_v420.z.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
2141
|
+
yourGift: import_v420.z.record(import_v420.z.string(), import_v420.z.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
2142
|
+
}).default(() => ({
|
|
2143
|
+
addGift: { ...GIFT_LABELS.addGift },
|
|
2144
|
+
remove: { ...GIFT_LABELS.remove },
|
|
2145
|
+
selectOptions: { ...GIFT_LABELS.selectOptions },
|
|
2146
|
+
yourGift: { ...GIFT_LABELS.yourGift }
|
|
2147
|
+
})),
|
|
2148
|
+
/** Bar fill color — the shop theme's `buttonBackground`, resolved server-side (React parity). */
|
|
2149
|
+
progressColor: import_v420.z.string().default("#2491C4"),
|
|
2150
|
+
sectionType: import_v420.z.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
2151
|
+
/**
|
|
2152
|
+
* The bar's milestones, in any order — the renderer sorts by resolved threshold. Drives the fill
|
|
2153
|
+
* (even slot per tier) and, for smart-cart product tiers, the gift add/remove. The visual tier
|
|
2154
|
+
* display lives in `sections` (composable), NOT here.
|
|
2155
|
+
*/
|
|
2156
|
+
tiers: import_v420.z.union([import_v420.z.array(CABProgressTier), import_v420.z.strictObject({}).transform(() => [])]).default(() => [])
|
|
2157
|
+
})
|
|
2158
|
+
);
|
|
1973
2159
|
|
|
1974
2160
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
1975
|
-
var
|
|
2161
|
+
var import_uuid9 = require("uuid");
|
|
1976
2162
|
var import_v421 = require("zod/v4");
|
|
1977
2163
|
var CABQuantitySection = import_v421.z.object({
|
|
1978
2164
|
errorMessages: import_v421.z.record(
|
|
@@ -1994,31 +2180,31 @@ var CABQuantitySection = import_v421.z.object({
|
|
|
1994
2180
|
min: import_v421.z.number().min(1).default(1),
|
|
1995
2181
|
name: import_v421.z.string().optional(),
|
|
1996
2182
|
rule: CABRule.optional(),
|
|
1997
|
-
sectionId: import_v421.z.uuid().default(() => (0,
|
|
2183
|
+
sectionId: import_v421.z.uuid().default(() => (0, import_uuid9.v7)()),
|
|
1998
2184
|
sectionType: import_v421.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1999
2185
|
});
|
|
2000
2186
|
|
|
2001
2187
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
2002
|
-
var
|
|
2188
|
+
var import_uuid10 = require("uuid");
|
|
2003
2189
|
var import_v422 = require("zod/v4");
|
|
2004
2190
|
var CABReviewsSection = import_v422.z.object({
|
|
2005
2191
|
color: import_v422.z.string().default("#fadb14"),
|
|
2006
2192
|
name: import_v422.z.string().optional(),
|
|
2007
2193
|
rule: CABRule.optional(),
|
|
2008
|
-
sectionId: import_v422.z.uuid().default(() => (0,
|
|
2194
|
+
sectionId: import_v422.z.uuid().default(() => (0, import_uuid10.v7)()),
|
|
2009
2195
|
sectionType: import_v422.z.literal(SectionType.reviews).default(SectionType.reviews),
|
|
2010
2196
|
size: import_v422.z.enum(reviewsSizes).default(ReviewsSize.default)
|
|
2011
2197
|
});
|
|
2012
2198
|
|
|
2013
2199
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
2014
2200
|
var import_compat3 = require("es-toolkit/compat");
|
|
2015
|
-
var
|
|
2201
|
+
var import_uuid11 = require("uuid");
|
|
2016
2202
|
var import_v423 = require("zod/v4");
|
|
2017
2203
|
var CABVariantsSection = import_v423.z.object({
|
|
2018
2204
|
hideOutOfStockVariants: import_v423.z.boolean().default(false),
|
|
2019
2205
|
name: import_v423.z.string().optional(),
|
|
2020
2206
|
rule: CABRule.optional(),
|
|
2021
|
-
sectionId: import_v423.z.uuid().default(() => (0,
|
|
2207
|
+
sectionId: import_v423.z.uuid().default(() => (0, import_uuid11.v7)()),
|
|
2022
2208
|
sectionType: import_v423.z.literal(SectionType.variants).default(SectionType.variants),
|
|
2023
2209
|
selector: import_v423.z.enum((0, import_compat3.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
2024
2210
|
variantMode: import_v423.z.enum(variantModes).default(VariantMode.multiple)
|
|
@@ -2076,7 +2262,7 @@ var CABLayoutSection = import_v425.z.object({
|
|
|
2076
2262
|
name: import_v425.z.string().optional(),
|
|
2077
2263
|
padding: import_v425.z.enum(spacings).default(Spacing.none),
|
|
2078
2264
|
rule: CABRule.optional(),
|
|
2079
|
-
sectionId: import_v425.z.uuid().default(() => (0,
|
|
2265
|
+
sectionId: import_v425.z.uuid().default(() => (0, import_uuid12.v7)()),
|
|
2080
2266
|
sections: import_v425.z.union([import_v425.z.array(import_v425.z.lazy(() => CABSection)), import_v425.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
2081
2267
|
sectionType: import_v425.z.literal(SectionType.layout).default(SectionType.layout),
|
|
2082
2268
|
spacing: import_v425.z.enum(spacings).default(Spacing.base),
|
|
@@ -2344,6 +2530,34 @@ var OFFER_LABELS = {
|
|
|
2344
2530
|
vi: "\u0110ang th\xEAm...",
|
|
2345
2531
|
zh: "\u6B63\u5728\u6DFB\u52A0..."
|
|
2346
2532
|
},
|
|
2533
|
+
redirectToCheckout: {
|
|
2534
|
+
ar: "\u0627\u0644\u062F\u0641\u0639",
|
|
2535
|
+
cs: "Pokladna",
|
|
2536
|
+
da: "Til kassen",
|
|
2537
|
+
de: "Zur Kasse",
|
|
2538
|
+
en: "Checkout",
|
|
2539
|
+
es: "Finalizar compra",
|
|
2540
|
+
fi: "Kassalle",
|
|
2541
|
+
fr: "Paiement",
|
|
2542
|
+
ga: "Seice\xE1il amach",
|
|
2543
|
+
he: "\u05DC\u05EA\u05E9\u05DC\u05D5\u05DD",
|
|
2544
|
+
hi: "\u091A\u0947\u0915\u0906\u0909\u091F",
|
|
2545
|
+
id: "Checkout",
|
|
2546
|
+
it: "Cassa",
|
|
2547
|
+
ja: "\u30C1\u30A7\u30C3\u30AF\u30A2\u30A6\u30C8",
|
|
2548
|
+
ko: "\uACB0\uC81C\uD558\uAE30",
|
|
2549
|
+
nl: "Afrekenen",
|
|
2550
|
+
no: "Til kassen",
|
|
2551
|
+
pl: "Do kasy",
|
|
2552
|
+
pt: "Finalizar compra",
|
|
2553
|
+
ru: "\u041E\u0444\u043E\u0440\u043C\u0438\u0442\u044C \u0437\u0430\u043A\u0430\u0437",
|
|
2554
|
+
sv: "Till kassan",
|
|
2555
|
+
th: "\u0E0A\u0E33\u0E23\u0E30\u0E40\u0E07\u0E34\u0E19",
|
|
2556
|
+
tr: "\xD6deme",
|
|
2557
|
+
uk: "\u041E\u0444\u043E\u0440\u043C\u0438\u0442\u0438 \u0437\u0430\u043C\u043E\u0432\u043B\u0435\u043D\u043D\u044F",
|
|
2558
|
+
vi: "Thanh to\xE1n",
|
|
2559
|
+
zh: "\u7ED3\u8D26"
|
|
2560
|
+
},
|
|
2347
2561
|
soldOut: {
|
|
2348
2562
|
ar: "\u0646\u0641\u062F\u062A \u0627\u0644\u0643\u0645\u064A\u0629",
|
|
2349
2563
|
cs: "Vyprod\xE1no",
|
|
@@ -2544,7 +2758,7 @@ var BlockType = blockType.enum;
|
|
|
2544
2758
|
|
|
2545
2759
|
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
2546
2760
|
var import_compat5 = require("es-toolkit/compat");
|
|
2547
|
-
var
|
|
2761
|
+
var import_uuid13 = require("uuid");
|
|
2548
2762
|
var import_v436 = require("zod/v4");
|
|
2549
2763
|
var TextAlignment2 = import_v436.z.union([import_v436.z.enum(["leading", "center", "trailing"]), import_v436.z.unknown().transform(() => "leading")]);
|
|
2550
2764
|
var TextSize = import_v436.z.union([
|
|
@@ -2552,7 +2766,7 @@ var TextSize = import_v436.z.union([
|
|
|
2552
2766
|
import_v436.z.unknown().transform(() => "medium")
|
|
2553
2767
|
]);
|
|
2554
2768
|
var CalloutBannerBlock = import_v436.z.object({
|
|
2555
|
-
id: import_v436.z.string().optional().default(() => (0,
|
|
2769
|
+
id: import_v436.z.string().optional().default(() => (0, import_uuid13.v4)()),
|
|
2556
2770
|
name: import_v436.z.string().optional(),
|
|
2557
2771
|
settings: import_v436.z.object({
|
|
2558
2772
|
superTitle: import_v436.z.union([import_v436.z.string(), TiptapDocument]).default(() => "Limited-time Offer"),
|
|
@@ -2568,7 +2782,7 @@ var CalloutBannerBlock = import_v436.z.object({
|
|
|
2568
2782
|
type: import_v436.z.literal(BlockType.callout_banner).default(BlockType.callout_banner)
|
|
2569
2783
|
});
|
|
2570
2784
|
var ImageBlock = import_v436.z.object({
|
|
2571
|
-
id: import_v436.z.string().optional().default(() => (0,
|
|
2785
|
+
id: import_v436.z.string().optional().default(() => (0, import_uuid13.v4)()),
|
|
2572
2786
|
name: import_v436.z.string().optional(),
|
|
2573
2787
|
settings: import_v436.z.union([
|
|
2574
2788
|
import_v436.z.object({
|
|
@@ -2583,7 +2797,7 @@ var ImageBlock = import_v436.z.object({
|
|
|
2583
2797
|
type: import_v436.z.literal(BlockType.image).default(BlockType.image)
|
|
2584
2798
|
});
|
|
2585
2799
|
var ImageContentBlock = import_v436.z.object({
|
|
2586
|
-
id: import_v436.z.string().optional().default(() => (0,
|
|
2800
|
+
id: import_v436.z.string().optional().default(() => (0, import_uuid13.v4)()),
|
|
2587
2801
|
name: import_v436.z.string().optional(),
|
|
2588
2802
|
settings: import_v436.z.object({
|
|
2589
2803
|
alt: import_v436.z.string().optional().default(""),
|
|
@@ -2605,7 +2819,7 @@ var ImageContentBlock = import_v436.z.object({
|
|
|
2605
2819
|
type: import_v436.z.literal(BlockType.image_content).default(BlockType.image_content)
|
|
2606
2820
|
});
|
|
2607
2821
|
var PayButtonBlock = import_v436.z.object({
|
|
2608
|
-
id: import_v436.z.string().optional().default(() => (0,
|
|
2822
|
+
id: import_v436.z.string().optional().default(() => (0, import_uuid13.v4)()),
|
|
2609
2823
|
name: import_v436.z.string().optional(),
|
|
2610
2824
|
settings: import_v436.z.union([
|
|
2611
2825
|
import_v436.z.object({
|
|
@@ -2628,17 +2842,17 @@ var PayButtonBlock = import_v436.z.object({
|
|
|
2628
2842
|
var ProductInformationBlock = import_v436.z.object({
|
|
2629
2843
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2630
2844
|
hideProductImage: import_v436.z.boolean().optional().default(false),
|
|
2631
|
-
id: import_v436.z.string().optional().default(() => (0,
|
|
2845
|
+
id: import_v436.z.string().optional().default(() => (0, import_uuid13.v4)()),
|
|
2632
2846
|
name: import_v436.z.string().optional(),
|
|
2633
2847
|
type: import_v436.z.literal(BlockType.product_information).default(BlockType.product_information)
|
|
2634
2848
|
});
|
|
2635
2849
|
var SeparatorBlock = import_v436.z.object({
|
|
2636
|
-
id: import_v436.z.string().optional().default(() => (0,
|
|
2850
|
+
id: import_v436.z.string().optional().default(() => (0, import_uuid13.v4)()),
|
|
2637
2851
|
name: import_v436.z.string().optional(),
|
|
2638
2852
|
type: import_v436.z.literal(BlockType.separator).default(BlockType.separator)
|
|
2639
2853
|
});
|
|
2640
2854
|
var TextBlock = import_v436.z.object({
|
|
2641
|
-
id: import_v436.z.string().optional().default(() => (0,
|
|
2855
|
+
id: import_v436.z.string().optional().default(() => (0, import_uuid13.v4)()),
|
|
2642
2856
|
name: import_v436.z.string().optional(),
|
|
2643
2857
|
settings: import_v436.z.object({
|
|
2644
2858
|
description: import_v436.z.union([import_v436.z.string(), TiptapDocument]).optional().default(
|
|
@@ -2657,7 +2871,7 @@ var TextBlock = import_v436.z.object({
|
|
|
2657
2871
|
type: import_v436.z.literal(BlockType.text).default(BlockType.text)
|
|
2658
2872
|
});
|
|
2659
2873
|
var TimerBlock = import_v436.z.object({
|
|
2660
|
-
id: import_v436.z.string().optional().default(() => (0,
|
|
2874
|
+
id: import_v436.z.string().optional().default(() => (0, import_uuid13.v4)()),
|
|
2661
2875
|
name: import_v436.z.string().optional(),
|
|
2662
2876
|
settings: import_v436.z.object({
|
|
2663
2877
|
durationMinutes: import_v436.z.number().min(0).default(10),
|
|
@@ -3300,6 +3514,21 @@ var OFFER_TEMPLATE_SEED = {
|
|
|
3300
3514
|
zh: "\u52A0\u5165\u8D2D\u7269\u8F66"
|
|
3301
3515
|
},
|
|
3302
3516
|
sectionType: "text"
|
|
3517
|
+
},
|
|
3518
|
+
{
|
|
3519
|
+
buttonField: "addedToCart",
|
|
3520
|
+
content: OFFER_LABELS.addedToCart,
|
|
3521
|
+
sectionType: "text"
|
|
3522
|
+
},
|
|
3523
|
+
{
|
|
3524
|
+
buttonField: "soldOut",
|
|
3525
|
+
content: OFFER_LABELS.soldOut,
|
|
3526
|
+
sectionType: "text"
|
|
3527
|
+
},
|
|
3528
|
+
{
|
|
3529
|
+
buttonField: "redirectToCheckout",
|
|
3530
|
+
content: OFFER_LABELS.redirectToCheckout,
|
|
3531
|
+
sectionType: "text"
|
|
3303
3532
|
}
|
|
3304
3533
|
],
|
|
3305
3534
|
sectionType: "button"
|
|
@@ -3398,7 +3627,7 @@ var buildOfferTemplate = ({ location: location2, name } = {}) => CABRootSection.
|
|
|
3398
3627
|
// src/transforms/offerV1/offerCard.ts
|
|
3399
3628
|
var VARIANT_SELECTOR = { button: "button", radio: "radio", select: "menu" };
|
|
3400
3629
|
var localizedContent = (defaults, override) => {
|
|
3401
|
-
const trimmed = override
|
|
3630
|
+
const trimmed = stripContentBlockHtml(override ?? "").trim();
|
|
3402
3631
|
return trimmed ? { ...defaults, en: trimmed } : defaults;
|
|
3403
3632
|
};
|
|
3404
3633
|
var buildStyledText = (token, style, color = "base") => {
|
|
@@ -3466,6 +3695,7 @@ var buildDescription = (settings) => {
|
|
|
3466
3695
|
return [{ content: { en: buildStyledText("{{productDescription}}", void 0) }, sectionType: "text" }];
|
|
3467
3696
|
};
|
|
3468
3697
|
var buildVariants = (settings) => {
|
|
3698
|
+
if (settings.viewOptions?.displayActions === false) return [];
|
|
3469
3699
|
if (settings.productOptions?.showVariantOptions === "never") return [];
|
|
3470
3700
|
const selector = settings.viewOptions?.variantSelector;
|
|
3471
3701
|
return [
|
|
@@ -3492,12 +3722,14 @@ var buildQuantity = (settings) => {
|
|
|
3492
3722
|
const quantity = settings.quantityInputs;
|
|
3493
3723
|
if (!quantity?.enabled) return [];
|
|
3494
3724
|
const inputType = quantity.type ? QUANTITY_INPUT_TYPE[quantity.type] : void 0;
|
|
3725
|
+
const max = Math.min(Math.max(quantity.maxValue ?? 10, 1), 100);
|
|
3726
|
+
const min = Math.min(Math.max(quantity.minValue ?? 1, 1), max);
|
|
3495
3727
|
return [
|
|
3496
3728
|
{
|
|
3497
3729
|
...buildQuantityErrors(quantity),
|
|
3498
3730
|
...inputType && { inputType },
|
|
3499
|
-
max
|
|
3500
|
-
min
|
|
3731
|
+
max,
|
|
3732
|
+
min,
|
|
3501
3733
|
sectionType: "quantity"
|
|
3502
3734
|
}
|
|
3503
3735
|
];
|
|
@@ -3539,7 +3771,9 @@ var buildAddButton = (settings) => {
|
|
|
3539
3771
|
slot("addToCart", settings.language?.addToCart),
|
|
3540
3772
|
slot("addingToCart", settings.language?.addingToCart),
|
|
3541
3773
|
slot("addedToCart", settings.language?.addedToCart),
|
|
3542
|
-
slot("soldOut", settings.language?.soldOutLabel)
|
|
3774
|
+
slot("soldOut", settings.language?.soldOutLabel),
|
|
3775
|
+
// Off-checkout Buy Now: the label the button shows once it links to the created checkout.
|
|
3776
|
+
slot("redirectToCheckout", settings.language?.redirectToCheckout)
|
|
3543
3777
|
],
|
|
3544
3778
|
sectionType: "button"
|
|
3545
3779
|
};
|
|
@@ -3621,23 +3855,29 @@ var buildDiscountSection = (discount) => {
|
|
|
3621
3855
|
}
|
|
3622
3856
|
];
|
|
3623
3857
|
};
|
|
3858
|
+
var bannerMessageContent = (message) => {
|
|
3859
|
+
const sanitized = typeof message === "string" ? stripContentBlockHtml(message) : message;
|
|
3860
|
+
return sanitized ? { ...OFFER_LABELS.addedToCartMessage, en: sanitized } : OFFER_LABELS.addedToCartMessage;
|
|
3861
|
+
};
|
|
3624
3862
|
var buildBanner = (language) => language?.successBannerEnabled ? [
|
|
3625
3863
|
{
|
|
3626
3864
|
color: "success",
|
|
3627
3865
|
dismissible: true,
|
|
3628
3866
|
sections: [
|
|
3629
3867
|
{
|
|
3630
|
-
|
|
3631
|
-
* A defined v1 message (RTE doc or string) passes through verbatim as `en`;
|
|
3632
|
-
* absent falls back to the localized defaults (P4 language policy).
|
|
3633
|
-
*/
|
|
3634
|
-
content: language.successBannerMessageRte ? { ...OFFER_LABELS.addedToCartMessage, en: language.successBannerMessageRte } : OFFER_LABELS.addedToCartMessage,
|
|
3868
|
+
content: bannerMessageContent(language.successBannerMessageRte),
|
|
3635
3869
|
sectionType: "text"
|
|
3636
3870
|
},
|
|
3637
3871
|
{
|
|
3638
3872
|
action: "undoAddToOrder",
|
|
3639
3873
|
buttonStyle: "plain",
|
|
3640
|
-
|
|
3874
|
+
/**
|
|
3875
|
+
* Tagged `undoAddToOrder`, never `buttonLabel` — the renderers (React CAB and
|
|
3876
|
+
* the Preact extension) and the schema's default offers tree resolve that slot.
|
|
3877
|
+
*/
|
|
3878
|
+
sections: [
|
|
3879
|
+
{ buttonField: "undoAddToOrder", content: OFFER_LABELS.undo, sectionType: "text" }
|
|
3880
|
+
],
|
|
3641
3881
|
sectionType: "button"
|
|
3642
3882
|
}
|
|
3643
3883
|
],
|
|
@@ -3658,6 +3898,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3658
3898
|
matchVariantOutOfStock: !!settings.productOptions?.matchVariantOutOfStock,
|
|
3659
3899
|
...settings.productType && { productType: settings.productType },
|
|
3660
3900
|
sectionType: "dataSource",
|
|
3901
|
+
...settings.subscriptionIsDefault && { subscriptionIsDefault: true },
|
|
3661
3902
|
...settings.treatAsGwp && { treatAsGwp: true }
|
|
3662
3903
|
};
|
|
3663
3904
|
const offers = {
|
|
@@ -3671,7 +3912,9 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3671
3912
|
};
|
|
3672
3913
|
const display = {
|
|
3673
3914
|
autoAdvanceInterval: 0,
|
|
3674
|
-
itemsAtOnce
|
|
3915
|
+
// `itemsAtOnce` feeds the carousel schema's `.min(1)`; a legacy `columns`/`limit` of 0 would
|
|
3916
|
+
// otherwise throw at parse, so floor it at 1 (the carousel still shows a product per page).
|
|
3917
|
+
itemsAtOnce: Math.max(layout?.carousel ? columns : settings.limit ?? columns, 1),
|
|
3675
3918
|
...listLayout,
|
|
3676
3919
|
sections: [offers],
|
|
3677
3920
|
sectionType: "carousel"
|