@abyss-project/commons-front-core 18.1.0 → 18.1.2

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 (41) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/catalog/pages/CookieConsent.tsx +51 -0
  3. package/catalog/specs/cookie-consent-modal.spec.ts +145 -5
  4. package/dist/CookieConsentSettings-CLB1Mlv5.js +687 -0
  5. package/dist/{Surface-z5TuQzlh.js → Surface-B_wIEB3b.js} +9 -9
  6. package/dist/{Tabs-C4K0mLME.js → Tabs-MVmpclcZ.js} +1 -1
  7. package/dist/components/business/CookieConsent/containing-block.d.ts +19 -0
  8. package/dist/components/business/CookieConsent/containing-block.spec.d.ts +1 -0
  9. package/dist/components/business/CookieConsent/use-banner-portal.d.ts +9 -0
  10. package/dist/cookie-consent.js +2 -2
  11. package/dist/{design-theme-BFkCN7Nz.js → design-theme-Bcu3EMIB.js} +1 -1
  12. package/dist/{editors-Eb3PHnxn.js → editors-D0JP2AdM.js} +27 -27
  13. package/dist/editors.js +1 -1
  14. package/dist/{index-CWD0waD8.js → index-B7TbdCxd.js} +2 -2
  15. package/dist/{index-z5ZOXlY8.js → index-BTQOcRMg.js} +4 -4
  16. package/dist/{index-BlOP01yA.js → index-BXwVo31B.js} +2 -2
  17. package/dist/{index-CtVoDSIn.js → index-BgK7ZufI.js} +2 -2
  18. package/dist/{index-2lNOK7eK.js → index-BhfgX3oc.js} +2 -2
  19. package/dist/{index-Ckzcg8qD.js → index-BiBtwp14.js} +4 -4
  20. package/dist/{index-BaL2x2GW.js → index-COEwfkxf.js} +3 -3
  21. package/dist/{index-CFDEfvCD.js → index-CTbeT-N0.js} +1 -1
  22. package/dist/{index-CQ7z2zKY.js → index-CTmmM3bQ.js} +4 -4
  23. package/dist/{index-CRFGogWn.js → index-CVRa0oBj.js} +2 -2
  24. package/dist/{index-Ckzmgx9X.js → index-CorW4VOJ.js} +3 -3
  25. package/dist/{index-BcO-JFrs.js → index-CxQaYgoB.js} +2 -2
  26. package/dist/{index-Dqm1dC1j.js → index-DB03r0_G.js} +2 -2
  27. package/dist/{index-Bw4XnSa0.js → index-DHwatinf.js} +2 -2
  28. package/dist/{index-DRtBc440.js → index-DOniqiUF.js} +2 -2
  29. package/dist/{index-CYBvIQsH.js → index-DS7PaGaq.js} +3 -3
  30. package/dist/{index-CrZZo4r1.js → index-DWOXLAjk.js} +2 -2
  31. package/dist/{index-CtkfWhK1.js → index-P3mYGVW9.js} +2 -2
  32. package/dist/{index-CUhMNEUo.js → index-WbhbeBj8.js} +3 -3
  33. package/dist/{index-B76nCWpd.js → index-WnQHBsCS.js} +2 -2
  34. package/dist/{index-BKRudpMw.js → index-tTzlUmYK.js} +2 -2
  35. package/dist/index.js +1312 -1301
  36. package/dist/legacy.js +6 -6
  37. package/dist/test/vitest-workers.d.ts +18 -0
  38. package/dist/test/vitest-workers.spec.d.ts +1 -0
  39. package/package.json +1 -1
  40. package/vitest.config.ts +6 -0
  41. package/dist/CookieConsentSettings-DUoKKRMZ.js +0 -595
package/dist/legacy.js CHANGED
@@ -5,15 +5,15 @@ import Ne, { useState as P, useCallback as V, useMemo as ge, useEffect as ye, cr
5
5
  import wo from "@mui/icons-material/Group";
6
6
  import Ro from "@mui/icons-material/Folder";
7
7
  import ra from "@mui/icons-material/Extension";
8
- import { r as na, a as oa, t as ia, w as aa, h as Nn, e as He, b as Cr, c as gt, s as Je, m as Ur, d as Bn, f as Fe, p as _n, g as zt, i as We, j as Hn, k as la, l as sa, n as da, A as Jt, o as Rr, q as Mr, Q as ca, u as nn, v as Mo, x as Ao, y as jt, z as N, B as wt, C as Qe, D as Io, H as pa, E as ua, W as Ar, F as Zt, X as Ir, K as fn, J as $t, U as xn, G as bn, I as Ot, L as yt, M as er, V as ma, N as ha, S as ga, O as fa, P as xa, R as ba, T as ya, Y as va, Z as ka, _ as Ca, $ as Sa, a0 as Dr, a1 as je, a2 as mt, a3 as Yt, a4 as wa, a5 as Se, a6 as vt, a7 as zo, a8 as dt, a9 as yn, aa as ct, ab as Ra, ac as Ma, ad as Aa, ae as Ia, af as za, ag as mr, ah as La, ai as $a, aj as Oa, ak as Lo, al as Ea, am as $o, an as Ta, ao as Wa, ap as Oo, aq as Da, ar as Pa, as as Ke, at as Fa, au as Na, av as Ba, aw as _a, ax as Ha, ay as ja, az as Ga, aA as Ua, aB as Va, aC as kt, aD as Ct } from "./design-theme-BFkCN7Nz.js";
9
- import { aR as Eg, aG as Tg, aH as Wg, aI as Dg, aE as Pg, aF as Fg, aX as Ng, aK as Bg, aL as _g, aT as Hg, aU as jg, aO as Gg, aP as Ug, aV as Vg, aW as Yg, aM as Xg, aN as qg, aS as Kg, aJ as Qg, aQ as Jg } from "./design-theme-BFkCN7Nz.js";
8
+ import { r as na, a as oa, t as ia, w as aa, h as Nn, e as He, b as Cr, c as gt, s as Je, m as Ur, d as Bn, f as Fe, p as _n, g as zt, i as We, j as Hn, k as la, l as sa, n as da, A as Jt, o as Rr, q as Mr, Q as ca, u as nn, v as Mo, x as Ao, y as jt, z as N, B as wt, C as Qe, D as Io, H as pa, E as ua, W as Ar, F as Zt, X as Ir, K as fn, J as $t, U as xn, G as bn, I as Ot, L as yt, M as er, V as ma, N as ha, S as ga, O as fa, P as xa, R as ba, T as ya, Y as va, Z as ka, _ as Ca, $ as Sa, a0 as Dr, a1 as je, a2 as mt, a3 as Yt, a4 as wa, a5 as Se, a6 as vt, a7 as zo, a8 as dt, a9 as yn, aa as ct, ab as Ra, ac as Ma, ad as Aa, ae as Ia, af as za, ag as mr, ah as La, ai as $a, aj as Oa, ak as Lo, al as Ea, am as $o, an as Ta, ao as Wa, ap as Oo, aq as Da, ar as Pa, as as Ke, at as Fa, au as Na, av as Ba, aw as _a, ax as Ha, ay as ja, az as Ga, aA as Ua, aB as Va, aC as kt, aD as Ct } from "./design-theme-Bcu3EMIB.js";
9
+ import { aR as Eg, aG as Tg, aH as Wg, aI as Dg, aE as Pg, aF as Fg, aX as Ng, aK as Bg, aL as _g, aT as Hg, aU as jg, aO as Gg, aP as Ug, aV as Vg, aW as Yg, aM as Xg, aN as qg, aS as Kg, aJ as Qg, aQ as Jg } from "./design-theme-Bcu3EMIB.js";
10
10
  import on from "@mui/icons-material/Apps";
11
11
  import Eo from "@mui/icons-material/Circle";
12
12
  import Ya from "@mui/icons-material/Fingerprint";
13
13
  import Xa from "@mui/icons-material/KeyboardArrowDown";
14
14
  import qa from "@mui/icons-material/MessageOutlined";
15
- import { u as ke, T as jn } from "./Surface-z5TuQzlh.js";
16
- import { f as ef } from "./Surface-z5TuQzlh.js";
15
+ import { u as ke, T as jn } from "./Surface-B_wIEB3b.js";
16
+ import { f as ef } from "./Surface-B_wIEB3b.js";
17
17
  import { SupportTicketCategory as Ka, AbyssService as Qa, ProjectStatus as an, byteSizeIEC as Gn, getServiceName as Ja, AbyssCore as Za, buildBillingDeepLink as el, BillingDeepLinkAction as hr } from "@abyss-project/main";
18
18
  import To from "@mui/icons-material/InsertDriveFile";
19
19
  import "@mui/icons-material/Image";
@@ -78,8 +78,8 @@ import jo from "@mui/icons-material/Search";
78
78
  import sn from "@mui/icons-material/BusinessRounded";
79
79
  import Nl from "@mui/icons-material/LocationOnOutlined";
80
80
  import Bl from "@mui/icons-material/CalendarTodayOutlined";
81
- import { a as _l } from "./CookieConsentSettings-DUoKKRMZ.js";
82
- import { A as rf, g as nf, h as of, e as af, i as lf, f as sf, j as df, k as cf, C as pf, b as uf, c as mf, D as hf, R as gf, o as ff, m as xf, l as bf, n as yf, r as vf, p as kf, u as Cf, d as Sf, w as wf } from "./CookieConsentSettings-DUoKKRMZ.js";
81
+ import { a as _l } from "./CookieConsentSettings-CLB1Mlv5.js";
82
+ import { A as rf, g as nf, h as of, e as af, i as lf, f as sf, j as df, k as cf, C as pf, b as uf, c as mf, D as hf, R as gf, o as ff, m as xf, l as bf, n as yf, r as vf, p as kf, u as Cf, d as Sf, w as wf } from "./CookieConsentSettings-CLB1Mlv5.js";
83
83
  import Hl from "@mui/icons-material/ArrowDownward";
84
84
  import jl from "@mui/icons-material/ArrowUpward";
85
85
  import Go from "@mui/icons-material/ChevronLeft";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Vitest worker-count resolution, read by `vitest.config.ts`. Same contract as
3
+ * `apps/front/src/test/vitest-workers.ts`: absent or malformed `VITEST_MAX_WORKERS` returns
4
+ * `undefined` and leaves Vitest's own default in charge. In CI the runner schedules many jobs on
5
+ * the same box, and an uncapped suite (one worker per core) timed out tests under that load
6
+ * (card #753, `test-front-core`), so the job sets the variable.
7
+ */
8
+ /**
9
+ * Resolves the Vitest worker cap from `VITEST_MAX_WORKERS`.
10
+ *
11
+ * Accepts only a strict decimal integer between 1 and 32 inclusive. Anything else — absent,
12
+ * blank, non-numeric, out of range, or not a strict integer literal (`"2.5"`, `" 4 "`) — returns
13
+ * `undefined` rather than guessing: a malformed CI variable must be visibly wrong in review, not
14
+ * silently replaced by some other computed number that then needs its own explanation, and
15
+ * `undefined` leaves Vitest's own default (all available cores) in effect exactly as before this
16
+ * option existed.
17
+ */
18
+ export declare function resolveVitestWorkers(env: NodeJS.ProcessEnv): number | undefined;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/commons-front-core",
3
- "version": "18.1.0",
3
+ "version": "18.1.2",
4
4
  "description": "Front Core package of AbyssProject",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/index.js",
package/vitest.config.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { defineConfig, mergeConfig } from 'vitest/config';
2
2
  import viteConfig from './vite.config';
3
+ import { resolveVitestWorkers } from './src/test/vitest-workers';
4
+
5
+ const maxWorkers = resolveVitestWorkers(process.env);
3
6
 
4
7
  export default mergeConfig(
5
8
  viteConfig,
@@ -16,6 +19,9 @@ export default mergeConfig(
16
19
  // Tests change process.env through `vi.stubEnv` only (lint rule in .eslintrc.cjs, card #612):
17
20
  // every stub is undone before the next test, absence included.
18
21
  unstubEnvs: true,
22
+ // Worker cap read from VITEST_MAX_WORKERS. The key is left out when the variable is absent, so
23
+ // Vitest keeps its own default; minWorkers follows, or tinypool rejects a low cap.
24
+ ...(maxWorkers === undefined ? {} : { minWorkers: maxWorkers, maxWorkers }),
19
25
  },
20
26
  }),
21
27
  );
@@ -1,595 +0,0 @@
1
- import { jsxs as p, Fragment as U, jsx as r } from "react/jsx-runtime";
2
- import { useState as h, useCallback as k, useEffect as T, useLayoutEffect as te, useId as S, useRef as ne, createContext as oe, useContext as q, useMemo as z } from "react";
3
- import O from "@mui/material/Button";
4
- import G from "@mui/material/Switch";
5
- import { styled as f } from "@mui/material/styles";
6
- import { t as R, w, p as d, d as D, D as _, S as M, a as P, u as C, b as J, h as ie, M as se, c as ae } from "./Surface-z5TuQzlh.js";
7
- import { useQuery as re, useMutation as ce } from "@tanstack/react-query";
8
- import { AbyssCore as W } from "@abyss-project/main";
9
- import { createPortal as de } from "react-dom";
10
- import le from "@mui/material/GlobalStyles";
11
- import ue from "@mui/material/Link";
12
- const it = "2026-11-03", x = "abyssCookieConsent", Q = 183, fe = Q * 24 * 60 * 60 * 1e3, me = Q * 24 * 60 * 60, ge = "/", ye = "Lax", pe = (e) => btoa(JSON.stringify(e)), he = (e) => {
13
- try {
14
- const t = JSON.parse(atob(decodeURIComponent(e)));
15
- return typeof t.a != "boolean" || typeof t.m != "boolean" || typeof t.d != "string" || typeof t.v != "string" ? null : t;
16
- } catch {
17
- return null;
18
- }
19
- }, X = (e, t, o = Date.now()) => {
20
- if (e.v !== t)
21
- return !1;
22
- const n = new Date(e.d).getTime();
23
- return Number.isNaN(n) ? !1 : o - n < fe;
24
- }, ke = () => typeof window > "u" ? !1 : window.location.protocol === "https:", Z = (e, t) => {
25
- const o = [
26
- `Path=${ge}`,
27
- `Max-Age=${t}`,
28
- `SameSite=${ye}`
29
- ];
30
- return e.domain && o.push(`Domain=${e.domain}`), ke() && o.push("Secure"), o.join("; ");
31
- }, be = () => {
32
- if (typeof document > "u")
33
- return null;
34
- const e = document.cookie.split(";").map((t) => t.trim()).find((t) => t.startsWith(`${x}=`));
35
- return e ? he(e.slice(x.length + 1)) : null;
36
- }, B = (e, t = {}) => {
37
- typeof document > "u" || (document.cookie = `${x}=${pe(
38
- e
39
- )}; ${Z(t, me)}`);
40
- }, ve = (e = {}) => {
41
- typeof document > "u" || (document.cookie = `${x}=; ${Z(e, 0)}`);
42
- };
43
- var $ = /* @__PURE__ */ ((e) => (e.NOOP = "noop", e.ADOPT_DB = "adopt-db", e.PUSH_COOKIE = "push-cookie", e))($ || {});
44
- const H = (e) => ({
45
- essentials: !0,
46
- analytics: e.analytics,
47
- marketing: e.marketing,
48
- decidedAt: typeof e.decidedAt == "string" ? e.decidedAt : new Date(e.decidedAt).toISOString(),
49
- consentVersion: e.consentVersion
50
- }), Ae = (e, t) => {
51
- if (!e && !t)
52
- return { action: "noop", value: null };
53
- if (!e && t)
54
- return { action: "adopt-db", value: H(t) };
55
- if (e && !t)
56
- return { action: "push-cookie", value: e };
57
- const o = new Date(e.decidedAt).getTime(), n = new Date(
58
- typeof t.decidedAt == "string" ? t.decidedAt : t.decidedAt.toISOString()
59
- ).getTime();
60
- return n > o ? { action: "adopt-db", value: H(t) } : o > n ? { action: "push-cookie", value: e } : { action: "noop", value: e };
61
- }, Se = (e) => ({
62
- essentials: !0,
63
- analytics: e.a,
64
- marketing: e.m,
65
- decidedAt: e.d,
66
- consentVersion: e.v
67
- }), j = (e) => ({
68
- a: e.analytics,
69
- m: e.marketing,
70
- d: e.decidedAt,
71
- v: e.consentVersion
72
- }), Ce = (e) => {
73
- const t = be();
74
- return !t || !X(t, e) ? null : Se(t);
75
- }, we = (e) => {
76
- const [t, o] = h(
77
- () => Ce(e.consentVersion)
78
- ), n = re({
79
- queryKey: ["cookie-consent", "me"],
80
- queryFn: async () => (await W.sdk.user.cookieConsent.get()).data.consent,
81
- enabled: e.isAuthenticated,
82
- retry: !1,
83
- refetchOnWindowFocus: !1
84
- }), s = ce({
85
- mutationFn: async (i) => (await W.sdk.user.cookieConsent.upsert({
86
- analytics: i.analytics,
87
- marketing: i.marketing,
88
- decidedAt: i.decidedAt,
89
- consentVersion: i.consentVersion
90
- })).data.consent
91
- }), a = k(
92
- (i) => {
93
- B(j(i), { domain: e.domain }), o(i), e.isAuthenticated && s.mutate(i);
94
- },
95
- [e.domain, e.isAuthenticated, s]
96
- );
97
- T(() => {
98
- if (!e.isAuthenticated || n.isLoading || n.isError)
99
- return;
100
- const i = n.data ?? null, g = i !== null && X(
101
- {
102
- a: i.analytics,
103
- m: i.marketing,
104
- // `String`, never `toISOString()`: an unreadable date must read as no choice, not throw.
105
- d: String(i.decidedAt),
106
- v: i.consentVersion
107
- },
108
- e.consentVersion
109
- ), m = Ae(t, g ? i : null);
110
- m.action === $.ADOPT_DB && m.value ? (B(j(m.value), { domain: e.domain }), o(m.value)) : m.action === $.PUSH_COOKIE && m.value && s.mutate(m.value);
111
- }, [e.isAuthenticated, n.isLoading, n.isError, n.data]);
112
- const l = k(() => {
113
- a({
114
- essentials: !0,
115
- analytics: !0,
116
- marketing: !0,
117
- decidedAt: (/* @__PURE__ */ new Date()).toISOString(),
118
- consentVersion: e.consentVersion
119
- });
120
- }, [e.consentVersion, a]), c = k(() => {
121
- a({
122
- essentials: !0,
123
- analytics: !1,
124
- marketing: !1,
125
- decidedAt: (/* @__PURE__ */ new Date()).toISOString(),
126
- consentVersion: e.consentVersion
127
- });
128
- }, [e.consentVersion, a]), u = k(
129
- (i) => {
130
- a({
131
- essentials: !0,
132
- analytics: i.analytics,
133
- marketing: i.marketing,
134
- decidedAt: (/* @__PURE__ */ new Date()).toISOString(),
135
- consentVersion: e.consentVersion
136
- });
137
- },
138
- [e.consentVersion, a]
139
- ), y = k(() => {
140
- ve({ domain: e.domain }), o(null);
141
- }, [e.domain]);
142
- return {
143
- consent: t,
144
- isResolved: t !== null,
145
- acceptAll: l,
146
- rejectAll: c,
147
- save: u,
148
- reset: y
149
- };
150
- }, Me = "https://abyss-project.fr/cgu", F = "--abyss-toast-clearance", v = "--abyss-cookie-banner-modal-clearance", A = "data-abyss-cookie-banner-host", xe = () => {
151
- const e = Array.from(document.body.children).filter(
152
- (t) => t instanceof HTMLElement && t.classList.contains("MuiModal-root") && !t.classList.contains("MuiModal-hidden") && !t.classList.contains("MuiPopover-root")
153
- );
154
- for (let t = e.length - 1; t >= 0; t -= 1) {
155
- const o = e[t], n = o.querySelector('[aria-modal="true"]');
156
- if (n !== null)
157
- return { host: o, surface: n };
158
- }
159
- return null;
160
- }, Te = () => {
161
- const [e] = h(
162
- () => typeof document > "u" ? null : document.createElement("div")
163
- ), [t, o] = h(null);
164
- return te(() => {
165
- if (e === null)
166
- return;
167
- let n = null;
168
- const s = /* @__PURE__ */ new WeakSet(), a = () => {
169
- Array.from(document.body.children).forEach((i) => {
170
- i.classList.contains("MuiModal-root") && !s.has(i) && (s.add(i), l.observe(i, {
171
- attributes: !0,
172
- attributeFilter: ["class"]
173
- }));
174
- });
175
- const c = xe(), u = (c == null ? void 0 : c.host) ?? null, y = (c == null ? void 0 : c.surface) ?? document.body;
176
- e.parentNode !== y && y.appendChild(e), e.removeAttribute("aria-hidden"), u !== n && (n == null || n.removeAttribute(A), u == null || u.setAttribute(A, ""), n = u, o(u));
177
- }, l = new MutationObserver(a);
178
- return l.observe(document.body, { childList: !0 }), a(), () => {
179
- l.disconnect(), n == null || n.removeAttribute(A), e.remove();
180
- };
181
- }, [e]), { container: e, modalHost: t };
182
- }, K = f(O)(({ theme: e }) => R(e)), Oe = f("div")(({ theme: e }) => {
183
- const { space: t, elevations: o, durations: n, easings: s } = e.design;
184
- return {
185
- position: "fixed",
186
- zIndex: e.zIndex.snackbar,
187
- // Clear of the home indicator or gesture bar of a native webview (0 elsewhere).
188
- bottom: w(M.Bottom, t[6]),
189
- right: d(t[6]),
190
- width: 420,
191
- maxWidth: `calc(100vw - ${d(2 * t[6])})`,
192
- "& > *": {
193
- boxShadow: o.overlay,
194
- animation: `cookie-consent-in ${n.slow}ms ${s.sheet}`
195
- },
196
- "@keyframes cookie-consent-in": {
197
- from: { opacity: 0, transform: `translateY(${d(t[3])})` },
198
- to: { opacity: 1, transform: "translateY(0)" }
199
- },
200
- "@media (prefers-reduced-motion: reduce)": {
201
- "& > *": { animation: "none" }
202
- },
203
- [D.down(_.Tablet)]: {
204
- bottom: w(M.Bottom, t[3]),
205
- right: w(M.Right, t[3]),
206
- left: w(M.Left, t[3]),
207
- width: "auto",
208
- maxWidth: "none"
209
- }
210
- };
211
- }), Re = f("h2")(({ theme: e }) => ({
212
- margin: 0,
213
- fontSize: d(e.design.typeScale.sectionTitle),
214
- fontWeight: P.semibold,
215
- color: e.design.tokens["text.primary"]
216
- })), Ie = f("p")(({ theme: e }) => ({
217
- margin: `${d(e.design.space[2])} 0 0`,
218
- fontSize: d(e.design.typeScale.body),
219
- color: e.design.tokens["text.secondary"]
220
- })), Ee = f(ue)(({ theme: e }) => ({
221
- alignSelf: "flex-start",
222
- marginTop: d(e.design.space[3]),
223
- fontSize: d(e.design.typeScale.body),
224
- color: e.design.tokens["accent.text"]
225
- })), $e = f("div")(({ theme: e }) => ({
226
- display: "flex",
227
- gap: d(e.design.space[2]),
228
- marginTop: d(e.design.space[4]),
229
- "& > *": { flex: 1 }
230
- })), De = f(O)(({ theme: e }) => ({
231
- ...R(e),
232
- marginTop: d(e.design.space[2]),
233
- color: e.design.tokens["text.secondary"]
234
- }));
235
- function _e({ api: e }) {
236
- const t = C(), { acceptAll: o, rejectAll: n, openPreferences: s } = e, a = S(), l = S(), c = ne(null), { container: u, modalHost: y } = Te();
237
- return T(() => {
238
- const i = c.current;
239
- if (i === null)
240
- return;
241
- const g = document.documentElement, m = () => {
242
- const L = Number.parseFloat(getComputedStyle(i).bottom), N = d(
243
- i.getBoundingClientRect().height + (Number.isNaN(L) ? 0 : L)
244
- );
245
- g.style.setProperty(F, N), y === null ? g.style.removeProperty(v) : g.style.setProperty(v, N);
246
- };
247
- m();
248
- const b = typeof ResizeObserver > "u" ? null : new ResizeObserver(m);
249
- return b == null || b.observe(i), window.addEventListener("resize", m), () => {
250
- b == null || b.disconnect(), window.removeEventListener("resize", m), g.style.removeProperty(F), g.style.removeProperty(v);
251
- };
252
- }, [y]), u === null ? null : de(
253
- /* @__PURE__ */ p(U, { children: [
254
- /* @__PURE__ */ r(
255
- le,
256
- {
257
- styles: {
258
- // A dialog or a sheet: the root of the modal is the box they are laid out in.
259
- [`body > [${A}]`]: {
260
- bottom: `var(${v}, 0px)`
261
- },
262
- // A drawer's paper is fixed to the viewport, not laid out in the root: shorten it too.
263
- [`body > [${A}] > .MuiDrawer-paper`]: {
264
- maxHeight: `calc(100% - var(${v}, 0px))`
265
- },
266
- [`body > [${A}] > .MuiDrawer-paperAnchorBottom`]: {
267
- bottom: `var(${v}, 0px)`
268
- }
269
- }
270
- }
271
- ),
272
- /* @__PURE__ */ r(Oe, { ref: c, children: /* @__PURE__ */ p(
273
- J,
274
- {
275
- padding: 4,
276
- role: "dialog",
277
- "aria-modal": !1,
278
- "aria-labelledby": a,
279
- "aria-describedby": l,
280
- children: [
281
- /* @__PURE__ */ r(Re, { id: a, children: t.formatRichMessage({ id: "cookies.banner.title" }) }),
282
- /* @__PURE__ */ r(Ie, { id: l, children: t.formatRichMessage({ id: "cookies.banner.description" }) }),
283
- /* @__PURE__ */ r(
284
- Ee,
285
- {
286
- href: Me,
287
- rel: "noreferrer",
288
- underline: "hover",
289
- children: t.formatRichMessage({ id: "cookies.banner.privacy-link" })
290
- }
291
- ),
292
- /* @__PURE__ */ p($e, { children: [
293
- /* @__PURE__ */ r(K, { variant: "contained", onClick: o, children: t.formatRichMessage({ id: "cookies.action.accept-all" }) }),
294
- /* @__PURE__ */ r(K, { variant: "outlined", onClick: n, children: t.formatRichMessage({ id: "cookies.action.reject-all" }) })
295
- ] }),
296
- /* @__PURE__ */ r(
297
- De,
298
- {
299
- variant: "text",
300
- size: "small",
301
- fullWidth: !0,
302
- onClick: s,
303
- children: t.formatRichMessage({ id: "cookies.action.configure" })
304
- }
305
- )
306
- ]
307
- }
308
- ) })
309
- ] }),
310
- u
311
- );
312
- }
313
- const Pe = f("div")(({ theme: e }) => {
314
- const { tokens: t, space: o } = e.design;
315
- return {
316
- display: "flex",
317
- alignItems: "center",
318
- justifyContent: "space-between",
319
- gap: d(o[6]),
320
- minWidth: 0,
321
- paddingTop: d(o[3]),
322
- paddingBottom: d(o[3]),
323
- "& + &": { borderTop: ie(t["border.subtle"]) },
324
- [D.down(_.Tablet)]: {
325
- flexDirection: "column",
326
- alignItems: "stretch",
327
- gap: d(o[3])
328
- }
329
- };
330
- }), Ve = f("div")(({ theme: e }) => ({
331
- display: "flex",
332
- flexDirection: "column",
333
- gap: d(e.design.space[1]),
334
- flex: "1 1 auto",
335
- minWidth: 0,
336
- overflowWrap: "anywhere"
337
- })), Le = f("label")(({ theme: e }) => ({
338
- fontSize: d(e.design.typeScale.body),
339
- fontWeight: P.medium,
340
- color: e.design.tokens["text.primary"]
341
- })), Ne = f("div")(({ theme: e }) => ({
342
- fontSize: d(e.design.typeScale.small),
343
- lineHeight: e.typography.body2.lineHeight,
344
- color: e.design.tokens["text.secondary"]
345
- })), ze = f("div")({
346
- display: "flex",
347
- flex: "none",
348
- alignItems: "center",
349
- justifyContent: "flex-end",
350
- maxWidth: "100%",
351
- [D.down(_.Tablet)]: {
352
- justifyContent: "flex-start"
353
- }
354
- });
355
- function ee({
356
- label: e,
357
- description: t,
358
- control: o,
359
- htmlFor: n
360
- }) {
361
- const s = S(), a = `${s}-label`, l = t !== void 0 ? `${s}-description` : void 0;
362
- return /* @__PURE__ */ p(
363
- Pe,
364
- {
365
- role: "group",
366
- "aria-labelledby": a,
367
- "aria-describedby": l,
368
- children: [
369
- /* @__PURE__ */ p(Ve, { children: [
370
- /* @__PURE__ */ r(
371
- Le,
372
- {
373
- id: a,
374
- htmlFor: n,
375
- as: n === void 0 ? "span" : "label",
376
- children: e
377
- }
378
- ),
379
- t !== void 0 && /* @__PURE__ */ r(Ne, { id: l, children: t })
380
- ] }),
381
- /* @__PURE__ */ r(ze, { children: o })
382
- ]
383
- }
384
- );
385
- }
386
- const Y = f(O)(({ theme: e }) => R(e)), We = f("span")(({ theme: e }) => ({
387
- fontSize: d(e.design.typeScale.small),
388
- color: e.design.tokens["text.secondary"],
389
- whiteSpace: "nowrap"
390
- })), Be = f("div")(({ theme: e }) => ({
391
- display: "flex",
392
- alignItems: "center",
393
- gap: d(e.design.space[2])
394
- }));
395
- function I({
396
- category: e,
397
- checked: t,
398
- locked: o = !1,
399
- onChange: n
400
- }) {
401
- const s = C(), a = S();
402
- return /* @__PURE__ */ r(
403
- ee,
404
- {
405
- label: s.formatRichMessage({
406
- id: `cookies.category.${e}.title`
407
- }),
408
- description: s.formatRichMessage({
409
- id: `cookies.category.${e}.description`
410
- }),
411
- htmlFor: a,
412
- control: /* @__PURE__ */ p(Be, { children: [
413
- o && /* @__PURE__ */ r(We, { children: s.formatRichMessage({
414
- id: "cookies.category.essentials.always-on"
415
- }) }),
416
- /* @__PURE__ */ r(
417
- G,
418
- {
419
- id: a,
420
- checked: t,
421
- disabled: o,
422
- onChange: (l, c) => n == null ? void 0 : n(c)
423
- }
424
- )
425
- ] })
426
- }
427
- );
428
- }
429
- function He({
430
- api: e,
431
- open: t,
432
- onClose: o
433
- }) {
434
- const n = C(), { consent: s, save: a } = e, [l, c] = h(!1), [u, y] = h(!1), i = (s == null ? void 0 : s.analytics) ?? !1, g = (s == null ? void 0 : s.marketing) ?? !1;
435
- T(() => {
436
- t && (c(i), y(g));
437
- }, [t, i, g]);
438
- const m = () => {
439
- a({ analytics: l, marketing: u }), o();
440
- };
441
- return /* @__PURE__ */ p(
442
- se,
443
- {
444
- open: t,
445
- onClose: o,
446
- size: ae.Small,
447
- title: n.formatRichMessage({ id: "cookies.configure.title" }),
448
- actions: /* @__PURE__ */ p(U, { children: [
449
- /* @__PURE__ */ r(Y, { variant: "text", onClick: o, children: n.formatRichMessage({ id: "cookies.action.cancel" }) }),
450
- /* @__PURE__ */ r(Y, { variant: "contained", onClick: m, children: n.formatRichMessage({ id: "cookies.action.save" }) })
451
- ] }),
452
- children: [
453
- /* @__PURE__ */ r(I, { category: "essentials", checked: !0, locked: !0 }),
454
- /* @__PURE__ */ r(
455
- I,
456
- {
457
- category: "analytics",
458
- checked: l,
459
- onChange: c
460
- }
461
- ),
462
- /* @__PURE__ */ r(
463
- I,
464
- {
465
- category: "marketing",
466
- checked: u,
467
- onChange: y
468
- }
469
- )
470
- ]
471
- }
472
- );
473
- }
474
- const V = oe(null), je = () => {
475
- const e = q(V);
476
- if (!e)
477
- throw new Error(
478
- "useAbyssCookieConsent must be used inside <AbyssCookieConsentProvider>"
479
- );
480
- return e;
481
- }, st = () => q(V), at = ({ children: e, consentVersion: t, isAuthenticated: o, domain: n, renderBanner: s }) => {
482
- const a = we({ isAuthenticated: o, consentVersion: t, domain: n }), [l, c] = h(!1), u = k(() => c(!0), []), y = k(() => c(!1), []), i = z(
483
- () => ({ ...a, openPreferences: u }),
484
- [a, u]
485
- ), g = z(() => i.isResolved || l ? null : s ? s(i) : /* @__PURE__ */ r(_e, { api: i }), [i, l, s]);
486
- return /* @__PURE__ */ p(V.Provider, { value: i, children: [
487
- e,
488
- g,
489
- /* @__PURE__ */ r(
490
- He,
491
- {
492
- api: i,
493
- open: l,
494
- onClose: y
495
- }
496
- )
497
- ] });
498
- }, Fe = f(O)(({ theme: e }) => R(e)), Ke = f("h2")(({ theme: e }) => ({
499
- margin: `0 0 ${d(e.design.space[2])}`,
500
- fontSize: d(e.design.typeScale.sectionTitle),
501
- fontWeight: P.semibold,
502
- color: e.design.tokens["text.primary"]
503
- })), Ye = f("div")(({ theme: e }) => ({
504
- display: "flex",
505
- marginTop: d(e.design.space[3])
506
- }));
507
- function E({
508
- category: e,
509
- checked: t,
510
- locked: o = !1,
511
- onChange: n
512
- }) {
513
- const s = C(), a = S();
514
- return /* @__PURE__ */ r(
515
- ee,
516
- {
517
- label: s.formatRichMessage({
518
- id: `cookies.category.${e}.title`
519
- }),
520
- description: s.formatRichMessage({
521
- id: `cookies.category.${e}.description`
522
- }),
523
- htmlFor: a,
524
- control: /* @__PURE__ */ r(
525
- G,
526
- {
527
- id: a,
528
- checked: t,
529
- disabled: o,
530
- onChange: (l, c) => n == null ? void 0 : n(c)
531
- }
532
- )
533
- }
534
- );
535
- }
536
- function rt() {
537
- const e = C(), { consent: t, save: o } = je(), [n, s] = h((t == null ? void 0 : t.analytics) ?? !1), [a, l] = h((t == null ? void 0 : t.marketing) ?? !1), c = t == null ? void 0 : t.analytics, u = t == null ? void 0 : t.marketing;
538
- return T(() => {
539
- c !== void 0 && s(c), u !== void 0 && l(u);
540
- }, [c, u]), /* @__PURE__ */ p(J, { padding: 4, children: [
541
- /* @__PURE__ */ r(Ke, { children: e.formatRichMessage({ id: "cookies.configure.title" }) }),
542
- /* @__PURE__ */ r(E, { category: "essentials", checked: !0, locked: !0 }),
543
- /* @__PURE__ */ r(
544
- E,
545
- {
546
- category: "analytics",
547
- checked: n,
548
- onChange: s
549
- }
550
- ),
551
- /* @__PURE__ */ r(
552
- E,
553
- {
554
- category: "marketing",
555
- checked: a,
556
- onChange: l
557
- }
558
- ),
559
- /* @__PURE__ */ r(Ye, { children: /* @__PURE__ */ r(
560
- Fe,
561
- {
562
- variant: "contained",
563
- onClick: () => o({ analytics: n, marketing: a }),
564
- children: e.formatRichMessage({ id: "cookies.action.save" })
565
- }
566
- ) })
567
- ] });
568
- }
569
- export {
570
- at as A,
571
- _e as C,
572
- Me as D,
573
- $ as R,
574
- ee as S,
575
- F as T,
576
- st as a,
577
- He as b,
578
- rt as c,
579
- we as d,
580
- it as e,
581
- x as f,
582
- Q as g,
583
- fe as h,
584
- me as i,
585
- ge as j,
586
- ye as k,
587
- pe as l,
588
- he as m,
589
- X as n,
590
- ve as o,
591
- Ae as p,
592
- be as r,
593
- je as u,
594
- B as w
595
- };