valtech-components 4.0.993 → 4.0.994
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/esm2022/lib/services/auth/org-switch.service.mjs +38 -1
- package/esm2022/lib/version.mjs +2 -2
- package/fesm2022/valtech-components.mjs +38 -1
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/services/auth/org-switch.service.d.ts +28 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -91,6 +91,14 @@ export declare class OrgSwitchService {
|
|
|
91
91
|
private readonly _switching;
|
|
92
92
|
private readonly _orgChanged;
|
|
93
93
|
private readonly _orgDataUpdated;
|
|
94
|
+
/**
|
|
95
|
+
* Navegador a "home" registrado por el shell de la app (opcional — ver
|
|
96
|
+
* `registerHomeNavigator`). Si existe, `switchTo` lo AWAIT-ea antes de
|
|
97
|
+
* emitir `orgChanged$`, así el shell termina de navegar (y destruye la
|
|
98
|
+
* vista de detalle vieja) antes de que cualquier página con
|
|
99
|
+
* `connectPageRefresh` reaccione al cambio de org.
|
|
100
|
+
*/
|
|
101
|
+
private homeNavigator;
|
|
94
102
|
/**
|
|
95
103
|
* `true` while a switch is in flight. UI should disable interactions
|
|
96
104
|
* with org-scoped data and show a loading indicator.
|
|
@@ -111,6 +119,26 @@ export declare class OrgSwitchService {
|
|
|
111
119
|
readonly orgDataUpdated$: Observable<Organization>;
|
|
112
120
|
/** Notify subscribers that the active org's data was updated. */
|
|
113
121
|
notifyOrgDataUpdated(org: Organization): void;
|
|
122
|
+
/**
|
|
123
|
+
* Registra la función que lleva a "home" tras un cambio de org (FE-7,
|
|
124
|
+
* `TODO.md`). Llamar UNA vez en el constructor del shell raíz de la app
|
|
125
|
+
* (ej. `AppLayoutPage`), reemplazando cualquier `orgChanged$.subscribe(() =>
|
|
126
|
+
* router.navigateByUrl(...))` manual que la app tuviera antes — ese patrón
|
|
127
|
+
* es exactamente el bug: `navigateByUrl` sin `await` deja que otro
|
|
128
|
+
* subscriber del mismo evento (`connectPageRefresh` de una página de
|
|
129
|
+
* detalle) dispare su refetch ANTES de que la navegación reemplace el
|
|
130
|
+
* componente, y por un instante se ve el estado vacío de la org anterior.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* constructor() {
|
|
135
|
+
* this.orgSwitch.registerHomeNavigator(() =>
|
|
136
|
+
* this.router.navigateByUrl('/app/home', { replaceUrl: true }).then(() => {})
|
|
137
|
+
* );
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
registerHomeNavigator(fn: () => Promise<void>): void;
|
|
114
142
|
constructor(auth: AuthService);
|
|
115
143
|
/**
|
|
116
144
|
* Switch the user's active organization.
|
package/lib/version.d.ts
CHANGED