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