@qbs-origin/origin-form 0.8.0 → 0.8.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.
@@ -16,7 +16,7 @@ import * as i4$1 from '@angular/material/checkbox';
16
16
  import { MatCheckboxModule } from '@angular/material/checkbox';
17
17
  import * as i6 from '@angular/material/autocomplete';
18
18
  import { MatAutocompleteTrigger, MatAutocompleteModule } from '@angular/material/autocomplete';
19
- import { catchError, throwError, BehaviorSubject, firstValueFrom, of, switchMap as switchMap$1, shareReplay, finalize, map, forkJoin, take, Subject, Subscription, interval, startWith, pairwise, debounceTime, takeUntil, timer, Observable, merge } from 'rxjs';
19
+ import { catchError, throwError, BehaviorSubject, firstValueFrom, of, switchMap as switchMap$1, shareReplay, finalize, map, forkJoin, take, Subject, Subscription, interval, startWith, pairwise, takeUntil, from, timer, Observable, merge } from 'rxjs';
20
20
  import * as i1$1 from '@angular/common/http';
21
21
  import { HttpHeaders, HttpParams, provideHttpClient, HTTP_INTERCEPTORS, withInterceptorsFromDi } from '@angular/common/http';
22
22
  import { tap, switchMap, catchError as catchError$1, map as map$1, takeWhile, finalize as finalize$1 } from 'rxjs/operators';
@@ -2664,6 +2664,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
2664
2664
  }]
2665
2665
  }], ctorParameters: () => [{ type: TranslatePipe }] });
2666
2666
 
2667
+ class NotificationConfig {
2668
+ constructor() {
2669
+ this.enabled = false;
2670
+ this.titleTemplate = 'Status update: {statusName}';
2671
+ this.messageTemplate = 'Your application status has been updated to: {statusName}';
2672
+ }
2673
+ }
2674
+ class InheritedField {
2675
+ constructor() {
2676
+ this.id = '';
2677
+ this.fieldName = '';
2678
+ }
2679
+ }
2680
+ class ParentChildConfig {
2681
+ constructor() {
2682
+ this.parentApplicationUuid = null;
2683
+ this.inheritedFields = [];
2684
+ this.notificationConfig = new NotificationConfig();
2685
+ }
2686
+ }
2667
2687
  class FormModel {
2668
2688
  }
2669
2689
  class AppDataControl {
@@ -2689,7 +2709,7 @@ class AppDataStep {
2689
2709
  }
2690
2710
  }
2691
2711
  class AppDataFill {
2692
- constructor(appDataId = '', configurationId = '', currentStepId = '', statusId = '', language = '', flux = [], offerId = '', isSubmitted = false) {
2712
+ constructor(appDataId = '', configurationId = '', currentStepId = '', statusId = '', language = '', flux = [], offerId = '', isSubmitted = false, parentAppDataUuid = '') {
2693
2713
  this.metadata = {
2694
2714
  appDataId: appDataId || '',
2695
2715
  configurationId: configurationId || '',
@@ -2698,18 +2718,20 @@ class AppDataFill {
2698
2718
  language: language || '',
2699
2719
  offerId: offerId || '',
2700
2720
  isSubmitted: isSubmitted || false,
2721
+ parentAppDataUuid: parentAppDataUuid || ''
2701
2722
  };
2702
2723
  this.flux = flux || [];
2703
2724
  }
2704
2725
  }
2705
2726
  class AppData {
2706
2727
  constructor(data) {
2707
- (this.id = data.id ?? undefined), (this.appDataId = data.appDataId || '');
2728
+ ((this.id = data.id ?? undefined), (this.appDataId = data.appDataId || ''));
2708
2729
  this.appConfigurationId = data.appConfigurationId || 0;
2709
2730
  this.fillData = data.fillData;
2710
2731
  this.initFlowValues = data.initFlowValues;
2711
2732
  this.withNextStep = data.withNextStep;
2712
2733
  this.blockPreviousStep = data.blockPreviousStep;
2734
+ this.parentAppDataUuid = data.parentAppDataUuid;
2713
2735
  if (!data.env) {
2714
2736
  this.env = 'Config';
2715
2737
  }
@@ -2723,7 +2745,8 @@ class FormModelExtenxions {
2723
2745
  this.formModel = model;
2724
2746
  }
2725
2747
  addInitFlowValuesItems(items) {
2726
- const initFlowValuesRaw = this.formModel?.generalData?.initFlowValues;
2748
+ const initFlowValuesRaw = this.formModel?.generalData
2749
+ ?.initFlowValues;
2727
2750
  if (initFlowValuesRaw === null || initFlowValuesRaw === undefined) {
2728
2751
  return;
2729
2752
  }
@@ -2776,7 +2799,7 @@ class FormModelExtenxions {
2776
2799
  return {
2777
2800
  fieldName: `initFlowValues_${underscorePath}`,
2778
2801
  fieldType: StepControlType.Metadata,
2779
- id: `initFlowValues_${underscorePath}`,
2802
+ id: `initFlowValues_${underscorePath}`
2780
2803
  };
2781
2804
  }
2782
2805
  fluxItems(untilStepIdentifier = undefined) {
@@ -2786,7 +2809,7 @@ class FormModelExtenxions {
2786
2809
  items.push({
2787
2810
  fieldName: fieldValue,
2788
2811
  fieldType: StepControlType.Metadata,
2789
- id: `metadata.${fieldValue}`,
2812
+ id: `metadata.${fieldValue}`
2790
2813
  });
2791
2814
  });
2792
2815
  }
@@ -2814,13 +2837,13 @@ class FormModelExtenxions {
2814
2837
  StepControlType.Buttons,
2815
2838
  StepControlType.NewRow,
2816
2839
  StepControlType.FluxInfo,
2817
- StepControlType.Paragraph,
2840
+ StepControlType.Paragraph
2818
2841
  ].includes(control.type) == false) {
2819
2842
  items.push({
2820
2843
  fieldName: `${step.name} -> ${section.title} -> ${control.title}`,
2821
2844
  fieldType: control.type,
2822
2845
  manulInputControlType: control.specificControlData?.type,
2823
- id: control.identifier,
2846
+ id: control.identifier
2824
2847
  });
2825
2848
  }
2826
2849
  });
@@ -2840,7 +2863,7 @@ class FormModelExtenxions {
2840
2863
  fieldType: step.type,
2841
2864
  id: document?.documentId
2842
2865
  ? `upload.${document.documentId}`
2843
- : `${step.type}.${step.name}`,
2866
+ : `${step.type}.${step.name}`
2844
2867
  });
2845
2868
  });
2846
2869
  }
@@ -2852,7 +2875,7 @@ class FormModelExtenxions {
2852
2875
  fieldType: step.type,
2853
2876
  id: document?.id
2854
2877
  ? `generate.${document.id}`
2855
- : `${step.type}.${step.name}`,
2878
+ : `${step.type}.${step.name}`
2856
2879
  });
2857
2880
  });
2858
2881
  }
@@ -2864,7 +2887,7 @@ class FormModelExtenxions {
2864
2887
  fieldType: step.type,
2865
2888
  id: document?.id
2866
2889
  ? `sign.${document.id}`
2867
- : `${step.type}.${step.name}`,
2890
+ : `${step.type}.${step.name}`
2868
2891
  });
2869
2892
  });
2870
2893
  }
@@ -2875,7 +2898,7 @@ class FormModelExtenxions {
2875
2898
  fieldType: step.type,
2876
2899
  id: document?.id
2877
2900
  ? `system.${document.id}`
2878
- : `${step.type}.${step.name}`,
2901
+ : `${step.type}.${step.name}`
2879
2902
  });
2880
2903
  });
2881
2904
  }
@@ -2891,7 +2914,7 @@ class FormModelExtenxions {
2891
2914
  items.push({
2892
2915
  fieldName: `${apiMethod.method} -> ${f.fieldName}`,
2893
2916
  fieldType: StepControlType.ApiMethodField,
2894
- id: f.id,
2917
+ id: f.id
2895
2918
  });
2896
2919
  });
2897
2920
  }
@@ -2910,7 +2933,7 @@ class FormModelExtenxions {
2910
2933
  const allApiItems = [
2911
2934
  ...this.formModel.api.getItems,
2912
2935
  ...this.formModel.api.validationItems,
2913
- ...this.formModel.api.sendItems,
2936
+ ...this.formModel.api.sendItems
2914
2937
  ];
2915
2938
  offerMethodsIds.forEach((methodId) => {
2916
2939
  const apiMethod = allApiItems.find((item) => item.id === methodId);
@@ -2919,7 +2942,7 @@ class FormModelExtenxions {
2919
2942
  items.push({
2920
2943
  fieldName: `${apiMethod.method} -> ${f.fieldName}`,
2921
2944
  fieldType: FluxType.ViewOffer,
2922
- id: `api_${apiMethod.id} -> ${f.id}`,
2945
+ id: `api_${apiMethod.id} -> ${f.id}`
2923
2946
  });
2924
2947
  });
2925
2948
  }
@@ -3076,7 +3099,7 @@ const initialFormulareState = {
3076
3099
  showNameStep: false,
3077
3100
  showAllSteps: false,
3078
3101
  showProgressBar: false,
3079
- initFlowValues: '',
3102
+ initFlowValues: ''
3080
3103
  },
3081
3104
  design: {
3082
3105
  fonts: [],
@@ -3092,7 +3115,7 @@ const initialFormulareState = {
3092
3115
  marginLeft: '',
3093
3116
  marginRight: '',
3094
3117
  marginTop: '',
3095
- marginBottom: '',
3118
+ marginBottom: ''
3096
3119
  },
3097
3120
  flux: [],
3098
3121
  api: { getItems: [], validationItems: [], sendItems: [] },
@@ -3100,15 +3123,16 @@ const initialFormulareState = {
3100
3123
  documents: [],
3101
3124
  statuses: [],
3102
3125
  display: {
3103
- sections: [],
3126
+ sections: []
3104
3127
  },
3105
3128
  generatedCss: {},
3106
3129
  metadataFields: [],
3107
3130
  errors: {},
3108
3131
  applicationMappings: {
3109
3132
  applicationTypeId: 0,
3110
- columnMappings: [],
3133
+ columnMappings: []
3111
3134
  },
3135
+ parentChildConfig: undefined
3112
3136
  },
3113
3137
  selectedTab: 'Date generale',
3114
3138
  canGetFromProd: false,
@@ -3116,7 +3140,7 @@ const initialFormulareState = {
3116
3140
  canPublishInProd: false,
3117
3141
  canPublishInTest: false,
3118
3142
  applicationUuid: '',
3119
- version: '',
3143
+ version: ''
3120
3144
  };
3121
3145
  class PartnerDictionaryMapping {
3122
3146
  }
@@ -3151,6 +3175,8 @@ class FieldsMapping {
3151
3175
  class MethodField {
3152
3176
  constructor() {
3153
3177
  this.manulInputControlType = undefined;
3178
+ this.fieldValue = undefined;
3179
+ this.expectedValue = undefined;
3154
3180
  }
3155
3181
  }
3156
3182
  class GetMethodField {
@@ -3230,14 +3256,16 @@ var ApiMethodType;
3230
3256
  ApiMethodType[ApiMethodType["Validation"] = 2] = "Validation";
3231
3257
  })(ApiMethodType || (ApiMethodType = {}));
3232
3258
  class StatusModel {
3233
- constructor(id, denumire, ordine, final, isActive, actions) {
3259
+ constructor(id, denumire, ordine, final, isActive, actions, childApplicationUuids = []) {
3234
3260
  this.actions = [];
3261
+ this.childApplicationUuids = [];
3235
3262
  this.id = id;
3236
3263
  this.name = denumire;
3237
3264
  this.order = ordine;
3238
3265
  this.final = final;
3239
3266
  this.isActive = isActive;
3240
3267
  this.actions = actions;
3268
+ this.childApplicationUuids = childApplicationUuids || [];
3241
3269
  }
3242
3270
  }
3243
3271
  class StatusAction {
@@ -5144,7 +5172,7 @@ class ApplicationDataService {
5144
5172
  const payload = {
5145
5173
  ...appData,
5146
5174
  initFlowValues: appData.initFlowValues,
5147
- fillData: appData.fillData ? JSON.stringify(appData.fillData) : undefined,
5175
+ fillData: appData.fillData ? JSON.stringify(appData.fillData) : undefined
5148
5176
  };
5149
5177
  return this.http.post(saveUrl, payload);
5150
5178
  }
@@ -5155,7 +5183,7 @@ class ApplicationDataService {
5155
5183
  appDataId: appDataId,
5156
5184
  stepData: JSON.stringify(currentStep),
5157
5185
  withNextStep: true,
5158
- selectedOfferId: selectedOfferId,
5186
+ selectedOfferId: selectedOfferId
5159
5187
  };
5160
5188
  return this.http.post(saveUrl, payload);
5161
5189
  }
@@ -5165,9 +5193,16 @@ class ApplicationDataService {
5165
5193
  appDataId;
5166
5194
  return this.http.get(getUrl);
5167
5195
  }
5168
- validateApi(apiValidateRequest) {
5196
+ async validateApi(apiValidateRequest) {
5169
5197
  const url = this.configService.readConfig().baseUrlBusiness + '/ApiRequest/dorequest';
5170
- return this.http.post(url, apiValidateRequest);
5198
+ try {
5199
+ const response = await firstValueFrom(this.http.post(url, apiValidateRequest));
5200
+ return response === true;
5201
+ }
5202
+ catch (error) {
5203
+ console.warn('API validation request failed', error);
5204
+ return false;
5205
+ }
5171
5206
  }
5172
5207
  doDocumentRequest(apiValidateRequest) {
5173
5208
  const url = this.configService.readConfig().baseUrlBusiness +
@@ -5186,7 +5221,7 @@ class ApplicationDataService {
5186
5221
  makeProcessApiCall(appDataID) {
5187
5222
  const url = this.configService.readConfig().baseUrlInfrastructure + '/Process';
5188
5223
  return this.http.post(url, { appId: appDataID }).pipe(map((response) => {
5189
- console.log('response from makeProcessApiCall', response), response;
5224
+ (console.log('response from makeProcessApiCall', response), response);
5190
5225
  }), catchError((error) => of({ ...error, body: false })));
5191
5226
  }
5192
5227
  getProcessStatus(appDataID) {
@@ -5206,7 +5241,7 @@ class ApplicationDataService {
5206
5241
  return this.http.post(url, {
5207
5242
  appDataId: appDataId,
5208
5243
  stepId: stepId,
5209
- setNextStep: setNextStep,
5244
+ setNextStep: setNextStep
5210
5245
  });
5211
5246
  }
5212
5247
  async setCurrentStep(appDataId, stepId) {
@@ -5234,7 +5269,7 @@ class ApplicationDataService {
5234
5269
  '/appdata/changeLanguage';
5235
5270
  const payload = {
5236
5271
  appDataId: appDataUuid,
5237
- languageIso: languageISOCode,
5272
+ languageIso: languageISOCode
5238
5273
  };
5239
5274
  return this.http.post(url, payload);
5240
5275
  }
@@ -5451,7 +5486,31 @@ class ModelPopulationHelper {
5451
5486
  if (controlDefinition.type === StepControlType.Dictionary) {
5452
5487
  const specificData = controlDefinition.specificControlData;
5453
5488
  const isRadio = specificData.showAsRadioButtonsList === true;
5454
- if (filledValueId !== null) {
5489
+ // Check for multi-select values first
5490
+ const fillValueIds = filledControlData.fillValueIds;
5491
+ if (specificData.allowMultipleSelection &&
5492
+ fillValueIds &&
5493
+ Array.isArray(fillValueIds) &&
5494
+ fillValueIds.length > 0) {
5495
+ const dictionary = dictionaryMap.get(specificData.dictionaryUUID);
5496
+ const mappedValues = [];
5497
+ for (const valueId of fillValueIds) {
5498
+ const numericId = typeof valueId === 'string'
5499
+ ? parseInt(valueId, 10)
5500
+ : valueId;
5501
+ const valueDto = dictionary?.values?.find((v) => v.id === numericId);
5502
+ if (valueDto) {
5503
+ const mapped = ModelPopulationHelper.mapDictionaryValueDto(valueDto, availableLanguages);
5504
+ if (mapped) {
5505
+ mappedValues.push(mapped);
5506
+ }
5507
+ }
5508
+ }
5509
+ if (mappedValues.length > 0) {
5510
+ valueFromFillData = mappedValues;
5511
+ }
5512
+ }
5513
+ else if (filledValueId !== null) {
5455
5514
  if (isRadio) {
5456
5515
  valueFromFillData = filledValueId;
5457
5516
  }
@@ -5486,8 +5545,9 @@ class ModelPopulationHelper {
5486
5545
  }
5487
5546
  }
5488
5547
  }
5489
- // Handle reference values
5548
+ // Handle reference values (only for single-select)
5490
5549
  if (valueFromFillData &&
5550
+ !Array.isArray(valueFromFillData) &&
5491
5551
  dictionaryMap.has(specificData.dictionaryUUID)) {
5492
5552
  const mainDictionary = dictionaryMap.get(specificData.dictionaryUUID);
5493
5553
  if (mainDictionary?.id) {
@@ -5571,6 +5631,93 @@ class ModelPopulationHelper {
5571
5631
  }
5572
5632
  }
5573
5633
  }
5634
+ // Fallback: apply inherited fields for controls not populated from flux
5635
+ if (fillData.inheritedFields) {
5636
+ for (const step of flux) {
5637
+ if (!step.sections)
5638
+ continue;
5639
+ for (const section of step.sections) {
5640
+ if (!section.controls)
5641
+ continue;
5642
+ for (const controlDef of section.controls) {
5643
+ const controlId = controlDef.identifier;
5644
+ if (!controlId || model[controlId] !== undefined)
5645
+ continue;
5646
+ const inheritedValue = fillData.inheritedFields[controlId];
5647
+ if (inheritedValue === undefined || inheritedValue === null)
5648
+ continue;
5649
+ if (controlDef.type === StepControlType.Dictionary) {
5650
+ const specificData = controlDef.specificControlData;
5651
+ const isRadio = specificData.showAsRadioButtonsList === true;
5652
+ // Enriched format: { fillValue, fillValueId, fillValueIds, dictionaryUUID }
5653
+ if (typeof inheritedValue === 'object' &&
5654
+ !Array.isArray(inheritedValue) &&
5655
+ inheritedValue.dictionaryUUID) {
5656
+ const dictionary = dictionaryMap.get(specificData.dictionaryUUID);
5657
+ // Multi-select
5658
+ if (specificData.allowMultipleSelection &&
5659
+ inheritedValue.fillValueIds &&
5660
+ Array.isArray(inheritedValue.fillValueIds) &&
5661
+ inheritedValue.fillValueIds.length > 0) {
5662
+ const mappedValues = [];
5663
+ for (const valueId of inheritedValue.fillValueIds) {
5664
+ const numericId = typeof valueId === 'string'
5665
+ ? parseInt(valueId, 10)
5666
+ : valueId;
5667
+ const valueDto = dictionary?.values?.find((v) => v.id === numericId);
5668
+ if (valueDto) {
5669
+ const mapped = ModelPopulationHelper.mapDictionaryValueDto(valueDto, availableLanguages);
5670
+ if (mapped) {
5671
+ mappedValues.push(mapped);
5672
+ }
5673
+ }
5674
+ }
5675
+ if (mappedValues.length > 0) {
5676
+ model[controlId] = mappedValues;
5677
+ }
5678
+ }
5679
+ else if (inheritedValue.fillValueId !== undefined && inheritedValue.fillValueId !== null) {
5680
+ // Single-select
5681
+ const parsedId = parseInt(String(inheritedValue.fillValueId), 10);
5682
+ if (!isNaN(parsedId)) {
5683
+ if (isRadio) {
5684
+ model[controlId] = parsedId;
5685
+ }
5686
+ else {
5687
+ const valueDto = dictionary?.values?.find((v) => v.id === parsedId);
5688
+ if (valueDto) {
5689
+ model[controlId] =
5690
+ ModelPopulationHelper.mapDictionaryValueDto(valueDto, availableLanguages);
5691
+ }
5692
+ }
5693
+ }
5694
+ }
5695
+ }
5696
+ else {
5697
+ // Backward compatible: simple value (old format)
5698
+ const parsedId = parseInt(String(inheritedValue), 10);
5699
+ if (!isNaN(parsedId)) {
5700
+ if (isRadio) {
5701
+ model[controlId] = parsedId;
5702
+ }
5703
+ else {
5704
+ const dictionary = dictionaryMap.get(specificData.dictionaryUUID);
5705
+ const valueDto = dictionary?.values?.find((v) => v.id === parsedId);
5706
+ if (valueDto) {
5707
+ model[controlId] =
5708
+ ModelPopulationHelper.mapDictionaryValueDto(valueDto, availableLanguages);
5709
+ }
5710
+ }
5711
+ }
5712
+ }
5713
+ }
5714
+ else {
5715
+ model[controlId] = inheritedValue;
5716
+ }
5717
+ }
5718
+ }
5719
+ }
5720
+ }
5574
5721
  // Apply precompletion for ManualInput controls
5575
5722
  ModelPopulationHelper.applyPrecompletionToModel(model, flux);
5576
5723
  return model;
@@ -6483,6 +6630,22 @@ class ActionStepHandler {
6483
6630
  }
6484
6631
  return visibleSteps;
6485
6632
  }
6633
+ /**
6634
+ * Gets action steps that appear before the first visible step in the flux.
6635
+ * These need to be executed on form initialization.
6636
+ */
6637
+ getActionStepsBeforeFirstVisibleStep(allSteps) {
6638
+ const actionSteps = [];
6639
+ for (const step of allSteps) {
6640
+ if (this.isActionStep(step)) {
6641
+ actionSteps.push(step);
6642
+ }
6643
+ else {
6644
+ break;
6645
+ }
6646
+ }
6647
+ return actionSteps;
6648
+ }
6486
6649
  /**
6487
6650
  * Gets action steps that should be executed when moving to the next step
6488
6651
  */
@@ -7031,33 +7194,33 @@ class CollectorFormComponent {
7031
7194
  language: 'English',
7032
7195
  code: 'en',
7033
7196
  type: 'US',
7034
- icon: FLAG_ICONS.en,
7197
+ icon: FLAG_ICONS.en
7035
7198
  },
7036
7199
  {
7037
7200
  language: 'Romana',
7038
7201
  code: 'ro',
7039
- icon: FLAG_ICONS.ro,
7202
+ icon: FLAG_ICONS.ro
7040
7203
  },
7041
7204
  {
7042
7205
  language: 'Deutsch',
7043
7206
  code: 'de',
7044
- icon: FLAG_ICONS.de,
7207
+ icon: FLAG_ICONS.de
7045
7208
  },
7046
7209
  {
7047
7210
  language: 'Français',
7048
7211
  code: 'fr',
7049
- icon: FLAG_ICONS.fr,
7212
+ icon: FLAG_ICONS.fr
7050
7213
  },
7051
7214
  {
7052
7215
  language: 'Italiano',
7053
7216
  code: 'it',
7054
- icon: FLAG_ICONS.it,
7217
+ icon: FLAG_ICONS.it
7055
7218
  },
7056
7219
  {
7057
7220
  language: 'Español',
7058
7221
  code: 'es',
7059
- icon: FLAG_ICONS.es,
7060
- },
7222
+ icon: FLAG_ICONS.es
7223
+ }
7061
7224
  ];
7062
7225
  this._self = this;
7063
7226
  this.loadingMessage = null;
@@ -7138,6 +7301,8 @@ class CollectorFormComponent {
7138
7301
  }
7139
7302
  if (this.appModel) {
7140
7303
  await this.initAsync();
7304
+ // Execute any action/status steps that appear before the first visible step
7305
+ await this.executeLeadingActionSteps();
7141
7306
  }
7142
7307
  }
7143
7308
  async ngOnChanges(changes) {
@@ -7176,6 +7341,8 @@ class CollectorFormComponent {
7176
7341
  }
7177
7342
  }
7178
7343
  await this.initAsync();
7344
+ // Execute any action/status steps that appear before the first visible step
7345
+ await this.executeLeadingActionSteps();
7179
7346
  }
7180
7347
  catch (error) {
7181
7348
  }
@@ -7243,7 +7410,8 @@ class CollectorFormComponent {
7243
7410
  this.formlyPresentationFields = [];
7244
7411
  this.model = {};
7245
7412
  this.form = new FormGroup({});
7246
- if (this.fillData) {
7413
+ // Populate control IDs with values if fillData or initFlowValues exist
7414
+ if (this.fillData || this.initFlowValues) {
7247
7415
  this.populateControlIdsWithValueDictionary();
7248
7416
  }
7249
7417
  // Initialize model with default values if no fillData
@@ -7252,7 +7420,6 @@ class CollectorFormComponent {
7252
7420
  }
7253
7421
  else {
7254
7422
  this.populateModelWithFillData(this.fillData);
7255
- this.populateControlIdsWithValueDictionary();
7256
7423
  }
7257
7424
  this.form.patchValue(this.model);
7258
7425
  await this.buildFormlyConfigAsync();
@@ -7318,33 +7485,49 @@ class CollectorFormComponent {
7318
7485
  }
7319
7486
  populateControlIdsWithValueDictionary() {
7320
7487
  var currentLanguageId = this.getCurrentLanguageId();
7321
- const controlIdsWithValues = this.fillData.flux
7322
- .flatMap((step) => step.sections.flatMap((section) => section.controls
7323
- .filter((control) => control.controlId && control.fillValue)
7324
- .map((control) => ({
7325
- controlId: control.controlId,
7326
- fillValue: control.fillValue,
7327
- fillValueId: control.fillValueId,
7328
- }))))
7329
- .reduce((dictionary, { controlId, fillValue, fillValueId }) => {
7330
- if (fillValueId) {
7331
- for (const [key, dict] of this.dictionaryMap.entries()) {
7332
- const value = dict.values?.find((v) => v.id == fillValueId);
7333
- if (value) {
7334
- const translation = value.valueTranslations.find((t) => t.languageId == currentLanguageId);
7335
- if (translation) {
7336
- dictionary[controlId] = translation.value;
7337
- break;
7488
+ // Build dictionary from fillData.flux if available, otherwise start empty
7489
+ const controlIdsWithValues = this.fillData?.flux
7490
+ ? this.fillData.flux
7491
+ .flatMap((step) => step.sections.flatMap((section) => section.controls
7492
+ .filter((control) => control.controlId && control.fillValue)
7493
+ .map((control) => ({
7494
+ controlId: control.controlId,
7495
+ fillValue: control.fillValue,
7496
+ fillValueId: control.fillValueId
7497
+ }))))
7498
+ .reduce((dictionary, { controlId, fillValue, fillValueId }) => {
7499
+ if (fillValueId) {
7500
+ for (const [key, dict] of this.dictionaryMap.entries()) {
7501
+ const value = dict.values?.find((v) => v.id == fillValueId);
7502
+ if (value) {
7503
+ const translation = value.valueTranslations.find((t) => t.languageId == currentLanguageId);
7504
+ if (translation) {
7505
+ dictionary[controlId] = translation.value;
7506
+ break;
7507
+ }
7338
7508
  }
7339
7509
  }
7340
7510
  }
7511
+ else {
7512
+ dictionary[controlId] = fillValue;
7513
+ }
7514
+ return dictionary;
7515
+ }, {})
7516
+ : {};
7517
+ // Get initFlowValues from fillData or from direct input (this.initFlowValues)
7518
+ let initFlowValues = this.fillData?.initFlowValues;
7519
+ // If not in fillData, try to parse from direct initFlowValues input
7520
+ if (!initFlowValues && this.initFlowValues) {
7521
+ try {
7522
+ initFlowValues =
7523
+ typeof this.initFlowValues === 'string'
7524
+ ? JSON.parse(this.initFlowValues)
7525
+ : this.initFlowValues;
7341
7526
  }
7342
- else {
7343
- dictionary[controlId] = fillValue;
7527
+ catch (e) {
7528
+ console.warn('Failed to parse initFlowValues:', e);
7344
7529
  }
7345
- return dictionary;
7346
- }, {});
7347
- const initFlowValues = this.fillData?.initFlowValues;
7530
+ }
7348
7531
  const addInitFlowValues = (node, pathParts) => {
7349
7532
  if (node === null || node === undefined) {
7350
7533
  if (pathParts.length > 0) {
@@ -7368,6 +7551,51 @@ class CollectorFormComponent {
7368
7551
  if (initFlowValues !== null && initFlowValues !== undefined) {
7369
7552
  addInitFlowValues(initFlowValues, []);
7370
7553
  }
7554
+ // Add inherited fields from parent app
7555
+ const inheritedFields = this.fillData?.inheritedFields;
7556
+ if (inheritedFields && typeof inheritedFields === 'object') {
7557
+ for (const [key, value] of Object.entries(inheritedFields)) {
7558
+ let resolvedValue;
7559
+ if (typeof value === 'object' &&
7560
+ value !== null &&
7561
+ !Array.isArray(value) &&
7562
+ value.dictionaryUUID) {
7563
+ // Enriched format: handle multi-select and single-select
7564
+ const enriched = value;
7565
+ const fillValueIds = enriched.fillValueIds;
7566
+ if (Array.isArray(fillValueIds) && fillValueIds.length > 0) {
7567
+ // Multi-select: look up each ID in dictionaryMap for translated display
7568
+ const currentLanguageId = this.getCurrentLanguageId();
7569
+ const displayValues = [];
7570
+ for (const valueId of fillValueIds) {
7571
+ const numericId = typeof valueId === 'string' ? parseInt(valueId, 10) : valueId;
7572
+ for (const [, dict] of this.dictionaryMap.entries()) {
7573
+ const dv = dict.values?.find((v) => v.id === numericId);
7574
+ if (dv) {
7575
+ const translation = dv.valueTranslations?.find((t) => t.languageId == currentLanguageId);
7576
+ displayValues.push(translation?.value || dv.name);
7577
+ break;
7578
+ }
7579
+ }
7580
+ }
7581
+ resolvedValue = displayValues.length > 0
7582
+ ? displayValues.join(', ')
7583
+ : (enriched.fillValue ?? String(value));
7584
+ }
7585
+ else {
7586
+ // Single-select
7587
+ resolvedValue = enriched.fillValue ?? String(value);
7588
+ }
7589
+ }
7590
+ else {
7591
+ resolvedValue = value;
7592
+ }
7593
+ controlIdsWithValues[`inherited_${key}`] = resolvedValue;
7594
+ if (controlIdsWithValues[key] === undefined) {
7595
+ controlIdsWithValues[key] = resolvedValue;
7596
+ }
7597
+ }
7598
+ }
7371
7599
  this.controlIdsWithValues = controlIdsWithValues;
7372
7600
  }
7373
7601
  getCurrentLanguageId() {
@@ -7386,7 +7614,7 @@ class CollectorFormComponent {
7386
7614
  showProgressBar: this.generalData.showProgressBar &&
7387
7615
  this.generalData.showAllSteps == false
7388
7616
  ? true
7389
- : false,
7617
+ : false
7390
7618
  };
7391
7619
  this.formlyAllSteps = await this.buildFormlyFieldGroupAsync();
7392
7620
  var hasDictionaryDependentSteps = this.formlyAllSteps.some((f) => f.props?.['dependentDictionary']?.isDictionaryDependent);
@@ -7413,7 +7641,7 @@ class CollectorFormComponent {
7413
7641
  display: this.display,
7414
7642
  designConfig: {
7415
7643
  buttonsVerticalPosition: this.appModel.design.buttonsVerticalPosition,
7416
- buttonsHorizontalPosition: this.appModel.design.buttonsHorizontalPosition,
7644
+ buttonsHorizontalPosition: this.appModel.design.buttonsHorizontalPosition
7417
7645
  },
7418
7646
  stepsSettings: this.stepsSettings,
7419
7647
  metaData: this.fillData?.metadata,
@@ -7426,10 +7654,10 @@ class CollectorFormComponent {
7426
7654
  hasActionSteps: this.flux.some((step) => this.actionStepHandler.isActionStep(step)), // Indicate if there are action steps
7427
7655
  completionEvent: () => this.onCompletion(),
7428
7656
  onSelectedPageChanging: (index) => this.onSelectedPageChanging(index),
7429
- onSelectedPageChanged: (index) => this.onSelectedPageChanged(index),
7657
+ onSelectedPageChanged: (index) => this.onSelectedPageChanged(index)
7430
7658
  },
7431
- fieldGroup: formlyFilteredSteps,
7432
- },
7659
+ fieldGroup: formlyFilteredSteps
7660
+ }
7433
7661
  ];
7434
7662
  // For display mode, populate values immediately after config is built
7435
7663
  if (this.showDisplayMode && this.formlyConfig[0]?.fieldGroup) {
@@ -7454,7 +7682,8 @@ class CollectorFormComponent {
7454
7682
  let actionsExecuted = false;
7455
7683
  if (toIndex > fromIndex) {
7456
7684
  console.log('➡️ Moving forward - executing action steps after current step');
7457
- actionsExecuted = await this.executeActionStepsAfterCurrentStep(fromIndex);
7685
+ actionsExecuted =
7686
+ await this.executeActionStepsAfterCurrentStep(fromIndex);
7458
7687
  }
7459
7688
  else if (toIndex < fromIndex) {
7460
7689
  console.log('⬅️ Moving backward - no action execution needed');
@@ -7523,6 +7752,35 @@ class CollectorFormComponent {
7523
7752
  return false;
7524
7753
  }
7525
7754
  }
7755
+ async executeLeadingActionSteps() {
7756
+ if (!this.appDataUuid || !this.flux || this.flux.length === 0) {
7757
+ return;
7758
+ }
7759
+ const leadingActionSteps = this.actionStepHandler.getActionStepsBeforeFirstVisibleStep(this.flux);
7760
+ if (leadingActionSteps.length === 0) {
7761
+ return;
7762
+ }
7763
+ console.log(`🎬 Executing ${leadingActionSteps.length} leading action steps before first visible step`);
7764
+ this.isLoading = true;
7765
+ try {
7766
+ const result = await this.actionStepHandler.executeActionSteps(leadingActionSteps, this.appDataUuid, (step) => {
7767
+ const loadingMessage = Utils.findTranslationInfo('loadingMessageTranslations', step.translations, this.currentLanguageIso);
7768
+ this.loadingMessage = loadingMessage || null;
7769
+ });
7770
+ if (result.success) {
7771
+ console.log('✅ Leading action steps executed successfully');
7772
+ }
7773
+ else {
7774
+ console.error('❌ Leading action steps failed:', result.error);
7775
+ }
7776
+ }
7777
+ catch (error) {
7778
+ console.error('❌ Error executing leading action steps:', error);
7779
+ }
7780
+ finally {
7781
+ this.loadingMessage = null;
7782
+ }
7783
+ }
7526
7784
  onSelectedPageChanged(index) {
7527
7785
  if (this.formlyConfig[0].fieldGroup) {
7528
7786
  var selectedPage = this.formlyConfig[0].fieldGroup[index];
@@ -7547,11 +7805,15 @@ class CollectorFormComponent {
7547
7805
  // Multiple selection - show values with comma
7548
7806
  const valueIdsArray = found.fillValueIds || found.fillvalueids || found.FillValueIds;
7549
7807
  const valuesArray = found.fillValues || found.fillvalues || found.FillValues;
7550
- if (valueIdsArray && Array.isArray(valueIdsArray) && valueIdsArray.length > 0) {
7808
+ if (valueIdsArray &&
7809
+ Array.isArray(valueIdsArray) &&
7810
+ valueIdsArray.length > 0) {
7551
7811
  const currentLanguageId = this.getCurrentLanguageId();
7552
7812
  const displayValues = [];
7553
7813
  for (const valueId of valueIdsArray) {
7554
- const numericValueId = typeof valueId === 'string' ? parseInt(valueId, 10) : valueId;
7814
+ const numericValueId = typeof valueId === 'string'
7815
+ ? parseInt(valueId, 10)
7816
+ : valueId;
7555
7817
  for (const [key, dict] of this.dictionaryMap.entries()) {
7556
7818
  const value = dict.values?.find((v) => v.id === numericValueId);
7557
7819
  if (value) {
@@ -7565,7 +7827,9 @@ class CollectorFormComponent {
7565
7827
  fg.defaultValue = displayValues.join(', ');
7566
7828
  }
7567
7829
  }
7568
- else if (valuesArray && Array.isArray(valuesArray) && valuesArray.length > 0) {
7830
+ else if (valuesArray &&
7831
+ Array.isArray(valuesArray) &&
7832
+ valuesArray.length > 0) {
7569
7833
  // Fallback: use fillValues array directly
7570
7834
  fg.defaultValue = valuesArray.join(', ');
7571
7835
  }
@@ -7587,8 +7851,20 @@ class CollectorFormComponent {
7587
7851
  }
7588
7852
  }
7589
7853
  else {
7590
- const val = this.findInApiCallsResponses(associatedControlId);
7591
- fg.defaultValue = val;
7854
+ // Check controlIdsWithValues for initFlowValues
7855
+ let initFlowValue = this.controlIdsWithValues?.[associatedControlId];
7856
+ if (initFlowValue !== undefined) {
7857
+ if (typeof initFlowValue === 'object' &&
7858
+ initFlowValue !== null &&
7859
+ initFlowValue.fillValue !== undefined) {
7860
+ initFlowValue = initFlowValue.fillValue;
7861
+ }
7862
+ fg.defaultValue = initFlowValue;
7863
+ }
7864
+ else {
7865
+ const val = this.findInApiCallsResponses(associatedControlId);
7866
+ fg.defaultValue = val;
7867
+ }
7592
7868
  }
7593
7869
  }
7594
7870
  }
@@ -7685,9 +7961,9 @@ class CollectorFormComponent {
7685
7961
  description: step.name,
7686
7962
  buttons: this.constructButtons(step.buttons),
7687
7963
  dependentDictionary: step.dependentDictionary,
7688
- stepId: step.identifier,
7964
+ stepId: step.identifier
7689
7965
  },
7690
- fieldGroup: await this.buildSectionsFieldGroupAsync(step, step.sections),
7966
+ fieldGroup: await this.buildSectionsFieldGroupAsync(step, step.sections)
7691
7967
  };
7692
7968
  if (step.translations) {
7693
7969
  stepFormlyConfig.props['label'] = Utils.findTranslationInfo('name', step.translations, this.currentLanguageIso);
@@ -7728,9 +8004,9 @@ class CollectorFormComponent {
7728
8004
  props: {
7729
8005
  label: step.name,
7730
8006
  buttons: this.constructButtons(step.buttons),
7731
- fluxType: step.type,
8007
+ fluxType: step.type
7732
8008
  },
7733
- fieldGroup: [],
8009
+ fieldGroup: []
7734
8010
  };
7735
8011
  this.setStepBaseProps(step, formlyConfig);
7736
8012
  var fieldConfig = this.createFormlySystemFieldConfig(step);
@@ -7775,8 +8051,8 @@ class CollectorFormComponent {
7775
8051
  if (event === 'success') {
7776
8052
  await this.stepperGoNextAsync();
7777
8053
  }
7778
- },
7779
- },
8054
+ }
8055
+ }
7780
8056
  };
7781
8057
  }
7782
8058
  CreateDownloadDocsFieldConfig(controlData) {
@@ -7788,8 +8064,8 @@ class CollectorFormComponent {
7788
8064
  controlData: controlData,
7789
8065
  env: this.env,
7790
8066
  documentsData: this.appModel.documents,
7791
- langIso: this.currentLanguageIso,
7792
- },
8067
+ langIso: this.currentLanguageIso
8068
+ }
7793
8069
  };
7794
8070
  }
7795
8071
  CreateViewDocsFieldConfig(controlData) {
@@ -7801,8 +8077,8 @@ class CollectorFormComponent {
7801
8077
  controlData: controlData,
7802
8078
  env: this.env,
7803
8079
  documentsData: this.appModel.documents,
7804
- langIso: this.currentLanguageIso,
7805
- },
8080
+ langIso: this.currentLanguageIso
8081
+ }
7806
8082
  };
7807
8083
  }
7808
8084
  CreateUploadDocsFieldConfig(controlData) {
@@ -7814,8 +8090,8 @@ class CollectorFormComponent {
7814
8090
  controlData: controlData,
7815
8091
  env: this.env,
7816
8092
  documentsData: this.appModel.documents,
7817
- langIso: this.currentLanguageIso,
7818
- },
8093
+ langIso: this.currentLanguageIso
8094
+ }
7819
8095
  };
7820
8096
  }
7821
8097
  CreateGenerateDocsFieldConfig(step) {
@@ -7831,8 +8107,8 @@ class CollectorFormComponent {
7831
8107
  if (event === 'success') {
7832
8108
  await this.stepperGoNextAsync();
7833
8109
  }
7834
- },
7835
- },
8110
+ }
8111
+ }
7836
8112
  };
7837
8113
  }
7838
8114
  async stepperGoNextAsync() {
@@ -7857,8 +8133,8 @@ class CollectorFormComponent {
7857
8133
  dataUrlId: this.dataUrlId,
7858
8134
  stepData: step,
7859
8135
  labels: labels,
7860
- langIso: this.currentLanguageIso,
7861
- },
8136
+ langIso: this.currentLanguageIso
8137
+ }
7862
8138
  };
7863
8139
  }
7864
8140
  CreateIdScanFieldConfig(step) {
@@ -7877,8 +8153,8 @@ class CollectorFormComponent {
7877
8153
  appDataId: this.appDataUuid || Utils.generateUUID(),
7878
8154
  appId: this.appModel.applicationUuid,
7879
8155
  errorMessages: errorMessages,
7880
- event: (event) => this.onIdScanCompleted(event, step),
7881
- },
8156
+ event: (event) => this.onIdScanCompleted(event, step)
8157
+ }
7882
8158
  };
7883
8159
  }
7884
8160
  CreateKycFieldConfig(step) {
@@ -7901,8 +8177,8 @@ class CollectorFormComponent {
7901
8177
  ectCompleted: async () => {
7902
8178
  this.loadingMessage = translatedLoadingMessage;
7903
8179
  await this.originFormSignalrHandlerService.initiateKycProcessing(this.appDataUuid);
7904
- },
7905
- },
8180
+ }
8181
+ }
7906
8182
  };
7907
8183
  }
7908
8184
  CreatePhoneEmailFieldConfig(step) {
@@ -7916,8 +8192,8 @@ class CollectorFormComponent {
7916
8192
  if (event === 'success') {
7917
8193
  await this.stepperGoNextAsync();
7918
8194
  }
7919
- },
7920
- },
8195
+ }
8196
+ }
7921
8197
  };
7922
8198
  }
7923
8199
  CreateViewOfferFieldConfig(step) {
@@ -7929,8 +8205,8 @@ class CollectorFormComponent {
7929
8205
  env: this.env,
7930
8206
  appModel: this.appModel,
7931
8207
  langIso: this.currentLanguageIso,
7932
- event: (event) => this.onOfferSelected(event, step),
7933
- },
8208
+ event: (event) => this.onOfferSelected(event, step)
8209
+ }
7934
8210
  };
7935
8211
  }
7936
8212
  CreatePauseFieldConfig(step) {
@@ -7943,8 +8219,8 @@ class CollectorFormComponent {
7943
8219
  stepData: step,
7944
8220
  env: this.env,
7945
8221
  appModel: this.appModel,
7946
- langIso: this.currentLanguageIso,
7947
- },
8222
+ langIso: this.currentLanguageIso
8223
+ }
7948
8224
  };
7949
8225
  }
7950
8226
  CreateOpenBankingFieldConfig(step) {
@@ -7965,10 +8241,10 @@ class CollectorFormComponent {
7965
8241
  waitingMessage: Utils.findTranslation(step.config?.waitingMessageTranslations || [], this.currentLanguageIso),
7966
8242
  consentErrorMessage: Utils.findTranslation(step.config?.consentErrorMessageTranslations || [], this.currentLanguageIso),
7967
8243
  completionMessage: Utils.findTranslation(step.config?.completionMessageTranslations || [], this.currentLanguageIso),
7968
- retryButtonLabel: Utils.findTranslation(step.config?.retryButtonLabelTranslations || [], this.currentLanguageIso),
8244
+ retryButtonLabel: Utils.findTranslation(step.config?.retryButtonLabelTranslations || [], this.currentLanguageIso)
7969
8245
  },
7970
- event: (event) => this.onOpenBankingEvent(event, step),
7971
- },
8246
+ event: (event) => this.onOpenBankingEvent(event, step)
8247
+ }
7972
8248
  };
7973
8249
  }
7974
8250
  CreateStatusFieldConfig(step) {
@@ -7978,8 +8254,8 @@ class CollectorFormComponent {
7978
8254
  config: step.config,
7979
8255
  stepData: step,
7980
8256
  appDataId: this.appDataUuid,
7981
- appId: this.appModel.applicationUuid,
7982
- },
8257
+ appId: this.appModel.applicationUuid
8258
+ }
7983
8259
  };
7984
8260
  }
7985
8261
  createFormlySystemFieldConfig(step) {
@@ -8053,8 +8329,8 @@ class CollectorFormComponent {
8053
8329
  if (c.controlId) {
8054
8330
  const value = {
8055
8331
  [c.controlId]: {
8056
- value: c.fillValue,
8057
- },
8332
+ value: c.fillValue
8333
+ }
8058
8334
  };
8059
8335
  if (this.form.contains(c.controlId)) {
8060
8336
  this.form.patchValue(value);
@@ -8075,7 +8351,7 @@ class CollectorFormComponent {
8075
8351
  if (formlyStepField) {
8076
8352
  formlyStepField.props = {
8077
8353
  ...formlyStepField.props,
8078
- buttonsDisabled: false,
8354
+ buttonsDisabled: false
8079
8355
  };
8080
8356
  this.updateFormlyConfig();
8081
8357
  this.formlyConfigUpdated.emit();
@@ -8102,8 +8378,8 @@ class CollectorFormComponent {
8102
8378
  type: 'separator',
8103
8379
  props: {
8104
8380
  title: section.translations?.find((t) => t.languageIso === this.currentLanguageIso)?.value ?? '',
8105
- design: this.design,
8106
- },
8381
+ design: this.design
8382
+ }
8107
8383
  };
8108
8384
  }
8109
8385
  if (section.showSectionSeparator) {
@@ -8112,8 +8388,8 @@ class CollectorFormComponent {
8112
8388
  type: 'separator',
8113
8389
  props: {
8114
8390
  ...separatorFormlyConfig.props,
8115
- showSeparator: section.showSectionSeparator,
8116
- },
8391
+ showSeparator: section.showSectionSeparator
8392
+ }
8117
8393
  };
8118
8394
  }
8119
8395
  if (section.dependentDictionary) {
@@ -8125,10 +8401,10 @@ class CollectorFormComponent {
8125
8401
  props: {
8126
8402
  label: section.title,
8127
8403
  description: section.translations?.find((t) => t.languageIso === this.currentLanguageIso)?.value ?? '',
8128
- design: this.design,
8404
+ design: this.design
8129
8405
  },
8130
8406
  fieldGroup: await this.buildControlsFieldGroupAsync(step, section.controls || [], section.presentationControls || []),
8131
- fieldGroupClassName: 'display-flex',
8407
+ fieldGroupClassName: 'display-flex'
8132
8408
  };
8133
8409
  if (section.dependentDictionary) {
8134
8410
  this.attachToDependentDictionaryIfNecessary(section.dependentDictionary, sectionFormlyConfig);
@@ -8146,7 +8422,7 @@ class CollectorFormComponent {
8146
8422
  // buttons: this.constructButtons(step.buttons),
8147
8423
  // dependentDictionary: step.dependentDictionary,
8148
8424
  },
8149
- fieldGroup: await this.buildSectionsFieldGroupAsync(undefined, this.display.sections),
8425
+ fieldGroup: await this.buildSectionsFieldGroupAsync(undefined, this.display.sections)
8150
8426
  };
8151
8427
  }
8152
8428
  return stepFormlyConfig;
@@ -8187,8 +8463,8 @@ class CollectorFormComponent {
8187
8463
  props: {
8188
8464
  label: '',
8189
8465
  disabled: true,
8190
- hide: true,
8191
- },
8466
+ hide: true
8467
+ }
8192
8468
  };
8193
8469
  }
8194
8470
  async buildControlsFieldGroupAsync(step, controls, presentationControls) {
@@ -8312,7 +8588,7 @@ class CollectorFormComponent {
8312
8588
  '.component-checkbox',
8313
8589
  '.component-radio',
8314
8590
  '.component-date',
8315
- '.component-data',
8591
+ '.component-data'
8316
8592
  ];
8317
8593
  let formlyConfig = this.getDefaultFormlyFieldConfig(control, initialType, pattern, componentStyleKey, componentsToExcludeFromStyle);
8318
8594
  //control.specificControlData.type === 3 is email
@@ -8343,7 +8619,7 @@ class CollectorFormComponent {
8343
8619
  case ManualInputControlType.DateTime:
8344
8620
  formlyConfig.type = 'datepicker';
8345
8621
  formlyConfig.props = {
8346
- readonly: true,
8622
+ readonly: true
8347
8623
  };
8348
8624
  componentStyleKey = '.component-date';
8349
8625
  break;
@@ -8438,40 +8714,40 @@ class CollectorFormComponent {
8438
8714
  }
8439
8715
  return true;
8440
8716
  },
8441
- message: emailErrorLabelValue,
8442
- },
8717
+ message: emailErrorLabelValue
8718
+ }
8443
8719
  };
8444
8720
  }
8445
8721
  addApiValidators(formlyConfig, control) {
8446
- formlyConfig.asyncValidators = {
8722
+ const throughApiValidation = Utils.findErrorTranslationValueOrDefault(control.errorsTranslations, this.currentLanguageIso, 'throughApiValidation');
8723
+ formlyConfig.validators = {
8447
8724
  validateThroughApi: {
8448
- expression: (cont) => {
8449
- return (cont.valueChanges.pipe(debounceTime(500), switchMap$1(() => {
8450
- const apiValidationMethod = control.specificControlData.apiValidationMethod;
8451
- const bodyValue = this.appModel.partners
8452
- .flatMap((p) => p.partnerSettings.partnerMethodsApi)
8453
- .find((p) => p.methodId === apiValidationMethod)
8454
- ?.bodyConfiguration.bodyMapFields;
8455
- const fieldMap = bodyValue?.reduce((acc, f) => {
8456
- if (f.fluxFieldId === control.identifier) {
8457
- acc[f.partnerField] = cont.value || '';
8458
- }
8459
- else {
8460
- acc[f.partnerField] = '';
8461
- }
8462
- return acc;
8463
- }, {}) || {};
8464
- const dataRequest = {
8465
- appId: this.appModel.applicationId,
8466
- apiId: apiValidationMethod,
8467
- data: JSON.stringify(fieldMap),
8468
- };
8469
- return this.validateMethodApi(dataRequest).pipe(catchError(() => of(false)));
8470
- })) || 'ssssssssssssssss');
8725
+ expression: async (cont) => {
8726
+ if (!cont.value) {
8727
+ return of(null);
8728
+ }
8729
+ const apiValidationMethod = control.specificControlData.apiValidationMethod;
8730
+ const dataRequest = {
8731
+ appDataId: this.appDataUuid,
8732
+ apiMethodId: apiValidationMethod,
8733
+ controlIdentifier: control.identifier
8734
+ };
8735
+ var response = await this.validateMethodApi(dataRequest);
8736
+ if (response === false) {
8737
+ cont.setErrors({ validateThroughApi: true });
8738
+ return false;
8739
+ }
8740
+ return true;
8471
8741
  },
8472
- message: 'Validation failed.',
8473
- },
8742
+ message: throughApiValidation
8743
+ }
8474
8744
  };
8745
+ if (formlyConfig.validation) {
8746
+ formlyConfig.validation.messages = {
8747
+ ...formlyConfig.validation.messages,
8748
+ validateThroughApi: throughApiValidation
8749
+ };
8750
+ }
8475
8751
  }
8476
8752
  getDefaultFormlyFieldConfig(control, type, pattern, componentStyleKey, componentsToExcludeFromStyle) {
8477
8753
  const currentLanguageId = Utils.findLanguageIdByIso(this.availableLanguages, this.currentLanguageIso);
@@ -8488,16 +8764,16 @@ class CollectorFormComponent {
8488
8764
  attributes: {
8489
8765
  style: componentsToExcludeFromStyle.find((c) => c === componentStyleKey)
8490
8766
  ? ''
8491
- : componentStyleKey,
8767
+ : componentStyleKey
8492
8768
  },
8493
8769
  autosize: true,
8494
8770
  options: [{}],
8495
8771
  fieldGroup: [],
8496
- autoDimension: control.autoDimension,
8772
+ autoDimension: control.autoDimension
8497
8773
  },
8498
8774
  expressions: {},
8499
8775
  hooks: {},
8500
- validators: {},
8776
+ validators: {}
8501
8777
  };
8502
8778
  formlyConfig.validation = {};
8503
8779
  if (control.specificControlData?.isMandatory && formlyConfig.props) {
@@ -8505,7 +8781,7 @@ class CollectorFormComponent {
8505
8781
  formlyConfig.props.required = control.specificControlData?.isMandatory;
8506
8782
  formlyConfig.validation.messages = {
8507
8783
  ...formlyConfig.validation?.messages,
8508
- required: requiredMessage,
8784
+ required: requiredMessage
8509
8785
  };
8510
8786
  }
8511
8787
  if (control.type === StepControlType.Dictionary &&
@@ -8516,7 +8792,7 @@ class CollectorFormComponent {
8516
8792
  formlyConfig.props.required = control.specificControlData?.isMandatory;
8517
8793
  formlyConfig.validation.messages = {
8518
8794
  ...formlyConfig.validation?.messages,
8519
- required: requiredMessage,
8795
+ required: requiredMessage
8520
8796
  };
8521
8797
  }
8522
8798
  let simpleValidationMessage = '';
@@ -8528,14 +8804,14 @@ class CollectorFormComponent {
8528
8804
  formlyConfig.props.min = control.specificControlData.minValue;
8529
8805
  formlyConfig.validation.messages = {
8530
8806
  ...formlyConfig.validation?.messages,
8531
- min: simpleValidationMessage,
8807
+ min: simpleValidationMessage
8532
8808
  };
8533
8809
  }
8534
8810
  if (control.specificControlData?.maxValue?.toString()) {
8535
8811
  formlyConfig.props.max = control.specificControlData.maxValue;
8536
8812
  formlyConfig.validation.messages = {
8537
8813
  ...formlyConfig.validation?.messages,
8538
- max: simpleValidationMessage,
8814
+ max: simpleValidationMessage
8539
8815
  };
8540
8816
  }
8541
8817
  }
@@ -8558,12 +8834,12 @@ class CollectorFormComponent {
8558
8834
  }
8559
8835
  },
8560
8836
  message: simpleValidationMessage ||
8561
- 'Value does not match the required pattern',
8562
- },
8837
+ 'Value does not match the required pattern'
8838
+ }
8563
8839
  };
8564
8840
  formlyConfig.validation.messages = {
8565
8841
  ...formlyConfig.validation?.messages,
8566
- pattern: simpleValidationMessage,
8842
+ pattern: simpleValidationMessage
8567
8843
  };
8568
8844
  }
8569
8845
  // Apply maxLength validation if maxCharacters is defined
@@ -8572,7 +8848,7 @@ class CollectorFormComponent {
8572
8848
  control.specificControlData?.maxCharacters;
8573
8849
  formlyConfig.validation.messages = {
8574
8850
  ...formlyConfig.validation?.messages,
8575
- maxLength: simpleValidationMessage,
8851
+ maxLength: simpleValidationMessage
8576
8852
  };
8577
8853
  }
8578
8854
  if (control.specificControlData?.allowOnlyFuture ||
@@ -8599,12 +8875,12 @@ class CollectorFormComponent {
8599
8875
  },
8600
8876
  message: (error, field) => {
8601
8877
  return simpleValidationMessage;
8602
- },
8603
- },
8878
+ }
8879
+ }
8604
8880
  };
8605
8881
  formlyConfig.validators = {
8606
8882
  ...formlyConfig.validators,
8607
- ...checkDateValidation,
8883
+ ...checkDateValidation
8608
8884
  };
8609
8885
  }
8610
8886
  }
@@ -8627,8 +8903,8 @@ class CollectorFormComponent {
8627
8903
  }
8628
8904
  return true;
8629
8905
  },
8630
- message: phoneErrorLabelValue,
8631
- },
8906
+ message: phoneErrorLabelValue
8907
+ }
8632
8908
  };
8633
8909
  }
8634
8910
  if (control.specificControlData?.type === 2) {
@@ -8650,12 +8926,12 @@ class CollectorFormComponent {
8650
8926
  if (simpleValidationMessage === '')
8651
8927
  return 'Please enter a valid date';
8652
8928
  return simpleValidationMessage;
8653
- },
8654
- },
8929
+ }
8930
+ }
8655
8931
  };
8656
8932
  formlyConfig.validators = {
8657
8933
  ...formlyConfig.validators,
8658
- ...checkDate2Validation,
8934
+ ...checkDate2Validation
8659
8935
  };
8660
8936
  }
8661
8937
  return formlyConfig;
@@ -8702,18 +8978,30 @@ class CollectorFormComponent {
8702
8978
  case 'boolean':
8703
8979
  formlyConfig.defaultValue = fillValue ? '&check;' : '&cross;';
8704
8980
  break;
8705
- default:
8706
- if (fillValue?.name) {
8981
+ case 'object':
8982
+ // Enriched inherited dictionary format: extract fillValue for display
8983
+ if (fillValue.fillValue !== undefined) {
8984
+ formlyConfig.defaultValue = fillValue.fillValue;
8985
+ }
8986
+ else if (fillValue.name) {
8707
8987
  formlyConfig.defaultValue = fillValue.name;
8708
8988
  }
8709
8989
  else {
8710
- formlyConfig.defaultValue = fillValue;
8990
+ formlyConfig.defaultValue = JSON.stringify(fillValue);
8711
8991
  }
8712
8992
  break;
8993
+ default:
8994
+ formlyConfig.defaultValue = fillValue;
8995
+ break;
8713
8996
  }
8714
8997
  }
8715
8998
  }
8716
8999
  }
9000
+ // Ensure type is set for presentation controls
9001
+ if (!formlyConfig.type) {
9002
+ formlyConfig.type = 'formly-paragraph';
9003
+ formlyConfig.className = 'component-text-field';
9004
+ }
8717
9005
  formlyConfig.id = control.identifier;
8718
9006
  formlyConfig.props['isDisplayMode'] = true;
8719
9007
  formlyConfig.props['collectionControlIdentifier'] =
@@ -8754,7 +9042,7 @@ class CollectorFormComponent {
8754
9042
  hide: (field) => {
8755
9043
  const shouldShow = this.shouldShowDependentField(parentKey, dependentValueIds, this.model);
8756
9044
  return !shouldShow;
8757
- },
9045
+ }
8758
9046
  };
8759
9047
  }
8760
9048
  }
@@ -8781,7 +9069,7 @@ class CollectorFormComponent {
8781
9069
  if (filteredValues.length > 0) {
8782
9070
  const newDictionary = {
8783
9071
  ...dictionary,
8784
- values: filteredValues,
9072
+ values: filteredValues
8785
9073
  };
8786
9074
  newDictionaries.push(newDictionary);
8787
9075
  }
@@ -8961,7 +9249,7 @@ class CollectorFormComponent {
8961
9249
  value: value,
8962
9250
  label: Utils.findValueTranslation(value.valueTranslations, currentLanguageId) || value.name,
8963
9251
  currentLanguageIso: this.currentLanguageIso,
8964
- relatedDictionariesTranslations: dictionaryControlData.relatedDictionariesTranslations,
9252
+ relatedDictionariesTranslations: dictionaryControlData.relatedDictionariesTranslations
8965
9253
  }));
8966
9254
  options.props['selectedRelatedDictionaries'] =
8967
9255
  dictionaryControlData.selectedRelatedDictionaries || [];
@@ -9032,14 +9320,14 @@ class CollectorFormComponent {
9032
9320
  currentLanguageId: currentLanguageId,
9033
9321
  required: true,
9034
9322
  attributes: {
9035
- style: this.styleObjectToStringExceptBackground(this.design[`.font-list`] || {}),
9323
+ style: this.styleObjectToStringExceptBackground(this.design[`.font-list`] || {})
9036
9324
  },
9037
9325
  options: referenceDictionary.values?.map((value) => ({
9038
9326
  value: value,
9039
9327
  label: Utils.findValueTranslation(value.valueTranslations, currentLanguageId) || value.name,
9040
- currentLanguageIso: this.currentLanguageIso,
9041
- })),
9042
- },
9328
+ currentLanguageIso: this.currentLanguageIso
9329
+ }))
9330
+ }
9043
9331
  };
9044
9332
  if (referenceDictionary.defaultValueId) {
9045
9333
  const defaultVal = this.findAndMapDefaultValue(referenceDictionary, referenceDictionary.defaultValueId);
@@ -9055,9 +9343,10 @@ class CollectorFormComponent {
9055
9343
  if (parentIndex !== -1) {
9056
9344
  const endIndex = this.findLastChildIndex(parentFieldGroup, parentIndex);
9057
9345
  const percentageToAdd = this.getExistingPercentage(parentFieldGroup, parentIndex);
9058
- newField.className = percentageToAdd === 0
9059
- ? parentDictionaryField.className
9060
- : this.getPercentageClassName(percentageToAdd);
9346
+ newField.className =
9347
+ percentageToAdd === 0
9348
+ ? parentDictionaryField.className
9349
+ : this.getPercentageClassName(percentageToAdd);
9061
9350
  parentFieldGroup.splice(endIndex + 1, 0, newField);
9062
9351
  const classNameToAdd = type === 'radio' ? ` component-radio` : ` component-data`;
9063
9352
  newField.className += classNameToAdd;
@@ -9138,12 +9427,12 @@ class CollectorFormComponent {
9138
9427
  preloadedDictionaries: this.dictionaryMap,
9139
9428
  options: childDictionary.values?.map((value) => ({
9140
9429
  value: value.id,
9141
- label: value.name,
9430
+ label: value.name
9142
9431
  })),
9143
9432
  required: true,
9144
9433
  attributes: {
9145
- style: this.styleObjectToStringExceptBackground(this.design[`.font-list`] || {}),
9146
- },
9434
+ style: this.styleObjectToStringExceptBackground(this.design[`.font-list`] || {})
9435
+ }
9147
9436
  },
9148
9437
  hooks: {
9149
9438
  onInit: (field) => {
@@ -9165,8 +9454,8 @@ class CollectorFormComponent {
9165
9454
  unsubscribe$.next();
9166
9455
  unsubscribe$.complete();
9167
9456
  };
9168
- },
9169
- },
9457
+ }
9458
+ }
9170
9459
  };
9171
9460
  const parentFieldGroup = parentDictionaryField.parent
9172
9461
  ? parentDictionaryField.parent.fieldGroup
@@ -9338,7 +9627,7 @@ class CollectorFormComponent {
9338
9627
  return buttonsConfig.map((button) => ({
9339
9628
  type: button.value.toLowerCase(),
9340
9629
  label: button.translations?.[this.currentLanguageIso] || button.value,
9341
- styleKey: `.button-${button.value.toLowerCase()}`,
9630
+ styleKey: `.button-${button.value.toLowerCase()}`
9342
9631
  }));
9343
9632
  }
9344
9633
  styleObjectToStringExceptBackground(styleObj) {
@@ -9347,17 +9636,16 @@ class CollectorFormComponent {
9347
9636
  .map(([key, value]) => `${key}: ${value}`)
9348
9637
  .join('; ');
9349
9638
  }
9350
- validateMethodApi(data) {
9351
- if (data.apiId === undefined || data.appId === undefined) {
9352
- return of(false);
9639
+ async validateMethodApi(data) {
9640
+ if (data.apiMethodId === undefined) {
9641
+ return false;
9353
9642
  }
9354
- return this.applicationDataService.validateApi(data).pipe(map((response) => {
9355
- console.log('API validation response:', response);
9356
- return !!response;
9643
+ var apiResponse = from(this.applicationDataService.validateApi(data)).pipe(map((obs) => {
9644
+ return !!obs;
9357
9645
  }), catchError((error) => {
9358
- console.error('Error validating ' + data.data, error);
9359
9646
  return of(false);
9360
9647
  }));
9648
+ return firstValueFrom(apiResponse);
9361
9649
  }
9362
9650
  /**
9363
9651
  * Public method to clear the saving after actions state
@@ -9959,7 +10247,7 @@ class FormlyFieldStepperComponent extends FieldType {
9959
10247
  callback: () => this.checkIfFlowIsFinished(),
9960
10248
  });
9961
10249
  console.log('hasActionSteps', hasActionSteps);
9962
- if (hasActionSteps) {
10250
+ if (hasActionSteps && !this.isFlowFinished) {
9963
10251
  await this.updateAppData(true);
9964
10252
  }
9965
10253
  if (!this.isFlowFinished) {
@@ -10029,12 +10317,14 @@ class FormlyFieldStepperComponent extends FieldType {
10029
10317
  current: currentIdx,
10030
10318
  callback: () => this.checkIfFlowIsFinished(),
10031
10319
  });
10032
- if (hasActionSteps) {
10320
+ if (hasActionSteps && !this.isFlowFinished) {
10033
10321
  await this.updateAppData(true);
10034
10322
  }
10035
- this.stepper.next();
10036
- this.currentStepIndex = this.stepper.selectedIndex;
10037
- this.field?.props?.['onSelectedPageChanged'](this.stepper.selectedIndex);
10323
+ if (!this.isFlowFinished) {
10324
+ this.stepper.next();
10325
+ this.currentStepIndex = this.stepper.selectedIndex;
10326
+ this.field?.props?.['onSelectedPageChanged'](this.stepper.selectedIndex);
10327
+ }
10038
10328
  this.cdr.detectChanges();
10039
10329
  }
10040
10330
  checkIfFlowIsFinished() {
@@ -10314,7 +10604,21 @@ class FormlyParagraphComponent extends BaseFormlyStepComponent {
10314
10604
  };
10315
10605
  }
10316
10606
  get formattedLabel() {
10317
- return this.formatDateIfNeeded(this.field.defaultValue).toString();
10607
+ return this.normalizeValue(this.field.defaultValue);
10608
+ }
10609
+ normalizeValue(value) {
10610
+ if (value == null)
10611
+ return '';
10612
+ if (Array.isArray(value)) {
10613
+ return value
10614
+ .map(v => this.normalizeValue(v))
10615
+ .filter(Boolean)
10616
+ .join(', ');
10617
+ }
10618
+ if (typeof value === 'object') {
10619
+ return String(value.fillValue ?? value.value ?? value.name ?? value.label ?? '');
10620
+ }
10621
+ return this.formatDateIfNeeded(value);
10318
10622
  }
10319
10623
  formatDateIfNeeded(value) {
10320
10624
  if (!value)