@egen-civitas/esm-app-shell 2.11.0 → 3.0.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 (144) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +4 -0
  3. package/dependencies.json +0 -1
  4. package/dist/{20657ca044e03c5a.js → 3511cb52421245d2.js} +1 -1
  5. package/dist/{20657ca044e03c5a.js.map → 3511cb52421245d2.js.map} +1 -1
  6. package/dist/6dbcb5941f2df991.css +1 -0
  7. package/dist/6dbcb5941f2df991.css.map +1 -0
  8. package/dist/813eae2000ea36ed.js +1 -0
  9. package/dist/813eae2000ea36ed.js.map +1 -0
  10. package/dist/82dfd50166a5c521.js +1 -0
  11. package/dist/{00ec668773e4b1f9.js.map → 82dfd50166a5c521.js.map} +1 -1
  12. package/dist/{e7bbded2c2574aaf.js.map → 9b6e06745c772498.js.map} +1 -1
  13. package/dist/{124ea515e17df9d6.js → 9db69859ba0e2e39.js} +1 -1
  14. package/dist/{124ea515e17df9d6.js.map → 9db69859ba0e2e39.js.map} +1 -1
  15. package/dist/{6e590e5d195a54b4.js → b5df5f2d225330c6.js} +1 -1
  16. package/dist/b5df5f2d225330c6.js.map +1 -0
  17. package/dist/{112183346a8cacf8.js → bab5d9d70fb62ab3.js} +1 -1
  18. package/dist/bab5d9d70fb62ab3.js.map +1 -0
  19. package/dist/d1cb238decb53613.js +20 -0
  20. package/dist/d1cb238decb53613.js.map +1 -0
  21. package/dist/{egen.c7b1a73a2765e233.js → egen.3c5427db0e04799d.js} +3 -3
  22. package/dist/egen.3c5427db0e04799d.js.map +1 -0
  23. package/dist/egen.9d32a525f71496ff.css +1 -0
  24. package/dist/{5ad49928ffd2c870.js → fa413d650533c455.js} +1 -1
  25. package/dist/fa413d650533c455.js.map +1 -0
  26. package/dist/index.html +42 -2
  27. package/package.json +6 -8
  28. package/rspack.config.js +3 -23
  29. package/src/host-incompatible.ts +1 -1
  30. package/src/index.ejs +50 -6
  31. package/src/index.ts +1 -56
  32. package/src/paths.ts +71 -0
  33. package/src/run.ts +3 -2
  34. package/src/ui/breadcrumbs.tsx +10 -9
  35. package/tools/targets.js +1 -1
  36. package/dist/00ec668773e4b1f9.js +0 -1
  37. package/dist/08aa56bc39f555b0.js +0 -20
  38. package/dist/08aa56bc39f555b0.js.map +0 -1
  39. package/dist/112183346a8cacf8.js.map +0 -1
  40. package/dist/56d16b0a42960c11.css +0 -1
  41. package/dist/56d16b0a42960c11.css.map +0 -1
  42. package/dist/5ad49928ffd2c870.js.map +0 -1
  43. package/dist/5eeaed47d520b54d.js +0 -1
  44. package/dist/5eeaed47d520b54d.js.map +0 -1
  45. package/dist/67c7c33d226f8c4a.css +0 -1
  46. package/dist/67c7c33d226f8c4a.css.map +0 -1
  47. package/dist/6e590e5d195a54b4.js.map +0 -1
  48. package/dist/76aef6b4c07d22a7.js +0 -1
  49. package/dist/76aef6b4c07d22a7.js.map +0 -1
  50. package/dist/dca183c189ecf073.js +0 -1
  51. package/dist/dca183c189ecf073.js.map +0 -1
  52. package/dist/egen.5a4d64708e9ef5e3.css +0 -1
  53. package/dist/egen.c7b1a73a2765e233.js.map +0 -1
  54. package/dist/fonts/IBMPlexMono-Italic-Cyrillic.woff2 +0 -0
  55. package/dist/fonts/IBMPlexMono-Italic-Latin1.woff2 +0 -0
  56. package/dist/fonts/IBMPlexMono-Italic-Latin2.woff2 +0 -0
  57. package/dist/fonts/IBMPlexMono-Italic-Latin3.woff2 +0 -0
  58. package/dist/fonts/IBMPlexMono-Italic-Pi.woff2 +0 -0
  59. package/dist/fonts/IBMPlexMono-Light-Cyrillic.woff2 +0 -0
  60. package/dist/fonts/IBMPlexMono-Light-Latin1.woff2 +0 -0
  61. package/dist/fonts/IBMPlexMono-Light-Latin2.woff2 +0 -0
  62. package/dist/fonts/IBMPlexMono-Light-Latin3.woff2 +0 -0
  63. package/dist/fonts/IBMPlexMono-Light-Pi.woff2 +0 -0
  64. package/dist/fonts/IBMPlexMono-LightItalic-Cyrillic.woff2 +0 -0
  65. package/dist/fonts/IBMPlexMono-LightItalic-Latin1.woff2 +0 -0
  66. package/dist/fonts/IBMPlexMono-LightItalic-Latin2.woff2 +0 -0
  67. package/dist/fonts/IBMPlexMono-LightItalic-Latin3.woff2 +0 -0
  68. package/dist/fonts/IBMPlexMono-LightItalic-Pi.woff2 +0 -0
  69. package/dist/fonts/IBMPlexMono-Regular-Cyrillic.woff2 +0 -0
  70. package/dist/fonts/IBMPlexMono-Regular-Latin1.woff2 +0 -0
  71. package/dist/fonts/IBMPlexMono-Regular-Latin2.woff2 +0 -0
  72. package/dist/fonts/IBMPlexMono-Regular-Latin3.woff2 +0 -0
  73. package/dist/fonts/IBMPlexMono-Regular-Pi.woff2 +0 -0
  74. package/dist/fonts/IBMPlexMono-SemiBold-Cyrillic.woff2 +0 -0
  75. package/dist/fonts/IBMPlexMono-SemiBold-Latin1.woff2 +0 -0
  76. package/dist/fonts/IBMPlexMono-SemiBold-Latin2.woff2 +0 -0
  77. package/dist/fonts/IBMPlexMono-SemiBold-Latin3.woff2 +0 -0
  78. package/dist/fonts/IBMPlexMono-SemiBold-Pi.woff2 +0 -0
  79. package/dist/fonts/IBMPlexMono-SemiBoldItalic-Cyrillic.woff2 +0 -0
  80. package/dist/fonts/IBMPlexMono-SemiBoldItalic-Latin1.woff2 +0 -0
  81. package/dist/fonts/IBMPlexMono-SemiBoldItalic-Latin2.woff2 +0 -0
  82. package/dist/fonts/IBMPlexMono-SemiBoldItalic-Latin3.woff2 +0 -0
  83. package/dist/fonts/IBMPlexMono-SemiBoldItalic-Pi.woff2 +0 -0
  84. package/dist/fonts/IBMPlexSans-Italic-Cyrillic.woff2 +0 -0
  85. package/dist/fonts/IBMPlexSans-Italic-Latin1.woff2 +0 -0
  86. package/dist/fonts/IBMPlexSans-Italic-Latin2.woff2 +0 -0
  87. package/dist/fonts/IBMPlexSans-Italic-Latin3.woff2 +0 -0
  88. package/dist/fonts/IBMPlexSans-Italic-Pi.woff2 +0 -0
  89. package/dist/fonts/IBMPlexSans-Light-Cyrillic.woff2 +0 -0
  90. package/dist/fonts/IBMPlexSans-Light-Latin1.woff2 +0 -0
  91. package/dist/fonts/IBMPlexSans-Light-Latin2.woff2 +0 -0
  92. package/dist/fonts/IBMPlexSans-Light-Latin3.woff2 +0 -0
  93. package/dist/fonts/IBMPlexSans-Light-Pi.woff2 +0 -0
  94. package/dist/fonts/IBMPlexSans-LightItalic-Cyrillic.woff2 +0 -0
  95. package/dist/fonts/IBMPlexSans-LightItalic-Latin1.woff2 +0 -0
  96. package/dist/fonts/IBMPlexSans-LightItalic-Latin2.woff2 +0 -0
  97. package/dist/fonts/IBMPlexSans-LightItalic-Latin3.woff2 +0 -0
  98. package/dist/fonts/IBMPlexSans-LightItalic-Pi.woff2 +0 -0
  99. package/dist/fonts/IBMPlexSans-Regular-Cyrillic.woff2 +0 -0
  100. package/dist/fonts/IBMPlexSans-Regular-Latin1.woff2 +0 -0
  101. package/dist/fonts/IBMPlexSans-Regular-Latin2.woff2 +0 -0
  102. package/dist/fonts/IBMPlexSans-Regular-Latin3.woff2 +0 -0
  103. package/dist/fonts/IBMPlexSans-Regular-Pi.woff2 +0 -0
  104. package/dist/fonts/IBMPlexSans-SemiBold-Cyrillic.woff2 +0 -0
  105. package/dist/fonts/IBMPlexSans-SemiBold-Latin1.woff2 +0 -0
  106. package/dist/fonts/IBMPlexSans-SemiBold-Latin2.woff2 +0 -0
  107. package/dist/fonts/IBMPlexSans-SemiBold-Latin3.woff2 +0 -0
  108. package/dist/fonts/IBMPlexSans-SemiBold-Pi.woff2 +0 -0
  109. package/dist/fonts/IBMPlexSans-SemiBoldItalic-Cyrillic.woff2 +0 -0
  110. package/dist/fonts/IBMPlexSans-SemiBoldItalic-Latin1.woff2 +0 -0
  111. package/dist/fonts/IBMPlexSans-SemiBoldItalic-Latin2.woff2 +0 -0
  112. package/dist/fonts/IBMPlexSans-SemiBoldItalic-Latin3.woff2 +0 -0
  113. package/dist/fonts/IBMPlexSans-SemiBoldItalic-Pi.woff2 +0 -0
  114. package/dist/fonts/IBMPlexSerif-Italic-Cyrillic.woff2 +0 -0
  115. package/dist/fonts/IBMPlexSerif-Italic-Latin1.woff2 +0 -0
  116. package/dist/fonts/IBMPlexSerif-Italic-Latin2.woff2 +0 -0
  117. package/dist/fonts/IBMPlexSerif-Italic-Latin3.woff2 +0 -0
  118. package/dist/fonts/IBMPlexSerif-Italic-Pi.woff2 +0 -0
  119. package/dist/fonts/IBMPlexSerif-Light-Cyrillic.woff2 +0 -0
  120. package/dist/fonts/IBMPlexSerif-Light-Latin1.woff2 +0 -0
  121. package/dist/fonts/IBMPlexSerif-Light-Latin2.woff2 +0 -0
  122. package/dist/fonts/IBMPlexSerif-Light-Latin3.woff2 +0 -0
  123. package/dist/fonts/IBMPlexSerif-Light-Pi.woff2 +0 -0
  124. package/dist/fonts/IBMPlexSerif-LightItalic-Cyrillic.woff2 +0 -0
  125. package/dist/fonts/IBMPlexSerif-LightItalic-Latin1.woff2 +0 -0
  126. package/dist/fonts/IBMPlexSerif-LightItalic-Latin2.woff2 +0 -0
  127. package/dist/fonts/IBMPlexSerif-LightItalic-Latin3.woff2 +0 -0
  128. package/dist/fonts/IBMPlexSerif-LightItalic-Pi.woff2 +0 -0
  129. package/dist/fonts/IBMPlexSerif-Regular-Cyrillic.woff2 +0 -0
  130. package/dist/fonts/IBMPlexSerif-Regular-Latin1.woff2 +0 -0
  131. package/dist/fonts/IBMPlexSerif-Regular-Latin2.woff2 +0 -0
  132. package/dist/fonts/IBMPlexSerif-Regular-Latin3.woff2 +0 -0
  133. package/dist/fonts/IBMPlexSerif-Regular-Pi.woff2 +0 -0
  134. package/dist/fonts/IBMPlexSerif-SemiBold-Cyrillic.woff2 +0 -0
  135. package/dist/fonts/IBMPlexSerif-SemiBold-Latin1.woff2 +0 -0
  136. package/dist/fonts/IBMPlexSerif-SemiBold-Latin2.woff2 +0 -0
  137. package/dist/fonts/IBMPlexSerif-SemiBold-Latin3.woff2 +0 -0
  138. package/dist/fonts/IBMPlexSerif-SemiBold-Pi.woff2 +0 -0
  139. package/dist/fonts/IBMPlexSerif-SemiBoldItalic-Cyrillic.woff2 +0 -0
  140. package/dist/fonts/IBMPlexSerif-SemiBoldItalic-Latin1.woff2 +0 -0
  141. package/dist/fonts/IBMPlexSerif-SemiBoldItalic-Latin2.woff2 +0 -0
  142. package/dist/fonts/IBMPlexSerif-SemiBoldItalic-Latin3.woff2 +0 -0
  143. package/dist/fonts/IBMPlexSerif-SemiBoldItalic-Pi.woff2 +0 -0
  144. /package/dist/{e7bbded2c2574aaf.js → 9b6e06745c772498.js} +0 -0
package/rspack.config.js CHANGED
@@ -22,7 +22,6 @@ try {
22
22
 
23
23
 
24
24
  const { mkdirSync, readdirSync, statSync, readFileSync, writeFileSync } = require('node:fs');
25
- const sass = require('sass-embedded');
26
25
  const semver = require('semver');
27
26
  const { removeTrailingSlash, getTimestamp } = require('./tools/helpers');
28
27
  const { resolveTarget, targetWindowBridge } = require('./tools/targets');
@@ -344,15 +343,9 @@ module.exports = (env, argv = []) => {
344
343
 
345
344
  const assetsPatterns = egenJsCssAssets.map((asset) => ({ from: asset, to: 'assets' }));
346
345
 
347
- // Compile the styleguide SCSS to CSS outside of rspack so it's a pure static file
348
- // with no JS involvement. The result is content-hashed for long-term caching.
349
- // Sass preserves @import of .css files as plain CSS @import rules rather than
350
- // inlining them, so we strip those out and prepend the actual file contents.
351
- const sassOutput = sass.compile(require.resolve('@egen-civitas/esm-styleguide/styles'), {
352
- style: isProd ? 'compressed' : 'expanded',
353
- quietDeps: true,
354
- loadPaths: [resolve(__dirname, '..', '..', '..', 'node_modules')],
355
- }).css;
346
+ // La feuille globale du styleguide est du CSS standard (plus de préprocesseur) : on la lit telle quelle, hors rspack,
347
+ // pour qu'elle reste un fichier statique sans JS, haché par contenu pour le cache long terme.
348
+ const sassOutput = readFileSync(require.resolve('@egen-civitas/esm-styleguide/styles'), 'utf-8');
356
349
 
357
350
  const cssImportRegex = /@import\s*["']([^"']+)["']\s*;?\n?/g;
358
351
  const inlinedImports = [];
@@ -528,19 +521,6 @@ module.exports = (env, argv = []) => {
528
521
  { loader: require.resolve('css-loader') },
529
522
  ],
530
523
  },
531
- {
532
- test: /\.s[ac]ss$/,
533
- use: [
534
- isProd
535
- ? { loader: require.resolve(CssExtractRspackPlugin.loader) }
536
- : { loader: require.resolve('style-loader') },
537
- { loader: require.resolve('css-loader') },
538
- {
539
- loader: require.resolve('sass-loader'),
540
- options: { sassOptions: { quietDeps: true } },
541
- },
542
- ],
543
- },
544
524
  {
545
525
  test: /\.(woff|woff2|png)?$/,
546
526
  type: 'asset/resource',
@@ -46,7 +46,7 @@ export function renderHostIncompatibleScreen(error: unknown, doc: Document = doc
46
46
  detail.className = 'egen-host-incompatible__detail';
47
47
  detail.textContent = error instanceof Error ? error.message : '';
48
48
  const button = doc.createElement('button');
49
- button.className = 'cds--btn cds--btn--primary';
49
+ button.className = 'egen-btn egen-btn--primary';
50
50
  button.type = 'button';
51
51
  button.textContent = t.reload;
52
52
  button.addEventListener('click', () => location.reload());
package/src/index.ejs CHANGED
@@ -85,6 +85,50 @@
85
85
  <% if (egenCoreRoutes) { %>
86
86
  <script type="egen-routes"><%= egenCoreRoutes %></script>
87
87
  <% } %>
88
+ <!-- Fond et centrage des modales (showModal). CSS simple : la fenêtre elle-même est stylée en ligne par esm-styleguide. -->
89
+ <style>
90
+ .egen-modals-container {
91
+ position: fixed;
92
+ top: 0;
93
+ left: 0;
94
+ width: 100vw;
95
+ height: 100vh;
96
+ z-index: 9001;
97
+ display: flex;
98
+ align-items: center;
99
+ justify-content: center;
100
+ background-color: rgba(0, 0, 0, 0.5);
101
+ visibility: hidden;
102
+ }
103
+ /* Page d'erreur de l'application (modèle #app-error) : CSS simple, sans dépendance à une bibliothèque de composants. */
104
+ .egen-btn {
105
+ display: inline-flex;
106
+ align-items: center;
107
+ min-height: 2.5rem;
108
+ padding: 0 1rem;
109
+ border: 1px solid transparent;
110
+ border-radius: 0.375rem;
111
+ background: #e5e7eb;
112
+ color: #111827;
113
+ font: inherit;
114
+ cursor: pointer;
115
+ }
116
+ .egen-btn:hover { filter: brightness(0.95); }
117
+ .egen-btn--primary { background: #0f62fe; color: #fff; }
118
+ .egen-snippet {
119
+ position: relative;
120
+ max-width: 48rem;
121
+ margin-top: 1rem;
122
+ background: #f4f4f4;
123
+ border-radius: 0.375rem;
124
+ }
125
+ .egen-snippet-container { overflow: auto; padding: 0.75rem 3rem 0.75rem 1rem; font-family: ui-monospace, monospace; font-size: 0.8125rem; }
126
+ .egen-snippet-container pre { margin: 0; white-space: pre-wrap; }
127
+ .egen-copy-btn { position: absolute; top: 0; right: 0; width: 2.5rem; height: 2.5rem; border: 0; background: transparent; cursor: pointer; }
128
+ .egen-copy-btn:hover { background: rgba(0, 0, 0, 0.08); }
129
+ .egen-copy-btn__feedback, .egen-assistive-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
130
+ .egen-snippet__icon { fill: currentColor; }
131
+ </style>
88
132
  </head>
89
133
  <body>
90
134
  <%= htmlWebpackPlugin.tags.bodyTags %>
@@ -127,18 +171,18 @@
127
171
  <p>Something went wrong. Please try reloading.</p>
128
172
  <p>Contact your system administrator if the problem persists.</p>
129
173
  <div id="buttons">
130
- <button class="cds--btn cds--btn--primary" <% if (!egenBootstrap) { %>onclick="location.reload()"<% } else { %>data-egen-action="reload"<% } %>>Reload</button>
174
+ <button class="egen-btn egen-btn--primary" <% if (!egenBootstrap) { %>onclick="location.reload()"<% } else { %>data-egen-action="reload"<% } %>>Reload</button>
131
175
  </div>
132
- <div class="cds--snippet cds--snippet--single" >
133
- <div tabindex="0" class="cds--snippet-container"
176
+ <div class="egen-snippet" >
177
+ <div tabindex="0" class="egen-snippet-container"
134
178
  aria-label="Code Snippet Text">
135
179
  <pre>
136
180
  <code data-var="message"></code>
137
181
  </pre>
138
182
  </div>
139
- <button data-copy-btn class="cds--copy-btn" type="button" tabindex="0" <% if (!egenBootstrap) { %>onclick="copyText(this.parentElement)"<% } else { %>data-egen-action="copy"<% } %>>
140
- <span class="cds--assistive-text cds--copy-btn__feedback">Copied!</span>
141
- <svg focusable="false" preserveAspectRatio="xMidYMid meet" style="will-change: transform;" xmlns="http://www.w3.org/2000/svg" class="cds--snippet__icon" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="M14,5v9H5V5h9m0-1H5A1,1,0,0,0,4,5v9a1,1,0,0,0,1,1h9a1,1,0,0,0,1-1V5a1,1,0,0,0-1-1Z"></path><path d="M2,9H1V2A1,1,0,0,1,2,1H9V2H2Z"></path></svg>
183
+ <button data-copy-btn class="egen-copy-btn" type="button" tabindex="0" <% if (!egenBootstrap) { %>onclick="copyText(this.parentElement)"<% } else { %>data-egen-action="copy"<% } %>>
184
+ <span class="egen-assistive-text egen-copy-btn__feedback">Copied!</span>
185
+ <svg focusable="false" preserveAspectRatio="xMidYMid meet" style="will-change: transform;" xmlns="http://www.w3.org/2000/svg" class="egen-snippet__icon" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="M14,5v9H5V5h9m0-1H5A1,1,0,0,0,4,5v9a1,1,0,0,0,1,1h9a1,1,0,0,0,1-1V5a1,1,0,0,0-1-1Z"></path><path d="M2,9H1V2A1,1,0,0,1,2,1H9V2H2Z"></path></svg>
142
186
  </button>
143
187
  </div>
144
188
  </div>
package/src/index.ts CHANGED
@@ -1,60 +1,5 @@
1
1
  import type { SpaConfig } from '@egen-civitas/esm-framework/src/internal';
2
-
3
- function _createSpaBase(baseUrl: string) {
4
- return () => baseUrl;
5
- }
6
-
7
- function setupPaths(config: SpaConfig) {
8
- let error = false;
9
- if (!config.apiUrl) {
10
- console.error(
11
- 'initializeSpa() was called without supplying an apiUrl. This means that the application cannot communicate with the backend.',
12
- );
13
- error = true;
14
- }
15
-
16
- if (!config.spaPath) {
17
- console.error(
18
- 'initializeSpa() was called without supplying a spaPath. This means that the application cannot properly generate urls.',
19
- );
20
- error = true;
21
- }
22
-
23
- if (error) {
24
- throw new Error(
25
- 'One or more required properties in the basic configuration of the application was missing and the application cannot be rendered. Please see the browser console for details.',
26
- );
27
- }
28
-
29
- // Object.defineProperty used to make these read-only
30
- Object.defineProperty(window, 'egenBase', {
31
- value: config.apiUrl,
32
- writable: false,
33
- configurable: false,
34
- });
35
- Object.defineProperty(window, 'spaBase', {
36
- value: config.spaPath,
37
- writable: false,
38
- configurable: false,
39
- });
40
- Object.defineProperty(window, 'spaEnv', {
41
- value: config.env || 'production',
42
- writable: false,
43
- configurable: false,
44
- });
45
- Object.defineProperty(window, 'spaVersion', {
46
- value: process.env.BUILD_VERSION ?? 'local',
47
- writable: false,
48
- configurable: false,
49
- });
50
-
51
- const spaBaseWithSlash = window.spaBase.endsWith('/') ? window.spaBase : window.spaBase + '/';
52
- Object.defineProperty(window, 'getEgenSpaBase', {
53
- value: _createSpaBase(spaBaseWithSlash),
54
- writable: false,
55
- configurable: false,
56
- });
57
- }
2
+ import { setupPaths } from './paths.js';
58
3
 
59
4
  export function setupUtils() {
60
5
  Object.defineProperty(window, 'copyText', {
package/src/paths.ts ADDED
@@ -0,0 +1,71 @@
1
+ import type { SpaConfig } from '@egen-civitas/esm-framework/src/internal';
2
+
3
+ function _createSpaBase(baseUrl: string) {
4
+ return () => baseUrl;
5
+ }
6
+
7
+ /**
8
+ * Pose les chemins globaux du shell (`egenBase`, `spaBase`, `spaEnv`, `spaVersion`, `getEgenSpaBase`), en lecture seule.
9
+ *
10
+ * Cible native (B6) : `spaPath` vaut `/app` (constant) et `apiUrl` est **absolue** (`https://…`) car l'origine du WebView
11
+ * n'est pas celle de l'API ; Web : `apiUrl` relative (`/egen`), même origine. `target` ne sert qu'aux tests.
12
+ */
13
+ export function setupPaths(config: SpaConfig, target: Window = window) {
14
+ let error = false;
15
+ if (!config.apiUrl) {
16
+ console.error(
17
+ 'initializeSpa() was called without supplying an apiUrl. This means that the application cannot communicate with the backend.',
18
+ );
19
+ error = true;
20
+ }
21
+
22
+ if (!config.spaPath) {
23
+ console.error(
24
+ 'initializeSpa() was called without supplying a spaPath. This means that the application cannot properly generate urls.',
25
+ );
26
+ error = true;
27
+ }
28
+
29
+ if (error) {
30
+ throw new Error(
31
+ 'One or more required properties in the basic configuration of the application was missing and the application cannot be rendered. Please see the browser console for details.',
32
+ );
33
+ }
34
+
35
+ // Object.defineProperty used to make these read-only
36
+ Object.defineProperty(target, 'egenBase', {
37
+ value: config.apiUrl,
38
+ writable: false,
39
+ configurable: false,
40
+ });
41
+ Object.defineProperty(target, 'spaBase', {
42
+ value: config.spaPath,
43
+ writable: false,
44
+ configurable: false,
45
+ });
46
+ Object.defineProperty(target, 'spaEnv', {
47
+ value: config.env || 'production',
48
+ writable: false,
49
+ configurable: false,
50
+ });
51
+ Object.defineProperty(target, 'spaVersion', {
52
+ value: process.env.BUILD_VERSION ?? 'local',
53
+ writable: false,
54
+ configurable: false,
55
+ });
56
+
57
+ const spaBaseWithSlash = target.spaBase.endsWith('/') ? target.spaBase : target.spaBase + '/';
58
+ Object.defineProperty(target, 'getEgenSpaBase', {
59
+ value: _createSpaBase(spaBaseWithSlash),
60
+ writable: false,
61
+ configurable: false,
62
+ });
63
+ }
64
+
65
+ /**
66
+ * URL absolue d'un chemin d'API (`/ws/rest/v1/session`…) : sans origine propre, une base d'API absolue est conservée
67
+ * telle quelle ; une base relative (Web) est résolue contre l'origine de la page.
68
+ */
69
+ export function resolveApiUrl(path: string, egenBase: string = window.egenBase, origin: string = window.location.origin) {
70
+ return new URL(`${egenBase}${path}`, origin).href;
71
+ }
package/src/run.ts CHANGED
@@ -60,6 +60,7 @@ import './events.js';
60
60
  import { appName, getCoreExtensions } from './ui/index.js';
61
61
  import { setupCoreConfig } from './core-config.js';
62
62
  import { bindPlatformSession } from './native-session.js';
63
+ import { resolveApiUrl } from './paths.js';
63
64
  import { HostIncompatibleError, isHostIncompatible, renderHostIncompatibleScreen } from './host-incompatible.js';
64
65
  import { setupOfflineMode } from './offline-setup.js';
65
66
 
@@ -225,7 +226,7 @@ function renderFatalErrorPage(e?: Error) {
225
226
  const appErrorActionButtons = fragment?.querySelector('#buttons');
226
227
  if (appErrorActionButtons) {
227
228
  const clearDevOverridesButton = document.createElement('button');
228
- clearDevOverridesButton.className = 'cds--btn';
229
+ clearDevOverridesButton.className = 'egen-btn';
229
230
  clearDevOverridesButton.innerHTML = 'Clear dev overrides';
230
231
  clearDevOverridesButton.onclick = clearDevOverrides;
231
232
  appErrorActionButtons.appendChild(clearDevOverridesButton);
@@ -374,7 +375,7 @@ async function precacheGlobalStaticDependencies() {
374
375
 
375
376
  // By default, cache the session endpoint.
376
377
  // This ensures that a lot of user/session related functions also work offline.
377
- const sessionPathUrl = new URL(`${window.egenBase}${restBaseUrl}/session`, window.location.origin).href;
378
+ const sessionPathUrl = resolveApiUrl(`${restBaseUrl}/session`);
378
379
 
379
380
  await messageEgenServiceWorker({
380
381
  type: 'registerDynamicRoute',
@@ -1,7 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { Breadcrumb, BreadcrumbItem, InlineLoading } from '@carbon/react';
3
2
  import type { BreadcrumbRegistration } from '@egen-civitas/esm-framework';
4
- import { getBreadcrumbsFor, ConfigurableLink } from '@egen-civitas/esm-framework';
3
+ import { getBreadcrumbsFor, ConfigurableLink, InlineLoading } from '@egen-civitas/esm-framework';
5
4
 
6
5
  function getPath(path: string, params: Array<string>) {
7
6
  const parts = [...params];
@@ -44,11 +43,11 @@ export const CustomBreadcrumbItem: React.FC<CustomBreadcrumbItemProps> = ({ brea
44
43
  }, [breadcrumbRegistration, params]);
45
44
 
46
45
  return (
47
- <BreadcrumbItem key={breadcrumbRegistration.settings.path}>
46
+ <li key={breadcrumbRegistration.settings.path} className="egen-breadcrumb-item">
48
47
  <ConfigurableLink to={getPath(breadcrumbRegistration.settings.path, params)}>
49
48
  {title ? title : <InlineLoading />}
50
49
  </ConfigurableLink>
51
- </BreadcrumbItem>
50
+ </li>
52
51
  );
53
52
  };
54
53
 
@@ -75,11 +74,13 @@ export const Breadcrumbs: React.FC = () => {
75
74
  }
76
75
 
77
76
  return (
78
- <Breadcrumb className="breadcrumbs-container">
79
- {breadcrumbs.map((bc, index) => (
80
- <CustomBreadcrumbItem key={`breadcrumb-item-${index}`} breadcrumbRegistration={bc} params={params} />
81
- ))}
82
- </Breadcrumb>
77
+ <nav aria-label="Breadcrumb" className="breadcrumbs-container">
78
+ <ol className="egen-breadcrumb">
79
+ {breadcrumbs.map((bc, index) => (
80
+ <CustomBreadcrumbItem key={`breadcrumb-item-${index}`} breadcrumbRegistration={bc} params={params} />
81
+ ))}
82
+ </ol>
83
+ </nav>
83
84
  );
84
85
  };
85
86
 
package/tools/targets.js CHANGED
@@ -25,7 +25,7 @@ const WEB_DEFAULT_PUBLIC_PATH = '/egen-civitas/spa';
25
25
 
26
26
  /**
27
27
  * CSP de départ de la cible native (proposition à valider sur appareil, cf. tâche B5).
28
- * Les styles `'unsafe-inline'` sont à réexaminer (Carbon / injection de styles). `'unsafe-eval'` est interdit.
28
+ * Les styles `'unsafe-inline'` sont à réexaminer (injection de styles). `'unsafe-eval'` est interdit.
29
29
  *
30
30
  * @param {string} apiOrigin Origine de l'API (`https://api.exemple.ga`), déjà validée.
31
31
  * @returns {string}
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_egen_civitas_esm_app_shell=self.webpackChunk_egen_civitas_esm_app_shell||[]).push([["6121"],{6739(e,t,n){n.r(t),n.d(t,{getSessionStore:()=>W,getTenantId:()=>f,getSessionLocation:()=>$,EgenFetchError:()=>U,createRetryMiddleware:()=>ex,setSessionLocation:()=>K,applyDevAuthBypassForLogin:()=>eE,egenFetch:()=>x,setUserLanguage:()=>H,setupApiModule:()=>ek,userHasAccess:()=>X,isDevEnabled:()=>Z,initDevAuthBypass:()=>eP,sessionEndpoint:()=>I,sessionStore:()=>M,clearCurrentUser:()=>q,egenObservableFetch:()=>B,getLoggedInUser:()=>V,refetchCurrentUser:()=>J,backendDependencies:()=>ee,makeUrl:()=>D,interceptSessionFetch:()=>ej,setAuthorizationProvider:()=>g,tenantHeaders:()=>d,isDevAuthBypassEnabled:()=>eu,subscribeTenant:()=>h,setUserProperties:()=>Q,isMultiTenant:()=>p,composeMiddlewares:()=>eT,isProblemDetails:()=>b,restBaseUrl:()=>_,getCurrentUser:()=>z});var r=n(8507),o=n(1442);let i=function(e){return void 0===e};var a=n(919),s=n(7344),u=n(3645),c=n(7774);function l(){var e,t=(0,o.getGlobalStore)("tenant");return null!=(e=null==t?void 0:t.getState())?e:null}function f(){var e,t;return null!=(e=null==(t=l())?void 0:t.tenantId)?e:void 0}function d(){var e=f();return e?{"X-Tenant-ID":e}:{}}function p(){var e;return(null==(e=l())?void 0:e.mode)==="multi"}function h(e){var t=(0,o.getGlobalStore)("tenant");return t?t.subscribe(e):function(){}}var v="${egenSpaBase}/login",y={redirectAuthFailure:{enabled:{_type:u.Type.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:u.Type.String,_default:v,_validators:[u.validators.isUrl],_description:"The url to which users will be redirected when they are logged out. If set to blank, the `location` header from the response will be used."},errors:{_type:u.Type.Array,_default:[401],_elements:{_type:u.Type.Number,_validators:[u.validators.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:u.Type.Boolean,_default:!1,_description:"Changes how requests that fail authentication are handled. Try messing with this if redirects to the login page aren't working correctly."}},followRedirects:{_type:u.Type.Boolean,_default:!0,_description:"Whether egenFetch should support redirects returned from the backend"}};function b(e){return(0,s.A)(e)&&"string"==typeof e.title}var w=null,m=null;function g(e){w=e,m=null}function S(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){n(e);return}s.done?t(u):Promise.resolve(u).then(r,o)}function O(e,t,n){return(O=T()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&P(o,n.prototype),o}).apply(null,arguments)}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function E(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function k(e){var t="function"==typeof Map?new Map:void 0;return(k=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return O(e,arguments,j(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),P(n,e)})(e)}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(T=function(){return!!e})()}function A(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _="/ws/rest/v1",I="".concat(_,"/session");function D(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.egenBase+e)}function x(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e)throw Error("The first argument to @egen-civitas/api's egenFetch function must be a url string");if((void 0===t?"undefined":E(t))!=="object")throw Error("The second argument to @egen-civitas/api's egenFetch function must be a plain object.");if(!window.egenBase)throw Error("@egen-civitas/api is running in a browser that doesn't have window.egenBase, which is provided by egen-module-spa's HTML file.");var n=D(e);if(t.headers||(t.headers={}),(0,s.A)(t.body)&&(t.body=JSON.stringify(t.body)),void 0===t.headers.Accept&&(t.headers.Accept="application/json"),null===t.headers.Accept&&delete t.headers.Accept,e.startsWith(_)&&void 0===t.headers["Disable-WWW-Authenticate"]&&(t.headers["Disable-WWW-Authenticate"]="true"),void 0===t.headers["X-Tenant-ID"]){var r=f();r&&(t.headers["X-Tenant-ID"]=r)}var o=Error(),i=w,a=Object.keys(t.headers).some(function(e){return"authorization"===e.toLowerCase()});return((null==i?void 0:i.credentials)&&void 0===t.credentials&&(t.credentials=i.credentials),i&&!a)?i.getAuthorization().then(function(e){return e&&(t.headers.Authorization=e),R(n,t,o,{authorizationInjected:!!e,isRetry:!1})}):R(n,t,o,{authorizationInjected:!1,isRetry:!1})}function R(e,t,n,r){return window.fetch(e,t).then(function(o){var i;return(i=function(){var i,a,s,l,f,d,p,h,y;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:u(0)}),s(a,"throw",{value:u(1)}),s(a,"return",{value:u(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function u(s){return function(u){var c=[s,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(b){switch(b.label){case 0:var g;if(i=o,a=w,!(s=401===i.status&&r.authorizationInjected&&!r.isRetry&&(null==a?void 0:a.refresh)&&function(e){if((null==(r=e.signal)?void 0:r.aborted)||"u">typeof ReadableStream&&(t=e.body,null!=(n=ReadableStream)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](t):t instanceof n))return!1;var t,n,r,o=(e.method||"GET").toUpperCase();return"GET"===o||"HEAD"===o||!0===e.replayOnUnauthorized}(t)))return[3,2];return[4,(null==(g=w)?void 0:g.refresh)?(m||(m=g.refresh().then(function(e){return m=null,e},function(){return m=null,!1})),m):Promise.resolve(!1)];case 1:s=b.sent(),b.label=2;case 2:if(!s)return[3,4];return[4,a.getAuthorization()];case 3:if(l=b.sent())return t.headers.Authorization=l,[2,R(e,t,n,{authorizationInjected:!0,isRetry:!0})];b.label=4;case 4:return[4,(0,u.getConfig)("@egen-civitas/esm-api")];case 5:if(d=(f=b.sent()).redirectAuthFailure,p=f.followRedirects,i.ok)if(204===i.status)return p&&i.headers.has("location")&&(h=i.headers.get("location"))&&(0,c.oo)({to:h}),i.data=null,[2,i];else return[2,i.clone().text().then(function(e){try{e&&(i.data=JSON.parse(e))}catch(e){}return i})];if(e===D(I)&&403===i.status||d.enabled&&d.errors.includes(i.status))return(0,c.g4)(),y=d.url||i.headers.get("location")||v,(0,c.oo)({to:y}),[2,d.resolvePromise?Promise.resolve():new Promise(function(){})];return[2,i.clone().text().then(function(t){var r=t;try{r=JSON.parse(t)}catch(e){}throw new U(e,i,r,n)},function(t){throw new U(e,i,null,n)})]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function a(e){S(o,n,r,a,s,"next",e)}function s(e){S(o,n,r,a,s,"throw",e)}a(void 0)})})()})}function B(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((void 0===t?"undefined":E(t))!=="object")throw Error("The second argument to egenObservableFetch must be either omitted or an object");var n=new AbortController;return t.signal=n.signal,new a.Observable(function(r){var o=!1;return x(e,t).then(function(e){o=!0,r.next(e),r.complete()},function(e){o=!0,r.error(e)}),function(){o||n.abort()}})}var U=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(e,n,r,o){var i,a;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return a=j(a=t),A(i=function(e,t){if(t&&("object"===E(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,T()?Reflect.construct(a,[],j(this).constructor):a.apply(this,void 0)),"response",void 0),A(i,"responseBody",void 0),A(i,"problem",void 0),i.message="Server responded with ".concat(n.status," (").concat(n.statusText,") for url ").concat(e,". Check err.responseBody or network tab in dev tools for more info"),o.message=i.message,i.responseBody=r,i.response=n,i.problem=b(r)?function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({type:"about:blank"},r):void 0,i.stack="Stacktrace for outgoing request:\n".concat(o.stack,"\nStacktrace for incoming response:\n").concat(i.stack),i}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&P(t,e),t}(k(Error));function L(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){n(e);return}s.done?t(u):Promise.resolve(u).then(r,o)}function C(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){L(i,r,o,a,s,"next",e)}function s(e){L(i,r,o,a,s,"throw",e)}a(void 0)})}}function G(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:u(0)}),s(a,"throw",{value:u(1)}),s(a,"return",{value:u(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function u(s){return function(u){var c=[s,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var M=(0,o.createGlobalStore)("session",{loaded:!1,session:null}),N=0,F=0;function z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{includeAuthStatus:!0},t=M.getState();return(N<Date.now()-6e4||!t.loaded)&&F<1&&J().catch(function(){}),new a.Observable(function(t){var n=function(n){if(n.loaded)if(e.includeAuthStatus)t.next(n.session);else{var r;t.next(null==(r=n.session)?void 0:r.user)}};return n(M.getState()),M.subscribe(n)})}function W(){var e=M.getState();return(N<Date.now()-6e4||!e.loaded)&&F<1&&J().catch(function(){}),M}function H(e){var t,n,r,o=null!=(t=e.locale)?t:null==(r=e.user)||null==(n=r.userProperties)?void 0:n.defaultLocale;o&&o.includes("_")&&(o=o.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(o)&&o!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",o)}function J(e,t){N=Date.now(),F=0;var n={};return e&&t&&(n.Authorization="Basic ".concat(window.btoa("".concat(e,":").concat(t)))),Y(x(I,{headers:n}))}function q(){M.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function X(e,t){var n,r;if(void 0===t)return!e;if(!e)return!0;return n=e,r=t,("string"==typeof n?!i(r.privileges.find(function(e){return n===e.display})):Array.isArray(n)?n.every(function(e){return!i(r.privileges.find(function(t){return e===t.display}))}):(i(n)||console.error('Could not understand privileges "'.concat(n,'"')),!0))||!i(t.roles.find(function(e){return"System Developer"===e.display}))}function V(){var e,t;return new Promise(function(n){var r=function(r){r.loaded&&r.session.user&&(e=r.session.user,n(r.session.user),t&&t())};r(M.getState()),e||(t=M.subscribe(r))})}function $(){return new Promise(function(e,t){z().subscribe(function(t){e(t.sessionLocation)},t).unsubscribe()})}function K(e,t){return C(function(){return G(this,function(n){return[2,Y(x(I,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:t.signal}))]})})()}function Q(e,t,n){return C(function(){return G(this,function(r){switch(r.label){case 0:return n||(n=new AbortController),[4,x("".concat(_,"/user/").concat(e),{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:n.signal})];case 1:return r.sent(),[2,J()]}})})()}function Y(e){return new Promise(function(t,n){e.then(function(e){var r,o;"object"==((o=null==e?void 0:e.data)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)?(F=0,r={loaded:!0,session:e.data},M.setState(r),t(r)):(r={loaded:!0,session:{authenticated:!1,sessionId:""}},M.setState(r),n(Error("Unexpected session response shape from server.")))}).catch(function(e){F++;var t,o=(null!=(t=Error)&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t)?e:Error("string"==typeof e?e:"Session fetch failed (attempt ".concat(F,"). Backend may be unreachable."));console.warn("[ESM] Session fetch failed (attempt ".concat(F,"): ").concat(o.message)),(0,r.N)(o),M.setState({loaded:!0,session:{authenticated:!1,sessionId:""}}),n(o)})})}function Z(){return"development"===window.spaEnv||"true"===localStorage.getItem("egen:devtools")}M.subscribe(function(e){e.loaded&&e.session&&H(e.session)});var ee={"webservices.rest":"2.24.0"},et=n(3766);function en(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){n(e);return}s.done?t(u):Promise.resolve(u).then(r,o)}function er(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){en(i,r,o,a,s,"next",e)}function s(e){en(i,r,o,a,s,"throw",e)}a(void 0)})}}function eo(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function ei(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function ea(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function es(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:u(0)}),s(a,"throw",{value:u(1)}),s(a,"return",{value:u(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function u(s){return function(u){var c=[s,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function eu(){if((0,et.$)())return!1;try{if("u">typeof window&&!0===window.egenDevNoAuth)return!0}catch(e){}try{return!1}catch(e){return!1}}var ec={authenticated:!0,sessionId:"dev-bypass-session",locale:"fr",allowedLocales:["fr","en"],user:{uuid:"dev-user-uuid",display:"Administrateur (Dev)",username:"dev-admin",systemId:"dev-admin",locale:"fr",allowedLocales:["fr","en"],userProperties:{defaultLocale:"fr"},person:{uuid:"dev-person-uuid",display:"Administrateur Dev",links:[]},privileges:[{uuid:"p1",name:"Get Users",display:"Get Users",links:[]},{uuid:"p2",name:"Edit Users",display:"Edit Users",links:[]},{uuid:"p3",name:"Get Records",display:"Get Records",links:[]},{uuid:"p4",name:"System Developer",display:"System Developer",links:[]}],roles:[{uuid:"r1",display:"System Developer",name:"System Developer",links:[]},{uuid:"r2",display:"Administrator",name:"Administrator",links:[]}],retired:!1,allRoles:[],allPrivileges:[]}},el="egen.devBypass.sessionLocale",ef="egen.devBypass.defaultLocale";function ed(e,t){try{return("session"===e?window.sessionStorage:window.localStorage).getItem(t)}catch(e){return null}}function ep(e,t,n){try{("session"===e?window.sessionStorage:window.localStorage).setItem(t,n)}catch(e){}}function eh(e){if("string"!=typeof e)return null;var t=e.replaceAll("-","_");return ec.allowedLocales.includes(t)?t:null}function ev(){var e,t,n=null!=(e=eh(ed("local",ef)))?e:ec.user.userProperties.defaultLocale,r=null!=(t=eh(ed("session",el)))?t:n;return ea(ei({},ec),{locale:r,user:ea(ei({},ec.user),{locale:r,userProperties:ea(ei({},ec.user.userProperties),{defaultLocale:n})})})}var ey=!0;function eb(){ey=!0;var e={loaded:!0,session:ev()};return M.setState(e),e}var ew={authenticated:!1,sessionId:""},em=!1;function eg(e){return new Response(JSON.stringify(e),{status:200,headers:{"Content-Type":"application/json","X-Dev-Bypass":"true"}})}function eS(e,t){return er(function(){var n,r,o,i;return es(this,function(a){switch(a.label){case 0:if(a.trys.push([0,6,,7]),"string"!=typeof(null==t?void 0:t.body))return[3,1];return r=t.body,[3,5];case 1:if(!eo(e,Request))return[3,3];return[4,e.clone().text()];case 2:return o=a.sent(),[3,4];case 3:o=null,a.label=4;case 4:r=o,a.label=5;case 5:return[2,(i=(n=r)?JSON.parse(n):null)&&(void 0===i?"undefined":i&&"u">typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)=="object"?i:null];case 6:return a.sent(),[2,null];case 7:return[2]}})})()}function eO(){M.setState({loaded:!0,session:ev()})}function ej(){if(!em&&"u">typeof window){em=!0;var e=window.fetch.bind(window);window.fetch=function(t,n){return er(function(){var r,o,i,a,s,u,c,l,f;return es(this,function(d){switch(d.label){case 0:if(o="string"==typeof t?t:eo(t,Request)?t.url:String(t),!("POST"===(i=(null!=(r=null==n?void 0:n.method)?r:eo(t,Request)?t.method:"GET").toUpperCase())&&(o.includes(I)||o.includes("/ws/rest/v1/session"))))return[3,2];return[4,eS(t,n)];case 1:return(s=eh.apply(void 0,[null==(a=d.sent())?void 0:a.locale]))&&ey&&(ep("session",el,s),eO()),[2,eg(ey?ev():ew)];case 2:if(u=o.match(/\/ws\/rest\/v1\/user\/([^/?#]+)/),!("POST"===i&&u&&u[1]===ec.user.uuid))return[3,4];return[4,eS(t,n)];case 3:if((f=eh(null==(l=null==(c=d.sent())?void 0:c.userProperties)?void 0:l.defaultLocale))&&ey){ep("local",ef,f);try{window.sessionStorage.removeItem(el)}catch(e){}eO()}return[2,eg(ev().user)];case 4:if(o.includes(I)||o.includes("/ws/rest/v1/session")){if("DELETE"===i)return ey=!1,[2,new Response(null,{status:204,headers:{"X-Dev-Bypass":"true"}})];return[2,eg(ey?ev():ew)]}return[2,e(t,n)]}})})()}}}function eP(){eu()&&(console.warn("[EGEN] ⚠️ EGEN_DEV_NO_AUTH=true — Bypass dev actif. Session admin fictive inject\xe9e globalement (comme une vraie connexion backend). NE PAS utiliser en production."),eb(),ej())}function eE(){return eu()?eb():null}function ek(){(0,u.defineConfigSchema)("@egen-civitas/esm-api",y),eu()||J().catch(function(){})}function eT(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=t.reduceRight(function(e,t){return function(n){return t(n,e)}},function(t){return e(t.url,t.init)});return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n({url:e,init:t})}}function eA(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){n(e);return}s.done?t(u):Promise.resolve(u).then(r,o)}var e_=["GET","HEAD","PUT","DELETE","OPTIONS"];function eI(e){if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&"response"in e){var t,n=null==(t=e.response)?void 0:t.status;return 429===n||"number"==typeof n&&n>=500}return!0}function eD(e){return new Promise(function(t){return setTimeout(t,e)})}function ex(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.maxAttempts,n=void 0===t?3:t,r=e.baseDelayMs,o=void 0===r?300:r,i=e.maxDelayMs,a=void 0===i?1e4:i,s=e.retryableMethods,u=e.isRetryable,c=void 0===u?eI:u,l=e.wait,f=void 0===l?eD:l,d=e.random,p=void 0===d?Math.random:d;if(n<1)throw Error("createRetryMiddleware: maxAttempts must be at least 1.");var h=(void 0===s?e_:s).map(function(e){return e.toUpperCase()});return function(e,t){var r;return(r=function(){var r,i,s,u,l,d;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:u(0)}),s(a,"throw",{value:u(1)}),s(a,"return",{value:u(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function u(s){return function(u){var c=[s,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(v){switch(v.label){case 0:i=(null!=(r=e.init.method)?r:"GET").toUpperCase(),s=h.includes(i),u=1,v.label=1;case 1:return v.trys.push([1,3,,5]),[4,t(e)];case 2:return[2,v.sent()];case 3:if(l=v.sent(),!s||u>=n||!c(l))throw l;return d=Math.min(a,o*Math.pow(2,u-1)),[4,f(p()*d)];case 4:return v.sent(),u++,[3,5];case 5:return[3,1];case 6:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){eA(i,n,o,a,s,"next",e)}function s(e){eA(i,n,o,a,s,"throw",e)}a(void 0)})})()}}},8507(e,t,n){n.d(t,{J:()=>i,N:()=>o});var r=n(9726);function o(e){var t=a(e);setTimeout(function(){throw t})}function i(){var e=Error();return function(t){var n=a(t);n.stack+="\nAsync stacktrace:\n".concat(e.stack),o(t)}}function a(e){var t,n;if(null!=(n=Error)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n)return e;if(null===e)return Error("'null' was thrown as an error");if((void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"){try{t="Object thrown as error: ".concat(JSON.stringify(e))}catch(n){t="Object thrown as error with the following properties: ".concat(Object.keys(e))}return Error(t)}if(void 0===e)return Error("'undefined' was thrown as an error");return Error(e.toString())}window.onerror=function(e){return console.error("Unexpected error: ",e),(0,r.Vt)({description:null!=e?e:"Oops! An unexpected error occurred.",kind:"error",title:"Error"}),!1},window.onunhandledrejection=function(e){var t;console.error("Unhandled rejection: ",e.reason),(0,r.Vt)({description:null!=(t=e.reason)?t:"Oops! An unhandled promise rejection occurred.",kind:"error",title:"Error"})}}}]);