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