@ama-mfe/ng-utils 13.0.0-next.3 → 13.0.0-next.31

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 (83) hide show
  1. package/fesm2022/ama-mfe-ng-utils.mjs +45 -45
  2. package/fesm2022/ama-mfe-ng-utils.mjs.map +1 -1
  3. package/index.d.ts +736 -4
  4. package/index.d.ts.map +1 -0
  5. package/package.json +13 -13
  6. package/schematics/ng-add/schema.json +3 -2
  7. package/ama-mfe-ng-utils.d.ts.map +0 -1
  8. package/connect/connect.directive.d.ts +0 -24
  9. package/connect/connect.directive.d.ts.map +0 -1
  10. package/connect/connect.providers.d.ts +0 -15
  11. package/connect/connect.providers.d.ts.map +0 -1
  12. package/connect/connect.resources.d.ts +0 -3
  13. package/connect/connect.resources.d.ts.map +0 -1
  14. package/connect/index.d.ts +0 -4
  15. package/connect/index.d.ts.map +0 -1
  16. package/history/history.providers.d.ts +0 -13
  17. package/history/history.providers.d.ts.map +0 -1
  18. package/history/index.d.ts +0 -2
  19. package/history/index.d.ts.map +0 -1
  20. package/host-info/host-info.d.ts +0 -48
  21. package/host-info/host-info.d.ts.map +0 -1
  22. package/host-info/host-info.pipe.d.ts +0 -30
  23. package/host-info/host-info.pipe.d.ts.map +0 -1
  24. package/host-info/index.d.ts +0 -3
  25. package/host-info/index.d.ts.map +0 -1
  26. package/managers/consumer.manager.service.d.ts +0 -36
  27. package/managers/consumer.manager.service.d.ts.map +0 -1
  28. package/managers/index.d.ts +0 -5
  29. package/managers/index.d.ts.map +0 -1
  30. package/managers/interfaces.d.ts +0 -49
  31. package/managers/interfaces.d.ts.map +0 -1
  32. package/managers/producer.manager.service.d.ts +0 -29
  33. package/managers/producer.manager.service.d.ts.map +0 -1
  34. package/managers/utils.d.ts +0 -14
  35. package/managers/utils.d.ts.map +0 -1
  36. package/messages/available.sender.d.ts +0 -15
  37. package/messages/available.sender.d.ts.map +0 -1
  38. package/messages/error/base.d.ts +0 -18
  39. package/messages/error/base.d.ts.map +0 -1
  40. package/messages/error/error.versions.d.ts +0 -10
  41. package/messages/error/error.versions.d.ts.map +0 -1
  42. package/messages/error/index.d.ts +0 -6
  43. package/messages/error/index.d.ts.map +0 -1
  44. package/messages/error.sender.d.ts +0 -17
  45. package/messages/error.sender.d.ts.map +0 -1
  46. package/messages/index.d.ts +0 -4
  47. package/messages/index.d.ts.map +0 -1
  48. package/navigation/index.d.ts +0 -5
  49. package/navigation/index.d.ts.map +0 -1
  50. package/navigation/navigation.consumer.service.d.ts +0 -60
  51. package/navigation/navigation.consumer.service.d.ts.map +0 -1
  52. package/navigation/restore-route.pipe.d.ts +0 -44
  53. package/navigation/restore-route.pipe.d.ts.map +0 -1
  54. package/navigation/route-memorize/index.d.ts +0 -3
  55. package/navigation/route-memorize/index.d.ts.map +0 -1
  56. package/navigation/route-memorize/route-memorize.directive.d.ts +0 -31
  57. package/navigation/route-memorize/route-memorize.directive.d.ts.map +0 -1
  58. package/navigation/route-memorize/route-memorize.service.d.ts +0 -27
  59. package/navigation/route-memorize/route-memorize.service.d.ts.map +0 -1
  60. package/navigation/routing.service.d.ts +0 -64
  61. package/navigation/routing.service.d.ts.map +0 -1
  62. package/public_api.d.ts +0 -9
  63. package/public_api.d.ts.map +0 -1
  64. package/resize/index.d.ts +0 -4
  65. package/resize/index.d.ts.map +0 -1
  66. package/resize/resize.consumer.service.d.ts +0 -44
  67. package/resize/resize.consumer.service.d.ts.map +0 -1
  68. package/resize/resize.directive.d.ts +0 -24
  69. package/resize/resize.directive.d.ts.map +0 -1
  70. package/resize/resize.producer.service.d.ts +0 -30
  71. package/resize/resize.producer.service.d.ts.map +0 -1
  72. package/theme/apply-theme.pipe.d.ts +0 -21
  73. package/theme/apply-theme.pipe.d.ts.map +0 -1
  74. package/theme/index.d.ts +0 -5
  75. package/theme/index.d.ts.map +0 -1
  76. package/theme/theme.consumer.service.d.ts +0 -38
  77. package/theme/theme.consumer.service.d.ts.map +0 -1
  78. package/theme/theme.helpers.d.ts +0 -40
  79. package/theme/theme.helpers.d.ts.map +0 -1
  80. package/theme/theme.producer.service.d.ts +0 -37
  81. package/theme/theme.producer.service.d.ts.map +0 -1
  82. package/utils.d.ts +0 -18
  83. package/utils.d.ts.map +0 -1
package/index.d.ts CHANGED
@@ -1,6 +1,738 @@
1
+ import * as i0 from '@angular/core';
2
+ import { PipeTransform } from '@angular/core';
3
+ import { VersionedMessage, RoutedMessage, PeerConnectionOptions } from '@amadeus-it-group/microfrontends';
4
+ import { MessagePeerServiceType, MessagePeerConfig } from '@amadeus-it-group/microfrontends-angular';
5
+ export { MessagePeerConfig as ConnectionConfig, MessagePeerService as ConnectionService } from '@amadeus-it-group/microfrontends-angular';
6
+ import { ResizeMessage, ResizeV1_0, NavigationMessage, NavigationV1_0, ThemeMessage, ThemeV1_0, ThemeStructure } from '@ama-mfe/messages';
7
+ import * as rxjs from 'rxjs';
8
+ import { SafeResourceUrl } from '@angular/platform-browser';
9
+ import { Logger } from '@o3r/logger';
10
+
11
+ /** the error message type */
12
+ declare const ERROR_MESSAGE_TYPE = "error";
1
13
  /**
2
- * Generated bundle index. Do not edit.
14
+ * The possible reasons for an error.
3
15
  */
4
- /// <amd-module name="@ama-mfe/ng-utils" />
5
- export * from './public_api';
6
- //# sourceMappingURL=ama-mfe-ng-utils.d.ts.map
16
+ type ErrorReason = 'unknown_type' | 'version_mismatch' | 'internal_error';
17
+ /**
18
+ * The content of an error message.
19
+ * @template S - The type of the source message.
20
+ */
21
+ interface ErrorContent<S extends VersionedMessage = VersionedMessage> {
22
+ /** The reason for the error */
23
+ reason: ErrorReason;
24
+ /** The source message that caused the error */
25
+ source: S;
26
+ }
27
+
28
+ /** An error message with the version 1.0 */
29
+ interface ErrorMessageV1_0<S extends VersionedMessage = VersionedMessage> extends VersionedMessage, ErrorContent<S> {
30
+ /** @inheritdoc */
31
+ type: 'error';
32
+ /** @inheritdoc */
33
+ version: '1.0';
34
+ }
35
+
36
+ /** The versions available for error messages */
37
+ type ErrorMessage = ErrorMessageV1_0;
38
+
39
+ /**
40
+ * Helper function to send an error message by the given endpoint (peer)
41
+ * @param peer The endpoint sending the message
42
+ * @param content the content of the error message to be sent
43
+ */
44
+ declare const sendError: (peer: MessagePeerServiceType<any>, content: ErrorContent) => void;
45
+ /**
46
+ * Check if the given message is of type error and the error reson is present too
47
+ * @param message the message to be checked
48
+ */
49
+ declare const isErrorMessage: (message: any) => message is VersionedMessage & {
50
+ type: typeof ERROR_MESSAGE_TYPE;
51
+ } & ErrorContent;
52
+
53
+ /**
54
+ * Gets the available consumers and formats them into a {@see DeclareMessages} object.
55
+ * @param consumers - The list of registered message consumers.
56
+ * @returns The formatted DeclareMessages object.
57
+ */
58
+ declare const getAvailableConsumers: (consumers: BasicMessageConsumer[]) => {
59
+ type: "declare_messages";
60
+ version: "1.0";
61
+ messages: {
62
+ type: string;
63
+ version: string;
64
+ }[];
65
+ };
66
+
67
+ /**
68
+ * Use the message payload to execute an action based on message type
69
+ * @param message message to consume
70
+ */
71
+ type MessageCallback<T extends VersionedMessage> = (message: RoutedMessage<T>) => void | Promise<void>;
72
+ /**
73
+ * Description of the accepted messages versions and their callbacks for a given message type
74
+ */
75
+ interface MessageVersions<T extends VersionedMessage> {
76
+ /** The message callback coresponding to the version */
77
+ [version: string]: MessageCallback<T>;
78
+ }
79
+ /** Description for the base message consumer */
80
+ interface BasicMessageConsumer<T extends VersionedMessage = VersionedMessage> {
81
+ /** Contains the message type */
82
+ type: T['type'];
83
+ /** A map of messages versions and their callbacks */
84
+ supportedVersions: Record<string, MessageCallback<any>>;
85
+ }
86
+ /** The consumer of a given message type */
87
+ interface MessageConsumer<T extends VersionedMessage = VersionedMessage> extends BasicMessageConsumer {
88
+ /** The message type which will be handled */
89
+ type: T['type'];
90
+ /** The map of functions which will be executed for each supported version */
91
+ supportedVersions: {
92
+ [V in T['version']]: MessageCallback<T & {
93
+ version: V;
94
+ }>;
95
+ };
96
+ /** Prepare the registration of the consumer */
97
+ start(): void;
98
+ /** Unregister the consumer */
99
+ stop(): void;
100
+ }
101
+ /**
102
+ * Definition of a message producer and which types of messages are produced
103
+ */
104
+ interface MessageProducer<T extends VersionedMessage = VersionedMessage> {
105
+ /** The types of the produced message */
106
+ types: T['type'] | T['type'][];
107
+ /**
108
+ * The producer should handle an error in case that it has produced a message which cannot be consumed by other peers
109
+ * @param message the error message received from a peer when the message sent previously has raised an error
110
+ */
111
+ handleError(message: ErrorContent<T>): void | Promise<void>;
112
+ }
113
+
114
+ declare class ConsumerManagerService {
115
+ private readonly messageService;
116
+ private readonly producerManagerService;
117
+ private readonly registeredConsumers;
118
+ private readonly logger;
119
+ /** The list of registered consumers */
120
+ readonly consumers: i0.Signal<BasicMessageConsumer<VersionedMessage>[]>;
121
+ constructor();
122
+ /**
123
+ * Consume a received message
124
+ * @param message the received message body
125
+ */
126
+ private consumeMessage;
127
+ /**
128
+ * Call the registered message callback(s) to consume the given message
129
+ * Handle error messages of internal communication protocol messages
130
+ * @param message message to consume
131
+ */
132
+ private consumeAdditionalMessage;
133
+ /**
134
+ * Register a message consumer
135
+ * @param consumer an instance of message consumer
136
+ */
137
+ register(consumer: BasicMessageConsumer): void;
138
+ /**
139
+ * Unregister a message consumer
140
+ * @param consumer an instance of message consumer
141
+ */
142
+ unregister(consumer: BasicMessageConsumer): void;
143
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConsumerManagerService, never>;
144
+ static ɵprov: i0.ɵɵInjectableDeclaration<ConsumerManagerService>;
145
+ }
146
+
147
+ declare class ProducerManagerService {
148
+ private readonly registeredProducers;
149
+ /** Get the list of registered producers of messages. The list will contain unique elements */
150
+ get producers(): MessageProducer<VersionedMessage>[];
151
+ /**
152
+ * Register a producer of a message
153
+ * @param producer The instance of the message producer
154
+ */
155
+ register(producer: MessageProducer): void;
156
+ /**
157
+ * Unregister a producer of a message
158
+ * @param producer The instance of the message producer
159
+ */
160
+ unregister(producer: MessageProducer): void;
161
+ /**
162
+ * Handles the received error message for the given message type by invoking the appropriate producer handlers.
163
+ * @template T - The type of the message, extending from Message.
164
+ * @param message - The error message to handle.
165
+ * @returns - A promise that resolves to true if the error was handled by at least one handler, false otherwise.
166
+ */
167
+ dispatchError<T extends VersionedMessage = VersionedMessage>(message: ErrorContent<T>): Promise<boolean>;
168
+ static ɵfac: i0.ɵɵFactoryDeclaration<ProducerManagerService, never>;
169
+ static ɵprov: i0.ɵɵInjectableDeclaration<ProducerManagerService>;
170
+ }
171
+
172
+ /**
173
+ * Method to call in the constructor of a producer
174
+ * @note should be used in injection context
175
+ * @param producer
176
+ */
177
+ declare const registerProducer: (producer: MessageProducer) => void;
178
+ /**
179
+ * Method to call in the constructor of a consumer
180
+ * @note should be used in injection context
181
+ * @param consumer
182
+ */
183
+ declare const registerConsumer: (consumer: MessageConsumer) => void;
184
+
185
+ /**
186
+ * This service listens for resize messages and updates the height of elements based on the received messages.
187
+ */
188
+ declare class ResizeConsumerService implements MessageConsumer<ResizeMessage> {
189
+ private readonly newHeight;
190
+ /**
191
+ * A readonly signal that provides the new height information from the channel.
192
+ */
193
+ readonly newHeightFromChannel: i0.Signal<{
194
+ height: number;
195
+ channelId: string;
196
+ } | undefined>;
197
+ /**
198
+ * The type of messages this service handles ('resize').
199
+ */
200
+ readonly type = "resize";
201
+ /**
202
+ * The supported versions of resize messages and their handlers.
203
+ */
204
+ supportedVersions: {
205
+ /**
206
+ * Use the message paylod to compute a new height and emit it via the public signal
207
+ * @param message message to consume
208
+ */
209
+ '1.0': (message: RoutedMessage<ResizeV1_0>) => void;
210
+ };
211
+ private readonly consumerManagerService;
212
+ constructor();
213
+ /**
214
+ * Starts the resize handler service by registering it into the consumer manager service.
215
+ */
216
+ start(): void;
217
+ /**
218
+ * Stops the resize handler service by unregistering it from the consumer manager service.
219
+ */
220
+ stop(): void;
221
+ static ɵfac: i0.ɵɵFactoryDeclaration<ResizeConsumerService, never>;
222
+ static ɵprov: i0.ɵɵInjectableDeclaration<ResizeConsumerService>;
223
+ }
224
+
225
+ /**
226
+ * This service observe changes in the document's body height.
227
+ * When the height changes, it sends a resize message with the new height, to the connected peers
228
+ */
229
+ declare class ResizeService implements MessageProducer<ResizeMessage> {
230
+ private actualHeight?;
231
+ private readonly messageService;
232
+ private resizeObserver?;
233
+ /**
234
+ * @inheritdoc
235
+ */
236
+ readonly types = "resize";
237
+ constructor();
238
+ /**
239
+ * @inheritdoc
240
+ */
241
+ handleError(message: ErrorContent<ResizeMessage>): void;
242
+ /**
243
+ * This method sets up a `ResizeObserver` to observe changes in the document's body height.
244
+ * When the height changes, it sends a resize message with the new height, to the connected peers
245
+ */
246
+ startResizeObserver(): void;
247
+ static ɵfac: i0.ɵɵFactoryDeclaration<ResizeService, never>;
248
+ static ɵprov: i0.ɵɵInjectableDeclaration<ResizeService>;
249
+ }
250
+
251
+ /**
252
+ * A directive that adjusts the height of an element based on resize messages from a specified channel.
253
+ */
254
+ declare class ScalableDirective {
255
+ /**
256
+ * The connection ID for the element, used as channel id backup
257
+ */
258
+ connect: i0.InputSignal<string | undefined>;
259
+ /**
260
+ * The channel id
261
+ */
262
+ scalable: i0.InputSignal<string | undefined>;
263
+ private readonly resizeHandler;
264
+ /**
265
+ * This signal checks if the current channel requesting the resize matches the channel ID from the resize handler.
266
+ * If they match, it returns the new height information; otherwise, it returns undefined.
267
+ */
268
+ private readonly newHeightFromChannel;
269
+ constructor();
270
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScalableDirective, never>;
271
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ScalableDirective, "[scalable]", never, { "connect": { "alias": "connect"; "required": false; "isSignal": true; }; "scalable": { "alias": "scalable"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
272
+ }
273
+
274
+ /**
275
+ * A service that handles navigation messages and routing.
276
+ *
277
+ * This service listens for navigation messages and updates the router state accordingly.
278
+ */
279
+ declare class NavigationConsumerService implements MessageConsumer<NavigationMessage> {
280
+ private readonly router;
281
+ private readonly activeRoute;
282
+ private readonly requestedUrl;
283
+ /**
284
+ * An observable that emits the requested URL and optional channel ID.
285
+ */
286
+ readonly requestedUrl$: rxjs.Observable<{
287
+ url: string;
288
+ channelId?: string;
289
+ }>;
290
+ /**
291
+ * The type of messages this service handles.
292
+ */
293
+ readonly type = "navigation";
294
+ /**
295
+ * @inheritdoc
296
+ */
297
+ readonly supportedVersions: {
298
+ /**
299
+ * Use the message paylod to compute a new url and emit it via the public subject
300
+ * Additionally navigate to the new url
301
+ * @param message message to consume
302
+ */
303
+ '1.0': (message: RoutedMessage<NavigationV1_0>) => void;
304
+ };
305
+ private readonly consumerManagerService;
306
+ constructor();
307
+ /**
308
+ * Parses a URL and returns an object containing the paths and query parameters.
309
+ * @param url - The URL to parse.
310
+ * @returns An object containing the paths and query parameters.
311
+ */
312
+ private parseUrl;
313
+ /**
314
+ * Navigates to the specified URL.
315
+ * @param url - The URL to navigate to.
316
+ */
317
+ private navigate;
318
+ /**
319
+ * @inheritdoc
320
+ */
321
+ start(): void;
322
+ /**
323
+ * @inheritdoc
324
+ */
325
+ stop(): void;
326
+ static ɵfac: i0.ɵɵFactoryDeclaration<NavigationConsumerService, never>;
327
+ static ɵprov: i0.ɵɵInjectableDeclaration<NavigationConsumerService>;
328
+ }
329
+
330
+ declare class RouteMemorizeDirective {
331
+ /**
332
+ * Whether to memorize the route.
333
+ * Default is true.
334
+ */
335
+ memorizeRoute: i0.InputSignal<boolean | "" | undefined>;
336
+ /**
337
+ * The ID used to memorize the route.
338
+ */
339
+ memorizeRouteId: i0.InputSignal<string | undefined>;
340
+ /**
341
+ * The maximum age for memorizing the route.
342
+ * Default is 0.
343
+ */
344
+ memorizeMaxAge: i0.InputSignal<number>;
345
+ /**
346
+ * The maximum age for memorizing the route, used as a fallback.
347
+ * Default is 0.
348
+ */
349
+ memorizeRouteMaxAge: i0.InputSignal<number>;
350
+ /**
351
+ * The connection ID for the iframe where the actual directive is applied.
352
+ */
353
+ connect: i0.InputSignal<string | undefined>;
354
+ private readonly maxAge;
355
+ constructor();
356
+ static ɵfac: i0.ɵɵFactoryDeclaration<RouteMemorizeDirective, never>;
357
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RouteMemorizeDirective, "iframe[memorizeRoute]", never, { "memorizeRoute": { "alias": "memorizeRoute"; "required": false; "isSignal": true; }; "memorizeRouteId": { "alias": "memorizeRouteId"; "required": false; "isSignal": true; }; "memorizeMaxAge": { "alias": "memorizeMaxAge"; "required": false; "isSignal": true; }; "memorizeRouteMaxAge": { "alias": "memorizeRouteMaxAge"; "required": false; "isSignal": true; }; "connect": { "alias": "connect"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
358
+ }
359
+
360
+ /**
361
+ * This service allows routes to be memorized with an optional lifetime and provides methods to retrieve and manage these routes.
362
+ */
363
+ declare class RouteMemorizeService {
364
+ private readonly routeTimers;
365
+ /** All memorized routes */
366
+ readonly routeStack: {
367
+ [x: string]: string;
368
+ };
369
+ /**
370
+ * Memorizes a route for a given channel ID with an optional lifetime.
371
+ * @param channelId - The ID of the channel to memorize the route for.
372
+ * @param url - The URL of the route to memorize.
373
+ * @param liveTime - The optional lifetime of the memorized route in milliseconds. If provided, the route will be removed after this time.
374
+ */
375
+ memorizeRoute(channelId: string, url: string, liveTime?: number): void;
376
+ /**
377
+ * Retrieves the memorized route for a given channel ID.
378
+ * @param channelId - The ID of the channel to retrieve the memorized route for.
379
+ * @returns The memorized route URL or undefined if no route is memorized for the given channel ID.
380
+ */
381
+ getRoute(channelId: string): string | undefined;
382
+ static ɵfac: i0.ɵɵFactoryDeclaration<RouteMemorizeService, never>;
383
+ static ɵprov: i0.ɵɵInjectableDeclaration<RouteMemorizeService>;
384
+ }
385
+
386
+ /** Options for the routing handling in case of navigation producer message */
387
+ interface RoutingServiceOptions {
388
+ /**
389
+ * Whether to handle only sub-routes.
390
+ * If true, the routing service will handle only sub-routes.
391
+ * Default is false.
392
+ */
393
+ subRouteOnly?: boolean;
394
+ }
395
+ /**
396
+ * A service that keeps in sync Router navigation and navigation messages.
397
+ *
398
+ * - listens to Router events and sends navigation messages
399
+ * - handles incoming navigation messages and triggers Router navigation
400
+ */
401
+ declare class RoutingService implements MessageProducer<NavigationMessage>, MessageConsumer<NavigationMessage> {
402
+ private readonly router;
403
+ private readonly activatedRoute;
404
+ private readonly messageService;
405
+ private readonly logger;
406
+ /**
407
+ * @inheritdoc
408
+ */
409
+ readonly types = "navigation";
410
+ /**
411
+ * @inheritdoc
412
+ */
413
+ readonly type = "navigation";
414
+ /**
415
+ * Use the message payload to navigate to the specified URL.
416
+ * @param message message to consume
417
+ */
418
+ readonly supportedVersions: {
419
+ '1.0': (message: RoutedMessage<any>) => Promise<void>;
420
+ };
421
+ constructor();
422
+ /**
423
+ * @inheritdoc
424
+ */
425
+ start(): void;
426
+ /**
427
+ * @inheritdoc
428
+ */
429
+ stop(): void;
430
+ /**
431
+ * @inheritdoc
432
+ */
433
+ handleError(message: ErrorContent<NavigationV1_0>): void;
434
+ /**
435
+ * Handles embedded routing by listening to router events and sending navigation messages to the connected endpoints.
436
+ * It can be a parent window or another iframe
437
+ * @note - This method has to be called in an injection context
438
+ * @param options - Optional parameters to control the routing behavior {@see RoutingServiceOptions}.
439
+ */
440
+ handleEmbeddedRouting(options?: RoutingServiceOptions): void;
441
+ static ɵfac: i0.ɵɵFactoryDeclaration<RoutingService, never>;
442
+ static ɵprov: i0.ɵɵInjectableDeclaration<RoutingService>;
443
+ }
444
+
445
+ /**
446
+ * Options for restoring a route with optional query parameters and memory channel ID.
447
+ */
448
+ interface RestoreRouteOptions {
449
+ /**
450
+ * Whether to propagate query parameters from the top window to the module URL.
451
+ */
452
+ propagateQueryParams?: boolean;
453
+ /**
454
+ * Whether to override existing query parameters in the module URL with those from the top window.
455
+ */
456
+ overrideQueryParams?: boolean;
457
+ /**
458
+ * The memory channel ID used to retrieve the memorized route.
459
+ * If provided, the memorized route associated with this ID will be used.
460
+ */
461
+ memoryChannelId?: string;
462
+ }
463
+ /**
464
+ * A pipe that restores a route with optional query parameters and memory channel ID.
465
+ *
466
+ * This pipe is used to transform a URL or SafeResourceUrl by appending query parameters
467
+ * and adjusting the pathname based on the current active route and memorized route.
468
+ */
469
+ declare class RestoreRoute implements PipeTransform {
470
+ private readonly activeRoute;
471
+ private readonly domSanitizer;
472
+ private readonly routeMemorizeService;
473
+ /**
474
+ * Transforms the given URL or SafeResourceUrl by appending query parameters and adjusting the pathname.
475
+ * @param url - The URL or SafeResourceUrl to be transformed.
476
+ * @param options - Optional parameters to control the transformation. {@see RestoreRouteOptions}
477
+ * @returns - The transformed SafeResourceUrl or undefined if the input URL is invalid.
478
+ */
479
+ transform(url: string, options?: Partial<RestoreRouteOptions>): string;
480
+ transform(url: SafeResourceUrl, options?: Partial<RestoreRouteOptions>): SafeResourceUrl;
481
+ transform(url: undefined, options?: Partial<RestoreRouteOptions>): undefined;
482
+ static ɵfac: i0.ɵɵFactoryDeclaration<RestoreRoute, never>;
483
+ static ɵpipe: i0.ɵɵPipeDeclaration<RestoreRoute, "restoreRoute", true>;
484
+ }
485
+
486
+ /**
487
+ * A pipe that applies the current theme from a theme manager service, to a given URL or SafeResourceUrl, as query param
488
+ */
489
+ declare class ApplyTheme implements PipeTransform {
490
+ private readonly themeManagerService;
491
+ private readonly domSanitizer;
492
+ /**
493
+ * Transforms the given URL or SafeResourceUrl by appending the current theme value as a query parameter.
494
+ * @param url - The URL or SafeResourceUrl to be transformed.
495
+ * @returns The transformed SafeResourceUrl or undefined if the input URL is invalid.
496
+ */
497
+ transform(url: string): string;
498
+ transform(url: SafeResourceUrl): SafeResourceUrl;
499
+ transform(url: undefined): undefined;
500
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApplyTheme, never>;
501
+ static ɵpipe: i0.ɵɵPipeDeclaration<ApplyTheme, "applyTheme", true>;
502
+ }
503
+
504
+ /**
505
+ * A service that handles theme messages and applies the received theme.
506
+ */
507
+ declare class ThemeConsumerService implements MessageConsumer<ThemeMessage> {
508
+ private readonly domSanitizer;
509
+ private readonly consumerManagerService;
510
+ private readonly logger;
511
+ /**
512
+ * The type of messages this service handles ('theme').
513
+ */
514
+ readonly type = "theme";
515
+ /**
516
+ * The supported versions of theme messages and their handlers.
517
+ */
518
+ readonly supportedVersions: {
519
+ /**
520
+ * Use the message paylod to get the theme and apply it
521
+ * @param message message to consume
522
+ */
523
+ '1.0': (message: RoutedMessage<ThemeV1_0>) => Promise<void>;
524
+ };
525
+ constructor();
526
+ /**
527
+ * Starts the theme handler service by registering it into the consumer manager service.
528
+ */
529
+ start(): void;
530
+ /**
531
+ * Stops the theme handler service by unregistering it from the consumer manager service.
532
+ */
533
+ stop(): void;
534
+ static ɵfac: i0.ɵɵFactoryDeclaration<ThemeConsumerService, never>;
535
+ static ɵprov: i0.ɵɵInjectableDeclaration<ThemeConsumerService>;
536
+ }
537
+
538
+ /** Default suffix for an url containing a theme css file */
539
+ declare const THEME_URL_SUFFIX = "-theme.css";
540
+ /** Default name for the query parameter containing the theme name */
541
+ declare const THEME_QUERY_PARAM_NAME = "theme";
542
+ /** Options and context for Style helpers */
543
+ interface StyleHelperOptions {
544
+ /**
545
+ * Logger to reporter the logs
546
+ */
547
+ logger?: Logger;
548
+ }
549
+ /**
550
+ * Fetches a CSS document and returns the content as a string.
551
+ * @param cssPath - The path to download the CSS.
552
+ * @param options Options and context for Style helpers
553
+ * @returns The content of the CSS document as a string, empty string if the fetch fails.
554
+ */
555
+ declare function getStyle(cssPath: string, options?: StyleHelperOptions): Promise<string>;
556
+ /**
557
+ * Applies the given CSS theme as a stylesheet.
558
+ * @param themeValue - CSS as text containing a theme definition.
559
+ * @param cleanPrevious - Whether to remove previously applied stylesheets if no themeValue provided. Default is true.
560
+ */
561
+ declare function applyTheme(themeValue?: string, cleanPrevious?: boolean): void;
562
+ /**
563
+ * Download the application additional theme
564
+ * @param theme Name of the theme to download from the current application
565
+ * @param options Options and context for Style helpers
566
+ */
567
+ declare function downloadApplicationThemeCss(theme: string, options?: StyleHelperOptions): Promise<string>;
568
+ /**
569
+ * Applies the initial theme based on the URL query parameters.
570
+ *
571
+ * This function fetches the CSS theme specified in the URL query parameters and applies it as a stylesheet.
572
+ * If a referrer is present, it also attempts to fetch and apply the theme from the referrer's URL.
573
+ * @param options Options and context for Style helpers
574
+ */
575
+ declare function applyInitialTheme(options?: StyleHelperOptions): Promise<PromiseSettledResult<void>[] | undefined>;
576
+
577
+ /**
578
+ * This service exposing the current theme signal
579
+ */
580
+ declare class ThemeProducerService implements MessageProducer<ThemeMessage> {
581
+ private readonly messageService;
582
+ private readonly logger;
583
+ private previousTheme;
584
+ private readonly currentThemeSelection;
585
+ /** Current selected theme signal */
586
+ readonly currentTheme: i0.Signal<ThemeStructure | undefined>;
587
+ /**
588
+ * The type of messages this service handles ('theme').
589
+ */
590
+ readonly types = "theme";
591
+ constructor();
592
+ /**
593
+ * Changes the current theme to the specified theme name.
594
+ * @param themeName - The name of the theme to change to.
595
+ */
596
+ changeTheme(themeName?: string): Promise<void>;
597
+ /**
598
+ * Reverts to the previous theme.
599
+ */
600
+ revertToPreviousTheme(): void;
601
+ /**
602
+ * @inheritdoc
603
+ */
604
+ handleError(message: ErrorContent<ThemeV1_0>): void;
605
+ static ɵfac: i0.ɵɵFactoryDeclaration<ThemeProducerService, never>;
606
+ static ɵprov: i0.ɵɵInjectableDeclaration<ThemeProducerService>;
607
+ }
608
+
609
+ declare class ConnectDirective {
610
+ /**
611
+ * The connection ID required for the message peer service.
612
+ */
613
+ connect: i0.InputSignal<string>;
614
+ /**
615
+ * The sanitized source URL for the iframe.
616
+ */
617
+ src: i0.InputSignal<SafeResourceUrl | undefined>;
618
+ /**
619
+ * Binds the `src` attribute of the iframe to the sanitized source URL.
620
+ */
621
+ get srcAttr(): SafeResourceUrl | undefined;
622
+ private readonly messageService;
623
+ private readonly domSanitizer;
624
+ private readonly elRef;
625
+ private readonly clientOrigin;
626
+ constructor();
627
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConnectDirective, never>;
628
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ConnectDirective, "iframe[connect]", never, { "connect": { "alias": "connect"; "required": true; "isSignal": true; }; "src": { "alias": "src"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
629
+ }
630
+
631
+ /** Options to configure the connection inside the communication protocol */
632
+ interface ConnectionConfigOptions extends Omit<MessagePeerConfig, 'id'> {
633
+ /** @inheritdoc */
634
+ id?: string;
635
+ /** Logger used to gather information */
636
+ logger?: Logger;
637
+ }
638
+ /**
639
+ * Provide the communication protocol connection configuration
640
+ * @param connectionConfigOptions The identifier of the application in the communication protocol ecosystem plus the types of messages able to exchange and a logger object
641
+ */
642
+ declare function provideConnection(connectionConfigOptions?: ConnectionConfigOptions): i0.EnvironmentProviders;
643
+
644
+ /**
645
+ * A constant array of known message types and their versions.
646
+ */
647
+ declare const KNOWN_MESSAGES: [{
648
+ readonly type: "error";
649
+ readonly version: "1.0";
650
+ }];
651
+ /**
652
+ * Returns the default options for starting a client endpoint peer connection.
653
+ * As `origin`, it will take the hostURL from {@link getHostInfo} and the `window` will be the parent window.
654
+ */
655
+ declare function getDefaultClientEndpointStartOptions(): PeerConnectionOptions;
656
+ /**
657
+ * Return `true` if embedded inside an iframe, `false` otherwise
658
+ */
659
+ declare function isEmbedded(): boolean;
660
+
661
+ /**
662
+ * Search parameter to add to the URL when embedding an iframe containing the URL of the host.
663
+ * This is needed to support Firefox (on which {@link https://developer.mozilla.org/docs/Web/API/Location/ancestorOrigins | location.ancestorOrigins} is not currently supported)
664
+ * in case of redirection inside the iframe.
665
+ */
666
+ declare const MFE_HOST_URL_PARAM = "ama-mfe-host-url";
667
+ /**
668
+ * Search parameter to add to the URL to let a module know on which application it's embedded
669
+ */
670
+ declare const MFE_HOST_APPLICATION_ID_PARAM = "ama-mfe-host-app-id";
671
+ /**
672
+ * Search parameter to add to the URL to identify the application in the network of peers in the communication protocol
673
+ */
674
+ declare const MFE_MODULE_APPLICATION_ID_PARAM = "ama-mfe-module-app-id";
675
+ /** The list of query parameters which can be set by the host */
676
+ declare const hostQueryParams: string[];
677
+ /**
678
+ * Information set up at host level to use in embedded context
679
+ */
680
+ interface MFEHostInformation {
681
+ /**
682
+ * URL of the host application
683
+ */
684
+ hostURL?: string;
685
+ /**
686
+ * ID of the host application
687
+ */
688
+ hostApplicationId?: string;
689
+ /**
690
+ * ID of the module to embed defined at host level
691
+ */
692
+ moduleApplicationId?: string;
693
+ }
694
+ /**
695
+ * Gather the host information from the url parameters
696
+ * The host url will use the first found among:
697
+ * - look for the search parameter {@link MFE_HOST_URL_PARAM} in the URL of the iframe
698
+ * - use the first item in `location.ancestorOrigins` (currently not supported on Firefox)
699
+ * - use `document.referrer` (will only work if called before any redirection in the iframe)
700
+ * The host application ID is taken from the search parameter {@link MFE_HOST_APPLICATION_ID_PARAM} in the URL of the iframe
701
+ * The module application ID is taken from the search parameter {@link MFE_APPLICATION_ID_PARAM} in the URL of the iframe
702
+ */
703
+ declare function getHostInfo(): MFEHostInformation;
704
+ /**
705
+ * Gather the host information from the url parameters and handle the persistence in session storage.
706
+ */
707
+ declare function persistHostInfo(): void;
708
+
709
+ /**
710
+ * A pipe that adds the host information in the URL of an iframe,
711
+ */
712
+ declare class HostInfoPipe implements PipeTransform {
713
+ private readonly domSanitizer;
714
+ /**
715
+ * Transforms the given URL or SafeResourceUrl by appending query parameters.
716
+ * @param url - The URL or SafeResourceUrl to be transformed.
717
+ * @param options - hostId and moduleId
718
+ * @returns - The transformed SafeResourceUrl or undefined if the input URL is invalid.
719
+ */
720
+ transform(url: string, options: {
721
+ hostId: string;
722
+ moduleId?: string;
723
+ }): string;
724
+ transform(url: SafeResourceUrl, options: {
725
+ hostId: string;
726
+ moduleId?: string;
727
+ }): SafeResourceUrl;
728
+ transform(url: undefined, options: {
729
+ hostId: string;
730
+ moduleId?: string;
731
+ }): undefined;
732
+ static ɵfac: i0.ɵɵFactoryDeclaration<HostInfoPipe, never>;
733
+ static ɵpipe: i0.ɵɵPipeDeclaration<HostInfoPipe, "hostInfo", true>;
734
+ }
735
+
736
+ export { ApplyTheme, ConnectDirective, ConsumerManagerService, ERROR_MESSAGE_TYPE, HostInfoPipe, KNOWN_MESSAGES, MFE_HOST_APPLICATION_ID_PARAM, MFE_HOST_URL_PARAM, MFE_MODULE_APPLICATION_ID_PARAM, NavigationConsumerService, ProducerManagerService, ResizeConsumerService, ResizeService, RestoreRoute, RouteMemorizeDirective, RouteMemorizeService, RoutingService, ScalableDirective, THEME_QUERY_PARAM_NAME, THEME_URL_SUFFIX, ThemeConsumerService, ThemeProducerService, applyInitialTheme, applyTheme, downloadApplicationThemeCss, getAvailableConsumers, getDefaultClientEndpointStartOptions, getHostInfo, getStyle, hostQueryParams, isEmbedded, isErrorMessage, persistHostInfo, provideConnection, registerConsumer, registerProducer, sendError };
737
+ export type { BasicMessageConsumer, ConnectionConfigOptions, ErrorContent, ErrorMessage, ErrorMessageV1_0, ErrorReason, MFEHostInformation, MessageCallback, MessageConsumer, MessageProducer, MessageVersions, RestoreRouteOptions, RoutingServiceOptions, StyleHelperOptions };
738
+ //# sourceMappingURL=index.d.ts.map