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