@nok-integration/storefront-react 0.29.8 → 0.29.11

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;
@@ -5668,7 +5722,9 @@ function ScreenTitleProvider({ children }) {
5668
5722
  return jsx(ScreenTitleContext.Provider, {
5669
5723
  value: value2,
5670
5724
  children: jsx(ScreenNavProvider, {
5671
- children
5725
+ children: jsx(ScreenBackdropProvider, {
5726
+ children
5727
+ })
5672
5728
  })
5673
5729
  });
5674
5730
  }
@@ -5733,15 +5789,52 @@ function useSetScreenNav(crumbs2, tone) {
5733
5789
  });
5734
5790
  }, [claim, key, tone, suppressed]);
5735
5791
  }
5792
+ const ScreenBackdropContext = createContext({
5793
+ backdrop: "plain",
5794
+ claim: () => () => {
5795
+ }
5796
+ });
5797
+ function ScreenBackdropProvider({ children }) {
5798
+ const [backdrop, setBackdrop] = useState("plain");
5799
+ const held = useRef(0);
5800
+ const claim = useCallback((next) => {
5801
+ held.current += 1;
5802
+ const mine = held.current;
5803
+ setBackdrop(next);
5804
+ return () => {
5805
+ if (held.current !== mine) return;
5806
+ setBackdrop("plain");
5807
+ };
5808
+ }, []);
5809
+ const value2 = useMemo(() => ({
5810
+ backdrop,
5811
+ claim
5812
+ }), [backdrop, claim]);
5813
+ return jsx(ScreenBackdropContext.Provider, {
5814
+ value: value2,
5815
+ children
5816
+ });
5817
+ }
5818
+ function useScreenBackdrop() {
5819
+ return useContext(ScreenBackdropContext).backdrop;
5820
+ }
5821
+ function useSetScreenBackdrop(backdrop) {
5822
+ const { claim } = useContext(ScreenBackdropContext);
5823
+ const suppressed = useContext(SuppressedContext);
5824
+ useEffect(() => {
5825
+ if (suppressed) return;
5826
+ return claim(backdrop);
5827
+ }, [claim, backdrop, suppressed]);
5828
+ }
5736
5829
  const ShopContext = createContext(null);
5737
5830
  const CartCacheContext = createContext(null);
5738
5831
  function DaznShopProvider({ children, ...config }) {
5739
5832
  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());
5833
+ const listeners2 = useRef(/* @__PURE__ */ new Set());
5741
5834
  const subscribe = useCallback((listener) => {
5742
- listeners.current.add(listener);
5835
+ listeners2.current.add(listener);
5743
5836
  return () => {
5744
- listeners.current.delete(listener);
5837
+ listeners2.current.delete(listener);
5745
5838
  };
5746
5839
  }, []);
5747
5840
  const onEventRef = useRef(onEvent);
@@ -5761,7 +5854,7 @@ function DaznShopProvider({ children, ...config }) {
5761
5854
  productsRef.current ??= new ProductCache();
5762
5855
  const products2 = productsRef.current;
5763
5856
  const emit = useCallback((event) => {
5764
- for (const listener of listeners.current) {
5857
+ for (const listener of listeners2.current) {
5765
5858
  try {
5766
5859
  listener(event);
5767
5860
  } catch {
@@ -6782,6 +6875,11 @@ const TREATMENTS = {
6782
6875
  title: "That is not possible right now",
6783
6876
  body: "This has already moved on. Refresh to see where it is.",
6784
6877
  retriable: false
6878
+ },
6879
+ vip_hero_missing: {
6880
+ title: "Not available yet",
6881
+ body: "This is still being set up.",
6882
+ retriable: false
6785
6883
  }
6786
6884
  };
6787
6885
  const FALLBACK = {
@@ -14654,18 +14752,18 @@ function requireDist() {
14654
14752
  return dist;
14655
14753
  }
14656
14754
  var distExports = requireDist();
14657
- const hero$1 = "_hero_dctyt_1";
14658
- const image$1 = "_image_dctyt_11";
14659
- const foot = "_foot_dctyt_34";
14660
- const text$1 = "_text_dctyt_40";
14661
- const logo$1 = "_logo_dctyt_48";
14662
- const copy$1 = "_copy_dctyt_53";
14663
- const headline = "_headline_dctyt_62";
14664
- const body = "_body_dctyt_70";
14665
- const cta$2 = "_cta_dctyt_79";
14666
- const video = "_video_dctyt_83";
14667
- const desktopOnly = "_desktopOnly_dctyt_87";
14668
- const phoneOnly$1 = "_phoneOnly_dctyt_97";
14755
+ const hero$1 = "_hero_15sq4_1";
14756
+ const image$1 = "_image_15sq4_11";
14757
+ const foot = "_foot_15sq4_34";
14758
+ const text$1 = "_text_15sq4_40";
14759
+ const logo$1 = "_logo_15sq4_48";
14760
+ const copy$1 = "_copy_15sq4_53";
14761
+ const headline = "_headline_15sq4_62";
14762
+ const body = "_body_15sq4_70";
14763
+ const cta$2 = "_cta_15sq4_79";
14764
+ const video = "_video_15sq4_83";
14765
+ const desktopOnly = "_desktopOnly_15sq4_87";
14766
+ const phoneOnly$1 = "_phoneOnly_15sq4_97";
14669
14767
  const hero$2 = {
14670
14768
  hero: hero$1,
14671
14769
  image: image$1,
@@ -14685,6 +14783,7 @@ function VipHero({ hero: hero2, onContinue }) {
14685
14783
  const assetUrl = useAssetUrl();
14686
14784
  const ref = useRef(null);
14687
14785
  useTopOffset(ref, "--vip-hero-top");
14786
+ useSetScreenBackdrop("media");
14688
14787
  const desktopImage = hero2.desktop_image ?? null;
14689
14788
  const desktopVideo = hero2.desktop_video ?? null;
14690
14789
  const wide2 = desktopImage !== null || desktopVideo !== null;
@@ -14762,6 +14861,7 @@ function VipInviteNotice({ title: title2, body: body3 }) {
14762
14861
  const navigate = useNavigate();
14763
14862
  const ref = useRef(null);
14764
14863
  useTopOffset(ref, "--vip-hero-top");
14864
+ useSetScreenBackdrop("media");
14765
14865
  const explore = () => {
14766
14866
  if (navigate) {
14767
14867
  navigate("/");
@@ -15740,236 +15840,57 @@ function useCartCount() {
15740
15840
  }, [subscribe]);
15741
15841
  return count2;
15742
15842
  }
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
- });
15843
+ let mounted = 0;
15844
+ const listeners = /* @__PURE__ */ new Set();
15845
+ function notify() {
15846
+ for (const listener of listeners) listener();
15803
15847
  }
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
- });
15835
- }
15836
- function useScrolledUnder(enabled) {
15837
- const [scrolled2, setScrolled] = useState(false);
15848
+ function useClaimShopNav() {
15838
15849
  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);
15850
+ mounted += 1;
15851
+ notify();
15852
+ return () => {
15853
+ mounted -= 1;
15854
+ notify();
15844
15855
  };
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
- });
15856
+ }, []);
15901
15857
  }
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
- });
15858
+ function useShopNavClaimed() {
15859
+ const [claimed, setClaimed] = useState(mounted > 0);
15860
+ useEffect(() => {
15861
+ const listener = () => setClaimed(mounted > 0);
15862
+ listeners.add(listener);
15863
+ listener();
15864
+ return () => {
15865
+ listeners.delete(listener);
15866
+ };
15867
+ }, []);
15868
+ return claimed;
15948
15869
  }
15949
15870
  const overlay = "_overlay_y4mxb_5";
15950
15871
  const scrim = "_scrim_y4mxb_21";
15951
15872
  const sheet = "_sheet_y4mxb_31";
15952
- const header = "_header_y4mxb_80";
15873
+ const header$1 = "_header_y4mxb_80";
15953
15874
  const close = "_close_y4mxb_86";
15954
15875
  const list$1 = "_list_y4mxb_105";
15955
15876
  const row = "_row_y4mxb_120";
15956
15877
  const icon = "_icon_y4mxb_149";
15957
15878
  const text = "_text_y4mxb_157";
15958
- const title = "_title_y4mxb_165";
15879
+ const title$1 = "_title_y4mxb_165";
15959
15880
  const subtitle = "_subtitle_y4mxb_172";
15960
15881
  const chevron = "_chevron_y4mxb_178";
15961
15882
  const dropdown = "_dropdown_y4mxb_187";
15962
- const styles$1 = {
15883
+ const styles$2 = {
15963
15884
  overlay,
15964
15885
  scrim,
15965
15886
  sheet,
15966
- header,
15887
+ header: header$1,
15967
15888
  close,
15968
15889
  list: list$1,
15969
15890
  row,
15970
15891
  icon,
15971
15892
  text,
15972
- title,
15893
+ title: title$1,
15973
15894
  subtitle,
15974
15895
  chevron,
15975
15896
  dropdown
@@ -16144,51 +16065,51 @@ function ShopMenuSheet({ open, onClose, onManageOrders, onHelp, closeLabel, labe
16144
16065
  } : {}
16145
16066
  }];
16146
16067
  return jsxs("div", {
16147
- className: [styles$1.overlay, placement === "dropdown" ? styles$1.dropdown : ""].filter(Boolean).join(" "),
16068
+ className: [styles$2.overlay, placement === "dropdown" ? styles$2.dropdown : ""].filter(Boolean).join(" "),
16148
16069
  children: [jsx("div", {
16149
- className: styles$1.scrim,
16070
+ className: styles$2.scrim,
16150
16071
  onClick: onClose,
16151
16072
  "aria-hidden": "true"
16152
16073
  }), jsxs(ShopSurface, {
16153
16074
  tone: "light",
16154
- className: styles$1.sheet,
16075
+ className: styles$2.sheet,
16155
16076
  role: "dialog",
16156
16077
  "aria-modal": "true",
16157
16078
  "aria-label": label2 ?? t("Shop menu"),
16158
16079
  ref: sheetRef,
16159
16080
  children: [jsx("div", {
16160
- className: styles$1.header,
16081
+ className: styles$2.header,
16161
16082
  children: jsx("button", {
16162
16083
  type: "button",
16163
- className: styles$1.close,
16084
+ className: styles$2.close,
16164
16085
  onClick: onClose,
16165
16086
  "aria-label": closeLabel ?? t("Close"),
16166
16087
  children: jsx(CloseIcon, {})
16167
16088
  })
16168
16089
  }), jsx("ul", {
16169
- className: styles$1.list,
16090
+ className: styles$2.list,
16170
16091
  children: rows.map((row2) => jsx("li", {
16171
16092
  "data-row": row2.key,
16172
16093
  children: jsxs("button", {
16173
16094
  type: "button",
16174
- className: styles$1.row,
16095
+ className: styles$2.row,
16175
16096
  onClick: row2.onSelect,
16176
16097
  disabled: !row2.onSelect,
16177
16098
  "aria-disabled": row2.onSelect ? void 0 : true,
16178
16099
  children: [row2.icon && jsx("span", {
16179
- className: styles$1.icon,
16100
+ className: styles$2.icon,
16180
16101
  children: row2.icon
16181
16102
  }), jsxs("span", {
16182
- className: styles$1.text,
16103
+ className: styles$2.text,
16183
16104
  children: [jsx("span", {
16184
- className: styles$1.title,
16105
+ className: styles$2.title,
16185
16106
  children: row2.title
16186
16107
  }), row2.subtitle && jsx("span", {
16187
- className: styles$1.subtitle,
16108
+ className: styles$2.subtitle,
16188
16109
  children: row2.subtitle
16189
16110
  })]
16190
16111
  }), jsx("span", {
16191
- className: styles$1.chevron,
16112
+ className: styles$2.chevron,
16192
16113
  children: jsx(ChevronRight, {})
16193
16114
  })]
16194
16115
  })
@@ -16197,6 +16118,57 @@ function ShopMenuSheet({ open, onClose, onManageOrders, onHelp, closeLabel, labe
16197
16118
  })]
16198
16119
  });
16199
16120
  }
16121
+ function CartIcon() {
16122
+ 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";
16123
+ return jsxs("svg", {
16124
+ width: "24",
16125
+ height: "24",
16126
+ viewBox: "0 0 24 24",
16127
+ fill: "none",
16128
+ "aria-hidden": "true",
16129
+ children: [jsx("g", {
16130
+ transform: "translate(2 3)",
16131
+ children: jsx("path", {
16132
+ fillRule: "evenodd",
16133
+ clipRule: "evenodd",
16134
+ 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",
16135
+ fill: "currentColor"
16136
+ })
16137
+ }), jsx("g", {
16138
+ transform: "translate(6 18)",
16139
+ children: jsx("path", {
16140
+ fillRule: "evenodd",
16141
+ clipRule: "evenodd",
16142
+ d: wheel,
16143
+ fill: "currentColor"
16144
+ })
16145
+ }), jsx("g", {
16146
+ transform: "translate(14 18)",
16147
+ children: jsx("path", {
16148
+ fillRule: "evenodd",
16149
+ clipRule: "evenodd",
16150
+ d: wheel,
16151
+ fill: "currentColor"
16152
+ })
16153
+ })]
16154
+ });
16155
+ }
16156
+ function MenuIcon() {
16157
+ return jsx("svg", {
16158
+ width: "24",
16159
+ height: "24",
16160
+ viewBox: "0 0 24 24",
16161
+ fill: "none",
16162
+ "aria-hidden": "true",
16163
+ children: jsx("g", {
16164
+ transform: "translate(12 12.25) rotate(90) translate(-8 -2)",
16165
+ children: jsx("path", {
16166
+ 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",
16167
+ fill: "currentColor"
16168
+ })
16169
+ })
16170
+ });
16171
+ }
16200
16172
  const bar = "_bar_10bv8_1";
16201
16173
  const media = "_media_10bv8_22";
16202
16174
  const light = "_light_10bv8_30";
@@ -16208,9 +16180,9 @@ const trail = "_trail_10bv8_64";
16208
16180
  const current = "_current_10bv8_65";
16209
16181
  const separator = "_separator_10bv8_85";
16210
16182
  const actions = "_actions_10bv8_90";
16211
- const iconBtn = "_iconBtn_10bv8_97";
16212
- const badge = "_badge_10bv8_126";
16213
- const styles = {
16183
+ const iconBtn$1 = "_iconBtn_10bv8_97";
16184
+ const badge$1 = "_badge_10bv8_126";
16185
+ const styles$1 = {
16214
16186
  bar,
16215
16187
  media,
16216
16188
  light,
@@ -16222,10 +16194,16 @@ const styles = {
16222
16194
  current,
16223
16195
  separator,
16224
16196
  actions,
16225
- iconBtn,
16226
- badge
16197
+ iconBtn: iconBtn$1,
16198
+ badge: badge$1
16227
16199
  };
16228
- function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16200
+ function ShopNav(props) {
16201
+ useClaimShopNav();
16202
+ return jsx(ShopNavBar, {
16203
+ ...props
16204
+ });
16205
+ }
16206
+ function ShopNavBar({ onManageOrders, onHelp, menuLabel, className, onMenu, showCart }) {
16229
16207
  const t = useT();
16230
16208
  const nav = useScreenNav();
16231
16209
  const bare = useScreenTrailing() === "none";
@@ -16238,17 +16216,17 @@ function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16238
16216
  const manageOrders = onManageOrders ?? (navigate ? () => navigate("/orders") : void 0);
16239
16217
  return jsxs(Fragment, {
16240
16218
  children: [jsxs("div", {
16241
- className: [styles.bar, nav.tone === "media" ? styles.media : styles.light, className ?? ""].filter(Boolean).join(" "),
16219
+ className: [styles$1.bar, nav.tone === "media" ? styles$1.media : styles$1.light, className ?? ""].filter(Boolean).join(" "),
16242
16220
  "data-shop-nav": nav.tone,
16243
16221
  children: [jsx("nav", {
16244
16222
  "aria-label": t("Breadcrumb"),
16245
- className: styles.crumbs,
16223
+ className: styles$1.crumbs,
16246
16224
  children: jsx("ol", {
16247
- className: styles.list,
16225
+ className: styles$1.list,
16248
16226
  children: nav.crumbs.map((crumb, i) => {
16249
- const role = i === last ? styles.current : i === 0 ? styles.root : styles.trail;
16227
+ const role = i === last ? styles$1.current : i === 0 ? styles$1.root : styles$1.trail;
16250
16228
  return jsxs("li", {
16251
- className: styles.item,
16229
+ className: styles$1.item,
16252
16230
  children: [i === last ? jsx("span", {
16253
16231
  className: role,
16254
16232
  "aria-current": "page",
@@ -16261,7 +16239,7 @@ function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16261
16239
  className: role,
16262
16240
  children: crumb.label
16263
16241
  }), i < last && jsx("span", {
16264
- className: styles.separator,
16242
+ className: styles$1.separator,
16265
16243
  "aria-hidden": "true",
16266
16244
  children: "›"
16267
16245
  })]
@@ -16269,22 +16247,22 @@ function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16269
16247
  })
16270
16248
  })
16271
16249
  }), !bare && jsxs("div", {
16272
- className: styles.actions,
16273
- children: [jsxs(CartTrigger, {
16274
- className: styles.iconBtn,
16250
+ className: styles$1.actions,
16251
+ children: [showCart !== false && jsxs(CartTrigger, {
16252
+ className: styles$1.iconBtn,
16275
16253
  "aria-label": cartLabel,
16276
16254
  children: [jsx(CartIcon, {}), cartCount !== null && cartCount > 0 ? jsx("span", {
16277
- className: styles.badge,
16255
+ className: styles$1.badge,
16278
16256
  "aria-hidden": "true",
16279
16257
  children: cartCount > 99 ? "99+" : cartCount
16280
16258
  }) : null]
16281
16259
  }), jsx("button", {
16282
16260
  type: "button",
16283
- className: styles.iconBtn,
16261
+ className: styles$1.iconBtn,
16284
16262
  "aria-label": menuLabel ?? t("More options"),
16285
- "aria-expanded": menuOpen,
16263
+ "aria-expanded": onMenu ? void 0 : menuOpen,
16286
16264
  "aria-haspopup": "dialog",
16287
- onClick: () => setMenuOpen((open) => !open),
16265
+ onClick: onMenu ?? (() => setMenuOpen((open) => !open)),
16288
16266
  children: jsx(MenuIcon, {})
16289
16267
  })]
16290
16268
  })]
@@ -16307,6 +16285,180 @@ function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16307
16285
  })]
16308
16286
  });
16309
16287
  }
16288
+ const header = "_header_iwoi3_14";
16289
+ const floating = "_floating_iwoi3_39";
16290
+ const scrolled = "_scrolled_iwoi3_47";
16291
+ const title = "_title_iwoi3_121";
16292
+ const leading = "_leading_iwoi3_134";
16293
+ const right = "_right_iwoi3_140";
16294
+ const spacer = "_spacer_iwoi3_153";
16295
+ const iconBtn = "_iconBtn_iwoi3_158";
16296
+ const menuBtn = "_menuBtn_iwoi3_185";
16297
+ const badge = "_badge_iwoi3_194";
16298
+ const closeSlot = "_closeSlot_iwoi3_221";
16299
+ const centred = "_centred_iwoi3_236";
16300
+ const narrowOnly = "_narrowOnly_iwoi3_243";
16301
+ const styles = {
16302
+ header,
16303
+ floating,
16304
+ scrolled,
16305
+ title,
16306
+ leading,
16307
+ right,
16308
+ spacer,
16309
+ iconBtn,
16310
+ menuBtn,
16311
+ badge,
16312
+ closeSlot,
16313
+ centred,
16314
+ narrowOnly
16315
+ };
16316
+ function ChevronLeft() {
16317
+ return jsx("svg", {
16318
+ width: "24",
16319
+ height: "24",
16320
+ viewBox: "0 0 24 24",
16321
+ fill: "none",
16322
+ "aria-hidden": "true",
16323
+ children: jsx("g", {
16324
+ transform: "translate(6.48 2.988)",
16325
+ children: jsx("path", {
16326
+ 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",
16327
+ fill: "currentColor"
16328
+ })
16329
+ })
16330
+ });
16331
+ }
16332
+ function useScrolledUnder(enabled) {
16333
+ const [scrolled2, setScrolled] = useState(false);
16334
+ useEffect(() => {
16335
+ if (!enabled) return;
16336
+ const read = (event) => {
16337
+ const target = event?.target;
16338
+ const top2 = target && target !== document && target instanceof HTMLElement ? target.scrollTop : window.scrollY || document.documentElement.scrollTop;
16339
+ setScrolled(top2 > 0);
16340
+ };
16341
+ read();
16342
+ document.addEventListener("scroll", read, {
16343
+ capture: true,
16344
+ passive: true
16345
+ });
16346
+ return () => document.removeEventListener("scroll", read, {
16347
+ capture: true
16348
+ });
16349
+ }, [enabled]);
16350
+ return enabled ? scrolled2 : false;
16351
+ }
16352
+ function CloseMedium() {
16353
+ return jsx("svg", {
16354
+ width: "24",
16355
+ height: "24",
16356
+ viewBox: "0 0 24 24",
16357
+ fill: "none",
16358
+ "aria-hidden": "true",
16359
+ children: jsx("g", {
16360
+ transform: "translate(5.03 5.03)",
16361
+ children: jsx("path", {
16362
+ 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",
16363
+ fill: "currentColor"
16364
+ })
16365
+ })
16366
+ });
16367
+ }
16368
+ function ShopHeader(props) {
16369
+ return props.context === "checkout" ? jsx(CheckoutBar, {
16370
+ ...props
16371
+ }) : jsx(ShopBar, {
16372
+ ...props
16373
+ });
16374
+ }
16375
+ function CheckoutBar({ title: title2, onClose, closeLabel, className }) {
16376
+ const t = useT();
16377
+ const classes = [styles.header, className ?? ""].filter(Boolean).join(" ");
16378
+ return jsxs("header", {
16379
+ className: classes,
16380
+ children: [jsx("span", {
16381
+ className: styles.closeSlot,
16382
+ "aria-hidden": "true"
16383
+ }), title2 ? jsx("span", {
16384
+ className: [styles.title, styles.centred].join(" "),
16385
+ children: title2
16386
+ }) : null, onClose ? jsx("button", {
16387
+ type: "button",
16388
+ className: [styles.iconBtn, styles.closeSlot].join(" "),
16389
+ "aria-label": closeLabel ?? t("Close"),
16390
+ onClick: onClose,
16391
+ children: jsx(CloseMedium, {})
16392
+ }) : jsx("span", {
16393
+ className: styles.closeSlot,
16394
+ "aria-hidden": "true"
16395
+ })]
16396
+ });
16397
+ }
16398
+ function ShopBar({ onBack, onMenu, title: title2, showCart, floating: floatingProp, scrolled: scrolled2, backLabel, menuLabel, className }) {
16399
+ const backdrop = useScreenBackdrop();
16400
+ const floating2 = floatingProp ?? backdrop === "media";
16401
+ const t = useT();
16402
+ const cartCount = useCartCount();
16403
+ const screenTitle = useScreenTitle();
16404
+ const shownTitle = title2 ?? screenTitle;
16405
+ const bare = useScreenTrailing() === "none";
16406
+ const cartOn = showCart ?? !bare;
16407
+ const menu = bare ? void 0 : onMenu;
16408
+ const hasTrailing = cartOn || Boolean(menu);
16409
+ const nav = useScreenNav();
16410
+ const navClaimed = useShopNavClaimed();
16411
+ const wide2 = Boolean(nav && nav.crumbs.length > 0);
16412
+ const atTop = useScrolledUnder(floating2 && scrolled2 === void 0);
16413
+ const isScrolled = scrolled2 ?? atTop;
16414
+ const cartLabel = cartCount === null ? t("Cart") : cartCount === 0 ? t("Cart, empty") : t("Cart, {0} item{1}", cartCount, cartCount === 1 ? "" : "s");
16415
+ const classes = [styles.header, floating2 ? styles.floating : "", floating2 && isScrolled ? styles.scrolled : "", wide2 ? styles.narrowOnly : "", className ?? ""].filter(Boolean).join(" ");
16416
+ return jsxs(Fragment, {
16417
+ children: [wide2 && !navClaimed ? jsx(ShopNavBar, {
16418
+ ...menu ? {
16419
+ onMenu: menu
16420
+ } : {},
16421
+ ...showCart === false ? {
16422
+ showCart: false
16423
+ } : {},
16424
+ ...menuLabel ? {
16425
+ menuLabel
16426
+ } : {}
16427
+ }) : null, jsxs("header", {
16428
+ className: classes,
16429
+ children: [onBack ? jsx("button", {
16430
+ type: "button",
16431
+ className: styles.iconBtn,
16432
+ "aria-label": backLabel ?? t("Back"),
16433
+ onClick: onBack,
16434
+ children: jsx(ChevronLeft, {})
16435
+ }) : jsx("span", {
16436
+ className: styles.spacer,
16437
+ "aria-hidden": "true"
16438
+ }), shownTitle ? jsx("span", {
16439
+ className: hasTrailing ? styles.title : `${styles.title} ${styles.leading}`,
16440
+ children: shownTitle
16441
+ }) : null, jsxs("div", {
16442
+ className: styles.right,
16443
+ children: [cartOn ? jsxs(CartTrigger, {
16444
+ className: styles.iconBtn,
16445
+ "aria-label": cartLabel,
16446
+ children: [jsx(CartIcon, {}), cartCount !== null && cartCount > 0 ? jsx("span", {
16447
+ className: styles.badge,
16448
+ "aria-hidden": "true",
16449
+ children: cartCount > 99 ? "99+" : cartCount
16450
+ }) : null]
16451
+ }) : null, menu ? jsx("button", {
16452
+ type: "button",
16453
+ className: `${styles.iconBtn} ${styles.menuBtn}`,
16454
+ "aria-label": menuLabel ?? t("More options"),
16455
+ onClick: menu,
16456
+ children: jsx(MenuIcon, {})
16457
+ }) : null]
16458
+ })]
16459
+ })]
16460
+ });
16461
+ }
16310
16462
  function major(money2) {
16311
16463
  return money2.amount / 100;
16312
16464
  }