ngx-payvent-shared 0.0.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.
@@ -0,0 +1,2595 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, signal, Injectable, inject, Input, Component, HostListener, Pipe, input, computed, model, output, effect, ViewChild, ViewEncapsulation, ElementRef, HostBinding, Renderer2, Output, untracked } from '@angular/core';
3
+ import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
4
+ import { timer, shareReplay, ReplaySubject, of, tap, share } from 'rxjs';
5
+ import * as i1 from '@angular/router';
6
+ import { ActivatedRoute, Router, NavigationStart, NavigationEnd, NavigationCancel } from '@angular/router';
7
+ import { catchError, shareReplay as shareReplay$1, map } from 'rxjs/operators';
8
+ import * as uuid from 'uuid';
9
+ import * as signalR from '@microsoft/signalr';
10
+ import * as i1$2 from '@angular/common';
11
+ import { Location, CommonModule, NgComponentOutlet, NgTemplateOutlet, JsonPipe } from '@angular/common';
12
+ import * as bowser from 'bowser';
13
+ import * as i2$1 from 'primeng/api';
14
+ import { ConfirmationService, MessageService } from 'primeng/api';
15
+ import { DomSanitizer, HammerModule } from '@angular/platform-browser';
16
+ import * as i1$1 from '@angular/forms';
17
+ import { FormsModule } from '@angular/forms';
18
+ import * as i2 from 'primeng/skeleton';
19
+ import { SkeletonModule } from 'primeng/skeleton';
20
+ import * as i3 from 'ngx-order-pipe';
21
+ import { OrderModule } from 'ngx-order-pipe';
22
+ import { InputText, InputTextModule } from 'primeng/inputtext';
23
+ import { InputOtp } from 'primeng/inputotp';
24
+ import * as i3$1 from 'primeng/button';
25
+ import { ButtonModule } from 'primeng/button';
26
+ import { CardModule } from 'primeng/card';
27
+ import { StyleClassModule } from 'primeng/styleclass';
28
+ import * as i1$3 from 'primeng/toast';
29
+ import { ToastModule } from 'primeng/toast';
30
+ import * as i1$4 from 'primeng/drawer';
31
+ import { DrawerModule } from 'primeng/drawer';
32
+ import { RippleModule } from 'primeng/ripple';
33
+ import * as i2$2 from 'primeng/checkbox';
34
+ import { CheckboxModule } from 'primeng/checkbox';
35
+
36
+ class FlowAppConfig {
37
+ production;
38
+ application_id;
39
+ groupId;
40
+ client_id;
41
+ endpoints;
42
+ signalr_hubname;
43
+ identityserver_scopes;
44
+ defaultLanguage;
45
+ forceOrigin;
46
+ facebook;
47
+ google;
48
+ apple;
49
+ fbPixel;
50
+ }
51
+
52
+ class GlobalService {
53
+ onSuccess = new EventEmitter(false);
54
+ onError = new EventEmitter(false);
55
+ // environment = inject(FlowAppConfig)
56
+ showLoader = true;
57
+ currentLanguage = signal('RO', ...(ngDevMode ? [{ debugName: "currentLanguage" }] : [])); //this.environment.defaultLanguage;
58
+ currentEditLanguage = signal('RO', ...(ngDevMode ? [{ debugName: "currentEditLanguage" }] : [])); //this.environment.defaultLanguage;
59
+ datePickerOptions = { autoclose: true, forceParse: true, format: 'd.mm.yyyy', orientation: 'bottom left', weekStart: 1 };
60
+ timePickerOptions = { showMeridian: false, minuteStep: 15, showSeconds: false, showInputs: false, explicitMode: true };
61
+ ckEditorOptions;
62
+ banks = {
63
+ 'NBOR': 'BANCA NATIONALA A ROMANIEI',
64
+ 'ABNA': 'ABN AMRO BANK ROMANIA',
65
+ 'BUCU': 'ALPHA BANK ROMANIA SA',
66
+ 'ARBL': 'ANGLO ROMANIAN BANK LTD',
67
+ 'MIND': 'ATE BANK ROMANIA SA',
68
+ 'BPOS': 'BANC POST SA',
69
+ 'CARP': 'BANCA COMERCIALA CARPATICA SA',
70
+ 'RNCB': 'BANCA COMERCIALA ROMANA SA',
71
+ 'DARO': 'BANCA CR FIRENZE ROMANIA SA',
72
+ 'BROM': 'BANCA DI ROMA SPA ITALIA - SUCURSALA BUCURESTI',
73
+ 'BITR': 'BANCA ITALO ROMENA SPA',
74
+ 'BRDE': 'BANCA ROMANA PENTRU DEZVOLTARE',
75
+ 'BRMA': 'BANCA ROMANEASCA SA',
76
+ 'BTRL': 'BANCA TRANSILVANIA SA',
77
+ 'DAFB': 'BANK LEUMI ROMANIA SA',
78
+ 'MIRB': 'BLOM BANK EGYPT SAE EGYPT - SUCURSALA ROMANIA',
79
+ 'CECE': 'CASA DE ECONOMII SI CONSEMNATIUNI CEC SA',
80
+ 'CITI': 'CITIBANK ROMANIA SA',
81
+ 'CRCO': 'CREDIT COOP CASA CENTRALA',
82
+ 'FNNB': 'CREDIT EUROPE BANK (ROMANIA) SA',
83
+ 'EGNA': 'EGNATIA BANK (ROMANIA) SA',
84
+ 'BSEA': 'EMPORIKI BANK-ROMANIA SA',
85
+ 'EXIM': 'EXIMBANK ROMANIA',
86
+ 'UGBI': 'GARANTIBANK INTERNATIONAL NV - SUCURSALA ROMANIA',
87
+ 'HVBL': 'HVB BANCA PENTRU LOCUINTE',
88
+ 'INGB': 'ING BANK NV',
89
+ 'BREL': 'LIBRA BANK SA',
90
+ 'CRDZ': 'MKB ROMEXTERRA BANK SA',
91
+ 'OTPV': 'OTP BANK ROMANIA SA',
92
+ 'PIRB': 'PIRAEUS BANK ROMANIA SA',
93
+ 'PORL': 'PORSCHE BANK ROMANIA SA',
94
+ 'MIRO': 'PROCREDIT BANK',
95
+ 'RZBL': 'RAIFFEISEN BANCA PT LOCUINTE SA',
96
+ 'RZBR': 'RAIFFEISEN BANK SA',
97
+ 'ROIN': 'ROMANIAN INTERNATIONAL BANK SA',
98
+ 'WBAN': 'SANPAOLO IMI BANK ROMANIA SA',
99
+ 'TRFD': 'TRANSFOND SA',
100
+ 'TREZ': 'TREZORERIA STATULUI',
101
+ 'BACX': 'UNICREDIT TIRIAC BANK SA',
102
+ 'VBBU': 'VOLKSBANK ROMANIA SA',
103
+ };
104
+ loading = true;
105
+ sidebarOpen = false;
106
+ constructor() {
107
+ if (typeof CKEDITOR !== 'undefined')
108
+ this.ckEditorOptions = {
109
+ toolbarGroups: [
110
+ { name: 'clipboard', groups: ['clipboard', 'undo'] },
111
+ { name: 'links' },
112
+ { name: 'insert', groups: ['table', 'horizontalline', 'specialcharacters'] },
113
+ { name: 'forms' },
114
+ { name: 'tools' },
115
+ { name: 'document', groups: ['document', 'doctools'] },
116
+ { name: 'others' },
117
+ '/',
118
+ { name: 'basicstyles', groups: ['basicstyles', 'cleanup'] },
119
+ { name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'] },
120
+ { name: 'colors' },
121
+ ],
122
+ removeButtons: 'Underline,Subscript,Superscript',
123
+ enterMode: CKEDITOR.ENTER_BR,
124
+ // Set the most common block elements.
125
+ allowedContent: true,
126
+ // ALLOW <i></i>
127
+ protectedSource: [...CKEDITOR.config.protectedSource, /<i[^>]*><\/i>/g, /<a[^>]*><\/a>/g],
128
+ // Simplify the dialog windows.
129
+ height: 350,
130
+ ProcessHTMLEntities: false
131
+ };
132
+ }
133
+ checkPID2(pid) {
134
+ var pidLength = 13;
135
+ // se testeaza lungimea pid-ului
136
+ if (typeof (pid) != "string" || pid.length != pidLength) {
137
+ return false;
138
+ }
139
+ var controlValues = new Array(2, 7, 9, 1, 4, 6, 3, 5, 8, 2, 7, 9);
140
+ var divideValue = 11;
141
+ var sexValue = 0;
142
+ var monthValue = 0;
143
+ var yearValue = 0;
144
+ var dayValue = 0;
145
+ // se citeste valorea referitoare la sex si data de nastere
146
+ try {
147
+ sexValue = parseInt(pid.substring(0, 1), 10);
148
+ yearValue = parseInt(pid.substring(1, 3), 10);
149
+ if (sexValue == 1 || sexValue == 2 || sexValue > 6)
150
+ yearValue = 1900 + yearValue;
151
+ else if (sexValue == 3 || sexValue == 4)
152
+ yearValue = 1800 + yearValue;
153
+ else if (sexValue == 5 || sexValue == 6)
154
+ yearValue = 2000 + yearValue;
155
+ monthValue = parseInt(pid.substring(3, 5), 10);
156
+ if (monthValue < 1 && monthValue > 12) {
157
+ return false;
158
+ }
159
+ dayValue = parseInt(pid.substring(5, 7), 10);
160
+ if (dayValue < 0 && dayValue > 31) {
161
+ return false;
162
+ }
163
+ if (!this.checkDateInFutureForPID(pid)) {
164
+ return false;
165
+ }
166
+ }
167
+ catch (e) {
168
+ return false;
169
+ }
170
+ // se testeaza daca sexul e definit corect
171
+ if (sexValue == 0) {
172
+ return false;
173
+ }
174
+ // aleg secolul
175
+ var centuryValue = 19;
176
+ if (sexValue > 2 && sexValue < 5) {
177
+ centuryValue = 18;
178
+ }
179
+ else if (sexValue > 4) {
180
+ centuryValue = 20;
181
+ }
182
+ if (yearValue < 100)
183
+ yearValue += centuryValue * 100;
184
+ // definesc un vector cu numarul de zile ale fiecarei luni din anul yearValue
185
+ var daysInMonth = new Array(31, 28 + (((yearValue % 4 == 0 && yearValue % 100 != 0) || yearValue % 400 == 0) ? 1 : 0), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
186
+ // se testeaza daca data nasterii este corecta
187
+ if (monthValue * dayValue == 0 ||
188
+ monthValue > 12 ||
189
+ daysInMonth[monthValue - 1] < dayValue) {
190
+ return false;
191
+ }
192
+ // se testeaza cifra de control
193
+ var controlValue = 0;
194
+ for (var ind = 0; ind < controlValues.length; ind++) {
195
+ var nVal = parseInt(pid.charAt(ind), 10);
196
+ if (isNaN(nVal)) {
197
+ return false;
198
+ }
199
+ controlValue += nVal * controlValues[ind];
200
+ }
201
+ var resultValue = controlValue % divideValue;
202
+ if (resultValue == 10)
203
+ resultValue = 1;
204
+ if (resultValue != parseInt(pid.charAt(pidLength - 1), 10)) {
205
+ return false;
206
+ }
207
+ return true;
208
+ }
209
+ checkDateInFutureForPID(pid) {
210
+ var crtDate = new Date();
211
+ var sexValue = parseInt(pid.substring(0, 1), 10);
212
+ var yearValue = parseInt(pid.substring(1, 3), 10);
213
+ if (sexValue == 1 || sexValue == 2 || sexValue > 6)
214
+ yearValue = 1900 + yearValue;
215
+ else if (sexValue == 3 || sexValue == 4)
216
+ yearValue = 1800 + yearValue;
217
+ else if (sexValue == 5 || sexValue == 6)
218
+ yearValue = 2000 + yearValue;
219
+ var monthValue = parseInt(pid.substring(3, 5), 10);
220
+ var dayValue = parseInt(pid.substring(5, 7), 10);
221
+ var crtYear = crtDate.getFullYear();
222
+ if (crtYear < 1900)
223
+ crtYear += 1900;
224
+ if (yearValue > crtYear) {
225
+ return false;
226
+ }
227
+ else if (yearValue == crtDate.getFullYear()) {
228
+ if (monthValue > crtDate.getMonth() + 1) {
229
+ return false;
230
+ }
231
+ else if (monthValue == crtDate.getMonth() + 1) {
232
+ if (dayValue > crtDate.getDate()) {
233
+ return false;
234
+ }
235
+ }
236
+ }
237
+ return true;
238
+ }
239
+ //definitii de functii apelate
240
+ isValidIBAN2(iban) {
241
+ /*
242
+ Pasul 1: Se muta primele patru caractere (simbolizand codul de tara si caracterele de verificare) la dreapta codului IBAN.
243
+ Exemplu: RO49AAAA1B31007593840000 devine AAAA1B31007593840000RO49.
244
+
245
+ Pasul 2: Se face conversia literelor in numere, conform tabelei de conversie cuprinsa in Anexa nr. 2.
246
+ Exemplu: AAAA1B31007593840000RO49 devine 1010101011131007593840000272449
247
+
248
+ Pasul 3: Se aplica algoritmul MOD 97-10 (conform ISO 7064). Pentru ca cele 2 caractere de verificare sa fie corecte (codul IBAN sa fie corect), restul impartirii numarului astfel obtinut la 97 trebuie sa fie 1.
249
+ Exemplu: Restul impartirii lui 1010101011131007593840000272449 la 97 este 1.
250
+ */
251
+ if (!iban)
252
+ return false;
253
+ //iban ="RO23TREZ1315069XXX000497";
254
+ iban = iban.toUpperCase();
255
+ iban = iban.substring(4) + iban.substring(0, 4);
256
+ iban = this.convert2N(iban);
257
+ var mod97 = this.GetRemainder(String(iban), "97");
258
+ var valid = mod97 == 1 ? true : false;
259
+ if (!valid) {
260
+ return false;
261
+ }
262
+ return true;
263
+ }
264
+ convert2N(iban) {
265
+ var conversionArray = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
266
+ var caracter = "";
267
+ var newiban = "";
268
+ var flag = 0;
269
+ for (var i = 0; i < 24; i++) {
270
+ caracter = iban.substring(i, i + 1);
271
+ flag = 0;
272
+ for (var j = 0; j < 26; j++) {
273
+ if (caracter == conversionArray[j]) {
274
+ newiban = newiban + (j + 10);
275
+ j = 26;
276
+ flag = 1;
277
+ }
278
+ }
279
+ if (flag == 0)
280
+ newiban = newiban + caracter;
281
+ }
282
+ return newiban;
283
+ }
284
+ GetRemainder(x, y) {
285
+ var nr = x;
286
+ var len = nr.length;
287
+ var number = parseInt(y, 10);
288
+ var remainder = 0;
289
+ var ignore = 0;
290
+ var k = '';
291
+ while (ignore < len) {
292
+ if (remainder == 0) {
293
+ var w1 = y + ' ';
294
+ var w2 = w1.length - 1;
295
+ k = nr.slice(ignore, ignore + w2);
296
+ ignore += w2;
297
+ remainder = parseInt(remainder + k, 10) % number;
298
+ }
299
+ else {
300
+ k = nr.slice(ignore, ignore + 1);
301
+ ignore += 1;
302
+ remainder = parseInt(remainder + k, 10) % number;
303
+ }
304
+ }
305
+ return remainder;
306
+ }
307
+ hexToRgbA(hex, a) {
308
+ var c;
309
+ if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {
310
+ c = hex.substring(1).split('');
311
+ if (c.length == 3) {
312
+ c = [c[0], c[0], c[1], c[1], c[2], c[2]];
313
+ }
314
+ c = '0x' + c.join('');
315
+ return 'rgba(' + [(c >> 16) & 255, (c >> 8) & 255, c & 255].join(',') + ',' + a + ')';
316
+ }
317
+ throw new Error('Bad Hex');
318
+ }
319
+ formatString(str, ...val) {
320
+ for (let index = 0; index < val.length; index++) {
321
+ str = str.replace(`{${index}}`, val[index]);
322
+ }
323
+ return str;
324
+ }
325
+ replacer(key, value) {
326
+ // Filtering out properties
327
+ if (typeof value === 'string') {
328
+ return encodeURIComponent(value);
329
+ }
330
+ return value;
331
+ }
332
+ reviver(key, value) {
333
+ // Filtering out properties
334
+ if (typeof value === 'string') {
335
+ return decodeURIComponent(value);
336
+ }
337
+ return value;
338
+ }
339
+ stripHtml(originalString) {
340
+ let strippedString = originalString ? originalString.replace(/(<([^>]+)>)/gi, '') : '';
341
+ return strippedString;
342
+ }
343
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: GlobalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
344
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: GlobalService, providedIn: 'root' });
345
+ }
346
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: GlobalService, decorators: [{
347
+ type: Injectable,
348
+ args: [{
349
+ providedIn: 'root'
350
+ }]
351
+ }], ctorParameters: () => [] });
352
+
353
+ class FlowCookieService {
354
+ instanceId;
355
+ globalService = inject(GlobalService);
356
+ _gdprConsent;
357
+ get gdprConsent() {
358
+ if (!this._gdprConsent)
359
+ this._gdprConsent = this.get('GdprConsent');
360
+ return this._gdprConsent;
361
+ }
362
+ set gdprConsent(value) {
363
+ this._gdprConsent = value;
364
+ this.put('GdprConsent', value, null);
365
+ }
366
+ constructor() {
367
+ }
368
+ get(name) {
369
+ if (!localStorage.getItem(name))
370
+ return null;
371
+ let obj = null;
372
+ try {
373
+ obj = JSON.parse(localStorage.getItem(name), this.globalService.reviver);
374
+ }
375
+ catch {
376
+ this.put(name, localStorage.getItem(name));
377
+ return localStorage.getItem(name);
378
+ }
379
+ if (obj.expires && Date.parse(obj.expires) < Date.parse(new Date().toISOString())) {
380
+ localStorage.removeItem(name);
381
+ return null;
382
+ }
383
+ else
384
+ return obj.value;
385
+ }
386
+ remove(name) {
387
+ localStorage.removeItem(name);
388
+ }
389
+ put(name, value, exp = null) {
390
+ localStorage[name] = JSON.stringify({ value: value, expires: exp ? exp.toISOString() : null }, this.globalService.replacer);
391
+ }
392
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: FlowCookieService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
393
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: FlowCookieService, providedIn: 'root' });
394
+ }
395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: FlowCookieService, decorators: [{
396
+ type: Injectable,
397
+ args: [{
398
+ providedIn: 'root'
399
+ }]
400
+ }], ctorParameters: () => [] });
401
+
402
+ class FlowHttpClient {
403
+ http = inject(HttpClient);
404
+ cookieService = inject(FlowCookieService);
405
+ globalService = inject(GlobalService);
406
+ route = inject(ActivatedRoute);
407
+ router = inject(Router);
408
+ loading = 0;
409
+ environment = inject(FlowAppConfig);
410
+ pageLoadingComplete = new EventEmitter(false);
411
+ loadingSuccess = new EventEmitter(false);
412
+ pageLoadingStart = new EventEmitter(false);
413
+ loadingFailure = new EventEmitter(false);
414
+ _pageLoading = 0;
415
+ _spinLoading = 0;
416
+ set pageLoading(value) {
417
+ let changed = value != this.loading;
418
+ this.loading = value;
419
+ if ((this.recordPageLoading && value > this._pageLoading) || value < this._pageLoading) {
420
+ if (this._pageLoading == 0)
421
+ this.pageLoadingStart.emit();
422
+ this._pageLoading = value;
423
+ }
424
+ if (value <= 0) {
425
+ this.recordPageLoading = false;
426
+ this._pageLoading = 0;
427
+ this.pageLoadingComplete.emit();
428
+ }
429
+ if (this.loading <= 0 && changed)
430
+ this.loadingSuccess.emit();
431
+ }
432
+ get pageLoading() {
433
+ // if (this.globalService.browser.name=='Safari' && this.globalService.browser.version && parseInt(this.globalService.browser.version.substring(0,1)) < 9)
434
+ // return 0;
435
+ return this._pageLoading;
436
+ }
437
+ recordPageLoading = true;
438
+ onError = new EventEmitter(false);
439
+ _token;
440
+ get token() {
441
+ if (!this._token)
442
+ this._token = this.cookieService.get('auth_token');
443
+ return this._token;
444
+ }
445
+ set token(value) {
446
+ this.cookieService.remove('auth_token');
447
+ this._token = value;
448
+ if (value)
449
+ this.cookieService.put('auth_token', value);
450
+ }
451
+ constructor() {
452
+ this.route.queryParams.subscribe(r => {
453
+ if (r['auth_token']) {
454
+ this.token = r['auth_token'];
455
+ let obj = Object.assign({}, r);
456
+ obj['auth_token'] = null;
457
+ this.router.navigate([], { relativeTo: this.route, queryParams: obj, queryParamsHandling: 'merge' });
458
+ }
459
+ });
460
+ this.router.events.subscribe(event => {
461
+ if (event instanceof NavigationStart) {
462
+ this.recordPageLoading = true;
463
+ this.pageLoading++;
464
+ // jQuery("html, body").animate({ scrollTop: 0 }, 50);
465
+ }
466
+ if (event instanceof NavigationEnd || event instanceof NavigationCancel) {
467
+ timer(100).subscribe(r => this.pageLoading--);
468
+ }
469
+ });
470
+ }
471
+ get(endpoint, url, options, showLoader = true) {
472
+ if (showLoader)
473
+ this.pageLoading++;
474
+ options = this.createAuthHeader(options);
475
+ let retValue = this.http.get(endpoint + url, options)
476
+ .pipe(catchError((err, caught) => {
477
+ this.recordPageLoading = false;
478
+ this.pageLoading = 0;
479
+ this.onError.emit(err);
480
+ throw err;
481
+ }), shareReplay());
482
+ retValue
483
+ .subscribe(res => {
484
+ if (showLoader)
485
+ this.pageLoading--;
486
+ });
487
+ return retValue;
488
+ }
489
+ delete(endpoint, url, options, showLoader = false) {
490
+ this.pageLoading++;
491
+ options = this.createAuthHeader(options);
492
+ let retValue = this.http.delete(endpoint + url, options)
493
+ .pipe(catchError((err, caught) => {
494
+ this.recordPageLoading = false;
495
+ this.pageLoading = 0;
496
+ this.onError.emit(err);
497
+ throw err;
498
+ }), shareReplay());
499
+ retValue
500
+ .subscribe(res => {
501
+ this.pageLoading--;
502
+ });
503
+ return retValue;
504
+ }
505
+ post(endpoint, url, data, options, showLoader = true) {
506
+ this.pageLoading++;
507
+ options = this.createAuthHeader(options);
508
+ if (data !== null && !options.headers.get('Content-Type'))
509
+ options.headers = options.headers.set('Content-Type', 'application/json');
510
+ let retValue = this.http.post(endpoint + url, data, options)
511
+ .pipe(catchError((err, caught) => {
512
+ this.recordPageLoading = false;
513
+ this.pageLoading = 0;
514
+ this.onError.emit(err);
515
+ throw err;
516
+ }), shareReplay());
517
+ retValue
518
+ .subscribe(res => {
519
+ this.pageLoading--;
520
+ });
521
+ return retValue;
522
+ }
523
+ put(endpoint, url, data, options, showLoader = false) {
524
+ this.pageLoading++;
525
+ options = this.createAuthHeader(options);
526
+ if (data !== null && !options.headers.get('Content-Type'))
527
+ options.headers = options.headers.set('Content-Type', 'application/json');
528
+ let retValue = this.http.put(endpoint + url, data, options)
529
+ .pipe(catchError((err, caught) => {
530
+ this.recordPageLoading = false;
531
+ this.pageLoading = 0;
532
+ this.onError.emit(err);
533
+ throw err;
534
+ }), shareReplay());
535
+ retValue
536
+ .subscribe(res => {
537
+ this.pageLoading--;
538
+ });
539
+ return retValue;
540
+ }
541
+ createAuthHeader(options) {
542
+ if (!options)
543
+ options = {};
544
+ if (!options.headers) {
545
+ options.headers = new HttpHeaders({
546
+ 'Accept': 'application/json',
547
+ 'flow-language-code': this.globalService.currentLanguage(),
548
+ 'flow-edit-language-code': this.globalService.currentEditLanguage(),
549
+ });
550
+ }
551
+ else {
552
+ if (!options.headers.get('Accept'))
553
+ options.headers = options.headers.set('Accept', 'application/json');
554
+ if (!options.headers.get('flow-language-code') && !options.excludeExtraHeaders)
555
+ options.headers = options.headers.set('flow-language-code', this.globalService.currentLanguage());
556
+ }
557
+ if (this.token && !options.excludeExtraHeaders) {
558
+ options.headers = options.headers.set('Authorization', 'Bearer ' + this.token);
559
+ }
560
+ if (this.environment.forceOrigin && !options.excludeExtraHeaders) {
561
+ options.headers = options.headers.set('flow-origin', this.environment.forceOrigin);
562
+ }
563
+ return options;
564
+ }
565
+ serializeToQueryString(obj, prefix = null) {
566
+ var str = [], p;
567
+ for (p in obj) {
568
+ if (obj.hasOwnProperty(p) && obj[p]) {
569
+ var k = prefix && !isNaN(p) ? prefix + "[" + p + "]" : prefix && isNaN(p) ? prefix + "." + p : p, v = obj[p];
570
+ str.push((v !== null && typeof v === "object") ?
571
+ this.serializeToQueryString(v, k) :
572
+ encodeURIComponent(k) + "=" + encodeURIComponent(v));
573
+ }
574
+ }
575
+ return str.join("&");
576
+ }
577
+ serializeToQueryString2(obj) {
578
+ var str = [], p;
579
+ for (p in obj) {
580
+ if (obj.hasOwnProperty(p) && obj[p]) {
581
+ var k = !isNaN(p) ? "[" + p + "]" : isNaN(p) ? p : p, v = obj[p];
582
+ str.push((v !== null && typeof v === "object") ?
583
+ this.serializeToQueryString(v, k) :
584
+ encodeURIComponent(this.jsUcfirst(k)) + "=" + encodeURIComponent(v));
585
+ }
586
+ }
587
+ return str.join("&");
588
+ }
589
+ jsUcfirst(string) {
590
+ return string.charAt(0).toUpperCase() + string.slice(1);
591
+ }
592
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: FlowHttpClient, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
593
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: FlowHttpClient, providedIn: 'root' });
594
+ }
595
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: FlowHttpClient, decorators: [{
596
+ type: Injectable,
597
+ args: [{
598
+ providedIn: 'root'
599
+ }]
600
+ }], ctorParameters: () => [] });
601
+
602
+ class SidebarContext {
603
+ close;
604
+ _context = signal({}, ...(ngDevMode ? [{ debugName: "_context" }] : []));
605
+ set context(value) {
606
+ this._context.set(value);
607
+ }
608
+ get context() {
609
+ return this._context;
610
+ }
611
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SidebarContext, deps: [], target: i0.ɵɵFactoryTarget.Component });
612
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.6", type: SidebarContext, isStandalone: true, selector: "ng-component", inputs: { context: "context" }, ngImport: i0, template: ``, isInline: true });
613
+ }
614
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SidebarContext, decorators: [{
615
+ type: Component,
616
+ args: [{
617
+ template: ``
618
+ }]
619
+ }], propDecorators: { context: [{
620
+ type: Input
621
+ }] } });
622
+
623
+ class SidebarService {
624
+ router;
625
+ // public readonly router = inject(Router);
626
+ sidebars = signal([], ...(ngDevMode ? [{ debugName: "sidebars" }] : []));
627
+ constructor(router) {
628
+ this.router = router;
629
+ this.router.events.subscribe(event => {
630
+ if (event instanceof NavigationStart) {
631
+ this.closeSidebars();
632
+ }
633
+ });
634
+ }
635
+ openSidebar(component, data = null, options = {}) {
636
+ let defaultPosition = 'right';
637
+ if (window.innerWidth < 576) {
638
+ document.getElementsByTagName("html")[0].style['overscroll-behavior'] = 'none';
639
+ document.getElementsByTagName("body")[0].style['overscroll-behavior'] = 'none';
640
+ defaultPosition = 'bottom';
641
+ }
642
+ options.position = options.position || defaultPosition;
643
+ options.ngStyle = options.ngStyle || {};
644
+ if (options.position == 'right' || options.position == 'left') {
645
+ options.ngStyle.width = options.ngStyle.width || '400px';
646
+ options.ngStyle.height = null;
647
+ options.ngStyle['max-width'] = '95%';
648
+ options.contentScrollable = signal(true, ...(ngDevMode ? [{ debugName: "contentScrollable" }] : []));
649
+ }
650
+ if (options.position == 'top' || options.position == 'bottom') {
651
+ options.ngStyle.width = null;
652
+ options.ngStyle.height = options.ngStyle.height || '30%';
653
+ options.ngStyle['max-height'] = '95%';
654
+ options.contentScrollable = signal(false, ...(ngDevMode ? [{ debugName: "contentScrollable" }] : []));
655
+ if (options.ngStyle.height == '95%')
656
+ options.contentScrollable.set(true);
657
+ if (options.position == 'bottom') {
658
+ options.ngStyle['border-top-left-radius'] = 'var(--p-border-radius)';
659
+ options.ngStyle['border-top-right-radius'] = 'var(--p-border-radius)';
660
+ }
661
+ if (options.position == 'top') {
662
+ options.ngStyle['border-bottom-left-radius'] = 'var(--p-border-radius)';
663
+ options.ngStyle['border-bottom-right-radius'] = 'var(--p-border-radius)';
664
+ }
665
+ }
666
+ let obj = {
667
+ id: uuid.v4(),
668
+ component: component,
669
+ options: options,
670
+ visible: true
671
+ };
672
+ let pr = new Promise((resolve, reject) => {
673
+ if (component.prototype instanceof SidebarContext) {
674
+ obj.inputs = { context: { data: data } };
675
+ obj.inputs.context.close = (value) => {
676
+ resolve(value);
677
+ this.closeSidebar(obj.id);
678
+ };
679
+ obj.inputs.context.setSize = (value) => {
680
+ this.setSize(value, options);
681
+ };
682
+ }
683
+ });
684
+ this.sidebars.update(s => [...this.sidebars(), obj]);
685
+ return pr;
686
+ }
687
+ openIframeSidebar(url, width = '400px') {
688
+ }
689
+ closeSidebars() {
690
+ }
691
+ setSize(size, options) {
692
+ if (options.position == 'bottom' && size.height) {
693
+ options.ngStyle.transition = 'height .2s';
694
+ options.ngStyle.height = size.height;
695
+ if (size.height == '95%')
696
+ options.contentScrollable.set(true);
697
+ else
698
+ options.contentScrollable.set(false);
699
+ }
700
+ else if ((options.position == 'left' || options.position == 'right') && size.width) {
701
+ options.ngStyle.transition = 'width .2s';
702
+ options.ngStyle.width = size.width;
703
+ }
704
+ }
705
+ closeSidebar(id) {
706
+ this.sidebars.update(s => {
707
+ if (s.findIndex(a => !a.visible) >= 0)
708
+ s.splice(s.findIndex(a => !a.visible), 1);
709
+ let closee = s.find(a => a.id == id);
710
+ closee.visible = false;
711
+ if (s.findIndex(a => a.visible) < 0) {
712
+ document.getElementsByTagName("html")[0].style['overscroll-behavior'] = 'initial';
713
+ document.getElementsByTagName("body")[0].style['overscroll-behavior'] = 'initial';
714
+ }
715
+ return s;
716
+ });
717
+ }
718
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SidebarService, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
719
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SidebarService, providedIn: 'root' });
720
+ }
721
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SidebarService, decorators: [{
722
+ type: Injectable,
723
+ args: [{
724
+ providedIn: 'root'
725
+ }]
726
+ }], ctorParameters: () => [{ type: i1.Router }] });
727
+
728
+ class SortingPagingCriteria {
729
+ numberOfRecords = 30;
730
+ pageNumber = 1;
731
+ totalResults;
732
+ columnSortOrdersDefinition;
733
+ applySort(columnName) {
734
+ if (this.columnSortOrdersDefinition.columnName == columnName) {
735
+ this.columnSortOrdersDefinition.columnSortOrder = this.columnSortOrdersDefinition.columnSortOrder === 'Ascending' ? 'Descending' : 'Ascending';
736
+ }
737
+ else {
738
+ this.columnSortOrdersDefinition.columnName = columnName;
739
+ this.columnSortOrdersDefinition.columnSortOrder = 'Ascending';
740
+ }
741
+ }
742
+ }
743
+ class ColumnSortOrdersDefinition {
744
+ columnName;
745
+ columnSortOrder;
746
+ }
747
+
748
+ class SignalrNotificationService {
749
+ cookieService = inject(FlowCookieService);
750
+ userService = inject(UserAccountService);
751
+ httpClient = inject(FlowHttpClient);
752
+ activatedRoute = inject(ActivatedRoute);
753
+ router = inject(Router);
754
+ http = inject(FlowHttpClient);
755
+ translationService = inject(TranslationSharedService);
756
+ globalService = inject(GlobalService);
757
+ connection;
758
+ messages = [];
759
+ newMessage;
760
+ subscribedChannels = [];
761
+ onNotification = new EventEmitter(true);
762
+ connectionPromise;
763
+ unreadMessageCount = 0;
764
+ hasMorePages = false;
765
+ subscription;
766
+ environment = inject(FlowAppConfig);
767
+ onlineStatus = 'OFFLINE';
768
+ statusSubscription;
769
+ interval;
770
+ onConnected = new ReplaySubject();
771
+ onNotificationClick = new EventEmitter(true);
772
+ coordinates;
773
+ simInfo;
774
+ get mute() {
775
+ return this.cookieService.get('mute') == 'true';
776
+ }
777
+ ;
778
+ set mute(value) {
779
+ this.cookieService.put('mute', value ? 'true' : 'false');
780
+ }
781
+ ;
782
+ notificationArray = [
783
+ { name: 'pop', sound: null },
784
+ { name: 'marimba1', sound: null },
785
+ ];
786
+ constructor() {
787
+ this.getNotifications();
788
+ this.getConnection();
789
+ this.preloadSounds();
790
+ console.log('subscribing');
791
+ // this.platform.resume.subscribe(() => {
792
+ // console.log('resuming');
793
+ // this.getConnection();
794
+ // this.subscribePushChannels();
795
+ // });
796
+ this.userService.onUserLoggedIn.subscribe(async (res) => {
797
+ this.getNotifications();
798
+ await this.stopConnection();
799
+ await this.getConnection();
800
+ this.subscribePushChannels();
801
+ });
802
+ this.userService.onUserLoggedOut.subscribe(res => {
803
+ this.unsubscribePushChannels(res);
804
+ });
805
+ // this.platform.ready().then(p => {
806
+ // if (!window.cordova || !window.FirebasePlugin)
807
+ // return;
808
+ // window.FirebasePlugin.hasPermission((has) => {
809
+ // if (has) { this.initPushNotifications(); }
810
+ // else { window.FirebasePlugin.grantPermission(r => this.initPushNotifications()); }
811
+ // })
812
+ // });
813
+ }
814
+ initPushNotifications() {
815
+ window.FirebasePlugin.getToken();
816
+ window.FirebasePlugin.onMessageReceived(res => {
817
+ console.log(res);
818
+ });
819
+ var channel = {
820
+ id: "default",
821
+ sound: "correct"
822
+ };
823
+ window.FirebasePlugin.createChannel(channel);
824
+ }
825
+ subscribePushChannels() {
826
+ if (this.userService.currentUser.id && window.cordova && window.FirebasePlugin)
827
+ window.FirebasePlugin.subscribe(`${this.environment.application_id}${this.environment.production ? '' : '--debug'}--${this.environment.client_id.replace('::', '~')}--${this.userService.currentUser.id}`);
828
+ }
829
+ unsubscribePushChannels(user) {
830
+ if (user.id && window.cordova && window.FirebasePlugin)
831
+ window.FirebasePlugin.unsubscribe(`${this.environment.application_id}${this.environment.production ? '' : '--debug'}--${this.environment.client_id.replace('::', '~')}--${user.id}`);
832
+ }
833
+ async getConnection() {
834
+ console.log('Getting SignalR connection');
835
+ console.log(this.onlineStatus);
836
+ if (this.interval)
837
+ this.interval.unsubscribe();
838
+ if (this.onlineStatus == 'ONLINE')
839
+ return;
840
+ // let options =
841
+ // {
842
+ // headers: {
843
+ // 'Authorization': `Bearer ${this.httpClient.token}`
844
+ // }
845
+ // };
846
+ this.connection = new signalR.HubConnectionBuilder()
847
+ .configureLogging(signalR.LogLevel.Information)
848
+ .withUrl(`${this.environment.endpoints['NotificationServer']}/SignalRNotificationHub?auth_token=${this.httpClient.token}`)
849
+ .build();
850
+ try {
851
+ await this.connection.start();
852
+ this.onlineStatus = 'ONLINE';
853
+ }
854
+ catch {
855
+ this.onlineStatus = 'OFFLINE';
856
+ console.log({ onlineStatus: this.onlineStatus });
857
+ this.interval = timer(5000).subscribe(async () => await this.getConnection());
858
+ return;
859
+ }
860
+ console.log({ onlineStatus: this.onlineStatus });
861
+ this.connection.onclose(async () => {
862
+ this.onlineStatus = 'OFFLINE';
863
+ console.log({ onClose: this.onlineStatus });
864
+ this.interval = timer(5000).subscribe(async () => await this.getConnection());
865
+ });
866
+ // this.connection.onreconnected(() =>{
867
+ // this.onlineStatus='ONLINE';
868
+ // console.log({ onReconnect: this.onlineStatus });
869
+ // });
870
+ if (this.onlineStatus == 'ONLINE') {
871
+ if (this.statusSubscription)
872
+ this.statusSubscription.unsubscribe();
873
+ await this.sendCurrentStatus();
874
+ this.statusSubscription = this.router.events.subscribe(async (ev) => {
875
+ if (ev instanceof NavigationEnd)
876
+ await this.sendCurrentStatus();
877
+ });
878
+ }
879
+ if (this.subscription)
880
+ this.subscription.unsubscribe();
881
+ this.subscription = this.connection.on('messageReceived', (msg, u) => {
882
+ let m = JSON.parse(msg);
883
+ this.onNotification.emit(m);
884
+ if (m.hideInToaster || this.mute)
885
+ return;
886
+ //here
887
+ this.messages.push(m);
888
+ this.unreadMessageCount++;
889
+ this.playSound(m.sound);
890
+ });
891
+ }
892
+ processReplacements(text, strObj, prefix = 'model') {
893
+ let obj = JSON.parse(strObj);
894
+ let replacements = this.buildReplacementsArray(obj, prefix);
895
+ replacements.forEach(element => {
896
+ text = text.replace(`{{${element.query}}}`, element.value);
897
+ });
898
+ return text;
899
+ }
900
+ preloadSounds() {
901
+ this.notificationArray.forEach(s => {
902
+ s.sound = new Audio();
903
+ s.sound.src = `../assets/audio/${s.name}.mp3`;
904
+ s.sound.load();
905
+ });
906
+ }
907
+ async stopConnection() {
908
+ console.log('stopping connection');
909
+ this.onlineStatus = 'OFFLINE';
910
+ if (this.interval && this.interval.unsubscribe) {
911
+ this.interval.unsubscribe();
912
+ this.interval = null;
913
+ }
914
+ if (this.connection)
915
+ await this.connection.stop();
916
+ }
917
+ playSound(name) {
918
+ if (!this.mute && name) {
919
+ let snd = this.notificationArray.find(n => n.name == name);
920
+ if (snd && snd.sound)
921
+ snd.sound.play();
922
+ }
923
+ }
924
+ buildReplacementsArray(obj, prefix = 'model') {
925
+ var str = [], p;
926
+ for (p in obj) {
927
+ if (obj.hasOwnProperty(p)) {
928
+ var k = prefix && !isNaN(p) ? prefix + "[" + p + "]" : prefix && isNaN(p) ? prefix + "." + p : p, v = obj[p];
929
+ str.push((v !== null && typeof v === "object") ?
930
+ this.buildReplacementsArray(v, k) :
931
+ { query: k, value: v });
932
+ }
933
+ }
934
+ return str;
935
+ }
936
+ messagePageNo = 1;
937
+ // async updateDeviceStatus() {
938
+ // this.coordinates = await this.geolocation.getCurrentPosition({ timeout: 30000 }).catch(err => {
939
+ // console.log(err);
940
+ // throw err;
941
+ // });
942
+ // }
943
+ async sendCurrentStatus() {
944
+ await this.userService.getCurrentUser().toPromise();
945
+ let objSettings = {
946
+ ApplicationId: this.environment.application_id,
947
+ ClientId: this.environment.client_id,
948
+ // BrowserName: this.browser.getBrowser().name, // "Microsoft Edge"
949
+ // BrowserVersion: this.browser.getBrowser().version, //114.0.1823.79
950
+ Route: window.location.pathname + window.location.search, // /access
951
+ Host: window.location.host,
952
+ User: this.userService.currentUser.id ? this.userService.currentUser : null, //{roles: Array(0)}
953
+ //Id: this.instanceId, //"372d46d4-a48a-2ca9-c29a-acdeee6798ef"
954
+ Language: this.globalService.currentLanguage(), // desktop
955
+ // Lat: this.coordinates ? this.coordinates.coords.latitude : null, //null
956
+ // Lng: this.coordinates ? this.coordinates.coords.longitutde : null, //null
957
+ NetworkOperator: this.simInfo ? this.simInfo.carrierName : null,
958
+ // OsName: this.browser.getOS().name, //Windows
959
+ // OsVersion: this.browser.getOS().version, //NT 10.0
960
+ // PlatformType: this.browser.getPlatformType(),
961
+ // ScreenH: this.platform.height(), //721
962
+ // ScreenW: this.platform.width(), //1026
963
+ // Version: packageInfo.version,
964
+ };
965
+ await this.connection.send('SendStatus', objSettings);
966
+ }
967
+ //offline?
968
+ getNotifications() {
969
+ let spc = new SortingPagingCriteria();
970
+ spc.pageNumber = this.messagePageNo;
971
+ let obs = this.httpClient.get(this.environment.endpoints['NotificationServer'], `/api/services/app/NotificationService/GetNotifications?${this.httpClient.serializeToQueryString(spc, 'spc')}`, null, false);
972
+ obs.subscribe(res => {
973
+ if (res.result.type !== 'error') {
974
+ if (this.messagePageNo == 1) {
975
+ this.messages = this.messages.filter(m => !m.saveToDb);
976
+ }
977
+ this.messages = this.messages.concat(res.result.notifications);
978
+ this.unreadMessageCount = res.result.unreadMessageCount;
979
+ this.hasMorePages = res.result.hasMorePages;
980
+ }
981
+ });
982
+ return obs;
983
+ }
984
+ setReadReceipt() {
985
+ this.unreadMessageCount = 0;
986
+ return this.httpClient.get(this.environment.endpoints['NotificationServer'], '/api/services/app/NotificationService/SetReadReceipt');
987
+ }
988
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SignalrNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
989
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SignalrNotificationService, providedIn: 'root' });
990
+ }
991
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SignalrNotificationService, decorators: [{
992
+ type: Injectable,
993
+ args: [{
994
+ providedIn: 'root'
995
+ }]
996
+ }], ctorParameters: () => [] });
997
+
998
+ class ApplicationSharedService {
999
+ environment = inject(FlowAppConfig);
1000
+ http = inject(FlowHttpClient);
1001
+ constructor() { }
1002
+ endpointObs;
1003
+ allowedApplications = [];
1004
+ _currentApplication = {};
1005
+ get endpoints() {
1006
+ return this.environment.endpoints;
1007
+ }
1008
+ get currentApplication() {
1009
+ return this._currentApplication;
1010
+ }
1011
+ set currentApplication(value) {
1012
+ this._currentApplication = value;
1013
+ }
1014
+ getAdminClients() {
1015
+ return this.http.get(this.endpoints['IdentityServer'], `/clients/getadminclients`);
1016
+ }
1017
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ApplicationSharedService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1018
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ApplicationSharedService, providedIn: 'root' });
1019
+ }
1020
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ApplicationSharedService, decorators: [{
1021
+ type: Injectable,
1022
+ args: [{
1023
+ providedIn: 'root'
1024
+ }]
1025
+ }], ctorParameters: () => [] });
1026
+
1027
+ class TranslationSharedService {
1028
+ translationsLoaded = signal(false, ...(ngDevMode ? [{ debugName: "translationsLoaded" }] : []));
1029
+ onLanguageChanged = new EventEmitter(true);
1030
+ onEditLanguageChanged = new EventEmitter(true);
1031
+ onTranslationsLoaded = new EventEmitter(true);
1032
+ onSetCountryProvinceCity = new EventEmitter(true);
1033
+ environment = inject(FlowAppConfig);
1034
+ http = inject(FlowHttpClient);
1035
+ applicationService = inject(ApplicationSharedService);
1036
+ globalService = inject(GlobalService);
1037
+ cookieService = inject(FlowCookieService);
1038
+ translations = signal({}, ...(ngDevMode ? [{ debugName: "translations" }] : []));
1039
+ languages = signal([], ...(ngDevMode ? [{ debugName: "languages" }] : []));
1040
+ countries = signal([], ...(ngDevMode ? [{ debugName: "countries" }] : []));
1041
+ editContent = signal(false, ...(ngDevMode ? [{ debugName: "editContent" }] : []));
1042
+ translationObs;
1043
+ countryProvinceCityPlaceholder = [];
1044
+ get endpoint() {
1045
+ return this.environment.endpoints['TranslationServer'];
1046
+ }
1047
+ get currentLanguage() {
1048
+ let value = this.cookieService.get('language');
1049
+ if (value)
1050
+ this.globalService.currentLanguage = value;
1051
+ return this.globalService.currentLanguage;
1052
+ }
1053
+ set currentLanguage(value) {
1054
+ if (!value)
1055
+ return;
1056
+ let languageChanged = false;
1057
+ if (this.globalService.currentLanguage != value)
1058
+ languageChanged = true;
1059
+ this.globalService.currentLanguage = value;
1060
+ this.cookieService.put('language', value);
1061
+ if (languageChanged) {
1062
+ this.onLanguageChanged.emit(value);
1063
+ this.getTranslations(true).subscribe(() => { });
1064
+ }
1065
+ }
1066
+ // public get currentEditLanguage() {
1067
+ // let value = this.cookieService.get('edit-language');
1068
+ // if (value)
1069
+ // this.globalService._currentEditLanguage = value;
1070
+ // return this.globalService._currentEditLanguage;
1071
+ // }
1072
+ // public set currentEditLanguage(value) {
1073
+ // if (!value)
1074
+ // return;
1075
+ // this.http.recordPageLoading = true;
1076
+ // let languageChanged = false;
1077
+ // if (this.globalService._currentEditLanguage != value)
1078
+ // languageChanged = true;
1079
+ // this.globalService._currentEditLanguage = value;
1080
+ // this.cookieService.put('edit-language', value);
1081
+ // if (languageChanged) {
1082
+ // this.onEditLanguageChanged.emit(value);
1083
+ // }
1084
+ // }
1085
+ get currentLanguageObj() {
1086
+ if (this.languages && this.languages[this.globalService.currentLanguage()])
1087
+ return this.languages[this.globalService.currentLanguage()];
1088
+ else
1089
+ return {};
1090
+ }
1091
+ constructor() {
1092
+ console.log('constructing translations');
1093
+ this.getTranslations(true).subscribe(() => { });
1094
+ this.getCountries().subscribe(() => { });
1095
+ this.getLanguages().subscribe(() => { });
1096
+ this.getLocalization();
1097
+ }
1098
+ getTranslations(force = true) {
1099
+ if (this.translationsLoaded() && !force)
1100
+ return of(this.translations);
1101
+ if (this.translationObs && !force)
1102
+ return this.translationObs;
1103
+ if (localStorage['translations']) {
1104
+ try {
1105
+ this.translations.set(JSON.parse(localStorage['translations']));
1106
+ }
1107
+ catch { }
1108
+ this.translationsLoaded.set(true);
1109
+ }
1110
+ this.translationObs = this.http.get(this.endpoint, `/api/services/app/TranslationClientService/GetTranslations?applicationId=${encodeURIComponent(this.environment.application_id)}&languageCode=${this.globalService.currentLanguage()}&groupId=${this.environment.groupId}`)
1111
+ .pipe(catchError(err => {
1112
+ console.log('Error loading translations');
1113
+ return of([]);
1114
+ }), tap(res => {
1115
+ this.translations.set(res.result);
1116
+ this.translationsLoaded.set(true);
1117
+ this.onTranslationsLoaded.emit();
1118
+ localStorage['translations'] = JSON.stringify(this.translations());
1119
+ this.translationObs = null;
1120
+ }));
1121
+ return this.translationObs;
1122
+ }
1123
+ getLanguages() {
1124
+ let obs = this.http.get(this.endpoint, `/api/services/app/LanguageClientService/GetLanguages?applicationId=${this.environment.application_id}`)
1125
+ .pipe(catchError(err => {
1126
+ console.log('Error loading translations');
1127
+ return of([]);
1128
+ }), tap(res => {
1129
+ if (!(res instanceof HttpErrorResponse))
1130
+ this.languages.set(res.result);
1131
+ }));
1132
+ return obs;
1133
+ }
1134
+ quickSaveHtmlContent(name, content) {
1135
+ let obs = this.http.post(this.endpoint, `/api/services/app/TranslationAdminService/QuickSave`, { name: name, value: content, languageCode: this.globalService.currentLanguage(), groupName: this.environment.groupId });
1136
+ return obs;
1137
+ }
1138
+ getCountries() {
1139
+ let obs = this.http.get(this.endpoint, `/api/services/app/CountryService/GetCountries`)
1140
+ .pipe(tap(res => {
1141
+ this.countries.set(res.result);
1142
+ }), catchError(err => {
1143
+ return of({});
1144
+ }));
1145
+ return obs;
1146
+ }
1147
+ getCountry(code) {
1148
+ return this.countries().filter(c => c.code == code)[0];
1149
+ }
1150
+ getHtmlContentByUrl(url) {
1151
+ return this.http.get(this.endpoint, `/api/services/app/TranslationClientService/GetContentPage?applicationId=${encodeURIComponent(this.environment.application_id)}&url=${encodeURIComponent(url)}&languageCode=${this.globalService.currentLanguage()}`);
1152
+ }
1153
+ getLocalization() {
1154
+ if (this.cookieService.get('localization'))
1155
+ return of(JSON.parse(this.cookieService.get('localization')));
1156
+ else {
1157
+ let obs = this.http.get(this.endpoint, `/api/services/app/LocalizationService/GetWithClientIp`).pipe(tap(res => this.cookieService.put('localization', JSON.stringify(res))));
1158
+ return obs;
1159
+ }
1160
+ }
1161
+ getCountryCityPlaceholder(correlation) {
1162
+ return this.countryProvinceCityPlaceholder[correlation];
1163
+ }
1164
+ setCountryCityPlaceholder(correlation, value) {
1165
+ var context = this.countryProvinceCityPlaceholder[correlation];
1166
+ context.update(ctx => {
1167
+ let result = {
1168
+ ...ctx,
1169
+ countryCode: value.countryCode,
1170
+ currentCountry: this.countries().find(c => c.code == value.countryCode),
1171
+ city: value.city
1172
+ };
1173
+ if (value.provinceCode) {
1174
+ ctx.currentProvince = this.countryProvinceCityPlaceholder[correlation].currentCountry.provinces.find(p => p.code == value.provinceCode);
1175
+ ctx.provinceCode = ctx.currentProvince.code;
1176
+ ctx.provinceName = ctx.currentProvince.name;
1177
+ }
1178
+ else {
1179
+ ctx.currentProvince = null;
1180
+ ctx.provinceCode = null;
1181
+ ctx.provinceName = value.provinceName;
1182
+ }
1183
+ });
1184
+ }
1185
+ validateCountryProvinceCity(correlation) {
1186
+ this.countryProvinceCityPlaceholder[correlation] = this.countryProvinceCityPlaceholder[correlation] || {};
1187
+ let countryProvinceCity = this.countryProvinceCityPlaceholder[correlation];
1188
+ countryProvinceCity.countryError = false;
1189
+ countryProvinceCity.provinceError = false;
1190
+ countryProvinceCity.cityError = false;
1191
+ if (!countryProvinceCity.countryCode) {
1192
+ countryProvinceCity.countryError = true;
1193
+ }
1194
+ if (!countryProvinceCity.provinceName) {
1195
+ countryProvinceCity.provinceError = true;
1196
+ }
1197
+ if (!countryProvinceCity.city) {
1198
+ countryProvinceCity.cityError = true;
1199
+ }
1200
+ }
1201
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TranslationSharedService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1202
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TranslationSharedService, providedIn: 'root' });
1203
+ }
1204
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TranslationSharedService, decorators: [{
1205
+ type: Injectable,
1206
+ args: [{
1207
+ providedIn: 'root'
1208
+ }]
1209
+ }], ctorParameters: () => [] });
1210
+
1211
+ class UserAccountService {
1212
+ cookieService = inject(FlowCookieService);
1213
+ http = inject(FlowHttpClient);
1214
+ router = inject(Router);
1215
+ location = inject(Location);
1216
+ route = inject(ActivatedRoute);
1217
+ sidebarService = inject(SidebarService);
1218
+ globalService = inject(GlobalService);
1219
+ environment = inject(FlowAppConfig);
1220
+ currentUser = { claims: [] };
1221
+ _redirectTo;
1222
+ source;
1223
+ logoutTimer;
1224
+ get browser() {
1225
+ return bowser.default.getParser(window.navigator.userAgent);
1226
+ }
1227
+ get redirectTo() {
1228
+ if (!this._redirectTo)
1229
+ this._redirectTo = this.cookieService.get('redirectTo');
1230
+ return this._redirectTo;
1231
+ }
1232
+ set redirectTo(value) {
1233
+ this._redirectTo = value;
1234
+ if (!value)
1235
+ this.cookieService.remove('redirectTo');
1236
+ else
1237
+ this.cookieService.put('redirectTo', value);
1238
+ }
1239
+ // public set loginUser(userAccount){
1240
+ // this.cookieService.put('userAccount', value);
1241
+ // }
1242
+ authError;
1243
+ onUserLoggedIn = new EventEmitter(false);
1244
+ onUserLoggedOut = new EventEmitter(false);
1245
+ onAccessRefused = new EventEmitter(false);
1246
+ lastRouteAddress;
1247
+ accessRefused;
1248
+ // public timer: TimerDirective;
1249
+ get token() {
1250
+ return this.cookieService.get('auth_token');
1251
+ }
1252
+ onFocus(event) {
1253
+ this.setLogOutTimer();
1254
+ }
1255
+ constructor() {
1256
+ this.router.events.subscribe((res) => {
1257
+ if (res instanceof NavigationStart) {
1258
+ this.lastRouteAddress = res.url;
1259
+ }
1260
+ });
1261
+ this.route.queryParams.subscribe(res => {
1262
+ if (res['tkk'])
1263
+ this.processLoginToken(res['tkk']);
1264
+ });
1265
+ }
1266
+ currentUserObs;
1267
+ getCurrentUser(force = false) {
1268
+ if (this.currentUserObs)
1269
+ return this.currentUserObs;
1270
+ if ((this.http.token && !this.currentUser.id) || force) {
1271
+ this.currentUserObs = this.getCurrentUserDetails(force).pipe(shareReplay$1());
1272
+ ;
1273
+ this.currentUserObs.subscribe(res => {
1274
+ if (res.result.status == 'valid')
1275
+ this.currentUser = res.result.user;
1276
+ else
1277
+ this.logout();
1278
+ this.currentUserObs = null;
1279
+ if (this.currentUser.id)
1280
+ this.setLogOutTimer();
1281
+ });
1282
+ return this.currentUserObs;
1283
+ }
1284
+ else {
1285
+ return of(this.currentUser);
1286
+ }
1287
+ }
1288
+ processLoginResponse(res) {
1289
+ if (res.response == 'fill_data') {
1290
+ this.http.token = res.token;
1291
+ }
1292
+ if (res.response == 'logged_in') {
1293
+ console.log(res);
1294
+ this.http.token = res.token;
1295
+ this.currentUser = res.userAccount;
1296
+ this.cookieService.put('userAccount', JSON.stringify({ firstName: res.userAccount.firstName, lastName: res.userAccount.lastName, email: res.userAccount.email }));
1297
+ this.onUserLoggedIn.emit(res.userAccount);
1298
+ this.setLogOutTimer();
1299
+ }
1300
+ }
1301
+ processLoginToken(tkk) {
1302
+ return this.http.get(this.environment.endpoints['IdentityServer'], `/api/services/app/IdentityService/ProcessLoginToken?t=${encodeURIComponent(tkk)}`).subscribe(res => {
1303
+ if (res.result.type == 'TOKEN') {
1304
+ this.processOtpToken(res.result);
1305
+ }
1306
+ });
1307
+ }
1308
+ processOtpToken(result) {
1309
+ this.http.token = result.authToken;
1310
+ this.currentUser = result.user;
1311
+ this.onUserLoggedIn.emit({ action: result.action, user: this.currentUser });
1312
+ this.setLogOutTimer();
1313
+ }
1314
+ getOtp(model) {
1315
+ model.os = this.browser.getOS().name;
1316
+ model.osVersion = this.browser.getOS().versionName;
1317
+ model.userAgent = `${this.browser.getBrowser().name} ${this.browser.getBrowser().version}`;
1318
+ return this.http.post(this.environment.endpoints['IdentityServer'], `api/services/app/IdentityService/GetOtp`, model);
1319
+ }
1320
+ resendOtp(model) {
1321
+ model.os = this.browser.getOS().name;
1322
+ model.osVersion = this.browser.getOS().versionName;
1323
+ model.userAgent = `${this.browser.getBrowser().name} ${this.browser.getBrowser().version}`;
1324
+ return this.http.post(this.environment.endpoints['IdentityServer'], `api/services/app/IdentityService/ResendOtp`, model);
1325
+ }
1326
+ verifyOtp(model) {
1327
+ return this.http.post(this.environment.endpoints['IdentityServer'], `api/services/app/IdentityService/VerifyOtp`, model);
1328
+ }
1329
+ saveUserProfile(model) {
1330
+ return this.http.post(this.environment.endpoints['IdentityServer'], `api/services/app/IdentityService/SaveUserProfileAndLogin
1331
+ `, model);
1332
+ }
1333
+ getCurrentUserDetails(force = false) {
1334
+ if (!this.currentUser.id || force) {
1335
+ let obs2;
1336
+ let obs = this.http
1337
+ .get(this.environment.endpoints['IdentityServer'], '/api/services/app/IdentityService/GetTokenModel')
1338
+ .pipe(shareReplay$1());
1339
+ return obs;
1340
+ }
1341
+ else {
1342
+ return of(this.currentUser);
1343
+ }
1344
+ }
1345
+ logout(returnUrl = null) {
1346
+ this.cookieService.remove("op_token");
1347
+ let headers = new HttpHeaders();
1348
+ let loggedOutUser = this.currentUser;
1349
+ headers = headers.append('Content-Type', 'application/x-www-form-urlencoded');
1350
+ let postObj = { token: this.token, client_id: this.environment.client_id };
1351
+ this.cookieService.remove('auth_token');
1352
+ // this.http.post(this.environment.endpoints['IdentityServer'], '/connect/revocation', this.http.serializeToQueryString(postObj), { headers: headers } );
1353
+ this.currentUser = { claims: [] };
1354
+ this.currentUserObs = null;
1355
+ this.http.token = null;
1356
+ this.onUserLoggedOut.emit(loggedOutUser);
1357
+ }
1358
+ getDecodedAccessToken(token) {
1359
+ let arrSplit = token.split('|');
1360
+ return { token: arrSplit[0], exp: arrSplit.length > 1 ? arrSplit[1] : null };
1361
+ }
1362
+ setLogOutTimer() {
1363
+ let tokenInfo = this.getDecodedAccessToken(this.token);
1364
+ if (!tokenInfo.exp)
1365
+ return;
1366
+ let expireDate = moment.unix(tokenInfo.exp);
1367
+ let currentDate = moment();
1368
+ let timeOut = expireDate.diff(currentDate);
1369
+ if (timeOut < 0)
1370
+ this.logout();
1371
+ if (this.logoutTimer) {
1372
+ this.logoutTimer.unsubscribe();
1373
+ this.logoutTimer = null;
1374
+ }
1375
+ this.logoutTimer = timer(timeOut).subscribe(res => {
1376
+ this.logout();
1377
+ });
1378
+ }
1379
+ userHasPermission(perm) {
1380
+ return this.currentUser.permissions && this.currentUser.permissions.includes(perm);
1381
+ }
1382
+ checkCurentUserClaims(route) {
1383
+ let obs = this.getCurrentUser(!this.currentUser.id);
1384
+ return obs.pipe(map((result) => {
1385
+ let retValue = !route.data.permissions; //currentRouteConfig.canActivate.length > 0;
1386
+ if (!route.data.permissions || !this.currentUser.id)
1387
+ return retValue;
1388
+ if (route.data.permissions && route.data.permissions.length == 0 && this.currentUser.id)
1389
+ return true;
1390
+ console.log(result);
1391
+ route.data.permissions.forEach(x => {
1392
+ retValue = retValue || (result?.permissions?.indexOf(x) >= 0);
1393
+ });
1394
+ if (!retValue) {
1395
+ this.redirectTo = window.location.pathname + window.location.search;
1396
+ if (result)
1397
+ this.authError = 'Nu aveti suficiente drepturi pentru a accesa pagina dorita';
1398
+ }
1399
+ else {
1400
+ this.authError = undefined;
1401
+ }
1402
+ return retValue ? true : false;
1403
+ }));
1404
+ }
1405
+ requestLoginNameChange(model) {
1406
+ return this.http.post(this.environment.endpoints['IdentityServer'], '/api/services/app/IdentityService/RequestLoginNameChange', model);
1407
+ }
1408
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: UserAccountService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1409
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: UserAccountService, providedIn: 'root' });
1410
+ }
1411
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: UserAccountService, decorators: [{
1412
+ type: Injectable,
1413
+ args: [{
1414
+ providedIn: 'root'
1415
+ }]
1416
+ }], ctorParameters: () => [], propDecorators: { onFocus: [{
1417
+ type: HostListener,
1418
+ args: ['window:focus', ['$event']]
1419
+ }] } });
1420
+
1421
+ // The work of the pipe is handled in the tranform method with our pipe's class
1422
+ class TranslationPipe {
1423
+ constructor() { }
1424
+ transform(value, htmlContentList) {
1425
+ return htmlContentList && htmlContentList[value] ? htmlContentList[value] : value;
1426
+ }
1427
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TranslationPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1428
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.1.6", ngImport: i0, type: TranslationPipe, isStandalone: true, name: "translation" });
1429
+ }
1430
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TranslationPipe, decorators: [{
1431
+ type: Pipe,
1432
+ args: [{
1433
+ name: 'translation',
1434
+ standalone: true
1435
+ }]
1436
+ }], ctorParameters: () => [] });
1437
+
1438
+ // The work of the pipe is handled in the tranform method with our pipe's class
1439
+ class SumPipe {
1440
+ constructor() { }
1441
+ transform(value, member) {
1442
+ let result = 0;
1443
+ value.forEach(t => result += parseFloat(t[member]));
1444
+ return result;
1445
+ }
1446
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SumPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1447
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.1.6", ngImport: i0, type: SumPipe, isStandalone: true, name: "sum" });
1448
+ }
1449
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SumPipe, decorators: [{
1450
+ type: Pipe,
1451
+ args: [{
1452
+ name: 'sum'
1453
+ }]
1454
+ }], ctorParameters: () => [] });
1455
+
1456
+ // import { ConfirmDialogModule } from 'primeng/confirmdialog';
1457
+ // import { Modal, BSModalContext } from 'ngx-modialog-7/plugins/bootstrap';
1458
+ // import { overlayConfigFactory } from 'ngx-modialog-7';
1459
+ class ModalService {
1460
+ translationService = inject(TranslationSharedService);
1461
+ // modal = inject(DialogModule);
1462
+ confirmationService = inject(ConfirmationService);
1463
+ messageService = inject(MessageService);
1464
+ constructor() { }
1465
+ openConfirm(trans) {
1466
+ this.confirmationService.confirm({
1467
+ header: new TranslationPipe().transform(`${trans}.title`, this.translationService.translations),
1468
+ message: new TranslationPipe().transform(`${trans}.body`, this.translationService.translations),
1469
+ icon: undefined,
1470
+ acceptIcon: "none",
1471
+ rejectIcon: "none",
1472
+ rejectButtonStyleClass: "p-button-text",
1473
+ acceptLabel: new TranslationPipe().transform(`ok`, this.translationService.translations),
1474
+ rejectLabel: new TranslationPipe().transform(`cancel`, this.translationService.translations),
1475
+ accept: () => {
1476
+ console.log('Dialog closed');
1477
+ },
1478
+ // accept: () => {
1479
+ // this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'You have accepted' });
1480
+ // },
1481
+ // reject: () => {
1482
+ // this.messageService.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected', life: 3000 });
1483
+ // }
1484
+ });
1485
+ }
1486
+ openAlert(trans) {
1487
+ this.confirmationService.confirm({
1488
+ header: new TranslationPipe().transform(`${trans}.title`, this.translationService.translations),
1489
+ message: new TranslationPipe().transform(`${trans}.body`, this.translationService.translations),
1490
+ acceptIcon: "none",
1491
+ rejectIcon: "none",
1492
+ rejectButtonStyleClass: "p-button-text",
1493
+ acceptVisible: true,
1494
+ rejectVisible: false,
1495
+ acceptLabel: new TranslationPipe().transform(`ok`, this.translationService.translations)
1496
+ });
1497
+ }
1498
+ openRawAlert(titleText, bodyText) {
1499
+ this.confirmationService.confirm({
1500
+ message: bodyText,
1501
+ acceptIcon: "none",
1502
+ rejectIcon: "none",
1503
+ rejectButtonStyleClass: "p-button-text",
1504
+ acceptVisible: true,
1505
+ rejectVisible: false,
1506
+ acceptLabel: new TranslationPipe().transform(`ok`, this.translationService.translations)
1507
+ });
1508
+ }
1509
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1510
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ModalService, providedIn: 'root' });
1511
+ }
1512
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ModalService, decorators: [{
1513
+ type: Injectable,
1514
+ args: [{
1515
+ providedIn: 'root'
1516
+ }]
1517
+ }], ctorParameters: () => [] });
1518
+
1519
+ class TranslationComponent {
1520
+ _name = signal(null, ...(ngDevMode ? [{ debugName: "_name" }] : []));
1521
+ name = input('name', ...(ngDevMode ? [{ debugName: "name" }] : []));
1522
+ // @Input('name')
1523
+ // public set name(value) {
1524
+ // this._name.set(value);
1525
+ // this.ngOnInit();
1526
+ // }
1527
+ // public get name() {
1528
+ // return this._name();
1529
+ // }
1530
+ // public _replacements: string[] = [];
1531
+ _replacements = signal(null, ...(ngDevMode ? [{ debugName: "_replacements" }] : []));
1532
+ replacements = input(null, ...(ngDevMode ? [{ debugName: "replacements" }] : []));
1533
+ editorOpen = signal(false, ...(ngDevMode ? [{ debugName: "editorOpen" }] : []));
1534
+ saveSuccess = signal(false, ...(ngDevMode ? [{ debugName: "saveSuccess" }] : []));
1535
+ editContent = signal(false, ...(ngDevMode ? [{ debugName: "editContent" }] : []));
1536
+ content = computed(() => {
1537
+ return this.sanitizer.bypassSecurityTrustHtml(this.globalService.formatString(new TranslationPipe().transform(this.name(), this.translationService.translations()), ...(Array.isArray(this.replacements()) ? this.replacements() : [])));
1538
+ }, ...(ngDevMode ? [{ debugName: "content" }] : []));
1539
+ editableContent = computed(() => this.sanitizer.bypassSecurityTrustHtml(new TranslationPipe().transform(this._name(), this.translationService.translations())), ...(ngDevMode ? [{ debugName: "editableContent" }] : []));
1540
+ translationService = inject(TranslationSharedService);
1541
+ router = inject(Router);
1542
+ sanitizer = inject(DomSanitizer);
1543
+ userService = inject(UserAccountService);
1544
+ route = inject(ActivatedRoute);
1545
+ globalService = inject(GlobalService);
1546
+ constructor() {
1547
+ window.angularContext = window.angularContext || { parentComponent: this };
1548
+ }
1549
+ ngOnInit() {
1550
+ }
1551
+ changeEdit() {
1552
+ this.userService.getCurrentUser().subscribe((res) => {
1553
+ this.translationService.editContent.set(res.claims && res.claims['permission'] &&
1554
+ res.claims['permission'].indexOf('manageTranslations') >= 0);
1555
+ });
1556
+ }
1557
+ // navigateUrl(url: string) {
1558
+ // this.zone.run(() => {
1559
+ // this.router.navigateByUrl(url);
1560
+ // this.appRef.tick();
1561
+ // });
1562
+ // }
1563
+ openEditor() {
1564
+ if (!this.translationService.editContent())
1565
+ return;
1566
+ this.editorOpen.set(true);
1567
+ }
1568
+ closeEditor() {
1569
+ this.editorOpen.set(false);
1570
+ }
1571
+ quickSaveContent() {
1572
+ this.translationService.quickSaveHtmlContent(this.name(), this.translationService.translations()[this.name()]).subscribe((res) => {
1573
+ if (res.result === true) {
1574
+ this.closeEditor();
1575
+ }
1576
+ });
1577
+ }
1578
+ handleSave(e) {
1579
+ if (e.ctrlKey && (e.which == 83)) {
1580
+ e.preventDefault();
1581
+ this.quickSaveContent();
1582
+ }
1583
+ }
1584
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TranslationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1585
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: TranslationComponent, isStandalone: true, selector: "translate", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, replacements: { classPropertyName: "replacements", publicName: "replacements", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (translationService.translationsLoaded()) {\r\n<span (click)=\"openEditor()\" style=\"position:relative\">\r\n @if(!translationService.editContent()){<span (dblclick)=\"changeEdit()\" [innerHtml]=\"content()\"></span>}\r\n</span>\r\n} @else {\r\n<p-skeleton></p-skeleton>\r\n}\r\n\r\n@if (translationService.editContent()) {\r\n<span class=\"html-edit\">\r\n <a class=\"btn-show-edit\" (click)=\"openEditor()\"><i class=\"fa fa-edit\"></i>\r\n {{name()}}</a>\r\n <span (click)=\"openEditor()\" [innerHtml]=\"editableContent()\"></span>\r\n</span>\r\n}\r\n@if(editorOpen()) {\r\n<div class=\"content-editor\">\r\n <textarea [(ngModel)]=\"translationService.translations()[name()]\" class='form-control html-edit-control'\r\n (keydown)=\"handleSave($event)\"></textarea>\r\n\r\n <div class=\"modal-footer\">\r\n @if(saveSuccess){<span class=\"text-muted\"><i class=\"fa fa-save\"></i> Datele au fost salvate</span>\r\n }\r\n <button color=\"default\" (click)=\"closeEditor()\">Anuleaza</button>\r\n <button color=\"primary\" (click)=\"quickSaveContent()\">Salveaza modificari</button>\r\n </div>\r\n\r\n <style type=\"text/css\">\r\n body {\r\n margin-bottom: 300px\r\n }\r\n </style>\r\n</div>\r\n}", styles: [".content-editor{position:fixed;z-index:100001;bottom:0;left:0;right:0;background-color:#fff}.html-edit:hover *{opacity:.8}.btn-show-edit{display:inherit}.btn-show-edit{display:none;background-color:#c87f0a;border-radius:2px;padding:3px;font-size:8pt;z-index:10000;white-space:nowrap;color:#fff!important;position:absolute;left:5px;top:-12px;opacity:1!important}.html-edit{cursor:pointer}.html-edit-control{height:150px!important;font-family:Courier New;font-size:12px;width:100%!important;display:block!important}\n", "body{margin-bottom:300px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i2.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }] });
1586
+ }
1587
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TranslationComponent, decorators: [{
1588
+ type: Component,
1589
+ args: [{ selector: 'translate', standalone: true, imports: [CommonModule, FormsModule, SkeletonModule], template: "@if (translationService.translationsLoaded()) {\r\n<span (click)=\"openEditor()\" style=\"position:relative\">\r\n @if(!translationService.editContent()){<span (dblclick)=\"changeEdit()\" [innerHtml]=\"content()\"></span>}\r\n</span>\r\n} @else {\r\n<p-skeleton></p-skeleton>\r\n}\r\n\r\n@if (translationService.editContent()) {\r\n<span class=\"html-edit\">\r\n <a class=\"btn-show-edit\" (click)=\"openEditor()\"><i class=\"fa fa-edit\"></i>\r\n {{name()}}</a>\r\n <span (click)=\"openEditor()\" [innerHtml]=\"editableContent()\"></span>\r\n</span>\r\n}\r\n@if(editorOpen()) {\r\n<div class=\"content-editor\">\r\n <textarea [(ngModel)]=\"translationService.translations()[name()]\" class='form-control html-edit-control'\r\n (keydown)=\"handleSave($event)\"></textarea>\r\n\r\n <div class=\"modal-footer\">\r\n @if(saveSuccess){<span class=\"text-muted\"><i class=\"fa fa-save\"></i> Datele au fost salvate</span>\r\n }\r\n <button color=\"default\" (click)=\"closeEditor()\">Anuleaza</button>\r\n <button color=\"primary\" (click)=\"quickSaveContent()\">Salveaza modificari</button>\r\n </div>\r\n\r\n <style type=\"text/css\">\r\n body {\r\n margin-bottom: 300px\r\n }\r\n </style>\r\n</div>\r\n}", styles: [".content-editor{position:fixed;z-index:100001;bottom:0;left:0;right:0;background-color:#fff}.html-edit:hover *{opacity:.8}.btn-show-edit{display:inherit}.btn-show-edit{display:none;background-color:#c87f0a;border-radius:2px;padding:3px;font-size:8pt;z-index:10000;white-space:nowrap;color:#fff!important;position:absolute;left:5px;top:-12px;opacity:1!important}.html-edit{cursor:pointer}.html-edit-control{height:150px!important;font-family:Courier New;font-size:12px;width:100%!important;display:block!important}\n", "body{margin-bottom:300px}\n"] }]
1590
+ }], ctorParameters: () => [] });
1591
+
1592
+ class InternationalPhoneComponent {
1593
+ countriesList = [];
1594
+ countryFlag;
1595
+ localizationCountry;
1596
+ selectedCountryCode;
1597
+ phoneNo;
1598
+ //private _phoneNumber = computed(() => this.phoneNumber());
1599
+ // private _phoneNumber = signal('')
1600
+ countriesObs;
1601
+ selectedCountry;
1602
+ _phoneNumber = signal('', ...(ngDevMode ? [{ debugName: "_phoneNumber" }] : []));
1603
+ phoneNumber = model(null, ...(ngDevMode ? [{ debugName: "phoneNumber" }] : []));
1604
+ // private _phoneNumber: string;
1605
+ // @Input()
1606
+ // public set phoneNumber(value) {
1607
+ // this._phoneNumber = value;
1608
+ // this.onPhoneInput(this._phoneNumber);
1609
+ // }
1610
+ get currentPhoneNumber() {
1611
+ let phoneDialCode = this.countriesList.find(ctr => ctr.code == this.selectedCountryCode).dialCode;
1612
+ if (this.phoneNo && phoneDialCode) {
1613
+ return phoneDialCode + this.phoneNo;
1614
+ }
1615
+ else {
1616
+ return null;
1617
+ }
1618
+ }
1619
+ phoneNumberChange = output();
1620
+ // @Output()
1621
+ // phoneNumberChange = new EventEmitter(true)
1622
+ translationService = inject(TranslationSharedService);
1623
+ constructor() {
1624
+ // effect(() => {
1625
+ // this._phoneNumber.set(this.phoneNumber() || '');
1626
+ // this.onPhoneInput(this._phoneNumber());
1627
+ // });
1628
+ effect(() => {
1629
+ this._phoneNumber.update(this.phoneNumber() || '');
1630
+ this.onPhoneInput(this._phoneNumber());
1631
+ }, { allowSignalWrites: true });
1632
+ }
1633
+ ngOnInit() {
1634
+ this.getCountries();
1635
+ this.getFlagEmoji(this.countriesList);
1636
+ console.log(this.countriesList);
1637
+ }
1638
+ getCountries() {
1639
+ if (this.countriesList.length > 0)
1640
+ return of(this.countriesList);
1641
+ this.countriesObs = this.translationService.getCountries().pipe(share());
1642
+ this.countriesObs.subscribe(res => {
1643
+ if (!this.selectedCountryCode) {
1644
+ this.translationService.getLocalization().subscribe(r => {
1645
+ this.countriesList = res.result;
1646
+ this.countriesList.forEach(c => c.displayName = `${c.name} ${this.getFlagEmoji(c.code)} (${c.dialCode})`);
1647
+ this.localizationCountry = r.result.country;
1648
+ if (this.localizationCountry)
1649
+ this.onSelectionChange(this.localizationCountry);
1650
+ });
1651
+ }
1652
+ });
1653
+ return this.countriesObs;
1654
+ }
1655
+ onSelectionChange(selectedCode) {
1656
+ this.countriesList.forEach(c => c.displayName = `${c.name} ${this.getFlagEmoji(c.code)} (${c.dialCode})`);
1657
+ this.selectedCountry = this.countriesList.find(c => c.code == selectedCode);
1658
+ this.selectedCountry.displayName = `${this.getFlagEmoji(this.selectedCountry.code)} (${this.selectedCountry.dialCode})`;
1659
+ this.selectedCountryCode = this.selectedCountry.code;
1660
+ }
1661
+ changePhoneNumber() {
1662
+ if (this._phoneNumber() != this.currentPhoneNumber) {
1663
+ this._phoneNumber.set(this.currentPhoneNumber);
1664
+ this.phoneNumberChange.emit(this.currentPhoneNumber);
1665
+ }
1666
+ }
1667
+ onPaste(pastedText) {
1668
+ this.onPhoneInput(pastedText.data);
1669
+ }
1670
+ onPhoneInput(pastedNumber = this.phoneNo) {
1671
+ this.getCountries().subscribe(c => {
1672
+ this.onSelectionChange(this.selectedCountryCode);
1673
+ if (!pastedNumber)
1674
+ return;
1675
+ pastedNumber = pastedNumber.replace(/[^0-9+]/g, '');
1676
+ let matchingCountry = this.countriesList.find(c => {
1677
+ return c.dialCode == pastedNumber.substring(0, c.dialCode.length);
1678
+ });
1679
+ if (matchingCountry) {
1680
+ this.phoneNo = pastedNumber.slice(matchingCountry.dialCode.length).trim();
1681
+ this.onSelectionChange(matchingCountry.code);
1682
+ }
1683
+ this.changePhoneNumber();
1684
+ });
1685
+ }
1686
+ getFlagEmoji(countryCodeFlag) {
1687
+ if (countryCodeFlag.length < 2) {
1688
+ return "";
1689
+ }
1690
+ this.countryFlag =
1691
+ [...countryCodeFlag?.toUpperCase()]
1692
+ .map((char) => String.fromCodePoint(127397 + char.charCodeAt(0)))
1693
+ .reduce((a, b) => `${a}${b}`);
1694
+ return this.countryFlag;
1695
+ }
1696
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: InternationalPhoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1697
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: InternationalPhoneComponent, isStandalone: true, selector: "payvent-international-phone", inputs: { phoneNumber: { classPropertyName: "phoneNumber", publicName: "phoneNumber", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { phoneNumber: "phoneNumberChange", phoneNumberChange: "phoneNumberChange" }, ngImport: i0, template: "<div class=\"mb-3\">\r\n <select style=\"width:110px; border-radius: 6px 0 0 6px; border-right-width: 0;\" class=\"form-control\" name=\"country\"\r\n [(ngModel)]=\"selectedCountryCode\" (change)=\"onPhoneInput()\" #country=\"ngModel\">\r\n <option value=\"undefined\" selected disabled>- select -</option>\r\n @for (item of countriesList; track item.code){\r\n <option [ngValue]=\"item.code\">{{item.displayName}}</option>\r\n }\r\n </select>\r\n <input style=\"border-radius: 0 6px 6px 0; border-left-width: 0;\" pInputText class=\"w-full\" type=\"phone\" [(ngModel)]=\"phoneNo\"\r\n (input)=\"onPhoneInput()\" phone class=\"form-control\" #phone=\"ngModel\" (paste)=\"onPaste($event)\" name=\"phone\"\r\n placeholder=\"Please enter phone number\" />\r\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
1698
+ }
1699
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: InternationalPhoneComponent, decorators: [{
1700
+ type: Component,
1701
+ args: [{ selector: 'payvent-international-phone', standalone: true, imports: [
1702
+ CommonModule,
1703
+ FormsModule,
1704
+ // InputTextModule,
1705
+ // CardModule,
1706
+ // RippleModule,
1707
+ // ButtonModule,
1708
+ // DropdownModule,
1709
+ // CheckboxModule,
1710
+ // TagModule,
1711
+ // AvatarModule,
1712
+ // AvatarGroupModule,
1713
+ ], template: "<div class=\"mb-3\">\r\n <select style=\"width:110px; border-radius: 6px 0 0 6px; border-right-width: 0;\" class=\"form-control\" name=\"country\"\r\n [(ngModel)]=\"selectedCountryCode\" (change)=\"onPhoneInput()\" #country=\"ngModel\">\r\n <option value=\"undefined\" selected disabled>- select -</option>\r\n @for (item of countriesList; track item.code){\r\n <option [ngValue]=\"item.code\">{{item.displayName}}</option>\r\n }\r\n </select>\r\n <input style=\"border-radius: 0 6px 6px 0; border-left-width: 0;\" pInputText class=\"w-full\" type=\"phone\" [(ngModel)]=\"phoneNo\"\r\n (input)=\"onPhoneInput()\" phone class=\"form-control\" #phone=\"ngModel\" (paste)=\"onPaste($event)\" name=\"phone\"\r\n placeholder=\"Please enter phone number\" />\r\n</div>" }]
1714
+ }], ctorParameters: () => [] });
1715
+
1716
+ class CountryProvinceCityComponent {
1717
+ translationService = inject(TranslationSharedService);
1718
+ correlation = input('country-province-city', ...(ngDevMode ? [{ debugName: "correlation" }] : []));
1719
+ mode = input('country', ...(ngDevMode ? [{ debugName: "mode" }] : []));
1720
+ _currentProvinceName;
1721
+ currentCountryCode;
1722
+ currentProvinceCode;
1723
+ set currentProvinceName(value) {
1724
+ this._currentProvinceName = value;
1725
+ }
1726
+ get currentProvinceName() {
1727
+ return this._currentProvinceName;
1728
+ }
1729
+ constructor() { }
1730
+ ngOnInit() {
1731
+ this.translationService.countryProvinceCityPlaceholder[this.correlation()] = signal({});
1732
+ }
1733
+ // emitOutput() {
1734
+ // this.valueChange.emit({ countryCode: this.currentCountryCode, countryName: this.currentCountryName, provinceCode: this.currentProvinceCode, provinceName: this.currentProvinceName });
1735
+ // }
1736
+ setCountry() {
1737
+ let placeholder = this.translationService.getCountryCityPlaceholder(this.correlation());
1738
+ placeholder.update(p => ({
1739
+ ...p,
1740
+ provinceCode: undefined,
1741
+ provinceName: undefined,
1742
+ currentProvince: undefined,
1743
+ city: undefined
1744
+ }));
1745
+ this.translationService.setCountryCityPlaceholder(this.correlation(), placeholder);
1746
+ }
1747
+ setProvince() {
1748
+ let placeholder = this.translationService.getCountryCityPlaceholder(this.correlation());
1749
+ placeholder.update(p => ({
1750
+ ...p,
1751
+ city: undefined
1752
+ }));
1753
+ this.translationService.setCountryCityPlaceholder(this.correlation(), placeholder);
1754
+ }
1755
+ ngOnDestroy() {
1756
+ this.translationService.countryProvinceCityPlaceholder[this.correlation()] = undefined;
1757
+ }
1758
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: CountryProvinceCityComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1759
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: CountryProvinceCityComponent, isStandalone: true, selector: "payvent-country-province-city", inputs: { correlation: { classPropertyName: "correlation", publicName: "correlation", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (mode() == 'country') {\r\n<select (change)=\"setCountry()\"\r\n [(ngModel)]=\"translationService.countryProvinceCityPlaceholder[this.correlation()]().countryCode\"\r\n class=\"form-control\">\r\n <option [ngValue]=\"undefined\">{{'pleaseSelect' | translation: translationService.translations }}</option>\r\n @for(c of translationService.countries(); track c.code) {\r\n <option [ngValue]=\"c.code\">{{c.name}}</option>\r\n }\r\n</select>\r\n}\r\n\r\n@if(mode()=='province') {\r\n@if(translationService.countryProvinceCityPlaceholder[this.correlation()]()?.currentCountry?.provinces?.length > 0) {\r\n\r\n<select (change)=\"setProvince()\" class=\"form-control\"\r\n [(ngModel)]=\"translationService.countryProvinceCityPlaceholder[this.correlation()]().provinceCode\">\r\n <option [ngValue]=\"undefined\">{{'pleaseSelect' | translation: translationService.translations }}</option>\r\n <option\r\n *ngFor=\"let c of translationService.countryProvinceCityPlaceholder[this.correlation()]().currentCountry?.provinces | orderBy: 'name'\"\r\n [ngValue]=\"c.code\">{{c.name}}</option>\r\n</select>\r\n}\r\n\r\n@if(!(translationService.countryProvinceCityPlaceholder[this.correlation()]().currentCountry?.provinces?.length > 0)) {\r\n<input type=\"text\" [(ngModel)]=\"translationService.countryProvinceCityPlaceholder[this.correlation()]().provinceName\"\r\n class=\"form-control\" #currentPName=\"ngModel\" name=\"currentPName\" required />\r\n}\r\n}\r\n\r\n@if(mode()=='city') {\r\n\r\n@if(translationService.countryProvinceCityPlaceholder[this.correlation()]().currentProvince?.cities?.length > 0) {\r\n\r\n<select class=\"form-control\" [(ngModel)]=\"translationService.countryProvinceCityPlaceholder[this.correlation()]().city\">\r\n <option [ngValue]=\"undefined\">{{'pleaseSelect' | translation: translationService.translations }}</option>\r\n @for(c of translationService.countryProvinceCityPlaceholder[this.correlation()]().currentProvince?.cities; track c) {\r\n <option>{{c}}</option>\r\n }\r\n</select>\r\n}\r\n\r\n@if(!(translationService.countryProvinceCityPlaceholder[this.correlation()]().currentProvince?.cities?.length > 0)) {\r\n\r\n<input type=\"text\" [(ngModel)]=\"translationService.countryProvinceCityPlaceholder[this.correlation()]().city\"\r\n class=\"form-control\" #currentC=\"ngModel\" name=\"currentC\" required />\r\n}\r\n}", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: OrderModule }, { kind: "pipe", type: TranslationPipe, name: "translation" }, { kind: "pipe", type: i3.OrderPipe, name: "orderBy" }] });
1760
+ }
1761
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: CountryProvinceCityComponent, decorators: [{
1762
+ type: Component,
1763
+ args: [{ selector: 'payvent-country-province-city', standalone: true, imports: [CommonModule, FormsModule, TranslationComponent, TranslationPipe, OrderModule], template: "@if (mode() == 'country') {\r\n<select (change)=\"setCountry()\"\r\n [(ngModel)]=\"translationService.countryProvinceCityPlaceholder[this.correlation()]().countryCode\"\r\n class=\"form-control\">\r\n <option [ngValue]=\"undefined\">{{'pleaseSelect' | translation: translationService.translations }}</option>\r\n @for(c of translationService.countries(); track c.code) {\r\n <option [ngValue]=\"c.code\">{{c.name}}</option>\r\n }\r\n</select>\r\n}\r\n\r\n@if(mode()=='province') {\r\n@if(translationService.countryProvinceCityPlaceholder[this.correlation()]()?.currentCountry?.provinces?.length > 0) {\r\n\r\n<select (change)=\"setProvince()\" class=\"form-control\"\r\n [(ngModel)]=\"translationService.countryProvinceCityPlaceholder[this.correlation()]().provinceCode\">\r\n <option [ngValue]=\"undefined\">{{'pleaseSelect' | translation: translationService.translations }}</option>\r\n <option\r\n *ngFor=\"let c of translationService.countryProvinceCityPlaceholder[this.correlation()]().currentCountry?.provinces | orderBy: 'name'\"\r\n [ngValue]=\"c.code\">{{c.name}}</option>\r\n</select>\r\n}\r\n\r\n@if(!(translationService.countryProvinceCityPlaceholder[this.correlation()]().currentCountry?.provinces?.length > 0)) {\r\n<input type=\"text\" [(ngModel)]=\"translationService.countryProvinceCityPlaceholder[this.correlation()]().provinceName\"\r\n class=\"form-control\" #currentPName=\"ngModel\" name=\"currentPName\" required />\r\n}\r\n}\r\n\r\n@if(mode()=='city') {\r\n\r\n@if(translationService.countryProvinceCityPlaceholder[this.correlation()]().currentProvince?.cities?.length > 0) {\r\n\r\n<select class=\"form-control\" [(ngModel)]=\"translationService.countryProvinceCityPlaceholder[this.correlation()]().city\">\r\n <option [ngValue]=\"undefined\">{{'pleaseSelect' | translation: translationService.translations }}</option>\r\n @for(c of translationService.countryProvinceCityPlaceholder[this.correlation()]().currentProvince?.cities; track c) {\r\n <option>{{c}}</option>\r\n }\r\n</select>\r\n}\r\n\r\n@if(!(translationService.countryProvinceCityPlaceholder[this.correlation()]().currentProvince?.cities?.length > 0)) {\r\n\r\n<input type=\"text\" [(ngModel)]=\"translationService.countryProvinceCityPlaceholder[this.correlation()]().city\"\r\n class=\"form-control\" #currentC=\"ngModel\" name=\"currentC\" required />\r\n}\r\n}" }]
1764
+ }], ctorParameters: () => [] });
1765
+
1766
+ class LoginFormComponent {
1767
+ context = model({}, ...(ngDevMode ? [{ debugName: "context" }] : []));
1768
+ myForm;
1769
+ // @ViewChild('cd', { static: false }) private countdown: CountdownComponent;
1770
+ allowAccountCreation = input(true, ...(ngDevMode ? [{ debugName: "allowAccountCreation" }] : []));
1771
+ tokenType = input('TEMPORARY', ...(ngDevMode ? [{ debugName: "tokenType" }] : []));
1772
+ clientId = input(null, ...(ngDevMode ? [{ debugName: "clientId" }] : []));
1773
+ type = input('EMAIL', ...(ngDevMode ? [{ debugName: "type" }] : []));
1774
+ showError = signal(false, ...(ngDevMode ? [{ debugName: "showError" }] : []));
1775
+ loginMessage;
1776
+ env;
1777
+ status;
1778
+ cordova;
1779
+ loginSubscription;
1780
+ accessRefused = signal(false, ...(ngDevMode ? [{ debugName: "accessRefused" }] : []));
1781
+ emailSent;
1782
+ verifyPhone;
1783
+ provincesList = [];
1784
+ countriesList = [];
1785
+ loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
1786
+ otpSuccess = signal(false, ...(ngDevMode ? [{ debugName: "otpSuccess" }] : []));
1787
+ contextResponse;
1788
+ responseStatus;
1789
+ otpError = signal(false, ...(ngDevMode ? [{ debugName: "otpError" }] : []));
1790
+ otpSent;
1791
+ verified;
1792
+ otpVerified = signal(false, ...(ngDevMode ? [{ debugName: "otpVerified" }] : []));
1793
+ loginToken;
1794
+ userProfile;
1795
+ emailOtp;
1796
+ phoneOtp;
1797
+ prevContext = {};
1798
+ countryFlag;
1799
+ localizationCountry;
1800
+ selectedCountryCode;
1801
+ phoneLoginNumber;
1802
+ profileCountryCode;
1803
+ currentCountry;
1804
+ currentProvince;
1805
+ showResend = signal(true, ...(ngDevMode ? [{ debugName: "showResend" }] : []));
1806
+ expTimestamp;
1807
+ countdownConfig = {};
1808
+ get passwordError() {
1809
+ if (!this.context().password)
1810
+ return 'error.login-form.password';
1811
+ if (this.context().password.length < 6)
1812
+ return 'error.login-form.password-length';
1813
+ return null;
1814
+ }
1815
+ userService = inject(UserAccountService);
1816
+ sidebarService = inject(SidebarService);
1817
+ router = inject(Router);
1818
+ http = inject(HttpClient);
1819
+ translationService = inject(TranslationSharedService);
1820
+ environment = inject(FlowAppConfig);
1821
+ httpClient = inject(FlowHttpClient);
1822
+ // public platform: Platform,
1823
+ cookieService = inject(FlowCookieService);
1824
+ globalService = inject(GlobalService);
1825
+ constructor() {
1826
+ }
1827
+ ngOnInit() {
1828
+ var result = {};
1829
+ this.context.update(ctx => ({
1830
+ ...ctx,
1831
+ type: ctx.type ?? this.type(),
1832
+ tokenType: ctx.tokenType ?? this.tokenType(),
1833
+ action: ctx.action ?? 'LOGIN',
1834
+ allowAccountCreation: typeof ctx.allowAccountCreation == 'boolean' ? ctx.allowAccountCreation : this.allowAccountCreation()
1835
+ }));
1836
+ this.userService.onAccessRefused.subscribe(res => {
1837
+ this.resetContext();
1838
+ this.accessRefused.set(true);
1839
+ });
1840
+ this.env = this.environment;
1841
+ this.cordova = window.cordova;
1842
+ if (!this.userService.redirectTo)
1843
+ this.userService.redirectTo = this.context().returnUrl || window.location.pathname + window.location.search;
1844
+ window.login = window.login || this;
1845
+ if (this.context().otpType == 'EMAIL') {
1846
+ this.context.update(ctx => ({
1847
+ ...ctx,
1848
+ otp: this.emailOtp
1849
+ }));
1850
+ }
1851
+ if (this.context().otpType == 'PHONE') {
1852
+ this.context.update(ctx => ({
1853
+ ...ctx,
1854
+ otp: this.phoneOtp
1855
+ }));
1856
+ }
1857
+ }
1858
+ ngOnDestroy() {
1859
+ if (this.loginSubscription)
1860
+ this.loginSubscription.unsubscribe();
1861
+ window.login = null;
1862
+ }
1863
+ openConsent(evt, item) {
1864
+ evt.stopPropagation();
1865
+ // this.http.get(item.contentUrl, { responseType: 'text' }).subscribe(r => {
1866
+ // this.modalService.openRawAlert(new TranslationPipe().transform('consentTitle.' + item.name, this.translationService.translations), r);
1867
+ // });
1868
+ }
1869
+ recover() {
1870
+ this.context.update(ctx => ({
1871
+ ...ctx,
1872
+ action: 'RECOVER',
1873
+ type: ctx.type == 'EMAIL' ? 'PHONE' : 'EMAIL'
1874
+ }));
1875
+ }
1876
+ getOtp() {
1877
+ this.showError.set(false);
1878
+ this.context.update(ctx => ({ ...ctx, errorMessage: null }));
1879
+ // this.showResend = false;
1880
+ if (this.myForm && !this.myForm.valid) {
1881
+ this.showError.set(true);
1882
+ this.globalService.onError.emit();
1883
+ return;
1884
+ }
1885
+ this.context.update(ctx => ({
1886
+ ...ctx,
1887
+ clientName: this.environment.client_id,
1888
+ allowAccountCreation: this.allowAccountCreation
1889
+ }));
1890
+ this.userService.getOtp(this.context()).subscribe(res => {
1891
+ if (res.result.status == 'otp_verified') {
1892
+ this.otpSuccess.set(true);
1893
+ this.globalService.onSuccess.emit();
1894
+ if (res.result.type == 'TOKEN') {
1895
+ this.userService.processOtpToken(res.result);
1896
+ return;
1897
+ }
1898
+ if (res.result.type == 'DATA') {
1899
+ // this.translationService.setCountryCityPlaceholder('login-form', {
1900
+ // countryCode: this.context().user.countryCode,
1901
+ // provinceCode: this.context().user.provinceCode,
1902
+ // provinceName: this.context().user.province,
1903
+ // city: this.context().user.city
1904
+ // });
1905
+ }
1906
+ }
1907
+ this.prevContext = this.context();
1908
+ this.context.set(res.result);
1909
+ this.countdownConfig = { leftTime: 30, format: 'ss' };
1910
+ if (this.context().status == 'error') {
1911
+ this.globalService.onError.emit();
1912
+ }
1913
+ if (this.context().errorMessage == 'duplicate_phone') {
1914
+ this.globalService.onError.emit();
1915
+ console.log('duplicate_phone');
1916
+ return;
1917
+ }
1918
+ });
1919
+ }
1920
+ verifyOtp(val) {
1921
+ console.log(this.context());
1922
+ if (val?.value.length < 6)
1923
+ return;
1924
+ this.context.update(ctx => ({
1925
+ ...ctx,
1926
+ errorMessage: null,
1927
+ clientName: this.environment.client_id,
1928
+ status: 'otp_sent',
1929
+ }));
1930
+ this.loading.set(true);
1931
+ this.otpError.set(false);
1932
+ this.otpSuccess.set(false);
1933
+ this.userService.verifyOtp(this.context()).subscribe(r => {
1934
+ if (r.result.status == 'otp_verified') {
1935
+ this.otpSuccess.set(true);
1936
+ this.globalService.onSuccess.emit();
1937
+ if (r.result.type == 'TOKEN') {
1938
+ this.userService.processOtpToken(r.result);
1939
+ return;
1940
+ }
1941
+ if (r.result.action == 'CHANGELOGINNAME' && r.result.status == 'login_name_changed') {
1942
+ this.userService.currentUser = r.result.user;
1943
+ this.userService.onUserLoggedIn.emit({ action: this.context().action, user: r.result.user });
1944
+ return;
1945
+ }
1946
+ }
1947
+ this.loading.set(false);
1948
+ this.context.set(r.result);
1949
+ console.log(this.context());
1950
+ if (this.context().errorMessage == 'wrong_code') {
1951
+ this.context().update(ctx => ({
1952
+ ...ctx,
1953
+ otp: null
1954
+ }));
1955
+ this.emailOtp = null;
1956
+ this.phoneOtp = null;
1957
+ this.otpError.set(true);
1958
+ }
1959
+ if (this.context().type == 'DATA') {
1960
+ }
1961
+ });
1962
+ }
1963
+ countdownEvent(evt) {
1964
+ if (evt.action == 'finished' || evt.action == 'done') {
1965
+ // this.showResend = true;
1966
+ }
1967
+ }
1968
+ resendOtp() {
1969
+ this.userService.resendOtp(this.context()).subscribe(res => {
1970
+ if (res.result.status == 'error') {
1971
+ this.context().errorMessage = res.result.errorMessage;
1972
+ this.globalService.onError.emit();
1973
+ }
1974
+ else {
1975
+ this.globalService.onSuccess.emit();
1976
+ // this.showResend = false;
1977
+ this.context.set(res.result);
1978
+ this.countdownConfig = { leftTime: 30, format: 'ss' };
1979
+ }
1980
+ });
1981
+ }
1982
+ saveUser() {
1983
+ this.translationService.validateCountryProvinceCity('login-form');
1984
+ let countryProvinceCity = this.translationService.countryProvinceCityPlaceholder['login-form'];
1985
+ this.showError.set(false);
1986
+ if ((this.myForm && !this.myForm.valid) || this.context().user.consents.find(c => c.required && !c.consented) || countryProvinceCity.countryError || countryProvinceCity.provinceError || countryProvinceCity.cityError) {
1987
+ this.globalService.onError.emit();
1988
+ this.showError.set(true);
1989
+ return;
1990
+ }
1991
+ this.context().errorMessage = null;
1992
+ let cpc = this.translationService.getCountryCityPlaceholder('login-form');
1993
+ this.context.update(ctx => ({
1994
+ ...ctx,
1995
+ user: {
1996
+ ...ctx.user,
1997
+ countryCode: cpc.countryCode,
1998
+ country: cpc.countryName,
1999
+ provinceCode: cpc.provinceCode,
2000
+ province: cpc.provinceName,
2001
+ city: cpc.city
2002
+ }
2003
+ }));
2004
+ this.userService.saveUserProfile(this.context()).subscribe(r => {
2005
+ this.userService.processOtpToken(r.result);
2006
+ });
2007
+ }
2008
+ resetContext() {
2009
+ this.prevContext.token = null;
2010
+ this.prevContext.loginName = null;
2011
+ this.context.set(this.prevContext);
2012
+ }
2013
+ resetContextData() {
2014
+ }
2015
+ submitRegister() {
2016
+ this.context.update(ctx => ({
2017
+ ...ctx,
2018
+ token: this.loginToken,
2019
+ errorMessage: null
2020
+ }));
2021
+ this.userService.verifyOtp(this.context()).subscribe(r => {
2022
+ this.context.set(r.result);
2023
+ if (r.result.status == 'error')
2024
+ this.globalService.onError.emit();
2025
+ else
2026
+ this.globalService.onSuccess.emit();
2027
+ });
2028
+ }
2029
+ remove() {
2030
+ this.cookieService.remove('userAccount');
2031
+ this.resetContext();
2032
+ }
2033
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: LoginFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2034
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: LoginFormComponent, isStandalone: true, selector: "payvent-login-form", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null }, allowAccountCreation: { classPropertyName: "allowAccountCreation", publicName: "allowAccountCreation", isSignal: true, isRequired: false, transformFunction: null }, tokenType: { classPropertyName: "tokenType", publicName: "tokenType", isSignal: true, isRequired: false, transformFunction: null }, clientId: { classPropertyName: "clientId", publicName: "clientId", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { context: "contextChange" }, viewQueries: [{ propertyName: "myForm", first: true, predicate: ["myForm"], descendants: true }], ngImport: i0, template: "<div class=\"login-component\">\r\n @if (accessRefused()) {\r\n <div class=\"alert alert-danger\">\r\n <translate name=\"login-form.access-refused\"></translate>\r\n </div>\r\n }\r\n\r\n <form novalidate #myForm=\"ngForm\">\r\n @if (context().errorMessage) {\r\n <div class=\"mt-1 text-red-500\">\r\n <span class=\"material-symbols mr-1\">info</span>\r\n <translate [name]=\"'login-form.error.' + context().errorMessage\"></translate>\r\n </div>\r\n }\r\n\r\n\r\n @if (context().type == 'EMAIL' && !['otp_sent', 'login_name_changed'].includes(context().status) &&\r\n context().errorMessage != 'wrong_code' ){\r\n <div class=\"form-group\">\r\n <label class=\"primary-50\">\r\n <translate [name]=\"'login-form.email.' + context().action.toLowerCase()\"></translate>\r\n </label>\r\n <input type=\"email\" [(ngModel)]=\"context().loginName\" pInputText email class=\"form-control\" #email=\"ngModel\"\r\n name=\"email\" required />\r\n @if(context().action=='LOGIN') {\r\n <a (click)=\"recover()\">\r\n <translate name=\"login-form.no-email-access\"></translate>\r\n </a>\r\n }\r\n\r\n @if(!email.valid && showError) {\r\n <div class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.email\"></translate>\r\n </div>\r\n }\r\n </div>\r\n\r\n <p-button color=\"success\" (click)=\"getOtp()\">\r\n <translate [name]=\"'login-form.submit-email.' + context().action.toLowerCase()\"></translate>\r\n </p-button>\r\n }\r\n\r\n\r\n @if (context().status == 'otp_sent' || context().errorMessage == 'wrong_code') {\r\n <div class=\"position:relative\">\r\n @if (loading()) {\r\n <div class=\"loader-container\">\r\n <div class=\"loader\"></div>\r\n </div>\r\n }\r\n <div class=\"form-group\">\r\n <translate name=\"login-form.enter_otp_code\" [replacements]=\"[context().loginNameMasked]\"></translate>\r\n </div>\r\n <div class=\"form-group\">\r\n <p-inputotp [disabled]=\"loading()\" [(ngModel)]=\"context().otp\" [length]=\"6\" [autofocus]=\"true\"\r\n (onChange)=\"verifyOtp($event)\" name=\"inputOtp\"></p-inputotp>\r\n </div>\r\n @if(!showResend()) {\r\n <translate name=\"login-form.resend-code.in-sec\"></translate>\r\n <!-- <countdown #cd [config]=\"countdownConfig\" (event)=\"countdownEvent($event)\">$!s!</countdown> sec -->\r\n }\r\n\r\n @if(showResend()) {\r\n <p-button color=\"info\" class=\"btn-block\" (click)=\"resendOtp()\">\r\n <translate name=\"login-form.resend-otp\"></translate>\r\n </p-button>\r\n }\r\n </div>\r\n\r\n }\r\n\r\n\r\n @if (context().type == 'PHONE' && !['otp_sent', 'login_name_changed'].includes(context().status) &&\r\n context().errorMessage != 'wrong_code') {\r\n <div class=\"form-group\">\r\n <label class=\"login-label\">\r\n <translate [name]=\"'login-form.phone.' + context().action.toLowerCase()\"></translate>\r\n </label>\r\n <payvent-international-phone [(phoneNumber)]=\"context().loginName\" name=\"phone\"\r\n ngDefaultControl></payvent-international-phone>\r\n\r\n @if (showError()) {\r\n <div class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.phone\"></translate>\r\n </div>\r\n }\r\n\r\n @if (context().status=='duplicate_phone') {\r\n <div class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.duplicate_phone\"></translate>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <button loading-button color=\"success\" class=\"btn-block\" (click)=\"getOtp()\">\r\n <translate [name]=\"'login-form.submit-phone.' + context().action.toLowerCase()\"></translate>\r\n </button>\r\n </div>\r\n }\r\n\r\n @if (context().type=='DATA') {\r\n <div class=\"form-group\">\r\n <div class=\"text-center form-group\">\r\n <label class=\"login-label\">\r\n <translate name=\"login-form.profile-data.login\"></translate>\r\n </label>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"login-form.email\"></translate>\r\n </label>\r\n <input type=\"email\" [(ngModel)]=\"context().user.email\" class=\"form-control\" #email=\"ngModel\" name=\"email\"\r\n disabled />\r\n </div>\r\n <div class=\"form-group name-group\">\r\n <div class=\"first\">\r\n <label>\r\n <translate name=\"login-form.firstName\"></translate>\r\n </label>\r\n <input type=\"text\" [(ngModel)]=\"context().user.firstName\" class=\"form-control\" #firstName=\"ngModel\"\r\n name=\"firstName\" required />\r\n <div *ngIf=\"!firstName.valid && showError\" class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.firstName\"></translate>\r\n </div>\r\n </div>\r\n <div class=\"second\">\r\n <label>\r\n <translate name=\"login-form.lastName\"></translate>\r\n </label>\r\n <input type=\"text\" [(ngModel)]=\"context().user.lastName\" class=\"form-control\" #lastName=\"ngModel\"\r\n name=\"lastName\" required />\r\n <div *ngIf=\"!lastName.valid && showError\" class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.lastName\"></translate>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"login-form.phone\"></translate>\r\n </label>\r\n <input type=\"phone\" [(ngModel)]=\"context().user.phoneNumber\" class=\"form-control\" #phone=\"ngModel\" name=\"phone\"\r\n disabled />\r\n </div>\r\n\r\n\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"login-form.country\"></translate>\r\n </label>\r\n <payvent-country-province-city mode=\"country\" correlation=\"login-form\"></payvent-country-province-city>\r\n @if(translationService.countryProvinceCityPlaceholder['login-form']().countryError) {\r\n <div class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.country\"></translate>\r\n </div>\r\n }\r\n </div>\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"login-form.province\"></translate>\r\n </label>\r\n <payvent-country-province-city mode=\"province\" correlation=\"login-form\"></payvent-country-province-city>\r\n\r\n @if(translationService.countryProvinceCityPlaceholder['login-form']().provinceError) {\r\n <div class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.province\"></translate>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"login-form.city\"></translate>\r\n </label>\r\n <payvent-country-province-city mode=\"city\" correlation=\"login-form\"></payvent-country-province-city>\r\n @if(translationService.countryProvinceCityPlaceholder['login-form']().cityError) {\r\n <div class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.city\"></translate>\r\n </div>\r\n }\r\n </div>\r\n\r\n @for(item of context().user.consents; track item.id) {\r\n <div class=\"form-group\">\r\n <icheck [name]=\"item.name\" [(ngModel)]=\"item.consented\">\r\n <translate name=\"login-form.consent\"></translate>&nbsp;<a (click)=\"openConsent($event, item)\">\r\n <translate [name]=\"'consent.' + item.name\"></translate>\r\n </a>\r\n </icheck>\r\n <div *ngIf=\"!item.consented && item.required && showError\" class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate [name]=\"'consentError.' + item.name\"></translate>\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </form>\r\n\r\n\r\n <div class=\"form-group\">\r\n @if (context().type == 'DATA') {\r\n <button loading-button color=\"success\" class=\"btn-block\" (click)=\"saveUser()\">\r\n <translate name=\"login-form.save-changes\"></translate>\r\n </button>\r\n }\r\n </div>\r\n\r\n @if (context().status && context().status != 'client_not_found' && context().status != 'login_name_changed' &&\r\n context().status != 'otp_verified' && !loading()) {\r\n <div class=\"form-group\">\r\n <p-button (click)=\"resetContext()\">\r\n <translate name=\"login-form.back\"></translate>\r\n </p-button>\r\n </div>\r\n }\r\n\r\n @if(context().action=='VERIFYRECOVER' && context().type=='TOKEN') {\r\n <translate name=\"login-form.recover_success\"></translate>\r\n }\r\n\r\n @if(context().action=='CHANGELOGINNAME' && context().status=='login_name_changed') {\r\n <translate [name]=\"'login-form.login_name_changed.' + context().type.toLowerCase()\"></translate>\r\n }\r\n\r\n</div>", styles: ["@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.loader-container{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffff4d;display:flex;align-items:center;justify-content:center}.loader{content:\"\";box-sizing:border-box;display:inline-block;width:32px;height:32px;position:absolute;border-radius:50%;border:4px solid rgba(237,156,40,.3);border-top-color:#ed9c28;animation:spinner .8s cubic-bezier(.58,.33,.52,.75) infinite;z-index:10000000001}\n"], dependencies: [{ kind: "component", type: TranslationComponent, selector: "translate", inputs: ["name", "replacements"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$1.EmailValidator, selector: "[email][formControlName],[email][formControl],[email][ngModel]", inputs: ["email"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: InternationalPhoneComponent, selector: "payvent-international-phone", inputs: ["phoneNumber"], outputs: ["phoneNumberChange"] }, { kind: "component", type: CountryProvinceCityComponent, selector: "payvent-country-province-city", inputs: ["correlation", "mode"] }, { kind: "directive", type: InputText, selector: "[pInputText]", inputs: ["pSize", "variant", "fluid", "invalid"] }, { kind: "component", type: InputOtp, selector: "p-inputOtp, p-inputotp, p-input-otp", inputs: ["readonly", "tabindex", "length", "styleClass", "mask", "integerOnly", "autofocus", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }] });
2035
+ }
2036
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: LoginFormComponent, decorators: [{
2037
+ type: Component,
2038
+ args: [{ selector: 'payvent-login-form', standalone: true, imports: [
2039
+ TranslationComponent,
2040
+ CommonModule,
2041
+ FormsModule,
2042
+ InternationalPhoneComponent,
2043
+ CountryProvinceCityComponent,
2044
+ InputText,
2045
+ InputOtp,
2046
+ ButtonModule
2047
+ ], template: "<div class=\"login-component\">\r\n @if (accessRefused()) {\r\n <div class=\"alert alert-danger\">\r\n <translate name=\"login-form.access-refused\"></translate>\r\n </div>\r\n }\r\n\r\n <form novalidate #myForm=\"ngForm\">\r\n @if (context().errorMessage) {\r\n <div class=\"mt-1 text-red-500\">\r\n <span class=\"material-symbols mr-1\">info</span>\r\n <translate [name]=\"'login-form.error.' + context().errorMessage\"></translate>\r\n </div>\r\n }\r\n\r\n\r\n @if (context().type == 'EMAIL' && !['otp_sent', 'login_name_changed'].includes(context().status) &&\r\n context().errorMessage != 'wrong_code' ){\r\n <div class=\"form-group\">\r\n <label class=\"primary-50\">\r\n <translate [name]=\"'login-form.email.' + context().action.toLowerCase()\"></translate>\r\n </label>\r\n <input type=\"email\" [(ngModel)]=\"context().loginName\" pInputText email class=\"form-control\" #email=\"ngModel\"\r\n name=\"email\" required />\r\n @if(context().action=='LOGIN') {\r\n <a (click)=\"recover()\">\r\n <translate name=\"login-form.no-email-access\"></translate>\r\n </a>\r\n }\r\n\r\n @if(!email.valid && showError) {\r\n <div class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.email\"></translate>\r\n </div>\r\n }\r\n </div>\r\n\r\n <p-button color=\"success\" (click)=\"getOtp()\">\r\n <translate [name]=\"'login-form.submit-email.' + context().action.toLowerCase()\"></translate>\r\n </p-button>\r\n }\r\n\r\n\r\n @if (context().status == 'otp_sent' || context().errorMessage == 'wrong_code') {\r\n <div class=\"position:relative\">\r\n @if (loading()) {\r\n <div class=\"loader-container\">\r\n <div class=\"loader\"></div>\r\n </div>\r\n }\r\n <div class=\"form-group\">\r\n <translate name=\"login-form.enter_otp_code\" [replacements]=\"[context().loginNameMasked]\"></translate>\r\n </div>\r\n <div class=\"form-group\">\r\n <p-inputotp [disabled]=\"loading()\" [(ngModel)]=\"context().otp\" [length]=\"6\" [autofocus]=\"true\"\r\n (onChange)=\"verifyOtp($event)\" name=\"inputOtp\"></p-inputotp>\r\n </div>\r\n @if(!showResend()) {\r\n <translate name=\"login-form.resend-code.in-sec\"></translate>\r\n <!-- <countdown #cd [config]=\"countdownConfig\" (event)=\"countdownEvent($event)\">$!s!</countdown> sec -->\r\n }\r\n\r\n @if(showResend()) {\r\n <p-button color=\"info\" class=\"btn-block\" (click)=\"resendOtp()\">\r\n <translate name=\"login-form.resend-otp\"></translate>\r\n </p-button>\r\n }\r\n </div>\r\n\r\n }\r\n\r\n\r\n @if (context().type == 'PHONE' && !['otp_sent', 'login_name_changed'].includes(context().status) &&\r\n context().errorMessage != 'wrong_code') {\r\n <div class=\"form-group\">\r\n <label class=\"login-label\">\r\n <translate [name]=\"'login-form.phone.' + context().action.toLowerCase()\"></translate>\r\n </label>\r\n <payvent-international-phone [(phoneNumber)]=\"context().loginName\" name=\"phone\"\r\n ngDefaultControl></payvent-international-phone>\r\n\r\n @if (showError()) {\r\n <div class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.phone\"></translate>\r\n </div>\r\n }\r\n\r\n @if (context().status=='duplicate_phone') {\r\n <div class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.duplicate_phone\"></translate>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <button loading-button color=\"success\" class=\"btn-block\" (click)=\"getOtp()\">\r\n <translate [name]=\"'login-form.submit-phone.' + context().action.toLowerCase()\"></translate>\r\n </button>\r\n </div>\r\n }\r\n\r\n @if (context().type=='DATA') {\r\n <div class=\"form-group\">\r\n <div class=\"text-center form-group\">\r\n <label class=\"login-label\">\r\n <translate name=\"login-form.profile-data.login\"></translate>\r\n </label>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"login-form.email\"></translate>\r\n </label>\r\n <input type=\"email\" [(ngModel)]=\"context().user.email\" class=\"form-control\" #email=\"ngModel\" name=\"email\"\r\n disabled />\r\n </div>\r\n <div class=\"form-group name-group\">\r\n <div class=\"first\">\r\n <label>\r\n <translate name=\"login-form.firstName\"></translate>\r\n </label>\r\n <input type=\"text\" [(ngModel)]=\"context().user.firstName\" class=\"form-control\" #firstName=\"ngModel\"\r\n name=\"firstName\" required />\r\n <div *ngIf=\"!firstName.valid && showError\" class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.firstName\"></translate>\r\n </div>\r\n </div>\r\n <div class=\"second\">\r\n <label>\r\n <translate name=\"login-form.lastName\"></translate>\r\n </label>\r\n <input type=\"text\" [(ngModel)]=\"context().user.lastName\" class=\"form-control\" #lastName=\"ngModel\"\r\n name=\"lastName\" required />\r\n <div *ngIf=\"!lastName.valid && showError\" class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.lastName\"></translate>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"login-form.phone\"></translate>\r\n </label>\r\n <input type=\"phone\" [(ngModel)]=\"context().user.phoneNumber\" class=\"form-control\" #phone=\"ngModel\" name=\"phone\"\r\n disabled />\r\n </div>\r\n\r\n\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"login-form.country\"></translate>\r\n </label>\r\n <payvent-country-province-city mode=\"country\" correlation=\"login-form\"></payvent-country-province-city>\r\n @if(translationService.countryProvinceCityPlaceholder['login-form']().countryError) {\r\n <div class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.country\"></translate>\r\n </div>\r\n }\r\n </div>\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"login-form.province\"></translate>\r\n </label>\r\n <payvent-country-province-city mode=\"province\" correlation=\"login-form\"></payvent-country-province-city>\r\n\r\n @if(translationService.countryProvinceCityPlaceholder['login-form']().provinceError) {\r\n <div class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.province\"></translate>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"login-form.city\"></translate>\r\n </label>\r\n <payvent-country-province-city mode=\"city\" correlation=\"login-form\"></payvent-country-province-city>\r\n @if(translationService.countryProvinceCityPlaceholder['login-form']().cityError) {\r\n <div class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate name=\"error.login-form.city\"></translate>\r\n </div>\r\n }\r\n </div>\r\n\r\n @for(item of context().user.consents; track item.id) {\r\n <div class=\"form-group\">\r\n <icheck [name]=\"item.name\" [(ngModel)]=\"item.consented\">\r\n <translate name=\"login-form.consent\"></translate>&nbsp;<a (click)=\"openConsent($event, item)\">\r\n <translate [name]=\"'consent.' + item.name\"></translate>\r\n </a>\r\n </icheck>\r\n <div *ngIf=\"!item.consented && item.required && showError\" class=\"text-danger\">\r\n <i class=\"fa fa-info-circle\"></i>\r\n <translate [name]=\"'consentError.' + item.name\"></translate>\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </form>\r\n\r\n\r\n <div class=\"form-group\">\r\n @if (context().type == 'DATA') {\r\n <button loading-button color=\"success\" class=\"btn-block\" (click)=\"saveUser()\">\r\n <translate name=\"login-form.save-changes\"></translate>\r\n </button>\r\n }\r\n </div>\r\n\r\n @if (context().status && context().status != 'client_not_found' && context().status != 'login_name_changed' &&\r\n context().status != 'otp_verified' && !loading()) {\r\n <div class=\"form-group\">\r\n <p-button (click)=\"resetContext()\">\r\n <translate name=\"login-form.back\"></translate>\r\n </p-button>\r\n </div>\r\n }\r\n\r\n @if(context().action=='VERIFYRECOVER' && context().type=='TOKEN') {\r\n <translate name=\"login-form.recover_success\"></translate>\r\n }\r\n\r\n @if(context().action=='CHANGELOGINNAME' && context().status=='login_name_changed') {\r\n <translate [name]=\"'login-form.login_name_changed.' + context().type.toLowerCase()\"></translate>\r\n }\r\n\r\n</div>", styles: ["@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.loader-container{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffff4d;display:flex;align-items:center;justify-content:center}.loader{content:\"\";box-sizing:border-box;display:inline-block;width:32px;height:32px;position:absolute;border-radius:50%;border:4px solid rgba(237,156,40,.3);border-top-color:#ed9c28;animation:spinner .8s cubic-bezier(.58,.33,.52,.75) infinite;z-index:10000000001}\n"] }]
2048
+ }], ctorParameters: () => [], propDecorators: { myForm: [{
2049
+ type: ViewChild,
2050
+ args: ['myForm', { static: false }]
2051
+ }] } });
2052
+
2053
+ class CookieBarComponent {
2054
+ get isPrerender() {
2055
+ return window.navigator.userAgent.includes('prerender');
2056
+ }
2057
+ cookieService = inject(FlowCookieService);
2058
+ gs = inject(GlobalService);
2059
+ constructor() { }
2060
+ ngOnInit() {
2061
+ }
2062
+ acceptCookies() {
2063
+ this.cookieService.gdprConsent = '1';
2064
+ }
2065
+ rejectCookies() {
2066
+ this.cookieService.gdprConsent = '0';
2067
+ }
2068
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: CookieBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2069
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: CookieBarComponent, isStandalone: true, selector: "cookie-bar", ngImport: i0, template: "@if(!cookieService.gdprConsent && !isPrerender){\r\n<div class=\"flow-cookie-bar-overlay\">\r\n <div class=\"flow-cookie-bar-alert\">\r\n <div style=\"padding: 10px;\">\r\n\r\n <div style=\"margin-bottom: 10px;\">\r\n <translate name=\"cookie-bar.text\"></translate>\r\n </div>\r\n <!-- <a pButton pRipple class=\"p-button-link\" (click)=\"acceptCookies()\">\r\n <translate name=\"cookie-bar.accept\"></translate>\r\n </a> -->\r\n\r\n <!-- <button pButton pRipple class=\"w-full\" (click)=\"acceptCookies()\">\r\n <translate name=\"cookie-bar.accept\"></translate>\r\n </button> -->\r\n\r\n <!-- <div class=\"mb-3\">\r\n <button class=\"w-full\" severity=\"secondary\" pRipple pButton (click)=\"acceptCookies()\">\r\n <translate name=\"cookie-bar.accept\"></translate>\r\n </button>\r\n </div> -->\r\n\r\n <div>\r\n <span style=\"padding: 5px;\">\r\n <p-button [outlined]=\"true\" (click)=\"acceptCookies()\" class=\"button-padding\">\r\n <translate name=\"cookie-bar.accept\"></translate>\r\n </p-button>\r\n </span>\r\n <span style=\"padding: 5px;\">\r\n <p-button [outlined]=\"true\" severity=\"secondary\" (click)=\"rejectCookies()\" class=\"button-padding\">\r\n <translate name=\"cookie-bar.reject\"></translate>\r\n </p-button>\r\n </span>\r\n </div>\r\n\r\n\r\n <!-- <button class=\"btn btn-default yes-btn\" (click)=\"acceptCookies()\">\r\n <translate name=\"cookie-bar.accept\"></translate>\r\n </button>\r\n <a class=\"no-link\" (click)=\"rejectCookies()\">\r\n <translate name=\"cookie-bar.reject\"></translate>\r\n </a> -->\r\n </div>\r\n </div>\r\n</div>\r\n}", styles: [".flow-cookie-bar-overlay{z-index:10;position:fixed;inset:0;background-color:#0003;display:flex;justify-content:center;align-items:center;text-align:center}.flow-cookie-bar-alert{border-radius:6px;background-color:#fff;border:solid 1px #eee;text-align:center;max-width:500px;margin:10px;font-size:medium;box-shadow:0 0 5px #ffa50033}.flow-cookie-bar-alert .yes-btn{margin-right:10px;padding:7px 10px}.flow-cookie-bar-alert .no-link{padding-bottom:10px;text-decoration:none;color:#000}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: TranslationComponent, selector: "translate", inputs: ["name", "replacements"] }, { kind: "ngmodule", type: CardModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: StyleClassModule }], encapsulation: i0.ViewEncapsulation.None });
2070
+ }
2071
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: CookieBarComponent, decorators: [{
2072
+ type: Component,
2073
+ args: [{ selector: 'cookie-bar', encapsulation: ViewEncapsulation.None, standalone: true, imports: [
2074
+ CommonModule,
2075
+ TranslationComponent,
2076
+ CardModule,
2077
+ ButtonModule,
2078
+ StyleClassModule
2079
+ // FormsModule,
2080
+ // RouterModule,
2081
+ // InputTextModule,
2082
+ // RippleModule,
2083
+ // ButtonModule,
2084
+ // DropdownModule,
2085
+ // CheckboxModule,
2086
+ // TagModule,
2087
+ // CompareDirective
2088
+ ], template: "@if(!cookieService.gdprConsent && !isPrerender){\r\n<div class=\"flow-cookie-bar-overlay\">\r\n <div class=\"flow-cookie-bar-alert\">\r\n <div style=\"padding: 10px;\">\r\n\r\n <div style=\"margin-bottom: 10px;\">\r\n <translate name=\"cookie-bar.text\"></translate>\r\n </div>\r\n <!-- <a pButton pRipple class=\"p-button-link\" (click)=\"acceptCookies()\">\r\n <translate name=\"cookie-bar.accept\"></translate>\r\n </a> -->\r\n\r\n <!-- <button pButton pRipple class=\"w-full\" (click)=\"acceptCookies()\">\r\n <translate name=\"cookie-bar.accept\"></translate>\r\n </button> -->\r\n\r\n <!-- <div class=\"mb-3\">\r\n <button class=\"w-full\" severity=\"secondary\" pRipple pButton (click)=\"acceptCookies()\">\r\n <translate name=\"cookie-bar.accept\"></translate>\r\n </button>\r\n </div> -->\r\n\r\n <div>\r\n <span style=\"padding: 5px;\">\r\n <p-button [outlined]=\"true\" (click)=\"acceptCookies()\" class=\"button-padding\">\r\n <translate name=\"cookie-bar.accept\"></translate>\r\n </p-button>\r\n </span>\r\n <span style=\"padding: 5px;\">\r\n <p-button [outlined]=\"true\" severity=\"secondary\" (click)=\"rejectCookies()\" class=\"button-padding\">\r\n <translate name=\"cookie-bar.reject\"></translate>\r\n </p-button>\r\n </span>\r\n </div>\r\n\r\n\r\n <!-- <button class=\"btn btn-default yes-btn\" (click)=\"acceptCookies()\">\r\n <translate name=\"cookie-bar.accept\"></translate>\r\n </button>\r\n <a class=\"no-link\" (click)=\"rejectCookies()\">\r\n <translate name=\"cookie-bar.reject\"></translate>\r\n </a> -->\r\n </div>\r\n </div>\r\n</div>\r\n}", styles: [".flow-cookie-bar-overlay{z-index:10;position:fixed;inset:0;background-color:#0003;display:flex;justify-content:center;align-items:center;text-align:center}.flow-cookie-bar-alert{border-radius:6px;background-color:#fff;border:solid 1px #eee;text-align:center;max-width:500px;margin:10px;font-size:medium;box-shadow:0 0 5px #ffa50033}.flow-cookie-bar-alert .yes-btn{margin-right:10px;padding:7px 10px}.flow-cookie-bar-alert .no-link{padding-bottom:10px;text-decoration:none;color:#000}\n"] }]
2089
+ }], ctorParameters: () => [] });
2090
+
2091
+ class NotificationListComponent {
2092
+ pageNo = 1;
2093
+ loading = false;
2094
+ signalRService = inject(SignalrNotificationService);
2095
+ translationService = inject(TranslationSharedService);
2096
+ constructor() { }
2097
+ ngOnInit() {
2098
+ this.signalRService.getNotifications().subscribe(res => {
2099
+ this.signalRService.messages.filter(m => m.isUnread).forEach(item => {
2100
+ item.isUnread = false;
2101
+ item.wasNew = true;
2102
+ });
2103
+ this.signalRService.setReadReceipt();
2104
+ });
2105
+ }
2106
+ ngOnDestroy() {
2107
+ this.signalRService.messages.forEach(item => {
2108
+ item.wasNew = false;
2109
+ });
2110
+ }
2111
+ get messages() {
2112
+ return this.signalRService.messages.slice().sort((a, b) => (a.creationTime.toString() < b.creationTime.toString() ? 1 : -1));
2113
+ }
2114
+ openNextPage() {
2115
+ this.loading = true;
2116
+ this.signalRService.messagePageNo++;
2117
+ this.signalRService.getNotifications().subscribe(res => this.loading = false);
2118
+ }
2119
+ notificationClick(message) {
2120
+ this.signalRService.onNotificationClick.emit(message);
2121
+ }
2122
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NotificationListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2123
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: NotificationListComponent, isStandalone: true, selector: "app-notification-list", ngImport: i0, template: "@for( m of messages; track m){\r\n<span>\r\n <li [class]=\"m.isUnread ? 'dropdown-message-unread' : m.wasNew ? 'dropdown-message-wasnew' : ''\">\r\n <div class=\"dropdown-messages-box\">\r\n <a class=\"media-link\" (click)=\"notificationClick(m)\">\r\n @if(m.mediaType=='Image' && m.mediaSrc){<img [src]=\"m.mediaSrc\" style=\"width:100%\" />}\r\n <span class=\"media-body\">\r\n <!-- <i class=\"fa fa-check bg-green icon\" *ngIf=\"m.class=='success'\"></i>\r\n <i class=\"fa fa-info-circle bg-aqua icon\" *ngIf=\"m.class=='info'\"></i>\r\n <i class=\"fa fa-exclamation-circle icon bg-yellow\" *ngIf=\"m.class=='warning'\"></i>\r\n <i class=\"fa fa-times bg-red icon\" *ngIf=\"m.class=='error'\"></i> -->\r\n @if(m.class=='success'){\r\n <i class=\"pi pi-check\"></i>\r\n }\r\n @if(m.class=='info'){\r\n <i class=\"pi pi-info-circle\"></i>\r\n }\r\n @if(m.class=='warning'){\r\n <i class=\"pi-exclamation-circle\"></i>\r\n }\r\n @if(m.class=='error'){\r\n <i class=\"pi pi-times\"></i>\r\n }\r\n\r\n <!-- @if(m.subject){\r\n <div class=\"media-title\">\r\n {{signalRService.processReplacements(m.subject | translation : translationService.translations, m.model)}}\r\n </div>\r\n }\r\n\r\n <span\r\n [innerHtml]=\"signalRService.processReplacements(m.body | translation : translationService.translations, m.model)\">\r\n </span>\r\n <br />\r\n <small class=\"text-muted\">\r\n <i class=\"fa subicon fa-clock-o\"></i> {{m.creationTime | amFromUtc | amTimeAgo}}</small> -->\r\n </span>\r\n </a>\r\n\r\n </div>\r\n </li>\r\n</span>\r\n}\r\n\r\n@if(messages.length==0){\r\n<li>\r\n <div class=\"media-body text-center text-muted\">\r\n <translate name=\"messages.nomessages\"></translate>\r\n </div>\r\n\r\n</li>\r\n}\r\n@if(signalRService.hasMorePages){\r\n<div class=\"media-body notification-footer text-center text-muted small-text\">\r\n @if(loading){<span class=\"loader loader-small\"></span>}\r\n @if(!loading){\r\n <a (click)=\"openNextPage()\">\r\n <translate name=\"messages.viewmore\"></translate>\r\n </a>\r\n }\r\n</div>\r\n}", styles: [".icon{margin-right:7px;margin-bottom:3px}.media-title{font-weight:700}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: TranslationComponent, selector: "translate", inputs: ["name", "replacements"] }, { kind: "ngmodule", type: CardModule }] });
2124
+ }
2125
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NotificationListComponent, decorators: [{
2126
+ type: Component,
2127
+ args: [{ selector: 'app-notification-list', standalone: true, imports: [
2128
+ CommonModule,
2129
+ TranslationComponent,
2130
+ CardModule,
2131
+ ], template: "@for( m of messages; track m){\r\n<span>\r\n <li [class]=\"m.isUnread ? 'dropdown-message-unread' : m.wasNew ? 'dropdown-message-wasnew' : ''\">\r\n <div class=\"dropdown-messages-box\">\r\n <a class=\"media-link\" (click)=\"notificationClick(m)\">\r\n @if(m.mediaType=='Image' && m.mediaSrc){<img [src]=\"m.mediaSrc\" style=\"width:100%\" />}\r\n <span class=\"media-body\">\r\n <!-- <i class=\"fa fa-check bg-green icon\" *ngIf=\"m.class=='success'\"></i>\r\n <i class=\"fa fa-info-circle bg-aqua icon\" *ngIf=\"m.class=='info'\"></i>\r\n <i class=\"fa fa-exclamation-circle icon bg-yellow\" *ngIf=\"m.class=='warning'\"></i>\r\n <i class=\"fa fa-times bg-red icon\" *ngIf=\"m.class=='error'\"></i> -->\r\n @if(m.class=='success'){\r\n <i class=\"pi pi-check\"></i>\r\n }\r\n @if(m.class=='info'){\r\n <i class=\"pi pi-info-circle\"></i>\r\n }\r\n @if(m.class=='warning'){\r\n <i class=\"pi-exclamation-circle\"></i>\r\n }\r\n @if(m.class=='error'){\r\n <i class=\"pi pi-times\"></i>\r\n }\r\n\r\n <!-- @if(m.subject){\r\n <div class=\"media-title\">\r\n {{signalRService.processReplacements(m.subject | translation : translationService.translations, m.model)}}\r\n </div>\r\n }\r\n\r\n <span\r\n [innerHtml]=\"signalRService.processReplacements(m.body | translation : translationService.translations, m.model)\">\r\n </span>\r\n <br />\r\n <small class=\"text-muted\">\r\n <i class=\"fa subicon fa-clock-o\"></i> {{m.creationTime | amFromUtc | amTimeAgo}}</small> -->\r\n </span>\r\n </a>\r\n\r\n </div>\r\n </li>\r\n</span>\r\n}\r\n\r\n@if(messages.length==0){\r\n<li>\r\n <div class=\"media-body text-center text-muted\">\r\n <translate name=\"messages.nomessages\"></translate>\r\n </div>\r\n\r\n</li>\r\n}\r\n@if(signalRService.hasMorePages){\r\n<div class=\"media-body notification-footer text-center text-muted small-text\">\r\n @if(loading){<span class=\"loader loader-small\"></span>}\r\n @if(!loading){\r\n <a (click)=\"openNextPage()\">\r\n <translate name=\"messages.viewmore\"></translate>\r\n </a>\r\n }\r\n</div>\r\n}", styles: [".icon{margin-right:7px;margin-bottom:3px}.media-title{font-weight:700}\n"] }]
2132
+ }], ctorParameters: () => [] });
2133
+
2134
+ class NotificationDropdownComponent {
2135
+ connection;
2136
+ notificationsOpen = false;
2137
+ sortingPagingCriteria = new SortingPagingCriteria();
2138
+ canClose;
2139
+ icon = input('fa fa-bell', ...(ngDevMode ? [{ debugName: "icon" }] : []));
2140
+ translation = input('', ...(ngDevMode ? [{ debugName: "translation" }] : []));
2141
+ linkClass = input('', ...(ngDevMode ? [{ debugName: "linkClass" }] : []));
2142
+ onDocumentClick(targetElementPath) {
2143
+ let elementRefInPath = targetElementPath.path ? targetElementPath.path.find(e => e === this._elementRef.nativeElement) : undefined;
2144
+ if (!elementRefInPath && this.notificationsOpen && this.canClose) {
2145
+ this.openNotifications();
2146
+ }
2147
+ }
2148
+ signalRService = inject(SignalrNotificationService);
2149
+ translationService = inject(TranslationSharedService);
2150
+ _elementRef = inject(ElementRef);
2151
+ constructor() { }
2152
+ ngOnInit() {
2153
+ }
2154
+ openNotifications() {
2155
+ this.canClose = false;
2156
+ this.notificationsOpen = !this.notificationsOpen;
2157
+ timer(100).subscribe(r => this.canClose = true);
2158
+ }
2159
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NotificationDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2160
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: NotificationDropdownComponent, isStandalone: true, selector: "[notification-dropdown]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, translation: { classPropertyName: "translation", publicName: "translation", isSignal: true, isRequired: false, transformFunction: null }, linkClass: { classPropertyName: "linkClass", publicName: "linkClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:touchend": "onDocumentClick($event)", "document:click": "onDocumentClick($event)" }, properties: { "class.open": "this.notificationsOpen" } }, ngImport: i0, template: "<a [class]=\"'dropdown-toggle count-info ' + linkClass\" (click)=\"openNotifications()\">\r\n <i [class]=\"icon()\"></i>\r\n @if(signalRService.unreadMessageCount>0){\r\n <span class=\"label label-primary\">{{signalRService.unreadMessageCount}}</span>\r\n }\r\n @if(translation){<translate [name]=\"translation\"></translate>}\r\n</a>\r\n@if(notificationsOpen){\r\n<ul class=\"dropdown-menu dropdown-messages\" #messagesCtl>\r\n <app-notification-list></app-notification-list>\r\n</ul>\r\n}", styles: [".media-body .icon{padding:2px;border-radius:2px;margin-right:3px}a.media-body{text-decoration:none}.media-body .subicon{margin-right:1px}.dropdown-menu{max-height:500px;overflow-y:auto;overflow-x:hidden;text-align:left}.dropdown-menu::-webkit-scrollbar-track{border-radius:5px;background-color:transparent}.dropdown-menu::-webkit-scrollbar{width:6px;background-color:transparent}.dropdown-menu::-webkit-scrollbar-thumb{border-radius:5px;background-color:#afafaf4d}.notification-footer{background-color:#fafafa;padding:10px 0;vertical-align:bottom}.notification-footer a{color:#333;font-size:9pt;font-weight:700}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: TranslationComponent, selector: "translate", inputs: ["name", "replacements"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: NotificationListComponent, selector: "app-notification-list" }] });
2161
+ }
2162
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NotificationDropdownComponent, decorators: [{
2163
+ type: Component,
2164
+ args: [{ selector: '[notification-dropdown]', standalone: true, imports: [
2165
+ CommonModule,
2166
+ TranslationComponent,
2167
+ CardModule,
2168
+ NotificationListComponent,
2169
+ ], template: "<a [class]=\"'dropdown-toggle count-info ' + linkClass\" (click)=\"openNotifications()\">\r\n <i [class]=\"icon()\"></i>\r\n @if(signalRService.unreadMessageCount>0){\r\n <span class=\"label label-primary\">{{signalRService.unreadMessageCount}}</span>\r\n }\r\n @if(translation){<translate [name]=\"translation\"></translate>}\r\n</a>\r\n@if(notificationsOpen){\r\n<ul class=\"dropdown-menu dropdown-messages\" #messagesCtl>\r\n <app-notification-list></app-notification-list>\r\n</ul>\r\n}", styles: [".media-body .icon{padding:2px;border-radius:2px;margin-right:3px}a.media-body{text-decoration:none}.media-body .subicon{margin-right:1px}.dropdown-menu{max-height:500px;overflow-y:auto;overflow-x:hidden;text-align:left}.dropdown-menu::-webkit-scrollbar-track{border-radius:5px;background-color:transparent}.dropdown-menu::-webkit-scrollbar{width:6px;background-color:transparent}.dropdown-menu::-webkit-scrollbar-thumb{border-radius:5px;background-color:#afafaf4d}.notification-footer{background-color:#fafafa;padding:10px 0;vertical-align:bottom}.notification-footer a{color:#333;font-size:9pt;font-weight:700}\n"] }]
2170
+ }], ctorParameters: () => [], propDecorators: { notificationsOpen: [{
2171
+ type: HostBinding,
2172
+ args: ['class.open']
2173
+ }], onDocumentClick: [{
2174
+ type: HostListener,
2175
+ args: ['document:touchend', ['$event']]
2176
+ }, {
2177
+ type: HostListener,
2178
+ args: ['document:click', ['$event']]
2179
+ }] } });
2180
+
2181
+ class NotificationToasterComponent {
2182
+ connection;
2183
+ _messages = [];
2184
+ newMessage;
2185
+ obsTimeout;
2186
+ obsTimer;
2187
+ signalRService = inject(SignalrNotificationService);
2188
+ translationService = inject(TranslationSharedService);
2189
+ messageService = inject(MessageService);
2190
+ constructor() { }
2191
+ ngOnInit() {
2192
+ this.signalRService.onNotification.subscribe(m => {
2193
+ m.isToasterUnread = true;
2194
+ m.isUnread = true;
2195
+ if (this.obsTimer) {
2196
+ this.obsTimer.unsubscribe();
2197
+ }
2198
+ this.obsTimeout = timer(5000);
2199
+ this.obsTimer = this.obsTimeout.subscribe(() => this.messages.forEach(m => {
2200
+ m.isToasterUnread = false;
2201
+ }));
2202
+ if (this.messages.length > 5)
2203
+ this.messages[0].isToasterUnread = false;
2204
+ });
2205
+ }
2206
+ get messages() {
2207
+ return this.signalRService.messages.filter(m => m && m.isToasterUnread && m.isUnread);
2208
+ }
2209
+ sendMessage() {
2210
+ this.connection.invoke('send', this.newMessage);
2211
+ this.newMessage = '';
2212
+ }
2213
+ removeNotification(not) {
2214
+ not.isUnread = false;
2215
+ not.isToasterUnread = false;
2216
+ }
2217
+ notificationClick(message) {
2218
+ this.signalRService.onNotificationClick.emit(message);
2219
+ this.removeNotification(message);
2220
+ }
2221
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NotificationToasterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2222
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: NotificationToasterComponent, isStandalone: true, selector: "app-notification-toaster", ngImport: i0, template: "<div id=\"toast-container\" class=\"card flex justify-content-center\" class=\"toast-bottom-right\">\r\n <p-toast />\r\n @for (m of messages; track m) {\r\n <p-button (onClick)=\"notificationClick(m)\" [severity]=\" m.class\" />\r\n <div class=\"toast-progress\"></div>\r\n <div class=\"pull-left\">\r\n @if(!m.iconUrl){\r\n <ng-container>\r\n @if(m.class=='success'){\r\n <i class=\"pi pi-check\"></i>\r\n }\r\n @if(m.class=='info'){\r\n <i class=\"pi pi-info-circle\"></i>\r\n }\r\n @if(m.class=='warning'){\r\n <i class=\"pi-exclamation-circle\"></i>\r\n }\r\n @if(m.class=='error'){\r\n <i class=\"pi pi-times\"></i>\r\n }\r\n </ng-container>\r\n }\r\n\r\n @if(m.iconUrl){<div [style.backgroundImage]=\"'url(' + m.iconUrl + ')'\" class=\"toast-icon\"></div>\r\n}\r\n </div>\r\n\r\n }\r\n</div>\r\n", styles: ["#toast-container>.toast{background-image:none!important}#toast-container>div{-moz-box-shadow:0 0 3px #999;-webkit-box-shadow:0 0 3px #999;box-shadow:0 0 3px #999;opacity:.9;-ms-filter:alpha(Opacity=90);filter:alpha(opacity=90)}#toast-container>:hover{-moz-box-shadow:0 0 4px #999;-webkit-box-shadow:0 0 4px #999;box-shadow:0 0 4px #999;opacity:1;-ms-filter:alpha(Opacity=100);filter:alpha(opacity=100);cursor:pointer}.toast-title{font-weight:700}.toast-message{-ms-word-wrap:break-word;word-wrap:break-word}.toast-message a,.toast-message label{color:#fff}.toast-message a:hover{color:#ccc;text-decoration:none}.toast-close-button{position:relative;right:-.3em;top:-.3em;float:right;font-size:20px;font-weight:700;color:#fff;-webkit-text-shadow:0 1px 0 #fff;text-shadow:0 1px 0 #fff;opacity:.8;-ms-filter:alpha(Opacity=80);filter:alpha(opacity=80)}.toast-close-button:focus,.toast-close-button:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.4;-ms-filter:alpha(Opacity=40);filter:alpha(opacity=40)}button.toast-close-button{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none;position:absolute;right:10px;top:5px}.toast-top-center{top:0;right:0;width:100%}.toast-icon{width:48px;height:48px;border-radius:4px;background-color:#fff;background-size:90%;background-repeat:no-repeat;background-position:center center;margin:0 7px 7px 0}.toast-bottom-center{bottom:0;right:0;width:100%}.toast-top-full-width{top:0;right:0;width:100%}.toast-bottom-full-width{bottom:0;right:0;width:100%}.toast-top-left{top:12px;left:12px}.toast-top-right{top:12px;right:12px}.toast-bottom-right{right:12px;bottom:12px}.toast-bottom-left{bottom:12px;left:12px}#toast-container{position:fixed;z-index:999999}#toast-container *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.toast{position:relative;overflow:hidden;margin:0 0 6px;padding:15px 25px 15px 15px;width:300px;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background-position:15px center;background-repeat:no-repeat;-moz-box-shadow:0 0 12px #999;-webkit-box-shadow:0 0 12px #999;box-shadow:0 0 12px #999;opacity:.8;-ms-filter:alpha(Opacity=80);filter:alpha(opacity=80)}#toast-container>:hover{-moz-box-shadow:0 0 12px #000;-webkit-box-shadow:0 0 12px #000;box-shadow:0 0 12px #000;opacity:1;-ms-filter:alpha(Opacity=100);filter:alpha(opacity=100);cursor:pointer}.icon{margin-right:10px;margin-bottom:10px}#toast-container.toast-bottom-center>div,#toast-container.toast-top-center>div{width:300px;margin:auto}#toast-container.toast-bottom-full-width>div,#toast-container.toast-top-full-width>div{width:96%;margin:auto}.toast{background-color:#030303;color:#fff}.toast-success{background-color:#51a351;color:#fff}.toast-error{background-color:#bd362f;color:#fff}.toast-info{background-color:#2f96b4;color:#fff}.toast-warning{background-color:#f89406;color:#fff}.toast-default{background-color:#fafafa;color:#555;padding:none}.toast-default.toast,.toast-default.toast .toast-message{padding:0}.toast-default.toast .toast-text-container{padding:15px}.toast-default.toast .toast-title{margin-bottom:3px}.toast-default .toast-message a,.toast-default .toast-message label{color:#555}.toast-progress{position:absolute;left:0;bottom:0;height:4px;background-color:#000;opacity:.4;-ms-filter:alpha(Opacity=40);filter:alpha(opacity=40)}@media all and (max-width: 240px){#toast-container>div{width:90%;margin-left:auto;margin-right:auto}}@media all and (min-width: 241px) and (max-width: 480px){#toast-container>div{width:90%;margin-left:auto;margin-right:auto}}@media all and (min-width: 481px) and (max-width: 768px){#toast-container>div{width:25em}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: CardModule }, { kind: "ngmodule", type: ToastModule }, { kind: "component", type: i1$3.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "life", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }] });
2223
+ }
2224
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NotificationToasterComponent, decorators: [{
2225
+ type: Component,
2226
+ args: [{ selector: 'app-notification-toaster', standalone: true, imports: [
2227
+ TranslationPipe,
2228
+ CommonModule,
2229
+ TranslationComponent,
2230
+ CardModule,
2231
+ ToastModule,
2232
+ ButtonModule
2233
+ ], template: "<div id=\"toast-container\" class=\"card flex justify-content-center\" class=\"toast-bottom-right\">\r\n <p-toast />\r\n @for (m of messages; track m) {\r\n <p-button (onClick)=\"notificationClick(m)\" [severity]=\" m.class\" />\r\n <div class=\"toast-progress\"></div>\r\n <div class=\"pull-left\">\r\n @if(!m.iconUrl){\r\n <ng-container>\r\n @if(m.class=='success'){\r\n <i class=\"pi pi-check\"></i>\r\n }\r\n @if(m.class=='info'){\r\n <i class=\"pi pi-info-circle\"></i>\r\n }\r\n @if(m.class=='warning'){\r\n <i class=\"pi-exclamation-circle\"></i>\r\n }\r\n @if(m.class=='error'){\r\n <i class=\"pi pi-times\"></i>\r\n }\r\n </ng-container>\r\n }\r\n\r\n @if(m.iconUrl){<div [style.backgroundImage]=\"'url(' + m.iconUrl + ')'\" class=\"toast-icon\"></div>\r\n}\r\n </div>\r\n\r\n }\r\n</div>\r\n", styles: ["#toast-container>.toast{background-image:none!important}#toast-container>div{-moz-box-shadow:0 0 3px #999;-webkit-box-shadow:0 0 3px #999;box-shadow:0 0 3px #999;opacity:.9;-ms-filter:alpha(Opacity=90);filter:alpha(opacity=90)}#toast-container>:hover{-moz-box-shadow:0 0 4px #999;-webkit-box-shadow:0 0 4px #999;box-shadow:0 0 4px #999;opacity:1;-ms-filter:alpha(Opacity=100);filter:alpha(opacity=100);cursor:pointer}.toast-title{font-weight:700}.toast-message{-ms-word-wrap:break-word;word-wrap:break-word}.toast-message a,.toast-message label{color:#fff}.toast-message a:hover{color:#ccc;text-decoration:none}.toast-close-button{position:relative;right:-.3em;top:-.3em;float:right;font-size:20px;font-weight:700;color:#fff;-webkit-text-shadow:0 1px 0 #fff;text-shadow:0 1px 0 #fff;opacity:.8;-ms-filter:alpha(Opacity=80);filter:alpha(opacity=80)}.toast-close-button:focus,.toast-close-button:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.4;-ms-filter:alpha(Opacity=40);filter:alpha(opacity=40)}button.toast-close-button{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none;position:absolute;right:10px;top:5px}.toast-top-center{top:0;right:0;width:100%}.toast-icon{width:48px;height:48px;border-radius:4px;background-color:#fff;background-size:90%;background-repeat:no-repeat;background-position:center center;margin:0 7px 7px 0}.toast-bottom-center{bottom:0;right:0;width:100%}.toast-top-full-width{top:0;right:0;width:100%}.toast-bottom-full-width{bottom:0;right:0;width:100%}.toast-top-left{top:12px;left:12px}.toast-top-right{top:12px;right:12px}.toast-bottom-right{right:12px;bottom:12px}.toast-bottom-left{bottom:12px;left:12px}#toast-container{position:fixed;z-index:999999}#toast-container *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.toast{position:relative;overflow:hidden;margin:0 0 6px;padding:15px 25px 15px 15px;width:300px;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background-position:15px center;background-repeat:no-repeat;-moz-box-shadow:0 0 12px #999;-webkit-box-shadow:0 0 12px #999;box-shadow:0 0 12px #999;opacity:.8;-ms-filter:alpha(Opacity=80);filter:alpha(opacity=80)}#toast-container>:hover{-moz-box-shadow:0 0 12px #000;-webkit-box-shadow:0 0 12px #000;box-shadow:0 0 12px #000;opacity:1;-ms-filter:alpha(Opacity=100);filter:alpha(opacity=100);cursor:pointer}.icon{margin-right:10px;margin-bottom:10px}#toast-container.toast-bottom-center>div,#toast-container.toast-top-center>div{width:300px;margin:auto}#toast-container.toast-bottom-full-width>div,#toast-container.toast-top-full-width>div{width:96%;margin:auto}.toast{background-color:#030303;color:#fff}.toast-success{background-color:#51a351;color:#fff}.toast-error{background-color:#bd362f;color:#fff}.toast-info{background-color:#2f96b4;color:#fff}.toast-warning{background-color:#f89406;color:#fff}.toast-default{background-color:#fafafa;color:#555;padding:none}.toast-default.toast,.toast-default.toast .toast-message{padding:0}.toast-default.toast .toast-text-container{padding:15px}.toast-default.toast .toast-title{margin-bottom:3px}.toast-default .toast-message a,.toast-default .toast-message label{color:#555}.toast-progress{position:absolute;left:0;bottom:0;height:4px;background-color:#000;opacity:.4;-ms-filter:alpha(Opacity=40);filter:alpha(opacity=40)}@media all and (max-width: 240px){#toast-container>div{width:90%;margin-left:auto;margin-right:auto}}@media all and (min-width: 241px) and (max-width: 480px){#toast-container>div{width:90%;margin-left:auto;margin-right:auto}}@media all and (min-width: 481px) and (max-width: 768px){#toast-container>div{width:25em}}\n"] }]
2234
+ }], ctorParameters: () => [] });
2235
+
2236
+ class QrScannerComponent {
2237
+ value = '';
2238
+ // @Input()
2239
+ // public disabled: boolean;
2240
+ // disabled = input<boolean>('')
2241
+ eventListener;
2242
+ valueRead = new EventEmitter();
2243
+ timeout;
2244
+ renderer = inject(Renderer2);
2245
+ constructor() { }
2246
+ ngOnInit() {
2247
+ this.eventListener = this.renderer.listen(document, 'keydown', (event) => {
2248
+ // if (this.disabled())
2249
+ // return;
2250
+ if (this.timeout)
2251
+ clearTimeout(this.timeout);
2252
+ if (event.keyCode != 13) {
2253
+ if (event.keyCode >= 31) {
2254
+ this.value += event.key.toString().toUpperCase();
2255
+ this.timeout = setTimeout(() => {
2256
+ this.value = '';
2257
+ }, 1000);
2258
+ }
2259
+ }
2260
+ else {
2261
+ this.valueRead.emit(this.value);
2262
+ this.value = '';
2263
+ }
2264
+ });
2265
+ }
2266
+ ngOnDestroy() {
2267
+ this.eventListener();
2268
+ }
2269
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: QrScannerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2270
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.6", type: QrScannerComponent, isStandalone: true, selector: "flow-qr-scanner", outputs: { valueRead: "valueRead" }, ngImport: i0, template: "", styles: [""] });
2271
+ }
2272
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: QrScannerComponent, decorators: [{
2273
+ type: Component,
2274
+ args: [{ selector: 'flow-qr-scanner', standalone: true, template: "" }]
2275
+ }], ctorParameters: () => [], propDecorators: { valueRead: [{
2276
+ type: Output
2277
+ }] } });
2278
+
2279
+ class SidebarComponent {
2280
+ contentComponent;
2281
+ sidebarService = inject(SidebarService);
2282
+ initialHeight;
2283
+ panElement;
2284
+ contentScrollable = signal(false, ...(ngDevMode ? [{ debugName: "contentScrollable" }] : []));
2285
+ #deltaScroll = 0;
2286
+ #initialY = 0;
2287
+ #initialTimestamp;
2288
+ ngOnInit() {
2289
+ }
2290
+ closeCallback(id) {
2291
+ this.sidebarService.closeSidebar(id);
2292
+ }
2293
+ onPan(evt, id) {
2294
+ console.log(evt);
2295
+ switch (evt.type) {
2296
+ case 'touchstart':
2297
+ let targetId = evt.target.id;
2298
+ this.panElement = document.querySelector(`#sidebar-${id} .p-drawer`);
2299
+ this.panElement.style.transition = 'none';
2300
+ this.initialHeight = this.panElement.offsetHeight;
2301
+ this.#initialY = evt.touches[0].clientY;
2302
+ this.#initialTimestamp = new Date().getTime();
2303
+ break;
2304
+ case 'touchmove':
2305
+ if (!this.panElement)
2306
+ return;
2307
+ this.#deltaScroll = this.#initialY - evt.touches[0].clientY;
2308
+ if (this.#deltaScroll < 0 && this.contentComponent.nativeElement.scrollTop > 0) {
2309
+ this.panElement = null;
2310
+ return;
2311
+ }
2312
+ this.panElement.style.height = (this.initialHeight + this.#initialY - evt.touches[0].clientY) + 'px';
2313
+ break;
2314
+ case 'touchend':
2315
+ if (!this.panElement)
2316
+ return;
2317
+ let currentSidebar = this.sidebarService.sidebars().find(s => s.id == id);
2318
+ this.panElement.style.transition = 'height .2s';
2319
+ let scrollSpeed = Math.abs(this.#deltaScroll) / Math.floor(new Date().getTime() - this.#initialTimestamp);
2320
+ if (this.panElement.offsetHeight < window.innerHeight * .3 || (this.#deltaScroll < 0 && scrollSpeed > 1.3)) {
2321
+ this.closeCallback(id);
2322
+ }
2323
+ if (this.panElement.offsetHeight > window.innerHeight * .3 && this.panElement.offsetHeight < window.innerHeight * .7) {
2324
+ this.panElement.style.height = '50%';
2325
+ currentSidebar.options.contentScrollable.set(false);
2326
+ }
2327
+ if (this.panElement.offsetHeight > window.innerHeight * .7) {
2328
+ this.panElement.style.height = '95%';
2329
+ currentSidebar.options.contentScrollable.set(true);
2330
+ }
2331
+ this.#deltaScroll = 0;
2332
+ this.#initialTimestamp = 0;
2333
+ this.#initialY = 0;
2334
+ this.panElement = null;
2335
+ break;
2336
+ }
2337
+ }
2338
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SidebarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2339
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: SidebarComponent, isStandalone: true, selector: "sidebar", viewQueries: [{ propertyName: "contentComponent", first: true, predicate: ["content"], descendants: true, read: ElementRef }], ngImport: i0, template: "@for(sidebar of sidebarService.sidebars(); track sidebar.id) {\r\n<div [id]=\"'sidebar-' + sidebar.id\" style=\"height: 100%;\">\r\n <p-drawer [visible]=\"sidebar.visible\" [appendTo]=\"'sidebar-' + sidebar.id\" dismissible=\"false\" closeOnEscape=\"false\"\r\n [position]=\"sidebar.options.position\" [style]=\"sidebar.options.ngStyle\">\r\n <ng-template pTemplate=\"headless\">\r\n <div class=\"flex flex-col h-full\" [id]=\"'sidebar-body-' + sidebar.id\" style=\"touch-action: none;\"\r\n (touchmove)=\"onPan($event, sidebar.id)\" (touchstart)=\"onPan($event, sidebar.id)\"\r\n (touchend)=\"onPan($event, sidebar.id)\">\r\n <div class=\"flex align-items-center justify-content-between px-3 py-2 flex-shrink-0\"\r\n [id]=\"'sidebar-header-' + sidebar.id\">\r\n <span [id]=\"'sidebar-header-inner-' + sidebar.id\"\r\n class=\"inline-flex flex-1 align-items-center justify-content-center gap-2 \">\r\n @if (sidebar.options.position=='bottom') {\r\n <div class=\"inline-block self-center bg-sky-400 rounded-full my-8\"\r\n [id]=\"'sidebar-header-hook-' + sidebar.id\" style=\"height: .3rem; width:70px\"></div>\r\n }\r\n </span>\r\n @if(sidebar.options.position == 'left' || sidebar.options.position == 'right') {\r\n <span>\r\n <p-button type=\"button\" (click)=\"closeCallback(sidebar.id)\" rounded=\"true\" outlined=\"true\"\r\n styleClass=\"h-2rem w-2rem\"><span class=\"material-symbols\">close</span></p-button>\r\n </span>\r\n }\r\n </div>\r\n <div #content\r\n [class]=\"{ 'overflow-y-auto': sidebar.options.contentScrollable(), 'p-3': !sidebar.options.noPadding }\">\r\n <ng-container *ngComponentOutlet=\"sidebar.component;inputs: sidebar.inputs;\" />\r\n </div>\r\n </div>\r\n </ng-template>\r\n </p-drawer>\r\n</div>\r\n}", styles: [""], dependencies: [{ kind: "ngmodule", type: DrawerModule }, { kind: "component", type: i1$4.Drawer, selector: "p-drawer", inputs: ["appendTo", "blockScroll", "style", "styleClass", "ariaCloseLabel", "autoZIndex", "baseZIndex", "modal", "closeButtonProps", "dismissible", "showCloseIcon", "closeOnEscape", "transitionOptions", "visible", "position", "fullScreen", "header", "maskStyle", "closable"], outputs: ["onShow", "onHide", "visibleChange"] }, { kind: "directive", type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: HammerModule }] });
2340
+ }
2341
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SidebarComponent, decorators: [{
2342
+ type: Component,
2343
+ args: [{ selector: 'sidebar', standalone: true, imports: [DrawerModule, NgComponentOutlet, ButtonModule, HammerModule], template: "@for(sidebar of sidebarService.sidebars(); track sidebar.id) {\r\n<div [id]=\"'sidebar-' + sidebar.id\" style=\"height: 100%;\">\r\n <p-drawer [visible]=\"sidebar.visible\" [appendTo]=\"'sidebar-' + sidebar.id\" dismissible=\"false\" closeOnEscape=\"false\"\r\n [position]=\"sidebar.options.position\" [style]=\"sidebar.options.ngStyle\">\r\n <ng-template pTemplate=\"headless\">\r\n <div class=\"flex flex-col h-full\" [id]=\"'sidebar-body-' + sidebar.id\" style=\"touch-action: none;\"\r\n (touchmove)=\"onPan($event, sidebar.id)\" (touchstart)=\"onPan($event, sidebar.id)\"\r\n (touchend)=\"onPan($event, sidebar.id)\">\r\n <div class=\"flex align-items-center justify-content-between px-3 py-2 flex-shrink-0\"\r\n [id]=\"'sidebar-header-' + sidebar.id\">\r\n <span [id]=\"'sidebar-header-inner-' + sidebar.id\"\r\n class=\"inline-flex flex-1 align-items-center justify-content-center gap-2 \">\r\n @if (sidebar.options.position=='bottom') {\r\n <div class=\"inline-block self-center bg-sky-400 rounded-full my-8\"\r\n [id]=\"'sidebar-header-hook-' + sidebar.id\" style=\"height: .3rem; width:70px\"></div>\r\n }\r\n </span>\r\n @if(sidebar.options.position == 'left' || sidebar.options.position == 'right') {\r\n <span>\r\n <p-button type=\"button\" (click)=\"closeCallback(sidebar.id)\" rounded=\"true\" outlined=\"true\"\r\n styleClass=\"h-2rem w-2rem\"><span class=\"material-symbols\">close</span></p-button>\r\n </span>\r\n }\r\n </div>\r\n <div #content\r\n [class]=\"{ 'overflow-y-auto': sidebar.options.contentScrollable(), 'p-3': !sidebar.options.noPadding }\">\r\n <ng-container *ngComponentOutlet=\"sidebar.component;inputs: sidebar.inputs;\" />\r\n </div>\r\n </div>\r\n </ng-template>\r\n </p-drawer>\r\n</div>\r\n}" }]
2344
+ }], propDecorators: { contentComponent: [{
2345
+ type: ViewChild,
2346
+ args: ['content', { read: ElementRef }]
2347
+ }] } });
2348
+
2349
+ class StoriesComponent {
2350
+ stories = input([], ...(ngDevMode ? [{ debugName: "stories" }] : []));
2351
+ currentStoryIndex = signal(-1, ...(ngDevMode ? [{ debugName: "currentStoryIndex" }] : []));
2352
+ footerTemplate = input(...(ngDevMode ? [undefined, { debugName: "footerTemplate" }] : []));
2353
+ subFooterTemplate = input(...(ngDevMode ? [undefined, { debugName: "subFooterTemplate" }] : []));
2354
+ sideTemplate = input(...(ngDevMode ? [undefined, { debugName: "sideTemplate" }] : []));
2355
+ showSubFooter = input(true, ...(ngDevMode ? [{ debugName: "showSubFooter" }] : []));
2356
+ mute = signal(true, ...(ngDevMode ? [{ debugName: "mute" }] : []));
2357
+ descriptionOpen = input(...(ngDevMode ? [undefined, { debugName: "descriptionOpen" }] : []));
2358
+ storyChanged = output();
2359
+ currentStory = computed(() => this.stories()[this.currentStoryIndex()], ...(ngDevMode ? [{ debugName: "currentStory" }] : []));
2360
+ defaultDuration = input(7, ...(ngDevMode ? [{ debugName: "defaultDuration" }] : []));
2361
+ currentProgress = signal(0, ...(ngDevMode ? [{ debugName: "currentProgress" }] : []));
2362
+ currentTime = 0;
2363
+ timerInterval = 100;
2364
+ timerSubscription;
2365
+ paused = model(false, ...(ngDevMode ? [{ debugName: "paused" }] : []));
2366
+ sidebarService = inject(SidebarService);
2367
+ videoPlayer;
2368
+ constructor() {
2369
+ effect(() => {
2370
+ if (this.currentStoryIndex() == -1 && this.stories().length > 0)
2371
+ untracked(() => this.next());
2372
+ });
2373
+ effect(() => {
2374
+ if (!this.paused()) {
2375
+ untracked(() => this.runTimer());
2376
+ if (this.videoPlayer)
2377
+ this.videoPlayer.nativeElement.play();
2378
+ }
2379
+ else {
2380
+ if (this.videoPlayer)
2381
+ this.videoPlayer.nativeElement.pause();
2382
+ }
2383
+ });
2384
+ }
2385
+ ngOnInit() {
2386
+ }
2387
+ next() {
2388
+ this.currentStoryIndex.update(c => c + 1 < this.stories().length ? c + 1 : 0);
2389
+ this.currentStory().completion = signal(0, ...(ngDevMode ? [{ debugName: "completion" }] : []));
2390
+ this.storyChanged.emit(this.currentStory());
2391
+ this.paused.set(false);
2392
+ this.currentProgress.set(0);
2393
+ this.currentTime = 0;
2394
+ this.runTimer();
2395
+ }
2396
+ runTimer() {
2397
+ if (this.timerSubscription)
2398
+ this.timerSubscription.unsubscribe();
2399
+ if (this.paused())
2400
+ return;
2401
+ this.timerSubscription = timer(this.timerInterval).subscribe(() => {
2402
+ this.currentTime += this.timerInterval;
2403
+ let duration = this.currentStory()?.duration ?? this.defaultDuration();
2404
+ this.currentProgress.set(this.currentTime / (duration * 10));
2405
+ if (this.currentTime >= duration * 1000)
2406
+ this.next();
2407
+ else
2408
+ this.runTimer();
2409
+ });
2410
+ }
2411
+ closeCallback(id) {
2412
+ this.sidebarService.closeSidebar(id);
2413
+ }
2414
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: StoriesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2415
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: StoriesComponent, isStandalone: true, selector: "stories", inputs: { stories: { classPropertyName: "stories", publicName: "stories", isSignal: true, isRequired: false, transformFunction: null }, footerTemplate: { classPropertyName: "footerTemplate", publicName: "footerTemplate", isSignal: true, isRequired: false, transformFunction: null }, subFooterTemplate: { classPropertyName: "subFooterTemplate", publicName: "subFooterTemplate", isSignal: true, isRequired: false, transformFunction: null }, sideTemplate: { classPropertyName: "sideTemplate", publicName: "sideTemplate", isSignal: true, isRequired: false, transformFunction: null }, showSubFooter: { classPropertyName: "showSubFooter", publicName: "showSubFooter", isSignal: true, isRequired: false, transformFunction: null }, descriptionOpen: { classPropertyName: "descriptionOpen", publicName: "descriptionOpen", isSignal: true, isRequired: false, transformFunction: null }, defaultDuration: { classPropertyName: "defaultDuration", publicName: "defaultDuration", isSignal: true, isRequired: false, transformFunction: null }, paused: { classPropertyName: "paused", publicName: "paused", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { storyChanged: "storyChanged", paused: "pausedChange" }, viewQueries: [{ propertyName: "videoPlayer", first: true, predicate: ["videoPlayer"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div class=\"w-full h-full flex align-items-center justify-content-center story-container\">\r\n <div class=\"story-backdrop\" (click)=\"next()\">\r\n @if (currentStory()?.type=='image') {\r\n <img [src]=\"currentStory().src\" />\r\n } @else if (currentStory()?.type=='video') {\r\n <video class=\"w-full\">\r\n <source [src]=\"currentStory().src\" type=\"video/mp4\">\r\n </video>\r\n }\r\n </div>\r\n\r\n\r\n <div class=\"story-content sm:border-round\">\r\n \r\n <div class=\"flex gap-1 story-lines p-2\">\r\n @for (story of stories(); track story.id; let i = $index) {\r\n <span>\r\n <p-button type=\"button\" (click)=\"closeCallback(story.id)\" icon=\"pi pi-times\" rounded=\"true\"\r\n outlined=\"true\" styleClass=\"h-2rem w-2rem\"></p-button>\r\n </span>\r\n <div class=\"story-line\">\r\n <div class=\"story-line-inner\"\r\n [style.width]=\"currentStoryIndex() > i ? '100%' : (currentStoryIndex() == i ? this.currentProgress() + '%' : '0')\">\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n @if (currentStory()?.type == 'image') {\r\n <img [src]=\"currentStory().src\" (click)=\"next()\" />\r\n }\r\n @if (currentStory()?.type=='video') {\r\n\r\n <video class=\"w-full h-full\" (canplay)=\"videoPlayer.play()\" (loadedmetadata)=\"videoPlayer.muted = mute()\"\r\n #videoPlayer autoplay [muted]=\"mute()\" [playsInline]=\"true\" loop (click)=\"next()\">\r\n <source [src]=\"currentStory().src\" type=\"video/mp4\">\r\n\r\n </video>\r\n }\r\n\r\n <div\r\n [class]=\"'story-overlay absolute bottom-0 p-3 left-0 w-full flex-column absolute flex align-items-end justify-content-end gap-2 ' + (descriptionOpen() ? 'scrollable' : '')\">\r\n <div class=\"flex align-items-end min-h-0 w-full gap-2\">\r\n @if(footerTemplate()){\r\n <div class=\"story-footer\">\r\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: currentStory() }\"></ng-container>\r\n </div>\r\n }\r\n @if(sideTemplate()){\r\n <div class=\"story-side\">\r\n <div class=\"mb-4\">\r\n <i (click)=\"paused.set(!paused())\"\r\n [class]=\"'pi side-icon ' + (paused() ? 'pi-play' : 'pi-pause')\"></i>\r\n </div>\r\n <div class=\"mb-4\">\r\n <i (click)=\"mute.set(!mute())\"\r\n [class]=\"'pi side-icon ' + (mute() ? 'pi-volume-off' : 'pi-volume-up')\"></i>\r\n </div>\r\n <ng-container [ngTemplateOutlet]=\"sideTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: currentStory() }\"></ng-container>\r\n </div>\r\n }\r\n </div>\r\n @if(showSubFooter() && subFooterTemplate()){\r\n <div class=\"story-subfooter w-full text-center\">\r\n <ng-container [ngTemplateOutlet]=\"subFooterTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: currentStory() }\"></ng-container>\r\n </div>\r\n\r\n }\r\n\r\n </div>\r\n </div>\r\n\r\n\r\n\r\n</div>", styles: [".story-content{background-position:center;background-size:contain;z-index:1;background-repeat:no-repeat;background-color:#000;position:relative;aspect-ratio:9 / 16;height:calc(100% - 5rem);display:flex;overflow:hidden}.story-backdrop{background-color:#000;position:absolute;left:0;top:0;width:100%;height:100%;filter:blur(50px);display:flex;align-items:center;justify-content:center;overflow:hidden}.story-backdrop video,.story-backdrop img{object-fit:cover;width:100%;height:100%}.story-content video,.story-content img{object-fit:contain}.story-content img{width:100%}.story-lines{position:absolute;width:100%}.story-line{background:#fff6;border-radius:6px;height:4px;flex:1}.story-footer{color:#fff;flex:1;min-width:0}p-skeleton .p-skeleton{background-color:#373737cc}.story-overlay{color:#fff;background-image:linear-gradient(transparent,#000c,#000);text-shadow:0 0px 3px rgba(0,0,0);padding-top:50px!important}.story-side{width:50px;text-align:center}.story-side .side-icon{font-size:24px}.story-line-inner{background:#fff;border-radius:6px;height:4px;transition:width .1s}.story-container{background-color:#000}.story-overlay.scrollable{height:90%;padding-top:0}.story-overlay.scrollable .story-footer{height:100%;overflow-y:auto}.story-overlay.scrollable .story-description{height:initial}.story-footer::-webkit-scrollbar{display:none}@media (max-width: 567px){.story-content{width:100%;height:100%;border-radius:0;background-color:transparent;margin:0}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }], encapsulation: i0.ViewEncapsulation.None });
2416
+ }
2417
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: StoriesComponent, decorators: [{
2418
+ type: Component,
2419
+ args: [{ selector: 'stories', standalone: true, imports: [JsonPipe, NgTemplateOutlet, ButtonModule], encapsulation: ViewEncapsulation.None, template: "<div class=\"w-full h-full flex align-items-center justify-content-center story-container\">\r\n <div class=\"story-backdrop\" (click)=\"next()\">\r\n @if (currentStory()?.type=='image') {\r\n <img [src]=\"currentStory().src\" />\r\n } @else if (currentStory()?.type=='video') {\r\n <video class=\"w-full\">\r\n <source [src]=\"currentStory().src\" type=\"video/mp4\">\r\n </video>\r\n }\r\n </div>\r\n\r\n\r\n <div class=\"story-content sm:border-round\">\r\n \r\n <div class=\"flex gap-1 story-lines p-2\">\r\n @for (story of stories(); track story.id; let i = $index) {\r\n <span>\r\n <p-button type=\"button\" (click)=\"closeCallback(story.id)\" icon=\"pi pi-times\" rounded=\"true\"\r\n outlined=\"true\" styleClass=\"h-2rem w-2rem\"></p-button>\r\n </span>\r\n <div class=\"story-line\">\r\n <div class=\"story-line-inner\"\r\n [style.width]=\"currentStoryIndex() > i ? '100%' : (currentStoryIndex() == i ? this.currentProgress() + '%' : '0')\">\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n @if (currentStory()?.type == 'image') {\r\n <img [src]=\"currentStory().src\" (click)=\"next()\" />\r\n }\r\n @if (currentStory()?.type=='video') {\r\n\r\n <video class=\"w-full h-full\" (canplay)=\"videoPlayer.play()\" (loadedmetadata)=\"videoPlayer.muted = mute()\"\r\n #videoPlayer autoplay [muted]=\"mute()\" [playsInline]=\"true\" loop (click)=\"next()\">\r\n <source [src]=\"currentStory().src\" type=\"video/mp4\">\r\n\r\n </video>\r\n }\r\n\r\n <div\r\n [class]=\"'story-overlay absolute bottom-0 p-3 left-0 w-full flex-column absolute flex align-items-end justify-content-end gap-2 ' + (descriptionOpen() ? 'scrollable' : '')\">\r\n <div class=\"flex align-items-end min-h-0 w-full gap-2\">\r\n @if(footerTemplate()){\r\n <div class=\"story-footer\">\r\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: currentStory() }\"></ng-container>\r\n </div>\r\n }\r\n @if(sideTemplate()){\r\n <div class=\"story-side\">\r\n <div class=\"mb-4\">\r\n <i (click)=\"paused.set(!paused())\"\r\n [class]=\"'pi side-icon ' + (paused() ? 'pi-play' : 'pi-pause')\"></i>\r\n </div>\r\n <div class=\"mb-4\">\r\n <i (click)=\"mute.set(!mute())\"\r\n [class]=\"'pi side-icon ' + (mute() ? 'pi-volume-off' : 'pi-volume-up')\"></i>\r\n </div>\r\n <ng-container [ngTemplateOutlet]=\"sideTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: currentStory() }\"></ng-container>\r\n </div>\r\n }\r\n </div>\r\n @if(showSubFooter() && subFooterTemplate()){\r\n <div class=\"story-subfooter w-full text-center\">\r\n <ng-container [ngTemplateOutlet]=\"subFooterTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: currentStory() }\"></ng-container>\r\n </div>\r\n\r\n }\r\n\r\n </div>\r\n </div>\r\n\r\n\r\n\r\n</div>", styles: [".story-content{background-position:center;background-size:contain;z-index:1;background-repeat:no-repeat;background-color:#000;position:relative;aspect-ratio:9 / 16;height:calc(100% - 5rem);display:flex;overflow:hidden}.story-backdrop{background-color:#000;position:absolute;left:0;top:0;width:100%;height:100%;filter:blur(50px);display:flex;align-items:center;justify-content:center;overflow:hidden}.story-backdrop video,.story-backdrop img{object-fit:cover;width:100%;height:100%}.story-content video,.story-content img{object-fit:contain}.story-content img{width:100%}.story-lines{position:absolute;width:100%}.story-line{background:#fff6;border-radius:6px;height:4px;flex:1}.story-footer{color:#fff;flex:1;min-width:0}p-skeleton .p-skeleton{background-color:#373737cc}.story-overlay{color:#fff;background-image:linear-gradient(transparent,#000c,#000);text-shadow:0 0px 3px rgba(0,0,0);padding-top:50px!important}.story-side{width:50px;text-align:center}.story-side .side-icon{font-size:24px}.story-line-inner{background:#fff;border-radius:6px;height:4px;transition:width .1s}.story-container{background-color:#000}.story-overlay.scrollable{height:90%;padding-top:0}.story-overlay.scrollable .story-footer{height:100%;overflow-y:auto}.story-overlay.scrollable .story-description{height:initial}.story-footer::-webkit-scrollbar{display:none}@media (max-width: 567px){.story-content{width:100%;height:100%;border-radius:0;background-color:transparent;margin:0}}\n"] }]
2420
+ }], ctorParameters: () => [], propDecorators: { videoPlayer: [{
2421
+ type: ViewChild,
2422
+ args: ['videoPlayer', { read: ElementRef }]
2423
+ }] } });
2424
+
2425
+ // import { UUID } from 'angular2-uuid';
2426
+ // import { environment } from 'environments/environment';
2427
+ class QuestionsComponent {
2428
+ imageRoot = input(null, ...(ngDevMode ? [{ debugName: "imageRoot" }] : []));
2429
+ value = input(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
2430
+ // get value(): any {
2431
+ // return this.registerQuestions;
2432
+ // };
2433
+ mode = input('answer', ...(ngDevMode ? [{ debugName: "mode" }] : []));
2434
+ // private _mode: string = 'answer';
2435
+ // @Input()
2436
+ // public get mode() {
2437
+ // return this._mode;
2438
+ // }
2439
+ // public set mode(value) {
2440
+ // this._mode = value;
2441
+ // }
2442
+ get imageItem() {
2443
+ return !this.registerQuestions ? null : this.registerQuestions().find(t => t.type == 'IMAGE');
2444
+ }
2445
+ get firstNameItem() {
2446
+ return !this.registerQuestions ? null : this.registerQuestions().find(t => t.type == 'FIRSTNAME');
2447
+ }
2448
+ get lastNameItem() {
2449
+ return !this.registerQuestions ? null : this.registerQuestions().find(t => t.type == 'LASTNAME');
2450
+ }
2451
+ get extraFields() {
2452
+ return !this.registerQuestions ? null : this.registerQuestions().filter(t => t.type != 'IMAGE' && t.type != 'FIRSTNAME' && t.type != 'LASTNAME') || [];
2453
+ }
2454
+ get imageUrl() {
2455
+ if (!this.imageItem)
2456
+ return null;
2457
+ else
2458
+ return this.sanitizer.bypassSecurityTrustStyle(`url(${this.imageRoot()}/misc/${!this.environment.production ? '_debug/' : ''}${this.imageItem.answer})`);
2459
+ }
2460
+ has(item, type) {
2461
+ return !this.registerQuestions().find(t => t.type == type && t.id != item.id);
2462
+ }
2463
+ get orderedRegisterQuestions() {
2464
+ return this.registerQuestions()?.sort((a, b) => a.priority > b.priority ? 1 : a.priority == b.priority ? 0 : -1);
2465
+ }
2466
+ registerQuestions = model([], ...(ngDevMode ? [{ debugName: "registerQuestions" }] : []));
2467
+ sanitizer = inject(DomSanitizer);
2468
+ environment = inject(FlowAppConfig);
2469
+ constructor() {
2470
+ }
2471
+ ngOnInit() {
2472
+ }
2473
+ addNew() {
2474
+ this.registerQuestions.update(rq => ([...rq, { id: uuid.v4(), type: 'TEXTBOX', priority: (Math.max(...rq.map(q => q.priority)) > 0 ? Math.max(...rq.map(q => q.priority)) : 0) + 1 }]));
2475
+ console.log(this.registerQuestions());
2476
+ }
2477
+ deleteQuestion(item) {
2478
+ this.registerQuestions.update(q => q.splice(q.indexOf(item), 1));
2479
+ }
2480
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: QuestionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2481
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: QuestionsComponent, isStandalone: true, selector: "questions", inputs: { imageRoot: { classPropertyName: "imageRoot", publicName: "imageRoot", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, registerQuestions: { classPropertyName: "registerQuestions", publicName: "registerQuestions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { registerQuestions: "registerQuestionsChange" }, ngImport: i0, template: "<div>\r\n @for(item of orderedRegisterQuestions; track item){\r\n <div>\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"company-questions.question\"></translate>\r\n </label>\r\n <input type=\"text\" [(ngModel)]=\"item.name\" class=\"form-control\" name=\"{{item.id}}\" required />\r\n </div>\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"company-questions.type\"></translate>\r\n </label>\r\n\r\n <select [(ngModel)]=\"item.inputType\" class=\"form-control\">\r\n <option>TEXTBOX</option>\r\n <option>TEXTAREA</option>\r\n <option>CHOICE</option>\r\n @if(has(item, 'DATEOFBIRTH')){\r\n <option>DATE</option>\r\n }\r\n\r\n @if(has(item, 'IMAGE')){\r\n <option>IMAGE</option>\r\n }\r\n </select>\r\n </div>\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"company-questions.value-type\"></translate>\r\n </label>\r\n\r\n <select [(ngModel)]=\"item.type\" class=\"form-control\">\r\n @if(has(item, 'FIRSTNAME')){\r\n <option>FIRSTNAME</option>\r\n }\r\n @if(has(item, 'LASTNAME')){\r\n <option>LASTNAME</option>\r\n }\r\n @if(has(item, 'EMAIL')){\r\n <option>EMAIL</option>\r\n }\r\n @if(has(item, 'PHONE')){\r\n <option>PHONE</option>\r\n }\r\n @if(has(item, 'CNP')){\r\n <option>CNP</option>\r\n }\r\n @if(has(item, 'SEX')){\r\n <option>SEX</option>\r\n }\r\n @if(has(item, 'COUNTRY')){\r\n <option>COUNTRY</option>\r\n }\r\n @if(has(item, 'CITY')){\r\n <option>CITY</option>\r\n }\r\n @if(has(item, 'DATEOFBIRTH')){\r\n <option>DATEOFBIRTH</option>\r\n }\r\n @if(has(item, 'GUARDIANNAME')){\r\n <option>GUARDIANNAME</option>\r\n }\r\n @if(has(item, 'GUARDIANPHONE')){\r\n <option>GUARDIANPHONE</option>\r\n }\r\n @if(has(item, 'IMAGE')){\r\n <option>IMAGE</option>\r\n }\r\n <option>OTHER</option>\r\n </select>\r\n </div>\r\n @if(item.inputType=='CHOICE'){\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"company-questions.choices\"></translate>\r\n </label>\r\n <textarea [(ngModel)]=\"item.choices\" class=\"form-control\" #choices=\"ngModel\" name=\"choices\" rows=\"5\"></textarea>\r\n </div>\r\n }\r\n\r\n <div class=\"form-group\" style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <label>\r\n <translate name=\"company-questions.priority\"></translate>\r\n </label>\r\n <input type=\"number\" [(ngModel)]=\"item.priority\" class=\"form-control\" style=\"width:100px; margin-left: 5px;\" />\r\n\r\n <p-checkbox class=\"pr-3\" [(ngModel)]=\"item.required\" [binary]=\"true\" name=\"is_required\" [inputId]=\"item.required\">\r\n <translate name=\"questions.is-required\">\r\n </translate>\r\n </p-checkbox>\r\n\r\n <!-- <icheck name=\"is_required\" style=\"margin-left: 10px;\" [(ngModel)]=\"item.required\"><translate name=\"questions.is-required\">\r\n </translate>\r\n </icheck> -->\r\n\r\n <a class=\"btn btn-warning btn-sm\" style=\"margin-left: auto;\" (click)=\"deleteQuestion(item)\"><i\r\n class=\"pi pi-trash\"></i></a>\r\n\r\n </div>\r\n <hr />\r\n </div>\r\n}\r\n <button class=\"btn btn-primary\" (click)=\"addNew()\"><i class=\"pi pi-plus\"></i></button>\r\n</div>\r\n<!-- <div *ngIf=\"mode=='answer'\">\r\n <div class=\"form-group text-center\">\r\n <div [style.backgroundImage]=\"imageUrl\" *ngIf=\"imageItem\" class=\"image-upload\"></div>\r\n <h3 *ngIf=\"firstNameItem || lastNameItem\">{{firstNameItem?.answer}} {{lastNameItem?.answer}}</h3>\r\n </div>\r\n <div class=\"form-group extra-fields\" *ngFor=\"let item of extraFields\">\r\n <label>{{item.name}}</label>\r\n \r\n <div>{{item.answer}}</div>\r\n </div>\r\n</div> -->", styles: [".image-upload{width:200px;height:200px;background-size:cover;background-position:center center;display:inline-block}.extra-fields{background-color:#fff;border-bottom:solid 1px #ccc;padding:10px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: TranslationComponent, selector: "translate", inputs: ["name", "replacements"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "ngmodule", type: CardModule }, { kind: "ngmodule", type: RippleModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i2$2.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "styleClass", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }] });
2482
+ }
2483
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: QuestionsComponent, decorators: [{
2484
+ type: Component,
2485
+ args: [{ selector: 'questions', standalone: true, imports: [
2486
+ CommonModule,
2487
+ TranslationComponent,
2488
+ FormsModule,
2489
+ InputTextModule,
2490
+ CardModule,
2491
+ RippleModule,
2492
+ ButtonModule,
2493
+ CheckboxModule,
2494
+ // DropdownModule,
2495
+ // TagModule,
2496
+ // CompareDirective
2497
+ // RouterModule,
2498
+ ], template: "<div>\r\n @for(item of orderedRegisterQuestions; track item){\r\n <div>\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"company-questions.question\"></translate>\r\n </label>\r\n <input type=\"text\" [(ngModel)]=\"item.name\" class=\"form-control\" name=\"{{item.id}}\" required />\r\n </div>\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"company-questions.type\"></translate>\r\n </label>\r\n\r\n <select [(ngModel)]=\"item.inputType\" class=\"form-control\">\r\n <option>TEXTBOX</option>\r\n <option>TEXTAREA</option>\r\n <option>CHOICE</option>\r\n @if(has(item, 'DATEOFBIRTH')){\r\n <option>DATE</option>\r\n }\r\n\r\n @if(has(item, 'IMAGE')){\r\n <option>IMAGE</option>\r\n }\r\n </select>\r\n </div>\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"company-questions.value-type\"></translate>\r\n </label>\r\n\r\n <select [(ngModel)]=\"item.type\" class=\"form-control\">\r\n @if(has(item, 'FIRSTNAME')){\r\n <option>FIRSTNAME</option>\r\n }\r\n @if(has(item, 'LASTNAME')){\r\n <option>LASTNAME</option>\r\n }\r\n @if(has(item, 'EMAIL')){\r\n <option>EMAIL</option>\r\n }\r\n @if(has(item, 'PHONE')){\r\n <option>PHONE</option>\r\n }\r\n @if(has(item, 'CNP')){\r\n <option>CNP</option>\r\n }\r\n @if(has(item, 'SEX')){\r\n <option>SEX</option>\r\n }\r\n @if(has(item, 'COUNTRY')){\r\n <option>COUNTRY</option>\r\n }\r\n @if(has(item, 'CITY')){\r\n <option>CITY</option>\r\n }\r\n @if(has(item, 'DATEOFBIRTH')){\r\n <option>DATEOFBIRTH</option>\r\n }\r\n @if(has(item, 'GUARDIANNAME')){\r\n <option>GUARDIANNAME</option>\r\n }\r\n @if(has(item, 'GUARDIANPHONE')){\r\n <option>GUARDIANPHONE</option>\r\n }\r\n @if(has(item, 'IMAGE')){\r\n <option>IMAGE</option>\r\n }\r\n <option>OTHER</option>\r\n </select>\r\n </div>\r\n @if(item.inputType=='CHOICE'){\r\n <div class=\"form-group\">\r\n <label>\r\n <translate name=\"company-questions.choices\"></translate>\r\n </label>\r\n <textarea [(ngModel)]=\"item.choices\" class=\"form-control\" #choices=\"ngModel\" name=\"choices\" rows=\"5\"></textarea>\r\n </div>\r\n }\r\n\r\n <div class=\"form-group\" style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <label>\r\n <translate name=\"company-questions.priority\"></translate>\r\n </label>\r\n <input type=\"number\" [(ngModel)]=\"item.priority\" class=\"form-control\" style=\"width:100px; margin-left: 5px;\" />\r\n\r\n <p-checkbox class=\"pr-3\" [(ngModel)]=\"item.required\" [binary]=\"true\" name=\"is_required\" [inputId]=\"item.required\">\r\n <translate name=\"questions.is-required\">\r\n </translate>\r\n </p-checkbox>\r\n\r\n <!-- <icheck name=\"is_required\" style=\"margin-left: 10px;\" [(ngModel)]=\"item.required\"><translate name=\"questions.is-required\">\r\n </translate>\r\n </icheck> -->\r\n\r\n <a class=\"btn btn-warning btn-sm\" style=\"margin-left: auto;\" (click)=\"deleteQuestion(item)\"><i\r\n class=\"pi pi-trash\"></i></a>\r\n\r\n </div>\r\n <hr />\r\n </div>\r\n}\r\n <button class=\"btn btn-primary\" (click)=\"addNew()\"><i class=\"pi pi-plus\"></i></button>\r\n</div>\r\n<!-- <div *ngIf=\"mode=='answer'\">\r\n <div class=\"form-group text-center\">\r\n <div [style.backgroundImage]=\"imageUrl\" *ngIf=\"imageItem\" class=\"image-upload\"></div>\r\n <h3 *ngIf=\"firstNameItem || lastNameItem\">{{firstNameItem?.answer}} {{lastNameItem?.answer}}</h3>\r\n </div>\r\n <div class=\"form-group extra-fields\" *ngFor=\"let item of extraFields\">\r\n <label>{{item.name}}</label>\r\n \r\n <div>{{item.answer}}</div>\r\n </div>\r\n</div> -->", styles: [".image-upload{width:200px;height:200px;background-size:cover;background-position:center center;display:inline-block}.extra-fields{background-color:#fff;border-bottom:solid 1px #ccc;padding:10px}\n"] }]
2499
+ }], ctorParameters: () => [] });
2500
+
2501
+ class LoginComponent {
2502
+ userService;
2503
+ globalService;
2504
+ router;
2505
+ message;
2506
+ constructor(userService, globalService, router) {
2507
+ this.userService = userService;
2508
+ this.globalService = globalService;
2509
+ this.router = router;
2510
+ }
2511
+ ngOnInit() {
2512
+ var result = {};
2513
+ window.location.hash.substring(1).split('&').forEach(e => {
2514
+ var k = e.split('=');
2515
+ if (k[1] != 'null')
2516
+ result[k[0]] = k[1];
2517
+ });
2518
+ let provider = decodeURIComponent(result.state).split('|')[0];
2519
+ let returnUrl = decodeURIComponent(result.state).split('|')[1];
2520
+ this.userService.redirectTo = returnUrl;
2521
+ if (window.opener && window.opener && window.opener.login) {
2522
+ window.opener.login.externalLogin(result, provider);
2523
+ window.close();
2524
+ return;
2525
+ }
2526
+ if (window.parent && window.parent.login) {
2527
+ window.parent.login.externalLogin(result, provider);
2528
+ return;
2529
+ }
2530
+ timer(100).subscribe(r => {
2531
+ window.login.externalLogin(result, provider);
2532
+ });
2533
+ // this.userService.redirectTo = null;
2534
+ // let redirectUrl = this.userService.processLogin().subscribe(res => {
2535
+ // console.log(window)
2536
+ // if (window.opener && window.opener && window.opener.login)
2537
+ // {
2538
+ // window.opener.login.userLoggedIn(this.userService.currentUser);
2539
+ // window.close();
2540
+ // return;
2541
+ // }
2542
+ // if (window.parent && window.parent.login) {
2543
+ // window.parent.login.userLoggedIn(this.userService.currentUser);
2544
+ // return;
2545
+ // }
2546
+ // window.login.userLoggedIn(this.userService.currentUser);
2547
+ // });
2548
+ }
2549
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: LoginComponent, deps: [{ token: UserAccountService }, { token: GlobalService }, { token: i1.Router }], target: i0.ɵɵFactoryTarget.Component });
2550
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.6", type: LoginComponent, isStandalone: true, selector: "app-login", ngImport: i0, template: "<!-- <app-loader></app-loader> -->\r\n<div style=\"max-width:400px; width:90%; margin: 0px auto\">\r\n <payvent-login-form></payvent-login-form>\r\n</div>", styles: [""], dependencies: [{ kind: "component", type: LoginFormComponent, selector: "payvent-login-form", inputs: ["context", "allowAccountCreation", "tokenType", "clientId", "type"], outputs: ["contextChange"] }] });
2551
+ }
2552
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: LoginComponent, decorators: [{
2553
+ type: Component,
2554
+ args: [{ selector: 'app-login', standalone: true, imports: [LoginFormComponent], template: "<!-- <app-loader></app-loader> -->\r\n<div style=\"max-width:400px; width:90%; margin: 0px auto\">\r\n <payvent-login-form></payvent-login-form>\r\n</div>" }]
2555
+ }], ctorParameters: () => [{ type: UserAccountService }, { type: GlobalService }, { type: i1.Router }] });
2556
+
2557
+ // export * from './loading-button/loading-button.component';
2558
+ // export * from './location-select/location-select.component';
2559
+ // export * from './flow-uploader/flow-uploader.component';
2560
+ // export * from './notification-list/notification-list.component';
2561
+ // export * from './questions/questions.component';
2562
+
2563
+ class Misc {
2564
+ hexToRgbA(hex, opacity) {
2565
+ var c;
2566
+ if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {
2567
+ c = hex.substring(1).split('');
2568
+ if (c.length == 3) {
2569
+ c = [c[0], c[0], c[1], c[1], c[2], c[2]];
2570
+ }
2571
+ c = '0x' + c.join('');
2572
+ return 'rgba(' + [(c >> 16) & 255, (c >> 8) & 255, c & 255].join(',') + ',' + opacity + ')';
2573
+ }
2574
+ throw new Error('Bad Hex');
2575
+ }
2576
+ }
2577
+
2578
+ class StoryContext {
2579
+ id;
2580
+ type;
2581
+ src;
2582
+ completion = signal(0, ...(ngDevMode ? [{ debugName: "completion" }] : []));
2583
+ }
2584
+
2585
+ /*
2586
+ * Public API Surface of ngx-payvent-shared
2587
+ */
2588
+ // export * from './lib/misc/sidebar-context';
2589
+
2590
+ /**
2591
+ * Generated bundle index. Do not edit.
2592
+ */
2593
+
2594
+ export { ApplicationSharedService, CookieBarComponent, FlowAppConfig, FlowCookieService, FlowHttpClient, GlobalService, InternationalPhoneComponent, LoginComponent, LoginFormComponent, Misc, ModalService, NotificationDropdownComponent, NotificationListComponent, NotificationToasterComponent, QrScannerComponent, QuestionsComponent, SidebarComponent, SidebarContext, SidebarService, SignalrNotificationService, SortingPagingCriteria, StoriesComponent, StoryContext, SumPipe, TranslationComponent, TranslationPipe, TranslationSharedService, UserAccountService };
2595
+ //# sourceMappingURL=ngx-payvent-shared.mjs.map