@lystech/sections 0.6.0 → 0.9.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 (36) hide show
  1. package/README.md +188 -1
  2. package/dist/Audience.d.ts +14 -0
  3. package/dist/BoutonEdition.d.ts +13 -0
  4. package/dist/BoutonEditionCorps.d.ts +12 -0
  5. package/dist/SectionsProvider.d.ts +62 -2
  6. package/dist/catalogue.d.ts +30 -0
  7. package/dist/constantes.d.ts +38 -0
  8. package/dist/editeur/ApercuMobile.d.ts +7 -0
  9. package/dist/editeur/ChoixAudience.d.ts +6 -0
  10. package/dist/editeur/MarquesBoutique.d.ts +26 -0
  11. package/dist/editeur/api.d.ts +16 -1
  12. package/dist/editeur/boutique/Collections.d.ts +8 -0
  13. package/dist/editeur/boutique/FicheCollection.d.ts +23 -0
  14. package/dist/editeur/boutique/FicheProduit.d.ts +23 -0
  15. package/dist/editeur/boutique/ListeVirtuelle.d.ts +13 -0
  16. package/dist/editeur/boutique/ModuleBoutique.d.ts +44 -0
  17. package/dist/editeur/boutique/Publier.d.ts +15 -0
  18. package/dist/editeur/boutique/Selecteur.d.ts +10 -0
  19. package/dist/editeur/boutique/api.d.ts +131 -0
  20. package/dist/editeur/boutique/commun.d.ts +19 -0
  21. package/dist/editeur/boutique/photos.d.ts +9 -0
  22. package/dist/editeur/boutique/styles.d.ts +1 -0
  23. package/dist/editeur/pont.d.ts +7 -0
  24. package/dist/editeur/styles.d.ts +1 -1
  25. package/dist/editeur.js +6 -1736
  26. package/dist/index.d.ts +9 -2
  27. package/dist/index.js +351 -209
  28. package/dist/morceaux/ApercuMobile-CSoo4dpM.js +63 -0
  29. package/dist/morceaux/BoutonEditionCorps-B57eJtJn.js +112 -0
  30. package/dist/morceaux/ModuleBoutique-CgqcQjIb.js +1509 -0
  31. package/dist/morceaux/constantes-BAdpe1ss.js +24 -0
  32. package/dist/morceaux/index-C_uFDnBO.js +2217 -0
  33. package/dist/types.d.ts +30 -0
  34. package/dist/useSection.d.ts +15 -0
  35. package/package.json +46 -46
  36. package/dist/morceaux/constantes-BPZxUYge.js +0 -19
package/dist/index.js CHANGED
@@ -1,203 +1,328 @@
1
- import { s as W, a as D, b as u } from "./morceaux/constantes-BPZxUYge.js";
2
- import { C as dt } from "./morceaux/constantes-BPZxUYge.js";
3
- import { jsx as I, jsxs as J, Fragment as q } from "react/jsx-runtime";
4
- import { useState as p, useRef as x, useEffect as A, useCallback as C, useMemo as L, useContext as Z, createContext as G } from "react";
5
- import { appliquerAuxTextes as K } from "./morceaux/sourceTexte-BMPMpNg9.js";
6
- import { adaptateurI18next as ht } from "./morceaux/sourceTexte-BMPMpNg9.js";
7
- const M = G(null), Q = "https://api.lystech.ca/api";
8
- function V() {
1
+ import { b as le, a as K, A as de, E as Q, s as fe, c as R, d as l, F as X } from "./morceaux/constantes-BAdpe1ss.js";
2
+ import { C as qe } from "./morceaux/constantes-BAdpe1ss.js";
3
+ import { useRef as v, useEffect as E, useState as w, useCallback as y, useMemo as k, useContext as he, createContext as me, Suspense as we, lazy as ge } from "react";
4
+ import { jsx as A, Fragment as te, jsxs as Y } from "react/jsx-runtime";
5
+ import { appliquerAuxTextes as B } from "./morceaux/sourceTexte-BMPMpNg9.js";
6
+ import { adaptateurI18next as $e } from "./morceaux/sourceTexte-BMPMpNg9.js";
7
+ function je(e) {
8
+ return { [de]: e };
9
+ }
10
+ function Oe(e, t = !1) {
11
+ return t ? { [K]: e, [le]: "" } : { [K]: e };
12
+ }
13
+ function Te(e) {
14
+ const t = v(e);
15
+ t.current = e, E(() => {
16
+ const n = (r) => t.current(r.detail);
17
+ return window.addEventListener(Q, n), () => window.removeEventListener(Q, n);
18
+ }, []);
19
+ }
20
+ const ne = me(null), pe = "https://api.lystech.ca/api";
21
+ function ee() {
22
+ if (typeof window > "u") return !1;
23
+ try {
24
+ return window.self !== window.top && (window.name === X || new URL(window.location.href).searchParams.has(X));
25
+ } catch {
26
+ return !1;
27
+ }
28
+ }
29
+ function ye() {
9
30
  if (typeof window > "u") return null;
10
- const t = (e) => {
31
+ try {
32
+ return window.localStorage.getItem(R) ? null : new URLSearchParams(window.location.hash.replace(/^#/, "")).get(l) ?? new URL(window.location.href).searchParams.get(l) ?? window.localStorage.getItem(l) ?? window.sessionStorage.getItem(l);
33
+ } catch {
34
+ return null;
35
+ }
36
+ }
37
+ function Ee() {
38
+ if (typeof window > "u") return null;
39
+ const e = (t) => {
11
40
  try {
12
- window.localStorage.setItem(u, e);
41
+ window.localStorage.setItem(l, t);
13
42
  } catch {
14
43
  try {
15
- window.sessionStorage.setItem(u, e);
44
+ window.sessionStorage.setItem(l, t);
16
45
  } catch {
17
46
  }
18
47
  }
19
- return e;
48
+ return t;
20
49
  };
21
50
  try {
22
- if (window.localStorage.getItem(D)) {
23
- window.localStorage.removeItem(D), window.localStorage.removeItem(u);
51
+ if (window.localStorage.getItem(R)) {
52
+ window.localStorage.removeItem(R), window.localStorage.removeItem(l);
24
53
  try {
25
- window.sessionStorage.removeItem(u);
54
+ window.sessionStorage.removeItem(l);
26
55
  } catch {
27
56
  }
28
57
  return null;
29
58
  }
30
- const e = window.location.hash.replace(/^#/, "");
31
- if (e.includes(u + "=")) {
32
- const c = new URLSearchParams(e), o = c.get(u);
33
- if (o) {
34
- c.delete(u);
35
- const a = c.toString();
59
+ const t = window.location.hash.replace(/^#/, "");
60
+ if (t.includes(l + "=")) {
61
+ const s = new URLSearchParams(t), c = s.get(l);
62
+ if (c) {
63
+ s.delete(l);
64
+ const a = s.toString();
36
65
  return window.history.replaceState(
37
66
  {},
38
67
  "",
39
68
  window.location.pathname + window.location.search + (a ? "#" + a : "")
40
- ), t(o);
69
+ ), e(c);
41
70
  }
42
71
  }
43
- const r = new URL(window.location.href), n = r.searchParams.get(u);
44
- return n ? (r.searchParams.delete(u), window.history.replaceState({}, "", r.toString()), t(n)) : window.localStorage.getItem(u) ?? window.sessionStorage.getItem(u);
72
+ const n = new URL(window.location.href), r = n.searchParams.get(l);
73
+ return r ? (n.searchParams.delete(l), window.history.replaceState({}, "", n.toString()), e(r)) : window.localStorage.getItem(l) ?? window.sessionStorage.getItem(l);
45
74
  } catch {
46
75
  return null;
47
76
  }
48
77
  }
49
- function ct({
50
- site: t,
51
- page: e,
52
- langue: r = "fr",
53
- apiBaseUrl: n = Q,
54
- sectionsInitiales: c,
55
- sourceTexte: o,
78
+ function De({
79
+ site: e,
80
+ page: t,
81
+ langue: n = "fr",
82
+ apiBaseUrl: r = pe,
83
+ sectionsInitiales: s,
84
+ sourceTexte: c,
56
85
  pagesPartagees: a,
57
- children: m
86
+ session: h,
87
+ connexionPropre: S = !1,
88
+ children: b
58
89
  }) {
59
- const [d, E] = p(
60
- c ?? []
61
- ), [w, g] = p(
62
- c?.length ? "pret" : "chargement"
63
- ), [j, y] = p(0), [S, k] = p({}), [P, N] = p(!1), U = x(null);
64
- A(() => {
65
- if (!t || !e) return;
66
- U.current?.abort();
67
- const s = new AbortController();
68
- U.current = s, g("chargement");
69
- const l = n + "/site-sections/public/" + encodeURIComponent(t) + "/" + encodeURIComponent([e, ...a ?? []].join(","));
70
- return fetch(l, { signal: s.signal }).then(
90
+ const [g, P] = w(
91
+ s ?? []
92
+ ), [_, p] = w(
93
+ s?.length ? "pret" : "chargement"
94
+ ), [j, re] = w(0), [F, oe] = w({}), [M, ce] = w(!1), [I] = w(ee), [N, z] = w(null), [O, se] = w(
95
+ () => ee() ? null : ye()
96
+ ), [ie, ae] = w(0), H = v(null);
97
+ E(() => {
98
+ if (!e || !t) return;
99
+ H.current?.abort();
100
+ const o = new AbortController();
101
+ H.current = o, p("chargement");
102
+ const u = encodeURIComponent(e) + "/" + encodeURIComponent([t, ...a ?? []].join(",")), d = new Headers(h?.entetes ?? {});
103
+ return O && d.set("Authorization", "Bearer " + O), fetch(
104
+ r + "/site-sections/membre/" + u + (O ? "?toutes=1" : ""),
105
+ { signal: o.signal, credentials: "include", headers: d }
106
+ ).then(
71
107
  (i) => i.ok ? i.json() : Promise.reject(new Error(String(i.status)))
72
108
  ).then((i) => {
73
- s.signal.aborted || (E(Array.isArray(i) ? i : []), g("pret"));
109
+ o.signal.aborted || (P(Array.isArray(i?.sections) ? i.sections : []), z(i?.viewer ?? null), p("pret"));
74
110
  }).catch((i) => {
75
- s.signal.aborted || i?.name === "AbortError" || g("erreur");
76
- }), () => s.abort();
77
- }, [t, e, n, j, (a ?? []).join(",")]);
78
- const R = C(() => y((s) => s + 1), []), $ = x({}), z = C((s, l) => {
79
- $.current[s] = l;
111
+ if (o.signal.aborted || i?.name === "AbortError") throw i;
112
+ return fetch(r + "/site-sections/public/" + u, {
113
+ signal: o.signal
114
+ }).then(
115
+ (C) => C.ok ? C.json() : Promise.reject(new Error(String(C.status)))
116
+ ).then((C) => {
117
+ o.signal.aborted || (P(Array.isArray(C) ? C : []), z(null), p("pret"));
118
+ });
119
+ }).catch((i) => {
120
+ o.signal.aborted || i?.name === "AbortError" || p("erreur");
121
+ }), () => o.abort();
122
+ }, [e, t, r, j, (a ?? []).join(","), h?.cle ?? null, O]);
123
+ const D = y(() => re((o) => o + 1), []), q = v({}), J = y((o, u) => {
124
+ q.current[o] = u;
80
125
  }, []);
81
- A(() => {
82
- !o || !d.length || K(d, o);
83
- }, [d, o]);
84
- const _ = C(
85
- (s, l) => k((i) => ({ ...i, [s]: l })),
126
+ E(() => {
127
+ !c || !g.length || B(g, c);
128
+ }, [g, c]);
129
+ const L = y(
130
+ (o, u) => oe((d) => ({ ...d, [o]: u })),
86
131
  []
87
- ), f = x({
88
- site: t,
89
- page: e,
90
- langue: r,
132
+ ), m = v({
133
+ site: e,
134
+ page: t,
135
+ langue: n,
91
136
  poserApercu: () => {
92
137
  },
93
138
  recharger: () => {
94
139
  }
95
140
  });
96
- f.current.site = t, f.current.page = e, f.current.langue = r, f.current.poserApercu = _, f.current.sourceTexte = o, f.current.replis = $.current, f.current.recharger = R, A(() => {
97
- f.current.surChangementDePage?.(e);
98
- }, [e]);
99
- const v = x(null), F = C(
100
- async (s, l = {}) => {
101
- const i = v.current;
102
- if (!i) throw new Error("Aucune connexion d'édition active.");
103
- if (!s.startsWith("/"))
141
+ m.current.site = e, m.current.page = t, m.current.langue = n, m.current.poserApercu = L, m.current.sourceTexte = c, m.current.replis = q.current, m.current.recharger = D, E(() => {
142
+ m.current.surChangementDePage?.(t);
143
+ }, [t]);
144
+ const U = v(null), $ = y(
145
+ async (o, u = {}) => {
146
+ const d = U.current;
147
+ if (!d) throw new Error("Aucune connexion d'édition active.");
148
+ if (!o.startsWith("/"))
104
149
  throw new Error(
105
150
  "appelEdition attend un chemin de l'API, ex. « /results/site/droits »."
106
151
  );
107
- const h = new Headers(l.headers);
108
- h.set("Authorization", "Bearer " + i), typeof l.body == "string" && !h.has("Content-Type") && h.set("Content-Type", "application/json");
109
- const H = await fetch(n + s, { ...l, headers: h });
110
- return H.status === 401 && W(), H;
152
+ const f = new Headers(u.headers);
153
+ f.set("Authorization", "Bearer " + d), typeof u.body == "string" && !f.has("Content-Type") && f.set("Content-Type", "application/json");
154
+ const i = await fetch(r + o, { ...u, headers: f });
155
+ return i.status === 401 && fe(), i;
111
156
  },
112
- [n]
157
+ [r]
113
158
  );
114
- A(() => {
115
- const s = V();
116
- if (!s) return;
117
- let l = !0, i;
118
- return import("@lystech/sections/editeur").then((h) => {
119
- l && (v.current = s, N(!0), i = h.monterEditeur({
120
- jeton: s,
121
- site: t,
122
- apiBaseUrl: n,
123
- pont: f.current
159
+ E(() => {
160
+ if (!I) return;
161
+ const o = (u) => {
162
+ if (u.source !== window.parent || u.origin !== window.location.origin) return;
163
+ const d = u.data;
164
+ if (d?.lystech !== "apercu" || !Array.isArray(d.blocs)) return;
165
+ const f = d.blocs.filter((i) => /^i18n:/.test(i.blockType));
166
+ f.length && c && B(f, c);
167
+ for (const i of d.blocs)
168
+ /^i18n:/.test(i.blockType) || L(i.blockType, i.data);
169
+ };
170
+ window.addEventListener("message", o);
171
+ try {
172
+ window.parent.postMessage({ lystech: "apercu-pret" }, window.location.origin);
173
+ } catch {
174
+ }
175
+ return () => window.removeEventListener("message", o);
176
+ }, [I, c, L]);
177
+ const V = y(
178
+ (o) => m.current.ouvrirBoutique?.(o ?? null) ?? !1,
179
+ []
180
+ );
181
+ E(() => {
182
+ if (I) return;
183
+ const o = Ee();
184
+ if (!o) return;
185
+ let u = !0, d;
186
+ return import("@lystech/sections/editeur").then((f) => {
187
+ u && (U.current = o, ce(!0), d = f.monterEditeur({
188
+ jeton: o,
189
+ site: e,
190
+ apiBaseUrl: r,
191
+ pont: m.current
124
192
  }));
125
- }).catch((h) => {
126
- console.error("[lystech] éditeur indisponible:", h?.message ?? h);
193
+ }).catch((f) => {
194
+ console.error("[lystech] éditeur indisponible:", f?.message ?? f);
127
195
  }), () => {
128
- l = !1, v.current = null, i?.();
196
+ u = !1, U.current = null, d?.();
129
197
  };
130
- }, [t, n]);
131
- const T = L(
198
+ }, [e, r, I, ie]);
199
+ const W = y((o) => {
200
+ if (o) {
201
+ try {
202
+ window.localStorage.removeItem(R), window.localStorage.setItem(l, o);
203
+ } catch {
204
+ try {
205
+ window.sessionStorage.setItem(l, o);
206
+ } catch {
207
+ window.location.hash = l + "=" + encodeURIComponent(o);
208
+ }
209
+ }
210
+ se(o), ae((u) => u + 1);
211
+ }
212
+ }, []), G = v(h?.entetes);
213
+ G.current = h?.entetes;
214
+ const Z = y(
215
+ (o, u = {}) => {
216
+ if (!o.startsWith("/"))
217
+ return Promise.reject(new Error("appelSession attend un chemin de l'API."));
218
+ const d = new Headers(u.headers);
219
+ for (const [f, i] of Object.entries(G.current ?? {})) d.set(f, i);
220
+ return fetch(r + o, { ...u, headers: d, credentials: "include" });
221
+ },
222
+ [r]
223
+ ), ue = k(
132
224
  () => ({
133
- site: t,
134
- page: e,
135
- langue: r,
136
- apiBaseUrl: n,
137
- sections: d,
138
- etat: w,
139
- recharger: R,
140
- apercu: S,
141
- poserApercu: _,
142
- modeEdition: P,
143
- declarerRepli: z,
144
- appelEdition: F
225
+ site: e,
226
+ page: t,
227
+ langue: n,
228
+ apiBaseUrl: r,
229
+ sections: g,
230
+ etat: _,
231
+ recharger: D,
232
+ apercu: F,
233
+ poserApercu: L,
234
+ modeEdition: M,
235
+ declarerRepli: J,
236
+ appelEdition: $,
237
+ ouvrirBoutique: V,
238
+ modeApercu: I,
239
+ visiteur: N,
240
+ entrerEnEdition: W,
241
+ connexionPropre: S,
242
+ appelSession: Z
145
243
  }),
146
244
  [
147
- t,
148
245
  e,
149
- r,
246
+ t,
150
247
  n,
151
- d,
152
- w,
153
- R,
154
- S,
248
+ r,
249
+ g,
155
250
  _,
156
- P,
157
- z,
158
- F
251
+ D,
252
+ F,
253
+ L,
254
+ M,
255
+ J,
256
+ $,
257
+ V,
258
+ I,
259
+ N,
260
+ W,
261
+ S,
262
+ Z
159
263
  ]
160
264
  );
161
- return /* @__PURE__ */ I(M.Provider, { value: T, children: m });
265
+ return /* @__PURE__ */ A(ne.Provider, { value: ue, children: b });
266
+ }
267
+ function x() {
268
+ return he(ne);
269
+ }
270
+ function Ae() {
271
+ return x()?.visiteur ?? null;
162
272
  }
163
- function O() {
164
- return Z(M);
273
+ function Se(e, t, n = []) {
274
+ if (t === "everyone") return !0;
275
+ if (!e) return !1;
276
+ switch (t) {
277
+ case "loggedIn":
278
+ return e.isLoggedIn;
279
+ case "members":
280
+ return e.activePlanUIDs.length > 0;
281
+ case "nonMembers":
282
+ return e.activePlanUIDs.length === 0;
283
+ case "plans":
284
+ return n.some((r) => e.activePlanUIDs.includes(r));
285
+ }
286
+ }
287
+ function Ue({ show: e, plans: t, fallback: n = null, children: r }) {
288
+ const s = Ae();
289
+ return /* @__PURE__ */ A(te, { children: Se(s, e, t) ? r : n });
165
290
  }
166
- const X = "https://api.lystech.ca/api";
167
- function st({
168
- site: t,
169
- apiBaseUrl: e,
170
- className: r,
171
- mention: n = "Réalisé avec Lystech",
172
- connexion: c = "Connexion",
173
- methodes: o
291
+ const be = "https://api.lystech.ca/api";
292
+ function ke({
293
+ site: e,
294
+ apiBaseUrl: t,
295
+ className: n,
296
+ mention: r = "Réalisé avec Lystech",
297
+ connexion: s = "Connexion",
298
+ methodes: c
174
299
  }) {
175
- const a = O(), m = t ?? a?.site ?? "", d = e ?? a?.apiBaseUrl ?? X, [E, w] = p(!1);
176
- if (!m) return null;
177
- const g = async () => {
178
- if (!E) {
179
- w(!0);
300
+ const a = x(), h = e ?? a?.site ?? "", S = t ?? a?.apiBaseUrl ?? be, [b, g] = w(!1);
301
+ if (!h) return null;
302
+ const P = async () => {
303
+ if (!b) {
304
+ g(!0);
180
305
  try {
181
306
  (await import("@lystech/sections/editeur")).monterConnexion({
182
- site: m,
183
- apiBaseUrl: d,
184
- ...o ? { methodes: o } : {},
185
- surJeton: (S) => {
307
+ site: h,
308
+ apiBaseUrl: S,
309
+ ...c ? { methodes: c } : {},
310
+ surJeton: (j) => {
186
311
  try {
187
- window.localStorage.removeItem(D), window.localStorage.setItem(u, S);
312
+ window.localStorage.removeItem(R), window.localStorage.setItem(l, j);
188
313
  } catch {
189
- window.location.hash = u + "=" + encodeURIComponent(S);
314
+ window.location.hash = l + "=" + encodeURIComponent(j);
190
315
  }
191
316
  window.location.reload();
192
317
  }
193
318
  });
194
- } catch (y) {
195
- console.error("[lystech] connexion indisponible:", y?.message ?? y);
319
+ } catch (p) {
320
+ console.error("[lystech] connexion indisponible:", p?.message ?? p);
196
321
  } finally {
197
- w(!1);
322
+ g(!1);
198
323
  }
199
324
  }
200
- }, j = {
325
+ }, _ = {
201
326
  color: "inherit",
202
327
  font: "inherit",
203
328
  background: "none",
@@ -207,10 +332,10 @@ function st({
207
332
  textDecoration: "underline",
208
333
  textUnderlineOffset: "0.2em"
209
334
  };
210
- return /* @__PURE__ */ J(
335
+ return /* @__PURE__ */ Y(
211
336
  "div",
212
337
  {
213
- className: r,
338
+ className: n,
214
339
  style: {
215
340
  display: "flex",
216
341
  flexWrap: "wrap",
@@ -221,109 +346,126 @@ function st({
221
346
  lineHeight: 1.5
222
347
  },
223
348
  children: [
224
- n !== null && /* @__PURE__ */ I(
349
+ r !== null && /* @__PURE__ */ A(
225
350
  "a",
226
351
  {
227
352
  href: "https://lystech.ca",
228
353
  target: "_blank",
229
354
  rel: "noreferrer",
230
355
  style: { color: "inherit" },
231
- children: n
356
+ children: r
232
357
  }
233
358
  ),
234
- !a?.modeEdition && /* @__PURE__ */ J(q, { children: [
235
- n !== null && /* @__PURE__ */ I("span", { "aria-hidden": "true", children: "·" }),
236
- /* @__PURE__ */ I("button", { type: "button", style: j, onClick: g, children: E ? "…" : c })
359
+ !a?.modeEdition && !a?.connexionPropre && /* @__PURE__ */ Y(te, { children: [
360
+ r !== null && /* @__PURE__ */ A("span", { "aria-hidden": "true", children: "·" }),
361
+ /* @__PURE__ */ A("button", { type: "button", style: _, onClick: P, children: b ? "…" : s })
237
362
  ] })
238
363
  ]
239
364
  }
240
365
  );
241
366
  }
242
- function Y(t) {
243
- return !!t && typeof t == "object" && !Array.isArray(t) && Object.keys(t).every((e) => /^[a-z]{2}(-[A-Za-z]{2})?$/.test(e));
367
+ const Ie = ge(() => import("./morceaux/BoutonEditionCorps-B57eJtJn.js"));
368
+ function Fe(e) {
369
+ const t = x();
370
+ return !t || !e.connecte || t.modeEdition || t.modeApercu || e.peutEditer === !1 ? null : /* @__PURE__ */ A(we, { fallback: null, children: /* @__PURE__ */ A(Ie, { ...e }) });
371
+ }
372
+ function Ce(e) {
373
+ return !!e && typeof e == "object" && !Array.isArray(e) && Object.keys(e).every((t) => /^[a-z]{2}(-[A-Za-z]{2})?$/.test(t));
244
374
  }
245
- function b(t, e) {
246
- if (Array.isArray(t)) return t.map((r) => b(r, e));
247
- if (Y(t)) {
248
- const r = t, n = e.slice(0, 2);
249
- return r[e] ?? r[n] ?? Object.values(r).find((o) => o != null) ?? "";
375
+ function T(e, t) {
376
+ if (Array.isArray(e)) return e.map((n) => T(n, t));
377
+ if (Ce(e)) {
378
+ const n = e, r = t.slice(0, 2);
379
+ return n[t] ?? n[r] ?? Object.values(n).find((c) => c != null) ?? "";
250
380
  }
251
- if (t && typeof t == "object") {
252
- const r = {};
253
- for (const [n, c] of Object.entries(t))
254
- r[n] = b(c, e);
255
- return r;
381
+ if (e && typeof e == "object") {
382
+ const n = {};
383
+ for (const [r, s] of Object.entries(e))
384
+ n[r] = T(s, t);
385
+ return n;
256
386
  }
257
- return t;
387
+ return e;
258
388
  }
259
- function B(t, e) {
260
- if (!e || typeof e != "object" || Array.isArray(e))
261
- return t;
262
- const r = { ...t };
263
- for (const [n, c] of Object.entries(e))
264
- c != null && (r[n] = c);
265
- return r;
389
+ function ve(e, t) {
390
+ if (!t || typeof t != "object" || Array.isArray(t))
391
+ return e;
392
+ const n = { ...e };
393
+ for (const [r, s] of Object.entries(t))
394
+ s != null && (n[r] = s);
395
+ return n;
266
396
  }
267
- function tt(t) {
268
- return (e) => ({ "data-lystech-champ": `${t}:${e}` });
397
+ function Le(e) {
398
+ return (t) => ({ "data-lystech-champ": `${e}:${t}` });
269
399
  }
270
- function it(t, e) {
271
- const r = O(), n = r?.apercu?.[t], c = r?.declarerRepli;
272
- return A(() => {
273
- c?.(t, e.defaut);
274
- }, [c, t, e.defaut]), L(() => {
275
- const o = r?.sections.find(
276
- (d) => d.blockType === t
277
- ), a = n ?? o?.data ?? null, m = a ? b(a, r?.langue ?? "fr") : null;
400
+ function Me(e, t) {
401
+ const n = x(), r = n?.apercu?.[e], s = n?.declarerRepli;
402
+ return E(() => {
403
+ s?.(e, t.defaut);
404
+ }, [s, e, t.defaut]), k(() => {
405
+ const c = n?.sections.find(
406
+ (b) => b.blockType === e
407
+ ), a = !!c?.hidden, h = a ? null : r ?? c?.data ?? null, S = h ? T(h, n?.langue ?? "fr") : null;
278
408
  return {
279
- contenu: B(e.defaut, m),
280
- publie: !!o?.data,
281
- UID: o?.UID ?? null,
282
- chargement: r?.etat === "chargement",
283
- ancrage: { "data-lystech-section": t },
284
- champ: tt(t)
409
+ contenu: ve(t.defaut, S),
410
+ visible: !a,
411
+ audience: c?.audience ?? null,
412
+ publie: !!c?.data,
413
+ UID: c?.UID ?? null,
414
+ chargement: n?.etat === "chargement",
415
+ ancrage: { "data-lystech-section": e },
416
+ champ: Le(e)
285
417
  };
286
418
  }, [
287
- r?.sections,
288
- r?.langue,
289
- r?.etat,
290
- n,
291
- t,
292
- e.defaut
419
+ n?.sections,
420
+ n?.langue,
421
+ n?.etat,
422
+ r,
423
+ e,
424
+ t.defaut
293
425
  ]);
294
426
  }
295
- function at(t, e) {
296
- const r = O();
297
- return L(() => {
298
- const n = { "data-lystech-section": t }, c = (r?.sections ?? []).filter(
299
- (o) => o.blockType === t
300
- );
301
- return c.length === 0 ? {
302
- items: (e?.defaut ?? []).map((o, a) => ({
303
- ...o,
304
- __uid: `defaut-${a}`
427
+ function Ne(e, t) {
428
+ const n = x();
429
+ return k(() => {
430
+ const r = { "data-lystech-section": e }, s = (n?.sections ?? []).filter(
431
+ (a) => a.blockType === e
432
+ ), c = s.filter((a) => !a.hidden);
433
+ return s.length > 0 && c.length === 0 ? { items: [], publie: !0, chargement: n?.etat === "chargement", ancrage: r } : c.length === 0 ? {
434
+ items: (t?.defaut ?? []).map((a, h) => ({
435
+ ...a,
436
+ __uid: `defaut-${h}`
305
437
  })),
306
438
  publie: !1,
307
- chargement: r?.etat === "chargement",
308
- ancrage: n
439
+ chargement: n?.etat === "chargement",
440
+ ancrage: r
309
441
  } : {
310
- items: c.map((o) => ({
311
- ...b(o.data ?? {}, r?.langue ?? "fr"),
312
- __uid: o.UID
442
+ items: c.map((a) => ({
443
+ ...T(a.data ?? {}, n?.langue ?? "fr"),
444
+ __uid: a.UID
313
445
  })),
314
446
  publie: !0,
315
- chargement: r?.etat === "chargement",
316
- ancrage: n
447
+ chargement: n?.etat === "chargement",
448
+ ancrage: r
317
449
  };
318
- }, [r?.sections, r?.langue, r?.etat, t, e?.defaut]);
450
+ }, [n?.sections, n?.langue, n?.etat, e, t?.defaut]);
319
451
  }
320
452
  export {
321
- dt as CLASSE_HORS_EDITION,
322
- ct as SectionsProvider,
323
- st as SignatureLystech,
324
- ht as adaptateurI18next,
325
- K as appliquerAuxTextes,
326
- it as useSection,
327
- at as useSectionList,
328
- O as useSectionsContext
453
+ K as ATTR_COLLECTION,
454
+ le as ATTR_COLLECTION_AFFICHEE,
455
+ de as ATTR_PRODUIT,
456
+ Ue as Audience,
457
+ Fe as BoutonEdition,
458
+ qe as CLASSE_HORS_EDITION,
459
+ Q as EVENEMENT_CATALOGUE,
460
+ De as SectionsProvider,
461
+ ke as SignatureLystech,
462
+ $e as adaptateurI18next,
463
+ B as appliquerAuxTextes,
464
+ Oe as marqueCollection,
465
+ je as marqueProduit,
466
+ Te as useCatalogueModifie,
467
+ Me as useSection,
468
+ Ne as useSectionList,
469
+ x as useSectionsContext,
470
+ Ae as useVisiteur
329
471
  };