@becklyn/next 4.2.6 → 4.4.0

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.
Files changed (83) hide show
  1. package/dist/cjs/lib/debounce.d.ts +2 -0
  2. package/dist/cjs/lib/debounce.d.ts.map +1 -0
  3. package/dist/cjs/lib/debounce.js +13 -0
  4. package/dist/cjs/lib/fetcher.d.ts +2 -0
  5. package/dist/cjs/lib/fetcher.d.ts.map +1 -0
  6. package/dist/cjs/lib/fetcher.js +5 -0
  7. package/dist/cjs/lib/useDebounce.d.ts +6 -0
  8. package/dist/cjs/lib/useDebounce.d.ts.map +1 -0
  9. package/dist/cjs/lib/useDebounce.js +11 -0
  10. package/dist/cjs/lib/useInterval.d.ts +5 -0
  11. package/dist/cjs/lib/useInterval.d.ts.map +1 -0
  12. package/dist/cjs/lib/useInterval.js +40 -0
  13. package/dist/cjs/lib/useIsDocumentHidden.d.ts +2 -0
  14. package/dist/cjs/lib/useIsDocumentHidden.d.ts.map +1 -0
  15. package/dist/cjs/lib/useIsDocumentHidden.js +14 -0
  16. package/dist/cjs/lib/useScrollAway.d.ts +6 -0
  17. package/dist/cjs/lib/useScrollAway.d.ts.map +1 -0
  18. package/dist/cjs/lib/useScrollAway.js +47 -0
  19. package/dist/cjs/lib/useTimeout.d.ts +5 -0
  20. package/dist/cjs/lib/useTimeout.d.ts.map +1 -0
  21. package/dist/cjs/lib/useTimeout.js +27 -0
  22. package/dist/cjs/types/prettify.d.ts +4 -0
  23. package/dist/cjs/types/prettify.d.ts.map +1 -0
  24. package/dist/cjs/types/prettify.js +2 -0
  25. package/dist/cjs/types/style.d.ts +5 -0
  26. package/dist/cjs/types/style.d.ts.map +1 -1
  27. package/dist/es/contentful/imageLoader.js +1 -5
  28. package/dist/es/contentful/inspector.js +18 -24
  29. package/dist/es/error/ErrorBoundary.js +2 -6
  30. package/dist/es/format/phone.js +1 -5
  31. package/dist/es/lib/click.js +4 -8
  32. package/dist/es/lib/debounce.d.ts +2 -0
  33. package/dist/es/lib/debounce.d.ts.map +1 -0
  34. package/dist/es/lib/debounce.js +9 -0
  35. package/dist/es/lib/escape.js +3 -7
  36. package/dist/es/lib/fetcher.d.ts +2 -0
  37. package/dist/es/lib/fetcher.d.ts.map +1 -0
  38. package/dist/es/lib/fetcher.js +1 -0
  39. package/dist/es/lib/focusTrap.js +10 -15
  40. package/dist/es/lib/geo.js +5 -10
  41. package/dist/es/lib/intersection.js +4 -8
  42. package/dist/es/lib/isMounted.js +7 -12
  43. package/dist/es/lib/shortcut.js +3 -7
  44. package/dist/es/lib/sleep.js +1 -5
  45. package/dist/es/lib/slider.js +11 -18
  46. package/dist/es/lib/staticContent.js +5 -9
  47. package/dist/es/lib/typeChecks.js +5 -13
  48. package/dist/es/lib/useDebounce.d.ts +6 -0
  49. package/dist/es/lib/useDebounce.d.ts.map +1 -0
  50. package/dist/es/lib/useDebounce.js +7 -0
  51. package/dist/es/lib/useInterval.d.ts +5 -0
  52. package/dist/es/lib/useInterval.d.ts.map +1 -0
  53. package/dist/es/lib/useInterval.js +36 -0
  54. package/dist/es/lib/useIsDocumentHidden.d.ts +2 -0
  55. package/dist/es/lib/useIsDocumentHidden.d.ts.map +1 -0
  56. package/dist/es/lib/useIsDocumentHidden.js +10 -0
  57. package/dist/es/lib/useMediaQuery.js +5 -9
  58. package/dist/es/lib/useScrollAway.d.ts +6 -0
  59. package/dist/es/lib/useScrollAway.d.ts.map +1 -0
  60. package/dist/es/lib/useScrollAway.js +43 -0
  61. package/dist/es/lib/useTimeout.d.ts +5 -0
  62. package/dist/es/lib/useTimeout.d.ts.map +1 -0
  63. package/dist/es/lib/useTimeout.js +23 -0
  64. package/dist/es/mock/block.js +1 -5
  65. package/dist/es/rte/generators.js +18 -30
  66. package/dist/es/rte/index.js +7 -11
  67. package/dist/es/structuredData/index.js +3 -7
  68. package/dist/es/tracking/cookiebot/index.js +17 -26
  69. package/dist/es/tracking/cookiebot/types.js +1 -2
  70. package/dist/es/tracking/gtm/index.js +18 -30
  71. package/dist/es/tracking/gtm/types.js +1 -2
  72. package/dist/es/tracking/index.js +1 -4
  73. package/dist/es/types/block.js +1 -2
  74. package/dist/es/types/prettify.d.ts +4 -0
  75. package/dist/es/types/prettify.d.ts.map +1 -0
  76. package/dist/es/types/prettify.js +1 -0
  77. package/dist/es/types/preview.js +1 -2
  78. package/dist/es/types/structuredData.js +1 -2
  79. package/dist/es/types/style.d.ts +5 -0
  80. package/dist/es/types/style.d.ts.map +1 -1
  81. package/dist/es/types/style.js +1 -2
  82. package/package.json +11 -5
  83. package/scss/story/story.scss +34 -0
@@ -1,23 +1,17 @@
1
1
  "use client";
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.useSlider = void 0;
8
- const react_1 = require("react");
9
- const keen_slider_1 = __importDefault(require("keen-slider"));
10
- const useSlider = ({ shouldObserverMutations, shouldAutoDisable, ...opt } = {}) => {
11
- const [ref, setRef] = (0, react_1.useState)(null);
12
- const [details, setDetails] = (0, react_1.useState)(null);
13
- const [options, setOptions] = (0, react_1.useState)(null);
14
- const [isMounted, setIsMounted] = (0, react_1.useState)(false);
15
- const sliderRef = (0, react_1.useRef)(null);
16
- (0, react_1.useEffect)(() => {
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
+ import KeenSlider from "keen-slider";
4
+ export const useSlider = ({ shouldObserverMutations, shouldAutoDisable, ...opt } = {}) => {
5
+ const [ref, setRef] = useState(null);
6
+ const [details, setDetails] = useState(null);
7
+ const [options, setOptions] = useState(null);
8
+ const [isMounted, setIsMounted] = useState(false);
9
+ const sliderRef = useRef(null);
10
+ useEffect(() => {
17
11
  if (!ref) {
18
12
  return;
19
13
  }
20
- sliderRef.current = new keen_slider_1.default(ref, {
14
+ sliderRef.current = new KeenSlider(ref, {
21
15
  rubberband: false,
22
16
  created: handleDetails,
23
17
  slideChanged: handleDetails,
@@ -37,7 +31,7 @@ const useSlider = ({ shouldObserverMutations, shouldAutoDisable, ...opt } = {})
37
31
  };
38
32
  // eslint-disable-next-line react-hooks/exhaustive-deps
39
33
  }, [ref]);
40
- const isActiveIndex = (0, react_1.useCallback)((index) => index === details?.rel, [details]);
34
+ const isActiveIndex = useCallback((index) => index === details?.rel, [details]);
41
35
  const handleDetails = (ref) => {
42
36
  const details = ref.track.details;
43
37
  setIsMounted(true);
@@ -77,7 +71,6 @@ const useSlider = ({ shouldObserverMutations, shouldAutoDisable, ...opt } = {})
77
71
  },
78
72
  ];
79
73
  };
80
- exports.useSlider = useSlider;
81
74
  const MutationPlugin = slider => {
82
75
  const observer = new MutationObserver(() => {
83
76
  slider.update(slider.options);
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useStaticContent = void 0;
4
- const react_1 = require("react");
5
- const useStaticContent = () => {
6
- const ref = (0, react_1.useRef)(null);
7
- const [render, setRender] = (0, react_1.useState)(typeof window === "undefined");
8
- (0, react_1.useEffect)(() => {
1
+ import { useEffect, useRef, useState } from "react";
2
+ export const useStaticContent = () => {
3
+ const ref = useRef(null);
4
+ const [render, setRender] = useState(typeof window === "undefined");
5
+ useEffect(() => {
9
6
  // check if the innerHTML is empty as client side navigation
10
7
  // need to render the component without server-side backup
11
8
  const isEmpty = ref.current?.innerHTML === "";
@@ -16,4 +13,3 @@ const useStaticContent = () => {
16
13
  }, []);
17
14
  return [render, ref];
18
15
  };
19
- exports.useStaticContent = useStaticContent;
@@ -1,19 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensureArray = exports.first = exports.isDefined = exports.isObject = exports.isString = void 0;
4
- const isString = (value) => {
1
+ export const isString = (value) => {
5
2
  return typeof value === "string";
6
3
  };
7
- exports.isString = isString;
8
- const isObject = (value) => {
4
+ export const isObject = (value) => {
9
5
  return typeof value === "object" && !Array.isArray(value);
10
6
  };
11
- exports.isObject = isObject;
12
- const isDefined = (value) => {
7
+ export const isDefined = (value) => {
13
8
  return value !== undefined && value !== null;
14
9
  };
15
- exports.isDefined = isDefined;
16
- const first = (value) => value ? (Array.isArray(value) ? value.at(0) : value) : undefined;
17
- exports.first = first;
18
- const ensureArray = (value) => value ? (Array.isArray(value) ? value : [value]) : [];
19
- exports.ensureArray = ensureArray;
10
+ export const first = (value) => value ? (Array.isArray(value) ? value.at(0) : value) : undefined;
11
+ export const ensureArray = (value) => value ? (Array.isArray(value) ? value : [value]) : [];
@@ -0,0 +1,6 @@
1
+ import { DependencyList } from "react";
2
+ import { debounce } from "./debounce";
3
+ type Props = Parameters<typeof debounce>;
4
+ export declare const useDebounce: (fn: Props[0], ms: Props[1], deps?: DependencyList) => void;
5
+ export {};
6
+ //# sourceMappingURL=useDebounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDebounce.d.ts","sourceRoot":"","sources":["../../../lib/useDebounce.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAsB,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEzC,eAAO,MAAM,WAAW,GAAI,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,cAAc,SAI5E,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import { useEffect, useMemo } from "react";
3
+ import { debounce } from "./debounce";
4
+ export const useDebounce = (fn, ms, deps) => {
5
+ const bounce = useMemo(() => debounce(fn, ms), [fn, ms]);
6
+ useEffect(() => (deps && Array.isArray(deps) ? bounce() : bounce()), [deps, bounce]);
7
+ };
@@ -0,0 +1,5 @@
1
+ export declare const useInterval: (callback: (executions: number) => void, interval: number, maxExecutions?: number) => {
2
+ startInterval: () => void;
3
+ cancelInterval: () => void;
4
+ };
5
+ //# sourceMappingURL=useInterval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInterval.d.ts","sourceRoot":"","sources":["../../../lib/useInterval.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,GACpB,UAAU,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,EACtC,UAAU,MAAM,EAChB,gBAAgB,MAAM;;;CAyCzB,CAAC"}
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { useCallback, useEffect, useRef } from "react";
3
+ export const useInterval = (callback, interval, maxExecutions) => {
4
+ const intervalRef = useRef(null);
5
+ const executions = useRef(0);
6
+ const startInterval = useCallback(() => {
7
+ if (intervalRef.current) {
8
+ clearInterval(intervalRef.current);
9
+ }
10
+ executions.current = 0;
11
+ intervalRef.current = setInterval(() => {
12
+ executions.current++;
13
+ callback(executions.current);
14
+ if (undefined !== maxExecutions && executions.current >= maxExecutions) {
15
+ if (intervalRef.current) {
16
+ clearInterval(intervalRef.current);
17
+ intervalRef.current = null;
18
+ }
19
+ }
20
+ }, interval);
21
+ }, [callback, interval, maxExecutions]);
22
+ const cancelInterval = useCallback(() => {
23
+ if (intervalRef.current) {
24
+ clearInterval(intervalRef.current);
25
+ intervalRef.current = null;
26
+ }
27
+ }, []);
28
+ useEffect(() => {
29
+ return () => {
30
+ if (intervalRef.current) {
31
+ clearInterval(intervalRef.current);
32
+ }
33
+ };
34
+ }, []);
35
+ return { startInterval, cancelInterval };
36
+ };
@@ -0,0 +1,2 @@
1
+ export declare const useIsDocumentHidden: () => boolean;
2
+ //# sourceMappingURL=useIsDocumentHidden.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsDocumentHidden.d.ts","sourceRoot":"","sources":["../../../lib/useIsDocumentHidden.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,eAW/B,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { useEffect, useState } from "react";
2
+ export const useIsDocumentHidden = () => {
3
+ const [isDocumentHidden, setIsDocumentHidden] = useState(document.hidden);
4
+ useEffect(() => {
5
+ const handleVisibilityChange = () => setIsDocumentHidden(document.hidden);
6
+ document.addEventListener("visibilitychange", handleVisibilityChange);
7
+ return () => document.removeEventListener("visibilitychange", handleVisibilityChange);
8
+ }, []);
9
+ return isDocumentHidden;
10
+ };
@@ -1,18 +1,15 @@
1
1
  "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useMediaQuery = void 0;
5
- const react_1 = require("react");
2
+ import { useEffect, useRef, useState } from "react";
6
3
  /**
7
4
  * Hook to track media query state
8
5
  * @param query - The media query string (e.g., "(min-width: 1024px)")
9
6
  * @returns boolean indicating if the media query matches
10
7
  */
11
- const useMediaQuery = (query) => {
8
+ export const useMediaQuery = (query) => {
12
9
  // Default to false for SSR to prevent hydration mismatch
13
- const [matches, setMatches] = (0, react_1.useState)(false);
14
- const currentMatches = (0, react_1.useRef)(matches);
15
- (0, react_1.useEffect)(() => {
10
+ const [matches, setMatches] = useState(false);
11
+ const currentMatches = useRef(matches);
12
+ useEffect(() => {
16
13
  // Only run on client side
17
14
  if (typeof window === "undefined") {
18
15
  return;
@@ -39,4 +36,3 @@ const useMediaQuery = (query) => {
39
36
  }, [query]);
40
37
  return matches;
41
38
  };
42
- exports.useMediaQuery = useMediaQuery;
@@ -0,0 +1,6 @@
1
+ export declare const useScrollAway: (elementId: string, options?: {
2
+ scrollContainerQuery?: string;
3
+ elementHeight?: number;
4
+ reverseDirection?: boolean;
5
+ }) => void;
6
+ //# sourceMappingURL=useScrollAway.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollAway.d.ts","sourceRoot":"","sources":["../../../lib/useScrollAway.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,GACtB,WAAW,MAAM,EACjB,UAAU;IACN,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,SAoDJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { useEffect } from "react";
3
+ export const useScrollAway = (elementId, options) => {
4
+ useEffect(() => {
5
+ if (typeof document === "undefined") {
6
+ return;
7
+ }
8
+ const element = document.getElementById(elementId);
9
+ if (!element) {
10
+ return;
11
+ }
12
+ const { scrollContainerQuery, elementHeight, reverseDirection = false } = options || {};
13
+ const scrollContainer = scrollContainerQuery
14
+ ? document.querySelector(scrollContainerQuery)
15
+ : null;
16
+ const scrollAnchor = scrollContainer || document.documentElement;
17
+ const distanceToTransform = elementHeight ?? element.offsetHeight;
18
+ let lastScrollPosition = scrollAnchor.scrollTop;
19
+ let ticking = false;
20
+ const update = () => {
21
+ const currentScroll = scrollAnchor.scrollTop;
22
+ const isScrollingDown = currentScroll > lastScrollPosition;
23
+ const shouldHide = reverseDirection ? !isScrollingDown : isScrollingDown;
24
+ if (currentScroll >= distanceToTransform && shouldHide) {
25
+ element.style.transform = `translateY(${-distanceToTransform}px)`;
26
+ }
27
+ else {
28
+ element.style.transform = "translateY(0)";
29
+ }
30
+ lastScrollPosition = currentScroll;
31
+ ticking = false;
32
+ };
33
+ const handleScroll = () => {
34
+ if (!ticking) {
35
+ window.requestAnimationFrame(update);
36
+ ticking = true;
37
+ }
38
+ };
39
+ const targetElement = scrollContainer || window;
40
+ targetElement.addEventListener("scroll", handleScroll, { passive: true });
41
+ return () => targetElement.removeEventListener("scroll", handleScroll);
42
+ }, [elementId, options]);
43
+ };
@@ -0,0 +1,5 @@
1
+ export declare const useTimeout: (callback: (executions: number) => void, duration: number, maxExecutions?: number) => {
2
+ startTimeout: () => void;
3
+ cancelTimeout: () => void;
4
+ };
5
+ //# sourceMappingURL=useTimeout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTimeout.d.ts","sourceRoot":"","sources":["../../../lib/useTimeout.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,GACnB,UAAU,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,EACtC,UAAU,MAAM,EAChB,gBAAgB,MAAM;;;CA0BzB,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { useCallback, useRef } from "react";
3
+ export const useTimeout = (callback, duration, maxExecutions) => {
4
+ const timeoutRef = useRef(null);
5
+ const executions = useRef(0);
6
+ const startTimeout = useCallback(() => {
7
+ if (undefined !== maxExecutions && maxExecutions <= executions.current) {
8
+ return;
9
+ }
10
+ executions.current++;
11
+ timeoutRef.current = setTimeout(() => {
12
+ callback(executions.current);
13
+ }, duration);
14
+ // eslint-disable-next-line react-hooks/exhaustive-deps
15
+ }, []);
16
+ const cancelTimeout = useCallback(() => {
17
+ if (timeoutRef.current) {
18
+ clearTimeout(timeoutRef.current);
19
+ timeoutRef.current = null;
20
+ }
21
+ }, []);
22
+ return { startTimeout, cancelTimeout };
23
+ };
@@ -1,10 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mockBlock = void 0;
4
- const mockBlock = (overwrite) => ({
1
+ export const mockBlock = (overwrite) => ({
5
2
  entryId: "123",
6
3
  locale: "de",
7
4
  draftMode: false,
8
5
  ...overwrite,
9
6
  });
10
- exports.mockBlock = mockBlock;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateRte = exports.generateRteData = exports.generateRteNewline = exports.generateRteAsset = exports.generateRteEmbed = exports.generateRteParagraph = exports.generateRteHeadline = exports.generateRteLink = exports.generateRteText = void 0;
4
- const rich_text_types_1 = require("@contentful/rich-text-types");
5
- const generateRteText = (text, marks = []) => {
1
+ import { BLOCKS, INLINES, } from "@contentful/rich-text-types";
2
+ export const generateRteText = (text, marks = []) => {
6
3
  return {
7
4
  data: {},
8
5
  marks,
@@ -10,36 +7,32 @@ const generateRteText = (text, marks = []) => {
10
7
  nodeType: "text",
11
8
  };
12
9
  };
13
- exports.generateRteText = generateRteText;
14
- const generateRteLink = (text, url) => {
10
+ export const generateRteLink = (text, url) => {
15
11
  return {
16
12
  data: {
17
13
  uri: url,
18
14
  },
19
- content: [(0, exports.generateRteText)(text)],
20
- nodeType: rich_text_types_1.INLINES.HYPERLINK,
15
+ content: [generateRteText(text)],
16
+ nodeType: INLINES.HYPERLINK,
21
17
  };
22
18
  };
23
- exports.generateRteLink = generateRteLink;
24
- const generateRteHeadline = (text, marks = []) => {
19
+ export const generateRteHeadline = (text, marks = []) => {
25
20
  return {
26
21
  data: {},
27
- content: [(0, exports.generateRteText)(text, marks)],
28
- nodeType: rich_text_types_1.BLOCKS.HEADING_3,
22
+ content: [generateRteText(text, marks)],
23
+ nodeType: BLOCKS.HEADING_3,
29
24
  };
30
25
  };
31
- exports.generateRteHeadline = generateRteHeadline;
32
- const generateRteParagraph = (children) => {
26
+ export const generateRteParagraph = (children) => {
33
27
  return {
34
28
  content: children,
35
29
  data: {},
36
- nodeType: rich_text_types_1.BLOCKS.PARAGRAPH,
30
+ nodeType: BLOCKS.PARAGRAPH,
37
31
  };
38
32
  };
39
- exports.generateRteParagraph = generateRteParagraph;
40
- const generateRteEmbed = (id) => {
33
+ export const generateRteEmbed = (id) => {
41
34
  return {
42
- nodeType: rich_text_types_1.BLOCKS.EMBEDDED_ENTRY,
35
+ nodeType: BLOCKS.EMBEDDED_ENTRY,
43
36
  data: {
44
37
  target: {
45
38
  sys: {
@@ -52,10 +45,9 @@ const generateRteEmbed = (id) => {
52
45
  content: [],
53
46
  };
54
47
  };
55
- exports.generateRteEmbed = generateRteEmbed;
56
- const generateRteAsset = (id) => {
48
+ export const generateRteAsset = (id) => {
57
49
  return {
58
- nodeType: rich_text_types_1.BLOCKS.EMBEDDED_ASSET,
50
+ nodeType: BLOCKS.EMBEDDED_ASSET,
59
51
  data: {
60
52
  target: {
61
53
  sys: {
@@ -68,20 +60,16 @@ const generateRteAsset = (id) => {
68
60
  content: [],
69
61
  };
70
62
  };
71
- exports.generateRteAsset = generateRteAsset;
72
- const generateRteNewline = () => (0, exports.generateRteParagraph)([(0, exports.generateRteText)("")]);
73
- exports.generateRteNewline = generateRteNewline;
74
- const generateRteData = (children) => {
63
+ export const generateRteNewline = () => generateRteParagraph([generateRteText("")]);
64
+ export const generateRteData = (children) => {
75
65
  return {
76
66
  content: children,
77
67
  data: {},
78
- nodeType: rich_text_types_1.BLOCKS.DOCUMENT,
68
+ nodeType: BLOCKS.DOCUMENT,
79
69
  };
80
70
  };
81
- exports.generateRteData = generateRteData;
82
- const generateRte = (json) => {
71
+ export const generateRte = (json) => {
83
72
  return {
84
73
  json,
85
74
  };
86
75
  };
87
- exports.generateRte = generateRte;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Rte = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const rich_text_react_renderer_1 = require("@contentful/rich-text-react-renderer");
6
- const typeChecks_1 = require("../lib/typeChecks");
7
- const Rte = ({ data, options, ...props }) => {
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { documentToReactComponents } from "@contentful/rich-text-react-renderer";
3
+ import { isString } from "../lib/typeChecks";
4
+ export const Rte = ({ data, options, ...props }) => {
8
5
  if (!data) {
9
6
  return null;
10
7
  }
@@ -12,9 +9,8 @@ const Rte = ({ data, options, ...props }) => {
12
9
  if (!json) {
13
10
  return null;
14
11
  }
15
- if ((0, typeChecks_1.isString)(json)) {
16
- return (0, jsx_runtime_1.jsx)("div", { ...props, children: json });
12
+ if (isString(json)) {
13
+ return _jsx("div", { ...props, children: json });
17
14
  }
18
- return (0, jsx_runtime_1.jsx)("div", { ...props, children: (0, rich_text_react_renderer_1.documentToReactComponents)(json, options) });
15
+ return _jsx("div", { ...props, children: documentToReactComponents(json, options) });
19
16
  };
20
- exports.Rte = Rte;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StructuredData = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const StructuredData = ({ data }) => {
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export const StructuredData = ({ data }) => {
6
3
  if (!data) {
7
4
  return null;
8
5
  }
@@ -10,6 +7,5 @@ const StructuredData = ({ data }) => {
10
7
  "@context": "https://schema.org",
11
8
  ...data,
12
9
  };
13
- return ((0, jsx_runtime_1.jsx)("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: JSON.stringify(structuredData) } }));
10
+ return (_jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: JSON.stringify(structuredData) } }));
14
11
  };
15
- exports.StructuredData = StructuredData;
@@ -1,14 +1,8 @@
1
1
  "use client";
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.withCookiebot = exports.useCookiebot = exports.CookiebotProvider = exports.CookiebotProviderContext = void 0;
8
- const jsx_runtime_1 = require("react/jsx-runtime");
9
- const react_1 = require("react");
10
- const script_1 = __importDefault(require("next/script"));
11
- exports.CookiebotProviderContext = (0, react_1.createContext)({});
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { createContext, useContext, useEffect, useState } from "react";
4
+ import Script from "next/script";
5
+ export const CookiebotProviderContext = createContext({});
12
6
  const closeWidget = () => {
13
7
  if (typeof window !== "undefined") {
14
8
  window?.Cookiebot?.hide();
@@ -19,13 +13,13 @@ const openWidget = () => {
19
13
  window?.Cookiebot?.show();
20
14
  }
21
15
  };
22
- const CookiebotProvider = ({ locale, cookieBotId, children, }) => {
23
- const [consentUpdate, setConsentUpdate] = (0, react_1.useState)(0);
24
- const [isAccepted, setIsAccepted] = (0, react_1.useState)(false);
25
- const [isConsentAnswered, setIsConsentAnswered] = (0, react_1.useState)(false);
26
- const [isLoaded, setIsLoaded] = (0, react_1.useState)(false);
27
- const [isOpened, setIsOpened] = (0, react_1.useState)(false);
28
- const [consent, setConsent] = (0, react_1.useState)({
16
+ export const CookiebotProvider = ({ locale, cookieBotId, children, }) => {
17
+ const [consentUpdate, setConsentUpdate] = useState(0);
18
+ const [isAccepted, setIsAccepted] = useState(false);
19
+ const [isConsentAnswered, setIsConsentAnswered] = useState(false);
20
+ const [isLoaded, setIsLoaded] = useState(false);
21
+ const [isOpened, setIsOpened] = useState(false);
22
+ const [consent, setConsent] = useState({
29
23
  necessary: false,
30
24
  preferences: false,
31
25
  statistics: false,
@@ -33,7 +27,7 @@ const CookiebotProvider = ({ locale, cookieBotId, children, }) => {
33
27
  method: null,
34
28
  });
35
29
  const checkConsent = (key) => isAccepted && isLoaded && !!consent[key];
36
- (0, react_1.useEffect)(() => {
30
+ useEffect(() => {
37
31
  const openedInitHandler = () => { };
38
32
  const tagsExecutedHandler = () => { };
39
33
  const openedHandler = () => {
@@ -74,7 +68,7 @@ const CookiebotProvider = ({ locale, cookieBotId, children, }) => {
74
68
  window.removeEventListener("CookiebotOnTagsExecuted", tagsExecutedHandler);
75
69
  };
76
70
  }, []);
77
- return ((0, jsx_runtime_1.jsxs)(exports.CookiebotProviderContext.Provider, { value: {
71
+ return (_jsxs(CookiebotProviderContext.Provider, { value: {
78
72
  openWidget,
79
73
  closeWidget,
80
74
  isLoaded,
@@ -84,12 +78,9 @@ const CookiebotProvider = ({ locale, cookieBotId, children, }) => {
84
78
  checkConsent,
85
79
  consent,
86
80
  consentUpdate,
87
- }, children: [(0, jsx_runtime_1.jsx)(script_1.default, { id: "Cookiebot", "data-culture": locale.toUpperCase(), src: `https://consent.cookiebot.com/uc.js?cbid=${cookieBotId}` }), children] }));
81
+ }, children: [_jsx(Script, { id: "Cookiebot", "data-culture": locale.toUpperCase(), src: `https://consent.cookiebot.com/uc.js?cbid=${cookieBotId}` }), children] }));
88
82
  };
89
- exports.CookiebotProvider = CookiebotProvider;
90
- const useCookiebot = () => (0, react_1.useContext)(exports.CookiebotProviderContext);
91
- exports.useCookiebot = useCookiebot;
92
- const withCookiebot = (Component) => {
93
- return (props) => ((0, jsx_runtime_1.jsx)(exports.CookiebotProvider, { ...props, children: (0, jsx_runtime_1.jsx)(Component, { ...props }) }));
83
+ export const useCookiebot = () => useContext(CookiebotProviderContext);
84
+ export const withCookiebot = (Component) => {
85
+ return (props) => (_jsx(CookiebotProvider, { ...props, children: _jsx(Component, { ...props }) }));
94
86
  };
95
- exports.withCookiebot = withCookiebot;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,17 +1,11 @@
1
1
  "use client";
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.useDataEventForwarder = exports.useLazyDataLayer = exports.useDataLayer = exports.withGtm = exports.useGtm = exports.GtmProvider = void 0;
8
- const jsx_runtime_1 = require("react/jsx-runtime");
9
- const react_1 = require("react");
10
- const script_1 = __importDefault(require("next/script"));
11
- const Context = (0, react_1.createContext)({});
12
- const GtmProvider = ({ hasConsent, onBeforeGtmSetup, onAfterGtmSetup, gtmDomain, gtmId, children, }) => {
13
- (0, exports.useDataEventForwarder)(hasConsent);
14
- (0, react_1.useEffect)(() => {
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { createContext, useContext, useEffect, useLayoutEffect, } from "react";
4
+ import Script from "next/script";
5
+ const Context = createContext({});
6
+ export const GtmProvider = ({ hasConsent, onBeforeGtmSetup, onAfterGtmSetup, gtmDomain, gtmId, children, }) => {
7
+ useDataEventForwarder(hasConsent);
8
+ useEffect(() => {
15
9
  if (onBeforeGtmSetup) {
16
10
  onBeforeGtmSetup();
17
11
  }
@@ -22,7 +16,7 @@ const GtmProvider = ({ hasConsent, onBeforeGtmSetup, onAfterGtmSetup, gtmDomain,
22
16
  }
23
17
  // eslint-disable-next-line react-hooks/exhaustive-deps
24
18
  }, []);
25
- return ((0, jsx_runtime_1.jsxs)(Context.Provider, { value: { hasConsent }, children: [hasConsent && ((0, jsx_runtime_1.jsx)(script_1.default, { id: "google-tag-manager", "data-cookieconsent": "marketing", children: `
19
+ return (_jsxs(Context.Provider, { value: { hasConsent }, children: [hasConsent && (_jsx(Script, { id: "google-tag-manager", "data-cookieconsent": "marketing", children: `
26
20
  (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
27
21
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
28
22
  j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
@@ -30,16 +24,13 @@ const GtmProvider = ({ hasConsent, onBeforeGtmSetup, onAfterGtmSetup, gtmDomain,
30
24
  })(window,document,'script','dataLayer','${gtmId}');
31
25
  ` })), children] }));
32
26
  };
33
- exports.GtmProvider = GtmProvider;
34
- const useGtm = () => (0, react_1.useContext)(Context);
35
- exports.useGtm = useGtm;
36
- const withGtm = (Component) => {
37
- return (props) => ((0, jsx_runtime_1.jsx)(exports.GtmProvider, { ...props, children: (0, jsx_runtime_1.jsx)(Component, { ...props }) }));
27
+ export const useGtm = () => useContext(Context);
28
+ export const withGtm = (Component) => {
29
+ return (props) => (_jsx(GtmProvider, { ...props, children: _jsx(Component, { ...props }) }));
38
30
  };
39
- exports.withGtm = withGtm;
40
- const useDataLayer = (input, deps = []) => {
41
- const hasConsent = (0, exports.useGtm)();
42
- (0, react_1.useEffect)(() => {
31
+ export const useDataLayer = (input, deps = []) => {
32
+ const hasConsent = useGtm();
33
+ useEffect(() => {
43
34
  if (!hasConsent) {
44
35
  return;
45
36
  }
@@ -56,9 +47,8 @@ const useDataLayer = (input, deps = []) => {
56
47
  // eslint-disable-next-line react-hooks/exhaustive-deps
57
48
  }, [hasConsent, input, ...deps]);
58
49
  };
59
- exports.useDataLayer = useDataLayer;
60
- const useLazyDataLayer = () => {
61
- const { hasConsent } = (0, exports.useGtm)();
50
+ export const useLazyDataLayer = () => {
51
+ const { hasConsent } = useGtm();
62
52
  return (input) => {
63
53
  if (!hasConsent || !input) {
64
54
  return;
@@ -72,9 +62,8 @@ const useLazyDataLayer = () => {
72
62
  }
73
63
  };
74
64
  };
75
- exports.useLazyDataLayer = useLazyDataLayer;
76
- const useDataEventForwarder = (hasConsent) => {
77
- (0, react_1.useLayoutEffect)(() => {
65
+ export const useDataEventForwarder = (hasConsent) => {
66
+ useLayoutEffect(() => {
78
67
  const captureDataEvent = (event) => {
79
68
  if (!hasConsent) {
80
69
  return;
@@ -111,4 +100,3 @@ const useDataEventForwarder = (hasConsent) => {
111
100
  };
112
101
  }, [hasConsent]);
113
102
  };
114
- exports.useDataEventForwarder = useDataEventForwarder;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};