@nok-integration/storefront-react 0.29.15 → 0.29.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -6115,6 +6115,8 @@ export declare type ShopEvent = {
6115
6115
  | {
6116
6116
  type: 'support_requested';
6117
6117
  orderRef: string;
6118
+ } | {
6119
+ type: 'help_requested';
6118
6120
  }
6119
6121
  /**
6120
6122
  * The fan confirmed a cancellation and the engine accepted it.
@@ -6222,6 +6224,7 @@ export declare interface ShopHeaderProps {
6222
6224
  * and cannot know which screen it is over.
6223
6225
  */
6224
6226
  onMenu?: () => void;
6227
+ onHelp?: () => void;
6225
6228
  /**
6226
6229
  * The screen name, drawn between the back control and the icons (Figma `mobile/header`
6227
6230
  * carries "DAZN Shop" here on the shop entry).
@@ -6277,6 +6280,7 @@ export declare interface ShopHeaderProps {
6277
6280
  /** Accessible name for the back control, for a host that is not in English. */
6278
6281
  backLabel?: string;
6279
6282
  menuLabel?: string;
6283
+ helpLabel?: string;
6280
6284
  closeLabel?: string;
6281
6285
  className?: string;
6282
6286
  }
package/dist/index.mjs CHANGED
@@ -5761,6 +5761,7 @@ async function restoreSetAside(cart2, writer, query, { force = false } = {}) {
5761
5761
  const ScreenTitleContext = createContext({
5762
5762
  title: void 0,
5763
5763
  trailing: "default",
5764
+ leading: "default",
5764
5765
  claim: () => () => {
5765
5766
  }
5766
5767
  });
@@ -5768,23 +5769,27 @@ const SuppressedContext = createContext(false);
5768
5769
  function ScreenTitleProvider({ children }) {
5769
5770
  const [title2, setTitle] = useState(void 0);
5770
5771
  const [trailing, setTrailing] = useState("default");
5772
+ const [leading2, setLeading] = useState("default");
5771
5773
  const held = useRef(void 0);
5772
- const claim = useCallback((next, nextTrailing) => {
5774
+ const claim = useCallback((next, nextTrailing, nextLeading) => {
5773
5775
  held.current = next;
5774
5776
  setTitle(next);
5775
5777
  setTrailing(nextTrailing);
5778
+ setLeading(nextLeading);
5776
5779
  return () => {
5777
5780
  if (held.current !== next) return;
5778
5781
  held.current = void 0;
5779
5782
  setTitle(void 0);
5780
5783
  setTrailing("default");
5784
+ setLeading("default");
5781
5785
  };
5782
5786
  }, []);
5783
5787
  const value2 = useMemo(() => ({
5784
5788
  title: title2,
5785
5789
  trailing,
5790
+ leading: leading2,
5786
5791
  claim
5787
- }), [title2, trailing, claim]);
5792
+ }), [title2, trailing, leading2, claim]);
5788
5793
  return jsx(ScreenTitleContext.Provider, {
5789
5794
  value: value2,
5790
5795
  children: jsx(ScreenNavProvider, {
@@ -5800,13 +5805,16 @@ function useScreenTitle() {
5800
5805
  function useScreenTrailing() {
5801
5806
  return useContext(ScreenTitleContext).trailing;
5802
5807
  }
5803
- function useSetScreenTitle(title2, trailing = "default") {
5808
+ function useScreenLeading() {
5809
+ return useContext(ScreenTitleContext).leading;
5810
+ }
5811
+ function useSetScreenTitle(title2, trailing = "default", leading2 = "default") {
5804
5812
  const { claim } = useContext(ScreenTitleContext);
5805
5813
  const suppressed = useContext(SuppressedContext);
5806
5814
  useEffect(() => {
5807
5815
  if (suppressed || title2 === void 0) return;
5808
- return claim(title2, trailing);
5809
- }, [claim, title2, trailing, suppressed]);
5816
+ return claim(title2, trailing, leading2);
5817
+ }, [claim, title2, trailing, leading2, suppressed]);
5810
5818
  }
5811
5819
  function NoScreenTitle({ children }) {
5812
5820
  return jsx(SuppressedContext.Provider, {
@@ -6523,6 +6531,7 @@ const ES = {
6523
6531
  "Gallery pagination": "Paginación de la galería",
6524
6532
  "Go to image {0}": "Ir a la imagen {0}",
6525
6533
  "Heavyweight comfort built for training days and off-duty moments": "Comodidad y resistencia pensadas para los días de entrenamiento y los momentos de ocio",
6534
+ Help: "Ayuda",
6526
6535
  "Help & Support": "Ayuda y asistencia",
6527
6536
  Hoodies: "Sudaderas con capucha",
6528
6537
  "Increase quantity": "Aumentar la cantidad",
@@ -15116,7 +15125,7 @@ function VipLandingView({ token, onUnavailable, screen: screen2 = "hero" }) {
15116
15125
  const [attempt, setAttempt] = useState(0);
15117
15126
  const emitRef = useRef(emit);
15118
15127
  emitRef.current = emit;
15119
- useSetScreenTitle(t("DAZN Shop"), "none");
15128
+ useSetScreenTitle(screen2 === "product" ? "" : t("DAZN Shop"), "help", screen2 === "product" ? "default" : "none");
15120
15129
  useEffect(() => {
15121
15130
  const target = locatorOf(token);
15122
15131
  if (!target) {
@@ -16505,17 +16514,22 @@ function CheckoutBar({ title: title2, onClose, closeLabel, className }) {
16505
16514
  })]
16506
16515
  });
16507
16516
  }
16508
- function ShopBar({ onBack, onMenu, title: title2, showCart, floating: floatingProp, scrolled: scrolled2, backLabel, menuLabel, className }) {
16517
+ function ShopBar({ onBack, onMenu, onHelp, helpLabel, title: title2, showCart, floating: floatingProp, scrolled: scrolled2, backLabel, menuLabel, className }) {
16509
16518
  const backdrop = useScreenBackdrop();
16510
- const floating2 = floatingProp ?? backdrop === "media";
16519
+ const floating2 = backdrop === "media" || (floatingProp ?? false);
16511
16520
  const t = useT();
16521
+ const emit = useShopEvent();
16522
+ const leading2 = useScreenLeading();
16523
+ const back = leading2 === "none" ? void 0 : onBack;
16512
16524
  const cartCount = useCartCount();
16513
16525
  const screenTitle = useScreenTitle();
16514
16526
  const shownTitle = title2 ?? screenTitle;
16515
- const bare = useScreenTrailing() === "none";
16516
- const cartOn = showCart ?? !bare;
16527
+ const trailing = useScreenTrailing();
16528
+ const help2 = trailing === "help";
16529
+ const bare = trailing !== "default";
16530
+ const cartOn = help2 ? false : showCart ?? !bare;
16517
16531
  const menu = bare ? void 0 : onMenu;
16518
- const hasTrailing = cartOn || Boolean(menu);
16532
+ const hasTrailing = cartOn || Boolean(menu) || help2;
16519
16533
  const nav = useScreenNav();
16520
16534
  const navClaimed = useShopNavClaimed();
16521
16535
  const wide2 = Boolean(nav && nav.crumbs.length > 0);
@@ -16536,13 +16550,13 @@ function ShopBar({ onBack, onMenu, title: title2, showCart, floating: floatingPr
16536
16550
  } : {}
16537
16551
  }) : null, jsxs("header", {
16538
16552
  className: classes,
16539
- children: [onBack ? jsx("button", {
16553
+ children: [back ? jsx("button", {
16540
16554
  type: "button",
16541
16555
  className: styles.iconBtn,
16542
16556
  "aria-label": backLabel ?? t("Back"),
16543
- onClick: onBack,
16557
+ onClick: back,
16544
16558
  children: jsx(ChevronLeft, {})
16545
- }) : jsx("span", {
16559
+ }) : leading2 === "none" ? null : jsx("span", {
16546
16560
  className: styles.spacer,
16547
16561
  "aria-hidden": "true"
16548
16562
  }), shownTitle ? jsx("span", {
@@ -16558,6 +16572,17 @@ function ShopBar({ onBack, onMenu, title: title2, showCart, floating: floatingPr
16558
16572
  "aria-hidden": "true",
16559
16573
  children: cartCount > 99 ? "99+" : cartCount
16560
16574
  }) : null]
16575
+ }) : null, help2 ? jsx("button", {
16576
+ type: "button",
16577
+ className: `${styles.iconBtn} ${styles.menuBtn}`,
16578
+ "aria-label": helpLabel ?? t("Help"),
16579
+ onClick: () => {
16580
+ emit({
16581
+ type: "help_requested"
16582
+ });
16583
+ onHelp?.();
16584
+ },
16585
+ children: jsx(HelpIcon, {})
16561
16586
  }) : null, menu ? jsx("button", {
16562
16587
  type: "button",
16563
16588
  className: `${styles.iconBtn} ${styles.menuBtn}`,
@@ -16654,6 +16679,7 @@ function toGa4Event(event) {
16654
16679
  case "ready":
16655
16680
  case "navigate":
16656
16681
  case "support_requested":
16682
+ case "help_requested":
16657
16683
  case "order_cancellation_requested":
16658
16684
  case "reorder_requested":
16659
16685
  case "session_required":
@@ -5761,6 +5761,7 @@ async function restoreSetAside(cart2, writer, query, { force = false } = {}) {
5761
5761
  const ScreenTitleContext = createContext({
5762
5762
  title: void 0,
5763
5763
  trailing: "default",
5764
+ leading: "default",
5764
5765
  claim: () => () => {
5765
5766
  }
5766
5767
  });
@@ -5768,23 +5769,27 @@ const SuppressedContext = createContext(false);
5768
5769
  function ScreenTitleProvider({ children }) {
5769
5770
  const [title2, setTitle] = useState(void 0);
5770
5771
  const [trailing, setTrailing] = useState("default");
5772
+ const [leading2, setLeading] = useState("default");
5771
5773
  const held = useRef(void 0);
5772
- const claim = useCallback((next, nextTrailing) => {
5774
+ const claim = useCallback((next, nextTrailing, nextLeading) => {
5773
5775
  held.current = next;
5774
5776
  setTitle(next);
5775
5777
  setTrailing(nextTrailing);
5778
+ setLeading(nextLeading);
5776
5779
  return () => {
5777
5780
  if (held.current !== next) return;
5778
5781
  held.current = void 0;
5779
5782
  setTitle(void 0);
5780
5783
  setTrailing("default");
5784
+ setLeading("default");
5781
5785
  };
5782
5786
  }, []);
5783
5787
  const value2 = useMemo(() => ({
5784
5788
  title: title2,
5785
5789
  trailing,
5790
+ leading: leading2,
5786
5791
  claim
5787
- }), [title2, trailing, claim]);
5792
+ }), [title2, trailing, leading2, claim]);
5788
5793
  return jsx(ScreenTitleContext.Provider, {
5789
5794
  value: value2,
5790
5795
  children: jsx(ScreenNavProvider, {
@@ -5800,13 +5805,16 @@ function useScreenTitle() {
5800
5805
  function useScreenTrailing() {
5801
5806
  return useContext(ScreenTitleContext).trailing;
5802
5807
  }
5803
- function useSetScreenTitle(title2, trailing = "default") {
5808
+ function useScreenLeading() {
5809
+ return useContext(ScreenTitleContext).leading;
5810
+ }
5811
+ function useSetScreenTitle(title2, trailing = "default", leading2 = "default") {
5804
5812
  const { claim } = useContext(ScreenTitleContext);
5805
5813
  const suppressed = useContext(SuppressedContext);
5806
5814
  useEffect(() => {
5807
5815
  if (suppressed || title2 === void 0) return;
5808
- return claim(title2, trailing);
5809
- }, [claim, title2, trailing, suppressed]);
5816
+ return claim(title2, trailing, leading2);
5817
+ }, [claim, title2, trailing, leading2, suppressed]);
5810
5818
  }
5811
5819
  function NoScreenTitle({ children }) {
5812
5820
  return jsx(SuppressedContext.Provider, {
@@ -6523,6 +6531,7 @@ const ES = {
6523
6531
  "Gallery pagination": "Paginación de la galería",
6524
6532
  "Go to image {0}": "Ir a la imagen {0}",
6525
6533
  "Heavyweight comfort built for training days and off-duty moments": "Comodidad y resistencia pensadas para los días de entrenamiento y los momentos de ocio",
6534
+ Help: "Ayuda",
6526
6535
  "Help & Support": "Ayuda y asistencia",
6527
6536
  Hoodies: "Sudaderas con capucha",
6528
6537
  "Increase quantity": "Aumentar la cantidad",
@@ -15116,7 +15125,7 @@ function VipLandingView({ token, onUnavailable, screen: screen2 = "hero" }) {
15116
15125
  const [attempt, setAttempt] = useState(0);
15117
15126
  const emitRef = useRef(emit);
15118
15127
  emitRef.current = emit;
15119
- useSetScreenTitle(t("DAZN Shop"), "none");
15128
+ useSetScreenTitle(screen2 === "product" ? "" : t("DAZN Shop"), "help", screen2 === "product" ? "default" : "none");
15120
15129
  useEffect(() => {
15121
15130
  const target = locatorOf(token);
15122
15131
  if (!target) {
@@ -16505,17 +16514,22 @@ function CheckoutBar({ title: title2, onClose, closeLabel, className }) {
16505
16514
  })]
16506
16515
  });
16507
16516
  }
16508
- function ShopBar({ onBack, onMenu, title: title2, showCart, floating: floatingProp, scrolled: scrolled2, backLabel, menuLabel, className }) {
16517
+ function ShopBar({ onBack, onMenu, onHelp, helpLabel, title: title2, showCart, floating: floatingProp, scrolled: scrolled2, backLabel, menuLabel, className }) {
16509
16518
  const backdrop = useScreenBackdrop();
16510
- const floating2 = floatingProp ?? backdrop === "media";
16519
+ const floating2 = backdrop === "media" || (floatingProp ?? false);
16511
16520
  const t = useT();
16521
+ const emit = useShopEvent();
16522
+ const leading2 = useScreenLeading();
16523
+ const back = leading2 === "none" ? void 0 : onBack;
16512
16524
  const cartCount = useCartCount();
16513
16525
  const screenTitle = useScreenTitle();
16514
16526
  const shownTitle = title2 ?? screenTitle;
16515
- const bare = useScreenTrailing() === "none";
16516
- const cartOn = showCart ?? !bare;
16527
+ const trailing = useScreenTrailing();
16528
+ const help2 = trailing === "help";
16529
+ const bare = trailing !== "default";
16530
+ const cartOn = help2 ? false : showCart ?? !bare;
16517
16531
  const menu = bare ? void 0 : onMenu;
16518
- const hasTrailing = cartOn || Boolean(menu);
16532
+ const hasTrailing = cartOn || Boolean(menu) || help2;
16519
16533
  const nav = useScreenNav();
16520
16534
  const navClaimed = useShopNavClaimed();
16521
16535
  const wide2 = Boolean(nav && nav.crumbs.length > 0);
@@ -16536,13 +16550,13 @@ function ShopBar({ onBack, onMenu, title: title2, showCart, floating: floatingPr
16536
16550
  } : {}
16537
16551
  }) : null, jsxs("header", {
16538
16552
  className: classes,
16539
- children: [onBack ? jsx("button", {
16553
+ children: [back ? jsx("button", {
16540
16554
  type: "button",
16541
16555
  className: styles.iconBtn,
16542
16556
  "aria-label": backLabel ?? t("Back"),
16543
- onClick: onBack,
16557
+ onClick: back,
16544
16558
  children: jsx(ChevronLeft, {})
16545
- }) : jsx("span", {
16559
+ }) : leading2 === "none" ? null : jsx("span", {
16546
16560
  className: styles.spacer,
16547
16561
  "aria-hidden": "true"
16548
16562
  }), shownTitle ? jsx("span", {
@@ -16558,6 +16572,17 @@ function ShopBar({ onBack, onMenu, title: title2, showCart, floating: floatingPr
16558
16572
  "aria-hidden": "true",
16559
16573
  children: cartCount > 99 ? "99+" : cartCount
16560
16574
  }) : null]
16575
+ }) : null, help2 ? jsx("button", {
16576
+ type: "button",
16577
+ className: `${styles.iconBtn} ${styles.menuBtn}`,
16578
+ "aria-label": helpLabel ?? t("Help"),
16579
+ onClick: () => {
16580
+ emit({
16581
+ type: "help_requested"
16582
+ });
16583
+ onHelp?.();
16584
+ },
16585
+ children: jsx(HelpIcon, {})
16561
16586
  }) : null, menu ? jsx("button", {
16562
16587
  type: "button",
16563
16588
  className: `${styles.iconBtn} ${styles.menuBtn}`,
@@ -16654,6 +16679,7 @@ function toGa4Event(event) {
16654
16679
  case "ready":
16655
16680
  case "navigate":
16656
16681
  case "support_requested":
16682
+ case "help_requested":
16657
16683
  case "order_cancellation_requested":
16658
16684
  case "reorder_requested":
16659
16685
  case "session_required":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nok-integration/storefront-react",
3
- "version": "0.29.15",
3
+ "version": "0.29.16",
4
4
  "description": "Mountable React storefront components: catalogue, product detail and cart, mounted directly into a host DOM tree. No iframe.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",