@rebuy/rebuy 2.18.0 → 2.18.1-rc.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.js +42 -41
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +10 -9
- package/dist/index.mjs.map +2 -2
- package/dist/schema/checkout-and-beyond.js +31 -30
- package/dist/schema/checkout-and-beyond.js.map +3 -3
- package/dist/schema/checkout-and-beyond.mjs +8 -7
- package/dist/schema/checkout-and-beyond.mjs.map +2 -2
- package/dist/schema/widget-data.js +11 -10
- package/dist/schema/widget-data.js.map +3 -3
- package/dist/schema/widget-data.mjs +7 -6
- package/dist/schema/widget-data.mjs.map +2 -2
- package/dist/schema/widgets/checkout-and-beyond/constants.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/text.d.ts +4 -4
- package/dist/schema/widgets/checkout-and-beyond/utils.d.ts.map +1 -1
- package/dist/schema/widgets/post-purchase-offer/postPurchaseBlocks.d.ts +18 -18
- package/dist/schema/widgets/post-purchase-offer/postPurchaseOffer.d.ts +9 -9
- package/dist/schema/widgets/post-purchase-offer/postPurchaseSettings.d.ts +9 -9
- package/dist/schema/widgets/post-purchase-offer/postPurchaseWidget.d.ts +9 -9
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -1272,7 +1272,7 @@ var ABTestingPlaceholder = import_v45.z.looseObject({
|
|
|
1272
1272
|
});
|
|
1273
1273
|
|
|
1274
1274
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
1275
|
-
var
|
|
1275
|
+
var import_es_toolkit = require("es-toolkit");
|
|
1276
1276
|
var import_v47 = require("zod/v4");
|
|
1277
1277
|
|
|
1278
1278
|
// src/schema/widgets/checkout-and-beyond/common.ts
|
|
@@ -1458,7 +1458,7 @@ var STATIC_ENDPOINTS = [
|
|
|
1458
1458
|
{ label: "Products Search", value: "/products/search" },
|
|
1459
1459
|
{ label: "Similar Products (AI)", value: "/products/similar_products" }
|
|
1460
1460
|
];
|
|
1461
|
-
var COMBINED_ENDPOINTS = (0,
|
|
1461
|
+
var COMBINED_ENDPOINTS = (0, import_es_toolkit.uniqBy)([...DEFAULT_ENDPOINTS, ...STATIC_ENDPOINTS], (item) => item.value);
|
|
1462
1462
|
var targetAreas = {
|
|
1463
1463
|
[EditorMode.checkoutExtension]: [
|
|
1464
1464
|
{ icon: "splitscreen_top", label: "Header Area", width: "984px" },
|
|
@@ -1614,7 +1614,8 @@ var HEX_COLOR_REGEX = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
|
1614
1614
|
var HTML_TAGS_REGEX = /<\/?[^>]+>/g;
|
|
1615
1615
|
|
|
1616
1616
|
// src/schema/widgets/checkout-and-beyond/utils.ts
|
|
1617
|
-
var
|
|
1617
|
+
var import_es_toolkit2 = require("es-toolkit");
|
|
1618
|
+
var import_compat = require("es-toolkit/compat");
|
|
1618
1619
|
var isHTML = (html = "") => {
|
|
1619
1620
|
if (typeof window !== "undefined") {
|
|
1620
1621
|
const parser = new DOMParser();
|
|
@@ -1625,30 +1626,30 @@ var isHTML = (html = "") => {
|
|
|
1625
1626
|
return HTML_TAGS_REGEX.test(html);
|
|
1626
1627
|
};
|
|
1627
1628
|
var hasHTMLInDoc = (doc) => doc.content.some(({ content = [] }) => content.some(({ text }) => isHTML(text)));
|
|
1628
|
-
var checkForHTML = (input) => !((0,
|
|
1629
|
+
var checkForHTML = (input) => !((0, import_compat.isString)(input) && isHTML(input) || (0, import_es_toolkit2.isPlainObject)(input) && hasHTMLInDoc(input));
|
|
1629
1630
|
var NO_HTML = { message: "HTML is not supported" };
|
|
1630
|
-
var isButtonType = (section) => (0,
|
|
1631
|
-
var isCarouselType = (section) => (0,
|
|
1632
|
-
var isCartLineType = (section) => (0,
|
|
1633
|
-
var isDataSourceType = (section) => (0,
|
|
1634
|
-
var isImageType = (section) => (0,
|
|
1635
|
-
var isLayoutType = (section) => (0,
|
|
1636
|
-
var isOffersType = (section) => (0,
|
|
1637
|
-
var isOverlayType = (section) => isLayoutType(section) && (0,
|
|
1638
|
-
var isProductType = (section) => (0,
|
|
1639
|
-
var isProductsType = (section) => (0,
|
|
1640
|
-
var isQuantityType = (section) => (0,
|
|
1641
|
-
var isReviewsType = (section) => (0,
|
|
1642
|
-
var isTableType = (section) => (0,
|
|
1643
|
-
var isTextType = (section) => (0,
|
|
1644
|
-
var isVariantsType = (section) => (0,
|
|
1645
|
-
var hasOnlyNumericKeys = (input) => !!(0,
|
|
1646
|
-
var numericObjectToArray = (input) => (0,
|
|
1631
|
+
var isButtonType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.button;
|
|
1632
|
+
var isCarouselType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.carousel;
|
|
1633
|
+
var isCartLineType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.cartLine;
|
|
1634
|
+
var isDataSourceType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.dataSource;
|
|
1635
|
+
var isImageType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.image;
|
|
1636
|
+
var isLayoutType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.layout;
|
|
1637
|
+
var isOffersType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.offers;
|
|
1638
|
+
var isOverlayType = (section) => isLayoutType(section) && (0, import_compat.get)(section, "buttonField") === ButtonField.overlayContent;
|
|
1639
|
+
var isProductType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.product;
|
|
1640
|
+
var isProductsType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.products;
|
|
1641
|
+
var isQuantityType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.quantity;
|
|
1642
|
+
var isReviewsType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.reviews;
|
|
1643
|
+
var isTableType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.table;
|
|
1644
|
+
var isTextType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.text;
|
|
1645
|
+
var isVariantsType = (section) => (0, import_compat.get)(section, "sectionType") === SectionType.variants;
|
|
1646
|
+
var hasOnlyNumericKeys = (input) => !!(0, import_compat.size)(input) && (0, import_compat.every)(input, (_, key) => ARRAY_INDEX_STRING.test(key) && Number.isSafeInteger(Number(key)));
|
|
1647
|
+
var numericObjectToArray = (input) => (0, import_compat.toPairs)(input).sort(([a], [b]) => Number(a) - Number(b)).map(([_, value]) => value);
|
|
1647
1648
|
var convertNumericObjects = (input) => {
|
|
1648
|
-
if ((0,
|
|
1649
|
-
if ((0,
|
|
1649
|
+
if ((0, import_compat.isArray)(input)) return (0, import_compat.map)(input, convertNumericObjects);
|
|
1650
|
+
if ((0, import_es_toolkit2.isPlainObject)(input)) {
|
|
1650
1651
|
const obj = input;
|
|
1651
|
-
return hasOnlyNumericKeys(obj) ? (0,
|
|
1652
|
+
return hasOnlyNumericKeys(obj) ? (0, import_compat.map)(numericObjectToArray(obj), convertNumericObjects) : (0, import_es_toolkit2.mapValues)(obj, convertNumericObjects);
|
|
1652
1653
|
}
|
|
1653
1654
|
return input;
|
|
1654
1655
|
};
|
|
@@ -1672,7 +1673,7 @@ var CABImageSection = import_v410.z.object({
|
|
|
1672
1673
|
});
|
|
1673
1674
|
|
|
1674
1675
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
1675
|
-
var
|
|
1676
|
+
var import_compat2 = require("es-toolkit/compat");
|
|
1676
1677
|
var import_uuid2 = require("uuid");
|
|
1677
1678
|
var import_v411 = require("zod/v4");
|
|
1678
1679
|
var enumOrOmit = (...vals) => import_v411.z.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
@@ -1685,7 +1686,7 @@ var TiptapText = import_v411.z.object({
|
|
|
1685
1686
|
import_v411.z.object({
|
|
1686
1687
|
attrs: import_v411.z.object({
|
|
1687
1688
|
class: import_v411.z.string().nullable(),
|
|
1688
|
-
href: import_v411.z.union([import_v411.z.url(), import_v411.z.string().regex(DYNAMIC_TOKEN_REGEX)]),
|
|
1689
|
+
href: import_v411.z.union([import_v411.z.url(), import_v411.z.literal("#"), import_v411.z.string().regex(DYNAMIC_TOKEN_REGEX)]),
|
|
1689
1690
|
rel: import_v411.z.string().default("noopener noreferrer nofollow"),
|
|
1690
1691
|
target: import_v411.z.string().default("_blank")
|
|
1691
1692
|
}),
|
|
@@ -1730,8 +1731,8 @@ var CABTextSection = import_v411.z.object({
|
|
|
1730
1731
|
sectionType: import_v411.z.literal(SectionType.text).default(SectionType.text)
|
|
1731
1732
|
}).superRefine(({ buttonField: buttonField2, content }, ctx) => {
|
|
1732
1733
|
if (buttonField2 === ButtonField.destinationUrl && content) {
|
|
1733
|
-
(0,
|
|
1734
|
-
if (value && (0,
|
|
1734
|
+
(0, import_compat2.forEach)(content, (value, lang) => {
|
|
1735
|
+
if (value && (0, import_compat2.isString)(value)) {
|
|
1735
1736
|
if (DYNAMIC_TOKEN_REGEX.test(value)) return;
|
|
1736
1737
|
try {
|
|
1737
1738
|
new URL(value);
|
|
@@ -1913,7 +1914,7 @@ var CABTableSection = import_v421.z.lazy(
|
|
|
1913
1914
|
);
|
|
1914
1915
|
|
|
1915
1916
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
1916
|
-
var
|
|
1917
|
+
var import_compat3 = require("es-toolkit/compat");
|
|
1917
1918
|
var import_uuid9 = require("uuid");
|
|
1918
1919
|
var import_v422 = require("zod/v4");
|
|
1919
1920
|
var CABVariantsSection = import_v422.z.object({
|
|
@@ -1921,7 +1922,7 @@ var CABVariantsSection = import_v422.z.object({
|
|
|
1921
1922
|
rule: CABRule.optional(),
|
|
1922
1923
|
sectionId: import_v422.z.uuid().default(() => (0, import_uuid9.v7)()),
|
|
1923
1924
|
sectionType: import_v422.z.literal(SectionType.variants).default(SectionType.variants),
|
|
1924
|
-
selector: import_v422.z.enum((0,
|
|
1925
|
+
selector: import_v422.z.enum((0, import_compat3.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
1925
1926
|
variantMode: import_v422.z.enum(variantModes).default(VariantMode.multiple)
|
|
1926
1927
|
});
|
|
1927
1928
|
|
|
@@ -2094,11 +2095,11 @@ var WidgetData = import_v432.z.discriminatedUnion("type", [
|
|
|
2094
2095
|
]);
|
|
2095
2096
|
|
|
2096
2097
|
// src/schema/widgets/post-purchase-offer/common.ts
|
|
2097
|
-
var
|
|
2098
|
+
var import_compat4 = require("es-toolkit/compat");
|
|
2098
2099
|
var import_v433 = require("zod/v4");
|
|
2099
2100
|
var strictNumber = import_v433.z.union([
|
|
2100
2101
|
import_v433.z.number(),
|
|
2101
|
-
import_v433.z.string().transform((value) => (0,
|
|
2102
|
+
import_v433.z.string().transform((value) => (0, import_compat4.toNumber)((0, import_compat4.replace)((0, import_compat4.toString)(value), /[^0-9.]/g, "")) || 0),
|
|
2102
2103
|
import_v433.z.unknown().transform(() => 0)
|
|
2103
2104
|
]);
|
|
2104
2105
|
|
|
@@ -2118,7 +2119,7 @@ var blockType = import_v434.z.enum(blockTypes);
|
|
|
2118
2119
|
var BlockType = blockType.enum;
|
|
2119
2120
|
|
|
2120
2121
|
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
2121
|
-
var
|
|
2122
|
+
var import_compat5 = require("es-toolkit/compat");
|
|
2122
2123
|
var import_uuid11 = require("uuid");
|
|
2123
2124
|
var import_v435 = require("zod/v4");
|
|
2124
2125
|
var TextAlignment2 = import_v435.z.union([import_v435.z.enum(["leading", "center", "trailing"]), import_v435.z.unknown().transform(() => "leading")]);
|
|
@@ -2261,14 +2262,14 @@ var PostPurchaseBlock = import_v435.z.discriminatedUnion("type", [
|
|
|
2261
2262
|
TextBlock,
|
|
2262
2263
|
TimerBlock
|
|
2263
2264
|
]);
|
|
2264
|
-
var isCalloutBannerBlock = (block) => (0,
|
|
2265
|
-
var isImageBlock = (block) => (0,
|
|
2266
|
-
var isImageContentBlock = (block) => (0,
|
|
2267
|
-
var isPayButtonBlock = (block) => (0,
|
|
2268
|
-
var isProductInformationBlock = (block) => (0,
|
|
2269
|
-
var isSeparatorBlock = (block) => (0,
|
|
2270
|
-
var isTextBlock = (block) => (0,
|
|
2271
|
-
var isTimerBlock = (block) => (0,
|
|
2265
|
+
var isCalloutBannerBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.callout_banner);
|
|
2266
|
+
var isImageBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.image);
|
|
2267
|
+
var isImageContentBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.image_content);
|
|
2268
|
+
var isPayButtonBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.pay_button);
|
|
2269
|
+
var isProductInformationBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.product_information);
|
|
2270
|
+
var isSeparatorBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.separator);
|
|
2271
|
+
var isTextBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.text);
|
|
2272
|
+
var isTimerBlock = (block) => (0, import_compat5.isEqual)((0, import_compat5.get)(block, "type"), BlockType.timer);
|
|
2272
2273
|
|
|
2273
2274
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
2274
2275
|
var import_v438 = require("zod/v4");
|