@lucrex/storefront-blocks 0.1.0 → 0.2.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/README.md +17 -3
- package/dist/index.cjs +1370 -40
- package/dist/index.mjs +1370 -40
- package/dist/server.cjs +1370 -40
- package/dist/server.mjs +1370 -40
- package/dist/types/block.d.ts +1 -1
- package/dist/types/blocks/store.d.ts +75 -0
- package/dist/types/context.d.ts +5 -1
- package/dist/types/data.d.ts +71 -1
- package/dist/types/index.d.ts +5 -2
- package/dist/types/money.d.ts +2 -0
- package/dist/types/templates/online-stores.d.ts +10 -0
- package/package.json +1 -1
package/dist/server.cjs
CHANGED
|
@@ -23,14 +23,20 @@ __export(server_exports, {
|
|
|
23
23
|
BlockList: () => BlockList,
|
|
24
24
|
Breakpoints: () => Breakpoints,
|
|
25
25
|
FunnelTemplateIds: () => FunnelTemplateIds,
|
|
26
|
+
OnlineStorePageTypes: () => OnlineStorePageTypes,
|
|
27
|
+
OnlineStoreTemplateIds: () => OnlineStoreTemplateIds,
|
|
26
28
|
PageContent: () => PageContent,
|
|
27
29
|
PageDataProvider: () => PageDataProvider,
|
|
28
30
|
PageDocumentError: () => PageDocumentError,
|
|
29
31
|
StyleProperties: () => StyleProperties,
|
|
30
32
|
blockSelector: () => blockSelector,
|
|
31
33
|
blocks: () => blocks,
|
|
34
|
+
checkoutData: () => checkoutData,
|
|
32
35
|
countBlocks: () => countBlocks,
|
|
33
36
|
funnelTemplate: () => funnelTemplate,
|
|
37
|
+
moneyFormatter: () => moneyFormatter,
|
|
38
|
+
onlineStorePages: () => onlineStorePages,
|
|
39
|
+
onlineStoreTemplate: () => onlineStoreTemplate,
|
|
34
40
|
pageCss: () => pageCss,
|
|
35
41
|
pageFontStylesheets: () => pageFontStylesheets,
|
|
36
42
|
pageJsonSchema: () => pageJsonSchema,
|
|
@@ -38,7 +44,10 @@ __export(server_exports, {
|
|
|
38
44
|
parsePageDocument: () => parsePageDocument,
|
|
39
45
|
processCss: () => processCss,
|
|
40
46
|
renderPage: () => renderPage,
|
|
47
|
+
storeData: () => storeData,
|
|
48
|
+
useCheckoutData: () => useCheckoutData,
|
|
41
49
|
usePageData: () => usePageData,
|
|
50
|
+
useStoreData: () => useStoreData,
|
|
42
51
|
walkBlocks: () => walkBlocks
|
|
43
52
|
});
|
|
44
53
|
module.exports = __toCommonJS(server_exports);
|
|
@@ -463,6 +472,24 @@ function usePageData() {
|
|
|
463
472
|
}
|
|
464
473
|
return data;
|
|
465
474
|
}
|
|
475
|
+
function checkoutData(data) {
|
|
476
|
+
if (!data.funnel || !data.product || !data.landingPage || !data.geo || !data.api) {
|
|
477
|
+
throw new Error("This block needs the product and checkout data of a product page");
|
|
478
|
+
}
|
|
479
|
+
return data;
|
|
480
|
+
}
|
|
481
|
+
function useCheckoutData() {
|
|
482
|
+
return checkoutData(usePageData());
|
|
483
|
+
}
|
|
484
|
+
function storeData(data) {
|
|
485
|
+
if (!data.store) {
|
|
486
|
+
throw new Error("This block needs the data of an online store page");
|
|
487
|
+
}
|
|
488
|
+
return data.store;
|
|
489
|
+
}
|
|
490
|
+
function useStoreData() {
|
|
491
|
+
return storeData(usePageData());
|
|
492
|
+
}
|
|
466
493
|
|
|
467
494
|
// src/blocks/product.tsx
|
|
468
495
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -488,7 +515,7 @@ var ProductTitle = defineBlock({
|
|
|
488
515
|
}
|
|
489
516
|
},
|
|
490
517
|
render: function ProductTitle2(props) {
|
|
491
|
-
const data =
|
|
518
|
+
const data = useCheckoutData();
|
|
492
519
|
return (0, import_react4.createElement)(
|
|
493
520
|
props.level,
|
|
494
521
|
{ ...blockRoot(props, "cs-title"), "data-funnel": "product-name" },
|
|
@@ -516,9 +543,9 @@ var ProductTagline = defineBlock({
|
|
|
516
543
|
schema: import_zod5.z.object({}),
|
|
517
544
|
fields: {},
|
|
518
545
|
render: function ProductTagline2(props) {
|
|
519
|
-
const { product } =
|
|
520
|
-
if (!
|
|
521
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { ...blockRoot(props, "cs-tagline"), "data-funnel": "tagline", children:
|
|
546
|
+
const { product: product2 } = useCheckoutData();
|
|
547
|
+
if (!product2.tagline) return null;
|
|
548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { ...blockRoot(props, "cs-tagline"), "data-funnel": "tagline", children: product2.tagline });
|
|
522
549
|
}
|
|
523
550
|
});
|
|
524
551
|
var ProductGallery = defineBlock({
|
|
@@ -528,9 +555,9 @@ var ProductGallery = defineBlock({
|
|
|
528
555
|
category: "product",
|
|
529
556
|
schema: import_zod5.z.object({}),
|
|
530
557
|
fields: {},
|
|
531
|
-
preload: (_props, data) => galleryImages(data).slice(0, 1),
|
|
558
|
+
preload: (_props, data) => galleryImages(checkoutData(data)).slice(0, 1),
|
|
532
559
|
render: function ProductGallery2(props) {
|
|
533
|
-
const data =
|
|
560
|
+
const data = useCheckoutData();
|
|
534
561
|
const images = galleryImages(data);
|
|
535
562
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ...blockRoot(props, "cs-gallery"), "data-funnel": "lead-images", children: images.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
536
563
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -577,9 +604,9 @@ var LandingImages = defineBlock({
|
|
|
577
604
|
]
|
|
578
605
|
}
|
|
579
606
|
},
|
|
580
|
-
preload: (props, data) => props.eagerFirstImage ? data.landingPage.images.slice(0, 1) : [],
|
|
607
|
+
preload: (props, data) => props.eagerFirstImage ? checkoutData(data).landingPage.images.slice(0, 1) : [],
|
|
581
608
|
render: function LandingImages2(props) {
|
|
582
|
-
const data =
|
|
609
|
+
const data = useCheckoutData();
|
|
583
610
|
const images = data.landingPage.images;
|
|
584
611
|
if (!images.length) return null;
|
|
585
612
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -631,7 +658,7 @@ var ProductDescription = defineBlock({
|
|
|
631
658
|
}
|
|
632
659
|
},
|
|
633
660
|
render: function ProductDescription2(props) {
|
|
634
|
-
const data =
|
|
661
|
+
const data = useCheckoutData();
|
|
635
662
|
if (!data.product.description) return null;
|
|
636
663
|
if (props.onlyWithoutLandingImages && data.landingPage.images.length) return null;
|
|
637
664
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("section", { ...blockRoot(props, "cs-card", "cs-desc"), "data-funnel": "description", children: data.product.description });
|
|
@@ -645,9 +672,9 @@ var ProductFaq = defineBlock({
|
|
|
645
672
|
schema: import_zod5.z.object({}),
|
|
646
673
|
fields: {},
|
|
647
674
|
render: function ProductFaq2(props) {
|
|
648
|
-
const { product } =
|
|
649
|
-
if (!
|
|
650
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("section", { ...blockRoot(props, "cs-card", "cs-faq"), "data-funnel": "faq", children:
|
|
675
|
+
const { product: product2 } = useCheckoutData();
|
|
676
|
+
if (!product2.faq.length) return null;
|
|
677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("section", { ...blockRoot(props, "cs-card", "cs-faq"), "data-funnel": "faq", children: product2.faq.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("details", { children: [
|
|
651
678
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("summary", { children: item.question }),
|
|
652
679
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: item.answer })
|
|
653
680
|
] }, index)) });
|
|
@@ -657,14 +684,14 @@ var ProductFaq = defineBlock({
|
|
|
657
684
|
// src/blocks/checkout.tsx
|
|
658
685
|
var import_zod6 = require("zod");
|
|
659
686
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
660
|
-
function offerUnitCount(
|
|
661
|
-
return
|
|
687
|
+
function offerUnitCount(products2) {
|
|
688
|
+
return products2.reduce((sum, item) => sum + (item.quantity || 0), 0);
|
|
662
689
|
}
|
|
663
|
-
function offerUnitNumber(
|
|
690
|
+
function offerUnitNumber(products2, productIndex, unitIndex) {
|
|
664
691
|
var _a;
|
|
665
692
|
let start = 0;
|
|
666
693
|
for (let i = 0; i < productIndex; i += 1) {
|
|
667
|
-
start += ((_a =
|
|
694
|
+
start += ((_a = products2[i]) == null ? void 0 : _a.quantity) || 0;
|
|
668
695
|
}
|
|
669
696
|
return start + unitIndex + 1;
|
|
670
697
|
}
|
|
@@ -698,7 +725,7 @@ function VariantChips({ definitions: definitions2 }) {
|
|
|
698
725
|
)) });
|
|
699
726
|
}
|
|
700
727
|
function OfferUnitVariants({ data, offer }) {
|
|
701
|
-
const { product } = data;
|
|
728
|
+
const { product: product2 } = data;
|
|
702
729
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cs-offer__variants", "data-offer-variants": "", children: offer.products.map(
|
|
703
730
|
(item, productIndex) => Array.from({ length: item.quantity }, (_unused, unit) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
704
731
|
"div",
|
|
@@ -709,7 +736,7 @@ function OfferUnitVariants({ data, offer }) {
|
|
|
709
736
|
"data-unit-index": unit,
|
|
710
737
|
children: [
|
|
711
738
|
offerUnitCount(offer.products) > 1 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "cs-offer__unit-label", children: `#${offerUnitNumber(offer.products, productIndex, unit)}` }) : null,
|
|
712
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cs-offer__fields", children:
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "cs-offer__fields", children: product2.isBundle ? product2.bundleProducts.filter(
|
|
713
740
|
(bundleProduct) => bundleProduct.trackingId === item.trackingId
|
|
714
741
|
).map((bundleProduct) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
715
742
|
VariantSelects,
|
|
@@ -717,7 +744,7 @@ function OfferUnitVariants({ data, offer }) {
|
|
|
717
744
|
definitions: bundleProduct.variantDefinitions
|
|
718
745
|
},
|
|
719
746
|
bundleProduct.trackingId
|
|
720
|
-
)) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(VariantSelects, { definitions:
|
|
747
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(VariantSelects, { definitions: product2.variantDefinitions }) })
|
|
721
748
|
]
|
|
722
749
|
},
|
|
723
750
|
`${item.trackingId}-${productIndex}-${unit}`
|
|
@@ -725,7 +752,7 @@ function OfferUnitVariants({ data, offer }) {
|
|
|
725
752
|
) });
|
|
726
753
|
}
|
|
727
754
|
function Catalog({ data }) {
|
|
728
|
-
const { product, offers } = data;
|
|
755
|
+
const { product: product2, offers } = data;
|
|
729
756
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
730
757
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "cs-offers", "data-funnel": "offers", hidden: !offers.length, children: [
|
|
731
758
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "cs-section-title", "data-i18n": "offers" }),
|
|
@@ -763,14 +790,14 @@ function Catalog({ data }) {
|
|
|
763
790
|
)
|
|
764
791
|
] })
|
|
765
792
|
] }) }),
|
|
766
|
-
|
|
793
|
+
product2.isBundle || product2.variantDefinitions.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OfferUnitVariants, { data, offer }) : null
|
|
767
794
|
]
|
|
768
795
|
},
|
|
769
796
|
offer.trackingId
|
|
770
797
|
))
|
|
771
798
|
] }),
|
|
772
799
|
offers.length ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
773
|
-
|
|
800
|
+
product2.isBundle ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("section", { "data-funnel": "bundle-products", children: product2.bundleProducts.map((item) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
774
801
|
"div",
|
|
775
802
|
{
|
|
776
803
|
className: "cs-bundle",
|
|
@@ -781,7 +808,7 @@ function Catalog({ data }) {
|
|
|
781
808
|
]
|
|
782
809
|
},
|
|
783
810
|
item.trackingId
|
|
784
|
-
)) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("section", { "data-funnel": "variants", hidden: !
|
|
811
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("section", { "data-funnel": "variants", hidden: !product2.variantDefinitions.length, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(VariantChips, { definitions: product2.variantDefinitions }) }),
|
|
785
812
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "cs-qty", "data-funnel": "qty", children: [
|
|
786
813
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", "data-qty": "-1", children: "-" }),
|
|
787
814
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "cs-qty__value", "data-qty-value": "", children: "1" }),
|
|
@@ -833,7 +860,7 @@ function FormField({ data, type }) {
|
|
|
833
860
|
if (type === "city") {
|
|
834
861
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { name: "city", "data-field": "city", children: [
|
|
835
862
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "" }),
|
|
836
|
-
data.geo.cities.map((city) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
863
|
+
(data.lazyCities ? [] : data.geo.cities).map((city) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
837
864
|
"option",
|
|
838
865
|
{
|
|
839
866
|
value: city.id,
|
|
@@ -893,7 +920,7 @@ function RecaptchaNotice({ language }) {
|
|
|
893
920
|
}
|
|
894
921
|
function OrderFormView(props) {
|
|
895
922
|
var _a;
|
|
896
|
-
const data =
|
|
923
|
+
const data = useCheckoutData();
|
|
897
924
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { ...blockRoot(props, "cs-form"), "data-funnel": "form", children: [
|
|
898
925
|
props.includeCatalog ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Catalog, { data }) : null,
|
|
899
926
|
data.funnel.form.fields.filter((field) => field.enabled).map((field) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
@@ -943,7 +970,7 @@ var ProductCatalog = defineBlock({
|
|
|
943
970
|
schema: import_zod6.z.object({}),
|
|
944
971
|
fields: {},
|
|
945
972
|
render: function ProductCatalog2(props) {
|
|
946
|
-
const data =
|
|
973
|
+
const data = useCheckoutData();
|
|
947
974
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ...blockRoot(props), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Catalog, { data }) });
|
|
948
975
|
}
|
|
949
976
|
});
|
|
@@ -968,6 +995,1028 @@ var OrderForm = defineBlock({
|
|
|
968
995
|
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OrderFormView, { ...props })
|
|
969
996
|
});
|
|
970
997
|
|
|
998
|
+
// src/blocks/store.tsx
|
|
999
|
+
var import_zod7 = require("zod");
|
|
1000
|
+
|
|
1001
|
+
// src/money.ts
|
|
1002
|
+
function moneyFormatter({
|
|
1003
|
+
language,
|
|
1004
|
+
iso2,
|
|
1005
|
+
currency
|
|
1006
|
+
}) {
|
|
1007
|
+
const options = {
|
|
1008
|
+
style: "currency",
|
|
1009
|
+
currency,
|
|
1010
|
+
currencyDisplay: "symbol",
|
|
1011
|
+
minimumFractionDigits: 0,
|
|
1012
|
+
maximumFractionDigits: 2
|
|
1013
|
+
};
|
|
1014
|
+
const country = iso2.toUpperCase();
|
|
1015
|
+
const part = (locale2) => {
|
|
1016
|
+
var _a, _b;
|
|
1017
|
+
return (_b = (_a = new Intl.NumberFormat(locale2, options).formatToParts(0).find((p) => p.type === "currency")) == null ? void 0 : _a.value) != null ? _b : "";
|
|
1018
|
+
};
|
|
1019
|
+
const isCode = (symbol2) => symbol2.replace(/\./g, "").toUpperCase() === currency.toUpperCase();
|
|
1020
|
+
const locale = `${language}-${country}`;
|
|
1021
|
+
const formatter = new Intl.NumberFormat(locale, options);
|
|
1022
|
+
const symbol = [locale, `fr-${country}`, `ar-${country}`].map(part).find((item) => !isCode(item));
|
|
1023
|
+
return (value) => formatter.formatToParts(value).map((item) => item.type === "currency" ? symbol != null ? symbol : item.value : item.value).join("");
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
// src/blocks/store.tsx
|
|
1027
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1028
|
+
var LabelKeys = [
|
|
1029
|
+
"bestSellers",
|
|
1030
|
+
"newArrivals",
|
|
1031
|
+
"shopByCategory",
|
|
1032
|
+
"youMayAlsoLike",
|
|
1033
|
+
"categories",
|
|
1034
|
+
"allProducts",
|
|
1035
|
+
"cod"
|
|
1036
|
+
];
|
|
1037
|
+
var LabelKeySchema = import_zod7.z.enum(LabelKeys);
|
|
1038
|
+
var labelOptions = LabelKeys.map((key) => ({ label: key, value: key }));
|
|
1039
|
+
var TextSchema = import_zod7.z.string().max(300);
|
|
1040
|
+
function heading(store, text, label) {
|
|
1041
|
+
return text || store.labels[label];
|
|
1042
|
+
}
|
|
1043
|
+
var MenuIcon = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1044
|
+
"svg",
|
|
1045
|
+
{
|
|
1046
|
+
viewBox: "0 0 24 24",
|
|
1047
|
+
width: "22",
|
|
1048
|
+
height: "22",
|
|
1049
|
+
fill: "none",
|
|
1050
|
+
stroke: "currentColor",
|
|
1051
|
+
strokeWidth: "1.8",
|
|
1052
|
+
strokeLinecap: "round",
|
|
1053
|
+
"aria-hidden": "true",
|
|
1054
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M3 6h18M3 12h18M3 18h18" })
|
|
1055
|
+
}
|
|
1056
|
+
);
|
|
1057
|
+
var SearchIcon = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1058
|
+
"svg",
|
|
1059
|
+
{
|
|
1060
|
+
viewBox: "0 0 24 24",
|
|
1061
|
+
width: "22",
|
|
1062
|
+
height: "22",
|
|
1063
|
+
fill: "none",
|
|
1064
|
+
stroke: "currentColor",
|
|
1065
|
+
strokeWidth: "1.8",
|
|
1066
|
+
strokeLinecap: "round",
|
|
1067
|
+
"aria-hidden": "true",
|
|
1068
|
+
children: [
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("circle", { cx: "11", cy: "11", r: "7" }),
|
|
1070
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "m20 20-3.5-3.5" })
|
|
1071
|
+
]
|
|
1072
|
+
}
|
|
1073
|
+
);
|
|
1074
|
+
function ProductCard({
|
|
1075
|
+
item,
|
|
1076
|
+
position,
|
|
1077
|
+
list,
|
|
1078
|
+
money
|
|
1079
|
+
}) {
|
|
1080
|
+
var _a;
|
|
1081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1082
|
+
"a",
|
|
1083
|
+
{
|
|
1084
|
+
className: "card",
|
|
1085
|
+
href: item.url,
|
|
1086
|
+
"data-product-card": "",
|
|
1087
|
+
"data-category": (_a = item.categoryId) != null ? _a : "",
|
|
1088
|
+
"data-price": item.fromPrice,
|
|
1089
|
+
"data-name": item.product.name,
|
|
1090
|
+
"data-position": position,
|
|
1091
|
+
"data-track": "product",
|
|
1092
|
+
"data-product-id": item.product.trackingId,
|
|
1093
|
+
"data-list": list,
|
|
1094
|
+
children: [
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "card__media", children: [
|
|
1096
|
+
item.cardImage ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1097
|
+
"img",
|
|
1098
|
+
{
|
|
1099
|
+
className: "card__image",
|
|
1100
|
+
src: item.cardImage,
|
|
1101
|
+
alt: item.product.name,
|
|
1102
|
+
loading: "lazy",
|
|
1103
|
+
decoding: "async"
|
|
1104
|
+
}
|
|
1105
|
+
) : null,
|
|
1106
|
+
item.cardHoverImage ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1107
|
+
"img",
|
|
1108
|
+
{
|
|
1109
|
+
className: "card__hover",
|
|
1110
|
+
src: item.cardHoverImage,
|
|
1111
|
+
alt: "",
|
|
1112
|
+
loading: "lazy",
|
|
1113
|
+
decoding: "async"
|
|
1114
|
+
}
|
|
1115
|
+
) : null,
|
|
1116
|
+
item.discountPercent ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "card__badge", children: `-${item.discountPercent}%` }) : null
|
|
1117
|
+
] }),
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "card__body", children: [
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "card__name", children: item.product.name }),
|
|
1120
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "card__price", children: [
|
|
1121
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: money(item.fromPrice) }),
|
|
1122
|
+
item.compareAtPrice ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("s", { children: money(item.compareAtPrice) }) : null
|
|
1123
|
+
] })
|
|
1124
|
+
] })
|
|
1125
|
+
]
|
|
1126
|
+
}
|
|
1127
|
+
);
|
|
1128
|
+
}
|
|
1129
|
+
function SectionHead({ title, viewAll }) {
|
|
1130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "section-head", children: [
|
|
1131
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { children: title }),
|
|
1132
|
+
viewAll ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/products", children: viewAll }) : null
|
|
1133
|
+
] });
|
|
1134
|
+
}
|
|
1135
|
+
var CategoryItemStyles = ["card", "pill", "tag", "chip", "link", "room"];
|
|
1136
|
+
function CategoryItem({
|
|
1137
|
+
entry,
|
|
1138
|
+
itemStyle
|
|
1139
|
+
}) {
|
|
1140
|
+
const track = { "data-track": "category", "data-category-id": entry.trackingId };
|
|
1141
|
+
if (itemStyle === "card") {
|
|
1142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("a", { className: "category", href: entry.url, ...track, children: [
|
|
1143
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "category__media", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { src: entry.imageUrl, alt: entry.name, loading: "lazy", decoding: "async" }) }),
|
|
1144
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "category__name", children: entry.name })
|
|
1145
|
+
] });
|
|
1146
|
+
}
|
|
1147
|
+
if (itemStyle === "chip") {
|
|
1148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("a", { className: "chip-link", href: entry.url, ...track, children: [
|
|
1149
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { src: entry.imageUrl, alt: "", loading: "lazy", decoding: "async" }),
|
|
1150
|
+
entry.name
|
|
1151
|
+
] });
|
|
1152
|
+
}
|
|
1153
|
+
if (itemStyle === "room") {
|
|
1154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("a", { className: "room", href: entry.url, ...track, children: [
|
|
1155
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { src: entry.imageUrl, alt: entry.name, loading: "lazy", decoding: "async" }),
|
|
1156
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: entry.name })
|
|
1157
|
+
] });
|
|
1158
|
+
}
|
|
1159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { className: itemStyle === "link" ? void 0 : itemStyle, href: entry.url, ...track, children: entry.name });
|
|
1160
|
+
}
|
|
1161
|
+
function trimmed(value, characters) {
|
|
1162
|
+
return (value != null ? value : "").split("").filter((character) => !characters.includes(character)).join("");
|
|
1163
|
+
}
|
|
1164
|
+
var AnnouncementBar = defineBlock({
|
|
1165
|
+
type: "AnnouncementBar",
|
|
1166
|
+
label: "Announcement bar",
|
|
1167
|
+
description: "The thin bar above the header with the announcement text from the store settings. Renders nothing when the announcement is off.",
|
|
1168
|
+
category: "store",
|
|
1169
|
+
schema: import_zod7.z.object({}),
|
|
1170
|
+
fields: {},
|
|
1171
|
+
render: function AnnouncementBar2(props) {
|
|
1172
|
+
const { onlineStore } = useStoreData();
|
|
1173
|
+
if (!onlineStore.announcementBarEnabled || !onlineStore.announcementBarText) return null;
|
|
1174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...blockRoot(props, "announcement"), children: onlineStore.announcementBarText });
|
|
1175
|
+
}
|
|
1176
|
+
});
|
|
1177
|
+
var StoreHeader = defineBlock({
|
|
1178
|
+
type: "StoreHeader",
|
|
1179
|
+
label: "Header",
|
|
1180
|
+
description: "The store navbar: menu button, logo, links to home, all products, the first categories and contact, the search link, and the mobile menu.",
|
|
1181
|
+
category: "store",
|
|
1182
|
+
schema: import_zod7.z.object({
|
|
1183
|
+
navCategories: import_zod7.z.number().int().min(0).max(12).default(4)
|
|
1184
|
+
}),
|
|
1185
|
+
fields: {
|
|
1186
|
+
navCategories: { type: "number", label: "Categories in the navbar" }
|
|
1187
|
+
},
|
|
1188
|
+
render: function StoreHeader2(props) {
|
|
1189
|
+
const { labels: t, onlineStore, categories: categories2 } = useStoreData();
|
|
1190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { ...blockRoot(props, "head"), children: [
|
|
1191
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "head__bar", children: [
|
|
1192
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1193
|
+
"button",
|
|
1194
|
+
{
|
|
1195
|
+
className: "head__icon head__menu",
|
|
1196
|
+
type: "button",
|
|
1197
|
+
"data-store": "menu-toggle",
|
|
1198
|
+
"aria-label": t.menu,
|
|
1199
|
+
"aria-expanded": "false",
|
|
1200
|
+
children: MenuIcon
|
|
1201
|
+
}
|
|
1202
|
+
),
|
|
1203
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { className: "logo", href: "/", children: onlineStore.logoUrl ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { src: onlineStore.logoUrl, alt: onlineStore.name }) : onlineStore.name }),
|
|
1204
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("nav", { className: "head__nav", "aria-label": t.menu, children: [
|
|
1205
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/", children: t.home }),
|
|
1206
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/products", children: t.allProducts }),
|
|
1207
|
+
categories2.slice(0, props.navCategories).map((entry) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: entry.url, children: entry.name }, entry.trackingId)),
|
|
1208
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/contact", children: t.contact })
|
|
1209
|
+
] }),
|
|
1210
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { className: "head__icon head__search", href: "/products", "aria-label": t.search, children: SearchIcon })
|
|
1211
|
+
] }),
|
|
1212
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("nav", { className: "menu", "data-store": "menu", hidden: true, "aria-label": t.menu, children: [
|
|
1213
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/", children: t.home }),
|
|
1214
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/products", children: t.allProducts }),
|
|
1215
|
+
categories2.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: entry.url, children: entry.name }, entry.trackingId)),
|
|
1216
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/about", children: t.about }),
|
|
1217
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/contact", children: t.contact })
|
|
1218
|
+
] })
|
|
1219
|
+
] });
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
var StoreFooter = defineBlock({
|
|
1223
|
+
type: "StoreFooter",
|
|
1224
|
+
label: "Footer",
|
|
1225
|
+
description: "The store footer: name and tagline, shop links with the first categories, help and policy links, social links, and the copyright line.",
|
|
1226
|
+
category: "store",
|
|
1227
|
+
schema: import_zod7.z.object({
|
|
1228
|
+
footerCategories: import_zod7.z.number().int().min(0).max(12).default(5)
|
|
1229
|
+
}),
|
|
1230
|
+
fields: {
|
|
1231
|
+
footerCategories: { type: "number", label: "Categories in the footer" }
|
|
1232
|
+
},
|
|
1233
|
+
render: function StoreFooter2(props) {
|
|
1234
|
+
const { labels: t, onlineStore, categories: categories2 } = useStoreData();
|
|
1235
|
+
const { contact: contact2 } = onlineStore;
|
|
1236
|
+
const social = { rel: "noopener noreferrer", target: "_blank" };
|
|
1237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("footer", { ...blockRoot(props, "foot"), children: [
|
|
1238
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "foot__inner", children: [
|
|
1239
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "foot__brand", children: [
|
|
1240
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { className: "logo", href: "/", children: onlineStore.name }),
|
|
1241
|
+
onlineStore.tagline ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: onlineStore.tagline }) : null
|
|
1242
|
+
] }),
|
|
1243
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
1244
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { children: t.shop }),
|
|
1245
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/products", children: t.allProducts }),
|
|
1246
|
+
categories2.slice(0, props.footerCategories).map((entry) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: entry.url, children: entry.name }, entry.trackingId))
|
|
1247
|
+
] }),
|
|
1248
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { children: t.help }),
|
|
1250
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/about", children: t.about }),
|
|
1251
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/contact", children: t.contact }),
|
|
1252
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/privacy-policy", children: t.privacyPolicy }),
|
|
1253
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/refund-policy", children: t.refundPolicy }),
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/terms-of-service", children: t.termsOfService })
|
|
1255
|
+
] }),
|
|
1256
|
+
contact2.facebook || contact2.instagram || contact2.tiktok ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
1257
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { children: t.followUs }),
|
|
1258
|
+
contact2.facebook ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: contact2.facebook, ...social, children: "Facebook" }) : null,
|
|
1259
|
+
contact2.instagram ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: contact2.instagram, ...social, children: "Instagram" }) : null,
|
|
1260
|
+
contact2.tiktok ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: contact2.tiktok, ...social, children: "TikTok" }) : null
|
|
1261
|
+
] }) : null
|
|
1262
|
+
] }),
|
|
1263
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "foot__legal", children: `\xA9 ${onlineStore.name}. ${t.rights}` })
|
|
1264
|
+
] });
|
|
1265
|
+
}
|
|
1266
|
+
});
|
|
1267
|
+
var StoreHeroTitle = defineBlock({
|
|
1268
|
+
type: "StoreHeroTitle",
|
|
1269
|
+
label: "Hero title",
|
|
1270
|
+
description: "The home page headline. Uses text when set, otherwise the hero title from the store settings, otherwise a default for the store language.",
|
|
1271
|
+
category: "store",
|
|
1272
|
+
schema: import_zod7.z.object({ text: TextSchema.default("") }),
|
|
1273
|
+
fields: { text: { type: "text", label: "Text" } },
|
|
1274
|
+
render: function StoreHeroTitle2(props) {
|
|
1275
|
+
const { labels: t, onlineStore } = useStoreData();
|
|
1276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { ...blockRoot(props, "hero__title"), children: props.text || onlineStore.hero.title || t.heroTitle });
|
|
1277
|
+
}
|
|
1278
|
+
});
|
|
1279
|
+
var StoreHeroSubtitle = defineBlock({
|
|
1280
|
+
type: "StoreHeroSubtitle",
|
|
1281
|
+
label: "Hero subtitle",
|
|
1282
|
+
description: "The line under the home page headline. Uses text when set, otherwise the hero subtitle from the store settings, otherwise a default.",
|
|
1283
|
+
category: "store",
|
|
1284
|
+
schema: import_zod7.z.object({ text: TextSchema.default("") }),
|
|
1285
|
+
fields: { text: { type: "textarea", label: "Text" } },
|
|
1286
|
+
render: function StoreHeroSubtitle2(props) {
|
|
1287
|
+
const { labels: t, onlineStore } = useStoreData();
|
|
1288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { ...blockRoot(props, "hero__subtitle"), children: props.text || onlineStore.hero.subtitle || t.heroSubtitle });
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
var StoreHeroButton = defineBlock({
|
|
1292
|
+
type: "StoreHeroButton",
|
|
1293
|
+
label: "Hero button",
|
|
1294
|
+
description: "The home page call to action. Links to all products. Uses label when set, otherwise the hero button label from the store settings.",
|
|
1295
|
+
category: "store",
|
|
1296
|
+
schema: import_zod7.z.object({
|
|
1297
|
+
label: TextSchema.default(""),
|
|
1298
|
+
href: import_zod7.z.string().max(500).regex(/^(https?:\/\/|\/|#)/, "A link must start with https://, / or #").default("/products")
|
|
1299
|
+
}),
|
|
1300
|
+
fields: {
|
|
1301
|
+
label: { type: "text", label: "Label" },
|
|
1302
|
+
href: { type: "text", label: "Link" }
|
|
1303
|
+
},
|
|
1304
|
+
render: function StoreHeroButton2(props) {
|
|
1305
|
+
const { labels: t, onlineStore } = useStoreData();
|
|
1306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { ...blockRoot(props, "btn"), href: props.href, children: props.label || onlineStore.hero.ctaLabel || t.shopNow });
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
var StoreHeroImage = defineBlock({
|
|
1310
|
+
type: "StoreHeroImage",
|
|
1311
|
+
label: "Hero image",
|
|
1312
|
+
description: "The hero image from the store settings, loaded first. Set frameClassName to wrap it in a div. Renders nothing when the store has no hero image.",
|
|
1313
|
+
category: "store",
|
|
1314
|
+
schema: import_zod7.z.object({ frameClassName: ClassNameSchema.default("") }),
|
|
1315
|
+
fields: { frameClassName: { type: "text", label: "Frame class" } },
|
|
1316
|
+
preload: (_props, data) => {
|
|
1317
|
+
const imageUrl = storeData(data).onlineStore.hero.imageUrl;
|
|
1318
|
+
return imageUrl ? [imageUrl] : [];
|
|
1319
|
+
},
|
|
1320
|
+
render: function StoreHeroImage2(props) {
|
|
1321
|
+
const { onlineStore } = useStoreData();
|
|
1322
|
+
if (!onlineStore.hero.imageUrl) return null;
|
|
1323
|
+
const image = (attributes) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1324
|
+
"img",
|
|
1325
|
+
{
|
|
1326
|
+
...attributes,
|
|
1327
|
+
src: onlineStore.hero.imageUrl,
|
|
1328
|
+
alt: onlineStore.name,
|
|
1329
|
+
fetchPriority: "high",
|
|
1330
|
+
decoding: "async"
|
|
1331
|
+
}
|
|
1332
|
+
);
|
|
1333
|
+
if (props.frameClassName) {
|
|
1334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...blockRoot(props, props.frameClassName), children: image({}) });
|
|
1335
|
+
}
|
|
1336
|
+
return image(blockRoot(props));
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
var StoreCategories = defineBlock({
|
|
1340
|
+
type: "StoreCategories",
|
|
1341
|
+
label: "Categories",
|
|
1342
|
+
description: "The store categories as links. layout nav renders a nav list, layout section renders a titled section. Renders nothing when the store has no categories.",
|
|
1343
|
+
category: "store",
|
|
1344
|
+
schema: import_zod7.z.object({
|
|
1345
|
+
layout: import_zod7.z.enum(["nav", "section"]).default("section"),
|
|
1346
|
+
listClassName: ClassNameSchema.default("categories"),
|
|
1347
|
+
itemStyle: import_zod7.z.enum(CategoryItemStyles).default("card"),
|
|
1348
|
+
title: TextSchema.default(""),
|
|
1349
|
+
titleLabel: LabelKeySchema.default("shopByCategory")
|
|
1350
|
+
}),
|
|
1351
|
+
fields: {
|
|
1352
|
+
layout: {
|
|
1353
|
+
type: "radio",
|
|
1354
|
+
label: "Layout",
|
|
1355
|
+
options: [
|
|
1356
|
+
{ label: "List", value: "nav" },
|
|
1357
|
+
{ label: "Titled section", value: "section" }
|
|
1358
|
+
]
|
|
1359
|
+
},
|
|
1360
|
+
listClassName: { type: "text", label: "List class" },
|
|
1361
|
+
itemStyle: {
|
|
1362
|
+
type: "select",
|
|
1363
|
+
label: "Item style",
|
|
1364
|
+
options: CategoryItemStyles.map((style) => ({ label: style, value: style }))
|
|
1365
|
+
},
|
|
1366
|
+
title: { type: "text", label: "Title" },
|
|
1367
|
+
titleLabel: { type: "select", label: "Default title", options: labelOptions }
|
|
1368
|
+
},
|
|
1369
|
+
render: function StoreCategories2(props) {
|
|
1370
|
+
const store = useStoreData();
|
|
1371
|
+
if (!store.categories.length) return null;
|
|
1372
|
+
const items = store.categories.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CategoryItem, { entry, itemStyle: props.itemStyle }, entry.trackingId));
|
|
1373
|
+
if (props.layout === "nav") {
|
|
1374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1375
|
+
"nav",
|
|
1376
|
+
{
|
|
1377
|
+
...blockRoot(props, props.listClassName),
|
|
1378
|
+
"aria-label": store.labels.categories,
|
|
1379
|
+
children: items
|
|
1380
|
+
}
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { ...blockRoot(props, "section"), children: [
|
|
1384
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SectionHead, { title: heading(store, props.title, props.titleLabel), viewAll: null }),
|
|
1385
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: props.listClassName, children: items })
|
|
1386
|
+
] });
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1389
|
+
var StoreProductGrid = defineBlock({
|
|
1390
|
+
type: "StoreProductGrid",
|
|
1391
|
+
label: "Product grid",
|
|
1392
|
+
description: "A titled section of product cards. source home shows the featured products first, related shows products from the same category on a product page.",
|
|
1393
|
+
category: "store",
|
|
1394
|
+
schema: import_zod7.z.object({
|
|
1395
|
+
source: import_zod7.z.enum(["home", "related"]).default("home"),
|
|
1396
|
+
gridClassName: ClassNameSchema.default(""),
|
|
1397
|
+
title: TextSchema.default(""),
|
|
1398
|
+
titleLabel: LabelKeySchema.default("bestSellers"),
|
|
1399
|
+
viewAll: import_zod7.z.boolean().default(true),
|
|
1400
|
+
hideWhenEmpty: import_zod7.z.boolean().default(true)
|
|
1401
|
+
}),
|
|
1402
|
+
fields: {
|
|
1403
|
+
source: {
|
|
1404
|
+
type: "radio",
|
|
1405
|
+
label: "Products",
|
|
1406
|
+
options: [
|
|
1407
|
+
{ label: "Home products", value: "home" },
|
|
1408
|
+
{ label: "Related products", value: "related" }
|
|
1409
|
+
]
|
|
1410
|
+
},
|
|
1411
|
+
gridClassName: { type: "text", label: "Grid class" },
|
|
1412
|
+
title: { type: "text", label: "Title" },
|
|
1413
|
+
titleLabel: { type: "select", label: "Default title", options: labelOptions },
|
|
1414
|
+
viewAll: {
|
|
1415
|
+
type: "radio",
|
|
1416
|
+
label: "View all link",
|
|
1417
|
+
options: [
|
|
1418
|
+
{ label: "Yes", value: true },
|
|
1419
|
+
{ label: "No", value: false }
|
|
1420
|
+
]
|
|
1421
|
+
},
|
|
1422
|
+
hideWhenEmpty: {
|
|
1423
|
+
type: "radio",
|
|
1424
|
+
label: "Hide when empty",
|
|
1425
|
+
options: [
|
|
1426
|
+
{ label: "Yes", value: true },
|
|
1427
|
+
{ label: "No", value: false }
|
|
1428
|
+
]
|
|
1429
|
+
}
|
|
1430
|
+
},
|
|
1431
|
+
render: function StoreProductGrid2(props) {
|
|
1432
|
+
var _a, _b;
|
|
1433
|
+
const store = useStoreData();
|
|
1434
|
+
const products2 = props.source === "related" ? (_b = (_a = store.productPage) == null ? void 0 : _a.related) != null ? _b : [] : store.homeProducts;
|
|
1435
|
+
if (props.hideWhenEmpty && !products2.length) return null;
|
|
1436
|
+
const money = moneyFormatter(store.money);
|
|
1437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { ...blockRoot(props, "section"), children: [
|
|
1438
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1439
|
+
SectionHead,
|
|
1440
|
+
{
|
|
1441
|
+
title: heading(store, props.title, props.titleLabel),
|
|
1442
|
+
viewAll: props.viewAll ? store.labels.viewAll : null
|
|
1443
|
+
}
|
|
1444
|
+
),
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `grid ${props.gridClassName}`, children: products2.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1446
|
+
ProductCard,
|
|
1447
|
+
{
|
|
1448
|
+
item,
|
|
1449
|
+
position: index,
|
|
1450
|
+
list: props.source,
|
|
1451
|
+
money
|
|
1452
|
+
},
|
|
1453
|
+
item.url
|
|
1454
|
+
)) })
|
|
1455
|
+
] });
|
|
1456
|
+
}
|
|
1457
|
+
});
|
|
1458
|
+
var TrustItems = [
|
|
1459
|
+
["cod", "codText"],
|
|
1460
|
+
["fastDelivery", "fastDeliveryText"],
|
|
1461
|
+
["confirmed", "confirmedText"],
|
|
1462
|
+
["easyReturns", "easyReturnsText"]
|
|
1463
|
+
];
|
|
1464
|
+
var StoreTrust = defineBlock({
|
|
1465
|
+
type: "StoreTrust",
|
|
1466
|
+
label: "Trust badges",
|
|
1467
|
+
description: "Cash on delivery, fast delivery, phone confirmation and easy returns, in the store language. variant bento shows them as tiles.",
|
|
1468
|
+
category: "store",
|
|
1469
|
+
schema: import_zod7.z.object({ variant: import_zod7.z.enum(["list", "bento"]).default("list") }),
|
|
1470
|
+
fields: {
|
|
1471
|
+
variant: {
|
|
1472
|
+
type: "radio",
|
|
1473
|
+
label: "Style",
|
|
1474
|
+
options: [
|
|
1475
|
+
{ label: "List", value: "list" },
|
|
1476
|
+
{ label: "Tiles", value: "bento" }
|
|
1477
|
+
]
|
|
1478
|
+
}
|
|
1479
|
+
},
|
|
1480
|
+
render: function StoreTrust2(props) {
|
|
1481
|
+
const { labels: t } = useStoreData();
|
|
1482
|
+
if (props.variant === "bento") {
|
|
1483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("section", { ...blockRoot(props, "bento"), style: { marginBlockStart: "8px" }, children: TrustItems.map(([title, text]) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "bento__tile", children: [
|
|
1484
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: t[title] }),
|
|
1485
|
+
t[text]
|
|
1486
|
+
] }, title)) });
|
|
1487
|
+
}
|
|
1488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("section", { ...blockRoot(props, "trust"), children: TrustItems.map(([title, text]) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "trust__item", children: [
|
|
1489
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: t[title] }),
|
|
1490
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t[text] })
|
|
1491
|
+
] }, title)) });
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1494
|
+
var StoreTagline = defineBlock({
|
|
1495
|
+
type: "StoreTagline",
|
|
1496
|
+
label: "Tagline",
|
|
1497
|
+
description: "The store tagline from the settings, as a quote section. Renders nothing when the store has no tagline.",
|
|
1498
|
+
category: "store",
|
|
1499
|
+
schema: import_zod7.z.object({}),
|
|
1500
|
+
fields: {},
|
|
1501
|
+
render: function StoreTagline2(props) {
|
|
1502
|
+
const { onlineStore } = useStoreData();
|
|
1503
|
+
if (!onlineStore.tagline) return null;
|
|
1504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("section", { ...blockRoot(props), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: onlineStore.tagline }) });
|
|
1505
|
+
}
|
|
1506
|
+
});
|
|
1507
|
+
var StoreTicker = defineBlock({
|
|
1508
|
+
type: "StoreTicker",
|
|
1509
|
+
label: "Ticker",
|
|
1510
|
+
description: "A scrolling strip that repeats the given labels.",
|
|
1511
|
+
category: "store",
|
|
1512
|
+
schema: import_zod7.z.object({
|
|
1513
|
+
labels: import_zod7.z.array(LabelKeySchema).max(4).default(["newArrivals", "cod"]),
|
|
1514
|
+
repeat: import_zod7.z.number().int().min(1).max(20).default(8)
|
|
1515
|
+
}),
|
|
1516
|
+
fields: {
|
|
1517
|
+
repeat: { type: "number", label: "Repeat" }
|
|
1518
|
+
},
|
|
1519
|
+
render: function StoreTicker2(props) {
|
|
1520
|
+
const { labels: t } = useStoreData();
|
|
1521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...blockRoot(props, "ticker"), "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "ticker__track", children: Array.from(
|
|
1522
|
+
{ length: props.repeat },
|
|
1523
|
+
(_, index) => props.labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t[label] }, `${index}-${label}`))
|
|
1524
|
+
) }) });
|
|
1525
|
+
}
|
|
1526
|
+
});
|
|
1527
|
+
var StoreSearch = defineBlock({
|
|
1528
|
+
type: "StoreSearch",
|
|
1529
|
+
label: "Search box",
|
|
1530
|
+
description: "A search field that opens all products filtered by the query.",
|
|
1531
|
+
category: "store",
|
|
1532
|
+
schema: import_zod7.z.object({}),
|
|
1533
|
+
fields: {},
|
|
1534
|
+
render: function StoreSearch2(props) {
|
|
1535
|
+
const { labels: t } = useStoreData();
|
|
1536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("form", { ...blockRoot(props, "home-search"), action: "/products", role: "search", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "search", name: "q", placeholder: t.search, "aria-label": t.search }) });
|
|
1537
|
+
}
|
|
1538
|
+
});
|
|
1539
|
+
var Ornament = defineBlock({
|
|
1540
|
+
type: "Ornament",
|
|
1541
|
+
label: "Ornament",
|
|
1542
|
+
description: "An empty decorative element, drawn by its class and css.",
|
|
1543
|
+
category: "store",
|
|
1544
|
+
schema: import_zod7.z.object({}),
|
|
1545
|
+
fields: {},
|
|
1546
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...blockRoot(props), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", {}) })
|
|
1547
|
+
});
|
|
1548
|
+
var StorePageHeading = defineBlock({
|
|
1549
|
+
type: "StorePageHeading",
|
|
1550
|
+
label: "Page heading",
|
|
1551
|
+
description: "The page title. source listing shows the category or all products with the product count, contact shows the contact title and intro, article shows the page title.",
|
|
1552
|
+
category: "store",
|
|
1553
|
+
schema: import_zod7.z.object({
|
|
1554
|
+
source: import_zod7.z.enum(["listing", "contact", "article"]).default("listing"),
|
|
1555
|
+
title: TextSchema.default(""),
|
|
1556
|
+
text: TextSchema.default("")
|
|
1557
|
+
}),
|
|
1558
|
+
fields: {
|
|
1559
|
+
source: {
|
|
1560
|
+
type: "select",
|
|
1561
|
+
label: "Page",
|
|
1562
|
+
options: [
|
|
1563
|
+
{ label: "Listing", value: "listing" },
|
|
1564
|
+
{ label: "Contact", value: "contact" },
|
|
1565
|
+
{ label: "Article", value: "article" }
|
|
1566
|
+
]
|
|
1567
|
+
},
|
|
1568
|
+
title: { type: "text", label: "Title" },
|
|
1569
|
+
text: { type: "textarea", label: "Text" }
|
|
1570
|
+
},
|
|
1571
|
+
render: function StorePageHeading2(props) {
|
|
1572
|
+
var _a, _b;
|
|
1573
|
+
const store = useStoreData();
|
|
1574
|
+
const t = store.labels;
|
|
1575
|
+
if (props.source === "listing") {
|
|
1576
|
+
const listing2 = store.listing;
|
|
1577
|
+
const title = props.title || ((listing2 == null ? void 0 : listing2.category) ? listing2.category.name : t.allProducts);
|
|
1578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { ...blockRoot(props, "page-head"), children: [
|
|
1579
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { children: title }),
|
|
1580
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: props.text || `${(_a = listing2 == null ? void 0 : listing2.products.length) != null ? _a : 0} ${t.productsCount}` })
|
|
1581
|
+
] });
|
|
1582
|
+
}
|
|
1583
|
+
if (props.source === "contact") {
|
|
1584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { ...blockRoot(props, "page-head"), children: [
|
|
1585
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { children: props.title || t.contact }),
|
|
1586
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: props.text || t.contactIntro })
|
|
1587
|
+
] });
|
|
1588
|
+
}
|
|
1589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { ...blockRoot(props, "page-head"), children: [
|
|
1590
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { children: props.title || ((_b = store.article) == null ? void 0 : _b.title) }),
|
|
1591
|
+
props.text ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: props.text }) : null
|
|
1592
|
+
] });
|
|
1593
|
+
}
|
|
1594
|
+
});
|
|
1595
|
+
var ListingToolbar = defineBlock({
|
|
1596
|
+
type: "ListingToolbar",
|
|
1597
|
+
label: "Listing toolbar",
|
|
1598
|
+
description: "Category filters (on all products only), the search field and the sort menu of a product listing.",
|
|
1599
|
+
category: "store",
|
|
1600
|
+
schema: import_zod7.z.object({}),
|
|
1601
|
+
fields: {},
|
|
1602
|
+
render: function ListingToolbar2(props) {
|
|
1603
|
+
const { labels: t, categories: categories2, listing: listing2 } = useStoreData();
|
|
1604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ...blockRoot(props, "toolbar"), children: [
|
|
1605
|
+
!(listing2 == null ? void 0 : listing2.category) && categories2.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "toolbar__filters", children: [
|
|
1606
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "chip is-active", "data-filter-category": "", children: t.all }),
|
|
1607
|
+
categories2.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1608
|
+
"button",
|
|
1609
|
+
{
|
|
1610
|
+
type: "button",
|
|
1611
|
+
className: "chip",
|
|
1612
|
+
"data-filter-category": entry.trackingId,
|
|
1613
|
+
children: entry.name
|
|
1614
|
+
},
|
|
1615
|
+
entry.trackingId
|
|
1616
|
+
))
|
|
1617
|
+
] }) : null,
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1619
|
+
"input",
|
|
1620
|
+
{
|
|
1621
|
+
className: "search-input",
|
|
1622
|
+
type: "search",
|
|
1623
|
+
"data-store": "search",
|
|
1624
|
+
placeholder: t.search,
|
|
1625
|
+
"aria-label": t.search
|
|
1626
|
+
}
|
|
1627
|
+
),
|
|
1628
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("select", { "data-store": "sort", "aria-label": t.sortBy, children: [
|
|
1629
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "position", children: t.sortFeatured }),
|
|
1630
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "price-asc", children: t.sortPriceAsc }),
|
|
1631
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "price-desc", children: t.sortPriceDesc })
|
|
1632
|
+
] })
|
|
1633
|
+
] });
|
|
1634
|
+
}
|
|
1635
|
+
});
|
|
1636
|
+
var ListingGrid = defineBlock({
|
|
1637
|
+
type: "ListingGrid",
|
|
1638
|
+
label: "Listing products",
|
|
1639
|
+
description: "The product cards of a listing page, filtered and sorted in the browser.",
|
|
1640
|
+
category: "store",
|
|
1641
|
+
schema: import_zod7.z.object({}),
|
|
1642
|
+
fields: {},
|
|
1643
|
+
render: function ListingGrid2(props) {
|
|
1644
|
+
var _a, _b;
|
|
1645
|
+
const store = useStoreData();
|
|
1646
|
+
const money = moneyFormatter(store.money);
|
|
1647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...blockRoot(props, "grid"), "data-store": "listing", children: ((_b = (_a = store.listing) == null ? void 0 : _a.products) != null ? _b : []).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1648
|
+
ProductCard,
|
|
1649
|
+
{
|
|
1650
|
+
item,
|
|
1651
|
+
position: index,
|
|
1652
|
+
list: "listing",
|
|
1653
|
+
money
|
|
1654
|
+
},
|
|
1655
|
+
item.url
|
|
1656
|
+
)) });
|
|
1657
|
+
}
|
|
1658
|
+
});
|
|
1659
|
+
var ListingEmpty = defineBlock({
|
|
1660
|
+
type: "ListingEmpty",
|
|
1661
|
+
label: "No results",
|
|
1662
|
+
description: "The message shown when the listing filters match no product.",
|
|
1663
|
+
category: "store",
|
|
1664
|
+
schema: import_zod7.z.object({ text: TextSchema.default("") }),
|
|
1665
|
+
fields: { text: { type: "text", label: "Text" } },
|
|
1666
|
+
render: function ListingEmpty2(props) {
|
|
1667
|
+
const { labels: t } = useStoreData();
|
|
1668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { ...blockRoot(props, "empty"), "data-store": "empty", hidden: true, children: props.text || t.noProducts });
|
|
1669
|
+
}
|
|
1670
|
+
});
|
|
1671
|
+
var ListingLoadMore = defineBlock({
|
|
1672
|
+
type: "ListingLoadMore",
|
|
1673
|
+
label: "Load more",
|
|
1674
|
+
description: "The button that shows the next products of a long listing.",
|
|
1675
|
+
category: "store",
|
|
1676
|
+
schema: import_zod7.z.object({ label: TextSchema.default("") }),
|
|
1677
|
+
fields: { label: { type: "text", label: "Label" } },
|
|
1678
|
+
render: function ListingLoadMore2(props) {
|
|
1679
|
+
const { labels: t } = useStoreData();
|
|
1680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...blockRoot(props, "more"), "data-store": "load-more", hidden: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "btn btn--ghost", children: props.label || t.loadMore }) });
|
|
1681
|
+
}
|
|
1682
|
+
});
|
|
1683
|
+
var StoreProductGallery = defineBlock({
|
|
1684
|
+
type: "StoreProductGallery",
|
|
1685
|
+
label: "Product gallery",
|
|
1686
|
+
description: "The product page images with thumbnails. The first image loads first.",
|
|
1687
|
+
category: "store",
|
|
1688
|
+
schema: import_zod7.z.object({}),
|
|
1689
|
+
fields: {},
|
|
1690
|
+
preload: (_props, data) => {
|
|
1691
|
+
var _a, _b;
|
|
1692
|
+
return ((_b = (_a = storeData(data).productPage) == null ? void 0 : _a.gallery) != null ? _b : []).slice(0, 1);
|
|
1693
|
+
},
|
|
1694
|
+
render: function StoreProductGallery2(props) {
|
|
1695
|
+
var _a, _b;
|
|
1696
|
+
const store = useStoreData();
|
|
1697
|
+
const { product: product2 } = useCheckoutData();
|
|
1698
|
+
const gallery = (_b = (_a = store.productPage) == null ? void 0 : _a.gallery) != null ? _b : [];
|
|
1699
|
+
const name = product2.name;
|
|
1700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { ...blockRoot(props, "pdp__media"), "data-funnel": "lead-images", children: [
|
|
1701
|
+
gallery.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1702
|
+
"img",
|
|
1703
|
+
{
|
|
1704
|
+
className: "pdp__main",
|
|
1705
|
+
"data-gallery-main": "",
|
|
1706
|
+
src: gallery[0],
|
|
1707
|
+
alt: name,
|
|
1708
|
+
fetchPriority: "high",
|
|
1709
|
+
decoding: "async"
|
|
1710
|
+
}
|
|
1711
|
+
) : null,
|
|
1712
|
+
gallery.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "pdp__thumbs", children: gallery.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1713
|
+
"img",
|
|
1714
|
+
{
|
|
1715
|
+
src: image,
|
|
1716
|
+
alt: name,
|
|
1717
|
+
"data-gallery-thumb": "",
|
|
1718
|
+
className: index === 0 ? "is-active" : void 0,
|
|
1719
|
+
loading: index === 0 ? void 0 : "lazy",
|
|
1720
|
+
decoding: "async"
|
|
1721
|
+
},
|
|
1722
|
+
`${index}-${image}`
|
|
1723
|
+
)) }) : null
|
|
1724
|
+
] });
|
|
1725
|
+
}
|
|
1726
|
+
});
|
|
1727
|
+
var StoreBreadcrumbs = defineBlock({
|
|
1728
|
+
type: "StoreBreadcrumbs",
|
|
1729
|
+
label: "Breadcrumbs",
|
|
1730
|
+
description: "Home and the product category above the product name.",
|
|
1731
|
+
category: "store",
|
|
1732
|
+
schema: import_zod7.z.object({}),
|
|
1733
|
+
fields: {},
|
|
1734
|
+
render: function StoreBreadcrumbs2(props) {
|
|
1735
|
+
const { labels: t, productPage } = useStoreData();
|
|
1736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("nav", { ...blockRoot(props, "crumbs"), "aria-label": t.menu, children: [
|
|
1737
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/", children: t.home }),
|
|
1738
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "/" }),
|
|
1739
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: "/products", children: (productPage == null ? void 0 : productPage.categoryName) || t.allProducts })
|
|
1740
|
+
] });
|
|
1741
|
+
}
|
|
1742
|
+
});
|
|
1743
|
+
var StoreProductTitle = defineBlock({
|
|
1744
|
+
type: "StoreProductTitle",
|
|
1745
|
+
label: "Product name",
|
|
1746
|
+
description: "The product name on a store product page.",
|
|
1747
|
+
category: "store",
|
|
1748
|
+
schema: import_zod7.z.object({}),
|
|
1749
|
+
fields: {},
|
|
1750
|
+
render: function StoreProductTitle2(props) {
|
|
1751
|
+
const { product: product2 } = useCheckoutData();
|
|
1752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { ...blockRoot(props, "pdp__title"), "data-funnel": "product-name", children: product2.name });
|
|
1753
|
+
}
|
|
1754
|
+
});
|
|
1755
|
+
var StoreProductPrice = defineBlock({
|
|
1756
|
+
type: "StoreProductPrice",
|
|
1757
|
+
label: "Product price",
|
|
1758
|
+
description: "The product price on a store product page. The checkout replaces it with the price of the chosen offer.",
|
|
1759
|
+
category: "store",
|
|
1760
|
+
schema: import_zod7.z.object({}),
|
|
1761
|
+
fields: {},
|
|
1762
|
+
render: function StoreProductPrice2(props) {
|
|
1763
|
+
var _a, _b;
|
|
1764
|
+
const store = useStoreData();
|
|
1765
|
+
const money = moneyFormatter(store.money);
|
|
1766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ...blockRoot(props, "cs-price"), "data-funnel": "price", children: [
|
|
1767
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "cs-price__current", "data-display-price": "", children: money((_b = (_a = store.productPage) == null ? void 0 : _a.price) != null ? _b : 0) }),
|
|
1768
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "cs-price__compare", "data-compare-price": "" })
|
|
1769
|
+
] });
|
|
1770
|
+
}
|
|
1771
|
+
});
|
|
1772
|
+
var StoreProductDescription = defineBlock({
|
|
1773
|
+
type: "StoreProductDescription",
|
|
1774
|
+
label: "Product description",
|
|
1775
|
+
description: "The landing page images of the product, or its text description when it has no images. Renders nothing when it has neither.",
|
|
1776
|
+
category: "store",
|
|
1777
|
+
schema: import_zod7.z.object({}),
|
|
1778
|
+
fields: {},
|
|
1779
|
+
render: function StoreProductDescription2(props) {
|
|
1780
|
+
const { product: product2, landingPage } = useCheckoutData();
|
|
1781
|
+
if (landingPage.images.length) {
|
|
1782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("section", { ...blockRoot(props, "pdp-images"), "data-funnel": "description", children: landingPage.images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1783
|
+
"img",
|
|
1784
|
+
{
|
|
1785
|
+
src: image,
|
|
1786
|
+
alt: product2.name,
|
|
1787
|
+
loading: "lazy",
|
|
1788
|
+
decoding: "async"
|
|
1789
|
+
},
|
|
1790
|
+
`${index}-${image}`
|
|
1791
|
+
)) });
|
|
1792
|
+
}
|
|
1793
|
+
if (!product2.description) return null;
|
|
1794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("section", { ...blockRoot(props, "pdp-text"), "data-funnel": "description", children: product2.description });
|
|
1795
|
+
}
|
|
1796
|
+
});
|
|
1797
|
+
var StoreProductFaq = defineBlock({
|
|
1798
|
+
type: "StoreProductFaq",
|
|
1799
|
+
label: "Product FAQ",
|
|
1800
|
+
description: "The product questions and answers. Renders nothing when there are none.",
|
|
1801
|
+
category: "store",
|
|
1802
|
+
schema: import_zod7.z.object({}),
|
|
1803
|
+
fields: {},
|
|
1804
|
+
render: function StoreProductFaq2(props) {
|
|
1805
|
+
const { product: product2 } = useCheckoutData();
|
|
1806
|
+
if (!product2.faq.length) return null;
|
|
1807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("section", { ...blockRoot(props, "pdp-faq"), "data-funnel": "faq", children: product2.faq.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { children: [
|
|
1808
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("summary", { children: entry.question }),
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: entry.answer })
|
|
1810
|
+
] }, index)) });
|
|
1811
|
+
}
|
|
1812
|
+
});
|
|
1813
|
+
var ContactDetails = defineBlock({
|
|
1814
|
+
type: "ContactDetails",
|
|
1815
|
+
label: "Contact details",
|
|
1816
|
+
description: "WhatsApp, phone, email and address from the store settings, each when set.",
|
|
1817
|
+
category: "store",
|
|
1818
|
+
schema: import_zod7.z.object({}),
|
|
1819
|
+
fields: {},
|
|
1820
|
+
render: function ContactDetails2(props) {
|
|
1821
|
+
const { labels: t, onlineStore } = useStoreData();
|
|
1822
|
+
const { contact: contact2 } = onlineStore;
|
|
1823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ...blockRoot(props, "contact__info"), children: [
|
|
1824
|
+
contact2.whatsapp ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "contact__row", children: [
|
|
1825
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t.whatsapp }),
|
|
1826
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1827
|
+
"a",
|
|
1828
|
+
{
|
|
1829
|
+
dir: "ltr",
|
|
1830
|
+
href: `https://wa.me/${trimmed(contact2.whatsapp, ["+", " "])}`,
|
|
1831
|
+
rel: "noopener noreferrer",
|
|
1832
|
+
target: "_blank",
|
|
1833
|
+
"data-track": "contact",
|
|
1834
|
+
"data-channel": "whatsapp",
|
|
1835
|
+
children: contact2.whatsapp
|
|
1836
|
+
}
|
|
1837
|
+
)
|
|
1838
|
+
] }) : null,
|
|
1839
|
+
contact2.phone ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "contact__row", children: [
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t.phone }),
|
|
1841
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1842
|
+
"a",
|
|
1843
|
+
{
|
|
1844
|
+
dir: "ltr",
|
|
1845
|
+
href: `tel:${trimmed(contact2.phone, [" "])}`,
|
|
1846
|
+
"data-track": "contact",
|
|
1847
|
+
"data-channel": "phone",
|
|
1848
|
+
children: contact2.phone
|
|
1849
|
+
}
|
|
1850
|
+
)
|
|
1851
|
+
] }) : null,
|
|
1852
|
+
contact2.email ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "contact__row", children: [
|
|
1853
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t.email }),
|
|
1854
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1855
|
+
"a",
|
|
1856
|
+
{
|
|
1857
|
+
href: `mailto:${contact2.email}`,
|
|
1858
|
+
"data-track": "contact",
|
|
1859
|
+
"data-channel": "email",
|
|
1860
|
+
children: contact2.email
|
|
1861
|
+
}
|
|
1862
|
+
)
|
|
1863
|
+
] }) : null,
|
|
1864
|
+
contact2.address ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "contact__row", children: [
|
|
1865
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t.address }),
|
|
1866
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: contact2.address })
|
|
1867
|
+
] }) : null
|
|
1868
|
+
] });
|
|
1869
|
+
}
|
|
1870
|
+
});
|
|
1871
|
+
var ContactFields = [
|
|
1872
|
+
{ name: "name", label: "yourName", type: "text", autoComplete: "name" },
|
|
1873
|
+
{ name: "phone", label: "yourPhone", type: "tel", autoComplete: "tel" },
|
|
1874
|
+
{ name: "email", label: "yourEmail", type: "email", autoComplete: "email" }
|
|
1875
|
+
];
|
|
1876
|
+
var ContactForm = defineBlock({
|
|
1877
|
+
type: "ContactForm",
|
|
1878
|
+
label: "Contact form",
|
|
1879
|
+
description: "The contact form (name, phone, optional email, message) with its success message. Messages reach the merchant inbox.",
|
|
1880
|
+
category: "store",
|
|
1881
|
+
schema: import_zod7.z.object({}),
|
|
1882
|
+
fields: {},
|
|
1883
|
+
render: function ContactForm2(props) {
|
|
1884
|
+
const { labels: t } = useStoreData();
|
|
1885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ...blockRoot(props), children: [
|
|
1886
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { className: "form", "data-store": "contact-form", noValidate: true, children: [
|
|
1887
|
+
ContactFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "field", "data-contact-wrap": "", children: [
|
|
1888
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: `contact-${field.name}`, children: t[field.label] }),
|
|
1889
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1890
|
+
"input",
|
|
1891
|
+
{
|
|
1892
|
+
id: `contact-${field.name}`,
|
|
1893
|
+
name: field.name,
|
|
1894
|
+
type: field.type === "text" ? void 0 : field.type,
|
|
1895
|
+
autoComplete: field.autoComplete,
|
|
1896
|
+
"data-contact-field": field.name
|
|
1897
|
+
}
|
|
1898
|
+
),
|
|
1899
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "field__error", "data-error": "" })
|
|
1900
|
+
] }, field.name)),
|
|
1901
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "field", "data-contact-wrap": "", children: [
|
|
1902
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: "contact-message", children: t.yourMessage }),
|
|
1903
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1904
|
+
"textarea",
|
|
1905
|
+
{
|
|
1906
|
+
id: "contact-message",
|
|
1907
|
+
name: "message",
|
|
1908
|
+
"data-contact-field": "message"
|
|
1909
|
+
}
|
|
1910
|
+
),
|
|
1911
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "field__error", "data-error": "" })
|
|
1912
|
+
] }),
|
|
1913
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "form__error", "data-store": "contact-error", hidden: true }),
|
|
1914
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: "btn", type: "submit", children: t.send })
|
|
1915
|
+
] }),
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "notice", "data-store": "contact-success", hidden: true, children: [
|
|
1917
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: t.messageSent }),
|
|
1918
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t.messageSentText })
|
|
1919
|
+
] })
|
|
1920
|
+
] });
|
|
1921
|
+
}
|
|
1922
|
+
});
|
|
1923
|
+
var OrderRows = [
|
|
1924
|
+
["offer", "offer", false],
|
|
1925
|
+
["customer", "customer", false],
|
|
1926
|
+
["phone", "phone", true],
|
|
1927
|
+
["delivery", "state", false],
|
|
1928
|
+
["city", "city", false],
|
|
1929
|
+
["deliveryAddress", "address", false]
|
|
1930
|
+
];
|
|
1931
|
+
var StoreThankYou = defineBlock({
|
|
1932
|
+
type: "StoreThankYou",
|
|
1933
|
+
label: "Thank you",
|
|
1934
|
+
description: "The thank-you message and the order summary the checkout fills in from the browser, with a link back to the products.",
|
|
1935
|
+
category: "store",
|
|
1936
|
+
schema: import_zod7.z.object({
|
|
1937
|
+
title: TextSchema.default(""),
|
|
1938
|
+
text: TextSchema.default("")
|
|
1939
|
+
}),
|
|
1940
|
+
fields: {
|
|
1941
|
+
title: { type: "text", label: "Title" },
|
|
1942
|
+
text: { type: "textarea", label: "Text" }
|
|
1943
|
+
},
|
|
1944
|
+
render: function StoreThankYou2(props) {
|
|
1945
|
+
const { labels: t } = useStoreData();
|
|
1946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ...blockRoot(props, "wrap"), "data-store": "thank-you", children: [
|
|
1947
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "center", children: [
|
|
1948
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { children: props.title || t.thankYouTitle }),
|
|
1949
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: props.text || t.thankYouText })
|
|
1950
|
+
] }),
|
|
1951
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "order", "data-store": "order-details", hidden: true, children: [
|
|
1952
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { children: t.orderDetails }),
|
|
1953
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "order__product", children: [
|
|
1954
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("img", { "data-order-image": "", alt: "", hidden: true }),
|
|
1955
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { "data-order": "product" })
|
|
1956
|
+
] }),
|
|
1957
|
+
OrderRows.map(([label, field, ltr]) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "order__row", "data-order-row": "", children: [
|
|
1958
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t[label] }),
|
|
1959
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "data-order": field, dir: ltr ? "ltr" : void 0 })
|
|
1960
|
+
] }, field)),
|
|
1961
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "order__row", children: [
|
|
1962
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t.productsPrice }),
|
|
1963
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "data-order": "products" })
|
|
1964
|
+
] }),
|
|
1965
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "order__row", children: [
|
|
1966
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t.delivery }),
|
|
1967
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "data-order": "shipping" })
|
|
1968
|
+
] }),
|
|
1969
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "order__row order__row--total", children: [
|
|
1970
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: t.total }),
|
|
1971
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "data-order": "total" })
|
|
1972
|
+
] })
|
|
1973
|
+
] }),
|
|
1974
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { className: "btn", href: "/products", children: t.keepShopping }) })
|
|
1975
|
+
] });
|
|
1976
|
+
}
|
|
1977
|
+
});
|
|
1978
|
+
var StoreNotFound = defineBlock({
|
|
1979
|
+
type: "StoreNotFound",
|
|
1980
|
+
label: "Not found",
|
|
1981
|
+
description: "The message of the 404 page with a link back home.",
|
|
1982
|
+
category: "store",
|
|
1983
|
+
schema: import_zod7.z.object({
|
|
1984
|
+
title: TextSchema.default(""),
|
|
1985
|
+
text: TextSchema.default("")
|
|
1986
|
+
}),
|
|
1987
|
+
fields: {
|
|
1988
|
+
title: { type: "text", label: "Title" },
|
|
1989
|
+
text: { type: "textarea", label: "Text" }
|
|
1990
|
+
},
|
|
1991
|
+
render: function StoreNotFound2(props) {
|
|
1992
|
+
const { labels: t } = useStoreData();
|
|
1993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ...blockRoot(props, "center"), children: [
|
|
1994
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { children: props.title || t.notFoundTitle }),
|
|
1995
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: props.text || t.notFoundText }),
|
|
1996
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { className: "btn", href: "/", children: t.backHome })
|
|
1997
|
+
] });
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
2000
|
+
var StoreArticle = defineBlock({
|
|
2001
|
+
type: "StoreArticle",
|
|
2002
|
+
label: "Page text",
|
|
2003
|
+
description: "The text of an about or policy page, written in the store settings. Headings and lists come from the settings text.",
|
|
2004
|
+
category: "store",
|
|
2005
|
+
schema: import_zod7.z.object({}),
|
|
2006
|
+
fields: {},
|
|
2007
|
+
render: function StoreArticle2(props) {
|
|
2008
|
+
var _a;
|
|
2009
|
+
const { article: article2 } = useStoreData();
|
|
2010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2011
|
+
"article",
|
|
2012
|
+
{
|
|
2013
|
+
...blockRoot(props, "article"),
|
|
2014
|
+
dangerouslySetInnerHTML: { __html: (_a = article2 == null ? void 0 : article2.html) != null ? _a : "" }
|
|
2015
|
+
}
|
|
2016
|
+
);
|
|
2017
|
+
}
|
|
2018
|
+
});
|
|
2019
|
+
|
|
971
2020
|
// src/blocks/index.ts
|
|
972
2021
|
var definitions = [
|
|
973
2022
|
Section,
|
|
@@ -986,30 +2035,60 @@ var definitions = [
|
|
|
986
2035
|
ProductDescription,
|
|
987
2036
|
ProductFaq,
|
|
988
2037
|
ProductCatalog,
|
|
989
|
-
OrderForm
|
|
2038
|
+
OrderForm,
|
|
2039
|
+
AnnouncementBar,
|
|
2040
|
+
StoreHeader,
|
|
2041
|
+
StoreFooter,
|
|
2042
|
+
StoreHeroTitle,
|
|
2043
|
+
StoreHeroSubtitle,
|
|
2044
|
+
StoreHeroButton,
|
|
2045
|
+
StoreHeroImage,
|
|
2046
|
+
StoreCategories,
|
|
2047
|
+
StoreProductGrid,
|
|
2048
|
+
StoreTrust,
|
|
2049
|
+
StoreTagline,
|
|
2050
|
+
StoreTicker,
|
|
2051
|
+
StoreSearch,
|
|
2052
|
+
Ornament,
|
|
2053
|
+
StorePageHeading,
|
|
2054
|
+
ListingToolbar,
|
|
2055
|
+
ListingGrid,
|
|
2056
|
+
ListingEmpty,
|
|
2057
|
+
ListingLoadMore,
|
|
2058
|
+
StoreProductGallery,
|
|
2059
|
+
StoreBreadcrumbs,
|
|
2060
|
+
StoreProductTitle,
|
|
2061
|
+
StoreProductPrice,
|
|
2062
|
+
StoreProductDescription,
|
|
2063
|
+
StoreProductFaq,
|
|
2064
|
+
ContactDetails,
|
|
2065
|
+
ContactForm,
|
|
2066
|
+
StoreThankYou,
|
|
2067
|
+
StoreNotFound,
|
|
2068
|
+
StoreArticle
|
|
990
2069
|
];
|
|
991
2070
|
var blocks = Object.fromEntries(
|
|
992
2071
|
definitions.map((definition) => [definition.type, definition])
|
|
993
2072
|
);
|
|
994
2073
|
|
|
995
2074
|
// src/validate.ts
|
|
996
|
-
var
|
|
997
|
-
var FontSchema =
|
|
998
|
-
family:
|
|
999
|
-
weights:
|
|
2075
|
+
var import_zod8 = require("zod");
|
|
2076
|
+
var FontSchema = import_zod8.z.object({
|
|
2077
|
+
family: import_zod8.z.string().min(1).max(60).regex(/^[A-Za-z0-9 ]+$/, "A font family can only contain letters, digits and spaces"),
|
|
2078
|
+
weights: import_zod8.z.array(import_zod8.z.number().int().min(100).max(900)).max(9).default([400, 700])
|
|
1000
2079
|
});
|
|
1001
|
-
var PageRootPropsSchema =
|
|
2080
|
+
var PageRootPropsSchema = import_zod8.z.object({
|
|
1002
2081
|
css: CssSchema.optional(),
|
|
1003
|
-
fonts:
|
|
2082
|
+
fonts: import_zod8.z.array(FontSchema).max(4).optional()
|
|
1004
2083
|
});
|
|
1005
|
-
var DocumentShapeSchema =
|
|
1006
|
-
root:
|
|
1007
|
-
content:
|
|
2084
|
+
var DocumentShapeSchema = import_zod8.z.object({
|
|
2085
|
+
root: import_zod8.z.object({ props: import_zod8.z.unknown() }).default({ props: {} }),
|
|
2086
|
+
content: import_zod8.z.array(import_zod8.z.unknown())
|
|
1008
2087
|
});
|
|
1009
2088
|
function blockPropsSchema(definition) {
|
|
1010
2089
|
return BaseBlockPropsSchema.extend(definition.schema.shape).extend(
|
|
1011
2090
|
Object.fromEntries(
|
|
1012
|
-
definition.slots.map((slot) => [slot,
|
|
2091
|
+
definition.slots.map((slot) => [slot, import_zod8.z.array(BlockNodeSchema).default([])])
|
|
1013
2092
|
)
|
|
1014
2093
|
);
|
|
1015
2094
|
}
|
|
@@ -1166,18 +2245,18 @@ function pageFontStylesheets(document) {
|
|
|
1166
2245
|
}
|
|
1167
2246
|
|
|
1168
2247
|
// src/json-schema.ts
|
|
1169
|
-
var
|
|
2248
|
+
var import_zod9 = require("zod");
|
|
1170
2249
|
function pageJsonSchema() {
|
|
1171
2250
|
return {
|
|
1172
2251
|
format: "A page is { root: { props }, content: Block[] }. A block is { type, props: { id, ...props } }. Ids are unique on the page. Slot props hold Block[]. Every block accepts style (CSS properties in camelCase, with tablet and mobile overrides) and css (CSS scoped to the block, nesting allowed, & is the block).",
|
|
1173
|
-
root:
|
|
2252
|
+
root: import_zod9.z.toJSONSchema(PageRootPropsSchema, { io: "input" }),
|
|
1174
2253
|
blocks: Object.values(blocks).map((definition) => ({
|
|
1175
2254
|
type: definition.type,
|
|
1176
2255
|
label: definition.label,
|
|
1177
2256
|
description: definition.description,
|
|
1178
2257
|
category: definition.category,
|
|
1179
2258
|
slots: definition.slots,
|
|
1180
|
-
props:
|
|
2259
|
+
props: import_zod9.z.toJSONSchema(blockPropsSchema(definition), { io: "input" })
|
|
1181
2260
|
}))
|
|
1182
2261
|
};
|
|
1183
2262
|
}
|
|
@@ -1237,6 +2316,257 @@ function funnelTemplate(templateId, options) {
|
|
|
1237
2316
|
throw new Error(`Unknown funnel template ${templateId}`);
|
|
1238
2317
|
}
|
|
1239
2318
|
|
|
2319
|
+
// src/templates/online-stores.ts
|
|
2320
|
+
var OnlineStoreTemplateIds = [
|
|
2321
|
+
"maison",
|
|
2322
|
+
"atelier",
|
|
2323
|
+
"noor",
|
|
2324
|
+
"block",
|
|
2325
|
+
"glow",
|
|
2326
|
+
"oud",
|
|
2327
|
+
"circuit",
|
|
2328
|
+
"hearth",
|
|
2329
|
+
"pebble",
|
|
2330
|
+
"souq"
|
|
2331
|
+
];
|
|
2332
|
+
var OnlineStorePageTypes = [
|
|
2333
|
+
"header",
|
|
2334
|
+
"footer",
|
|
2335
|
+
"home",
|
|
2336
|
+
"all-products",
|
|
2337
|
+
"category",
|
|
2338
|
+
"product",
|
|
2339
|
+
"thank-you",
|
|
2340
|
+
"contact",
|
|
2341
|
+
"about",
|
|
2342
|
+
"privacy-policy",
|
|
2343
|
+
"refund-policy",
|
|
2344
|
+
"terms-of-service",
|
|
2345
|
+
"not-found"
|
|
2346
|
+
];
|
|
2347
|
+
function block2(type, id, props = {}) {
|
|
2348
|
+
return { type, props: { id, ...props } };
|
|
2349
|
+
}
|
|
2350
|
+
function page2(content) {
|
|
2351
|
+
return { root: { props: {} }, content };
|
|
2352
|
+
}
|
|
2353
|
+
function stack(id, className, content) {
|
|
2354
|
+
return block2("Stack", id, { className, content });
|
|
2355
|
+
}
|
|
2356
|
+
function section(id, className, content) {
|
|
2357
|
+
return block2("Section", id, { tag: "section", className, content });
|
|
2358
|
+
}
|
|
2359
|
+
function heroText() {
|
|
2360
|
+
return [
|
|
2361
|
+
block2("StoreHeroTitle", "hero-title"),
|
|
2362
|
+
block2("StoreHeroSubtitle", "hero-subtitle"),
|
|
2363
|
+
block2("StoreHeroButton", "hero-button")
|
|
2364
|
+
];
|
|
2365
|
+
}
|
|
2366
|
+
function heroImage(className = "") {
|
|
2367
|
+
return block2("StoreHeroImage", "hero-image", className ? { className } : {});
|
|
2368
|
+
}
|
|
2369
|
+
function categories(props = {}) {
|
|
2370
|
+
return block2("StoreCategories", "categories", props);
|
|
2371
|
+
}
|
|
2372
|
+
function categoryNav(listClassName, itemStyle) {
|
|
2373
|
+
return categories({ layout: "nav", listClassName, itemStyle });
|
|
2374
|
+
}
|
|
2375
|
+
function products(titleLabel, gridClassName = "") {
|
|
2376
|
+
return block2("StoreProductGrid", "products", {
|
|
2377
|
+
source: "home",
|
|
2378
|
+
titleLabel,
|
|
2379
|
+
gridClassName,
|
|
2380
|
+
hideWhenEmpty: false
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2383
|
+
function trust() {
|
|
2384
|
+
return block2("StoreTrust", "trust");
|
|
2385
|
+
}
|
|
2386
|
+
var homes = {
|
|
2387
|
+
maison: () => [
|
|
2388
|
+
section("hero", "hero", [
|
|
2389
|
+
heroImage("hero__image"),
|
|
2390
|
+
stack("hero-text", "hero__text", heroText())
|
|
2391
|
+
]),
|
|
2392
|
+
stack("main", "wrap", [
|
|
2393
|
+
categories(),
|
|
2394
|
+
block2("StoreTagline", "story", { className: "story" }),
|
|
2395
|
+
products("bestSellers"),
|
|
2396
|
+
trust()
|
|
2397
|
+
])
|
|
2398
|
+
],
|
|
2399
|
+
atelier: () => [
|
|
2400
|
+
section("hero", "split", [
|
|
2401
|
+
stack("hero-text", "split__text", heroText()),
|
|
2402
|
+
stack("hero-media", "split__media", [heroImage()])
|
|
2403
|
+
]),
|
|
2404
|
+
stack("main", "wrap", [
|
|
2405
|
+
categoryNav("pills", "pill"),
|
|
2406
|
+
products("newArrivals", "editorial"),
|
|
2407
|
+
block2("StoreTagline", "quote", { className: "quote" }),
|
|
2408
|
+
trust()
|
|
2409
|
+
])
|
|
2410
|
+
],
|
|
2411
|
+
noor: () => [
|
|
2412
|
+
section("hero", "arch-hero", [
|
|
2413
|
+
stack("hero-media", "arch", [heroImage()]),
|
|
2414
|
+
stack("hero-text", "arch-hero__text", heroText())
|
|
2415
|
+
]),
|
|
2416
|
+
stack("main", "wrap", [categories(), products("newArrivals"), trust()])
|
|
2417
|
+
],
|
|
2418
|
+
block: () => [
|
|
2419
|
+
block2("StoreTicker", "ticker", { labels: ["newArrivals", "cod"], repeat: 8 }),
|
|
2420
|
+
section("hero", "poster", [heroImage(), stack("hero-text", "poster__text", heroText())]),
|
|
2421
|
+
categoryNav("tags", "tag"),
|
|
2422
|
+
products("newArrivals", "wall"),
|
|
2423
|
+
trust()
|
|
2424
|
+
],
|
|
2425
|
+
glow: () => [
|
|
2426
|
+
section("hero", "glow-hero", [
|
|
2427
|
+
heroImage(),
|
|
2428
|
+
stack("hero-text", "glow-hero__text", heroText())
|
|
2429
|
+
]),
|
|
2430
|
+
stack("main", "wrap", [categoryNav("chips", "chip"), products("bestSellers"), trust()])
|
|
2431
|
+
],
|
|
2432
|
+
oud: () => [
|
|
2433
|
+
section("hero", "oud-hero", [
|
|
2434
|
+
block2("StoreHeroImage", "hero-image", { frameClassName: "oud-hero__frame" }),
|
|
2435
|
+
...heroText()
|
|
2436
|
+
]),
|
|
2437
|
+
block2("Ornament", "rule", { className: "oud-rule" }),
|
|
2438
|
+
stack("main", "wrap", [categories(), products("bestSellers"), trust()])
|
|
2439
|
+
],
|
|
2440
|
+
circuit: () => [
|
|
2441
|
+
section("hero", "stage", [
|
|
2442
|
+
stack("hero-text", "stage__text", heroText()),
|
|
2443
|
+
stack("hero-media", "stage__media", [heroImage()])
|
|
2444
|
+
]),
|
|
2445
|
+
block2("StoreTrust", "trust", { variant: "bento" }),
|
|
2446
|
+
stack("main", "wrap", [categoryNav("chip-row", "link"), products("bestSellers")])
|
|
2447
|
+
],
|
|
2448
|
+
hearth: () => [
|
|
2449
|
+
section("hero", "room-hero", [
|
|
2450
|
+
heroImage(),
|
|
2451
|
+
stack("hero-text", "room-hero__card", heroText())
|
|
2452
|
+
]),
|
|
2453
|
+
stack("main", "wrap", [
|
|
2454
|
+
categories({ listClassName: "rooms", itemStyle: "room" }),
|
|
2455
|
+
products("bestSellers"),
|
|
2456
|
+
trust()
|
|
2457
|
+
])
|
|
2458
|
+
],
|
|
2459
|
+
pebble: () => [
|
|
2460
|
+
section("hero", "play-hero", [
|
|
2461
|
+
stack("hero-text", "play-hero__text", heroText()),
|
|
2462
|
+
stack("hero-media", "play-hero__media", [heroImage()])
|
|
2463
|
+
]),
|
|
2464
|
+
stack("main", "wrap", [categories(), products("bestSellers"), trust()])
|
|
2465
|
+
],
|
|
2466
|
+
souq: () => [
|
|
2467
|
+
stack("main", "wrap", [
|
|
2468
|
+
block2("StoreSearch", "search"),
|
|
2469
|
+
categoryNav("rail", "card"),
|
|
2470
|
+
section("promo", "promo", [
|
|
2471
|
+
heroImage("promo__image"),
|
|
2472
|
+
stack("promo-text", "promo__text", heroText())
|
|
2473
|
+
]),
|
|
2474
|
+
products("bestSellers"),
|
|
2475
|
+
trust()
|
|
2476
|
+
])
|
|
2477
|
+
]
|
|
2478
|
+
};
|
|
2479
|
+
function listing() {
|
|
2480
|
+
return page2([
|
|
2481
|
+
stack("main", "wrap", [
|
|
2482
|
+
block2("StorePageHeading", "heading", { source: "listing" }),
|
|
2483
|
+
block2("ListingToolbar", "toolbar"),
|
|
2484
|
+
block2("ListingGrid", "products"),
|
|
2485
|
+
block2("ListingEmpty", "empty"),
|
|
2486
|
+
block2("ListingLoadMore", "load-more")
|
|
2487
|
+
])
|
|
2488
|
+
]);
|
|
2489
|
+
}
|
|
2490
|
+
function product() {
|
|
2491
|
+
return page2([
|
|
2492
|
+
stack("main", "wrap", [
|
|
2493
|
+
stack("product", "pdp", [
|
|
2494
|
+
block2("StoreProductGallery", "gallery"),
|
|
2495
|
+
section("buy-box", "pdp__info", [
|
|
2496
|
+
block2("StoreBreadcrumbs", "breadcrumbs"),
|
|
2497
|
+
block2("StoreProductTitle", "product-name"),
|
|
2498
|
+
block2("StoreProductPrice", "price"),
|
|
2499
|
+
block2("ProductTagline", "tagline"),
|
|
2500
|
+
block2("ProductCatalog", "catalog"),
|
|
2501
|
+
block2("OrderForm", "order-form", { includeCatalog: false })
|
|
2502
|
+
])
|
|
2503
|
+
]),
|
|
2504
|
+
block2("StoreProductDescription", "description"),
|
|
2505
|
+
block2("StoreProductFaq", "faq"),
|
|
2506
|
+
block2("StoreProductGrid", "related", {
|
|
2507
|
+
source: "related",
|
|
2508
|
+
titleLabel: "youMayAlsoLike"
|
|
2509
|
+
})
|
|
2510
|
+
])
|
|
2511
|
+
]);
|
|
2512
|
+
}
|
|
2513
|
+
function contact() {
|
|
2514
|
+
return page2([
|
|
2515
|
+
stack("main", "wrap", [
|
|
2516
|
+
block2("StorePageHeading", "heading", { source: "contact" }),
|
|
2517
|
+
stack("contact", "contact", [
|
|
2518
|
+
block2("ContactDetails", "details"),
|
|
2519
|
+
block2("ContactForm", "form")
|
|
2520
|
+
])
|
|
2521
|
+
])
|
|
2522
|
+
]);
|
|
2523
|
+
}
|
|
2524
|
+
function article() {
|
|
2525
|
+
return page2([
|
|
2526
|
+
stack("main", "wrap", [
|
|
2527
|
+
block2("StorePageHeading", "heading", { source: "article" }),
|
|
2528
|
+
block2("StoreArticle", "text")
|
|
2529
|
+
])
|
|
2530
|
+
]);
|
|
2531
|
+
}
|
|
2532
|
+
function onlineStoreTemplate(templateId, pageType) {
|
|
2533
|
+
if (!OnlineStoreTemplateIds.includes(templateId)) {
|
|
2534
|
+
throw new Error(`Unknown online store template: ${templateId}`);
|
|
2535
|
+
}
|
|
2536
|
+
switch (pageType) {
|
|
2537
|
+
case "header":
|
|
2538
|
+
return page2([block2("AnnouncementBar", "announcement"), block2("StoreHeader", "header")]);
|
|
2539
|
+
case "footer":
|
|
2540
|
+
return page2([block2("StoreFooter", "footer")]);
|
|
2541
|
+
case "home":
|
|
2542
|
+
return page2(homes[templateId]());
|
|
2543
|
+
case "all-products":
|
|
2544
|
+
case "category":
|
|
2545
|
+
return listing();
|
|
2546
|
+
case "product":
|
|
2547
|
+
return product();
|
|
2548
|
+
case "thank-you":
|
|
2549
|
+
return page2([block2("StoreThankYou", "thank-you")]);
|
|
2550
|
+
case "contact":
|
|
2551
|
+
return contact();
|
|
2552
|
+
case "about":
|
|
2553
|
+
case "privacy-policy":
|
|
2554
|
+
case "refund-policy":
|
|
2555
|
+
case "terms-of-service":
|
|
2556
|
+
return article();
|
|
2557
|
+
case "not-found":
|
|
2558
|
+
return page2([stack("main", "wrap", [block2("StoreNotFound", "not-found")])]);
|
|
2559
|
+
default:
|
|
2560
|
+
throw new Error(`Unknown online store page type: ${pageType}`);
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
function onlineStorePages(templateId) {
|
|
2564
|
+
return OnlineStorePageTypes.map((pageType) => ({
|
|
2565
|
+
pageType,
|
|
2566
|
+
document: onlineStoreTemplate(templateId, pageType)
|
|
2567
|
+
}));
|
|
2568
|
+
}
|
|
2569
|
+
|
|
1240
2570
|
// src/server.ts
|
|
1241
2571
|
var Targets = {
|
|
1242
2572
|
chrome: 80 << 16,
|