@rebuy/rebuy 2.27.0 → 2.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.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1352 -366
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +1351 -365
- package/dist/index.mjs.map +4 -4
- package/dist/schema/checkout-and-beyond/constants.js +1 -0
- package/dist/schema/checkout-and-beyond/constants.js.map +2 -2
- package/dist/schema/checkout-and-beyond/constants.mjs +1 -0
- package/dist/schema/checkout-and-beyond/constants.mjs.map +2 -2
- package/dist/schema/checkout-and-beyond/index.js +285 -92
- package/dist/schema/checkout-and-beyond/index.js.map +4 -4
- package/dist/schema/checkout-and-beyond/index.mjs +285 -92
- package/dist/schema/checkout-and-beyond/index.mjs.map +4 -4
- package/dist/schema/widget-data.js +165 -148
- package/dist/schema/widget-data.js.map +4 -4
- package/dist/schema/widget-data.mjs +165 -148
- package/dist/schema/widget-data.mjs.map +4 -4
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts +2 -1
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/discount.d.ts +30 -0
- package/dist/schema/widgets/checkout-and-beyond/discount.d.ts.map +1 -0
- package/dist/schema/widgets/checkout-and-beyond/index.d.ts +2 -0
- package/dist/schema/widgets/checkout-and-beyond/index.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/offerLabels.d.ts +178 -0
- package/dist/schema/widgets/checkout-and-beyond/offerLabels.d.ts.map +1 -0
- package/dist/schema/widgets/checkout-and-beyond/shared.d.ts +2 -1
- package/dist/schema/widgets/checkout-and-beyond/shared.d.ts.map +1 -1
- package/dist/schema/widgets/checkout-and-beyond/utils.d.ts +2 -0
- package/dist/schema/widgets/checkout-and-beyond/utils.d.ts.map +1 -1
- package/dist/server/dataSourceResults.d.ts +18 -0
- package/dist/server/dataSourceResults.d.ts.map +1 -0
- package/dist/server/index.d.ts +6 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1162 -435
- package/dist/server/index.js.map +4 -4
- package/dist/server/index.mjs +1161 -434
- package/dist/server/index.mjs.map +4 -4
- package/dist/server/userConfig.d.ts +8 -0
- package/dist/server/userConfig.d.ts.map +1 -0
- package/dist/server/widgetSettings.d.ts.map +1 -1
- package/dist/transforms/index.d.ts +4 -0
- package/dist/transforms/index.d.ts.map +1 -1
- package/dist/transforms/index.js +1004 -81
- package/dist/transforms/index.js.map +4 -4
- package/dist/transforms/index.mjs +1004 -81
- package/dist/transforms/index.mjs.map +4 -4
- package/dist/transforms/offerV1/buildOfferTemplate.d.ts +13 -0
- package/dist/transforms/offerV1/buildOfferTemplate.d.ts.map +1 -0
- package/dist/transforms/offerV1/convertOfferToV2.d.ts +18 -0
- package/dist/transforms/offerV1/convertOfferToV2.d.ts.map +1 -0
- package/dist/transforms/offerV1/offerCard.d.ts +17 -0
- package/dist/transforms/offerV1/offerCard.d.ts.map +1 -0
- package/dist/transforms/offerV1/offerTemplateSeed.d.ts +339 -0
- package/dist/transforms/offerV1/offerTemplateSeed.d.ts.map +1 -0
- package/dist/transforms/offerV1/types.d.ts +145 -0
- package/dist/transforms/offerV1/types.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1061,7 +1061,7 @@ var UserConfig = z4.object({
|
|
|
1061
1061
|
});
|
|
1062
1062
|
|
|
1063
1063
|
// src/schema/widgetData.ts
|
|
1064
|
-
import { z as
|
|
1064
|
+
import { z as z33 } from "zod/v4";
|
|
1065
1065
|
|
|
1066
1066
|
// src/schema/widgets/abTestingPlaceholder.ts
|
|
1067
1067
|
import { z as z5 } from "zod/v4";
|
|
@@ -1196,6 +1196,7 @@ var sectionTypes = [
|
|
|
1196
1196
|
"carousel",
|
|
1197
1197
|
"cartLine",
|
|
1198
1198
|
"dataSource",
|
|
1199
|
+
"discount",
|
|
1199
1200
|
"image",
|
|
1200
1201
|
"layout",
|
|
1201
1202
|
"monetize",
|
|
@@ -1306,14 +1307,14 @@ var CheckoutExtension = z6.looseObject({
|
|
|
1306
1307
|
});
|
|
1307
1308
|
|
|
1308
1309
|
// src/schema/widgets/contentBlock.ts
|
|
1309
|
-
import { z as
|
|
1310
|
+
import { z as z27 } from "zod/v4";
|
|
1310
1311
|
|
|
1311
1312
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1312
|
-
import { z as
|
|
1313
|
+
import { z as z26 } from "zod/v4";
|
|
1313
1314
|
|
|
1314
1315
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
1315
|
-
import { v7 as
|
|
1316
|
-
import { z as
|
|
1316
|
+
import { v7 as uuidv713 } from "uuid";
|
|
1317
|
+
import { z as z25 } from "zod/v4";
|
|
1317
1318
|
|
|
1318
1319
|
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
1319
1320
|
import { z as z7 } from "zod/v4";
|
|
@@ -1383,7 +1384,7 @@ var CABRule = z7.object({
|
|
|
1383
1384
|
});
|
|
1384
1385
|
|
|
1385
1386
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
1386
|
-
import { z as
|
|
1387
|
+
import { z as z24 } from "zod/v4";
|
|
1387
1388
|
|
|
1388
1389
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
1389
1390
|
import { z as z8 } from "zod/v4";
|
|
@@ -1430,6 +1431,7 @@ var isButtonType = (section) => get2(section, "sectionType") === SectionType.but
|
|
|
1430
1431
|
var isCarouselType = (section) => get2(section, "sectionType") === SectionType.carousel;
|
|
1431
1432
|
var isCartLineType = (section) => get2(section, "sectionType") === SectionType.cartLine;
|
|
1432
1433
|
var isDataSourceType = (section) => get2(section, "sectionType") === SectionType.dataSource;
|
|
1434
|
+
var isDiscountType = (section) => get2(section, "sectionType") === SectionType.discount;
|
|
1433
1435
|
var isImageType = (section) => get2(section, "sectionType") === SectionType.image;
|
|
1434
1436
|
var isLayoutType = (section) => get2(section, "sectionType") === SectionType.layout;
|
|
1435
1437
|
var isMonetizeType = (section) => get2(section, "sectionType") === SectionType.monetize;
|
|
@@ -1700,39 +1702,54 @@ var CABCartLineSection = z17.lazy(
|
|
|
1700
1702
|
})
|
|
1701
1703
|
);
|
|
1702
1704
|
|
|
1703
|
-
// src/schema/widgets/checkout-and-beyond/
|
|
1705
|
+
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
1704
1706
|
import { v7 as uuidv77 } from "uuid";
|
|
1705
1707
|
import { z as z18 } from "zod/v4";
|
|
1706
|
-
var
|
|
1708
|
+
var CABDiscountSection = z18.object({
|
|
1709
|
+
amount: z18.union([z18.number(), z18.string()]).catch(0),
|
|
1710
|
+
discountedBy: z18.string().optional(),
|
|
1711
|
+
discountedFrom: z18.enum(discountSources).optional().catch(void 0),
|
|
1712
|
+
message: z18.string().optional(),
|
|
1707
1713
|
name: z18.string().optional(),
|
|
1708
|
-
|
|
1714
|
+
quantity: z18.number().default(1),
|
|
1709
1715
|
sectionId: z18.uuid().default(() => uuidv77()),
|
|
1710
|
-
sectionType: z18.literal(SectionType.
|
|
1716
|
+
sectionType: z18.literal(SectionType.discount).default(SectionType.discount),
|
|
1717
|
+
type: z18.enum(discountTypes).catch("none")
|
|
1711
1718
|
});
|
|
1712
1719
|
|
|
1713
|
-
// src/schema/widgets/checkout-and-beyond/
|
|
1720
|
+
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
1714
1721
|
import { v7 as uuidv78 } from "uuid";
|
|
1715
1722
|
import { z as z19 } from "zod/v4";
|
|
1716
|
-
var
|
|
1717
|
-
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
1718
|
-
countryCodes: z19.array(z19.string()).default(() => []),
|
|
1723
|
+
var CABMonetizeSection = z19.object({
|
|
1719
1724
|
name: z19.string().optional(),
|
|
1720
1725
|
rule: CABRule.optional(),
|
|
1721
1726
|
sectionId: z19.uuid().default(() => uuidv78()),
|
|
1722
|
-
|
|
1723
|
-
sectionType: z19.literal(SectionType.progressBar).default(SectionType.progressBar)
|
|
1727
|
+
sectionType: z19.literal(SectionType.monetize).default(SectionType.monetize)
|
|
1724
1728
|
});
|
|
1725
1729
|
|
|
1726
|
-
// src/schema/widgets/checkout-and-beyond/
|
|
1730
|
+
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
1727
1731
|
import { v7 as uuidv79 } from "uuid";
|
|
1728
1732
|
import { z as z20 } from "zod/v4";
|
|
1729
|
-
var
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1733
|
+
var CABProgressBarSection = z20.object({
|
|
1734
|
+
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
1735
|
+
countryCodes: z20.array(z20.string()).default(() => []),
|
|
1736
|
+
name: z20.string().optional(),
|
|
1737
|
+
rule: CABRule.optional(),
|
|
1738
|
+
sectionId: z20.uuid().default(() => uuidv79()),
|
|
1739
|
+
sections: z20.union([z20.array(CABTextSection), z20.strictObject({}).transform(() => [])]).default(() => []),
|
|
1740
|
+
sectionType: z20.literal(SectionType.progressBar).default(SectionType.progressBar)
|
|
1741
|
+
});
|
|
1742
|
+
|
|
1743
|
+
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
1744
|
+
import { v7 as uuidv710 } from "uuid";
|
|
1745
|
+
import { z as z21 } from "zod/v4";
|
|
1746
|
+
var CABQuantitySection = z21.object({
|
|
1747
|
+
errorMessages: z21.record(
|
|
1748
|
+
z21.string(),
|
|
1749
|
+
z21.object({
|
|
1750
|
+
max: z21.string().optional(),
|
|
1751
|
+
min: z21.string().optional(),
|
|
1752
|
+
neg: z21.string().optional()
|
|
1736
1753
|
})
|
|
1737
1754
|
).default({
|
|
1738
1755
|
en: {
|
|
@@ -1741,58 +1758,59 @@ var CABQuantitySection = z20.object({
|
|
|
1741
1758
|
neg: "Quantity cannot be negative"
|
|
1742
1759
|
}
|
|
1743
1760
|
}),
|
|
1744
|
-
inputType:
|
|
1745
|
-
max:
|
|
1746
|
-
min:
|
|
1747
|
-
name: z20.string().optional(),
|
|
1748
|
-
rule: CABRule.optional(),
|
|
1749
|
-
sectionId: z20.uuid().default(() => uuidv79()),
|
|
1750
|
-
sectionType: z20.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1751
|
-
});
|
|
1752
|
-
|
|
1753
|
-
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1754
|
-
import { v7 as uuidv710 } from "uuid";
|
|
1755
|
-
import { z as z21 } from "zod/v4";
|
|
1756
|
-
var CABReviewsSection = z21.object({
|
|
1757
|
-
color: z21.string().default("#fadb14"),
|
|
1761
|
+
inputType: z21.enum(quantityInputs).default(QuantityInput.select),
|
|
1762
|
+
max: z21.number().min(1).max(100).default(10),
|
|
1763
|
+
min: z21.number().min(1).default(1),
|
|
1758
1764
|
name: z21.string().optional(),
|
|
1759
1765
|
rule: CABRule.optional(),
|
|
1760
1766
|
sectionId: z21.uuid().default(() => uuidv710()),
|
|
1761
|
-
sectionType: z21.literal(SectionType.
|
|
1762
|
-
size: z21.enum(reviewsSizes).default(ReviewsSize.default)
|
|
1767
|
+
sectionType: z21.literal(SectionType.quantity).default(SectionType.quantity)
|
|
1763
1768
|
});
|
|
1764
1769
|
|
|
1765
|
-
// src/schema/widgets/checkout-and-beyond/
|
|
1766
|
-
import { slice } from "es-toolkit/compat";
|
|
1770
|
+
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
1767
1771
|
import { v7 as uuidv711 } from "uuid";
|
|
1768
1772
|
import { z as z22 } from "zod/v4";
|
|
1769
|
-
var
|
|
1770
|
-
|
|
1773
|
+
var CABReviewsSection = z22.object({
|
|
1774
|
+
color: z22.string().default("#fadb14"),
|
|
1771
1775
|
name: z22.string().optional(),
|
|
1772
1776
|
rule: CABRule.optional(),
|
|
1773
1777
|
sectionId: z22.uuid().default(() => uuidv711()),
|
|
1774
|
-
sectionType: z22.literal(SectionType.
|
|
1775
|
-
|
|
1776
|
-
|
|
1778
|
+
sectionType: z22.literal(SectionType.reviews).default(SectionType.reviews),
|
|
1779
|
+
size: z22.enum(reviewsSizes).default(ReviewsSize.default)
|
|
1780
|
+
});
|
|
1781
|
+
|
|
1782
|
+
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
1783
|
+
import { slice } from "es-toolkit/compat";
|
|
1784
|
+
import { v7 as uuidv712 } from "uuid";
|
|
1785
|
+
import { z as z23 } from "zod/v4";
|
|
1786
|
+
var CABVariantsSection = z23.object({
|
|
1787
|
+
hideOutOfStockVariants: z23.boolean().default(false),
|
|
1788
|
+
name: z23.string().optional(),
|
|
1789
|
+
rule: CABRule.optional(),
|
|
1790
|
+
sectionId: z23.uuid().default(() => uuidv712()),
|
|
1791
|
+
sectionType: z23.literal(SectionType.variants).default(SectionType.variants),
|
|
1792
|
+
selector: z23.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
1793
|
+
variantMode: z23.enum(variantModes).default(VariantMode.multiple)
|
|
1777
1794
|
});
|
|
1778
1795
|
|
|
1779
1796
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
1780
|
-
var CABBorder =
|
|
1781
|
-
radius:
|
|
1782
|
-
style:
|
|
1783
|
-
width:
|
|
1797
|
+
var CABBorder = z24.object({
|
|
1798
|
+
radius: z24.enum(borderRadii).default(BorderRadius.base),
|
|
1799
|
+
style: z24.enum(borderStyles).default(BorderStyle.none),
|
|
1800
|
+
width: z24.enum(borderWidths).default(BorderWidth.base)
|
|
1784
1801
|
}).default({
|
|
1785
1802
|
radius: BorderRadius.base,
|
|
1786
1803
|
style: BorderStyle.none,
|
|
1787
1804
|
width: BorderWidth.base
|
|
1788
1805
|
});
|
|
1789
|
-
var CABSection =
|
|
1790
|
-
() =>
|
|
1806
|
+
var CABSection = z24.lazy(
|
|
1807
|
+
() => z24.discriminatedUnion("sectionType", [
|
|
1791
1808
|
CABBannerSection,
|
|
1792
1809
|
CABButtonSection,
|
|
1793
1810
|
CABCarouselSection,
|
|
1794
1811
|
CABCartLineSection,
|
|
1795
1812
|
CABDataSourceSection,
|
|
1813
|
+
CABDiscountSection,
|
|
1796
1814
|
CABImageSection,
|
|
1797
1815
|
CABLayoutSection,
|
|
1798
1816
|
CABMonetizeSection,
|
|
@@ -1808,155 +1826,155 @@ var CABSection = z23.lazy(
|
|
|
1808
1826
|
);
|
|
1809
1827
|
|
|
1810
1828
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
1811
|
-
var GridItem =
|
|
1812
|
-
var CABLayoutSection =
|
|
1813
|
-
alignment:
|
|
1814
|
-
horizontal:
|
|
1815
|
-
vertical:
|
|
1829
|
+
var GridItem = z25.union([z25.literal("auto"), z25.literal("fill"), z25.string().regex(/^\d+%$/), z25.number()]);
|
|
1830
|
+
var CABLayoutSection = z25.object({
|
|
1831
|
+
alignment: z25.object({
|
|
1832
|
+
horizontal: z25.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
1833
|
+
vertical: z25.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
1816
1834
|
}).default({
|
|
1817
1835
|
horizontal: HorizontalAlignment.start,
|
|
1818
1836
|
vertical: VerticalAlignment.top
|
|
1819
1837
|
}),
|
|
1820
|
-
border:
|
|
1821
|
-
buttonField:
|
|
1822
|
-
direction:
|
|
1823
|
-
grid:
|
|
1824
|
-
columns:
|
|
1825
|
-
rows:
|
|
1838
|
+
border: z25.lazy(() => CABBorder),
|
|
1839
|
+
buttonField: z25.enum(buttonFields).optional(),
|
|
1840
|
+
direction: z25.enum(directions).default(Direction.rows),
|
|
1841
|
+
grid: z25.object({
|
|
1842
|
+
columns: z25.union([z25.array(GridItem), z25.undefined()]).default(() => ["auto"]),
|
|
1843
|
+
rows: z25.union([z25.array(GridItem), z25.undefined()]).default(() => ["auto"])
|
|
1826
1844
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
1827
|
-
name:
|
|
1828
|
-
padding:
|
|
1845
|
+
name: z25.string().optional(),
|
|
1846
|
+
padding: z25.enum(spacings).default(Spacing.none),
|
|
1829
1847
|
rule: CABRule.optional(),
|
|
1830
|
-
sectionId:
|
|
1831
|
-
sections:
|
|
1832
|
-
sectionType:
|
|
1833
|
-
spacing:
|
|
1848
|
+
sectionId: z25.uuid().default(() => uuidv713()),
|
|
1849
|
+
sections: z25.union([z25.array(z25.lazy(() => CABSection)), z25.strictObject({}).transform(() => [])]).default(() => []),
|
|
1850
|
+
sectionType: z25.literal(SectionType.layout).default(SectionType.layout),
|
|
1851
|
+
spacing: z25.enum(spacings).default(Spacing.base),
|
|
1834
1852
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
1835
|
-
viewUrl:
|
|
1836
|
-
width:
|
|
1853
|
+
viewUrl: z25.string().optional(),
|
|
1854
|
+
width: z25.number().default(100)
|
|
1837
1855
|
});
|
|
1838
1856
|
|
|
1839
1857
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
1840
|
-
var TargetArea =
|
|
1841
|
-
fill:
|
|
1842
|
-
flip:
|
|
1843
|
-
icon:
|
|
1844
|
-
label:
|
|
1845
|
-
width:
|
|
1858
|
+
var TargetArea = z26.object({
|
|
1859
|
+
fill: z26.boolean().optional(),
|
|
1860
|
+
flip: z26.enum(["both", "horizontal", "vertical"]).optional(),
|
|
1861
|
+
icon: z26.string(),
|
|
1862
|
+
label: z26.string(),
|
|
1863
|
+
width: z26.string()
|
|
1846
1864
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
1847
|
-
var CABTracking =
|
|
1848
|
-
enableAttribution:
|
|
1849
|
-
enableSource:
|
|
1850
|
-
enableWidget:
|
|
1865
|
+
var CABTracking = z26.object({
|
|
1866
|
+
enableAttribution: z26.boolean().default(true),
|
|
1867
|
+
enableSource: z26.boolean().default(true),
|
|
1868
|
+
enableWidget: z26.boolean().default(true)
|
|
1851
1869
|
}).default({ enableAttribution: true, enableSource: true, enableWidget: true });
|
|
1852
1870
|
var CABRootSection = CABLayoutSection.extend({
|
|
1853
|
-
editorMode:
|
|
1854
|
-
previewMode:
|
|
1855
|
-
storeId:
|
|
1871
|
+
editorMode: z26.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
1872
|
+
previewMode: z26.boolean().default(false),
|
|
1873
|
+
storeId: z26.number().nullable().default(null),
|
|
1856
1874
|
targetArea: TargetArea.nullable(),
|
|
1857
1875
|
tracking: CABTracking,
|
|
1858
|
-
type:
|
|
1859
|
-
version:
|
|
1860
|
-
widgetId:
|
|
1876
|
+
type: z26.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
1877
|
+
version: z26.literal(2).default(2),
|
|
1878
|
+
widgetId: z26.number().nullable().default(null)
|
|
1861
1879
|
});
|
|
1862
1880
|
|
|
1863
1881
|
// src/schema/widgets/contentBlock.ts
|
|
1864
|
-
var ContentBlockV1 =
|
|
1865
|
-
blockSpacing:
|
|
1866
|
-
imageBlocks:
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
altText:
|
|
1870
|
-
description:
|
|
1871
|
-
id:
|
|
1872
|
-
imagePlacement:
|
|
1873
|
-
imageSize:
|
|
1874
|
-
imageUrl:
|
|
1875
|
-
textAlignment:
|
|
1876
|
-
textSize:
|
|
1882
|
+
var ContentBlockV1 = z27.object({
|
|
1883
|
+
blockSpacing: z27.enum(spacings).optional(),
|
|
1884
|
+
imageBlocks: z27.union([
|
|
1885
|
+
z27.array(
|
|
1886
|
+
z27.object({
|
|
1887
|
+
altText: z27.string().nullable(),
|
|
1888
|
+
description: z27.string().nullable(),
|
|
1889
|
+
id: z27.uuid(),
|
|
1890
|
+
imagePlacement: z27.enum(["top", "right", "bottom", "left"]),
|
|
1891
|
+
imageSize: z27.number(),
|
|
1892
|
+
imageUrl: z27.url(),
|
|
1893
|
+
textAlignment: z27.enum(["left", "center", "right"]),
|
|
1894
|
+
textSize: z27.enum(textSizeNames)
|
|
1877
1895
|
})
|
|
1878
1896
|
),
|
|
1879
|
-
|
|
1897
|
+
z27.strictObject({}).transform(() => [])
|
|
1880
1898
|
]).optional(),
|
|
1881
|
-
imageLayout:
|
|
1882
|
-
language:
|
|
1883
|
-
description:
|
|
1884
|
-
superTitle:
|
|
1885
|
-
title:
|
|
1899
|
+
imageLayout: z27.enum(["row", "column"]).optional(),
|
|
1900
|
+
language: z27.object({
|
|
1901
|
+
description: z27.string(),
|
|
1902
|
+
superTitle: z27.string(),
|
|
1903
|
+
title: z27.string()
|
|
1886
1904
|
}),
|
|
1887
|
-
previewMode:
|
|
1888
|
-
type:
|
|
1889
|
-
version:
|
|
1905
|
+
previewMode: z27.boolean(),
|
|
1906
|
+
type: z27.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block),
|
|
1907
|
+
version: z27.literal(1)
|
|
1890
1908
|
});
|
|
1891
|
-
var ContentBlock =
|
|
1909
|
+
var ContentBlock = z27.discriminatedUnion("version", [
|
|
1892
1910
|
ContentBlockV1,
|
|
1893
1911
|
CABRootSection.extend({
|
|
1894
|
-
type:
|
|
1912
|
+
type: z27.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
1895
1913
|
})
|
|
1896
1914
|
]);
|
|
1897
1915
|
|
|
1898
1916
|
// src/schema/widgets/giftWithPurchase.ts
|
|
1899
|
-
import { z as
|
|
1900
|
-
var GiftWithPurchase =
|
|
1901
|
-
type:
|
|
1917
|
+
import { z as z28 } from "zod/v4";
|
|
1918
|
+
var GiftWithPurchase = z28.looseObject({
|
|
1919
|
+
type: z28.literal(WidgetType.gift_with_purchase).default(WidgetType.gift_with_purchase)
|
|
1902
1920
|
});
|
|
1903
1921
|
|
|
1904
1922
|
// src/schema/widgets/lineItemEditor.ts
|
|
1905
|
-
import { z as
|
|
1906
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
1907
|
-
downgradeToOneTimeLabel:
|
|
1923
|
+
import { z as z29 } from "zod/v4";
|
|
1924
|
+
var LineItemEditorSwitchLanguageV1 = z29.object({
|
|
1925
|
+
downgradeToOneTimeLabel: z29.string().optional(),
|
|
1908
1926
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
1909
|
-
subscriptionOptionLabel:
|
|
1910
|
-
upgradeToSubscriptionLabel:
|
|
1911
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
1927
|
+
subscriptionOptionLabel: z29.string().optional(),
|
|
1928
|
+
upgradeToSubscriptionLabel: z29.string().optional(),
|
|
1929
|
+
upgradeToSubscriptionWithoutDiscountLabel: z29.string().optional()
|
|
1912
1930
|
});
|
|
1913
|
-
var LineItemEditorV1 =
|
|
1931
|
+
var LineItemEditorV1 = z29.object({
|
|
1914
1932
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
1915
|
-
button:
|
|
1916
|
-
previewMode:
|
|
1917
|
-
switchToSubscription:
|
|
1918
|
-
disableDowngrade:
|
|
1933
|
+
button: z29.object({ kind: z29.enum(["plain", "primary", "secondary"]).optional() }).optional(),
|
|
1934
|
+
previewMode: z29.boolean().optional(),
|
|
1935
|
+
switchToSubscription: z29.object({
|
|
1936
|
+
disableDowngrade: z29.boolean().optional(),
|
|
1919
1937
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
1920
1938
|
}).optional(),
|
|
1921
|
-
switchToSubscriptionEnabled:
|
|
1922
|
-
tracking:
|
|
1923
|
-
enableAttribution:
|
|
1924
|
-
enableSource:
|
|
1925
|
-
enableWidget:
|
|
1939
|
+
switchToSubscriptionEnabled: z29.boolean().optional(),
|
|
1940
|
+
tracking: z29.object({
|
|
1941
|
+
enableAttribution: z29.boolean().optional(),
|
|
1942
|
+
enableSource: z29.boolean().optional(),
|
|
1943
|
+
enableWidget: z29.boolean().optional()
|
|
1926
1944
|
}).optional(),
|
|
1927
|
-
type:
|
|
1928
|
-
version:
|
|
1945
|
+
type: z29.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
1946
|
+
version: z29.literal(1)
|
|
1929
1947
|
});
|
|
1930
|
-
var LineItemEditor =
|
|
1948
|
+
var LineItemEditor = z29.discriminatedUnion("version", [
|
|
1931
1949
|
LineItemEditorV1,
|
|
1932
1950
|
CABRootSection.extend({
|
|
1933
|
-
type:
|
|
1951
|
+
type: z29.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
1934
1952
|
})
|
|
1935
1953
|
]);
|
|
1936
1954
|
|
|
1937
1955
|
// src/schema/widgets/progressBar.ts
|
|
1938
|
-
import { z as
|
|
1939
|
-
var ProgressBar =
|
|
1940
|
-
type:
|
|
1956
|
+
import { z as z30 } from "zod/v4";
|
|
1957
|
+
var ProgressBar = z30.looseObject({
|
|
1958
|
+
type: z30.literal(WidgetType.ui_extension_progress_bar).default(WidgetType.ui_extension_progress_bar)
|
|
1941
1959
|
});
|
|
1942
1960
|
|
|
1943
1961
|
// src/schema/widgets/rebuyButton.ts
|
|
1944
|
-
import { z as
|
|
1945
|
-
var RebuyButtonV1 =
|
|
1946
|
-
type:
|
|
1947
|
-
version:
|
|
1962
|
+
import { z as z31 } from "zod/v4";
|
|
1963
|
+
var RebuyButtonV1 = z31.looseObject({
|
|
1964
|
+
type: z31.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button),
|
|
1965
|
+
version: z31.literal(1)
|
|
1948
1966
|
});
|
|
1949
|
-
var RebuyButton =
|
|
1967
|
+
var RebuyButton = z31.discriminatedUnion("version", [
|
|
1950
1968
|
RebuyButtonV1,
|
|
1951
1969
|
CABRootSection.extend({
|
|
1952
|
-
type:
|
|
1970
|
+
type: z31.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
1953
1971
|
})
|
|
1954
1972
|
]);
|
|
1955
1973
|
|
|
1956
1974
|
// src/schema/widgets/rebuyMonetize.ts
|
|
1957
|
-
import { z as
|
|
1958
|
-
var RebuyMonetize =
|
|
1959
|
-
type:
|
|
1975
|
+
import { z as z32 } from "zod/v4";
|
|
1976
|
+
var RebuyMonetize = z32.looseObject({
|
|
1977
|
+
type: z32.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad)
|
|
1960
1978
|
});
|
|
1961
1979
|
|
|
1962
1980
|
// src/schema/widgetData.ts
|
|
@@ -1970,7 +1988,7 @@ var extensionWidgetTypes = [
|
|
|
1970
1988
|
WidgetType.ui_extension_line_item_editor,
|
|
1971
1989
|
WidgetType.ui_extension_progress_bar
|
|
1972
1990
|
];
|
|
1973
|
-
var WidgetData =
|
|
1991
|
+
var WidgetData = z33.discriminatedUnion("type", [
|
|
1974
1992
|
ABTestingPlaceholder,
|
|
1975
1993
|
CheckoutExtension,
|
|
1976
1994
|
ContentBlock,
|
|
@@ -1981,6 +1999,178 @@ var WidgetData = z32.discriminatedUnion("type", [
|
|
|
1981
1999
|
RebuyMonetize
|
|
1982
2000
|
]);
|
|
1983
2001
|
|
|
2002
|
+
// src/schema/widgets/checkout-and-beyond/offerLabels.ts
|
|
2003
|
+
var OFFER_LABELS = {
|
|
2004
|
+
addToCart: {
|
|
2005
|
+
ar: "\u0623\u0636\u0641 \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629",
|
|
2006
|
+
cs: "P\u0159idat do ko\u0161\xEDku",
|
|
2007
|
+
da: "L\xE6g i kurv",
|
|
2008
|
+
de: "In den Warenkorb",
|
|
2009
|
+
en: "Add to cart",
|
|
2010
|
+
es: "A\xF1adir al carrito",
|
|
2011
|
+
fi: "Lis\xE4\xE4 ostoskoriin",
|
|
2012
|
+
fr: "Ajouter au panier",
|
|
2013
|
+
ga: "Cuir sa chairt",
|
|
2014
|
+
he: "\u05D4\u05D5\u05E1\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4",
|
|
2015
|
+
hi: "\u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u0947\u0902",
|
|
2016
|
+
id: "Tambahkan ke keranjang",
|
|
2017
|
+
it: "Aggiungi al carrello",
|
|
2018
|
+
ja: "\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0",
|
|
2019
|
+
ko: "\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00",
|
|
2020
|
+
nl: "In winkelwagen",
|
|
2021
|
+
no: "Legg i handlekurven",
|
|
2022
|
+
pl: "Dodaj do koszyka",
|
|
2023
|
+
pt: "Adicionar ao carrinho",
|
|
2024
|
+
ru: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443",
|
|
2025
|
+
sv: "L\xE4gg i varukorgen",
|
|
2026
|
+
th: "\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E25\u0E07\u0E15\u0E30\u0E01\u0E23\u0E49\u0E32",
|
|
2027
|
+
tr: "Sepete ekle",
|
|
2028
|
+
uk: "\u0414\u043E\u0434\u0430\u0442\u0438 \u0432 \u043A\u043E\u0448\u0438\u043A",
|
|
2029
|
+
vi: "Th\xEAm v\xE0o gi\u1ECF h\xE0ng",
|
|
2030
|
+
zh: "\u52A0\u5165\u8D2D\u7269\u8F66"
|
|
2031
|
+
},
|
|
2032
|
+
addedToCart: {
|
|
2033
|
+
ar: "\u062A\u0645\u062A \u0627\u0644\u0625\u0636\u0627\u0641\u0629!",
|
|
2034
|
+
cs: "P\u0159id\xE1no!",
|
|
2035
|
+
da: "Tilf\xF8jet!",
|
|
2036
|
+
de: "Hinzugef\xFCgt!",
|
|
2037
|
+
en: "Added!",
|
|
2038
|
+
es: "\xA1A\xF1adido!",
|
|
2039
|
+
fi: "Lis\xE4tty!",
|
|
2040
|
+
fr: "Ajout\xE9 !",
|
|
2041
|
+
ga: "Curtha leis!",
|
|
2042
|
+
he: "\u05E0\u05D5\u05E1\u05E3!",
|
|
2043
|
+
hi: "\u091C\u094B\u0921\u093C\u093E \u0917\u092F\u093E!",
|
|
2044
|
+
id: "Ditambahkan!",
|
|
2045
|
+
it: "Aggiunto!",
|
|
2046
|
+
ja: "\u8FFD\u52A0\u3057\u307E\u3057\u305F\uFF01",
|
|
2047
|
+
ko: "\uCD94\uAC00\uB428!",
|
|
2048
|
+
nl: "Toegevoegd!",
|
|
2049
|
+
no: "Lagt til!",
|
|
2050
|
+
pl: "Dodano!",
|
|
2051
|
+
pt: "Adicionado!",
|
|
2052
|
+
ru: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u043E!",
|
|
2053
|
+
sv: "Tillagd!",
|
|
2054
|
+
th: "\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E41\u0E25\u0E49\u0E27!",
|
|
2055
|
+
tr: "Eklendi!",
|
|
2056
|
+
uk: "\u0414\u043E\u0434\u0430\u043D\u043E!",
|
|
2057
|
+
vi: "\u0110\xE3 th\xEAm!",
|
|
2058
|
+
zh: "\u5DF2\u6DFB\u52A0\uFF01"
|
|
2059
|
+
},
|
|
2060
|
+
addedToCartMessage: {
|
|
2061
|
+
ar: "\u062A\u0645\u062A \u0625\u0636\u0627\u0641\u0629 {{quantity}} {{productTitle}} \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629.",
|
|
2062
|
+
cs: "{{quantity}} {{productTitle}} p\u0159id\xE1no do ko\u0161\xEDku.",
|
|
2063
|
+
da: "{{quantity}} {{productTitle}} lagt i kurven.",
|
|
2064
|
+
de: "{{quantity}} {{productTitle}} zum Warenkorb hinzugef\xFCgt.",
|
|
2065
|
+
en: "{{quantity}} {{productTitle}} added to cart.",
|
|
2066
|
+
es: "{{quantity}} {{productTitle}} a\xF1adido al carrito.",
|
|
2067
|
+
fi: "{{quantity}} {{productTitle}} lis\xE4tty ostoskoriin.",
|
|
2068
|
+
fr: "{{quantity}} {{productTitle}} ajout\xE9 au panier.",
|
|
2069
|
+
ga: "Cuireadh {{quantity}} {{productTitle}} sa chairt.",
|
|
2070
|
+
he: "{{quantity}} {{productTitle}} \u05E0\u05D5\u05E1\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4.",
|
|
2071
|
+
hi: "{{quantity}} {{productTitle}} \u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u093E \u0917\u092F\u093E\u0964",
|
|
2072
|
+
id: "{{quantity}} {{productTitle}} ditambahkan ke keranjang.",
|
|
2073
|
+
it: "{{quantity}} {{productTitle}} aggiunto al carrello.",
|
|
2074
|
+
ja: "{{quantity}} {{productTitle}}\u3092\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0\u3057\u307E\u3057\u305F\u3002",
|
|
2075
|
+
ko: "{{quantity}} {{productTitle}}\uC774(\uAC00) \uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
|
|
2076
|
+
nl: "{{quantity}} {{productTitle}} toegevoegd aan winkelwagen.",
|
|
2077
|
+
no: "{{quantity}} {{productTitle}} lagt i handlekurven.",
|
|
2078
|
+
pl: "{{quantity}} {{productTitle}} dodano do koszyka.",
|
|
2079
|
+
pt: "{{quantity}} {{productTitle}} adicionado ao carrinho.",
|
|
2080
|
+
ru: "{{quantity}} {{productTitle}} \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u043E \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443.",
|
|
2081
|
+
sv: "{{quantity}} {{productTitle}} har lagts i varukorgen.",
|
|
2082
|
+
th: "\u0E40\u0E1E\u0E34\u0E48\u0E21 {{quantity}} {{productTitle}} \u0E25\u0E07\u0E15\u0E30\u0E01\u0E23\u0E49\u0E32\u0E41\u0E25\u0E49\u0E27",
|
|
2083
|
+
tr: "{{quantity}} {{productTitle}} sepete eklendi.",
|
|
2084
|
+
uk: "{{quantity}} {{productTitle}} \u0434\u043E\u0434\u0430\u043D\u043E \u0434\u043E \u043A\u043E\u0448\u0438\u043A\u0430.",
|
|
2085
|
+
vi: "\u0110\xE3 th\xEAm {{quantity}} {{productTitle}} v\xE0o gi\u1ECF h\xE0ng.",
|
|
2086
|
+
zh: "{{quantity}} {{productTitle}} \u5DF2\u52A0\u5165\u8D2D\u7269\u8F66\u3002"
|
|
2087
|
+
},
|
|
2088
|
+
addingToCart: {
|
|
2089
|
+
ar: "\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0636\u0627\u0641\u0629...",
|
|
2090
|
+
cs: "P\u0159id\xE1v\xE1n\xED...",
|
|
2091
|
+
da: "Tilf\xF8jer...",
|
|
2092
|
+
de: "Wird hinzugef\xFCgt...",
|
|
2093
|
+
en: "Adding...",
|
|
2094
|
+
es: "A\xF1adiendo...",
|
|
2095
|
+
fi: "Lis\xE4t\xE4\xE4n...",
|
|
2096
|
+
fr: "Ajout en cours...",
|
|
2097
|
+
ga: "\xC1 chur leis...",
|
|
2098
|
+
he: "\u05DE\u05D5\u05E1\u05D9\u05E3...",
|
|
2099
|
+
hi: "\u091C\u094B\u0921\u093C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948...",
|
|
2100
|
+
id: "Menambahkan...",
|
|
2101
|
+
it: "Aggiunta in corso...",
|
|
2102
|
+
ja: "\u8FFD\u52A0\u4E2D...",
|
|
2103
|
+
ko: "\uCD94\uAC00 \uC911...",
|
|
2104
|
+
nl: "Toevoegen...",
|
|
2105
|
+
no: "Legger til...",
|
|
2106
|
+
pl: "Dodawanie...",
|
|
2107
|
+
pt: "Adicionando...",
|
|
2108
|
+
ru: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435...",
|
|
2109
|
+
sv: "L\xE4gger till...",
|
|
2110
|
+
th: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E40\u0E1E\u0E34\u0E48\u0E21...",
|
|
2111
|
+
tr: "Ekleniyor...",
|
|
2112
|
+
uk: "\u0414\u043E\u0434\u0430\u0432\u0430\u043D\u043D\u044F...",
|
|
2113
|
+
vi: "\u0110ang th\xEAm...",
|
|
2114
|
+
zh: "\u6B63\u5728\u6DFB\u52A0..."
|
|
2115
|
+
},
|
|
2116
|
+
soldOut: {
|
|
2117
|
+
ar: "\u0646\u0641\u062F\u062A \u0627\u0644\u0643\u0645\u064A\u0629",
|
|
2118
|
+
cs: "Vyprod\xE1no",
|
|
2119
|
+
da: "Udsolgt",
|
|
2120
|
+
de: "Ausverkauft",
|
|
2121
|
+
en: "Sold out",
|
|
2122
|
+
es: "Agotado",
|
|
2123
|
+
fi: "Loppuunmyyty",
|
|
2124
|
+
fr: "\xC9puis\xE9",
|
|
2125
|
+
ga: "D\xEDolta amach",
|
|
2126
|
+
he: "\u05D0\u05D6\u05DC \u05DE\u05D4\u05DE\u05DC\u05D0\u05D9",
|
|
2127
|
+
hi: "\u0938\u094D\u091F\u0949\u0915 \u0916\u093C\u0924\u094D\u092E",
|
|
2128
|
+
id: "Habis terjual",
|
|
2129
|
+
it: "Esaurito",
|
|
2130
|
+
ja: "\u58F2\u308A\u5207\u308C",
|
|
2131
|
+
ko: "\uD488\uC808",
|
|
2132
|
+
nl: "Uitverkocht",
|
|
2133
|
+
no: "Utsolgt",
|
|
2134
|
+
pl: "Wyprzedane",
|
|
2135
|
+
pt: "Esgotado",
|
|
2136
|
+
ru: "\u0420\u0430\u0441\u043F\u0440\u043E\u0434\u0430\u043D\u043E",
|
|
2137
|
+
sv: "Sluts\xE5ld",
|
|
2138
|
+
th: "\u0E2A\u0E34\u0E19\u0E04\u0E49\u0E32\u0E2B\u0E21\u0E14",
|
|
2139
|
+
tr: "T\xFCkendi",
|
|
2140
|
+
uk: "\u0420\u043E\u0437\u043F\u0440\u043E\u0434\u0430\u043D\u043E",
|
|
2141
|
+
vi: "H\u1EBFt h\xE0ng",
|
|
2142
|
+
zh: "\u5DF2\u552E\u7F44"
|
|
2143
|
+
},
|
|
2144
|
+
undo: {
|
|
2145
|
+
ar: "\u062A\u0631\u0627\u062C\u0639",
|
|
2146
|
+
cs: "Zp\u011Bt",
|
|
2147
|
+
da: "Fortryd",
|
|
2148
|
+
de: "R\xFCckg\xE4ngig",
|
|
2149
|
+
en: "Undo",
|
|
2150
|
+
es: "Deshacer",
|
|
2151
|
+
fi: "Kumoa",
|
|
2152
|
+
fr: "Annuler",
|
|
2153
|
+
ga: "Cealaigh",
|
|
2154
|
+
he: "\u05D1\u05D8\u05DC",
|
|
2155
|
+
hi: "\u092A\u0942\u0930\u094D\u0935\u0935\u0924 \u0915\u0930\u0947\u0902",
|
|
2156
|
+
id: "Urungkan",
|
|
2157
|
+
it: "Annulla",
|
|
2158
|
+
ja: "\u5143\u306B\u623B\u3059",
|
|
2159
|
+
ko: "\uC2E4\uD589 \uCDE8\uC18C",
|
|
2160
|
+
nl: "Ongedaan maken",
|
|
2161
|
+
no: "Angre",
|
|
2162
|
+
pl: "Cofnij",
|
|
2163
|
+
pt: "Desfazer",
|
|
2164
|
+
ru: "\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",
|
|
2165
|
+
sv: "\xC5ngra",
|
|
2166
|
+
th: "\u0E40\u0E25\u0E34\u0E01\u0E17\u0E33",
|
|
2167
|
+
tr: "Geri al",
|
|
2168
|
+
uk: "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438",
|
|
2169
|
+
vi: "Ho\xE0n t\xE1c",
|
|
2170
|
+
zh: "\u64A4\u9500"
|
|
2171
|
+
}
|
|
2172
|
+
};
|
|
2173
|
+
|
|
1984
2174
|
// src/schema/widgets/checkout-and-beyond/switchLabels.ts
|
|
1985
2175
|
var SWITCH_LABELS = {
|
|
1986
2176
|
subscriptionOption: {
|
|
@@ -2099,15 +2289,15 @@ var SWITCH_LABELS = {
|
|
|
2099
2289
|
|
|
2100
2290
|
// src/schema/widgets/post-purchase-offer/common.ts
|
|
2101
2291
|
import { replace, toNumber, toString } from "es-toolkit/compat";
|
|
2102
|
-
import { z as
|
|
2103
|
-
var strictNumber =
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2292
|
+
import { z as z34 } from "zod/v4";
|
|
2293
|
+
var strictNumber = z34.union([
|
|
2294
|
+
z34.number(),
|
|
2295
|
+
z34.string().transform((value) => toNumber(replace(toString(value), /[^0-9.]/g, "")) || 0),
|
|
2296
|
+
z34.unknown().transform(() => 0)
|
|
2107
2297
|
]);
|
|
2108
2298
|
|
|
2109
2299
|
// src/schema/widgets/post-purchase-offer/constants.ts
|
|
2110
|
-
import { z as
|
|
2300
|
+
import { z as z35 } from "zod/v4";
|
|
2111
2301
|
var blockTypes = [
|
|
2112
2302
|
"callout_banner",
|
|
2113
2303
|
"image",
|
|
@@ -2118,144 +2308,144 @@ var blockTypes = [
|
|
|
2118
2308
|
"text",
|
|
2119
2309
|
"timer"
|
|
2120
2310
|
];
|
|
2121
|
-
var blockType =
|
|
2311
|
+
var blockType = z35.enum(blockTypes);
|
|
2122
2312
|
var BlockType = blockType.enum;
|
|
2123
2313
|
|
|
2124
2314
|
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
2125
2315
|
import { get as get3, isEqual } from "es-toolkit/compat";
|
|
2126
2316
|
import { v4 as uuidv4 } from "uuid";
|
|
2127
|
-
import { z as
|
|
2128
|
-
var TextAlignment2 =
|
|
2129
|
-
var TextSize =
|
|
2130
|
-
|
|
2131
|
-
|
|
2317
|
+
import { z as z36 } from "zod/v4";
|
|
2318
|
+
var TextAlignment2 = z36.union([z36.enum(["leading", "center", "trailing"]), z36.unknown().transform(() => "leading")]);
|
|
2319
|
+
var TextSize = z36.union([
|
|
2320
|
+
z36.enum(["xsmall", "small", "base", "default", "medium", "large", "xlarge"]),
|
|
2321
|
+
z36.unknown().transform(() => "medium")
|
|
2132
2322
|
]);
|
|
2133
|
-
var CalloutBannerBlock =
|
|
2134
|
-
id:
|
|
2135
|
-
name:
|
|
2136
|
-
settings:
|
|
2137
|
-
superTitle:
|
|
2138
|
-
title:
|
|
2323
|
+
var CalloutBannerBlock = z36.object({
|
|
2324
|
+
id: z36.string().optional().default(() => uuidv4()),
|
|
2325
|
+
name: z36.string().optional(),
|
|
2326
|
+
settings: z36.object({
|
|
2327
|
+
superTitle: z36.union([z36.string(), TiptapDocument]).default(() => "Limited-time Offer"),
|
|
2328
|
+
title: z36.union([z36.string(), TiptapDocument]).default(() => "Add this customer favorite to your order")
|
|
2139
2329
|
}),
|
|
2140
|
-
styles:
|
|
2141
|
-
superTitleEmphasized:
|
|
2330
|
+
styles: z36.object({
|
|
2331
|
+
superTitleEmphasized: z36.boolean().default(false),
|
|
2142
2332
|
superTitleSize: TextSize.default("large"),
|
|
2143
2333
|
textAlignment: TextAlignment2.default("center"),
|
|
2144
|
-
titleEmphasized:
|
|
2334
|
+
titleEmphasized: z36.boolean().default(true),
|
|
2145
2335
|
titleSize: TextSize.default("large")
|
|
2146
2336
|
}),
|
|
2147
|
-
type:
|
|
2337
|
+
type: z36.literal(BlockType.callout_banner).default(BlockType.callout_banner)
|
|
2148
2338
|
});
|
|
2149
|
-
var ImageBlock =
|
|
2150
|
-
id:
|
|
2151
|
-
name:
|
|
2152
|
-
settings:
|
|
2153
|
-
|
|
2339
|
+
var ImageBlock = z36.object({
|
|
2340
|
+
id: z36.string().optional().default(() => uuidv4()),
|
|
2341
|
+
name: z36.string().optional(),
|
|
2342
|
+
settings: z36.union([
|
|
2343
|
+
z36.object({
|
|
2154
2344
|
/** This isn't used in the post-purchase offer widget */
|
|
2155
|
-
alt:
|
|
2156
|
-
image:
|
|
2157
|
-
imageSize:
|
|
2158
|
-
imageType:
|
|
2345
|
+
alt: z36.string().optional().default(""),
|
|
2346
|
+
image: z36.union([z36.literal(""), z36.url()]).default(""),
|
|
2347
|
+
imageSize: z36.number().default(20),
|
|
2348
|
+
imageType: z36.enum(["URL", "UPLOAD"]).default("URL")
|
|
2159
2349
|
}),
|
|
2160
|
-
|
|
2350
|
+
z36.array(z36.never()).transform(() => ({}))
|
|
2161
2351
|
]),
|
|
2162
|
-
type:
|
|
2163
|
-
});
|
|
2164
|
-
var ImageContentBlock =
|
|
2165
|
-
id:
|
|
2166
|
-
name:
|
|
2167
|
-
settings:
|
|
2168
|
-
alt:
|
|
2169
|
-
description:
|
|
2352
|
+
type: z36.literal(BlockType.image).default(BlockType.image)
|
|
2353
|
+
});
|
|
2354
|
+
var ImageContentBlock = z36.object({
|
|
2355
|
+
id: z36.string().optional().default(() => uuidv4()),
|
|
2356
|
+
name: z36.string().optional(),
|
|
2357
|
+
settings: z36.object({
|
|
2358
|
+
alt: z36.string().optional().default(""),
|
|
2359
|
+
description: z36.union([z36.string(), TiptapDocument, z36.null()]).default(
|
|
2170
2360
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
2171
2361
|
),
|
|
2172
2362
|
descriptionSize: TextSize.default("medium"),
|
|
2173
2363
|
horizontalAlignment: TextAlignment2.default("leading"),
|
|
2174
|
-
image:
|
|
2175
|
-
imagePlacement:
|
|
2176
|
-
imageSize:
|
|
2177
|
-
superTitle:
|
|
2364
|
+
image: z36.union([z36.literal(""), z36.url()]).default(""),
|
|
2365
|
+
imagePlacement: z36.enum(["bottom", "left", "right", "top"]).optional().default("left"),
|
|
2366
|
+
imageSize: z36.number().default(20),
|
|
2367
|
+
superTitle: z36.union([z36.string(), TiptapDocument]).default("Lorem Ipsum!"),
|
|
2178
2368
|
superTitleSize: TextSize.default("medium"),
|
|
2179
2369
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2180
|
-
swapContent:
|
|
2181
|
-
title:
|
|
2370
|
+
swapContent: z36.boolean().optional().default(false),
|
|
2371
|
+
title: z36.union([z36.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet"),
|
|
2182
2372
|
titleSize: TextSize.default("medium")
|
|
2183
2373
|
}),
|
|
2184
|
-
type:
|
|
2185
|
-
});
|
|
2186
|
-
var PayButtonBlock =
|
|
2187
|
-
id:
|
|
2188
|
-
name:
|
|
2189
|
-
settings:
|
|
2190
|
-
|
|
2191
|
-
label:
|
|
2374
|
+
type: z36.literal(BlockType.image_content).default(BlockType.image_content)
|
|
2375
|
+
});
|
|
2376
|
+
var PayButtonBlock = z36.object({
|
|
2377
|
+
id: z36.string().optional().default(() => uuidv4()),
|
|
2378
|
+
name: z36.string().optional(),
|
|
2379
|
+
settings: z36.union([
|
|
2380
|
+
z36.object({
|
|
2381
|
+
label: z36.string().default("Pay Now")
|
|
2192
2382
|
}),
|
|
2193
|
-
|
|
2383
|
+
z36.array(z36.never()).transform(() => ({
|
|
2194
2384
|
label: "Pay Now"
|
|
2195
2385
|
}))
|
|
2196
2386
|
]),
|
|
2197
|
-
styles:
|
|
2198
|
-
|
|
2199
|
-
buttonWidth:
|
|
2387
|
+
styles: z36.union([
|
|
2388
|
+
z36.object({
|
|
2389
|
+
buttonWidth: z36.number().min(10).max(100).default(50)
|
|
2200
2390
|
}),
|
|
2201
|
-
|
|
2391
|
+
z36.array(z36.never()).transform(() => ({
|
|
2202
2392
|
buttonWidth: 50
|
|
2203
2393
|
}))
|
|
2204
2394
|
]),
|
|
2205
|
-
type:
|
|
2395
|
+
type: z36.literal(BlockType.pay_button).default(BlockType.pay_button)
|
|
2206
2396
|
});
|
|
2207
|
-
var ProductInformationBlock =
|
|
2397
|
+
var ProductInformationBlock = z36.object({
|
|
2208
2398
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2209
|
-
hideProductImage:
|
|
2210
|
-
id:
|
|
2211
|
-
name:
|
|
2212
|
-
type:
|
|
2213
|
-
});
|
|
2214
|
-
var SeparatorBlock =
|
|
2215
|
-
id:
|
|
2216
|
-
name:
|
|
2217
|
-
type:
|
|
2218
|
-
});
|
|
2219
|
-
var TextBlock =
|
|
2220
|
-
id:
|
|
2221
|
-
name:
|
|
2222
|
-
settings:
|
|
2223
|
-
description:
|
|
2399
|
+
hideProductImage: z36.boolean().optional().default(false),
|
|
2400
|
+
id: z36.string().optional().default(() => uuidv4()),
|
|
2401
|
+
name: z36.string().optional(),
|
|
2402
|
+
type: z36.literal(BlockType.product_information).default(BlockType.product_information)
|
|
2403
|
+
});
|
|
2404
|
+
var SeparatorBlock = z36.object({
|
|
2405
|
+
id: z36.string().optional().default(() => uuidv4()),
|
|
2406
|
+
name: z36.string().optional(),
|
|
2407
|
+
type: z36.literal(BlockType.separator).default(BlockType.separator)
|
|
2408
|
+
});
|
|
2409
|
+
var TextBlock = z36.object({
|
|
2410
|
+
id: z36.string().optional().default(() => uuidv4()),
|
|
2411
|
+
name: z36.string().optional(),
|
|
2412
|
+
settings: z36.object({
|
|
2413
|
+
description: z36.union([z36.string(), TiptapDocument]).optional().default(
|
|
2224
2414
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
2225
2415
|
),
|
|
2226
2416
|
/** This isn't used in the post-purchase offer widget */
|
|
2227
2417
|
descriptionSize: TextSize.default("medium"),
|
|
2228
2418
|
horizontalAlignment: TextAlignment2.default("leading"),
|
|
2229
|
-
superTitle:
|
|
2419
|
+
superTitle: z36.union([z36.string(), TiptapDocument]).default("Super Title"),
|
|
2230
2420
|
/** This isn't used in the post-purchase offer widget */
|
|
2231
2421
|
superTitleSize: TextSize.default("medium"),
|
|
2232
|
-
title:
|
|
2422
|
+
title: z36.union([z36.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet."),
|
|
2233
2423
|
/** This isn't used in the post-purchase offer widget */
|
|
2234
2424
|
titleSize: TextSize.default("medium")
|
|
2235
2425
|
}),
|
|
2236
|
-
type:
|
|
2237
|
-
});
|
|
2238
|
-
var TimerBlock =
|
|
2239
|
-
id:
|
|
2240
|
-
name:
|
|
2241
|
-
settings:
|
|
2242
|
-
durationMinutes:
|
|
2243
|
-
durationSeconds:
|
|
2244
|
-
endOffer:
|
|
2245
|
-
title:
|
|
2426
|
+
type: z36.literal(BlockType.text).default(BlockType.text)
|
|
2427
|
+
});
|
|
2428
|
+
var TimerBlock = z36.object({
|
|
2429
|
+
id: z36.string().optional().default(() => uuidv4()),
|
|
2430
|
+
name: z36.string().optional(),
|
|
2431
|
+
settings: z36.object({
|
|
2432
|
+
durationMinutes: z36.number().min(0).default(10),
|
|
2433
|
+
durationSeconds: z36.union([z36.number().min(0), z36.unknown().transform(() => 0)]).default(0),
|
|
2434
|
+
endOffer: z36.boolean().default(true),
|
|
2435
|
+
title: z36.union([z36.string(), TiptapDocument]).default("Hurry \u2014 your special offer ends in:")
|
|
2246
2436
|
}),
|
|
2247
|
-
styles:
|
|
2437
|
+
styles: z36.object({
|
|
2248
2438
|
textAlignment: TextAlignment2.default("center"),
|
|
2249
|
-
timerBackgroundColor:
|
|
2250
|
-
timerEmphasized:
|
|
2439
|
+
timerBackgroundColor: z36.enum(["info", "warning", "success", "critical"]).default("warning"),
|
|
2440
|
+
timerEmphasized: z36.union([z36.boolean(), z36.unknown().transform(() => true)]).default(true),
|
|
2251
2441
|
timerSize: TextSize.default("medium"),
|
|
2252
|
-
timerWidth:
|
|
2253
|
-
titleEmphasized:
|
|
2442
|
+
timerWidth: z36.number().min(10).max(100).optional().default(100),
|
|
2443
|
+
titleEmphasized: z36.union([z36.boolean(), z36.unknown().transform(() => true)]).default(false),
|
|
2254
2444
|
titleSize: TextSize.default("medium")
|
|
2255
2445
|
}),
|
|
2256
|
-
type:
|
|
2446
|
+
type: z36.literal(BlockType.timer).default(BlockType.timer)
|
|
2257
2447
|
});
|
|
2258
|
-
var PostPurchaseBlock =
|
|
2448
|
+
var PostPurchaseBlock = z36.discriminatedUnion("type", [
|
|
2259
2449
|
CalloutBannerBlock,
|
|
2260
2450
|
ImageBlock,
|
|
2261
2451
|
ImageContentBlock,
|
|
@@ -2275,68 +2465,68 @@ var isTextBlock = (block) => isEqual(get3(block, "type"), BlockType.text);
|
|
|
2275
2465
|
var isTimerBlock = (block) => isEqual(get3(block, "type"), BlockType.timer);
|
|
2276
2466
|
|
|
2277
2467
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
2278
|
-
import { z as
|
|
2468
|
+
import { z as z39 } from "zod/v4";
|
|
2279
2469
|
|
|
2280
2470
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
2281
|
-
import { z as
|
|
2471
|
+
import { z as z38 } from "zod/v4";
|
|
2282
2472
|
|
|
2283
2473
|
// src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
|
|
2284
|
-
import { z as
|
|
2285
|
-
var PostPurchaseSettings =
|
|
2286
|
-
advance:
|
|
2287
|
-
blocks:
|
|
2474
|
+
import { z as z37 } from "zod/v4";
|
|
2475
|
+
var PostPurchaseSettings = z37.object({
|
|
2476
|
+
advance: z37.object({ removePartialOrder: z37.boolean().default(true) }).optional().default(() => ({ removePartialOrder: true })),
|
|
2477
|
+
blocks: z37.union([z37.array(PostPurchaseBlock), z37.unknown().transform(() => [])]).default(() => [
|
|
2288
2478
|
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.timer }),
|
|
2289
2479
|
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.callout_banner }),
|
|
2290
2480
|
PostPurchaseBlock.parse({ type: BlockType.product_information })
|
|
2291
2481
|
]),
|
|
2292
|
-
columnLayout:
|
|
2293
|
-
discount:
|
|
2482
|
+
columnLayout: z37.boolean().optional(),
|
|
2483
|
+
discount: z37.object({
|
|
2294
2484
|
amount: strictNumber.default(30),
|
|
2295
|
-
shouldShowSavingText:
|
|
2296
|
-
type:
|
|
2485
|
+
shouldShowSavingText: z37.boolean().optional().default(true),
|
|
2486
|
+
type: z37.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
2297
2487
|
}),
|
|
2298
|
-
discountedFrom:
|
|
2299
|
-
endpoint:
|
|
2300
|
-
integrations:
|
|
2301
|
-
judgeme:
|
|
2302
|
-
junip:
|
|
2303
|
-
klaviyo:
|
|
2304
|
-
loox:
|
|
2305
|
-
okendo:
|
|
2306
|
-
opinew:
|
|
2307
|
-
reviewsio:
|
|
2308
|
-
stamped:
|
|
2309
|
-
yotpo:
|
|
2488
|
+
discountedFrom: z37.enum(["price", "compare_at_price"]).optional().default("price"),
|
|
2489
|
+
endpoint: z37.string().optional(),
|
|
2490
|
+
integrations: z37.object({
|
|
2491
|
+
judgeme: z37.boolean().default(false),
|
|
2492
|
+
junip: z37.boolean().optional().default(false),
|
|
2493
|
+
klaviyo: z37.boolean().default(false),
|
|
2494
|
+
loox: z37.boolean().default(false),
|
|
2495
|
+
okendo: z37.boolean().default(false),
|
|
2496
|
+
opinew: z37.boolean().optional().default(false),
|
|
2497
|
+
reviewsio: z37.boolean().optional().default(false),
|
|
2498
|
+
stamped: z37.boolean().default(false),
|
|
2499
|
+
yotpo: z37.boolean().default(false)
|
|
2310
2500
|
}),
|
|
2311
|
-
key:
|
|
2312
|
-
language:
|
|
2313
|
-
description:
|
|
2314
|
-
descriptionEnabled:
|
|
2315
|
-
descriptionRte:
|
|
2316
|
-
content:
|
|
2317
|
-
type:
|
|
2501
|
+
key: z37.string().optional(),
|
|
2502
|
+
language: z37.object({
|
|
2503
|
+
description: z37.union([z37.string(), z37.unknown().transform(() => "")]).default(""),
|
|
2504
|
+
descriptionEnabled: z37.boolean().optional().default(false),
|
|
2505
|
+
descriptionRte: z37.object({
|
|
2506
|
+
content: z37.array(z37.unknown()),
|
|
2507
|
+
type: z37.string()
|
|
2318
2508
|
}).optional(),
|
|
2319
|
-
descriptionSpacing:
|
|
2320
|
-
displayCtaPrice:
|
|
2321
|
-
global:
|
|
2322
|
-
declineAll:
|
|
2323
|
-
declineThisOffer:
|
|
2324
|
-
free:
|
|
2325
|
-
notAvailable:
|
|
2326
|
-
payNow:
|
|
2327
|
-
payNowUpgradeToSubscription:
|
|
2328
|
-
quantity:
|
|
2509
|
+
descriptionSpacing: z37.enum(["none", "xtight", "tight", "default", "loose", "xloose"]).optional(),
|
|
2510
|
+
displayCtaPrice: z37.boolean().default(true),
|
|
2511
|
+
global: z37.object({
|
|
2512
|
+
declineAll: z37.string().optional().default("Decline All"),
|
|
2513
|
+
declineThisOffer: z37.string().default("Decline this offer"),
|
|
2514
|
+
free: z37.string().optional().default("Free"),
|
|
2515
|
+
notAvailable: z37.string().optional().default("Not available"),
|
|
2516
|
+
payNow: z37.string().default("Pay Now"),
|
|
2517
|
+
payNowUpgradeToSubscription: z37.string().optional().default("Upgrade to Subscription"),
|
|
2518
|
+
quantity: z37.string().default("Quantity"),
|
|
2329
2519
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2330
|
-
recurringShipping:
|
|
2331
|
-
recurringSubtotal:
|
|
2332
|
-
reviewsPlural:
|
|
2333
|
-
reviewsSingular:
|
|
2334
|
-
save:
|
|
2335
|
-
shipping:
|
|
2336
|
-
subscriptionOption:
|
|
2337
|
-
subtotal:
|
|
2338
|
-
taxes:
|
|
2339
|
-
total:
|
|
2520
|
+
recurringShipping: z37.string().optional().default("Recurring shipping"),
|
|
2521
|
+
recurringSubtotal: z37.string().default("Recurring subtotal"),
|
|
2522
|
+
reviewsPlural: z37.string().optional().default("Reviews"),
|
|
2523
|
+
reviewsSingular: z37.string().optional().default("Review"),
|
|
2524
|
+
save: z37.union([z37.string(), z37.unknown().transform(() => "Save")]).optional().default("Save"),
|
|
2525
|
+
shipping: z37.string().default("Shipping"),
|
|
2526
|
+
subscriptionOption: z37.string().optional().default("Subscribe and Save"),
|
|
2527
|
+
subtotal: z37.string().default("Subtotal"),
|
|
2528
|
+
taxes: z37.string().default("Taxes"),
|
|
2529
|
+
total: z37.string().default("Total")
|
|
2340
2530
|
}).optional().default(() => ({
|
|
2341
2531
|
declineAll: "Decline All",
|
|
2342
2532
|
declineThisOffer: "Decline this offer",
|
|
@@ -2357,70 +2547,70 @@ var PostPurchaseSettings = z36.object({
|
|
|
2357
2547
|
taxes: "Taxes",
|
|
2358
2548
|
total: "Total"
|
|
2359
2549
|
})),
|
|
2360
|
-
globalTranslation:
|
|
2550
|
+
globalTranslation: z37.string().optional().default("english")
|
|
2361
2551
|
}),
|
|
2362
|
-
metafields:
|
|
2552
|
+
metafields: z37.boolean().default(false),
|
|
2363
2553
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2364
|
-
offer:
|
|
2365
|
-
count:
|
|
2554
|
+
offer: z37.object({
|
|
2555
|
+
count: z37.number().default(1)
|
|
2366
2556
|
}),
|
|
2367
|
-
offersLayout:
|
|
2368
|
-
itemsPerPage:
|
|
2369
|
-
type:
|
|
2557
|
+
offersLayout: z37.object({
|
|
2558
|
+
itemsPerPage: z37.number().optional(),
|
|
2559
|
+
type: z37.enum(["list", "grid", "carousel"]).default("list")
|
|
2370
2560
|
}).optional().default({
|
|
2371
2561
|
type: "list"
|
|
2372
2562
|
}),
|
|
2373
2563
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2374
|
-
previewMode:
|
|
2375
|
-
productLimit:
|
|
2376
|
-
productOptions:
|
|
2564
|
+
previewMode: z37.boolean().default(false),
|
|
2565
|
+
productLimit: z37.number().optional().default(1),
|
|
2566
|
+
productOptions: z37.object({
|
|
2377
2567
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2378
|
-
hideOutOfStockVariants:
|
|
2379
|
-
matchVariant:
|
|
2380
|
-
showDeclineAll:
|
|
2381
|
-
showShipping:
|
|
2382
|
-
showSubtotal:
|
|
2383
|
-
showTaxes:
|
|
2384
|
-
showTotal:
|
|
2385
|
-
showVariantSelectors:
|
|
2386
|
-
variantSelectorDisplayMode:
|
|
2568
|
+
hideOutOfStockVariants: z37.boolean().optional().default(false),
|
|
2569
|
+
matchVariant: z37.boolean().optional().default(true),
|
|
2570
|
+
showDeclineAll: z37.enum(["above", "below", "both", "none"]).optional(),
|
|
2571
|
+
showShipping: z37.boolean().optional().default(true),
|
|
2572
|
+
showSubtotal: z37.boolean().optional().default(true),
|
|
2573
|
+
showTaxes: z37.boolean().optional().default(true),
|
|
2574
|
+
showTotal: z37.boolean().optional().default(true),
|
|
2575
|
+
showVariantSelectors: z37.boolean().optional().default(true),
|
|
2576
|
+
variantSelectorDisplayMode: z37.enum(["separate", "single"]).optional().default("separate")
|
|
2387
2577
|
}),
|
|
2388
|
-
productType:
|
|
2389
|
-
productTypeSelector:
|
|
2390
|
-
quantityInputs:
|
|
2391
|
-
defaultQuantity:
|
|
2392
|
-
enabled:
|
|
2393
|
-
maxValue:
|
|
2394
|
-
minValue:
|
|
2578
|
+
productType: z37.union([z37.enum(["one-time", "subscription", "both"]), z37.literal("").transform(() => "one-time")]).default("one-time"),
|
|
2579
|
+
productTypeSelector: z37.enum(["dropdown", "radio"]).optional().default("radio"),
|
|
2580
|
+
quantityInputs: z37.object({
|
|
2581
|
+
defaultQuantity: z37.union([z37.number(), z37.null().transform(() => 1)]).default(1),
|
|
2582
|
+
enabled: z37.boolean().default(true),
|
|
2583
|
+
maxValue: z37.union([z37.number(), z37.null().transform(() => 15)]).default(15),
|
|
2584
|
+
minValue: z37.union([z37.number().min(0), z37.unknown().transform(() => 0)]).default(1)
|
|
2395
2585
|
}),
|
|
2396
|
-
shipping:
|
|
2586
|
+
shipping: z37.object({
|
|
2397
2587
|
amount: strictNumber.default(10),
|
|
2398
2588
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2399
|
-
enabled:
|
|
2400
|
-
title:
|
|
2401
|
-
type:
|
|
2589
|
+
enabled: z37.boolean().default(true),
|
|
2590
|
+
title: z37.string().optional().default("Shipping Fees"),
|
|
2591
|
+
type: z37.enum(["free", "fixed_amount"]).default("free")
|
|
2402
2592
|
}),
|
|
2403
|
-
styles:
|
|
2404
|
-
starColor:
|
|
2405
|
-
starSize:
|
|
2406
|
-
starStrokeColor:
|
|
2407
|
-
strokeWidth:
|
|
2593
|
+
styles: z37.object({
|
|
2594
|
+
starColor: z37.string().optional().default("#fadb14"),
|
|
2595
|
+
starSize: z37.union([z37.enum(["small", "medium", "large"]), z37.unknown().transform(() => "large")]).optional().default("large"),
|
|
2596
|
+
starStrokeColor: z37.string().optional().default("#fadb14"),
|
|
2597
|
+
strokeWidth: z37.string().optional().default("1")
|
|
2408
2598
|
}).optional(),
|
|
2409
|
-
subImages:
|
|
2410
|
-
subscription:
|
|
2411
|
-
discount:
|
|
2599
|
+
subImages: z37.number().nullish().default(8),
|
|
2600
|
+
subscription: z37.object({
|
|
2601
|
+
discount: z37.object({
|
|
2412
2602
|
amount: strictNumber.default(30),
|
|
2413
|
-
shouldShowSavingText:
|
|
2414
|
-
type:
|
|
2603
|
+
shouldShowSavingText: z37.boolean().optional().default(true),
|
|
2604
|
+
type: z37.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
2415
2605
|
}),
|
|
2416
|
-
shipping:
|
|
2606
|
+
shipping: z37.object({
|
|
2417
2607
|
amount: strictNumber.default(1),
|
|
2418
2608
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2419
|
-
enabled:
|
|
2609
|
+
enabled: z37.boolean().default(true),
|
|
2420
2610
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2421
2611
|
recurringAmount: strictNumber.default(2),
|
|
2422
|
-
shippingTitle:
|
|
2423
|
-
type:
|
|
2612
|
+
shippingTitle: z37.string().default("Shipping Fees"),
|
|
2613
|
+
type: z37.enum(["free", "fixed_amount"]).default("free")
|
|
2424
2614
|
})
|
|
2425
2615
|
}).optional().default({
|
|
2426
2616
|
discount: {
|
|
@@ -2438,15 +2628,15 @@ var PostPurchaseSettings = z36.object({
|
|
|
2438
2628
|
type: "free"
|
|
2439
2629
|
}
|
|
2440
2630
|
}),
|
|
2441
|
-
subscriptionIsDefault:
|
|
2631
|
+
subscriptionIsDefault: z37.boolean().optional(),
|
|
2442
2632
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2443
|
-
template:
|
|
2444
|
-
type:
|
|
2445
|
-
upgradeToSubscription:
|
|
2446
|
-
acceptButtonText:
|
|
2447
|
-
allow:
|
|
2448
|
-
emailRefundNotice:
|
|
2449
|
-
errorBannerText:
|
|
2633
|
+
template: z37.string().optional().default(""),
|
|
2634
|
+
type: z37.literal("shopify_post_purchase_extension").default("shopify_post_purchase_extension"),
|
|
2635
|
+
upgradeToSubscription: z37.object({
|
|
2636
|
+
acceptButtonText: z37.string().optional().default("Upgrade"),
|
|
2637
|
+
allow: z37.boolean().optional().default(false),
|
|
2638
|
+
emailRefundNotice: z37.boolean().optional().default(false),
|
|
2639
|
+
errorBannerText: z37.string().optional().default("This subscription cannot be added - limit one per order")
|
|
2450
2640
|
}).optional().default(() => ({
|
|
2451
2641
|
acceptButtonText: "Upgrade",
|
|
2452
2642
|
allow: false,
|
|
@@ -2456,35 +2646,825 @@ var PostPurchaseSettings = z36.object({
|
|
|
2456
2646
|
});
|
|
2457
2647
|
|
|
2458
2648
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
2459
|
-
var PostPurchaseWidgetLinkedFlow =
|
|
2460
|
-
id:
|
|
2461
|
-
name:
|
|
2462
|
-
});
|
|
2463
|
-
var PostPurchaseWidget =
|
|
2464
|
-
classification:
|
|
2465
|
-
createdAtTime:
|
|
2466
|
-
customEndpointName:
|
|
2467
|
-
id:
|
|
2468
|
-
lastViewed:
|
|
2469
|
-
linkedCustomEndpointId:
|
|
2470
|
-
linkedFlows:
|
|
2471
|
-
name:
|
|
2472
|
-
owner:
|
|
2649
|
+
var PostPurchaseWidgetLinkedFlow = z38.object({
|
|
2650
|
+
id: z38.number(),
|
|
2651
|
+
name: z38.string()
|
|
2652
|
+
});
|
|
2653
|
+
var PostPurchaseWidget = z38.object({
|
|
2654
|
+
classification: z38.literal("post_purchase_offer_page").default("post_purchase_offer_page"),
|
|
2655
|
+
createdAtTime: z38.iso.datetime({ offset: true }).optional(),
|
|
2656
|
+
customEndpointName: z38.string().nullish(),
|
|
2657
|
+
id: z38.number().default(0),
|
|
2658
|
+
lastViewed: z38.iso.datetime({ offset: true }).nullish(),
|
|
2659
|
+
linkedCustomEndpointId: z38.number().nullish(),
|
|
2660
|
+
linkedFlows: z38.array(PostPurchaseWidgetLinkedFlow).optional(),
|
|
2661
|
+
name: z38.string().default(""),
|
|
2662
|
+
owner: z38.number().nullish(),
|
|
2473
2663
|
settings: PostPurchaseSettings
|
|
2474
2664
|
});
|
|
2475
2665
|
|
|
2476
2666
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
2477
|
-
var PostPurchaseOffer =
|
|
2478
|
-
|
|
2479
|
-
errors:
|
|
2480
|
-
message:
|
|
2481
|
-
successful:
|
|
2667
|
+
var PostPurchaseOffer = z39.discriminatedUnion("successful", [
|
|
2668
|
+
z39.strictObject({
|
|
2669
|
+
errors: z39.array(z39.object({ message: z39.string() })),
|
|
2670
|
+
message: z39.string(),
|
|
2671
|
+
successful: z39.literal(false)
|
|
2482
2672
|
}),
|
|
2483
|
-
|
|
2484
|
-
successful:
|
|
2673
|
+
z39.strictObject({
|
|
2674
|
+
successful: z39.literal(true),
|
|
2485
2675
|
widget: PostPurchaseWidget
|
|
2486
2676
|
})
|
|
2487
2677
|
]);
|
|
2678
|
+
|
|
2679
|
+
// src/transforms/contentBlockV1/stripContentBlockHtml.ts
|
|
2680
|
+
var HTML_COMMENT_RE = /<!--[\s\S]*?-->/g;
|
|
2681
|
+
var STRIPPED_ELEMENT_RE = /<(script|style|iframe|object|embed|noscript|template)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/gi;
|
|
2682
|
+
var HTML_TAG_RE = /<\/?[a-zA-Z][^>]*>/g;
|
|
2683
|
+
var stripContentBlockHtml = (text) => text.replace(HTML_COMMENT_RE, "").replace(STRIPPED_ELEMENT_RE, "").replace(HTML_TAG_RE, "");
|
|
2684
|
+
|
|
2685
|
+
// src/transforms/contentBlockV1/convertTextToTiptapParagraph.ts
|
|
2686
|
+
var convertTextToTiptapParagraph = ({
|
|
2687
|
+
color,
|
|
2688
|
+
fontSize,
|
|
2689
|
+
marks = [],
|
|
2690
|
+
text,
|
|
2691
|
+
textAlign
|
|
2692
|
+
}) => {
|
|
2693
|
+
const sanitizedText = stripContentBlockHtml(text);
|
|
2694
|
+
return TiptapParagraph.parse({
|
|
2695
|
+
attrs: { textAlign },
|
|
2696
|
+
content: sanitizedText ? [
|
|
2697
|
+
{
|
|
2698
|
+
marks: [{ attrs: { color, fontSize }, type: "textStyle" }, ...marks],
|
|
2699
|
+
text: sanitizedText,
|
|
2700
|
+
type: "text"
|
|
2701
|
+
}
|
|
2702
|
+
] : [],
|
|
2703
|
+
type: "paragraph"
|
|
2704
|
+
});
|
|
2705
|
+
};
|
|
2706
|
+
|
|
2707
|
+
// src/transforms/contentBlockV1/convertContentBlockTextToV2.ts
|
|
2708
|
+
var convertContentBlockTextToV2 = (language) => {
|
|
2709
|
+
const description = language?.description;
|
|
2710
|
+
const superTitle = language?.superTitle;
|
|
2711
|
+
const title = language?.title;
|
|
2712
|
+
return TiptapDocument.parse({
|
|
2713
|
+
attrs: { blockSpacing: "tight" },
|
|
2714
|
+
content: [
|
|
2715
|
+
superTitle ? convertTextToTiptapParagraph({
|
|
2716
|
+
color: "base",
|
|
2717
|
+
fontSize: "extraLarge",
|
|
2718
|
+
marks: [{ type: "bold" }],
|
|
2719
|
+
text: superTitle,
|
|
2720
|
+
textAlign: "center"
|
|
2721
|
+
}) : null,
|
|
2722
|
+
title ? convertTextToTiptapParagraph({
|
|
2723
|
+
color: "base",
|
|
2724
|
+
fontSize: "medium",
|
|
2725
|
+
marks: [{ type: "bold" }],
|
|
2726
|
+
text: title,
|
|
2727
|
+
textAlign: "center"
|
|
2728
|
+
}) : null,
|
|
2729
|
+
description ? convertTextToTiptapParagraph({
|
|
2730
|
+
color: "base",
|
|
2731
|
+
fontSize: "base",
|
|
2732
|
+
text: description,
|
|
2733
|
+
textAlign: "center"
|
|
2734
|
+
}) : null
|
|
2735
|
+
].filter((p) => p !== null),
|
|
2736
|
+
type: "doc"
|
|
2737
|
+
});
|
|
2738
|
+
};
|
|
2739
|
+
|
|
2740
|
+
// src/transforms/offerV1/offerTemplateSeed.ts
|
|
2741
|
+
var OFFER_TEMPLATE_SEED = {
|
|
2742
|
+
alignment: {
|
|
2743
|
+
horizontal: "center",
|
|
2744
|
+
vertical: "top"
|
|
2745
|
+
},
|
|
2746
|
+
border: {
|
|
2747
|
+
radius: "base",
|
|
2748
|
+
style: "none",
|
|
2749
|
+
width: "thick"
|
|
2750
|
+
},
|
|
2751
|
+
direction: "rows",
|
|
2752
|
+
editorMode: "checkoutExtension",
|
|
2753
|
+
grid: {
|
|
2754
|
+
columns: ["auto"],
|
|
2755
|
+
rows: ["auto"]
|
|
2756
|
+
},
|
|
2757
|
+
padding: "tight",
|
|
2758
|
+
previewMode: false,
|
|
2759
|
+
sections: [
|
|
2760
|
+
{
|
|
2761
|
+
alignment: {
|
|
2762
|
+
horizontal: "end",
|
|
2763
|
+
vertical: "top"
|
|
2764
|
+
},
|
|
2765
|
+
autoAdvanceInterval: 0,
|
|
2766
|
+
border: {
|
|
2767
|
+
radius: "base",
|
|
2768
|
+
style: "none",
|
|
2769
|
+
width: "base"
|
|
2770
|
+
},
|
|
2771
|
+
direction: "rows",
|
|
2772
|
+
grid: {
|
|
2773
|
+
columns: ["auto"],
|
|
2774
|
+
rows: ["auto", "auto"]
|
|
2775
|
+
},
|
|
2776
|
+
itemsAtOnce: 2,
|
|
2777
|
+
padding: "none",
|
|
2778
|
+
sections: [
|
|
2779
|
+
{
|
|
2780
|
+
alignment: {
|
|
2781
|
+
horizontal: "start",
|
|
2782
|
+
vertical: "middle"
|
|
2783
|
+
},
|
|
2784
|
+
border: {
|
|
2785
|
+
radius: "base",
|
|
2786
|
+
style: "none",
|
|
2787
|
+
width: "base"
|
|
2788
|
+
},
|
|
2789
|
+
direction: "columns",
|
|
2790
|
+
grid: {
|
|
2791
|
+
columns: ["auto", "auto"],
|
|
2792
|
+
rows: ["auto"]
|
|
2793
|
+
},
|
|
2794
|
+
name: "pagination",
|
|
2795
|
+
padding: "none",
|
|
2796
|
+
sections: [
|
|
2797
|
+
{
|
|
2798
|
+
action: "goToPrevPage",
|
|
2799
|
+
buttonStyle: "plain",
|
|
2800
|
+
disableDowngrade: false,
|
|
2801
|
+
popover: {
|
|
2802
|
+
alignment: "center",
|
|
2803
|
+
position: "blockStart"
|
|
2804
|
+
},
|
|
2805
|
+
sections: [
|
|
2806
|
+
{
|
|
2807
|
+
buttonField: "buttonLabel",
|
|
2808
|
+
content: {
|
|
2809
|
+
ar: "\u2039",
|
|
2810
|
+
cs: "\u2039",
|
|
2811
|
+
da: "\u2039",
|
|
2812
|
+
de: "\u2039",
|
|
2813
|
+
en: "\u2039",
|
|
2814
|
+
es: "\u2039",
|
|
2815
|
+
fi: "\u2039",
|
|
2816
|
+
fr: "\u2039",
|
|
2817
|
+
ga: "\u2039",
|
|
2818
|
+
he: "\u2039",
|
|
2819
|
+
hi: "\u2039",
|
|
2820
|
+
id: "\u2039",
|
|
2821
|
+
it: "\u2039",
|
|
2822
|
+
ja: "\u2039",
|
|
2823
|
+
ko: "\u2039",
|
|
2824
|
+
nl: "\u2039",
|
|
2825
|
+
no: "\u2039",
|
|
2826
|
+
pl: "\u2039",
|
|
2827
|
+
pt: "\u2039",
|
|
2828
|
+
ru: "\u2039",
|
|
2829
|
+
sv: "\u2039",
|
|
2830
|
+
th: "\u2039",
|
|
2831
|
+
tr: "\u2039",
|
|
2832
|
+
uk: "\u2039",
|
|
2833
|
+
vi: "\u2039",
|
|
2834
|
+
zh: "\u2039"
|
|
2835
|
+
},
|
|
2836
|
+
sectionType: "text"
|
|
2837
|
+
}
|
|
2838
|
+
],
|
|
2839
|
+
sectionType: "button"
|
|
2840
|
+
},
|
|
2841
|
+
{
|
|
2842
|
+
action: "goToNextPage",
|
|
2843
|
+
buttonStyle: "plain",
|
|
2844
|
+
disableDowngrade: false,
|
|
2845
|
+
popover: {
|
|
2846
|
+
alignment: "center",
|
|
2847
|
+
position: "blockStart"
|
|
2848
|
+
},
|
|
2849
|
+
sections: [
|
|
2850
|
+
{
|
|
2851
|
+
buttonField: "buttonLabel",
|
|
2852
|
+
content: {
|
|
2853
|
+
ar: "\u203A",
|
|
2854
|
+
cs: "\u203A",
|
|
2855
|
+
da: "\u203A",
|
|
2856
|
+
de: "\u203A",
|
|
2857
|
+
en: "\u203A",
|
|
2858
|
+
es: "\u203A",
|
|
2859
|
+
fi: "\u203A",
|
|
2860
|
+
fr: "\u203A",
|
|
2861
|
+
ga: "\u203A",
|
|
2862
|
+
he: "\u203A",
|
|
2863
|
+
hi: "\u203A",
|
|
2864
|
+
id: "\u203A",
|
|
2865
|
+
it: "\u203A",
|
|
2866
|
+
ja: "\u203A",
|
|
2867
|
+
ko: "\u203A",
|
|
2868
|
+
nl: "\u203A",
|
|
2869
|
+
no: "\u203A",
|
|
2870
|
+
pl: "\u203A",
|
|
2871
|
+
pt: "\u203A",
|
|
2872
|
+
ru: "\u203A",
|
|
2873
|
+
sv: "\u203A",
|
|
2874
|
+
th: "\u203A",
|
|
2875
|
+
tr: "\u203A",
|
|
2876
|
+
uk: "\u203A",
|
|
2877
|
+
vi: "\u203A",
|
|
2878
|
+
zh: "\u203A"
|
|
2879
|
+
},
|
|
2880
|
+
sectionType: "text"
|
|
2881
|
+
}
|
|
2882
|
+
],
|
|
2883
|
+
sectionType: "button"
|
|
2884
|
+
}
|
|
2885
|
+
],
|
|
2886
|
+
sectionType: "layout",
|
|
2887
|
+
spacing: "base",
|
|
2888
|
+
width: 100
|
|
2889
|
+
},
|
|
2890
|
+
{
|
|
2891
|
+
alignment: {
|
|
2892
|
+
horizontal: "start",
|
|
2893
|
+
vertical: "middle"
|
|
2894
|
+
},
|
|
2895
|
+
border: {
|
|
2896
|
+
radius: "base",
|
|
2897
|
+
style: "base",
|
|
2898
|
+
width: "base"
|
|
2899
|
+
},
|
|
2900
|
+
direction: "rows",
|
|
2901
|
+
grid: {
|
|
2902
|
+
columns: ["15%"],
|
|
2903
|
+
rows: ["auto", "auto"]
|
|
2904
|
+
},
|
|
2905
|
+
padding: "base",
|
|
2906
|
+
sections: [
|
|
2907
|
+
{
|
|
2908
|
+
alignment: {
|
|
2909
|
+
horizontal: "start",
|
|
2910
|
+
vertical: "middle"
|
|
2911
|
+
},
|
|
2912
|
+
border: {
|
|
2913
|
+
radius: "base",
|
|
2914
|
+
style: "none",
|
|
2915
|
+
width: "base"
|
|
2916
|
+
},
|
|
2917
|
+
direction: "grid",
|
|
2918
|
+
grid: {
|
|
2919
|
+
columns: ["15%", "fill", "auto"],
|
|
2920
|
+
rows: ["auto"]
|
|
2921
|
+
},
|
|
2922
|
+
padding: "none",
|
|
2923
|
+
sections: [
|
|
2924
|
+
{
|
|
2925
|
+
altText: "",
|
|
2926
|
+
aspectRatio: null,
|
|
2927
|
+
border: {
|
|
2928
|
+
radius: "base",
|
|
2929
|
+
style: "none",
|
|
2930
|
+
width: "base"
|
|
2931
|
+
},
|
|
2932
|
+
category: null,
|
|
2933
|
+
name: "Product Image",
|
|
2934
|
+
naturalHeight: 0,
|
|
2935
|
+
naturalWidth: 0,
|
|
2936
|
+
objectFit: "cover",
|
|
2937
|
+
sectionType: "image",
|
|
2938
|
+
source: "{{productImage}}",
|
|
2939
|
+
width: 100
|
|
2940
|
+
},
|
|
2941
|
+
{
|
|
2942
|
+
content: {
|
|
2943
|
+
en: {
|
|
2944
|
+
attrs: {
|
|
2945
|
+
blockSpacing: "none"
|
|
2946
|
+
},
|
|
2947
|
+
content: [
|
|
2948
|
+
{
|
|
2949
|
+
attrs: {
|
|
2950
|
+
textAlign: "start"
|
|
2951
|
+
},
|
|
2952
|
+
content: [
|
|
2953
|
+
{
|
|
2954
|
+
marks: [
|
|
2955
|
+
{
|
|
2956
|
+
attrs: {
|
|
2957
|
+
color: "base",
|
|
2958
|
+
fontSize: "medium"
|
|
2959
|
+
},
|
|
2960
|
+
type: "textStyle"
|
|
2961
|
+
},
|
|
2962
|
+
{
|
|
2963
|
+
type: "bold"
|
|
2964
|
+
}
|
|
2965
|
+
],
|
|
2966
|
+
text: "{{productAndVariantTitle}}",
|
|
2967
|
+
type: "text"
|
|
2968
|
+
}
|
|
2969
|
+
],
|
|
2970
|
+
type: "paragraph"
|
|
2971
|
+
},
|
|
2972
|
+
{
|
|
2973
|
+
attrs: {
|
|
2974
|
+
textAlign: "start"
|
|
2975
|
+
},
|
|
2976
|
+
content: [
|
|
2977
|
+
{
|
|
2978
|
+
marks: [
|
|
2979
|
+
{
|
|
2980
|
+
attrs: {
|
|
2981
|
+
color: "accent",
|
|
2982
|
+
fontSize: "medium"
|
|
2983
|
+
},
|
|
2984
|
+
type: "textStyle"
|
|
2985
|
+
}
|
|
2986
|
+
],
|
|
2987
|
+
text: "{{variantPrice}}",
|
|
2988
|
+
type: "text"
|
|
2989
|
+
}
|
|
2990
|
+
],
|
|
2991
|
+
type: "paragraph"
|
|
2992
|
+
}
|
|
2993
|
+
],
|
|
2994
|
+
type: "doc"
|
|
2995
|
+
}
|
|
2996
|
+
},
|
|
2997
|
+
name: "Product Info",
|
|
2998
|
+
sectionType: "text"
|
|
2999
|
+
},
|
|
3000
|
+
{
|
|
3001
|
+
action: "addToOrder",
|
|
3002
|
+
buttonStyle: "primary",
|
|
3003
|
+
disableDowngrade: false,
|
|
3004
|
+
popover: {
|
|
3005
|
+
alignment: "center",
|
|
3006
|
+
position: "blockStart"
|
|
3007
|
+
},
|
|
3008
|
+
sections: [
|
|
3009
|
+
{
|
|
3010
|
+
buttonField: "addingToCart",
|
|
3011
|
+
content: {
|
|
3012
|
+
ar: "\u064A\u062A\u0645 \u0627\u0644\u0625\u0636\u0627\u0641\u0629 \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629",
|
|
3013
|
+
cs: "P\u0159id\xE1v\xE1m do ko\u0161\xEDku",
|
|
3014
|
+
da: "Tilf\xF8jer til kurv",
|
|
3015
|
+
de: "Wird zum Warenkorb hinzugef\xFCgt",
|
|
3016
|
+
en: "Adding...",
|
|
3017
|
+
es: "Agregando al carrito",
|
|
3018
|
+
fi: "Lis\xE4t\xE4\xE4n ostoskoriin",
|
|
3019
|
+
fr: "Ajout au panier",
|
|
3020
|
+
ga: "\xC1 Chur le Cairt",
|
|
3021
|
+
he: "\u05DE\u05D5\u05E1\u05D9\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4",
|
|
3022
|
+
hi: "\u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C \u0930\u0939\u0947 \u0939\u0948\u0902",
|
|
3023
|
+
id: "Menambahkan ke Keranjang",
|
|
3024
|
+
it: "Aggiungendo al carrello",
|
|
3025
|
+
ja: "\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0\u4E2D",
|
|
3026
|
+
ko: "\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00 \uC911",
|
|
3027
|
+
nl: "Toevoegen aan winkelwagen",
|
|
3028
|
+
no: "Legger i handlekurv",
|
|
3029
|
+
pl: "Dodaj\u0119 do koszyka",
|
|
3030
|
+
pt: "Adicionando ao carrinho",
|
|
3031
|
+
ru: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443",
|
|
3032
|
+
sv: "L\xE4gger till i varukorg",
|
|
3033
|
+
th: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E25\u0E07\u0E43\u0E19\u0E23\u0E16\u0E40\u0E02\u0E47\u0E19",
|
|
3034
|
+
tr: "Sepete Ekleniyor",
|
|
3035
|
+
uk: "\u0414\u043E\u0434\u0430\u0454\u043C\u043E \u0434\u043E \u043A\u043E\u0448\u0438\u043A\u0430",
|
|
3036
|
+
vi: "\u0110ang th\xEAm v\xE0o gi\u1ECF h\xE0ng",
|
|
3037
|
+
zh: "\u6B63\u5728\u52A0\u5165\u8D2D\u7269\u8F66"
|
|
3038
|
+
},
|
|
3039
|
+
sectionType: "text"
|
|
3040
|
+
},
|
|
3041
|
+
{
|
|
3042
|
+
buttonField: "addToCart",
|
|
3043
|
+
content: {
|
|
3044
|
+
ar: "\u0623\u0636\u0641 \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629",
|
|
3045
|
+
cs: "P\u0159idat do ko\u0161\xEDku",
|
|
3046
|
+
da: "F\xF8j til kurv",
|
|
3047
|
+
de: "In den Warenkorb",
|
|
3048
|
+
en: "Add",
|
|
3049
|
+
es: "Agregar al carrito",
|
|
3050
|
+
fi: "Lis\xE4\xE4 ostoskoriin",
|
|
3051
|
+
fr: "Ajouter au panier",
|
|
3052
|
+
ga: "Cuir le Cairt",
|
|
3053
|
+
he: "\u05D4\u05D5\u05E1\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4",
|
|
3054
|
+
hi: "\u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u0947\u0902",
|
|
3055
|
+
id: "Tambah ke Keranjang",
|
|
3056
|
+
it: "Aggiungi al carrello",
|
|
3057
|
+
ja: "\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0",
|
|
3058
|
+
ko: "\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00",
|
|
3059
|
+
nl: "Toevoegen aan winkelwagen",
|
|
3060
|
+
no: "Legg i handlekurv",
|
|
3061
|
+
pl: "Dodaj do koszyka",
|
|
3062
|
+
pt: "Adicionar ao carrinho",
|
|
3063
|
+
ru: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443",
|
|
3064
|
+
sv: "L\xE4gg i varukorg",
|
|
3065
|
+
th: "\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E25\u0E07\u0E43\u0E19\u0E23\u0E16\u0E40\u0E02\u0E47\u0E19",
|
|
3066
|
+
tr: "Sepete Ekle",
|
|
3067
|
+
uk: "\u0414\u043E\u0434\u0430\u0442\u0438 \u0434\u043E \u043A\u043E\u0448\u0438\u043A\u0430",
|
|
3068
|
+
vi: "Th\xEAm v\xE0o gi\u1ECF h\xE0ng",
|
|
3069
|
+
zh: "\u52A0\u5165\u8D2D\u7269\u8F66"
|
|
3070
|
+
},
|
|
3071
|
+
sectionType: "text"
|
|
3072
|
+
}
|
|
3073
|
+
],
|
|
3074
|
+
sectionType: "button"
|
|
3075
|
+
}
|
|
3076
|
+
],
|
|
3077
|
+
sectionType: "layout",
|
|
3078
|
+
spacing: "base",
|
|
3079
|
+
width: 100
|
|
3080
|
+
},
|
|
3081
|
+
{
|
|
3082
|
+
alignment: {
|
|
3083
|
+
horizontal: "start",
|
|
3084
|
+
vertical: "top"
|
|
3085
|
+
},
|
|
3086
|
+
border: {
|
|
3087
|
+
radius: "base",
|
|
3088
|
+
style: "none",
|
|
3089
|
+
width: "base"
|
|
3090
|
+
},
|
|
3091
|
+
direction: "rows",
|
|
3092
|
+
grid: {
|
|
3093
|
+
columns: ["auto"],
|
|
3094
|
+
rows: ["auto"]
|
|
3095
|
+
},
|
|
3096
|
+
padding: "none",
|
|
3097
|
+
sections: [
|
|
3098
|
+
{
|
|
3099
|
+
errorMessages: {
|
|
3100
|
+
en: {
|
|
3101
|
+
max: "Maximum quantity allowed is {{max}}",
|
|
3102
|
+
min: "Minimum quantity required is {{min}}",
|
|
3103
|
+
neg: "Quantity cannot be negative"
|
|
3104
|
+
}
|
|
3105
|
+
},
|
|
3106
|
+
inputType: "select",
|
|
3107
|
+
max: 10,
|
|
3108
|
+
min: 1,
|
|
3109
|
+
sectionType: "quantity"
|
|
3110
|
+
}
|
|
3111
|
+
],
|
|
3112
|
+
sectionType: "layout",
|
|
3113
|
+
spacing: "base",
|
|
3114
|
+
width: 100
|
|
3115
|
+
},
|
|
3116
|
+
{
|
|
3117
|
+
limit: 3,
|
|
3118
|
+
sectionType: "dataSource"
|
|
3119
|
+
},
|
|
3120
|
+
{
|
|
3121
|
+
sectionType: "products"
|
|
3122
|
+
}
|
|
3123
|
+
],
|
|
3124
|
+
sectionType: "offers",
|
|
3125
|
+
spacing: "base",
|
|
3126
|
+
width: 100
|
|
3127
|
+
}
|
|
3128
|
+
],
|
|
3129
|
+
sectionType: "carousel",
|
|
3130
|
+
spacing: "base",
|
|
3131
|
+
width: 100
|
|
3132
|
+
}
|
|
3133
|
+
],
|
|
3134
|
+
sectionType: "layout",
|
|
3135
|
+
spacing: "base",
|
|
3136
|
+
targetArea: {
|
|
3137
|
+
icon: "splitscreen_left",
|
|
3138
|
+
label: "Main Column",
|
|
3139
|
+
width: "503px"
|
|
3140
|
+
},
|
|
3141
|
+
type: "shopify_checkout_extension",
|
|
3142
|
+
version: 2,
|
|
3143
|
+
width: 100
|
|
3144
|
+
};
|
|
3145
|
+
|
|
3146
|
+
// src/transforms/offerV1/types.ts
|
|
3147
|
+
var SHOPIFY_CHECKOUT_EXTENSION = "shopify_checkout_extension";
|
|
3148
|
+
var isOfferV1 = (data) => {
|
|
3149
|
+
if (!data || typeof data !== "object") return false;
|
|
3150
|
+
return data.type === SHOPIFY_CHECKOUT_EXTENSION;
|
|
3151
|
+
};
|
|
3152
|
+
|
|
3153
|
+
// src/transforms/offerV1/buildOfferTemplate.ts
|
|
3154
|
+
var LOCATION_TO_EDITOR_MODE = {
|
|
3155
|
+
checkout: "checkoutExtension",
|
|
3156
|
+
"order-status": "orderStatusPage",
|
|
3157
|
+
"thank-you": "thankYouPage"
|
|
3158
|
+
};
|
|
3159
|
+
var buildOfferTemplate = ({ location: location2, name } = {}) => CABRootSection.parse({
|
|
3160
|
+
...OFFER_TEMPLATE_SEED,
|
|
3161
|
+
editorMode: LOCATION_TO_EDITOR_MODE[location2 ?? "checkout"],
|
|
3162
|
+
...name && { name },
|
|
3163
|
+
previewMode: false,
|
|
3164
|
+
type: SHOPIFY_CHECKOUT_EXTENSION
|
|
3165
|
+
});
|
|
3166
|
+
|
|
3167
|
+
// src/transforms/offerV1/offerCard.ts
|
|
3168
|
+
var VARIANT_SELECTOR = { button: "button", radio: "radio", select: "menu" };
|
|
3169
|
+
var localizedContent = (defaults, override) => {
|
|
3170
|
+
const trimmed = override?.trim();
|
|
3171
|
+
return trimmed ? { ...defaults, en: trimmed } : defaults;
|
|
3172
|
+
};
|
|
3173
|
+
var buildStyledText = (token, style, color = "base") => {
|
|
3174
|
+
const marks = [
|
|
3175
|
+
{ attrs: { color, fontSize: style?.textSize ?? "base" }, type: "textStyle" }
|
|
3176
|
+
];
|
|
3177
|
+
if (style?.textEmphasis === "bold") marks.push({ type: "bold" });
|
|
3178
|
+
if (style?.textEmphasis === "italic") marks.push({ type: "italic" });
|
|
3179
|
+
return { content: [{ content: [{ marks, text: token, type: "text" }], type: "paragraph" }], type: "doc" };
|
|
3180
|
+
};
|
|
3181
|
+
var buildPriceContent = (settings) => {
|
|
3182
|
+
const content = [{ text: "{{variantPrice}}", type: "text" }];
|
|
3183
|
+
if (settings.discount?.showSavingAmount !== false) {
|
|
3184
|
+
content.push(
|
|
3185
|
+
{ text: " ", type: "text" },
|
|
3186
|
+
{
|
|
3187
|
+
marks: [{ type: "strike" }, { attrs: { color: "subdued" }, type: "textStyle" }],
|
|
3188
|
+
text: "{{variantCompareAtPrice}}",
|
|
3189
|
+
type: "text"
|
|
3190
|
+
}
|
|
3191
|
+
);
|
|
3192
|
+
}
|
|
3193
|
+
return { content: [{ content, type: "paragraph" }], type: "doc" };
|
|
3194
|
+
};
|
|
3195
|
+
var buildReviews = (settings) => {
|
|
3196
|
+
if (!settings.integrations || !Object.values(settings.integrations).some(Boolean)) return [];
|
|
3197
|
+
const reviews = settings.displaySettings?.reviews;
|
|
3198
|
+
return [
|
|
3199
|
+
{
|
|
3200
|
+
...reviews?.color && { color: reviews.color },
|
|
3201
|
+
sectionType: "reviews",
|
|
3202
|
+
...reviews?.size && { size: reviews.size }
|
|
3203
|
+
}
|
|
3204
|
+
];
|
|
3205
|
+
};
|
|
3206
|
+
var buildImage = (settings) => ({
|
|
3207
|
+
...settings.displaySettings?.image?.imageFit && {
|
|
3208
|
+
objectFit: settings.displaySettings.image.imageFit
|
|
3209
|
+
},
|
|
3210
|
+
sectionType: "image",
|
|
3211
|
+
source: settings.images?.source === "product" ? "{{productImage}}" : "{{variantImage}}",
|
|
3212
|
+
width: 100
|
|
3213
|
+
});
|
|
3214
|
+
var buildTitle = (settings) => ({
|
|
3215
|
+
content: { en: buildStyledText("{{productTitle}}", settings.displaySettings?.product) },
|
|
3216
|
+
sectionType: "text"
|
|
3217
|
+
});
|
|
3218
|
+
var buildPrice = (settings) => ({
|
|
3219
|
+
content: { en: buildPriceContent(settings) },
|
|
3220
|
+
sectionType: "text"
|
|
3221
|
+
});
|
|
3222
|
+
var buildVariantTitle = (settings) => {
|
|
3223
|
+
const show = settings.productOptions?.showVariantTitle;
|
|
3224
|
+
if (!show || show === "hide") return [];
|
|
3225
|
+
return [
|
|
3226
|
+
{
|
|
3227
|
+
content: { en: buildStyledText("{{variantTitle}}", settings.displaySettings?.variant) },
|
|
3228
|
+
sectionType: "text"
|
|
3229
|
+
}
|
|
3230
|
+
];
|
|
3231
|
+
};
|
|
3232
|
+
var buildDescription = (settings) => {
|
|
3233
|
+
const show = settings.productOptions?.showProductDescription;
|
|
3234
|
+
if (!show || show === "hide") return [];
|
|
3235
|
+
return [{ content: { en: buildStyledText("{{productDescription}}", void 0) }, sectionType: "text" }];
|
|
3236
|
+
};
|
|
3237
|
+
var buildVariants = (settings) => {
|
|
3238
|
+
if (settings.productOptions?.showVariantOptions === "never") return [];
|
|
3239
|
+
const selector = settings.viewOptions?.variantSelector;
|
|
3240
|
+
return [
|
|
3241
|
+
{
|
|
3242
|
+
hideOutOfStockVariants: !!settings.productOptions?.hideOutOfStockVariants,
|
|
3243
|
+
...selector && { selector: VARIANT_SELECTOR[selector] },
|
|
3244
|
+
sectionType: "variants"
|
|
3245
|
+
}
|
|
3246
|
+
];
|
|
3247
|
+
};
|
|
3248
|
+
var QUANTITY_INPUT_TYPE = {
|
|
3249
|
+
"buttons-manual-input": "number",
|
|
3250
|
+
"dropdown-select": "select"
|
|
3251
|
+
};
|
|
3252
|
+
var buildQuantityErrors = (quantity) => {
|
|
3253
|
+
const en = {
|
|
3254
|
+
...quantity.maxError && { max: quantity.maxError },
|
|
3255
|
+
...quantity.minError && { min: quantity.minError },
|
|
3256
|
+
...quantity.negativeError && { neg: quantity.negativeError }
|
|
3257
|
+
};
|
|
3258
|
+
return Object.keys(en).length ? { errorMessages: { en } } : {};
|
|
3259
|
+
};
|
|
3260
|
+
var buildQuantity = (settings) => {
|
|
3261
|
+
const quantity = settings.quantityInputs;
|
|
3262
|
+
if (!quantity?.enabled) return [];
|
|
3263
|
+
const inputType = quantity.type ? QUANTITY_INPUT_TYPE[quantity.type] : void 0;
|
|
3264
|
+
return [
|
|
3265
|
+
{
|
|
3266
|
+
...buildQuantityErrors(quantity),
|
|
3267
|
+
...inputType && { inputType },
|
|
3268
|
+
max: quantity.maxValue ?? 10,
|
|
3269
|
+
min: quantity.minValue ?? 1,
|
|
3270
|
+
sectionType: "quantity"
|
|
3271
|
+
}
|
|
3272
|
+
];
|
|
3273
|
+
};
|
|
3274
|
+
var buildSubscriptionButton = (settings) => {
|
|
3275
|
+
if (settings.productType !== "both" && settings.productType !== "subscription") return [];
|
|
3276
|
+
const language = settings.language;
|
|
3277
|
+
const slot = (buttonField, override) => ({
|
|
3278
|
+
buttonField,
|
|
3279
|
+
content: localizedContent(SWITCH_LABELS[buttonField], override),
|
|
3280
|
+
sectionType: "text"
|
|
3281
|
+
});
|
|
3282
|
+
return [
|
|
3283
|
+
{
|
|
3284
|
+
action: "switchToSubscription",
|
|
3285
|
+
buttonStyle: "plain",
|
|
3286
|
+
sections: [
|
|
3287
|
+
slot("subscriptionOption", void 0),
|
|
3288
|
+
slot("switchToOneTimePurchase", language?.cartSwitchToOnetime),
|
|
3289
|
+
slot("switchToSubscriptionNoDiscount", language?.cartSwitchToSubscription),
|
|
3290
|
+
slot("switchToSubscriptionWithDiscount", language?.upgradeToSubscription)
|
|
3291
|
+
],
|
|
3292
|
+
sectionType: "button"
|
|
3293
|
+
}
|
|
3294
|
+
];
|
|
3295
|
+
};
|
|
3296
|
+
var BUTTON_KINDS = ["plain", "primary", "secondary"];
|
|
3297
|
+
var buildAddButton = (settings) => {
|
|
3298
|
+
const kind = settings.button?.kind;
|
|
3299
|
+
const slot = (buttonField, override) => ({
|
|
3300
|
+
buttonField,
|
|
3301
|
+
content: localizedContent(OFFER_LABELS[buttonField], override),
|
|
3302
|
+
sectionType: "text"
|
|
3303
|
+
});
|
|
3304
|
+
return {
|
|
3305
|
+
action: "addToOrder",
|
|
3306
|
+
buttonStyle: BUTTON_KINDS.includes(kind) ? kind : "primary",
|
|
3307
|
+
sections: [
|
|
3308
|
+
slot("addToCart", settings.language?.addToCart),
|
|
3309
|
+
slot("addingToCart", settings.language?.addingToCart),
|
|
3310
|
+
slot("addedToCart", settings.language?.addedToCart),
|
|
3311
|
+
slot("soldOut", settings.language?.soldOutLabel)
|
|
3312
|
+
],
|
|
3313
|
+
sectionType: "button"
|
|
3314
|
+
};
|
|
3315
|
+
};
|
|
3316
|
+
var rowsLayout = (sections) => ({
|
|
3317
|
+
direction: "rows",
|
|
3318
|
+
sections,
|
|
3319
|
+
sectionType: "layout"
|
|
3320
|
+
});
|
|
3321
|
+
var buildOfferCard = (settings, horizontal) => {
|
|
3322
|
+
const image = buildImage(settings);
|
|
3323
|
+
const title = buildTitle(settings);
|
|
3324
|
+
const variantTitle = buildVariantTitle(settings);
|
|
3325
|
+
const price = buildPrice(settings);
|
|
3326
|
+
const description = buildDescription(settings);
|
|
3327
|
+
const reviews = buildReviews(settings);
|
|
3328
|
+
const variants = buildVariants(settings);
|
|
3329
|
+
const quantity = buildQuantity(settings);
|
|
3330
|
+
const subscription = buildSubscriptionButton(settings);
|
|
3331
|
+
const addButton = buildAddButton(settings);
|
|
3332
|
+
if (!horizontal) {
|
|
3333
|
+
return [
|
|
3334
|
+
image,
|
|
3335
|
+
title,
|
|
3336
|
+
...variantTitle,
|
|
3337
|
+
price,
|
|
3338
|
+
...description,
|
|
3339
|
+
...reviews,
|
|
3340
|
+
...variants,
|
|
3341
|
+
...quantity,
|
|
3342
|
+
...subscription,
|
|
3343
|
+
addButton
|
|
3344
|
+
];
|
|
3345
|
+
}
|
|
3346
|
+
const info = rowsLayout([title, ...variantTitle, price, ...description, ...reviews, ...variants]);
|
|
3347
|
+
const actions = [...subscription, addButton];
|
|
3348
|
+
const actionsCell = actions.length === 1 ? actions[0] : rowsLayout(actions);
|
|
3349
|
+
const card = {
|
|
3350
|
+
direction: "grid",
|
|
3351
|
+
grid: { columns: ["15%", "fill", "auto"], rows: ["auto"] },
|
|
3352
|
+
sections: [image, info, actionsCell],
|
|
3353
|
+
sectionType: "layout"
|
|
3354
|
+
};
|
|
3355
|
+
return [card, ...quantity];
|
|
3356
|
+
};
|
|
3357
|
+
|
|
3358
|
+
// src/transforms/offerV1/convertOfferToV2.ts
|
|
3359
|
+
var LOCATION_TO_EDITOR_MODE2 = {
|
|
3360
|
+
checkout: "checkoutExtension",
|
|
3361
|
+
"order-status": "orderStatusPage",
|
|
3362
|
+
"thank-you": "thankYouPage"
|
|
3363
|
+
};
|
|
3364
|
+
var STYLE_TO_DIRECTION = {
|
|
3365
|
+
grid: "grid",
|
|
3366
|
+
line: "columns",
|
|
3367
|
+
list: "rows",
|
|
3368
|
+
none: "rows"
|
|
3369
|
+
};
|
|
3370
|
+
var directionForStyle = (style) => style ? STYLE_TO_DIRECTION[style] : "rows";
|
|
3371
|
+
var buildProductListLayout = (direction, columns) => direction === "grid" ? { direction, grid: { columns: Array.from({ length: Math.max(columns, 1) }, () => "fill"), rows: ["auto"] } } : { direction };
|
|
3372
|
+
var hasHeaderText = (language) => !!(language?.title || language?.superTitle || language?.description);
|
|
3373
|
+
var DISCOUNTED_FROM = {
|
|
3374
|
+
compare_at_price: "compare_at_price",
|
|
3375
|
+
original_price: "price",
|
|
3376
|
+
price: "price"
|
|
3377
|
+
};
|
|
3378
|
+
var buildDiscountSection = (discount) => {
|
|
3379
|
+
if (!discount?.type || discount.type === "none") return [];
|
|
3380
|
+
const discountedFrom = discount.discountedFrom ? DISCOUNTED_FROM[discount.discountedFrom] : void 0;
|
|
3381
|
+
return [
|
|
3382
|
+
{
|
|
3383
|
+
amount: discount.amount ?? 0,
|
|
3384
|
+
...discount.discountedBy && { discountedBy: discount.discountedBy },
|
|
3385
|
+
...discountedFrom && { discountedFrom },
|
|
3386
|
+
...discount.message && { message: discount.message },
|
|
3387
|
+
...discount.quantity != null && { quantity: discount.quantity },
|
|
3388
|
+
sectionType: "discount",
|
|
3389
|
+
type: discount.type
|
|
3390
|
+
}
|
|
3391
|
+
];
|
|
3392
|
+
};
|
|
3393
|
+
var buildBanner = (language) => language?.successBannerEnabled ? [
|
|
3394
|
+
{
|
|
3395
|
+
color: "success",
|
|
3396
|
+
dismissible: true,
|
|
3397
|
+
sections: [
|
|
3398
|
+
{
|
|
3399
|
+
/**
|
|
3400
|
+
* A defined v1 message (RTE doc or string) passes through verbatim as `en`;
|
|
3401
|
+
* absent falls back to the localized defaults (P4 language policy).
|
|
3402
|
+
*/
|
|
3403
|
+
content: language.successBannerMessageRte ? { ...OFFER_LABELS.addedToCartMessage, en: language.successBannerMessageRte } : OFFER_LABELS.addedToCartMessage,
|
|
3404
|
+
sectionType: "text"
|
|
3405
|
+
},
|
|
3406
|
+
{
|
|
3407
|
+
action: "undoAddToOrder",
|
|
3408
|
+
buttonStyle: "plain",
|
|
3409
|
+
sections: [{ buttonField: "buttonLabel", content: OFFER_LABELS.undo, sectionType: "text" }],
|
|
3410
|
+
sectionType: "button"
|
|
3411
|
+
}
|
|
3412
|
+
],
|
|
3413
|
+
sectionType: "banner"
|
|
3414
|
+
}
|
|
3415
|
+
] : [];
|
|
3416
|
+
var convertOfferToV2 = ({ id, name, settings }) => {
|
|
3417
|
+
const layout = settings.layout?.large ?? settings.layout?.medium ?? settings.layout?.small;
|
|
3418
|
+
const columns = layout?.columns ?? 1;
|
|
3419
|
+
const direction = directionForStyle(layout?.style);
|
|
3420
|
+
const listLayout = buildProductListLayout(direction, columns);
|
|
3421
|
+
const horizontalCard = direction === "rows";
|
|
3422
|
+
const dataSource = {
|
|
3423
|
+
...settings.endpoint && { dataSourcePath: settings.endpoint },
|
|
3424
|
+
...settings.integrations && { integrations: settings.integrations },
|
|
3425
|
+
...settings.limit !== void 0 && { limit: settings.limit },
|
|
3426
|
+
matchVariant: !!settings.productOptions?.matchVariant,
|
|
3427
|
+
matchVariantOutOfStock: !!settings.productOptions?.matchVariantOutOfStock,
|
|
3428
|
+
...settings.productType && { productType: settings.productType },
|
|
3429
|
+
sectionType: "dataSource",
|
|
3430
|
+
...settings.treatAsGwp && { treatAsGwp: true }
|
|
3431
|
+
};
|
|
3432
|
+
const offers = {
|
|
3433
|
+
sections: [
|
|
3434
|
+
...buildOfferCard(settings, horizontalCard),
|
|
3435
|
+
dataSource,
|
|
3436
|
+
...buildDiscountSection(settings.discount),
|
|
3437
|
+
...buildBanner(settings.language)
|
|
3438
|
+
],
|
|
3439
|
+
sectionType: "offers"
|
|
3440
|
+
};
|
|
3441
|
+
const display = {
|
|
3442
|
+
autoAdvanceInterval: 0,
|
|
3443
|
+
itemsAtOnce: layout?.carousel ? columns : settings.limit ?? columns,
|
|
3444
|
+
...listLayout,
|
|
3445
|
+
sections: [offers],
|
|
3446
|
+
sectionType: "carousel"
|
|
3447
|
+
};
|
|
3448
|
+
return CABRootSection.parse({
|
|
3449
|
+
direction: "rows",
|
|
3450
|
+
editorMode: LOCATION_TO_EDITOR_MODE2[settings.location ?? "checkout"],
|
|
3451
|
+
// The widget name is required by the admin save schema; carry the legacy widget's name through.
|
|
3452
|
+
...name && { name },
|
|
3453
|
+
previewMode: settings.previewMode,
|
|
3454
|
+
sections: [
|
|
3455
|
+
...hasHeaderText(settings.language) ? [{ content: { en: convertContentBlockTextToV2(settings.language) }, sectionType: "text" }] : [],
|
|
3456
|
+
display
|
|
3457
|
+
],
|
|
3458
|
+
tracking: {
|
|
3459
|
+
enableAttribution: settings.tracking?.enableAttribution ?? true,
|
|
3460
|
+
enableSource: settings.tracking?.enableSource ?? true,
|
|
3461
|
+
enableWidget: settings.tracking?.enableWidget ?? true
|
|
3462
|
+
},
|
|
3463
|
+
type: SHOPIFY_CHECKOUT_EXTENSION,
|
|
3464
|
+
version: 2,
|
|
3465
|
+
widgetId: id
|
|
3466
|
+
});
|
|
3467
|
+
};
|
|
2488
3468
|
export {
|
|
2489
3469
|
ABTestingPlaceholder,
|
|
2490
3470
|
ARRAY_INDEX_STRING,
|
|
@@ -2505,6 +3485,7 @@ export {
|
|
|
2505
3485
|
CABCartLineSection,
|
|
2506
3486
|
CABDataSourceSection,
|
|
2507
3487
|
CABDiscount,
|
|
3488
|
+
CABDiscountSection,
|
|
2508
3489
|
CABImageSection,
|
|
2509
3490
|
CABIntegrations,
|
|
2510
3491
|
CABLayoutSection,
|
|
@@ -2550,6 +3531,7 @@ export {
|
|
|
2550
3531
|
LineItemEditorV1,
|
|
2551
3532
|
Metadata,
|
|
2552
3533
|
NO_HTML,
|
|
3534
|
+
OFFER_LABELS,
|
|
2553
3535
|
ObjectFit,
|
|
2554
3536
|
PayButtonBlock,
|
|
2555
3537
|
PopoverPosition,
|
|
@@ -2601,11 +3583,13 @@ export {
|
|
|
2601
3583
|
borderRadii,
|
|
2602
3584
|
borderStyles,
|
|
2603
3585
|
borderWidths,
|
|
3586
|
+
buildOfferTemplate,
|
|
2604
3587
|
buttonActions,
|
|
2605
3588
|
buttonFields,
|
|
2606
3589
|
buttonStyles,
|
|
2607
3590
|
checkForHTML,
|
|
2608
3591
|
convertNumericObjects,
|
|
3592
|
+
convertOfferToV2,
|
|
2609
3593
|
convertProductToStorefrontFormat,
|
|
2610
3594
|
convertToNodes,
|
|
2611
3595
|
convertVariantToStorefrontFormat,
|
|
@@ -2632,12 +3616,14 @@ export {
|
|
|
2632
3616
|
isCarouselType,
|
|
2633
3617
|
isCartLineType,
|
|
2634
3618
|
isDataSourceType,
|
|
3619
|
+
isDiscountType,
|
|
2635
3620
|
isHTML,
|
|
2636
3621
|
isImageBlock,
|
|
2637
3622
|
isImageContentBlock,
|
|
2638
3623
|
isImageType,
|
|
2639
3624
|
isLayoutType,
|
|
2640
3625
|
isMonetizeType,
|
|
3626
|
+
isOfferV1,
|
|
2641
3627
|
isOffersType,
|
|
2642
3628
|
isOverlayType,
|
|
2643
3629
|
isPayButtonBlock,
|