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