@dsivd/prestations-ng 16.4.10-beta.2 → 16.4.10-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.
@@ -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 => {
@@ -4679,9 +4695,10 @@ class ObjectHelper {
4679
4695
  *
4680
4696
  * @param value1 as first value to compare to
4681
4697
  * @param value2 as value to be compared to
4698
+ * @param skipFunctionTypeCompare boolean (default true) (when set to false compares functions)
4682
4699
  * @returns boolean
4683
4700
  */
4684
- static isEqual(value1, value2) {
4701
+ static isEqual(value1, value2, skipFunctionTypeCompare = true) {
4685
4702
  if (value1 &&
4686
4703
  value2 &&
4687
4704
  typeof value1 === 'object' &&
@@ -4689,6 +4706,16 @@ class ObjectHelper {
4689
4706
  const matches = (obj, source) => Object.keys(source).length === Object.keys(obj).length &&
4690
4707
  Object.keys(source).every(key => {
4691
4708
  if (obj.hasOwnProperty(key)) {
4709
+ if (obj[key] &&
4710
+ source[key] &&
4711
+ typeof obj[key] === 'function' &&
4712
+ typeof source[key] === 'function') {
4713
+ if (skipFunctionTypeCompare) {
4714
+ return true;
4715
+ }
4716
+ // Didn't find better to compare two functions
4717
+ return (obj[key].toString() === source[key].toString());
4718
+ }
4692
4719
  if (obj[key] &&
4693
4720
  source[key] &&
4694
4721
  typeof obj[key] === 'object' &&
@@ -4703,6 +4730,9 @@ class ObjectHelper {
4703
4730
  }
4704
4731
  return value1 === value2;
4705
4732
  }
4733
+ static isDifferent(value1, value2, skipFunctionType = true) {
4734
+ return !ObjectHelper.isEqual(value1, value2, skipFunctionType);
4735
+ }
4706
4736
  static hasAnyValue(value) {
4707
4737
  // do not simplify with an inline variable result due to compilation error
4708
4738
  const result = Object.keys(value).some(key => {
@@ -12056,23 +12086,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
12056
12086
  }] });
12057
12087
 
12058
12088
  class FoehnRemainingAlertsSummaryComponent {
12059
- constructor(gesdemService) {
12089
+ constructor(gesdemService, applicationInfoService, dictionaryService) {
12060
12090
  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>';
12091
+ this.applicationInfoService = applicationInfoService;
12092
+ this.dictionaryService = dictionaryService;
12063
12093
  this.remainingErrorNamesToIgnore = [];
12064
12094
  this.hasRemainingErrors = of(false);
12065
- this.hasRemainingErrors = this.gesdemService.updateFormDataSubject.pipe(map(() => !!this.gesdemService.lastResponse.errors.filter(e => !this.remainingErrorNamesToIgnore.includes(e.name)).length));
12095
+ this.remainingErrorsLabelSubject = new BehaviorSubject(null);
12096
+ this.DEFAULT_REMAINING_ERRORS_MSG_KEY = 'foehn-remaining-alert-summary.default-error-message';
12097
+ const remainingErrors = this.gesdemService.updateFormDataSubject.pipe(map(() => {
12098
+ this.reference = this.gesdemService.lastResponse.meta.reference;
12099
+ return this.gesdemService.lastResponse.errors.filter(e => !this.remainingErrorNamesToIgnore.includes(e.name));
12100
+ }), shareReplay(1));
12101
+ 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, {
12102
+ supportLink: link
12103
+ })));
12104
+ this.hasRemainingErrors = remainingErrors.pipe(map(errors => !!errors.length));
12105
+ this.remainingErrorsMessage = combineLatest([
12106
+ defaultRemainingErrorsMsg,
12107
+ this.remainingErrorsLabelSubject.asObservable()
12108
+ ]).pipe(map(([defaultMsg, errorLabel]) => {
12109
+ if (errorLabel) {
12110
+ return errorLabel;
12111
+ }
12112
+ return defaultMsg;
12113
+ }));
12114
+ }
12115
+ set remainingErrorsLabel(msg) {
12116
+ this.remainingErrorsLabelSubject.next(msg);
12066
12117
  }
12067
12118
  }
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" }] });
12119
+ 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 });
12120
+ 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
12121
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FoehnRemainingAlertsSummaryComponent, decorators: [{
12071
12122
  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: [{
12123
+ args: [{ selector: 'foehn-remaining-alerts-summary', template: "<div\n class=\"alert alert-danger\"\n *ngIf=\"hasRemainingErrors | async\"\n [innerHTML]=\"remainingErrorsMessage | async\"\n></div>\n" }]
12124
+ }], ctorParameters: function () { return [{ type: GesdemHandlerService }, { type: ApplicationInfoService }, { type: SdkDictionaryService }]; }, propDecorators: { remainingErrorNamesToIgnore: [{
12074
12125
  type: Input
12075
- }], remainingErrorNamesToIgnore: [{
12126
+ }], remainingErrorsLabel: [{
12076
12127
  type: Input
12077
12128
  }] } });
12078
12129
 
@@ -14491,9 +14542,28 @@ class FoehnListSummaryComponent extends FoehnInputComponent {
14491
14542
  this.tableSort = {
14492
14543
  sortDirection: 'ASC'
14493
14544
  };
14545
+ this.list_ = [];
14546
+ this.listItemDescriptions_ = [];
14494
14547
  this.trackFoehnListItem = (index, item) => item.trackingIndex || index;
14495
14548
  this.trackFoehnListItemDescription = (index, item) => item.label || index;
14496
14549
  }
14550
+ get list() {
14551
+ return this.list_;
14552
+ }
14553
+ set list(items) {
14554
+ if (ObjectHelper.isDifferent(items, this.list_)) {
14555
+ this.list_ = items;
14556
+ }
14557
+ }
14558
+ // eslint-disable-next-line @typescript-eslint/member-ordering
14559
+ get listItemDescriptions() {
14560
+ return this.listItemDescriptions_;
14561
+ }
14562
+ set listItemDescriptions(items) {
14563
+ if (ObjectHelper.isDifferent(items, this.listItemDescriptions_)) {
14564
+ this.listItemDescriptions_ = items;
14565
+ }
14566
+ }
14497
14567
  ngOnChanges(changes) {
14498
14568
  if (!!changes?.list?.currentValue?.length || !!changes.showAsTable) {
14499
14569
  this.updateListCopyForTable();
@@ -14573,7 +14643,7 @@ class FoehnListSummaryComponent extends FoehnInputComponent {
14573
14643
  }
14574
14644
  }
14575
14645
  FoehnListSummaryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FoehnListSummaryComponent, deps: [{ token: FoehnConfirmModalService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
14576
- FoehnListSummaryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FoehnListSummaryComponent, selector: "foehn-list-summary", inputs: { list: "list", getListItemTitle: "getListItemTitle", showAsTable: "showAsTable", listItemDescriptions: "listItemDescriptions" }, outputs: { itemRemoved: "itemRemoved", itemEdit: "itemEdit" }, providers: [
14646
+ FoehnListSummaryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FoehnListSummaryComponent, selector: "foehn-list-summary", inputs: { getListItemTitle: "getListItemTitle", showAsTable: "showAsTable", list: "list", listItemDescriptions: "listItemDescriptions" }, outputs: { itemRemoved: "itemRemoved", itemEdit: "itemEdit" }, providers: [
14577
14647
  {
14578
14648
  provide: FoehnInputComponent,
14579
14649
  useExisting: forwardRef(() => FoehnListSummaryComponent),
@@ -14592,18 +14662,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
14592
14662
  }], ctorParameters: function () { return [{ type: FoehnConfirmModalService }, { type: i0.NgZone }]; }, propDecorators: { tableActionButtons: [{
14593
14663
  type: ViewChild,
14594
14664
  args: ['tableActionButtons']
14595
- }], list: [{
14596
- type: Input
14597
14665
  }], getListItemTitle: [{
14598
14666
  type: Input
14599
14667
  }], showAsTable: [{
14600
14668
  type: Input
14601
- }], listItemDescriptions: [{
14602
- type: Input
14603
14669
  }], itemRemoved: [{
14604
14670
  type: Output
14605
14671
  }], itemEdit: [{
14606
14672
  type: Output
14673
+ }], list: [{
14674
+ type: Input
14675
+ }], listItemDescriptions: [{
14676
+ type: Input
14607
14677
  }] } });
14608
14678
 
14609
14679
  class FoehnMenuItemComponent {