@dsivd/prestations-ng 16.4.10-beta.2 → 16.4.10-beta.3

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.
@@ -979,7 +979,11 @@ const DEFAULT_DICTIONARY = {
979
979
  'espace-securise.menu.item.administrer-espace-pro.label': "Administrer l'espace professionnel",
980
980
  'espace-securise.menu.item.administrer-espace-pro.title': "Administrer l'espace professionnel",
981
981
  'espace-securise.menu.item.deconnection.label': 'Se déconnecter',
982
- 'espace-securise.menu.item.deconnection.title': 'Se déconnecter'
982
+ 'espace-securise.menu.item.deconnection.title': 'Se déconnecter',
983
+ 'foehn-remaining-alert-summary.default-error-message': '<p>Notre formulaire a un problème et vous ne pourrez pas le transmettre.</p>' +
984
+ '<p>Merci de prendre contact avec nous et de nous communiquer cette erreur au moyen du formulaire de support : ' +
985
+ '<a href="{supportLink}" target="_blank">https://www.vd.ch/contact-portail/</a></p>' +
986
+ '<p>Nous reprendrons contact avec vous.</p>'
983
987
  };
984
988
 
985
989
  class GrowlMessage {
@@ -1502,11 +1506,23 @@ class ApplicationInfoService {
1502
1506
  return this.data.pipe(map(appInfo => appInfo.configuration?.portail?.cyberLoginUrl ||
1503
1507
  `${this.getPortailBaseUrl(appInfo)}100018/`));
1504
1508
  }
1505
- getSafeSupportFormUrl(reference) {
1509
+ getSafeSupportFormUrl(reference, errors) {
1506
1510
  return this.data.pipe(map(appInfo => appInfo.configuration?.portail?.supportFormUrl ||
1507
- `${this.getPortailBaseUrl(appInfo)}pub/101098/`), map(link => !!reference?.length
1508
- ? `${link}?concernedReference=${reference}`
1509
- : link));
1511
+ `${this.getPortailBaseUrl(appInfo)}pub/101098/`), map(link => {
1512
+ if (!!reference?.length) {
1513
+ link += `?concernedReference=${reference}`;
1514
+ }
1515
+ if (!!errors?.length) {
1516
+ link += !!reference?.length ? '&' : '?';
1517
+ // Need following code to avoid browser Sanitizing error when using JSON.stringify
1518
+ link += `errors=${errors
1519
+ .map(error => Object.entries(error)
1520
+ .map(value => `${value.join('=')}`)
1521
+ .join(','))
1522
+ .join(';')}`;
1523
+ }
1524
+ return link;
1525
+ }));
1510
1526
  }
1511
1527
  getSafeSupportFormTitle() {
1512
1528
  return this.data.pipe(map(appInfo => {
@@ -12056,23 +12072,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
12056
12072
  }] });
12057
12073
 
12058
12074
  class FoehnRemainingAlertsSummaryComponent {
12059
- constructor(gesdemService) {
12075
+ constructor(gesdemService, applicationInfoService, dictionaryService) {
12060
12076
  this.gesdemService = gesdemService;
12061
- this.remainingErrorsLabel = '<p>Il reste des erreurs, le formulaire ne peut pas être transmis.</p>' +
12062
- '<p>Merci de revenir en arrière ou de réessayer plus tard.</p>';
12077
+ this.applicationInfoService = applicationInfoService;
12078
+ this.dictionaryService = dictionaryService;
12063
12079
  this.remainingErrorNamesToIgnore = [];
12064
12080
  this.hasRemainingErrors = of(false);
12065
- this.hasRemainingErrors = this.gesdemService.updateFormDataSubject.pipe(map(() => !!this.gesdemService.lastResponse.errors.filter(e => !this.remainingErrorNamesToIgnore.includes(e.name)).length));
12081
+ this.remainingErrorsLabelSubject = new BehaviorSubject(null);
12082
+ this.DEFAULT_REMAINING_ERRORS_MSG_KEY = 'foehn-remaining-alert-summary.default-error-message';
12083
+ const remainingErrors = this.gesdemService.updateFormDataSubject.pipe(map(() => {
12084
+ this.reference = this.gesdemService.lastResponse.meta.reference;
12085
+ return this.gesdemService.lastResponse.errors.filter(e => !this.remainingErrorNamesToIgnore.includes(e.name));
12086
+ }), shareReplay(1));
12087
+ const defaultRemainingErrorsMsg = remainingErrors.pipe(filter(errors => !!errors.length), switchMap(errors => this.applicationInfoService.getSafeSupportFormUrl(this.reference, errors)), map(link => this.dictionaryService.getKeySync(this.DEFAULT_REMAINING_ERRORS_MSG_KEY, {
12088
+ supportLink: link
12089
+ })));
12090
+ this.hasRemainingErrors = remainingErrors.pipe(map(errors => !!errors.length));
12091
+ this.remainingErrorsMessage = combineLatest([
12092
+ defaultRemainingErrorsMsg,
12093
+ this.remainingErrorsLabelSubject.asObservable()
12094
+ ]).pipe(map(([defaultMsg, errorLabel]) => {
12095
+ if (errorLabel) {
12096
+ return errorLabel;
12097
+ }
12098
+ return defaultMsg;
12099
+ }));
12100
+ }
12101
+ set remainingErrorsLabel(msg) {
12102
+ this.remainingErrorsLabelSubject.next(msg);
12066
12103
  }
12067
12104
  }
12068
- FoehnRemainingAlertsSummaryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FoehnRemainingAlertsSummaryComponent, deps: [{ token: GesdemHandlerService }], target: i0.ɵɵFactoryTarget.Component });
12069
- FoehnRemainingAlertsSummaryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FoehnRemainingAlertsSummaryComponent, selector: "foehn-remaining-alerts-summary", inputs: { remainingErrorsLabel: "remainingErrorsLabel", remainingErrorNamesToIgnore: "remainingErrorNamesToIgnore" }, ngImport: i0, template: "<div\n class=\"alert alert-danger\"\n *ngIf=\"hasRemainingErrors | async\"\n [innerHTML]=\"remainingErrorsLabel\"\n></div>\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] });
12105
+ FoehnRemainingAlertsSummaryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FoehnRemainingAlertsSummaryComponent, deps: [{ token: GesdemHandlerService }, { token: ApplicationInfoService }, { token: SdkDictionaryService }], target: i0.ɵɵFactoryTarget.Component });
12106
+ FoehnRemainingAlertsSummaryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FoehnRemainingAlertsSummaryComponent, selector: "foehn-remaining-alerts-summary", inputs: { remainingErrorNamesToIgnore: "remainingErrorNamesToIgnore", remainingErrorsLabel: "remainingErrorsLabel" }, ngImport: i0, template: "<div\n class=\"alert alert-danger\"\n *ngIf=\"hasRemainingErrors | async\"\n [innerHTML]=\"remainingErrorsMessage | async\"\n></div>\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] });
12070
12107
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FoehnRemainingAlertsSummaryComponent, decorators: [{
12071
12108
  type: Component,
12072
- args: [{ selector: 'foehn-remaining-alerts-summary', template: "<div\n class=\"alert alert-danger\"\n *ngIf=\"hasRemainingErrors | async\"\n [innerHTML]=\"remainingErrorsLabel\"\n></div>\n" }]
12073
- }], ctorParameters: function () { return [{ type: GesdemHandlerService }]; }, propDecorators: { remainingErrorsLabel: [{
12109
+ args: [{ selector: 'foehn-remaining-alerts-summary', template: "<div\n class=\"alert alert-danger\"\n *ngIf=\"hasRemainingErrors | async\"\n [innerHTML]=\"remainingErrorsMessage | async\"\n></div>\n" }]
12110
+ }], ctorParameters: function () { return [{ type: GesdemHandlerService }, { type: ApplicationInfoService }, { type: SdkDictionaryService }]; }, propDecorators: { remainingErrorNamesToIgnore: [{
12074
12111
  type: Input
12075
- }], remainingErrorNamesToIgnore: [{
12112
+ }], remainingErrorsLabel: [{
12076
12113
  type: Input
12077
12114
  }] } });
12078
12115