@egen-civitas/esm-nextjs-utils 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @egen-civitas/esm-nextjs-utils
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3f171d9: Navigation partagée Shell ↔ application embarquée (protocole 1.1, additif) : l'URL du Core reflète la page courante de l'app (actualisation, retour/avance, partage).
8
+
9
+ - Hôte : option `navigation` de `getEmbedLifecycle` (`route`, `mode` `history` | `hash` | `none`, `sensitiveParams`, `pathMap`, `onTitle`) ; messages `hello`, `location`, `goto`.
10
+ - Client : `reportLocation()` et `onGoto()`.
11
+ - Script injectable sans dépendance `assets/egen-bridge.js` (export `@egen-civitas/esm-nextjs-utils/egen-bridge.js`).
12
+ - Fonctions pures exportées (`normalizeAppPath`, `stripSensitive`, `coreSubpath`, `buildCoreUrl`, `buildEmbedSrc`…). Paramètres sensibles jamais recopiés dans l'URL du Core.
13
+ - Sans l'option `navigation`, comportement inchangé.
14
+
3
15
  ## 0.2.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -69,3 +69,16 @@ App → Shell : `ready`, `navigate { to }`, `resize { height }`, `title { title
69
69
  - Les apps natives (Android/iOS) exigent un contenu embarqué : une iframe distante n'y est pas adaptée.
70
70
 
71
71
  Tests : `yarn test` (fenêtres simulées ; l'exécution inter-fenêtres dans un vrai navigateur reste à valider).
72
+
73
+ ## Navigation partagée (protocole 1.1)
74
+
75
+ L'URL du Core reflète la page courante de l'application embarquée : actualisation, retour/avance et liens partageables fonctionnent comme pour une app interne.
76
+
77
+ ```ts
78
+ getEmbedLifecycle({
79
+ moduleName, featureName, url,
80
+ navigation: { route: 'mon-app', mode: 'history' /* | 'hash' | 'none' */, sensitiveParams: ['invite'] },
81
+ });
82
+ ```
83
+
84
+ Côté application : soit le script injectable `assets/egen-bridge.js` (`<script src="/egen-bridge.js" defer data-mode="history">`), soit le client (`bridge.reportLocation(path)`, `bridge.onGoto(fn)`). Sans l'option `navigation`, rien ne change. Détails, sécurité et exemples : `docs/integration-apps/16-navigation-partagee-apps-externes.md` du dépôt Core.
package/dist/client.d.ts CHANGED
@@ -23,6 +23,13 @@ export interface EgenBridge {
23
23
  setHeight(height: number): void;
24
24
  /** Annonce un titre accessible pour l'iframe. */
25
25
  setTitle(title: string): void;
26
+ /** Protocole 1.1 : annonce la page courante de l'application (`/chemin?q#h`) ; `replace` n'ajoute pas d'entrée d'historique. */
27
+ reportLocation(path: string, options?: {
28
+ replace?: boolean;
29
+ title?: string;
30
+ }): void;
31
+ /** Protocole 1.1 : le Shell demande d'aller à `path` (retour/avance, lien du Core) ; renvoie le désabonnement. */
32
+ onGoto(listener: (path: string) => void): () => void;
26
33
  /** Annonce automatiquement la hauteur du document (ResizeObserver). */
27
34
  autoResize(): () => void;
28
35
  destroy(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAoB,KAAK,SAAS,EAAsC,MAAM,eAAe,CAAC;AAErG,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1B,mDAAmD;IACnD,QAAQ,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B,6EAA6E;IAC7E,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACrE,2EAA2E;I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E;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACpF,kHAAkH;IAClH,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACrD,uEAAuE;IACvE,UAAU,IAAI,MAAM,IAAI,CAAC;IACzB,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,UAAU,CAsEpE"}
package/dist/client.js CHANGED
@@ -65,6 +65,7 @@ export function createEgenBridge(opts) {
65
65
  if (host === window) throw new Error("createEgenBridge doit s'exécuter dans une iframe affichée par le Shell EGEN.");
66
66
  var state = {};
67
67
  var listeners = new Set();
68
+ var gotoListeners = new Set();
68
69
  var resolveReady;
69
70
  var ready = new Promise(function(r) {
70
71
  return resolveReady = r;
@@ -90,6 +91,18 @@ export function createEgenBridge(opts) {
90
91
  session: msg.session
91
92
  });
92
93
  emit();
94
+ } else if (msg.kind === 'hello') {
95
+ send({
96
+ kind: 'ready',
97
+ caps: [
98
+ 'location',
99
+ 'goto'
100
+ ]
101
+ });
102
+ } else if (msg.kind === 'goto') {
103
+ gotoListeners.forEach(function(l) {
104
+ return l(msg.path);
105
+ });
93
106
  } else if (msg.kind === 'locale') {
94
107
  state = _object_spread_props(_object_spread({}, state), {
95
108
  locale: msg.locale
@@ -107,13 +120,31 @@ export function createEgenBridge(opts) {
107
120
  });
108
121
  };
109
122
  send({
110
- kind: 'ready'
123
+ kind: 'ready',
124
+ caps: [
125
+ 'location',
126
+ 'goto'
127
+ ]
111
128
  });
112
129
  return {
113
130
  ready: ready,
114
131
  getState: function getState() {
115
132
  return state;
116
133
  },
134
+ reportLocation: function reportLocation(path, o) {
135
+ return send({
136
+ kind: 'location',
137
+ path: path,
138
+ replace: o === null || o === void 0 ? void 0 : o.replace,
139
+ title: o === null || o === void 0 ? void 0 : o.title
140
+ });
141
+ },
142
+ onGoto: function onGoto(l) {
143
+ gotoListeners.add(l);
144
+ return function() {
145
+ return gotoListeners.delete(l);
146
+ };
147
+ },
117
148
  subscribe: function subscribe(l) {
118
149
  listeners.add(l);
119
150
  return function() {
package/dist/host.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { LifeCycles } from 'single-spa';
2
2
  import { type LifecycleExport, type LifecycleOptions } from '@egen-civitas/esm-integration-utils';
3
+ import { type NavigationOptions } from './navigation.js';
3
4
  export interface EmbedLifecycleOptions extends LifecycleOptions {
4
5
  /** URL de l'application embarquée (ou fonction des props Single-SPA). */
5
6
  url: string | ((props: Record<string, any>) => string);
@@ -15,6 +16,11 @@ export interface EmbedLifecycleOptions extends LifecycleOptions {
15
16
  minHeight?: number;
16
17
  /** Navigation demandée par l'application (défaut : `singleSpaNavigate(spaBase + chemin)`). */
17
18
  onNavigate?: (to: string) => void;
19
+ /**
20
+ * Navigation partagée (protocole 1.1) : l'URL du Core reflète la page courante de l'application et inversement
21
+ * (actualisation, retour/avance, lien partageable). Absent ou `mode: 'none'` : comportement opaque d'origine.
22
+ */
23
+ navigation?: NavigationOptions;
18
24
  }
19
25
  /** Chemin relatif interne uniquement (`/x`), jamais d'URL absolue ni `//hôte`. */
20
26
  export declare function isSafeInternalPath(to: unknown): to is string;
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,gBAAgB,EAEtB,MAAM,qCAAqC,CAAC;AAG7C,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D,yEAAyE;IACzE,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,CAAC,CAAC;IACvD,wFAAwF;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M,CAAC;IACf,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC;AAKD,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,MAAM,CAE5D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,UAAU,CAqJ7E;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,CAEhF"}
package/dist/host.js CHANGED
@@ -1,4 +1,57 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _object_spread(target) {
15
+ for(var i = 1; i < arguments.length; i++){
16
+ var source = arguments[i] != null ? arguments[i] : {};
17
+ var ownKeys = Object.keys(source);
18
+ if (typeof Object.getOwnPropertySymbols === "function") {
19
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
+ }));
22
+ }
23
+ ownKeys.forEach(function(key) {
24
+ _define_property(target, key, source[key]);
25
+ });
26
+ }
27
+ return target;
28
+ }
29
+ function ownKeys(object, enumerableOnly) {
30
+ var keys = Object.keys(object);
31
+ if (Object.getOwnPropertySymbols) {
32
+ var symbols = Object.getOwnPropertySymbols(object);
33
+ if (enumerableOnly) {
34
+ symbols = symbols.filter(function(sym) {
35
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
36
+ });
37
+ }
38
+ keys.push.apply(keys, symbols);
39
+ }
40
+ return keys;
41
+ }
42
+ function _object_spread_props(target, source) {
43
+ source = source != null ? source : {};
44
+ if (Object.getOwnPropertyDescriptors) {
45
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
46
+ } else {
47
+ ownKeys(Object(source)).forEach(function(key) {
48
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
49
+ });
50
+ }
51
+ return target;
52
+ }
1
53
  import { assertLifecycleOptions, resolveMountTarget, toLifecycleExport, watchSession, watchTranslations } from '@egen-civitas/esm-integration-utils';
54
+ import { buildCoreUrl, buildEmbedSrc, coreSubpath, createRateLimiter, stripSensitive, toAppPath, toCorePath } from './navigation.js';
2
55
  import { DEFAULT_SESSION_FIELDS, isEnvelope, pickFields, wrap } from './protocol.js';
3
56
  var DEFAULT_SANDBOX = 'allow-scripts allow-same-origin allow-forms allow-popups';
4
57
  var SAFE_PATH = /^\/(?!\/)[^\s\\]*$/;
@@ -22,9 +75,27 @@ var SAFE_PATH = /^\/(?!\/)[^\s\\]*$/;
22
75
  return Promise.resolve();
23
76
  },
24
77
  mount: function mount(props) {
25
- var _opts_allowedOrigin, _opts_sandbox, _opts_title, _opts_minHeight;
78
+ var _opts_navigation_mode, _opts_navigation_mode1, _currentCorePath, _toAppPath, _opts_allowedOrigin, _opts_sandbox, _opts_title, _opts_minHeight;
26
79
  var target = resolveMountTarget(props);
27
- var src = typeof opts.url === 'function' ? opts.url(props) : opts.url;
80
+ var baseUrl = typeof opts.url === 'function' ? opts.url(props) : opts.url;
81
+ var nav = opts.navigation && ((_opts_navigation_mode = opts.navigation.mode) !== null && _opts_navigation_mode !== void 0 ? _opts_navigation_mode : 'history') !== 'none' ? _object_spread_props(_object_spread({}, opts.navigation), {
82
+ mode: (_opts_navigation_mode1 = opts.navigation.mode) !== null && _opts_navigation_mode1 !== void 0 ? _opts_navigation_mode1 : 'history'
83
+ }) : undefined;
84
+ var spaBase = function spaBase() {
85
+ var _ref;
86
+ var _window_getEgenSpaBase, _window;
87
+ return (_ref = (_window_getEgenSpaBase = (_window = window).getEgenSpaBase) === null || _window_getEgenSpaBase === void 0 ? void 0 : _window_getEgenSpaBase.call(_window)) !== null && _ref !== void 0 ? _ref : '/';
88
+ };
89
+ /** Page courante du Core, en chemin (`/x?q#h`) relatif à la route de l'application ; `null` hors de cette page. */ var currentCorePath = function currentCorePath() {
90
+ if (!nav) return null;
91
+ var sub = coreSubpath(window.location.pathname, spaBase(), nav.route);
92
+ if (sub === null) return null;
93
+ var raw = sub + window.location.search + window.location.hash;
94
+ return stripSensitive(raw, nav.sensitiveParams);
95
+ };
96
+ var lastCorePath = (_currentCorePath = currentCorePath()) !== null && _currentCorePath !== void 0 ? _currentCorePath : '/';
97
+ var initialAppPath = nav ? (_toAppPath = toAppPath(lastCorePath, nav)) !== null && _toAppPath !== void 0 ? _toAppPath : '/' : '/';
98
+ var src = nav ? buildEmbedSrc(baseUrl, initialAppPath, nav.mode) : baseUrl;
28
99
  var origin = (_opts_allowedOrigin = opts.allowedOrigin) !== null && _opts_allowedOrigin !== void 0 ? _opts_allowedOrigin : new URL(src, window.location.href).origin;
29
100
  if (origin === '*' || origin === 'null') throw new Error('allowedOrigin invalide : une origine explicite est requise.');
30
101
  var sandbox = (_opts_sandbox = opts.sandbox) !== null && _opts_sandbox !== void 0 ? _opts_sandbox : DEFAULT_SANDBOX;
@@ -44,6 +115,9 @@ var SAFE_PATH = /^\/(?!\/)[^\s\\]*$/;
44
115
  var stop = [];
45
116
  var ready = false;
46
117
  var lastSession;
118
+ var bridgeSeen = false;
119
+ var seq = 0;
120
+ var allowLocation = createRateLimiter();
47
121
  var onMessage = function onMessage(event) {
48
122
  if (event.source !== iframe.contentWindow || event.origin !== origin) return;
49
123
  if (!isEnvelope(event.data, opts.moduleName)) return;
@@ -53,13 +127,18 @@ var SAFE_PATH = /^\/(?!\/)[^\s\\]*$/;
53
127
  var _ref;
54
128
  var _window_i18next, _window_getEgenSpaBase, _window;
55
129
  ready = true;
130
+ bridgeSeen = true;
56
131
  send({
57
132
  kind: 'init',
58
133
  payload: {
59
134
  moduleName: opts.moduleName,
60
135
  locale: (_window_i18next = window.i18next) === null || _window_i18next === void 0 ? void 0 : _window_i18next.language,
61
136
  spaBase: (_ref = (_window_getEgenSpaBase = (_window = window).getEgenSpaBase) === null || _window_getEgenSpaBase === void 0 ? void 0 : _window_getEgenSpaBase.call(_window)) !== null && _ref !== void 0 ? _ref : '/',
62
- session: lastSession
137
+ session: lastSession,
138
+ navigation: nav ? {
139
+ mode: nav.mode,
140
+ route: nav.route
141
+ } : undefined
63
142
  }
64
143
  });
65
144
  break;
@@ -79,12 +158,61 @@ var SAFE_PATH = /^\/(?!\/)[^\s\\]*$/;
79
158
  case 'title':
80
159
  if (typeof msg.title === 'string') iframe.title = msg.title.slice(0, 200);
81
160
  break;
161
+ case 'location':
162
+ {
163
+ if (!nav || !allowLocation()) break;
164
+ bridgeSeen = true;
165
+ if (typeof msg.title === 'string') {
166
+ var _nav_onTitle;
167
+ iframe.title = msg.title.slice(0, 200);
168
+ (_nav_onTitle = nav.onTitle) === null || _nav_onTitle === void 0 ? void 0 : _nav_onTitle.call(nav, iframe.title);
169
+ }
170
+ var corePath = toCorePath(msg.path, nav);
171
+ if (!corePath || corePath === lastCorePath) break;
172
+ lastCorePath = corePath;
173
+ var url = buildCoreUrl(spaBase(), nav.route, corePath);
174
+ // History API (surchargée par Single-SPA) : la page reste active (la route correspond toujours), sans remontage.
175
+ window.history[msg.replace ? 'replaceState' : 'pushState'](window.history.state, '', url);
176
+ break;
177
+ }
82
178
  }
83
179
  };
84
180
  window.addEventListener('message', onMessage);
85
181
  stop.push(function() {
86
182
  return window.removeEventListener('message', onMessage);
87
183
  });
184
+ if (nav) {
185
+ // poignée de main à chaque chargement de l'iframe (le script injectable n'a pas besoin de connaître l'origine du Shell)
186
+ var onLoad = function onLoad() {
187
+ return send({
188
+ kind: 'hello'
189
+ });
190
+ };
191
+ iframe.addEventListener('load', onLoad);
192
+ stop.push(function() {
193
+ return iframe.removeEventListener('load', onLoad);
194
+ });
195
+ // URL du Core modifiée hors de l'application (retour/avance, lien) → l'application suit
196
+ var onCoreLocation = function onCoreLocation() {
197
+ var cur = currentCorePath();
198
+ if (cur === null || cur === lastCorePath) return;
199
+ lastCorePath = cur;
200
+ var appPath = toAppPath(cur, nav);
201
+ if (!appPath) return;
202
+ if (bridgeSeen) send({
203
+ kind: 'goto',
204
+ path: appPath,
205
+ seq: ++seq
206
+ });
207
+ else iframe.src = buildEmbedSrc(baseUrl, appPath, nav.mode);
208
+ };
209
+ window.addEventListener('single-spa:routing-event', onCoreLocation);
210
+ window.addEventListener('popstate', onCoreLocation);
211
+ stop.push(function() {
212
+ window.removeEventListener('single-spa:routing-event', onCoreLocation);
213
+ window.removeEventListener('popstate', onCoreLocation);
214
+ });
215
+ }
88
216
  stop.push(watchSession(function(session) {
89
217
  lastSession = pickFields(session, fields);
90
218
  if (ready) send({
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './host.js';
2
+ export * from './navigation.js';
2
3
  export * from './protocol.js';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './host.js';
2
+ export * from './navigation.js';
2
3
  export * from './protocol.js';