@ama-mfe/ng-utils 14.5.0-prerelease.9 → 14.5.0-rc.2
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/README.md +42 -0
- package/fesm2022/ama-mfe-ng-utils.mjs +690 -127
- package/fesm2022/ama-mfe-ng-utils.mjs.map +1 -1
- package/migration.json +10 -0
- package/package.json +13 -10
- package/schematics/ng-update/v14-5/index.d.ts +8 -0
- package/schematics/ng-update/v14-5/index.d.ts.map +1 -0
- package/schematics/ng-update/v14-5/index.js +64 -0
- package/schematics/ng-update/v14-5/index.js.map +1 -0
- package/types/ama-mfe-ng-utils.d.ts +425 -47
- package/types/ama-mfe-ng-utils.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ interaction between host and embedded applications.
|
|
|
8
8
|
Key features include:
|
|
9
9
|
- [Connect](https://github.com/AmadeusITGroup/otter/blob/main/packages/%40ama-mfe/ng-utils/src/connect/): Connect to the communication protocol and send messages to registered applications.
|
|
10
10
|
- [Navigation](https://github.com/AmadeusITGroup/otter/blob/main/packages/%40ama-mfe/ng-utils/src/navigation/): Handles navigation messages between the host and embedded applications. Embedded applications can use `RoutingService` to sync their internal routing with the host application. The host application can use `NavigationConsumerService` to get notifications about navigation events in the embedded applications.
|
|
11
|
+
- [Navigation Exit](https://github.com/AmadeusITGroup/otter/blob/main/packages/%40ama-mfe/ng-utils/src/navigation/navigation-exit/): Negotiates navigation when an embedded module holds unsaved work. Modules report their block state, and either side asks for confirmation before navigation proceeds.
|
|
11
12
|
- [Theme](https://github.com/AmadeusITGroup/otter/blob/main/packages/%40ama-mfe/ng-utils/src/theme/): Allows the application of unified CSS variables and styles across embedded modules, ensuring a cohesive
|
|
12
13
|
look and feel.
|
|
13
14
|
- [Resize](https://github.com/AmadeusITGroup/otter/blob/main/packages/%40ama-mfe/ng-utils/src/resize/): Dynamically adjusts the iframe dimensions to fit the content of the embedded application, enhancing the
|
|
@@ -156,6 +157,7 @@ There is no standardization on the name of the methods used to trigger a message
|
|
|
156
157
|
#### Services provided in @ama-mfe/ng-utils
|
|
157
158
|
You will find more information for each service in their respective `README.md`:
|
|
158
159
|
- [Navigation](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-mfe/ng-utils/src/navigation/README.md)
|
|
160
|
+
- [Navigation Exit](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-mfe/ng-utils/src/navigation/navigation-exit/README.md)
|
|
159
161
|
- [Resize](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-mfe/ng-utils/src/resize/README.md)
|
|
160
162
|
- [Theme](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-mfe/ng-utils/src/theme/README.md)
|
|
161
163
|
- [User Activity](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-mfe/ng-utils/src/user-activity/README.md)
|
|
@@ -245,6 +247,40 @@ export class CustomConsumerService implements MessageConsumer<CustomMessageVersi
|
|
|
245
247
|
}
|
|
246
248
|
```
|
|
247
249
|
|
|
250
|
+
##### Using `AbstractMessageConsumer`
|
|
251
|
+
As a shortcut, custom consumers can extend `AbstractMessageConsumer`, which already injects the `ConsumerManagerService`,
|
|
252
|
+
provides default `start`/`stop` implementations, and unregisters automatically when the host injection context is destroyed.
|
|
253
|
+
|
|
254
|
+
The consumer is **not** started automatically: define it without a constructor and let the application start it
|
|
255
|
+
explicitly (typically via `provideAppInitializer`), exactly like the other consumers above.
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
@Injectable({ providedIn: 'root' })
|
|
259
|
+
export class CustomConsumerService extends AbstractMessageConsumer<CustomMessageVersions> {
|
|
260
|
+
public readonly type = 'custom';
|
|
261
|
+
public readonly supportedVersions = {
|
|
262
|
+
'1.0': (message: RoutedMessage<CustomMessageV1_0>) => { /* ... */ }
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
// app.config.ts
|
|
269
|
+
import {inject, provideAppInitializer} from '@angular/core';
|
|
270
|
+
import {CustomConsumerService} from './custom-consumer.service';
|
|
271
|
+
|
|
272
|
+
export const appConfig: ApplicationConfig = {
|
|
273
|
+
providers: [
|
|
274
|
+
provideAppInitializer(() => { inject(CustomConsumerService).start(); })
|
|
275
|
+
]
|
|
276
|
+
};
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
> **Note:** consumers shipped by `@ama-mfe/ng-utils` (e.g. `NavigationConsumerService`, `ThemeConsumerService`,
|
|
280
|
+
> `HistoryConsumerService`, `ResizeConsumerService`) still auto-start from their constructor for backwards
|
|
281
|
+
> compatibility, but this is **deprecated** and will be removed in v15. Start them explicitly from your
|
|
282
|
+
> application configuration instead. The `migration-v14_5` schematic wires the `start()` calls for you on `ng update`.
|
|
283
|
+
|
|
248
284
|
#### Producer
|
|
249
285
|
A producer should implement the `MessageProducer` interface and inject the `ProducerManagerService` which handles the
|
|
250
286
|
registration to the communication protocol.
|
|
@@ -366,3 +402,9 @@ To avoid this, the `@ama-mfe/ng-utils` will forbid the application running in th
|
|
|
366
402
|
The User Activity Tracking feature allows a host application (shell) to monitor user interactions across embedded micro-frontends. This is useful for implementing session timeout functionality, analytics, or any feature that needs to know when users are actively interacting with the application.
|
|
367
403
|
|
|
368
404
|
For detailed documentation, configuration options, and examples, see the [User Activity README](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-mfe/ng-utils/src/user-activity/README.md).
|
|
405
|
+
|
|
406
|
+
### Navigation Exit
|
|
407
|
+
|
|
408
|
+
The Navigation Exit feature negotiates navigation when an embedded module holds unfinished work (e.g. a dirty form). Both shell- and module-initiated navigations are covered, with the shell owning the confirmation UI and modules running any cleanup the shell asks for before the navigation proceeds.
|
|
409
|
+
|
|
410
|
+
For the full message contract, services, guards, flows, and integration steps, see the [Navigation Exit README](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-mfe/ng-utils/src/navigation/navigation-exit/README.md).
|