@nok-integration/storefront-react 0.29.7 → 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 = {
@@ -8643,7 +8702,7 @@ function ReturnFlowContent({ orderRef, returnRef, onDone, locale }) {
8643
8702
  onRetry: () => void load()
8644
8703
  });
8645
8704
  }
8646
- if (!order.can_return) {
8705
+ if (!order.can_return || order.vip) {
8647
8706
  return jsx(ErrorState, {
8648
8707
  code: "order_not_cancellable",
8649
8708
  onRetry: () => void load()
@@ -9183,10 +9242,6 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onO
9183
9242
  onReorder();
9184
9243
  return;
9185
9244
  }
9186
- if (current22.vip) {
9187
- navigate?.(`/vip/${encodeURIComponent(current22.vip.invite_ref)}`);
9188
- return;
9189
- }
9190
9245
  setReordering(true);
9191
9246
  try {
9192
9247
  let added = 0;
@@ -9235,7 +9290,7 @@ function OrderTrackingContent({ orderRef, locale: localeProp, onStartReturn, onO
9235
9290
  className: styles$D.cancelledMeta,
9236
9291
  children: t("Order #{0} · Placed {1}", shortRef$1(order.order_ref), placedOn(order.placed_at, locale))
9237
9292
  })]
9238
- }), jsx(Button, {
9293
+ }), !order.vip && jsx(Button, {
9239
9294
  variant: "primary",
9240
9295
  fullWidth: true,
9241
9296
  className: styles$D.reorder,
@@ -9361,7 +9416,7 @@ function NeedHelp({ order, onStartReturn, onOpenReturn, onContactSupport }) {
9361
9416
  label: returns.length > 1 ? t("Track return {0}", ret.return_ref) : "Track your return",
9362
9417
  status: RETURN_STATUS[ret.status] ?? ret.status.replace(/_/g, " "),
9363
9418
  onClick: () => onOpenReturn?.(ret.return_ref)
9364
- }, ret.return_ref)), order.can_return && onStartReturn && jsx(HelpRow, {
9419
+ }, ret.return_ref)), order.can_return && !order.vip && onStartReturn && jsx(HelpRow, {
9365
9420
  label: "Start a return",
9366
9421
  onClick: onStartReturn
9367
9422
  }), jsx(HelpRow, {
@@ -10966,11 +11021,11 @@ const styles$q = {
10966
11021
  label: label$1,
10967
11022
  divider: divider$1
10968
11023
  };
10969
- function ShippingInfo() {
11024
+ function ShippingInfo({ returns = true } = {}) {
10970
11025
  const t = useT();
10971
11026
  return jsxs("section", {
10972
11027
  className: styles$q.box,
10973
- "aria-label": t("Shipping and returns"),
11028
+ "aria-label": returns ? t("Shipping and returns") : t("Shipping"),
10974
11029
  children: [jsxs("div", {
10975
11030
  className: styles$q.row,
10976
11031
  children: [jsx("svg", {
@@ -10988,10 +11043,10 @@ function ShippingInfo() {
10988
11043
  className: styles$q.label,
10989
11044
  children: t("Standard or express delivery")
10990
11045
  })]
10991
- }), jsx("div", {
11046
+ }), returns && jsx("div", {
10992
11047
  className: styles$q.divider,
10993
11048
  role: "presentation"
10994
- }), jsxs("div", {
11049
+ }), returns && jsxs("div", {
10995
11050
  className: styles$q.row,
10996
11051
  children: [jsx("svg", {
10997
11052
  className: styles$q.icon,
@@ -12458,7 +12513,9 @@ function ProductDetail({ product, inventory: inventory2, recommendations = [], c
12458
12513
  variants,
12459
12514
  selectedSku: genericSku,
12460
12515
  onSelect: setGenericSku
12461
- }), jsx(ShippingInfo, {}), product.description && jsx(ProductDetails, {
12516
+ }), jsx(ShippingInfo, {
12517
+ returns: !claim
12518
+ }), product.description && jsx(ProductDetails, {
12462
12519
  description: product.description
12463
12520
  })]
12464
12521
  }), related.length > 0 && jsx("div", {
@@ -15742,236 +15799,57 @@ function useCartCount() {
15742
15799
  }, [subscribe]);
15743
15800
  return count2;
15744
15801
  }
15745
- const header$1 = "_header_r9jjq_14";
15746
- const floating = "_floating_r9jjq_39";
15747
- const scrolled = "_scrolled_r9jjq_47";
15748
- const title$1 = "_title_r9jjq_121";
15749
- const leading = "_leading_r9jjq_134";
15750
- const right = "_right_r9jjq_140";
15751
- const spacer = "_spacer_r9jjq_153";
15752
- const iconBtn$1 = "_iconBtn_r9jjq_158";
15753
- const menuBtn = "_menuBtn_r9jjq_185";
15754
- const badge$1 = "_badge_r9jjq_194";
15755
- const closeSlot = "_closeSlot_r9jjq_221";
15756
- const centred = "_centred_r9jjq_236";
15757
- const styles$2 = {
15758
- header: header$1,
15759
- floating,
15760
- scrolled,
15761
- title: title$1,
15762
- leading,
15763
- right,
15764
- spacer,
15765
- iconBtn: iconBtn$1,
15766
- menuBtn,
15767
- badge: badge$1,
15768
- closeSlot,
15769
- centred
15770
- };
15771
- function CartIcon() {
15772
- 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";
15773
- return jsxs("svg", {
15774
- width: "24",
15775
- height: "24",
15776
- viewBox: "0 0 24 24",
15777
- fill: "none",
15778
- "aria-hidden": "true",
15779
- children: [jsx("g", {
15780
- transform: "translate(2 3)",
15781
- children: jsx("path", {
15782
- fillRule: "evenodd",
15783
- clipRule: "evenodd",
15784
- 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",
15785
- fill: "currentColor"
15786
- })
15787
- }), jsx("g", {
15788
- transform: "translate(6 18)",
15789
- children: jsx("path", {
15790
- fillRule: "evenodd",
15791
- clipRule: "evenodd",
15792
- d: wheel,
15793
- fill: "currentColor"
15794
- })
15795
- }), jsx("g", {
15796
- transform: "translate(14 18)",
15797
- children: jsx("path", {
15798
- fillRule: "evenodd",
15799
- clipRule: "evenodd",
15800
- d: wheel,
15801
- fill: "currentColor"
15802
- })
15803
- })]
15804
- });
15805
- }
15806
- function MenuIcon() {
15807
- return jsx("svg", {
15808
- width: "24",
15809
- height: "24",
15810
- viewBox: "0 0 24 24",
15811
- fill: "none",
15812
- "aria-hidden": "true",
15813
- children: jsx("g", {
15814
- transform: "translate(12 12.25) rotate(90) translate(-8 -2)",
15815
- children: jsx("path", {
15816
- 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",
15817
- fill: "currentColor"
15818
- })
15819
- })
15820
- });
15802
+ let mounted = 0;
15803
+ const listeners = /* @__PURE__ */ new Set();
15804
+ function notify() {
15805
+ for (const listener of listeners) listener();
15821
15806
  }
15822
- function ChevronLeft() {
15823
- return jsx("svg", {
15824
- width: "24",
15825
- height: "24",
15826
- viewBox: "0 0 24 24",
15827
- fill: "none",
15828
- "aria-hidden": "true",
15829
- children: jsx("g", {
15830
- transform: "translate(6.48 2.988)",
15831
- children: jsx("path", {
15832
- 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",
15833
- fill: "currentColor"
15834
- })
15835
- })
15836
- });
15837
- }
15838
- function useScrolledUnder(enabled) {
15839
- const [scrolled2, setScrolled] = useState(false);
15807
+ function useClaimShopNav() {
15840
15808
  useEffect(() => {
15841
- if (!enabled) return;
15842
- const read = (event) => {
15843
- const target = event?.target;
15844
- const top2 = target && target !== document && target instanceof HTMLElement ? target.scrollTop : window.scrollY || document.documentElement.scrollTop;
15845
- setScrolled(top2 > 0);
15809
+ mounted += 1;
15810
+ notify();
15811
+ return () => {
15812
+ mounted -= 1;
15813
+ notify();
15846
15814
  };
15847
- read();
15848
- document.addEventListener("scroll", read, {
15849
- capture: true,
15850
- passive: true
15851
- });
15852
- return () => document.removeEventListener("scroll", read, {
15853
- capture: true
15854
- });
15855
- }, [enabled]);
15856
- return enabled ? scrolled2 : false;
15857
- }
15858
- function CloseMedium() {
15859
- return jsx("svg", {
15860
- width: "24",
15861
- height: "24",
15862
- viewBox: "0 0 24 24",
15863
- fill: "none",
15864
- "aria-hidden": "true",
15865
- children: jsx("g", {
15866
- transform: "translate(5.03 5.03)",
15867
- children: jsx("path", {
15868
- 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",
15869
- fill: "currentColor"
15870
- })
15871
- })
15872
- });
15873
- }
15874
- function ShopHeader(props) {
15875
- return props.context === "checkout" ? jsx(CheckoutBar, {
15876
- ...props
15877
- }) : jsx(ShopBar, {
15878
- ...props
15879
- });
15880
- }
15881
- function CheckoutBar({ title: title2, onClose, closeLabel, className }) {
15882
- const t = useT();
15883
- const classes = [styles$2.header, className ?? ""].filter(Boolean).join(" ");
15884
- return jsxs("header", {
15885
- className: classes,
15886
- children: [jsx("span", {
15887
- className: styles$2.closeSlot,
15888
- "aria-hidden": "true"
15889
- }), title2 ? jsx("span", {
15890
- className: [styles$2.title, styles$2.centred].join(" "),
15891
- children: title2
15892
- }) : null, onClose ? jsx("button", {
15893
- type: "button",
15894
- className: [styles$2.iconBtn, styles$2.closeSlot].join(" "),
15895
- "aria-label": closeLabel ?? t("Close"),
15896
- onClick: onClose,
15897
- children: jsx(CloseMedium, {})
15898
- }) : jsx("span", {
15899
- className: styles$2.closeSlot,
15900
- "aria-hidden": "true"
15901
- })]
15902
- });
15815
+ }, []);
15903
15816
  }
15904
- function ShopBar({ onBack, onMenu, title: title2, showCart, floating: floating2 = false, scrolled: scrolled2, backLabel, menuLabel, className }) {
15905
- const t = useT();
15906
- const cartCount = useCartCount();
15907
- const screenTitle = useScreenTitle();
15908
- const shownTitle = title2 ?? screenTitle;
15909
- const bare = useScreenTrailing() === "none";
15910
- const cartOn = showCart ?? !bare;
15911
- const menu = bare ? void 0 : onMenu;
15912
- const hasTrailing = cartOn || Boolean(menu);
15913
- const atTop = useScrolledUnder(floating2 && scrolled2 === void 0);
15914
- const isScrolled = scrolled2 ?? atTop;
15915
- const cartLabel = cartCount === null ? t("Cart") : cartCount === 0 ? t("Cart, empty") : t("Cart, {0} item{1}", cartCount, cartCount === 1 ? "" : "s");
15916
- const classes = [styles$2.header, floating2 ? styles$2.floating : "", floating2 && isScrolled ? styles$2.scrolled : "", className ?? ""].filter(Boolean).join(" ");
15917
- return jsxs("header", {
15918
- className: classes,
15919
- children: [onBack ? jsx("button", {
15920
- type: "button",
15921
- className: styles$2.iconBtn,
15922
- "aria-label": backLabel ?? t("Back"),
15923
- onClick: onBack,
15924
- children: jsx(ChevronLeft, {})
15925
- }) : jsx("span", {
15926
- className: styles$2.spacer,
15927
- "aria-hidden": "true"
15928
- }), shownTitle ? jsx("span", {
15929
- className: hasTrailing ? styles$2.title : `${styles$2.title} ${styles$2.leading}`,
15930
- children: shownTitle
15931
- }) : null, jsxs("div", {
15932
- className: styles$2.right,
15933
- children: [cartOn ? jsxs(CartTrigger, {
15934
- className: styles$2.iconBtn,
15935
- "aria-label": cartLabel,
15936
- children: [jsx(CartIcon, {}), cartCount !== null && cartCount > 0 ? jsx("span", {
15937
- className: styles$2.badge,
15938
- "aria-hidden": "true",
15939
- children: cartCount > 99 ? "99+" : cartCount
15940
- }) : null]
15941
- }) : null, menu ? jsx("button", {
15942
- type: "button",
15943
- className: `${styles$2.iconBtn} ${styles$2.menuBtn}`,
15944
- "aria-label": menuLabel ?? t("More options"),
15945
- onClick: menu,
15946
- children: jsx(MenuIcon, {})
15947
- }) : null]
15948
- })]
15949
- });
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;
15950
15828
  }
15951
15829
  const overlay = "_overlay_y4mxb_5";
15952
15830
  const scrim = "_scrim_y4mxb_21";
15953
15831
  const sheet = "_sheet_y4mxb_31";
15954
- const header = "_header_y4mxb_80";
15832
+ const header$1 = "_header_y4mxb_80";
15955
15833
  const close = "_close_y4mxb_86";
15956
15834
  const list$1 = "_list_y4mxb_105";
15957
15835
  const row = "_row_y4mxb_120";
15958
15836
  const icon = "_icon_y4mxb_149";
15959
15837
  const text = "_text_y4mxb_157";
15960
- const title = "_title_y4mxb_165";
15838
+ const title$1 = "_title_y4mxb_165";
15961
15839
  const subtitle = "_subtitle_y4mxb_172";
15962
15840
  const chevron = "_chevron_y4mxb_178";
15963
15841
  const dropdown = "_dropdown_y4mxb_187";
15964
- const styles$1 = {
15842
+ const styles$2 = {
15965
15843
  overlay,
15966
15844
  scrim,
15967
15845
  sheet,
15968
- header,
15846
+ header: header$1,
15969
15847
  close,
15970
15848
  list: list$1,
15971
15849
  row,
15972
15850
  icon,
15973
15851
  text,
15974
- title,
15852
+ title: title$1,
15975
15853
  subtitle,
15976
15854
  chevron,
15977
15855
  dropdown
@@ -16146,51 +16024,51 @@ function ShopMenuSheet({ open, onClose, onManageOrders, onHelp, closeLabel, labe
16146
16024
  } : {}
16147
16025
  }];
16148
16026
  return jsxs("div", {
16149
- 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(" "),
16150
16028
  children: [jsx("div", {
16151
- className: styles$1.scrim,
16029
+ className: styles$2.scrim,
16152
16030
  onClick: onClose,
16153
16031
  "aria-hidden": "true"
16154
16032
  }), jsxs(ShopSurface, {
16155
16033
  tone: "light",
16156
- className: styles$1.sheet,
16034
+ className: styles$2.sheet,
16157
16035
  role: "dialog",
16158
16036
  "aria-modal": "true",
16159
16037
  "aria-label": label2 ?? t("Shop menu"),
16160
16038
  ref: sheetRef,
16161
16039
  children: [jsx("div", {
16162
- className: styles$1.header,
16040
+ className: styles$2.header,
16163
16041
  children: jsx("button", {
16164
16042
  type: "button",
16165
- className: styles$1.close,
16043
+ className: styles$2.close,
16166
16044
  onClick: onClose,
16167
16045
  "aria-label": closeLabel ?? t("Close"),
16168
16046
  children: jsx(CloseIcon, {})
16169
16047
  })
16170
16048
  }), jsx("ul", {
16171
- className: styles$1.list,
16049
+ className: styles$2.list,
16172
16050
  children: rows.map((row2) => jsx("li", {
16173
16051
  "data-row": row2.key,
16174
16052
  children: jsxs("button", {
16175
16053
  type: "button",
16176
- className: styles$1.row,
16054
+ className: styles$2.row,
16177
16055
  onClick: row2.onSelect,
16178
16056
  disabled: !row2.onSelect,
16179
16057
  "aria-disabled": row2.onSelect ? void 0 : true,
16180
16058
  children: [row2.icon && jsx("span", {
16181
- className: styles$1.icon,
16059
+ className: styles$2.icon,
16182
16060
  children: row2.icon
16183
16061
  }), jsxs("span", {
16184
- className: styles$1.text,
16062
+ className: styles$2.text,
16185
16063
  children: [jsx("span", {
16186
- className: styles$1.title,
16064
+ className: styles$2.title,
16187
16065
  children: row2.title
16188
16066
  }), row2.subtitle && jsx("span", {
16189
- className: styles$1.subtitle,
16067
+ className: styles$2.subtitle,
16190
16068
  children: row2.subtitle
16191
16069
  })]
16192
16070
  }), jsx("span", {
16193
- className: styles$1.chevron,
16071
+ className: styles$2.chevron,
16194
16072
  children: jsx(ChevronRight, {})
16195
16073
  })]
16196
16074
  })
@@ -16199,6 +16077,57 @@ function ShopMenuSheet({ open, onClose, onManageOrders, onHelp, closeLabel, labe
16199
16077
  })]
16200
16078
  });
16201
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
+ }
16202
16131
  const bar = "_bar_10bv8_1";
16203
16132
  const media = "_media_10bv8_22";
16204
16133
  const light = "_light_10bv8_30";
@@ -16210,9 +16139,9 @@ const trail = "_trail_10bv8_64";
16210
16139
  const current = "_current_10bv8_65";
16211
16140
  const separator = "_separator_10bv8_85";
16212
16141
  const actions = "_actions_10bv8_90";
16213
- const iconBtn = "_iconBtn_10bv8_97";
16214
- const badge = "_badge_10bv8_126";
16215
- const styles = {
16142
+ const iconBtn$1 = "_iconBtn_10bv8_97";
16143
+ const badge$1 = "_badge_10bv8_126";
16144
+ const styles$1 = {
16216
16145
  bar,
16217
16146
  media,
16218
16147
  light,
@@ -16224,10 +16153,16 @@ const styles = {
16224
16153
  current,
16225
16154
  separator,
16226
16155
  actions,
16227
- iconBtn,
16228
- badge
16156
+ iconBtn: iconBtn$1,
16157
+ badge: badge$1
16229
16158
  };
16230
- 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 }) {
16231
16166
  const t = useT();
16232
16167
  const nav = useScreenNav();
16233
16168
  const bare = useScreenTrailing() === "none";
@@ -16240,17 +16175,17 @@ function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16240
16175
  const manageOrders = onManageOrders ?? (navigate ? () => navigate("/orders") : void 0);
16241
16176
  return jsxs(Fragment, {
16242
16177
  children: [jsxs("div", {
16243
- 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(" "),
16244
16179
  "data-shop-nav": nav.tone,
16245
16180
  children: [jsx("nav", {
16246
16181
  "aria-label": t("Breadcrumb"),
16247
- className: styles.crumbs,
16182
+ className: styles$1.crumbs,
16248
16183
  children: jsx("ol", {
16249
- className: styles.list,
16184
+ className: styles$1.list,
16250
16185
  children: nav.crumbs.map((crumb, i) => {
16251
- 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;
16252
16187
  return jsxs("li", {
16253
- className: styles.item,
16188
+ className: styles$1.item,
16254
16189
  children: [i === last ? jsx("span", {
16255
16190
  className: role,
16256
16191
  "aria-current": "page",
@@ -16263,7 +16198,7 @@ function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16263
16198
  className: role,
16264
16199
  children: crumb.label
16265
16200
  }), i < last && jsx("span", {
16266
- className: styles.separator,
16201
+ className: styles$1.separator,
16267
16202
  "aria-hidden": "true",
16268
16203
  children: "›"
16269
16204
  })]
@@ -16271,22 +16206,22 @@ function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16271
16206
  })
16272
16207
  })
16273
16208
  }), !bare && jsxs("div", {
16274
- className: styles.actions,
16275
- children: [jsxs(CartTrigger, {
16276
- className: styles.iconBtn,
16209
+ className: styles$1.actions,
16210
+ children: [showCart !== false && jsxs(CartTrigger, {
16211
+ className: styles$1.iconBtn,
16277
16212
  "aria-label": cartLabel,
16278
16213
  children: [jsx(CartIcon, {}), cartCount !== null && cartCount > 0 ? jsx("span", {
16279
- className: styles.badge,
16214
+ className: styles$1.badge,
16280
16215
  "aria-hidden": "true",
16281
16216
  children: cartCount > 99 ? "99+" : cartCount
16282
16217
  }) : null]
16283
16218
  }), jsx("button", {
16284
16219
  type: "button",
16285
- className: styles.iconBtn,
16220
+ className: styles$1.iconBtn,
16286
16221
  "aria-label": menuLabel ?? t("More options"),
16287
- "aria-expanded": menuOpen,
16222
+ "aria-expanded": onMenu ? void 0 : menuOpen,
16288
16223
  "aria-haspopup": "dialog",
16289
- onClick: () => setMenuOpen((open) => !open),
16224
+ onClick: onMenu ?? (() => setMenuOpen((open) => !open)),
16290
16225
  children: jsx(MenuIcon, {})
16291
16226
  })]
16292
16227
  })]
@@ -16309,6 +16244,178 @@ function ShopNav({ onManageOrders, onHelp, menuLabel, className }) {
16309
16244
  })]
16310
16245
  });
16311
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
+ }
16312
16419
  function major(money2) {
16313
16420
  return money2.amount / 100;
16314
16421
  }