@nok-integration/storefront-react 0.29.8 → 0.29.10

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.
@@ -5319,14 +5319,65 @@ const TOP = {
5319
5319
  doc: 0,
5320
5320
  pane: 0
5321
5321
  };
5322
- const places = /* @__PURE__ */ new Map();
5322
+ const STORE = "dazn-shop.places";
5323
+ const KEPT = 50;
5324
+ function stored() {
5325
+ const out = /* @__PURE__ */ new Map();
5326
+ try {
5327
+ const raw = typeof sessionStorage === "undefined" ? null : sessionStorage.getItem(STORE);
5328
+ const rows = raw ? JSON.parse(raw) : [];
5329
+ if (!Array.isArray(rows)) return out;
5330
+ for (const row2 of rows) {
5331
+ if (!Array.isArray(row2) || typeof row2[0] !== "string") continue;
5332
+ const at = row2[1];
5333
+ if (at && Number.isFinite(at.doc) && Number.isFinite(at.pane)) {
5334
+ out.set(row2[0], {
5335
+ doc: at.doc,
5336
+ pane: at.pane
5337
+ });
5338
+ }
5339
+ }
5340
+ } catch {
5341
+ return out;
5342
+ }
5343
+ return out;
5344
+ }
5345
+ function persist() {
5346
+ try {
5347
+ if (typeof sessionStorage === "undefined") return;
5348
+ if (places.size === 0) sessionStorage.removeItem(STORE);
5349
+ else sessionStorage.setItem(STORE, JSON.stringify([...places]));
5350
+ } catch {
5351
+ return;
5352
+ }
5353
+ }
5354
+ const places = stored();
5323
5355
  let returnedTo = null;
5356
+ let pending$3 = null;
5357
+ function flush() {
5358
+ if (pending$3 !== null) clearTimeout(pending$3);
5359
+ pending$3 = null;
5360
+ persist();
5361
+ }
5362
+ function persistSoon() {
5363
+ if (pending$3 === null) pending$3 = setTimeout(flush, 150);
5364
+ }
5324
5365
  function here() {
5325
5366
  if (typeof window === "undefined") return "";
5326
5367
  const { pathname, search, hash } = window.location;
5327
5368
  return pathname + search + hash;
5328
5369
  }
5370
+ function reachedThroughHistory() {
5371
+ try {
5372
+ const [entry] = performance.getEntriesByType("navigation");
5373
+ return entry?.type === "back_forward";
5374
+ } catch {
5375
+ return false;
5376
+ }
5377
+ }
5329
5378
  if (typeof window !== "undefined") {
5379
+ if (reachedThroughHistory()) returnedTo = here();
5380
+ window.addEventListener("pagehide", flush);
5330
5381
  window.addEventListener("popstate", () => {
5331
5382
  returnedTo = here();
5332
5383
  }, {
@@ -5344,7 +5395,10 @@ function settleReturn() {
5344
5395
  returnedTo = null;
5345
5396
  }
5346
5397
  function remember(key, offset) {
5398
+ places.delete(key);
5347
5399
  places.set(key, offset);
5400
+ while (places.size > KEPT) places.delete(places.keys().next().value);
5401
+ persistSoon();
5348
5402
  }
5349
5403
  let latestScreen = 0;
5350
5404
  let currentScreen = 0;
@@ -5737,11 +5791,11 @@ const ShopContext = createContext(null);
5737
5791
  const CartCacheContext = createContext(null);
5738
5792
  function DaznShopProvider({ children, ...config }) {
5739
5793
  const { apiBaseUrl, getToken, market, navigate: hostNavigate, prefetch: hostPrefetch, sessionTransport = "bearer", theme = "auto", notifications = "internal", features, onEvent, locale, assetBaseUrl } = config;
5740
- const listeners = useRef(/* @__PURE__ */ new Set());
5794
+ const listeners2 = useRef(/* @__PURE__ */ new Set());
5741
5795
  const subscribe = useCallback((listener) => {
5742
- listeners.current.add(listener);
5796
+ listeners2.current.add(listener);
5743
5797
  return () => {
5744
- listeners.current.delete(listener);
5798
+ listeners2.current.delete(listener);
5745
5799
  };
5746
5800
  }, []);
5747
5801
  const onEventRef = useRef(onEvent);
@@ -5761,7 +5815,7 @@ function DaznShopProvider({ children, ...config }) {
5761
5815
  productsRef.current ??= new ProductCache();
5762
5816
  const products2 = productsRef.current;
5763
5817
  const emit = useCallback((event) => {
5764
- for (const listener of listeners.current) {
5818
+ for (const listener of listeners2.current) {
5765
5819
  try {
5766
5820
  listener(event);
5767
5821
  } catch {
@@ -6782,6 +6836,11 @@ const TREATMENTS = {
6782
6836
  title: "That is not possible right now",
6783
6837
  body: "This has already moved on. Refresh to see where it is.",
6784
6838
  retriable: false
6839
+ },
6840
+ vip_hero_missing: {
6841
+ title: "Not available yet",
6842
+ body: "This is still being set up.",
6843
+ retriable: false
6785
6844
  }
6786
6845
  };
6787
6846
  const FALLBACK = {
@@ -15740,236 +15799,57 @@ function useCartCount() {
15740
15799
  }, [subscribe]);
15741
15800
  return count2;
15742
15801
  }
15743
- const header$1 = "_header_r9jjq_14";
15744
- const floating = "_floating_r9jjq_39";
15745
- const scrolled = "_scrolled_r9jjq_47";
15746
- const title$1 = "_title_r9jjq_121";
15747
- const leading = "_leading_r9jjq_134";
15748
- const right = "_right_r9jjq_140";
15749
- const spacer = "_spacer_r9jjq_153";
15750
- const iconBtn$1 = "_iconBtn_r9jjq_158";
15751
- const menuBtn = "_menuBtn_r9jjq_185";
15752
- const badge$1 = "_badge_r9jjq_194";
15753
- const closeSlot = "_closeSlot_r9jjq_221";
15754
- const centred = "_centred_r9jjq_236";
15755
- const styles$2 = {
15756
- header: header$1,
15757
- floating,
15758
- scrolled,
15759
- title: title$1,
15760
- leading,
15761
- right,
15762
- spacer,
15763
- iconBtn: iconBtn$1,
15764
- menuBtn,
15765
- badge: badge$1,
15766
- closeSlot,
15767
- centred
15768
- };
15769
- function CartIcon() {
15770
- const wheel = "M0.211146 1.10557C0.948194 -0.368524 3.05181 -0.368524 3.78885 1.10557C4.07038 1.66863 4.07038 2.33137 3.78885 2.89443C3.05181 4.36852 0.948194 4.36852 0.211146 2.89443C-0.0703819 2.33137 -0.0703819 1.66863 0.211146 1.10557Z";
15771
- return jsxs("svg", {
15772
- width: "24",
15773
- height: "24",
15774
- viewBox: "0 0 24 24",
15775
- fill: "none",
15776
- "aria-hidden": "true",
15777
- children: [jsx("g", {
15778
- transform: "translate(2 3)",
15779
- children: jsx("path", {
15780
- fillRule: "evenodd",
15781
- clipRule: "evenodd",
15782
- d: "M3 2H0V0H4C4.55228 0 5 0.447715 5 1V1.84615H19C19.3727 1.84615 19.7146 2.05347 19.8868 2.38402C20.0591 2.71458 20.0332 3.11351 19.8196 3.41902L14.8196 10.5729C14.6326 10.8405 14.3266 11 14 11H5V12H17V14H4C3.44772 14 3 13.5523 3 13V2ZM5 3.84615V9H13.4789L17.081 3.84615H5Z",
15783
- fill: "currentColor"
15784
- })
15785
- }), jsx("g", {
15786
- transform: "translate(6 18)",
15787
- children: jsx("path", {
15788
- fillRule: "evenodd",
15789
- clipRule: "evenodd",
15790
- d: wheel,
15791
- fill: "currentColor"
15792
- })
15793
- }), jsx("g", {
15794
- transform: "translate(14 18)",
15795
- children: jsx("path", {
15796
- fillRule: "evenodd",
15797
- clipRule: "evenodd",
15798
- d: wheel,
15799
- fill: "currentColor"
15800
- })
15801
- })]
15802
- });
15803
- }
15804
- function MenuIcon() {
15805
- return jsx("svg", {
15806
- width: "24",
15807
- height: "24",
15808
- viewBox: "0 0 24 24",
15809
- fill: "none",
15810
- "aria-hidden": "true",
15811
- children: jsx("g", {
15812
- transform: "translate(12 12.25) rotate(90) translate(-8 -2)",
15813
- children: jsx("path", {
15814
- d: "M2 4C1.45 4 0.979167 3.80417 0.5875 3.4125C0.195833 3.02083 0 2.55 0 2C0 1.45 0.195833 0.979167 0.5875 0.5875C0.979167 0.195833 1.45 0 2 0C2.55 0 3.02083 0.195833 3.4125 0.5875C3.80417 0.979167 4 1.45 4 2C4 2.55 3.80417 3.02083 3.4125 3.4125C3.02083 3.80417 2.55 4 2 4ZM8 4C7.45 4 6.97917 3.80417 6.5875 3.4125C6.19583 3.02083 6 2.55 6 2C6 1.45 6.19583 0.979167 6.5875 0.5875C6.97917 0.195833 7.45 0 8 0C8.55 0 9.02083 0.195833 9.4125 0.5875C9.80417 0.979167 10 1.45 10 2C10 2.55 9.80417 3.02083 9.4125 3.4125C9.02083 3.80417 8.55 4 8 4ZM14 4C13.45 4 12.9792 3.80417 12.5875 3.4125C12.1958 3.02083 12 2.55 12 2C12 1.45 12.1958 0.979167 12.5875 0.5875C12.9792 0.195833 13.45 0 14 0C14.55 0 15.0208 0.195833 15.4125 0.5875C15.8042 0.979167 16 1.45 16 2C16 2.55 15.8042 3.02083 15.4125 3.4125C15.0208 3.80417 14.55 4 14 4Z",
15815
- fill: "currentColor"
15816
- })
15817
- })
15818
- });
15819
- }
15820
- function ChevronLeft() {
15821
- return jsx("svg", {
15822
- width: "24",
15823
- height: "24",
15824
- viewBox: "0 0 24 24",
15825
- fill: "none",
15826
- "aria-hidden": "true",
15827
- children: jsx("g", {
15828
- transform: "translate(6.48 2.988)",
15829
- children: jsx("path", {
15830
- d: "M0 9.00923C1.26763e-08 8.71923 0.12 8.44923 0.34 8.25923L9.38 0.249231C9.79 -0.110769 10.42 -0.0807692 10.79 0.339231C11.15 0.749231 11.12 1.37923 10.7 1.74923L2.5 9.01923L10.7 16.2792C11.12 16.6492 11.15 17.2792 10.79 17.6892C10.42 18.0992 9.79 18.1392 9.38 17.7692L0.34 9.75923C0.13 9.56923 -1.26763e-08 9.29923 0 9.00923Z",
15831
- fill: "currentColor"
15832
- })
15833
- })
15834
- });
15802
+ let mounted = 0;
15803
+ const listeners = /* @__PURE__ */ new Set();
15804
+ function notify() {
15805
+ for (const listener of listeners) listener();
15835
15806
  }
15836
- function useScrolledUnder(enabled) {
15837
- const [scrolled2, setScrolled] = useState(false);
15807
+ function useClaimShopNav() {
15838
15808
  useEffect(() => {
15839
- if (!enabled) return;
15840
- const read = (event) => {
15841
- const target = event?.target;
15842
- const top2 = target && target !== document && target instanceof HTMLElement ? target.scrollTop : window.scrollY || document.documentElement.scrollTop;
15843
- setScrolled(top2 > 0);
15809
+ mounted += 1;
15810
+ notify();
15811
+ return () => {
15812
+ mounted -= 1;
15813
+ notify();
15844
15814
  };
15845
- read();
15846
- document.addEventListener("scroll", read, {
15847
- capture: true,
15848
- passive: true
15849
- });
15850
- return () => document.removeEventListener("scroll", read, {
15851
- capture: true
15852
- });
15853
- }, [enabled]);
15854
- return enabled ? scrolled2 : false;
15855
- }
15856
- function CloseMedium() {
15857
- return jsx("svg", {
15858
- width: "24",
15859
- height: "24",
15860
- viewBox: "0 0 24 24",
15861
- fill: "none",
15862
- "aria-hidden": "true",
15863
- children: jsx("g", {
15864
- transform: "translate(5.03 5.03)",
15865
- children: jsx("path", {
15866
- d: "M12.233 0.292847C12.6235 -0.0975851 13.2566 -0.0976464 13.6471 0.292847C14.0375 0.683347 14.0375 1.3164 13.6471 1.70691L8.38437 6.9696L13.6471 12.2323C14.0376 12.6228 14.0376 13.2558 13.6471 13.6464C13.2565 14.0369 12.6235 14.0369 12.233 13.6464L6.96933 8.38367L1.70761 13.6464C1.31711 14.0369 0.684078 14.0368 0.293548 13.6464C-0.0969764 13.2558 -0.0969764 12.6228 0.293548 12.2323L5.55527 6.9696L0.292571 1.70691C-0.0976189 1.31653 -0.0974286 0.683349 0.292571 0.292847C0.683065 -0.0976464 1.31708 -0.0975851 1.70761 0.292847L6.97031 5.55554L12.233 0.292847Z",
15867
- fill: "currentColor"
15868
- })
15869
- })
15870
- });
15871
- }
15872
- function ShopHeader(props) {
15873
- return props.context === "checkout" ? jsx(CheckoutBar, {
15874
- ...props
15875
- }) : jsx(ShopBar, {
15876
- ...props
15877
- });
15878
- }
15879
- function CheckoutBar({ title: title2, onClose, closeLabel, className }) {
15880
- const t = useT();
15881
- const classes = [styles$2.header, className ?? ""].filter(Boolean).join(" ");
15882
- return jsxs("header", {
15883
- className: classes,
15884
- children: [jsx("span", {
15885
- className: styles$2.closeSlot,
15886
- "aria-hidden": "true"
15887
- }), title2 ? jsx("span", {
15888
- className: [styles$2.title, styles$2.centred].join(" "),
15889
- children: title2
15890
- }) : null, onClose ? jsx("button", {
15891
- type: "button",
15892
- className: [styles$2.iconBtn, styles$2.closeSlot].join(" "),
15893
- "aria-label": closeLabel ?? t("Close"),
15894
- onClick: onClose,
15895
- children: jsx(CloseMedium, {})
15896
- }) : jsx("span", {
15897
- className: styles$2.closeSlot,
15898
- "aria-hidden": "true"
15899
- })]
15900
- });
15815
+ }, []);
15901
15816
  }
15902
- function ShopBar({ onBack, onMenu, title: title2, showCart, floating: floating2 = false, scrolled: scrolled2, backLabel, menuLabel, className }) {
15903
- const t = useT();
15904
- const cartCount = useCartCount();
15905
- const screenTitle = useScreenTitle();
15906
- const shownTitle = title2 ?? screenTitle;
15907
- const bare = useScreenTrailing() === "none";
15908
- const cartOn = showCart ?? !bare;
15909
- const menu = bare ? void 0 : onMenu;
15910
- const hasTrailing = cartOn || Boolean(menu);
15911
- const atTop = useScrolledUnder(floating2 && scrolled2 === void 0);
15912
- const isScrolled = scrolled2 ?? atTop;
15913
- const cartLabel = cartCount === null ? t("Cart") : cartCount === 0 ? t("Cart, empty") : t("Cart, {0} item{1}", cartCount, cartCount === 1 ? "" : "s");
15914
- const classes = [styles$2.header, floating2 ? styles$2.floating : "", floating2 && isScrolled ? styles$2.scrolled : "", className ?? ""].filter(Boolean).join(" ");
15915
- return jsxs("header", {
15916
- className: classes,
15917
- children: [onBack ? jsx("button", {
15918
- type: "button",
15919
- className: styles$2.iconBtn,
15920
- "aria-label": backLabel ?? t("Back"),
15921
- onClick: onBack,
15922
- children: jsx(ChevronLeft, {})
15923
- }) : jsx("span", {
15924
- className: styles$2.spacer,
15925
- "aria-hidden": "true"
15926
- }), shownTitle ? jsx("span", {
15927
- className: hasTrailing ? styles$2.title : `${styles$2.title} ${styles$2.leading}`,
15928
- children: shownTitle
15929
- }) : null, jsxs("div", {
15930
- className: styles$2.right,
15931
- children: [cartOn ? jsxs(CartTrigger, {
15932
- className: styles$2.iconBtn,
15933
- "aria-label": cartLabel,
15934
- children: [jsx(CartIcon, {}), cartCount !== null && cartCount > 0 ? jsx("span", {
15935
- className: styles$2.badge,
15936
- "aria-hidden": "true",
15937
- children: cartCount > 99 ? "99+" : cartCount
15938
- }) : null]
15939
- }) : null, menu ? jsx("button", {
15940
- type: "button",
15941
- className: `${styles$2.iconBtn} ${styles$2.menuBtn}`,
15942
- "aria-label": menuLabel ?? t("More options"),
15943
- onClick: menu,
15944
- children: jsx(MenuIcon, {})
15945
- }) : null]
15946
- })]
15947
- });
15817
+ function useShopNavClaimed() {
15818
+ const [claimed, setClaimed] = useState(mounted > 0);
15819
+ useEffect(() => {
15820
+ const listener = () => setClaimed(mounted > 0);
15821
+ listeners.add(listener);
15822
+ listener();
15823
+ return () => {
15824
+ listeners.delete(listener);
15825
+ };
15826
+ }, []);
15827
+ return claimed;
15948
15828
  }
15949
15829
  const overlay = "_overlay_y4mxb_5";
15950
15830
  const scrim = "_scrim_y4mxb_21";
15951
15831
  const sheet = "_sheet_y4mxb_31";
15952
- const header = "_header_y4mxb_80";
15832
+ const header$1 = "_header_y4mxb_80";
15953
15833
  const close = "_close_y4mxb_86";
15954
15834
  const list$1 = "_list_y4mxb_105";
15955
15835
  const row = "_row_y4mxb_120";
15956
15836
  const icon = "_icon_y4mxb_149";
15957
15837
  const text = "_text_y4mxb_157";
15958
- const title = "_title_y4mxb_165";
15838
+ const title$1 = "_title_y4mxb_165";
15959
15839
  const subtitle = "_subtitle_y4mxb_172";
15960
15840
  const chevron = "_chevron_y4mxb_178";
15961
15841
  const dropdown = "_dropdown_y4mxb_187";
15962
- const styles$1 = {
15842
+ const styles$2 = {
15963
15843
  overlay,
15964
15844
  scrim,
15965
15845
  sheet,
15966
- header,
15846
+ header: header$1,
15967
15847
  close,
15968
15848
  list: list$1,
15969
15849
  row,
15970
15850
  icon,
15971
15851
  text,
15972
- title,
15852
+ title: title$1,
15973
15853
  subtitle,
15974
15854
  chevron,
15975
15855
  dropdown
@@ -16144,51 +16024,51 @@ function ShopMenuSheet({ open, onClose, onManageOrders, onHelp, closeLabel, labe
16144
16024
  } : {}
16145
16025
  }];
16146
16026
  return jsxs("div", {
16147
- className: [styles$1.overlay, placement === "dropdown" ? styles$1.dropdown : ""].filter(Boolean).join(" "),
16027
+ className: [styles$2.overlay, placement === "dropdown" ? styles$2.dropdown : ""].filter(Boolean).join(" "),
16148
16028
  children: [jsx("div", {
16149
- className: styles$1.scrim,
16029
+ className: styles$2.scrim,
16150
16030
  onClick: onClose,
16151
16031
  "aria-hidden": "true"
16152
16032
  }), jsxs(ShopSurface, {
16153
16033
  tone: "light",
16154
- className: styles$1.sheet,
16034
+ className: styles$2.sheet,
16155
16035
  role: "dialog",
16156
16036
  "aria-modal": "true",
16157
16037
  "aria-label": label2 ?? t("Shop menu"),
16158
16038
  ref: sheetRef,
16159
16039
  children: [jsx("div", {
16160
- className: styles$1.header,
16040
+ className: styles$2.header,
16161
16041
  children: jsx("button", {
16162
16042
  type: "button",
16163
- className: styles$1.close,
16043
+ className: styles$2.close,
16164
16044
  onClick: onClose,
16165
16045
  "aria-label": closeLabel ?? t("Close"),
16166
16046
  children: jsx(CloseIcon, {})
16167
16047
  })
16168
16048
  }), jsx("ul", {
16169
- className: styles$1.list,
16049
+ className: styles$2.list,
16170
16050
  children: rows.map((row2) => jsx("li", {
16171
16051
  "data-row": row2.key,
16172
16052
  children: jsxs("button", {
16173
16053
  type: "button",
16174
- className: styles$1.row,
16054
+ className: styles$2.row,
16175
16055
  onClick: row2.onSelect,
16176
16056
  disabled: !row2.onSelect,
16177
16057
  "aria-disabled": row2.onSelect ? void 0 : true,
16178
16058
  children: [row2.icon && jsx("span", {
16179
- className: styles$1.icon,
16059
+ className: styles$2.icon,
16180
16060
  children: row2.icon
16181
16061
  }), jsxs("span", {
16182
- className: styles$1.text,
16062
+ className: styles$2.text,
16183
16063
  children: [jsx("span", {
16184
- className: styles$1.title,
16064
+ className: styles$2.title,
16185
16065
  children: row2.title
16186
16066
  }), row2.subtitle && jsx("span", {
16187
- className: styles$1.subtitle,
16067
+ className: styles$2.subtitle,
16188
16068
  children: row2.subtitle
16189
16069
  })]
16190
16070
  }), jsx("span", {
16191
- className: styles$1.chevron,
16071
+ className: styles$2.chevron,
16192
16072
  children: jsx(ChevronRight, {})
16193
16073
  })]
16194
16074
  })
@@ -16197,6 +16077,57 @@ function ShopMenuSheet({ open, onClose, onManageOrders, onHelp, closeLabel, labe
16197
16077
  })]
16198
16078
  });
16199
16079
  }
16080
+ function CartIcon() {
16081
+ const wheel = "M0.211146 1.10557C0.948194 -0.368524 3.05181 -0.368524 3.78885 1.10557C4.07038 1.66863 4.07038 2.33137 3.78885 2.89443C3.05181 4.36852 0.948194 4.36852 0.211146 2.89443C-0.0703819 2.33137 -0.0703819 1.66863 0.211146 1.10557Z";
16082
+ return jsxs("svg", {
16083
+ width: "24",
16084
+ height: "24",
16085
+ viewBox: "0 0 24 24",
16086
+ fill: "none",
16087
+ "aria-hidden": "true",
16088
+ children: [jsx("g", {
16089
+ transform: "translate(2 3)",
16090
+ children: jsx("path", {
16091
+ fillRule: "evenodd",
16092
+ clipRule: "evenodd",
16093
+ d: "M3 2H0V0H4C4.55228 0 5 0.447715 5 1V1.84615H19C19.3727 1.84615 19.7146 2.05347 19.8868 2.38402C20.0591 2.71458 20.0332 3.11351 19.8196 3.41902L14.8196 10.5729C14.6326 10.8405 14.3266 11 14 11H5V12H17V14H4C3.44772 14 3 13.5523 3 13V2ZM5 3.84615V9H13.4789L17.081 3.84615H5Z",
16094
+ fill: "currentColor"
16095
+ })
16096
+ }), jsx("g", {
16097
+ transform: "translate(6 18)",
16098
+ children: jsx("path", {
16099
+ fillRule: "evenodd",
16100
+ clipRule: "evenodd",
16101
+ d: wheel,
16102
+ fill: "currentColor"
16103
+ })
16104
+ }), jsx("g", {
16105
+ transform: "translate(14 18)",
16106
+ children: jsx("path", {
16107
+ fillRule: "evenodd",
16108
+ clipRule: "evenodd",
16109
+ d: wheel,
16110
+ fill: "currentColor"
16111
+ })
16112
+ })]
16113
+ });
16114
+ }
16115
+ function MenuIcon() {
16116
+ return jsx("svg", {
16117
+ width: "24",
16118
+ height: "24",
16119
+ viewBox: "0 0 24 24",
16120
+ fill: "none",
16121
+ "aria-hidden": "true",
16122
+ children: jsx("g", {
16123
+ transform: "translate(12 12.25) rotate(90) translate(-8 -2)",
16124
+ children: jsx("path", {
16125
+ d: "M2 4C1.45 4 0.979167 3.80417 0.5875 3.4125C0.195833 3.02083 0 2.55 0 2C0 1.45 0.195833 0.979167 0.5875 0.5875C0.979167 0.195833 1.45 0 2 0C2.55 0 3.02083 0.195833 3.4125 0.5875C3.80417 0.979167 4 1.45 4 2C4 2.55 3.80417 3.02083 3.4125 3.4125C3.02083 3.80417 2.55 4 2 4ZM8 4C7.45 4 6.97917 3.80417 6.5875 3.4125C6.19583 3.02083 6 2.55 6 2C6 1.45 6.19583 0.979167 6.5875 0.5875C6.97917 0.195833 7.45 0 8 0C8.55 0 9.02083 0.195833 9.4125 0.5875C9.80417 0.979167 10 1.45 10 2C10 2.55 9.80417 3.02083 9.4125 3.4125C9.02083 3.80417 8.55 4 8 4ZM14 4C13.45 4 12.9792 3.80417 12.5875 3.4125C12.1958 3.02083 12 2.55 12 2C12 1.45 12.1958 0.979167 12.5875 0.5875C12.9792 0.195833 13.45 0 14 0C14.55 0 15.0208 0.195833 15.4125 0.5875C15.8042 0.979167 16 1.45 16 2C16 2.55 15.8042 3.02083 15.4125 3.4125C15.0208 3.80417 14.55 4 14 4Z",
16126
+ fill: "currentColor"
16127
+ })
16128
+ })
16129
+ });
16130
+ }
16200
16131
  const bar = "_bar_10bv8_1";
16201
16132
  const media = "_media_10bv8_22";
16202
16133
  const light = "_light_10bv8_30";
@@ -16208,9 +16139,9 @@ const trail = "_trail_10bv8_64";
16208
16139
  const current = "_current_10bv8_65";
16209
16140
  const separator = "_separator_10bv8_85";
16210
16141
  const actions = "_actions_10bv8_90";
16211
- const iconBtn = "_iconBtn_10bv8_97";
16212
- const badge = "_badge_10bv8_126";
16213
- const styles = {
16142
+ const iconBtn$1 = "_iconBtn_10bv8_97";
16143
+ const badge$1 = "_badge_10bv8_126";
16144
+ const styles$1 = {
16214
16145
  bar,
16215
16146
  media,
16216
16147
  light,
@@ -16222,10 +16153,16 @@ const styles = {
16222
16153
  current,
16223
16154
  separator,
16224
16155
  actions,
16225
- iconBtn,
16226
- badge
16156
+ iconBtn: iconBtn$1,
16157
+ badge: badge$1
16227
16158
  };
16228
- function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16159
+ function ShopNav(props) {
16160
+ useClaimShopNav();
16161
+ return jsx(ShopNavBar, {
16162
+ ...props
16163
+ });
16164
+ }
16165
+ function ShopNavBar({ onManageOrders, onHelp, menuLabel, className, onMenu, showCart }) {
16229
16166
  const t = useT();
16230
16167
  const nav = useScreenNav();
16231
16168
  const bare = useScreenTrailing() === "none";
@@ -16238,17 +16175,17 @@ function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16238
16175
  const manageOrders = onManageOrders ?? (navigate ? () => navigate("/orders") : void 0);
16239
16176
  return jsxs(Fragment, {
16240
16177
  children: [jsxs("div", {
16241
- className: [styles.bar, nav.tone === "media" ? styles.media : styles.light, className ?? ""].filter(Boolean).join(" "),
16178
+ className: [styles$1.bar, nav.tone === "media" ? styles$1.media : styles$1.light, className ?? ""].filter(Boolean).join(" "),
16242
16179
  "data-shop-nav": nav.tone,
16243
16180
  children: [jsx("nav", {
16244
16181
  "aria-label": t("Breadcrumb"),
16245
- className: styles.crumbs,
16182
+ className: styles$1.crumbs,
16246
16183
  children: jsx("ol", {
16247
- className: styles.list,
16184
+ className: styles$1.list,
16248
16185
  children: nav.crumbs.map((crumb, i) => {
16249
- const role = i === last ? styles.current : i === 0 ? styles.root : styles.trail;
16186
+ const role = i === last ? styles$1.current : i === 0 ? styles$1.root : styles$1.trail;
16250
16187
  return jsxs("li", {
16251
- className: styles.item,
16188
+ className: styles$1.item,
16252
16189
  children: [i === last ? jsx("span", {
16253
16190
  className: role,
16254
16191
  "aria-current": "page",
@@ -16261,7 +16198,7 @@ function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16261
16198
  className: role,
16262
16199
  children: crumb.label
16263
16200
  }), i < last && jsx("span", {
16264
- className: styles.separator,
16201
+ className: styles$1.separator,
16265
16202
  "aria-hidden": "true",
16266
16203
  children: "›"
16267
16204
  })]
@@ -16269,22 +16206,22 @@ function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16269
16206
  })
16270
16207
  })
16271
16208
  }), !bare && jsxs("div", {
16272
- className: styles.actions,
16273
- children: [jsxs(CartTrigger, {
16274
- className: styles.iconBtn,
16209
+ className: styles$1.actions,
16210
+ children: [showCart !== false && jsxs(CartTrigger, {
16211
+ className: styles$1.iconBtn,
16275
16212
  "aria-label": cartLabel,
16276
16213
  children: [jsx(CartIcon, {}), cartCount !== null && cartCount > 0 ? jsx("span", {
16277
- className: styles.badge,
16214
+ className: styles$1.badge,
16278
16215
  "aria-hidden": "true",
16279
16216
  children: cartCount > 99 ? "99+" : cartCount
16280
16217
  }) : null]
16281
16218
  }), jsx("button", {
16282
16219
  type: "button",
16283
- className: styles.iconBtn,
16220
+ className: styles$1.iconBtn,
16284
16221
  "aria-label": menuLabel ?? t("More options"),
16285
- "aria-expanded": menuOpen,
16222
+ "aria-expanded": onMenu ? void 0 : menuOpen,
16286
16223
  "aria-haspopup": "dialog",
16287
- onClick: () => setMenuOpen((open) => !open),
16224
+ onClick: onMenu ?? (() => setMenuOpen((open) => !open)),
16288
16225
  children: jsx(MenuIcon, {})
16289
16226
  })]
16290
16227
  })]
@@ -16307,6 +16244,178 @@ function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16307
16244
  })]
16308
16245
  });
16309
16246
  }
16247
+ const header = "_header_iwoi3_14";
16248
+ const floating = "_floating_iwoi3_39";
16249
+ const scrolled = "_scrolled_iwoi3_47";
16250
+ const title = "_title_iwoi3_121";
16251
+ const leading = "_leading_iwoi3_134";
16252
+ const right = "_right_iwoi3_140";
16253
+ const spacer = "_spacer_iwoi3_153";
16254
+ const iconBtn = "_iconBtn_iwoi3_158";
16255
+ const menuBtn = "_menuBtn_iwoi3_185";
16256
+ const badge = "_badge_iwoi3_194";
16257
+ const closeSlot = "_closeSlot_iwoi3_221";
16258
+ const centred = "_centred_iwoi3_236";
16259
+ const narrowOnly = "_narrowOnly_iwoi3_243";
16260
+ const styles = {
16261
+ header,
16262
+ floating,
16263
+ scrolled,
16264
+ title,
16265
+ leading,
16266
+ right,
16267
+ spacer,
16268
+ iconBtn,
16269
+ menuBtn,
16270
+ badge,
16271
+ closeSlot,
16272
+ centred,
16273
+ narrowOnly
16274
+ };
16275
+ function ChevronLeft() {
16276
+ return jsx("svg", {
16277
+ width: "24",
16278
+ height: "24",
16279
+ viewBox: "0 0 24 24",
16280
+ fill: "none",
16281
+ "aria-hidden": "true",
16282
+ children: jsx("g", {
16283
+ transform: "translate(6.48 2.988)",
16284
+ children: jsx("path", {
16285
+ d: "M0 9.00923C1.26763e-08 8.71923 0.12 8.44923 0.34 8.25923L9.38 0.249231C9.79 -0.110769 10.42 -0.0807692 10.79 0.339231C11.15 0.749231 11.12 1.37923 10.7 1.74923L2.5 9.01923L10.7 16.2792C11.12 16.6492 11.15 17.2792 10.79 17.6892C10.42 18.0992 9.79 18.1392 9.38 17.7692L0.34 9.75923C0.13 9.56923 -1.26763e-08 9.29923 0 9.00923Z",
16286
+ fill: "currentColor"
16287
+ })
16288
+ })
16289
+ });
16290
+ }
16291
+ function useScrolledUnder(enabled) {
16292
+ const [scrolled2, setScrolled] = useState(false);
16293
+ useEffect(() => {
16294
+ if (!enabled) return;
16295
+ const read = (event) => {
16296
+ const target = event?.target;
16297
+ const top2 = target && target !== document && target instanceof HTMLElement ? target.scrollTop : window.scrollY || document.documentElement.scrollTop;
16298
+ setScrolled(top2 > 0);
16299
+ };
16300
+ read();
16301
+ document.addEventListener("scroll", read, {
16302
+ capture: true,
16303
+ passive: true
16304
+ });
16305
+ return () => document.removeEventListener("scroll", read, {
16306
+ capture: true
16307
+ });
16308
+ }, [enabled]);
16309
+ return enabled ? scrolled2 : false;
16310
+ }
16311
+ function CloseMedium() {
16312
+ return jsx("svg", {
16313
+ width: "24",
16314
+ height: "24",
16315
+ viewBox: "0 0 24 24",
16316
+ fill: "none",
16317
+ "aria-hidden": "true",
16318
+ children: jsx("g", {
16319
+ transform: "translate(5.03 5.03)",
16320
+ children: jsx("path", {
16321
+ d: "M12.233 0.292847C12.6235 -0.0975851 13.2566 -0.0976464 13.6471 0.292847C14.0375 0.683347 14.0375 1.3164 13.6471 1.70691L8.38437 6.9696L13.6471 12.2323C14.0376 12.6228 14.0376 13.2558 13.6471 13.6464C13.2565 14.0369 12.6235 14.0369 12.233 13.6464L6.96933 8.38367L1.70761 13.6464C1.31711 14.0369 0.684078 14.0368 0.293548 13.6464C-0.0969764 13.2558 -0.0969764 12.6228 0.293548 12.2323L5.55527 6.9696L0.292571 1.70691C-0.0976189 1.31653 -0.0974286 0.683349 0.292571 0.292847C0.683065 -0.0976464 1.31708 -0.0975851 1.70761 0.292847L6.97031 5.55554L12.233 0.292847Z",
16322
+ fill: "currentColor"
16323
+ })
16324
+ })
16325
+ });
16326
+ }
16327
+ function ShopHeader(props) {
16328
+ return props.context === "checkout" ? jsx(CheckoutBar, {
16329
+ ...props
16330
+ }) : jsx(ShopBar, {
16331
+ ...props
16332
+ });
16333
+ }
16334
+ function CheckoutBar({ title: title2, onClose, closeLabel, className }) {
16335
+ const t = useT();
16336
+ const classes = [styles.header, className ?? ""].filter(Boolean).join(" ");
16337
+ return jsxs("header", {
16338
+ className: classes,
16339
+ children: [jsx("span", {
16340
+ className: styles.closeSlot,
16341
+ "aria-hidden": "true"
16342
+ }), title2 ? jsx("span", {
16343
+ className: [styles.title, styles.centred].join(" "),
16344
+ children: title2
16345
+ }) : null, onClose ? jsx("button", {
16346
+ type: "button",
16347
+ className: [styles.iconBtn, styles.closeSlot].join(" "),
16348
+ "aria-label": closeLabel ?? t("Close"),
16349
+ onClick: onClose,
16350
+ children: jsx(CloseMedium, {})
16351
+ }) : jsx("span", {
16352
+ className: styles.closeSlot,
16353
+ "aria-hidden": "true"
16354
+ })]
16355
+ });
16356
+ }
16357
+ function ShopBar({ onBack, onMenu, title: title2, showCart, floating: floating2 = false, scrolled: scrolled2, backLabel, menuLabel, className }) {
16358
+ const t = useT();
16359
+ const cartCount = useCartCount();
16360
+ const screenTitle = useScreenTitle();
16361
+ const shownTitle = title2 ?? screenTitle;
16362
+ const bare = useScreenTrailing() === "none";
16363
+ const cartOn = showCart ?? !bare;
16364
+ const menu = bare ? void 0 : onMenu;
16365
+ const hasTrailing = cartOn || Boolean(menu);
16366
+ const nav = useScreenNav();
16367
+ const navClaimed = useShopNavClaimed();
16368
+ const wide2 = Boolean(nav && nav.crumbs.length > 0);
16369
+ const atTop = useScrolledUnder(floating2 && scrolled2 === void 0);
16370
+ const isScrolled = scrolled2 ?? atTop;
16371
+ const cartLabel = cartCount === null ? t("Cart") : cartCount === 0 ? t("Cart, empty") : t("Cart, {0} item{1}", cartCount, cartCount === 1 ? "" : "s");
16372
+ const classes = [styles.header, floating2 ? styles.floating : "", floating2 && isScrolled ? styles.scrolled : "", wide2 ? styles.narrowOnly : "", className ?? ""].filter(Boolean).join(" ");
16373
+ return jsxs(Fragment, {
16374
+ children: [wide2 && !navClaimed ? jsx(ShopNavBar, {
16375
+ ...menu ? {
16376
+ onMenu: menu
16377
+ } : {},
16378
+ ...showCart === false ? {
16379
+ showCart: false
16380
+ } : {},
16381
+ ...menuLabel ? {
16382
+ menuLabel
16383
+ } : {}
16384
+ }) : null, jsxs("header", {
16385
+ className: classes,
16386
+ children: [onBack ? jsx("button", {
16387
+ type: "button",
16388
+ className: styles.iconBtn,
16389
+ "aria-label": backLabel ?? t("Back"),
16390
+ onClick: onBack,
16391
+ children: jsx(ChevronLeft, {})
16392
+ }) : jsx("span", {
16393
+ className: styles.spacer,
16394
+ "aria-hidden": "true"
16395
+ }), shownTitle ? jsx("span", {
16396
+ className: hasTrailing ? styles.title : `${styles.title} ${styles.leading}`,
16397
+ children: shownTitle
16398
+ }) : null, jsxs("div", {
16399
+ className: styles.right,
16400
+ children: [cartOn ? jsxs(CartTrigger, {
16401
+ className: styles.iconBtn,
16402
+ "aria-label": cartLabel,
16403
+ children: [jsx(CartIcon, {}), cartCount !== null && cartCount > 0 ? jsx("span", {
16404
+ className: styles.badge,
16405
+ "aria-hidden": "true",
16406
+ children: cartCount > 99 ? "99+" : cartCount
16407
+ }) : null]
16408
+ }) : null, menu ? jsx("button", {
16409
+ type: "button",
16410
+ className: `${styles.iconBtn} ${styles.menuBtn}`,
16411
+ "aria-label": menuLabel ?? t("More options"),
16412
+ onClick: menu,
16413
+ children: jsx(MenuIcon, {})
16414
+ }) : null]
16415
+ })]
16416
+ })]
16417
+ });
16418
+ }
16310
16419
  function major(money2) {
16311
16420
  return money2.amount / 100;
16312
16421
  }