@dsivd/prestations-ng 17.0.0-beta.3 → 17.0.0-beta.4

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.
@@ -2,10 +2,10 @@ import * as i0 from '@angular/core';
2
2
  import { Injectable, Optional, Inject, EventEmitter, Directive, Input, ViewChildren, ViewChild, forwardRef, Output, HostBinding, Pipe, Component, ContentChildren, HostListener, NgModule, TemplateRef, ContentChild, InjectionToken } from '@angular/core';
3
3
  import * as i1$1 from '@angular/router';
4
4
  import { ActivatedRoute, NavigationStart, RouterModule, NavigationEnd, RouterLink } from '@angular/router';
5
- import { of, BehaviorSubject, combineLatest, Subject, throwError, tap as tap$1, concat, toArray, EMPTY, merge, withLatestFrom, debounceTime as debounceTime$1, map as map$1 } from 'rxjs';
6
- import { map, shareReplay, debounceTime, catchError, switchMap, tap, first, filter, throttleTime, mergeMap, share, finalize, distinctUntilChanged } from 'rxjs/operators';
5
+ import { of, Subject, BehaviorSubject, combineLatest, throwError, tap as tap$1, concat, toArray, EMPTY, merge, withLatestFrom, debounceTime as debounceTime$1, switchMap as switchMap$1, map as map$1 } from 'rxjs';
6
+ import { map, shareReplay, filter, tap, debounceTime, catchError, switchMap, first, throttleTime, mergeMap, share, finalize, distinctUntilChanged } from 'rxjs/operators';
7
7
  import * as i1 from '@angular/common/http';
8
- import { HttpStatusCode, HttpResponse, HttpErrorResponse, HttpParams, HttpEventType, HTTP_INTERCEPTORS, HttpClientModule, HttpClient } from '@angular/common/http';
8
+ import { HttpStatusCode, HttpResponseBase, HttpErrorResponse, HttpParams, HttpEventType, HttpResponse, HTTP_INTERCEPTORS, HttpClientModule, HttpClient } from '@angular/common/http';
9
9
  import * as i3 from '@angular/forms';
10
10
  import { NgModel, NgForm, FormsModule } from '@angular/forms';
11
11
  import * as i2 from '@angular/common';
@@ -81,18 +81,235 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
81
81
  args: ['neverConnected']
82
82
  }] }] });
83
83
 
84
+ // eslint-disable max-classes-per-file
85
+ class ApplicationInfo {
86
+ constructor() {
87
+ this.configuration = new Configuration();
88
+ }
89
+ }
90
+ class EtapeInfo {
91
+ }
92
+ class Configuration {
93
+ constructor() {
94
+ this.portail = new Portail();
95
+ }
96
+ }
97
+ class Session {
98
+ }
99
+ class Document {
100
+ }
101
+ class Captcha {
102
+ }
103
+ class Portail {
104
+ }
105
+
106
+ var ActionStatut;
107
+ (function (ActionStatut) {
108
+ ActionStatut["DRAFT"] = "DRAFT";
109
+ ActionStatut["INITIAL"] = "INITIAL";
110
+ ActionStatut["PENDING_PAYMENT"] = "PENDING_PAYMENT";
111
+ ActionStatut["TRANSFERRED"] = "TRANSFERRED";
112
+ ActionStatut["ABANDONED"] = "ABANDONED";
113
+ ActionStatut["REOPENED"] = "REOPENED";
114
+ })(ActionStatut || (ActionStatut = {}));
115
+ class GesdemStatutUtils {
116
+ static isFinal(actionStatut) {
117
+ if (!actionStatut) {
118
+ return false;
119
+ }
120
+ return (actionStatut === ActionStatut.TRANSFERRED ||
121
+ actionStatut === ActionStatut.ABANDONED);
122
+ }
123
+ }
124
+
125
+ class FoehnPageService {
126
+ constructor() {
127
+ this._foehnPageSubject = new Subject();
128
+ this._saveFormRequestSubject = new Subject();
129
+ this._currentEtapeId = new BehaviorSubject(null);
130
+ this.currentEtapeIdObs = this._currentEtapeId.asObservable();
131
+ }
132
+ foehnPageObservable() {
133
+ return this._foehnPageSubject.asObservable();
134
+ }
135
+ setPageTitle(title) {
136
+ this._foehnPageSubject.next(title);
137
+ }
138
+ requestFormSave() {
139
+ this._saveFormRequestSubject.next();
140
+ }
141
+ saveFormRequest() {
142
+ return this._saveFormRequestSubject.asObservable();
143
+ }
144
+ setCurrentEtapeId(etapeId) {
145
+ this._currentEtapeId.next(etapeId);
146
+ }
147
+ onEtapeIdChange() {
148
+ return this._currentEtapeId
149
+ .asObservable()
150
+ .pipe(filter(etapeInfo => !!etapeInfo));
151
+ }
152
+ isUserCategoryVisible(isFirstPage, isLastPage, isUserCategoryEnabled, isInitialStep, isUserNeverConnected,
153
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
154
+ backendResponse, isCurrentRouteDefined) {
155
+ const isStatusFinal = backendResponse &&
156
+ GesdemStatutUtils.isFinal(ActionStatut[backendResponse.meta.statut]);
157
+ return (isCurrentRouteDefined &&
158
+ !isStatusFinal &&
159
+ !isUserNeverConnected &&
160
+ isUserCategoryEnabled &&
161
+ isInitialStep &&
162
+ (isFirstPage || isLastPage));
163
+ }
164
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FoehnPageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
165
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FoehnPageService, providedIn: 'root' }); }
166
+ }
167
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FoehnPageService, decorators: [{
168
+ type: Injectable,
169
+ args: [{
170
+ providedIn: 'root'
171
+ }]
172
+ }], ctorParameters: () => [] });
173
+
174
+ const APP_INFO_API_URL = 'api/applicationInfo';
175
+ const PORTAIL_BASE_URL_INT = 'https://int-prestations.vd.ch/';
176
+ const FORM_SUPPORT_CYBER_TITLE_FALLBACK = "Demander de l'aide pour l'utilisation du portail sécurisé";
177
+ class ApplicationInfoService {
178
+ constructor(http, foehnPageService) {
179
+ this.http = http;
180
+ this.foehnPageService = foehnPageService;
181
+ this.applicationInfo = new ApplicationInfo();
182
+ this.pulling_ = this.http
183
+ .get(APP_INFO_API_URL)
184
+ .pipe(shareReplay(1));
185
+ // In most prestation, we're interested in the first etape info.
186
+ this.firstEtapeInfo_ = this.pulling_.pipe(filter(appInfo => !!appInfo && !!appInfo.etapeInfos), map(({ etapeInfos }) => {
187
+ // Checks whether the server returns a first key, otherwise fails the
188
+ // observable to ensure that client applications don't try to use this value
189
+ // and are able to implement fallback strategies.
190
+ const firstKey = Object.keys(etapeInfos)[0];
191
+ if (!firstKey) {
192
+ throw new Error('There must be at least one key in the etapeInfos');
193
+ }
194
+ return etapeInfos[firstKey];
195
+ }));
196
+ this.currentEtapeInfo_ = combineLatest([
197
+ this.foehnPageService.onEtapeIdChange(),
198
+ this.pulling_
199
+ ]).pipe(map(([etapeId, applicationInfo]) => applicationInfo.etapeInfos[etapeId]), shareReplay(1));
200
+ this.pulling_.subscribe((ai) => this.setApplicationInfo(ai));
201
+ }
202
+ get data() {
203
+ return this.pulling_.pipe(tap(appInfo => {
204
+ if (!!appInfo.configuration.portail.baseVdChUrl?.length) {
205
+ // already set by the backend
206
+ return;
207
+ }
208
+ switch (appInfo.environment?.toUpperCase()) {
209
+ case 'IN':
210
+ appInfo.configuration.portail.baseVdChUrl =
211
+ 'https://int.vd.ch';
212
+ break;
213
+ case 'VA':
214
+ appInfo.configuration.portail.baseVdChUrl =
215
+ 'https://valid.vd.ch';
216
+ break;
217
+ default:
218
+ appInfo.configuration.portail.baseVdChUrl =
219
+ 'https://www.vd.ch';
220
+ }
221
+ }));
222
+ }
223
+ get firstEtapeInfo() {
224
+ return this.firstEtapeInfo_;
225
+ }
226
+ get currentEtapeInfo() {
227
+ return this.currentEtapeInfo_;
228
+ }
229
+ getSafeCyberLoginUrl() {
230
+ return this.data.pipe(map(appInfo => appInfo.configuration?.portail?.cyberLoginUrl ||
231
+ `${this.getPortailBaseUrl(appInfo)}100018/`));
232
+ }
233
+ getSafeSupportFormUrl(reference, errors) {
234
+ return this.data.pipe(map(appInfo => appInfo.configuration?.portail?.supportFormUrl ||
235
+ `${this.getPortailBaseUrl(appInfo)}pub/101098/`), map(link => {
236
+ if (!!reference?.length) {
237
+ link += `?concernedReference=${reference}`;
238
+ }
239
+ if (!!errors?.length) {
240
+ link += !!reference?.length ? '&' : '?';
241
+ // Need following code to avoid browser Sanitizing error when using JSON.stringify
242
+ link += `errors=${errors
243
+ .map(error => Object.entries(error)
244
+ .map(value => `${value.join('=')}`)
245
+ .join(','))
246
+ .join(';')}`;
247
+ }
248
+ return link;
249
+ }));
250
+ }
251
+ getSafeSupportFormTitle() {
252
+ return this.data.pipe(map(appInfo => {
253
+ const title = appInfo.configuration?.portail
254
+ ?.portailTitlesByPrestaCode?.[101098];
255
+ return title && title.length
256
+ ? title
257
+ : FORM_SUPPORT_CYBER_TITLE_FALLBACK;
258
+ }));
259
+ }
260
+ getSafeEspacesSecuriseUrl() {
261
+ return this.data.pipe(map(appInfo => appInfo.configuration?.portail?.espaceSecuriseUrl ||
262
+ `${this.getPortailBaseUrl(appInfo)}100002/`));
263
+ }
264
+ setApplicationInfo(applicationInfo) {
265
+ this.applicationInfo = applicationInfo;
266
+ if (this.applicationInfo) {
267
+ switch (this.applicationInfo.environment) {
268
+ case 'CO': {
269
+ this.applicationInfo.environmentLabel = 'développement';
270
+ break;
271
+ }
272
+ case 'IN': {
273
+ this.applicationInfo.environmentLabel = 'intégration';
274
+ break;
275
+ }
276
+ case 'VA': {
277
+ this.applicationInfo.environmentLabel = 'validation';
278
+ break;
279
+ }
280
+ default: {
281
+ // Nothing to do
282
+ }
283
+ }
284
+ }
285
+ }
286
+ getPortailBaseUrl(appInfo) {
287
+ return appInfo.environment === 'CO'
288
+ ? PORTAIL_BASE_URL_INT
289
+ : `${window.location.origin}/`;
290
+ }
291
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ApplicationInfoService, deps: [{ token: i1.HttpClient }, { token: FoehnPageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
292
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ApplicationInfoService, providedIn: 'root' }); }
293
+ }
294
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ApplicationInfoService, decorators: [{
295
+ type: Injectable,
296
+ args: [{
297
+ providedIn: 'root'
298
+ }]
299
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: FoehnPageService }] });
300
+
84
301
  const DEFAULT_VALUES = {
85
302
  espaceSecuriseUrl: '/100002/accueil',
86
303
  allPrestationsUrl: '/100002/prestations',
87
- vdChUrl: 'https://www.vd.ch/',
88
- descriptionPageBaseUrl: 'https://www.vd.ch/go.to?prestation=',
304
+ vdChUrl: null,
305
+ descriptionPageBaseUrl: null,
89
306
  // It's better to not display the breadcrumb item if the prestation doesn't give its code.
90
307
  prestationCode: null
91
308
  };
92
309
  // eslint-disable-next-line jsdoc/require-jsdoc
93
- function getNotConnectedBreadcrumb({ vdChUrl = DEFAULT_VALUES.vdChUrl, descriptionPageBaseUrl = DEFAULT_VALUES.descriptionPageBaseUrl, prestationCode = DEFAULT_VALUES.prestationCode }) {
310
+ function getNotConnectedBreadcrumb({ vdChUrl, descriptionPageBaseUrl, prestationCode = DEFAULT_VALUES.prestationCode }, vdChUrlFromAppInfo) {
94
311
  const rootElement = {
95
- url: vdChUrl,
312
+ url: vdChUrl || vdChUrlFromAppInfo,
96
313
  routerLink: null,
97
314
  label: 'vd.ch'
98
315
  };
@@ -106,7 +323,9 @@ function getNotConnectedBreadcrumb({ vdChUrl = DEFAULT_VALUES.vdChUrl, descripti
106
323
  rootElement,
107
324
  {
108
325
  // e.g. https://www.vd.ch/go.to?prestation=101016
109
- url: `${descriptionPageBaseUrl}${prestationCode}`,
326
+ url: descriptionPageBaseUrl
327
+ ? `${descriptionPageBaseUrl}${prestationCode}`
328
+ : `${vdChUrlFromAppInfo}/go.to?prestation=${prestationCode}`,
110
329
  routerLink: null,
111
330
  label: 'Description de la prestation'
112
331
  }
@@ -132,22 +351,23 @@ function getConnectedBreadcrumb({ espaceSecuriseUrl = DEFAULT_VALUES.espaceSecur
132
351
  * @param sessionInfoData data info on session
133
352
  * @param configuration as breadcrumb config.
134
353
  * @param currentItem as breadcrumb current item
354
+ * @param vdChBaseUrl typo3 base url for current env
135
355
  * @returns Breadcrumb
136
356
  */
137
- function getBreadcrumb(sessionInfoData, configuration, currentItem) {
357
+ function getBreadcrumb(sessionInfoData, configuration, currentItem, vdChBaseUrl) {
138
358
  // Whether the user has a context we consider it as connected.
139
359
  const isConnectedCyber = !!sessionInfoData && !!sessionInfoData.context;
140
360
  const breadcrumb = new Breadcrumb();
141
361
  // Depending on whether the user is connected, the content of the items change.
142
362
  breadcrumb.breadcrumbItems = isConnectedCyber
143
363
  ? getConnectedBreadcrumb(configuration, sessionInfoData)
144
- : getNotConnectedBreadcrumb(configuration);
364
+ : getNotConnectedBreadcrumb(configuration, vdChBaseUrl);
145
365
  // Optionally set the current item.
146
366
  breadcrumb.current = currentItem;
147
367
  return breadcrumb;
148
368
  }
149
369
  // eslint-disable-next-line jsdoc/require-jsdoc
150
- function mapBreadcrumb([override, configuration, currentItem, sessionInfoData]) {
370
+ function mapBreadcrumb([override, configuration, currentItem, sessionInfoData, applicationInfo]) {
151
371
  // Take the override if it exists
152
372
  if (override) {
153
373
  // Although there's an override, we do want to assign the current item
@@ -160,14 +380,15 @@ function mapBreadcrumb([override, configuration, currentItem, sessionInfoData])
160
380
  }
161
381
  // Otherwise get a breadcrumb based on the configuration
162
382
  if (configuration) {
163
- return getBreadcrumb(sessionInfoData, configuration, currentItem);
383
+ return getBreadcrumb(sessionInfoData, configuration, currentItem, applicationInfo.configuration.portail.baseVdChUrl);
164
384
  }
165
385
  // Only output a breadcrumb of there's a configuration or an override
166
386
  return null;
167
387
  }
168
388
  class BreadcrumbEventService {
169
- constructor(sessionInfo) {
389
+ constructor(sessionInfo, applicationInfoService) {
170
390
  this.sessionInfo = sessionInfo;
391
+ this.applicationInfoService = applicationInfoService;
171
392
  this._breadcrumbOverride = new BehaviorSubject(null);
172
393
  this._breadcrumbConfiguration = new BehaviorSubject(null);
173
394
  this._currentBreadcrumbItem = new BehaviorSubject(null);
@@ -177,7 +398,8 @@ class BreadcrumbEventService {
177
398
  this._breadcrumbOverride,
178
399
  this._breadcrumbConfiguration,
179
400
  this._currentBreadcrumbItem,
180
- this.sessionInfo.data
401
+ this.sessionInfo.data,
402
+ this.applicationInfoService.data
181
403
  ]).pipe(
182
404
  // Put together the breadcrumb, or just take the override if it exists.
183
405
  map(mapBreadcrumb));
@@ -186,7 +408,8 @@ class BreadcrumbEventService {
186
408
  this._breadcrumbOverride,
187
409
  this._breadcrumbConfiguration,
188
410
  this._currentBreadcrumbItem,
189
- of(null)
411
+ of(null),
412
+ this.applicationInfoService.data
190
413
  ]).pipe(
191
414
  // Put together the breadcrumb, or just take the override if it exists.
192
415
  map(mapBreadcrumb));
@@ -235,7 +458,7 @@ class BreadcrumbEventService {
235
458
  setConfiguration(configuration) {
236
459
  this._breadcrumbConfiguration.next(configuration);
237
460
  }
238
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: BreadcrumbEventService, deps: [{ token: SessionInfo }], target: i0.ɵɵFactoryTarget.Injectable }); }
461
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: BreadcrumbEventService, deps: [{ token: SessionInfo }, { token: ApplicationInfoService }], target: i0.ɵɵFactoryTarget.Injectable }); }
239
462
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: BreadcrumbEventService, providedIn: 'root' }); }
240
463
  }
241
464
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: BreadcrumbEventService, decorators: [{
@@ -243,7 +466,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
243
466
  args: [{
244
467
  providedIn: 'root'
245
468
  }]
246
- }], ctorParameters: () => [{ type: SessionInfo }] });
469
+ }], ctorParameters: () => [{ type: SessionInfo }, { type: ApplicationInfoService }] });
247
470
 
248
471
  class RegisterNgModelService {
249
472
  constructor() {
@@ -976,8 +1199,10 @@ const DEFAULT_DICTIONARY = {
976
1199
  'espace-securise.menu.item.deconnection.title': 'Se déconnecter',
977
1200
  'foehn-error-pill.incomplete': 'Incomplet',
978
1201
  'foehn-error-pill.complete': 'Renseigné',
979
- 'foehn-remaining-alert-summary.default-error-message': '<p>Notre formulaire a un problème et vous ne pourrez pas le transmettre.</p>' +
980
- '<p>Merci de prendre contact avec nous et de nous communiquer cette erreur au moyen du formulaire de support : ' +
1202
+ 'foehn-remaining-alert-summary.default-error-message': '<p>Notre formulaire a rencontré un problème et vous ne pourrez pas le transmettre.</p>' +
1203
+ '<p>Afin de le résoudre, nous vous invitons à revenir en arrière et essayer de repasser chacune des étapes.</p>' +
1204
+ // eslint-disable-next-line max-len
1205
+ '<p>Si le problème persiste, merci de prendre contact avec nous et de nous communiquer cette erreur au moyen du formulaire de support : ' +
981
1206
  '<a href="{supportLink}" target="_blank">https://www.vd.ch/contact-portail/</a></p>' +
982
1207
  '<p>Nous reprendrons contact avec vous.</p>'
983
1208
  };
@@ -1415,7 +1640,7 @@ class IamExpiredInterceptorService {
1415
1640
  }
1416
1641
  intercept(req, next) {
1417
1642
  return next.handle(req).pipe(map(event => {
1418
- if (event instanceof HttpResponse) {
1643
+ if (event instanceof HttpResponseBase) {
1419
1644
  if (hasIamExpiredHeader(event) ||
1420
1645
  isRedirectionToLogin(event)) {
1421
1646
  this._isIamSessionExpired.next(true);
@@ -1426,12 +1651,10 @@ class IamExpiredInterceptorService {
1426
1651
  }
1427
1652
  handleError(err) {
1428
1653
  if (err instanceof HttpErrorResponse) {
1429
- // status is 200, but still an error since
1430
1654
  // login page is returned when xml/json is expected
1431
- const isStatusOk = err.status === HttpStatusCode.Ok;
1432
1655
  const isUrlCyberLogin = err.url.includes(CYBER_LOGIN_PATH);
1433
1656
  const isUrlAcvLogin = err.url.includes(ACV_LOGIN_PATH);
1434
- if (isStatusOk && (isUrlCyberLogin || isUrlAcvLogin)) {
1657
+ if (isUrlCyberLogin || isUrlAcvLogin) {
1435
1658
  this._isIamSessionExpired.next(true);
1436
1659
  }
1437
1660
  }
@@ -2179,74 +2402,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
2179
2402
  }]
2180
2403
  }], ctorParameters: () => [{ type: i1$1.Router }, { type: GesdemHandlerService }, { type: GesdemActionRecoveryService }, { type: i1$1.ActivatedRoute }, { type: i2.Location }, { type: DemandeTransmitInterceptor }, { type: SdkEventsLoggerService }] });
2181
2404
 
2182
- var ActionStatut;
2183
- (function (ActionStatut) {
2184
- ActionStatut["DRAFT"] = "DRAFT";
2185
- ActionStatut["INITIAL"] = "INITIAL";
2186
- ActionStatut["PENDING_PAYMENT"] = "PENDING_PAYMENT";
2187
- ActionStatut["TRANSFERRED"] = "TRANSFERRED";
2188
- ActionStatut["ABANDONED"] = "ABANDONED";
2189
- ActionStatut["REOPENED"] = "REOPENED";
2190
- })(ActionStatut || (ActionStatut = {}));
2191
- class GesdemStatutUtils {
2192
- static isFinal(actionStatut) {
2193
- if (!actionStatut) {
2194
- return false;
2195
- }
2196
- return (actionStatut === ActionStatut.TRANSFERRED ||
2197
- actionStatut === ActionStatut.ABANDONED);
2198
- }
2199
- }
2200
-
2201
- class FoehnPageService {
2202
- constructor() {
2203
- this._foehnPageSubject = new Subject();
2204
- this._saveFormRequestSubject = new Subject();
2205
- this._currentEtapeId = new BehaviorSubject(null);
2206
- this.currentEtapeIdObs = this._currentEtapeId.asObservable();
2207
- }
2208
- foehnPageObservable() {
2209
- return this._foehnPageSubject.asObservable();
2210
- }
2211
- setPageTitle(title) {
2212
- this._foehnPageSubject.next(title);
2213
- }
2214
- requestFormSave() {
2215
- this._saveFormRequestSubject.next();
2216
- }
2217
- saveFormRequest() {
2218
- return this._saveFormRequestSubject.asObservable();
2219
- }
2220
- setCurrentEtapeId(etapeId) {
2221
- this._currentEtapeId.next(etapeId);
2222
- }
2223
- onEtapeIdChange() {
2224
- return this._currentEtapeId
2225
- .asObservable()
2226
- .pipe(filter(etapeInfo => !!etapeInfo));
2227
- }
2228
- isUserCategoryVisible(isFirstPage, isLastPage, isUserCategoryEnabled, isInitialStep, isUserNeverConnected,
2229
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2230
- backendResponse, isCurrentRouteDefined) {
2231
- const isStatusFinal = backendResponse &&
2232
- GesdemStatutUtils.isFinal(ActionStatut[backendResponse.meta.statut]);
2233
- return (isCurrentRouteDefined &&
2234
- !isStatusFinal &&
2235
- !isUserNeverConnected &&
2236
- isUserCategoryEnabled &&
2237
- isInitialStep &&
2238
- (isFirstPage || isLastPage));
2239
- }
2240
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FoehnPageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2241
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FoehnPageService, providedIn: 'root' }); }
2242
- }
2243
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FoehnPageService, decorators: [{
2244
- type: Injectable,
2245
- args: [{
2246
- providedIn: 'root'
2247
- }]
2248
- }], ctorParameters: () => [] });
2249
-
2250
2405
  class PendingFiles {
2251
2406
  }
2252
2407
 
@@ -2589,131 +2744,6 @@ class UploaderHelper {
2589
2744
  }
2590
2745
  }
2591
2746
 
2592
- // eslint-disable max-classes-per-file
2593
- class ApplicationInfo {
2594
- }
2595
- class EtapeInfo {
2596
- }
2597
- class Configuration {
2598
- }
2599
- class Session {
2600
- }
2601
- class Document {
2602
- }
2603
- class Captcha {
2604
- }
2605
- class Portail {
2606
- }
2607
-
2608
- const APP_INFO_API_URL = 'api/applicationInfo';
2609
- const PORTAIL_BASE_URL_INT = 'https://int-prestations.vd.ch/';
2610
- const FORM_SUPPORT_CYBER_TITLE_FALLBACK = "Demander de l'aide pour l'utilisation du portail sécurisé";
2611
- class ApplicationInfoService {
2612
- constructor(http, foehnPageService) {
2613
- this.http = http;
2614
- this.foehnPageService = foehnPageService;
2615
- this.applicationInfo = new ApplicationInfo();
2616
- this.pulling_ = this.http
2617
- .get(APP_INFO_API_URL)
2618
- .pipe(shareReplay(1));
2619
- // In most prestation, we're interested in the first etape info.
2620
- this.firstEtapeInfo_ = this.pulling_.pipe(filter(appInfo => !!appInfo && !!appInfo.etapeInfos), map(({ etapeInfos }) => {
2621
- // Checks whether the server returns a first key, otherwise fails the
2622
- // observable to ensure that client applications don't try to use this value
2623
- // and are able to implement fallback strategies.
2624
- const firstKey = Object.keys(etapeInfos)[0];
2625
- if (!firstKey) {
2626
- throw new Error('There must be at least one key in the etapeInfos');
2627
- }
2628
- return etapeInfos[firstKey];
2629
- }));
2630
- this.currentEtapeInfo_ = combineLatest([
2631
- this.foehnPageService.onEtapeIdChange(),
2632
- this.pulling_
2633
- ]).pipe(map(([etapeId, applicationInfo]) => applicationInfo.etapeInfos[etapeId]), shareReplay(1));
2634
- this.pulling_.subscribe((ai) => this.setApplicationInfo(ai));
2635
- }
2636
- get data() {
2637
- return this.pulling_;
2638
- }
2639
- get firstEtapeInfo() {
2640
- return this.firstEtapeInfo_;
2641
- }
2642
- get currentEtapeInfo() {
2643
- return this.currentEtapeInfo_;
2644
- }
2645
- getSafeCyberLoginUrl() {
2646
- return this.data.pipe(map(appInfo => appInfo.configuration?.portail?.cyberLoginUrl ||
2647
- `${this.getPortailBaseUrl(appInfo)}100018/`));
2648
- }
2649
- getSafeSupportFormUrl(reference, errors) {
2650
- return this.data.pipe(map(appInfo => appInfo.configuration?.portail?.supportFormUrl ||
2651
- `${this.getPortailBaseUrl(appInfo)}pub/101098/`), map(link => {
2652
- if (!!reference?.length) {
2653
- link += `?concernedReference=${reference}`;
2654
- }
2655
- if (!!errors?.length) {
2656
- link += !!reference?.length ? '&' : '?';
2657
- // Need following code to avoid browser Sanitizing error when using JSON.stringify
2658
- link += `errors=${errors
2659
- .map(error => Object.entries(error)
2660
- .map(value => `${value.join('=')}`)
2661
- .join(','))
2662
- .join(';')}`;
2663
- }
2664
- return link;
2665
- }));
2666
- }
2667
- getSafeSupportFormTitle() {
2668
- return this.data.pipe(map(appInfo => {
2669
- const title = appInfo.configuration?.portail
2670
- ?.portailTitlesByPrestaCode?.[101098];
2671
- return title && title.length
2672
- ? title
2673
- : FORM_SUPPORT_CYBER_TITLE_FALLBACK;
2674
- }));
2675
- }
2676
- getSafeEspacesSecuriseUrl() {
2677
- return this.data.pipe(map(appInfo => appInfo.configuration?.portail?.espaceSecuriseUrl ||
2678
- `${this.getPortailBaseUrl(appInfo)}100002/`));
2679
- }
2680
- setApplicationInfo(applicationInfo) {
2681
- this.applicationInfo = applicationInfo;
2682
- if (this.applicationInfo) {
2683
- switch (this.applicationInfo.environment) {
2684
- case 'CO': {
2685
- this.applicationInfo.environmentLabel = 'développement';
2686
- break;
2687
- }
2688
- case 'IN': {
2689
- this.applicationInfo.environmentLabel = 'intégration';
2690
- break;
2691
- }
2692
- case 'VA': {
2693
- this.applicationInfo.environmentLabel = 'validation';
2694
- break;
2695
- }
2696
- default: {
2697
- // Nothing to do
2698
- }
2699
- }
2700
- }
2701
- }
2702
- getPortailBaseUrl(appInfo) {
2703
- return appInfo.environment === 'CO'
2704
- ? PORTAIL_BASE_URL_INT
2705
- : `${window.location.origin}/`;
2706
- }
2707
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ApplicationInfoService, deps: [{ token: i1.HttpClient }, { token: FoehnPageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2708
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ApplicationInfoService, providedIn: 'root' }); }
2709
- }
2710
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ApplicationInfoService, decorators: [{
2711
- type: Injectable,
2712
- args: [{
2713
- providedIn: 'root'
2714
- }]
2715
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: FoehnPageService }] });
2716
-
2717
2747
  class UploadProgressService {
2718
2748
  constructor() {
2719
2749
  this._uploadProgressSubject = new BehaviorSubject(null);
@@ -3639,6 +3669,7 @@ class GesdemConfirmationComponent {
3639
3669
  this._sessionInfo = ServiceLocator.injector.get(SessionInfo);
3640
3670
  this._navigation = ServiceLocator.injector.get(FoehnNavigationService);
3641
3671
  this._eventsLoggerService = ServiceLocator.injector.get(SdkEventsLoggerService);
3672
+ this._applicationInfoService = ServiceLocator.injector.get(ApplicationInfoService);
3642
3673
  const route = FoehnNavigationService.getRootRouteRecursive(activatedRoute.snapshot);
3643
3674
  this._navigation.initRoute(route);
3644
3675
  // Override from the routing.
@@ -3682,18 +3713,20 @@ class GesdemConfirmationComponent {
3682
3713
  this.closeButtonConnectedText ||
3683
3714
  'gesdem-confirmation.exit-button-connected';
3684
3715
  // default closeLink if not by @Input and not by route data
3685
- this.foehnPageService
3686
- .onEtapeIdChange()
3687
- .pipe(first())
3688
- // eslint-disable-next-line rxjs/no-nested-subscribe,rxjs-angular/prefer-async-pipe
3689
- .subscribe(etapeId => {
3716
+ combineLatest([
3717
+ this.foehnPageService.onEtapeIdChange().pipe(first()),
3718
+ this._applicationInfoService.data.pipe(first())
3719
+ ])
3720
+ .pipe(first(), tap(([etapeId, appInfo]) => {
3690
3721
  if (!this.closeLinkNotConnected.getValue()) {
3691
- this.closeLinkNotConnected.next(`https://www.vd.ch/go.to?prestation=${etapeId}`);
3722
+ this.closeLinkNotConnected.next(`${appInfo.configuration.portail.baseVdChUrl}/go.to?prestation=${etapeId}`);
3692
3723
  }
3693
3724
  if (!this.closeLinkConnected.getValue()) {
3694
3725
  this.closeLinkConnected.next('/100018/logout');
3695
3726
  }
3696
- });
3727
+ }))
3728
+ // eslint-disable-next-line rxjs/no-nested-subscribe,rxjs-angular/prefer-async-pipe,rxjs/no-nested-subscribe
3729
+ .subscribe();
3697
3730
  });
3698
3731
  }
3699
3732
  get isTransferred() {
@@ -10021,7 +10054,7 @@ class FoehnTimeComponent extends FoehnInputStringComponent {
10021
10054
  useExisting: forwardRef(() => FoehnTimeComponent),
10022
10055
  multi: true
10023
10056
  }
10024
- ], usesInheritance: true, ngImport: i0, template: "<div\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [attr.id]=\"buildId('Container')\"\n tabindex=\"-1\"\n>\n <fieldset\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n <legend\n *ngIf=\"!!label\"\n [ngClass]=\"isLabelSrOnly ? 'visually-hidden' : 'vd-p'\"\n >\n <span [innerHTML]=\"label\"></span>\n <span\n *ngIf=\"!required && !hideNotRequiredExtraLabel\"\n aria-hidden=\"true\"\n >\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n </legend>\n\n <foehn-validation-alerts [component]=\"this\"></foehn-validation-alerts>\n\n <small\n *ngIf=\"helpText\"\n [attr.id]=\"buildId() + 'Help'\"\n class=\"text-secondary\"\n [innerHTML]=\"helpText\"\n ></small>\n\n <ng-content></ng-content>\n\n <div class=\"vd-form-flex\">\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_hours'\"\n [name]=\"name + '_hours'\"\n [label]=\"'foehn-input-time.hours.label' | fromDictionary\"\n [maxlength]=\"2\"\n [max]=\"24\"\n [(model)]=\"hour\"\n (focusout)=\"updateTime()\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n [isLabelSrOnly]=\"childrenLabelSrOnly\"\n #entryComponent\n ></foehn-input-number>\n </div>\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_minutes'\"\n [name]=\"name + '_minutes'\"\n [label]=\"'foehn-input-time.minutes.label' | fromDictionary\"\n [maxlength]=\"2\"\n [max]=\"59\"\n [(model)]=\"minute\"\n (focusout)=\"updateTime()\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n [isLabelSrOnly]=\"childrenLabelSrOnly\"\n ></foehn-input-number>\n </div>\n <div\n class=\"align-self-center position-relative\"\n *ngIf=\"!isEmpty() && (displayClearButton() | async)\"\n >\n <button\n [id]=\"buildId() + '_clearButton'\"\n type=\"button\"\n class=\"clear-button btn btn-link d-flex\"\n (click)=\"resetModel()\"\n >\n <foehn-icon-times\n [title]=\"\n 'foehn-input.clear-button.label' | fromDictionary\n \"\n ></foehn-icon-times>\n </button>\n </div>\n </div>\n </fieldset>\n</div>\n", styles: [":host ::ng-deep .clear-button.btn .svg-inline--fa{font-size:1.5rem;color:#000!important}:host ::ng-deep foehn-input-number div.form-group{margin-bottom:0!important}\n"], dependencies: [{ kind: "component", type: FoehnIconTimesComponent, selector: "foehn-icon-times" }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FoehnValidationAlertsComponent, selector: "foehn-validation-alerts", inputs: ["component", "shouldErrorsBeLive"] }, { kind: "component", type: FoehnInputNumberComponent, selector: "foehn-input-number", inputs: ["hideStandardHelpText", "allowDecimal", "allowNegative", "maxDecimalCount", "allowFreeInput", "allowLeadingZero", "model"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: SdkDictionaryPipe, name: "fromDictionary" }] }); }
10057
+ ], usesInheritance: true, ngImport: i0, template: "<div\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [attr.id]=\"buildId('Container')\"\n tabindex=\"-1\"\n>\n <fieldset\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n <legend\n *ngIf=\"!!label\"\n [ngClass]=\"isLabelSrOnly ? 'visually-hidden' : 'vd-p'\"\n >\n <span [innerHTML]=\"label\"></span>\n <span\n *ngIf=\"!required && !hideNotRequiredExtraLabel\"\n aria-hidden=\"true\"\n >\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n </legend>\n\n <foehn-validation-alerts [component]=\"this\"></foehn-validation-alerts>\n\n <small\n *ngIf=\"helpText\"\n [attr.id]=\"buildId() + 'Help'\"\n class=\"text-secondary\"\n [innerHTML]=\"helpText\"\n ></small>\n\n <ng-content></ng-content>\n\n <div class=\"vd-form-flex\">\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_hours'\"\n [name]=\"name + '_hours'\"\n [label]=\"'foehn-input-time.hours.label' | fromDictionary\"\n [maxlength]=\"2\"\n [max]=\"24\"\n [(model)]=\"hour\"\n (focusout)=\"updateTime()\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n [isLabelSrOnly]=\"childrenLabelSrOnly\"\n [allowLeadingZero]=\"true\"\n #entryComponent\n ></foehn-input-number>\n </div>\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_minutes'\"\n [name]=\"name + '_minutes'\"\n [label]=\"'foehn-input-time.minutes.label' | fromDictionary\"\n [maxlength]=\"2\"\n [max]=\"59\"\n [(model)]=\"minute\"\n (focusout)=\"updateTime()\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n [isLabelSrOnly]=\"childrenLabelSrOnly\"\n [allowLeadingZero]=\"true\"\n ></foehn-input-number>\n </div>\n <div\n class=\"align-self-center position-relative\"\n *ngIf=\"!isEmpty() && (displayClearButton() | async)\"\n >\n <button\n [id]=\"buildId() + '_clearButton'\"\n type=\"button\"\n class=\"clear-button btn btn-link d-flex\"\n (click)=\"resetModel()\"\n >\n <foehn-icon-times\n [title]=\"\n 'foehn-input.clear-button.label' | fromDictionary\n \"\n ></foehn-icon-times>\n </button>\n </div>\n </div>\n </fieldset>\n</div>\n", styles: [":host ::ng-deep .clear-button.btn .svg-inline--fa{font-size:1.5rem;color:#000!important}:host ::ng-deep foehn-input-number div.form-group{margin-bottom:0!important}\n"], dependencies: [{ kind: "component", type: FoehnIconTimesComponent, selector: "foehn-icon-times" }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FoehnValidationAlertsComponent, selector: "foehn-validation-alerts", inputs: ["component", "shouldErrorsBeLive"] }, { kind: "component", type: FoehnInputNumberComponent, selector: "foehn-input-number", inputs: ["hideStandardHelpText", "allowDecimal", "allowNegative", "maxDecimalCount", "allowFreeInput", "allowLeadingZero", "model"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: SdkDictionaryPipe, name: "fromDictionary" }] }); }
10025
10058
  }
10026
10059
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FoehnTimeComponent, decorators: [{
10027
10060
  type: Component,
@@ -10031,7 +10064,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
10031
10064
  useExisting: forwardRef(() => FoehnTimeComponent),
10032
10065
  multi: true
10033
10066
  }
10034
- ], template: "<div\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [attr.id]=\"buildId('Container')\"\n tabindex=\"-1\"\n>\n <fieldset\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n <legend\n *ngIf=\"!!label\"\n [ngClass]=\"isLabelSrOnly ? 'visually-hidden' : 'vd-p'\"\n >\n <span [innerHTML]=\"label\"></span>\n <span\n *ngIf=\"!required && !hideNotRequiredExtraLabel\"\n aria-hidden=\"true\"\n >\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n </legend>\n\n <foehn-validation-alerts [component]=\"this\"></foehn-validation-alerts>\n\n <small\n *ngIf=\"helpText\"\n [attr.id]=\"buildId() + 'Help'\"\n class=\"text-secondary\"\n [innerHTML]=\"helpText\"\n ></small>\n\n <ng-content></ng-content>\n\n <div class=\"vd-form-flex\">\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_hours'\"\n [name]=\"name + '_hours'\"\n [label]=\"'foehn-input-time.hours.label' | fromDictionary\"\n [maxlength]=\"2\"\n [max]=\"24\"\n [(model)]=\"hour\"\n (focusout)=\"updateTime()\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n [isLabelSrOnly]=\"childrenLabelSrOnly\"\n #entryComponent\n ></foehn-input-number>\n </div>\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_minutes'\"\n [name]=\"name + '_minutes'\"\n [label]=\"'foehn-input-time.minutes.label' | fromDictionary\"\n [maxlength]=\"2\"\n [max]=\"59\"\n [(model)]=\"minute\"\n (focusout)=\"updateTime()\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n [isLabelSrOnly]=\"childrenLabelSrOnly\"\n ></foehn-input-number>\n </div>\n <div\n class=\"align-self-center position-relative\"\n *ngIf=\"!isEmpty() && (displayClearButton() | async)\"\n >\n <button\n [id]=\"buildId() + '_clearButton'\"\n type=\"button\"\n class=\"clear-button btn btn-link d-flex\"\n (click)=\"resetModel()\"\n >\n <foehn-icon-times\n [title]=\"\n 'foehn-input.clear-button.label' | fromDictionary\n \"\n ></foehn-icon-times>\n </button>\n </div>\n </div>\n </fieldset>\n</div>\n", styles: [":host ::ng-deep .clear-button.btn .svg-inline--fa{font-size:1.5rem;color:#000!important}:host ::ng-deep foehn-input-number div.form-group{margin-bottom:0!important}\n"] }]
10067
+ ], template: "<div\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [attr.id]=\"buildId('Container')\"\n tabindex=\"-1\"\n>\n <fieldset\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n <legend\n *ngIf=\"!!label\"\n [ngClass]=\"isLabelSrOnly ? 'visually-hidden' : 'vd-p'\"\n >\n <span [innerHTML]=\"label\"></span>\n <span\n *ngIf=\"!required && !hideNotRequiredExtraLabel\"\n aria-hidden=\"true\"\n >\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n </legend>\n\n <foehn-validation-alerts [component]=\"this\"></foehn-validation-alerts>\n\n <small\n *ngIf=\"helpText\"\n [attr.id]=\"buildId() + 'Help'\"\n class=\"text-secondary\"\n [innerHTML]=\"helpText\"\n ></small>\n\n <ng-content></ng-content>\n\n <div class=\"vd-form-flex\">\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_hours'\"\n [name]=\"name + '_hours'\"\n [label]=\"'foehn-input-time.hours.label' | fromDictionary\"\n [maxlength]=\"2\"\n [max]=\"24\"\n [(model)]=\"hour\"\n (focusout)=\"updateTime()\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n [isLabelSrOnly]=\"childrenLabelSrOnly\"\n [allowLeadingZero]=\"true\"\n #entryComponent\n ></foehn-input-number>\n </div>\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_minutes'\"\n [name]=\"name + '_minutes'\"\n [label]=\"'foehn-input-time.minutes.label' | fromDictionary\"\n [maxlength]=\"2\"\n [max]=\"59\"\n [(model)]=\"minute\"\n (focusout)=\"updateTime()\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n [isLabelSrOnly]=\"childrenLabelSrOnly\"\n [allowLeadingZero]=\"true\"\n ></foehn-input-number>\n </div>\n <div\n class=\"align-self-center position-relative\"\n *ngIf=\"!isEmpty() && (displayClearButton() | async)\"\n >\n <button\n [id]=\"buildId() + '_clearButton'\"\n type=\"button\"\n class=\"clear-button btn btn-link d-flex\"\n (click)=\"resetModel()\"\n >\n <foehn-icon-times\n [title]=\"\n 'foehn-input.clear-button.label' | fromDictionary\n \"\n ></foehn-icon-times>\n </button>\n </div>\n </div>\n </fieldset>\n</div>\n", styles: [":host ::ng-deep .clear-button.btn .svg-inline--fa{font-size:1.5rem;color:#000!important}:host ::ng-deep foehn-input-number div.form-group{margin-bottom:0!important}\n"] }]
10035
10068
  }], ctorParameters: () => [], propDecorators: { childrenLabelSrOnly: [{
10036
10069
  type: Input
10037
10070
  }] } });
@@ -12925,19 +12958,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
12925
12958
  }] });
12926
12959
 
12927
12960
  class RedirectComponent {
12928
- constructor(iamInterceptor, foehnPageModalService) {
12961
+ constructor(iamInterceptor, foehnPageModalService, sessionInfo) {
12929
12962
  this.iamInterceptor = iamInterceptor;
12930
12963
  this.foehnPageModalService = foehnPageModalService;
12931
- this.redirectUrl =
12932
- this.foehnPageModalService.buildSelfRedirectionThroughCyberLogin();
12964
+ this.sessionInfo = sessionInfo;
12965
+ this.redirectUrl = '';
12966
+ this.sessionInfo.data
12967
+ .pipe(first(), switchMap$1(data => {
12968
+ if (!data || !!data.context) {
12969
+ // not connected or connected cyber
12970
+ return this.foehnPageModalService.buildSelfRedirectionThroughCyberLogin();
12971
+ }
12972
+ // connected ACV, refresh page
12973
+ return of('');
12974
+ }), tap(redirectUrl => {
12975
+ this.redirectUrl = redirectUrl;
12976
+ }))
12977
+ // eslint-disable-next-line rxjs-angular/prefer-async-pipe
12978
+ .subscribe( /* redirect url should be calculated when the user is still connected to know if IAM or Cyber*/);
12933
12979
  this.isModalVisible = this.iamInterceptor.isIamSessionExpired.pipe(first(), tap(() => this.startTimer()));
12934
12980
  }
12935
12981
  reloadPage() {
12936
- this.redirectUrl
12937
- // eslint-disable-next-line rxjs-angular/prefer-async-pipe
12938
- .subscribe(redirectUrl => {
12939
- window.location.href = redirectUrl;
12940
- });
12982
+ window.location.href = this.redirectUrl;
12941
12983
  }
12942
12984
  startTimer() {
12943
12985
  this.counter = 10;
@@ -12949,13 +12991,13 @@ class RedirectComponent {
12949
12991
  this.counter--;
12950
12992
  }, 1000);
12951
12993
  }
12952
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RedirectComponent, deps: [{ token: IamExpiredInterceptorService }, { token: FoehnPageModalService }], target: i0.ɵɵFactoryTarget.Component }); }
12953
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: RedirectComponent, selector: "redirector", ngImport: i0, template: "<foehn-modal\n [modalHeaderText]=\"'Information'\"\n [isModalVisible]=\"isModalVisible | async\"\n [closeable]=\"false\"\n>\n <p>Votre session a expir\u00E9.</p>\n <p>\n Vous pouvez\n <a [href]=\"redirectUrl | async\">vous connecter</a>\n \u00E0 nouveau pour continuer \u00E0 utiliser nos services.\n </p>\n\n <div modal-footer class=\"w-100 text-end fw-bold\">\n Vous allez \u00EAtre redirig\u00E9 dans {{ counter }} s.\n </div>\n</foehn-modal>\n", dependencies: [{ kind: "component", type: FoehnModalComponent, selector: "foehn-modal", inputs: ["id", "name", "modalSize", "modalBodyText", "modalHeaderText", "closeable", "modalTriggerHtmlElement", "isModalVisible"], outputs: ["isModalVisibleChange"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] }); }
12994
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RedirectComponent, deps: [{ token: IamExpiredInterceptorService }, { token: FoehnPageModalService }, { token: SessionInfo }], target: i0.ɵɵFactoryTarget.Component }); }
12995
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: RedirectComponent, selector: "redirector", ngImport: i0, template: "<foehn-modal\n [modalHeaderText]=\"'Information'\"\n [isModalVisible]=\"isModalVisible | async\"\n [closeable]=\"false\"\n>\n <p>Votre session a expir\u00E9.</p>\n <p>\n Vous pouvez\n <a [href]=\"redirectUrl\">vous connecter</a>\n \u00E0 nouveau pour continuer \u00E0 utiliser nos services.\n </p>\n\n <div modal-footer class=\"w-100 text-end fw-bold\">\n Vous allez \u00EAtre redirig\u00E9 dans {{ counter }} s.\n </div>\n</foehn-modal>\n", dependencies: [{ kind: "component", type: FoehnModalComponent, selector: "foehn-modal", inputs: ["id", "name", "modalSize", "modalBodyText", "modalHeaderText", "closeable", "modalTriggerHtmlElement", "isModalVisible"], outputs: ["isModalVisibleChange"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] }); }
12954
12996
  }
12955
12997
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RedirectComponent, decorators: [{
12956
12998
  type: Component,
12957
- args: [{ selector: 'redirector', template: "<foehn-modal\n [modalHeaderText]=\"'Information'\"\n [isModalVisible]=\"isModalVisible | async\"\n [closeable]=\"false\"\n>\n <p>Votre session a expir\u00E9.</p>\n <p>\n Vous pouvez\n <a [href]=\"redirectUrl | async\">vous connecter</a>\n \u00E0 nouveau pour continuer \u00E0 utiliser nos services.\n </p>\n\n <div modal-footer class=\"w-100 text-end fw-bold\">\n Vous allez \u00EAtre redirig\u00E9 dans {{ counter }} s.\n </div>\n</foehn-modal>\n" }]
12958
- }], ctorParameters: () => [{ type: IamExpiredInterceptorService }, { type: FoehnPageModalService }] });
12999
+ args: [{ selector: 'redirector', template: "<foehn-modal\n [modalHeaderText]=\"'Information'\"\n [isModalVisible]=\"isModalVisible | async\"\n [closeable]=\"false\"\n>\n <p>Votre session a expir\u00E9.</p>\n <p>\n Vous pouvez\n <a [href]=\"redirectUrl\">vous connecter</a>\n \u00E0 nouveau pour continuer \u00E0 utiliser nos services.\n </p>\n\n <div modal-footer class=\"w-100 text-end fw-bold\">\n Vous allez \u00EAtre redirig\u00E9 dans {{ counter }} s.\n </div>\n</foehn-modal>\n" }]
13000
+ }], ctorParameters: () => [{ type: IamExpiredInterceptorService }, { type: FoehnPageModalService }, { type: SessionInfo }] });
12959
13001
 
12960
13002
  class SdkRedirectModule {
12961
13003
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: SdkRedirectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }