@nok-integration/storefront-react 0.19.45 → 0.19.47

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.mjs CHANGED
@@ -5108,6 +5108,12 @@ function requireClient() {
5108
5108
  return client;
5109
5109
  }
5110
5110
  var clientExports = requireClient();
5111
+ function anchorToTop() {
5112
+ if (typeof window === "undefined") return;
5113
+ const top2 = () => window.scrollTo(0, 0);
5114
+ top2();
5115
+ if (typeof window.requestAnimationFrame === "function") window.requestAnimationFrame(top2);
5116
+ }
5111
5117
  function resolveAssetUrl(src, base) {
5112
5118
  if (!base) return src;
5113
5119
  if (!src.startsWith("/") || src.startsWith("//")) return src;
@@ -5301,6 +5307,7 @@ function DaznShopProvider({ children, ...config }) {
5301
5307
  to
5302
5308
  });
5303
5309
  hostNavigate?.(to);
5310
+ anchorToTop();
5304
5311
  }, [emit, hostNavigate]);
5305
5312
  const announced = useRef(false);
5306
5313
  useEffect(() => {
@@ -5395,18 +5402,11 @@ function ShopLink({ to, children, ...rest }) {
5395
5402
  }
5396
5403
  event.preventDefault();
5397
5404
  navigate(to);
5398
- anchorToTop();
5399
5405
  },
5400
5406
  ...rest,
5401
5407
  children
5402
5408
  });
5403
5409
  }
5404
- function anchorToTop() {
5405
- if (typeof window === "undefined") return;
5406
- const top2 = () => window.scrollTo(0, 0);
5407
- top2();
5408
- if (typeof window.requestAnimationFrame === "function") window.requestAnimationFrame(top2);
5409
- }
5410
5410
  function ShopImage({ src, alt, fill: fill2 = false, width, height, sizes, className, style, priority = false }) {
5411
5411
  const assetUrl = useAssetUrl();
5412
5412
  const fillStyle = fill2 ? {
@@ -11016,7 +11016,13 @@ function useDocumentSnap(ref, enabled = true) {
11016
11016
  const previousPadding = root2.style.scrollPaddingTop;
11017
11017
  root2.style.scrollSnapType = "y mandatory";
11018
11018
  root2.style.scrollPaddingTop = "0px";
11019
+ const top2 = () => window.scrollTo(0, 0);
11020
+ top2();
11021
+ const frame2 = typeof window.requestAnimationFrame === "function" ? window.requestAnimationFrame(top2) : null;
11019
11022
  return () => {
11023
+ if (frame2 !== null && typeof window.cancelAnimationFrame === "function") {
11024
+ window.cancelAnimationFrame(frame2);
11025
+ }
11020
11026
  root2.style.scrollSnapType = previousType;
11021
11027
  root2.style.scrollPaddingTop = previousPadding;
11022
11028
  };
@@ -5108,6 +5108,12 @@ function requireClient() {
5108
5108
  return client;
5109
5109
  }
5110
5110
  var clientExports = requireClient();
5111
+ function anchorToTop() {
5112
+ if (typeof window === "undefined") return;
5113
+ const top2 = () => window.scrollTo(0, 0);
5114
+ top2();
5115
+ if (typeof window.requestAnimationFrame === "function") window.requestAnimationFrame(top2);
5116
+ }
5111
5117
  function resolveAssetUrl(src, base) {
5112
5118
  if (!base) return src;
5113
5119
  if (!src.startsWith("/") || src.startsWith("//")) return src;
@@ -5301,6 +5307,7 @@ function DaznShopProvider({ children, ...config }) {
5301
5307
  to
5302
5308
  });
5303
5309
  hostNavigate?.(to);
5310
+ anchorToTop();
5304
5311
  }, [emit, hostNavigate]);
5305
5312
  const announced = useRef(false);
5306
5313
  useEffect(() => {
@@ -5395,18 +5402,11 @@ function ShopLink({ to, children, ...rest }) {
5395
5402
  }
5396
5403
  event.preventDefault();
5397
5404
  navigate(to);
5398
- anchorToTop();
5399
5405
  },
5400
5406
  ...rest,
5401
5407
  children
5402
5408
  });
5403
5409
  }
5404
- function anchorToTop() {
5405
- if (typeof window === "undefined") return;
5406
- const top2 = () => window.scrollTo(0, 0);
5407
- top2();
5408
- if (typeof window.requestAnimationFrame === "function") window.requestAnimationFrame(top2);
5409
- }
5410
5410
  function ShopImage({ src, alt, fill: fill2 = false, width, height, sizes, className, style, priority = false }) {
5411
5411
  const assetUrl = useAssetUrl();
5412
5412
  const fillStyle = fill2 ? {
@@ -11016,7 +11016,13 @@ function useDocumentSnap(ref, enabled = true) {
11016
11016
  const previousPadding = root2.style.scrollPaddingTop;
11017
11017
  root2.style.scrollSnapType = "y mandatory";
11018
11018
  root2.style.scrollPaddingTop = "0px";
11019
+ const top2 = () => window.scrollTo(0, 0);
11020
+ top2();
11021
+ const frame2 = typeof window.requestAnimationFrame === "function" ? window.requestAnimationFrame(top2) : null;
11019
11022
  return () => {
11023
+ if (frame2 !== null && typeof window.cancelAnimationFrame === "function") {
11024
+ window.cancelAnimationFrame(frame2);
11025
+ }
11020
11026
  root2.style.scrollSnapType = previousType;
11021
11027
  root2.style.scrollPaddingTop = previousPadding;
11022
11028
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nok-integration/storefront-react",
3
- "version": "0.19.45",
3
+ "version": "0.19.47",
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",