@luigi-project/client-support-angular 1.23.2-dev.20220770759 → 1.23.2-dev.20220782305

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 (47) hide show
  1. package/bundles/luigi-project-client-support-angular.umd.js +796 -0
  2. package/bundles/luigi-project-client-support-angular.umd.js.map +1 -0
  3. package/bundles/luigi-project-client-support-angular.umd.min.js +17 -0
  4. package/bundles/luigi-project-client-support-angular.umd.min.js.map +1 -0
  5. package/esm2015/lib/component/luigi.preload.component.js +13 -0
  6. package/esm2015/lib/luigi-mock/luigi-mock.module.js +163 -0
  7. package/esm2015/lib/luigi.angular.support.module.js +60 -0
  8. package/esm2015/lib/route/luigi-activated-route-snapshot-helper.js +11 -0
  9. package/esm2015/lib/route/luigi-route-strategy.js +9 -0
  10. package/esm2015/lib/service/luigi-auto-routing.service.js +128 -0
  11. package/esm2015/lib/service/luigi-context-service.js +8 -0
  12. package/esm2015/lib/service/luigi-context.service.impl.js +70 -0
  13. package/esm2015/luigi-project-client-support-angular.js +6 -0
  14. package/esm2015/public-api.js +10 -0
  15. package/fesm2015/{luigi-project-client-support-angular.mjs → luigi-project-client-support-angular.js} +74 -90
  16. package/fesm2015/luigi-project-client-support-angular.js.map +1 -0
  17. package/lib/component/luigi.preload.component.d.ts +0 -3
  18. package/lib/component/luigi.preload.component.d.ts.map +1 -1
  19. package/lib/luigi-mock/luigi-mock.module.d.ts +0 -4
  20. package/lib/luigi-mock/luigi-mock.module.d.ts.map +1 -1
  21. package/lib/luigi.angular.support.module.d.ts +0 -6
  22. package/lib/luigi.angular.support.module.d.ts.map +1 -1
  23. package/lib/route/luigi-activated-route-snapshot-helper.d.ts.map +1 -1
  24. package/lib/route/luigi-route-strategy.d.ts.map +1 -1
  25. package/lib/service/luigi-auto-routing.service.d.ts +0 -3
  26. package/lib/service/luigi-auto-routing.service.d.ts.map +1 -1
  27. package/lib/service/luigi-context-service.d.ts.map +1 -1
  28. package/lib/service/luigi-context.service.impl.d.ts +0 -3
  29. package/lib/service/luigi-context.service.impl.d.ts.map +1 -1
  30. package/luigi-project-client-support-angular.d.ts +1 -1
  31. package/luigi-project-client-support-angular.d.ts.map +1 -1
  32. package/luigi-project-client-support-angular.metadata.json +1 -0
  33. package/package.json +8 -20
  34. package/public-api.d.ts.map +1 -1
  35. package/esm2020/lib/component/luigi.preload.component.mjs +0 -13
  36. package/esm2020/lib/luigi-mock/luigi-mock.module.mjs +0 -173
  37. package/esm2020/lib/luigi.angular.support.module.mjs +0 -70
  38. package/esm2020/lib/route/luigi-activated-route-snapshot-helper.mjs +0 -11
  39. package/esm2020/lib/route/luigi-route-strategy.mjs +0 -9
  40. package/esm2020/lib/service/luigi-auto-routing.service.mjs +0 -124
  41. package/esm2020/lib/service/luigi-context-service.mjs +0 -8
  42. package/esm2020/lib/service/luigi-context.service.impl.mjs +0 -69
  43. package/esm2020/luigi-project-client-support-angular.mjs +0 -5
  44. package/esm2020/public-api.mjs +0 -10
  45. package/fesm2015/luigi-project-client-support-angular.mjs.map +0 -1
  46. package/fesm2020/luigi-project-client-support-angular.mjs +0 -464
  47. package/fesm2020/luigi-project-client-support-angular.mjs.map +0 -1
@@ -0,0 +1,796 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/router'), require('rxjs'), require('rxjs/operators'), require('@luigi-project/client')) :
3
+ typeof define === 'function' && define.amd ? define('@luigi-project/client-support-angular', ['exports', '@angular/core', '@angular/router', 'rxjs', 'rxjs/operators', '@luigi-project/client'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['luigi-project'] = global['luigi-project'] || {}, global['luigi-project']['client-support-angular'] = {}), global.ng.core, global.ng.router, global.rxjs, global.rxjs.operators, global.client));
5
+ }(this, (function (exports, i0, i1, rxjs, operators, client) { 'use strict';
6
+
7
+ var LuigiPreloadComponent = /** @class */ (function () {
8
+ function LuigiPreloadComponent() {
9
+ }
10
+ LuigiPreloadComponent.prototype.ngOnInit = function () { };
11
+ return LuigiPreloadComponent;
12
+ }());
13
+ LuigiPreloadComponent.decorators = [
14
+ { type: i0.Component, args: [{
15
+ selector: 'lib-client-support-angular',
16
+ template: "<p luigipreload=\"luigipreload\"></p>\n"
17
+ },] }
18
+ ];
19
+ LuigiPreloadComponent.ctorParameters = function () { return []; };
20
+
21
+ var LuigiContextService = /** @class */ (function () {
22
+ function LuigiContextService() {
23
+ }
24
+ return LuigiContextService;
25
+ }());
26
+ (function (ILuigiContextTypes) {
27
+ ILuigiContextTypes[ILuigiContextTypes["INIT"] = 0] = "INIT";
28
+ ILuigiContextTypes[ILuigiContextTypes["UPDATE"] = 1] = "UPDATE";
29
+ })(exports.ILuigiContextTypes || (exports.ILuigiContextTypes = {}));
30
+
31
+ var LuigiContextServiceImpl = /** @class */ (function () {
32
+ function LuigiContextServiceImpl(zone) {
33
+ var _this = this;
34
+ this.zone = zone;
35
+ this.subject = new rxjs.ReplaySubject(1);
36
+ this.currentContext = null;
37
+ client.addInitListener(function (initContext) {
38
+ _this.addListener(exports.ILuigiContextTypes.INIT, initContext);
39
+ });
40
+ client.addContextUpdateListener(function (updateContext) {
41
+ _this.addListener(exports.ILuigiContextTypes.UPDATE, updateContext);
42
+ });
43
+ }
44
+ LuigiContextServiceImpl.prototype.contextObservable = function () {
45
+ return this.subject.asObservable();
46
+ };
47
+ /**
48
+ * Get latest context object retrieved from luigi core application or none, if not yet set.
49
+ */
50
+ LuigiContextServiceImpl.prototype.getContext = function () {
51
+ return this.currentContext && this.currentContext.context;
52
+ };
53
+ /**
54
+ * Get a promise that resolves when context is set.
55
+ */
56
+ LuigiContextServiceImpl.prototype.getContextAsync = function () {
57
+ var _this = this;
58
+ return new Promise(function (resolve, reject) {
59
+ if (_this.getContext()) {
60
+ resolve(_this.getContext());
61
+ }
62
+ else {
63
+ _this.contextObservable()
64
+ .pipe(operators.first())
65
+ .subscribe(function (ctx) {
66
+ resolve(ctx.context);
67
+ });
68
+ }
69
+ });
70
+ };
71
+ /**
72
+ * Set current context
73
+ */
74
+ LuigiContextServiceImpl.prototype.setContext = function (obj) {
75
+ var _this = this;
76
+ this.zone.run(function () {
77
+ _this.currentContext = obj;
78
+ _this.subject.next(obj);
79
+ });
80
+ };
81
+ LuigiContextServiceImpl.prototype.addListener = function (contextType, context) {
82
+ this.setContext({
83
+ contextType: contextType,
84
+ context: context
85
+ });
86
+ };
87
+ return LuigiContextServiceImpl;
88
+ }());
89
+ LuigiContextServiceImpl.ɵprov = i0.ɵɵdefineInjectable({ factory: function LuigiContextServiceImpl_Factory() { return new LuigiContextServiceImpl(i0.ɵɵinject(i0.NgZone)); }, token: LuigiContextServiceImpl, providedIn: "root" });
90
+ LuigiContextServiceImpl.decorators = [
91
+ { type: i0.Injectable, args: [{
92
+ providedIn: 'root'
93
+ },] }
94
+ ];
95
+ LuigiContextServiceImpl.ctorParameters = function () { return [
96
+ { type: i0.NgZone }
97
+ ]; };
98
+
99
+ var LuigiActivatedRouteSnapshotHelper = /** @class */ (function () {
100
+ function LuigiActivatedRouteSnapshotHelper() {
101
+ }
102
+ LuigiActivatedRouteSnapshotHelper.getCurrent = function () {
103
+ return LuigiActivatedRouteSnapshotHelper._current;
104
+ };
105
+ LuigiActivatedRouteSnapshotHelper.setCurrent = function (current) {
106
+ LuigiActivatedRouteSnapshotHelper._current = current;
107
+ };
108
+ return LuigiActivatedRouteSnapshotHelper;
109
+ }());
110
+ // tslint:disable-next-line:variable-name
111
+ LuigiActivatedRouteSnapshotHelper._current = null;
112
+
113
+ var LuigiAutoRoutingService = /** @class */ (function () {
114
+ function LuigiAutoRoutingService(router, luigiContextService) {
115
+ this.router = router;
116
+ this.luigiContextService = luigiContextService;
117
+ this.subscription = new rxjs.Subscription();
118
+ this.subscription.add(this.router.events.pipe(this.doFilter()).subscribe(this.doSubscription.bind(this)));
119
+ }
120
+ LuigiAutoRoutingService.prototype.doFilter = function () {
121
+ return operators.filter(function (event) {
122
+ return !!(event instanceof i1.NavigationEnd &&
123
+ event.url &&
124
+ event.url.length > 0 &&
125
+ !(history.state && history.state.luigiInduced));
126
+ });
127
+ };
128
+ /**
129
+ * This method will be take in consideration angular route that having in data object the paramter
130
+ * fromVirtualTreeRoot: true, here an example:
131
+ * {path: 'demo', component: DemoComponent, data:{fromVirtualTreeRoot: true}}
132
+ * Another option is to specify the LuigiPath: if you add in route data luigiRoute:'/xxxx/xxx';
133
+ * in the case we will update the path in LuigiCore navigation, here an example
134
+ * {path: 'demo', component: DemoComponent, data:{luigiRoute: '/home/demo''}}
135
+ * If updateModalPathParam is specified, than modalPathParam will be updated upon internal navigation:
136
+ * {path: 'demo', component: DemoComponent, data:{updateModalPathParam: true}}
137
+ * @param event the NavigationEnd event
138
+ */
139
+ LuigiAutoRoutingService.prototype.doSubscription = function (event) {
140
+ var _a;
141
+ var current = LuigiActivatedRouteSnapshotHelper.getCurrent();
142
+ if (!current) {
143
+ current = this.router.routerState.root.snapshot;
144
+ var _loop_1 = function () {
145
+ // handle multiple children
146
+ var primary = null;
147
+ current === null || current === void 0 ? void 0 : current.children.forEach(function (childSnapshot) {
148
+ if (childSnapshot.outlet === 'primary') {
149
+ primary = childSnapshot;
150
+ }
151
+ });
152
+ if (primary) {
153
+ current = primary;
154
+ }
155
+ else if (current.firstChild) {
156
+ current = current.firstChild;
157
+ }
158
+ else {
159
+ return "break";
160
+ }
161
+ };
162
+ while (((_a = current === null || current === void 0 ? void 0 : current.children) === null || _a === void 0 ? void 0 : _a.length) > 0) {
163
+ var state_1 = _loop_1();
164
+ if (state_1 === "break")
165
+ break;
166
+ }
167
+ }
168
+ if (current === null || current === void 0 ? void 0 : current.data) {
169
+ var ux = client.uxManager();
170
+ var lm = client.linkManager().withoutSync();
171
+ var route_1;
172
+ if (current.data.luigiRoute) {
173
+ route_1 = current.data.luigiRoute;
174
+ if (current.params) {
175
+ var pmap_1 = i1.convertToParamMap(current.params);
176
+ pmap_1.keys.forEach(function (key) {
177
+ var val = pmap_1.getAll(key).forEach(function (param) {
178
+ route_1 = route_1 === null || route_1 === void 0 ? void 0 : route_1.replace(':' + key, param);
179
+ });
180
+ });
181
+ }
182
+ if (current.data.fromContext) {
183
+ if (!this.luigiContextService.getContext()) {
184
+ console.debug('Ignoring auto navigation request, luigi context not set');
185
+ return;
186
+ }
187
+ if (current.data.fromContext === true) {
188
+ lm = lm.fromClosestContext();
189
+ }
190
+ else {
191
+ lm = lm.fromContext(current.data.fromContext);
192
+ }
193
+ }
194
+ }
195
+ else if (current.data.fromVirtualTreeRoot) {
196
+ var url = event.url;
197
+ var truncate = current.data.fromVirtualTreeRoot.truncate;
198
+ if (truncate) {
199
+ if (truncate.indexOf('*') === 0) {
200
+ var index = url.indexOf(truncate.substr(1));
201
+ url = url.substr(index + truncate.length - 1);
202
+ }
203
+ else if (url.indexOf(truncate) === 0) {
204
+ url = url.substr(truncate.length);
205
+ }
206
+ }
207
+ route_1 = url;
208
+ console.debug('Calling fromVirtualTreeRoot for url ==> ' + route_1);
209
+ lm = lm.fromVirtualTreeRoot();
210
+ }
211
+ if (ux.isModal()) {
212
+ if (current.data.updateModalDataPath) {
213
+ lm.updateModalPathInternalNavigation(route_1, {}, current.data.addHistoryEntry);
214
+ }
215
+ }
216
+ else if (route_1) {
217
+ lm.navigate(route_1);
218
+ }
219
+ }
220
+ };
221
+ LuigiAutoRoutingService.prototype.ngOnDestroy = function () {
222
+ this.subscription.unsubscribe();
223
+ };
224
+ return LuigiAutoRoutingService;
225
+ }());
226
+ LuigiAutoRoutingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LuigiAutoRoutingService_Factory() { return new LuigiAutoRoutingService(i0.ɵɵinject(i1.Router), i0.ɵɵinject(LuigiContextService)); }, token: LuigiAutoRoutingService, providedIn: "root" });
227
+ LuigiAutoRoutingService.decorators = [
228
+ { type: i0.Injectable, args: [{
229
+ providedIn: 'root'
230
+ },] }
231
+ ];
232
+ LuigiAutoRoutingService.ctorParameters = function () { return [
233
+ { type: i1.Router },
234
+ { type: LuigiContextService }
235
+ ]; };
236
+
237
+ /*! *****************************************************************************
238
+ Copyright (c) Microsoft Corporation.
239
+
240
+ Permission to use, copy, modify, and/or distribute this software for any
241
+ purpose with or without fee is hereby granted.
242
+
243
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
244
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
245
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
246
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
247
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
248
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
249
+ PERFORMANCE OF THIS SOFTWARE.
250
+ ***************************************************************************** */
251
+ /* global Reflect, Promise */
252
+ var extendStatics = function (d, b) {
253
+ extendStatics = Object.setPrototypeOf ||
254
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
255
+ function (d, b) { for (var p in b)
256
+ if (Object.prototype.hasOwnProperty.call(b, p))
257
+ d[p] = b[p]; };
258
+ return extendStatics(d, b);
259
+ };
260
+ function __extends(d, b) {
261
+ extendStatics(d, b);
262
+ function __() { this.constructor = d; }
263
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
264
+ }
265
+ var __assign = function () {
266
+ __assign = Object.assign || function __assign(t) {
267
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
268
+ s = arguments[i];
269
+ for (var p in s)
270
+ if (Object.prototype.hasOwnProperty.call(s, p))
271
+ t[p] = s[p];
272
+ }
273
+ return t;
274
+ };
275
+ return __assign.apply(this, arguments);
276
+ };
277
+ function __rest(s, e) {
278
+ var t = {};
279
+ for (var p in s)
280
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
281
+ t[p] = s[p];
282
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
283
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
284
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
285
+ t[p[i]] = s[p[i]];
286
+ }
287
+ return t;
288
+ }
289
+ function __decorate(decorators, target, key, desc) {
290
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
291
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
292
+ r = Reflect.decorate(decorators, target, key, desc);
293
+ else
294
+ for (var i = decorators.length - 1; i >= 0; i--)
295
+ if (d = decorators[i])
296
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
297
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
298
+ }
299
+ function __param(paramIndex, decorator) {
300
+ return function (target, key) { decorator(target, key, paramIndex); };
301
+ }
302
+ function __metadata(metadataKey, metadataValue) {
303
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
304
+ return Reflect.metadata(metadataKey, metadataValue);
305
+ }
306
+ function __awaiter(thisArg, _arguments, P, generator) {
307
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
308
+ return new (P || (P = Promise))(function (resolve, reject) {
309
+ function fulfilled(value) { try {
310
+ step(generator.next(value));
311
+ }
312
+ catch (e) {
313
+ reject(e);
314
+ } }
315
+ function rejected(value) { try {
316
+ step(generator["throw"](value));
317
+ }
318
+ catch (e) {
319
+ reject(e);
320
+ } }
321
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
322
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
323
+ });
324
+ }
325
+ function __generator(thisArg, body) {
326
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
327
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
328
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
329
+ function verb(n) { return function (v) { return step([n, v]); }; }
330
+ function step(op) {
331
+ if (f)
332
+ throw new TypeError("Generator is already executing.");
333
+ while (_)
334
+ try {
335
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
336
+ return t;
337
+ if (y = 0, t)
338
+ op = [op[0] & 2, t.value];
339
+ switch (op[0]) {
340
+ case 0:
341
+ case 1:
342
+ t = op;
343
+ break;
344
+ case 4:
345
+ _.label++;
346
+ return { value: op[1], done: false };
347
+ case 5:
348
+ _.label++;
349
+ y = op[1];
350
+ op = [0];
351
+ continue;
352
+ case 7:
353
+ op = _.ops.pop();
354
+ _.trys.pop();
355
+ continue;
356
+ default:
357
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
358
+ _ = 0;
359
+ continue;
360
+ }
361
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
362
+ _.label = op[1];
363
+ break;
364
+ }
365
+ if (op[0] === 6 && _.label < t[1]) {
366
+ _.label = t[1];
367
+ t = op;
368
+ break;
369
+ }
370
+ if (t && _.label < t[2]) {
371
+ _.label = t[2];
372
+ _.ops.push(op);
373
+ break;
374
+ }
375
+ if (t[2])
376
+ _.ops.pop();
377
+ _.trys.pop();
378
+ continue;
379
+ }
380
+ op = body.call(thisArg, _);
381
+ }
382
+ catch (e) {
383
+ op = [6, e];
384
+ y = 0;
385
+ }
386
+ finally {
387
+ f = t = 0;
388
+ }
389
+ if (op[0] & 5)
390
+ throw op[1];
391
+ return { value: op[0] ? op[1] : void 0, done: true };
392
+ }
393
+ }
394
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
395
+ if (k2 === undefined)
396
+ k2 = k;
397
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
398
+ }) : (function (o, m, k, k2) {
399
+ if (k2 === undefined)
400
+ k2 = k;
401
+ o[k2] = m[k];
402
+ });
403
+ function __exportStar(m, o) {
404
+ for (var p in m)
405
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
406
+ __createBinding(o, m, p);
407
+ }
408
+ function __values(o) {
409
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
410
+ if (m)
411
+ return m.call(o);
412
+ if (o && typeof o.length === "number")
413
+ return {
414
+ next: function () {
415
+ if (o && i >= o.length)
416
+ o = void 0;
417
+ return { value: o && o[i++], done: !o };
418
+ }
419
+ };
420
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
421
+ }
422
+ function __read(o, n) {
423
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
424
+ if (!m)
425
+ return o;
426
+ var i = m.call(o), r, ar = [], e;
427
+ try {
428
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
429
+ ar.push(r.value);
430
+ }
431
+ catch (error) {
432
+ e = { error: error };
433
+ }
434
+ finally {
435
+ try {
436
+ if (r && !r.done && (m = i["return"]))
437
+ m.call(i);
438
+ }
439
+ finally {
440
+ if (e)
441
+ throw e.error;
442
+ }
443
+ }
444
+ return ar;
445
+ }
446
+ function __spread() {
447
+ for (var ar = [], i = 0; i < arguments.length; i++)
448
+ ar = ar.concat(__read(arguments[i]));
449
+ return ar;
450
+ }
451
+ function __spreadArrays() {
452
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
453
+ s += arguments[i].length;
454
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
455
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
456
+ r[k] = a[j];
457
+ return r;
458
+ }
459
+ ;
460
+ function __await(v) {
461
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
462
+ }
463
+ function __asyncGenerator(thisArg, _arguments, generator) {
464
+ if (!Symbol.asyncIterator)
465
+ throw new TypeError("Symbol.asyncIterator is not defined.");
466
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
467
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
468
+ function verb(n) { if (g[n])
469
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
470
+ function resume(n, v) { try {
471
+ step(g[n](v));
472
+ }
473
+ catch (e) {
474
+ settle(q[0][3], e);
475
+ } }
476
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
477
+ function fulfill(value) { resume("next", value); }
478
+ function reject(value) { resume("throw", value); }
479
+ function settle(f, v) { if (f(v), q.shift(), q.length)
480
+ resume(q[0][0], q[0][1]); }
481
+ }
482
+ function __asyncDelegator(o) {
483
+ var i, p;
484
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
485
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
486
+ }
487
+ function __asyncValues(o) {
488
+ if (!Symbol.asyncIterator)
489
+ throw new TypeError("Symbol.asyncIterator is not defined.");
490
+ var m = o[Symbol.asyncIterator], i;
491
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
492
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
493
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
494
+ }
495
+ function __makeTemplateObject(cooked, raw) {
496
+ if (Object.defineProperty) {
497
+ Object.defineProperty(cooked, "raw", { value: raw });
498
+ }
499
+ else {
500
+ cooked.raw = raw;
501
+ }
502
+ return cooked;
503
+ }
504
+ ;
505
+ var __setModuleDefault = Object.create ? (function (o, v) {
506
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
507
+ }) : function (o, v) {
508
+ o["default"] = v;
509
+ };
510
+ function __importStar(mod) {
511
+ if (mod && mod.__esModule)
512
+ return mod;
513
+ var result = {};
514
+ if (mod != null)
515
+ for (var k in mod)
516
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
517
+ __createBinding(result, mod, k);
518
+ __setModuleDefault(result, mod);
519
+ return result;
520
+ }
521
+ function __importDefault(mod) {
522
+ return (mod && mod.__esModule) ? mod : { default: mod };
523
+ }
524
+ function __classPrivateFieldGet(receiver, privateMap) {
525
+ if (!privateMap.has(receiver)) {
526
+ throw new TypeError("attempted to get private field on non-instance");
527
+ }
528
+ return privateMap.get(receiver);
529
+ }
530
+ function __classPrivateFieldSet(receiver, privateMap, value) {
531
+ if (!privateMap.has(receiver)) {
532
+ throw new TypeError("attempted to set private field on non-instance");
533
+ }
534
+ privateMap.set(receiver, value);
535
+ return value;
536
+ }
537
+
538
+ var LuigiRouteStrategy = /** @class */ (function (_super) {
539
+ __extends(LuigiRouteStrategy, _super);
540
+ function LuigiRouteStrategy() {
541
+ return _super !== null && _super.apply(this, arguments) || this;
542
+ }
543
+ LuigiRouteStrategy.prototype.retrieve = function (route) {
544
+ LuigiActivatedRouteSnapshotHelper.setCurrent(route);
545
+ return _super.prototype.retrieve.call(this, route);
546
+ };
547
+ return LuigiRouteStrategy;
548
+ }(i1.BaseRouteReuseStrategy));
549
+
550
+ var ɵ0 = { fromVirtualTreeRoot: true }, ɵ1 = { luigiRoute: '/home/reload' }, ɵ2 = { reuse: true }, ɵ3 = { updateModalPathParam: true };
551
+ var staticRoutes = [
552
+ /** here an example if you want to specify that this component is a virtualTree element in Luigi Core navigation*/
553
+ {
554
+ path: 'luigi-client-support-preload',
555
+ component: LuigiPreloadComponent,
556
+ data: ɵ0
557
+ },
558
+ /** here an example if you want to specify that this component it is a luigi component and u want to change the navigation in Luigi core*/
559
+ {
560
+ path: 'luigi-client-support-preload',
561
+ component: LuigiPreloadComponent,
562
+ data: ɵ1
563
+ },
564
+ /** here an example if you want to reuse the component and not recreating every time you navigate to it (a singleton Component) It requires in your module to redefine */
565
+ {
566
+ path: 'luigi-client-support-preload=component',
567
+ component: LuigiPreloadComponent,
568
+ data: ɵ2
569
+ },
570
+ /** here an example if you want to update modalPathParam on internal navigation */
571
+ {
572
+ path: 'luigi-client-support-preload',
573
+ component: LuigiPreloadComponent,
574
+ data: ɵ3
575
+ }
576
+ ];
577
+ var LuigiAngularSupportModule = /** @class */ (function () {
578
+ function LuigiAngularSupportModule(navigation, context) {
579
+ }
580
+ return LuigiAngularSupportModule;
581
+ }());
582
+ LuigiAngularSupportModule.decorators = [
583
+ { type: i0.NgModule, args: [{
584
+ declarations: [LuigiPreloadComponent],
585
+ imports: [i1.RouterModule.forChild(staticRoutes)],
586
+ providers: [
587
+ {
588
+ provide: LuigiContextService,
589
+ useClass: LuigiContextServiceImpl
590
+ },
591
+ {
592
+ provide: i1.RouteReuseStrategy,
593
+ useClass: LuigiRouteStrategy
594
+ }
595
+ ],
596
+ exports: [LuigiPreloadComponent]
597
+ },] }
598
+ ];
599
+ LuigiAngularSupportModule.ctorParameters = function () { return [
600
+ { type: LuigiAutoRoutingService },
601
+ { type: LuigiContextService }
602
+ ]; };
603
+
604
+ // @dynamic
605
+ /*
606
+ * This class mocks Luigi Core related functionality.
607
+ *
608
+ * Micro Frontends that use Luigi Client would usually communicate with Luigi Core
609
+ * back and forth. When testing Luigi Client based components, Luigi Core might
610
+ * not be present which leads into limitations on integration/e2e testing for standalone
611
+ * microfrontends.
612
+ *
613
+ * This module adds a hook to the window postMessage API by adding an event listener to the
614
+ * global message event of the window object and mocking the callback.
615
+ * In the normal workflow this message would picked up by Luigi Core which then sends the response back.
616
+ */
617
+ var LuigiMockModule = /** @class */ (function () {
618
+ function LuigiMockModule() {
619
+ }
620
+ // Add a hook to the post message api to mock the LuigiCore response to the Client
621
+ LuigiMockModule.initPostMessageHook = function () {
622
+ var _this = this;
623
+ return function () { return __awaiter(_this, void 0, void 0, function () {
624
+ return __generator(this, function (_a) {
625
+ // Check if Luigi Client is running standalone
626
+ if (window.parent === window) {
627
+ console.debug('Detected standalone mode');
628
+ // Check and skip if Luigi environment is already mocked
629
+ if (window.luigiMockEnvironment) {
630
+ return [2 /*return*/];
631
+ }
632
+ window.luigiMockEnvironment = {
633
+ msgListener: function (e) {
634
+ if (e.data.msg && (e.data.msg.startsWith('luigi.') || e.data.msg === 'storage')) {
635
+ console.debug('Luigi msg', e.data);
636
+ if (e.data.msg === 'luigi.get-context') {
637
+ window.postMessage({
638
+ msg: 'luigi.init',
639
+ emulated: true,
640
+ internal: {
641
+ viewStackSize: 1
642
+ },
643
+ context: e.data.context
644
+ }, '*');
645
+ }
646
+ // vizualise retrieved event data
647
+ LuigiMockModule.visualize(JSON.stringify(e.data));
648
+ // Check and run mocked callback if it exists
649
+ var mockListener = window.luigiMockEnvironment.mockListeners[e.data.msg];
650
+ if (mockListener) {
651
+ mockListener(e);
652
+ }
653
+ }
654
+ },
655
+ mockListeners: {
656
+ 'luigi.navigation.pathExists': function (event) {
657
+ var mockData = window.sessionStorage.getItem('luigiMockData');
658
+ var mockDataParsed = mockData ? JSON.parse(mockData) : undefined;
659
+ var inputPath = event.data.data.link;
660
+ var pathExists = mockDataParsed && mockDataParsed.pathExists && mockDataParsed.pathExists[inputPath];
661
+ var response = {
662
+ msg: 'luigi.navigation.pathExists.answer',
663
+ data: {
664
+ correlationId: event.data.data.id,
665
+ pathExists: pathExists ? pathExists : false
666
+ },
667
+ emulated: true
668
+ };
669
+ window.postMessage(response, '*');
670
+ },
671
+ //ux
672
+ 'luigi.ux.confirmationModal.show': function (event) {
673
+ var response = {
674
+ msg: 'luigi.ux.confirmationModal.hide',
675
+ data: event.data,
676
+ emulated: true
677
+ };
678
+ window.postMessage(response, '*');
679
+ },
680
+ 'luigi.ux.alert.show': function (event) {
681
+ var response = {
682
+ msg: 'luigi.ux.alert.hide',
683
+ data: event.data,
684
+ emulated: true
685
+ };
686
+ window.postMessage(response, '*');
687
+ },
688
+ 'luigi.ux.set-current-locale': function (event) {
689
+ var response = {
690
+ msg: 'luigi.current-locale-changed',
691
+ currentLocale: event.data.data.currentLocale,
692
+ emulated: true
693
+ };
694
+ window.postMessage(response, '*');
695
+ },
696
+ // linkManager
697
+ 'luigi.navigation.open': function (event) {
698
+ var response = {
699
+ msg: 'luigi.navigate.ok',
700
+ data: event.data,
701
+ emulated: true
702
+ };
703
+ window.postMessage(response, '*');
704
+ },
705
+ 'luigi.navigation.splitview.close': function (event) {
706
+ var response = {
707
+ msg: 'luigi.navigate.ok',
708
+ data: event.data,
709
+ emulated: true
710
+ };
711
+ window.postMessage(response, '*');
712
+ },
713
+ 'luigi.navigation.splitview.collapse': function (event) {
714
+ var response = {
715
+ msg: 'luigi.navigate.ok',
716
+ data: event.data,
717
+ emulated: true
718
+ };
719
+ window.postMessage(response, '*');
720
+ },
721
+ 'luigi.navigation.splitview.expand': function (event) {
722
+ var response = {
723
+ msg: 'luigi.navigate.ok',
724
+ data: event.data,
725
+ emulated: true
726
+ };
727
+ window.postMessage(response, '*');
728
+ },
729
+ // storage
730
+ storage: function () { }
731
+ }
732
+ };
733
+ // Listen to the global 'message' event of the window object
734
+ window.addEventListener('message', window.luigiMockEnvironment.msgListener);
735
+ }
736
+ return [2 /*return*/];
737
+ });
738
+ }); };
739
+ };
740
+ /*
741
+ * This method takes a data object of type 'any' and vizualizes a simple container
742
+ * which holds data that is useful for e2e testing.
743
+ */
744
+ LuigiMockModule.visualize = function (data) {
745
+ var luigiVisualizationContainer = document.querySelector('#luigi-debug-vis-cnt');
746
+ // Construct element structure if not already constructed
747
+ if (!luigiVisualizationContainer) {
748
+ luigiVisualizationContainer = document.createElement('div');
749
+ luigiVisualizationContainer.setAttribute('id', 'luigi-debug-vis-cnt');
750
+ // Hide the added DOM element to avoid interferring/overlapping with other elements during testing.
751
+ luigiVisualizationContainer.setAttribute('style', 'display:none');
752
+ document.body.appendChild(luigiVisualizationContainer);
753
+ }
754
+ var line = document.createElement('div');
755
+ line.textContent = data;
756
+ luigiVisualizationContainer.appendChild(line);
757
+ };
758
+ return LuigiMockModule;
759
+ }());
760
+ LuigiMockModule.decorators = [
761
+ { type: i0.NgModule, args: [{
762
+ providers: [
763
+ {
764
+ provide: i0.APP_INITIALIZER,
765
+ useFactory: LuigiMockModule.initPostMessageHook,
766
+ multi: true
767
+ }
768
+ ]
769
+ },] }
770
+ ];
771
+
772
+ /*
773
+ * Public API Surface of client-support-angular
774
+ */
775
+
776
+ /**
777
+ * Generated bundle index. Do not edit.
778
+ */
779
+
780
+ exports.LuigiAngularSupportModule = LuigiAngularSupportModule;
781
+ exports.LuigiAutoRoutingService = LuigiAutoRoutingService;
782
+ exports.LuigiContextService = LuigiContextService;
783
+ exports.LuigiContextServiceImpl = LuigiContextServiceImpl;
784
+ exports.LuigiMockModule = LuigiMockModule;
785
+ exports.LuigiPreloadComponent = LuigiPreloadComponent;
786
+ exports.staticRoutes = staticRoutes;
787
+ exports.ɵ0 = ɵ0;
788
+ exports.ɵ1 = ɵ1;
789
+ exports.ɵ2 = ɵ2;
790
+ exports.ɵ3 = ɵ3;
791
+ exports.ɵa = LuigiRouteStrategy;
792
+
793
+ Object.defineProperty(exports, '__esModule', { value: true });
794
+
795
+ })));
796
+ //# sourceMappingURL=luigi-project-client-support-angular.umd.js.map