@bolttech/form-engine-core 1.0.7 → 1.0.9

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.
Files changed (3) hide show
  1. package/index.d.ts +15 -7
  2. package/index.esm.js +75 -29
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as rxjs from 'rxjs';
2
- import { Subject, Subscription } from 'rxjs';
2
+ import { Subject, Subscription, BehaviorSubject } from 'rxjs';
3
3
  import { TCurrencyLocalCode, TCurrencyCode } from '@gaignoux/currency';
4
4
  import { OutgoingHttpHeaders } from 'http2';
5
5
 
@@ -7,7 +7,12 @@ type AllowOnly<T, K extends keyof T> = Pick<T, K> & {
7
7
  [P in keyof Omit<T, K>]?: never;
8
8
  };
9
9
  type OneOf<T, K = keyof T> = K extends keyof T ? AllowOnly<T, K> : never;
10
- type TValidationHandler = Record<string, (value: unknown, validations: TValidationMethods) => boolean>;
10
+ type TValidationPayload = [
11
+ unknown,
12
+ TValidationMethods,
13
+ TFormValues<unknown>?
14
+ ];
15
+ type TValidationHandler = Record<string, (...args: TValidationPayload) => boolean>;
11
16
 
12
17
  type TComponentPropsMappingSubset = keyof (Pick<TEventPropsEnum, 'onBlur' | 'onChange' | 'onFocus' | 'onKeyDown' | 'onKeyUp' | 'onClick'> & Pick<TEventDataPropsEnum, 'onSubmit'>);
13
18
  /**
@@ -325,7 +330,7 @@ type TLengthValidation = {
325
330
  * const callbackValidation: TCallbackValidation = (value) => typeof value === 'string';
326
331
  * ```
327
332
  */
328
- type TCallbackValidation = (value: unknown) => boolean;
333
+ type TCallbackValidation = (value: unknown, formValues: Pick<TFormValues<unknown>, 'values' | 'metadata'>) => boolean;
329
334
  /**
330
335
  * @type TBetweenValidation
331
336
  * Represents validation rules that check if a value is between a range.
@@ -1422,6 +1427,7 @@ declare class FormField {
1422
1427
  key: string;
1423
1428
  status: boolean;
1424
1429
  }>;
1430
+ formValuesStateSubject$: BehaviorSubject<TFormValues<unknown>>;
1425
1431
  validateVisibility: (payload: {
1426
1432
  event: TEvents;
1427
1433
  key: string;
@@ -1456,7 +1462,7 @@ declare class FormField {
1456
1462
  * @param {TMapper<unknown>} options.mapper, - component generic mapper containing render parameters for adapters
1457
1463
  * @param {() => TFormValues<unknown>} options.getFormValues, - form instance function that builds onData parameter payload from fields
1458
1464
  */
1459
- constructor({ formIndex, schemaComponent, config, children, validateVisibility, resetValue, resetProperty, templateSubject$, fieldEventSubject$, dataSubject$, fieldValidNotification$, mountSubject$, mapper, getFormValues, submitEvent, visibility, persistValue, }: {
1465
+ constructor({ formIndex, schemaComponent, config, children, validateVisibility, resetValue, resetProperty, templateSubject$, fieldEventSubject$, dataSubject$, fieldValidNotification$, mountSubject$, mapper, formValuesStateSubject$, submitEvent, visibility, persistValue, }: {
1460
1466
  formIndex: string;
1461
1467
  schemaComponent: IComponentSchema;
1462
1468
  config?: TSchemaFormConfig;
@@ -1483,8 +1489,8 @@ declare class FormField {
1483
1489
  key: string;
1484
1490
  status: boolean;
1485
1491
  }>;
1492
+ formValuesStateSubject$: BehaviorSubject<TFormValues<unknown>>;
1486
1493
  mapper: TMapper<unknown>;
1487
- getFormValues: () => TFormValues<unknown>;
1488
1494
  visibility?: boolean;
1489
1495
  persistValue?: boolean;
1490
1496
  });
@@ -1721,6 +1727,7 @@ declare class FormCore {
1721
1727
  dataSubject$: Subject<TFormDataPayload>;
1722
1728
  formValidSubject$: Subject<TFormValidationPayload>;
1723
1729
  fieldValidNotification$: Subject<TFieldValidationPayload>;
1730
+ formValuesStateSubject$: BehaviorSubject<TFormValues<unknown>>;
1724
1731
  subscribedTemplates: TSubscribedTemplates[];
1725
1732
  action?: string;
1726
1733
  method?: string;
@@ -1742,6 +1749,7 @@ declare class FormCore {
1742
1749
  _valid: boolean;
1743
1750
  stopEventsOnSubmit: boolean;
1744
1751
  submitted: boolean;
1752
+ getFormValues: () => TFormValues<unknown>;
1745
1753
  /**
1746
1754
  * Creates an instance of FormCore.
1747
1755
  *
@@ -1998,7 +2006,7 @@ declare class FormCore {
1998
2006
  *
1999
2007
  * @returns {TFormValues} The current form values.
2000
2008
  */
2001
- getFormValues<T>(): TFormValues<T>;
2009
+ getFormState<T>(): TFormValues<T>;
2002
2010
  /**
2003
2011
  * function to be called to events sent from the adapter
2004
2012
  *
@@ -2324,4 +2332,4 @@ type TFormGroupOnValidEventPayload = {
2324
2332
  type TFormGroupOnSubmitEventPayload<T> = Record<string, TFormValues<T> | undefined>;
2325
2333
 
2326
2334
  export { FormCore, FormField, FormGroup, TMutationEnum };
2327
- export type { AllowOnly, IComponentSchema, IComponentSchemaAsFormField, IFormField, IFormSchema, IState, OneOf, TAllowedResetPropsMutationsEnum, TApiConfig, TApiEvent, TApiResponse, TApiResponsePayload, TAvailableValidations, TBetweenDatesValidation, TBetweenValidation, TCallbackValidation, TComponentPropsMapping, TConditionsValidation, TConditionsValidationSet, TCreditCardMatch, TCurrencyMask, TDateFormatsValidation, TDateInterval, TDateOperatorsValidation, TDateValidation, TDocumentValidation, TErrorMessages, TEvent, TEventDataProps, TEventDataPropsEnum, TEventEnum, TEventMessages, TEventMessagesValidationMethods, TEventProps, TEventPropsEnum, TEvents, TFieldEvent, TFieldValidationPayload, TFormCore, TFormDataPayload, TFormDataValues, TFormEntry, TFormGroup, TFormGroupOnDataEventPayload, TFormGroupOnSubmitEventPayload, TFormGroupOnValidEventPayload, TFormSubmitPayload, TFormValidationPayload, TFormValues, TFormatters, TGenericValidationRule, TLengthValidation, TMapper, TMaskGeneric, TMasks, TMultipleValidation, TMutationEvents, TProps, TResetPathMethods, TResetValueMethods, TSchemaFormConfig, TSchemaValidation, TSplitterFormatterValue, TSubscribedTemplates, TTemplateAvaliableScopes, TTemplateAvaliableScopesEnum, TTemplateEvent, TValidationHandler, TValidationMethods, TValidations, TValueChangeEvent, TVisibility };
2335
+ export type { AllowOnly, IComponentSchema, IComponentSchemaAsFormField, IFormField, IFormSchema, IState, OneOf, TAllowedResetPropsMutationsEnum, TApiConfig, TApiEvent, TApiResponse, TApiResponsePayload, TAvailableValidations, TBetweenDatesValidation, TBetweenValidation, TCallbackValidation, TComponentPropsMapping, TConditionsValidation, TConditionsValidationSet, TCreditCardMatch, TCurrencyMask, TDateFormatsValidation, TDateInterval, TDateOperatorsValidation, TDateValidation, TDocumentValidation, TErrorMessages, TEvent, TEventDataProps, TEventDataPropsEnum, TEventEnum, TEventMessages, TEventMessagesValidationMethods, TEventProps, TEventPropsEnum, TEvents, TFieldEvent, TFieldValidationPayload, TFormCore, TFormDataPayload, TFormDataValues, TFormEntry, TFormGroup, TFormGroupOnDataEventPayload, TFormGroupOnSubmitEventPayload, TFormGroupOnValidEventPayload, TFormSubmitPayload, TFormValidationPayload, TFormValues, TFormatters, TGenericValidationRule, TLengthValidation, TMapper, TMaskGeneric, TMasks, TMultipleValidation, TMutationEvents, TProps, TResetPathMethods, TResetValueMethods, TSchemaFormConfig, TSchemaValidation, TSplitterFormatterValue, TSubscribedTemplates, TTemplateAvaliableScopes, TTemplateAvaliableScopesEnum, TTemplateEvent, TValidationHandler, TValidationMethods, TValidationPayload, TValidations, TValueChangeEvent, TVisibility };
package/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Subject, Subscription, groupBy, mergeMap, debounceTime, filter, combineLatest, startWith, map, distinctUntilKeyChanged } from 'rxjs';
1
+ import { Subject, Subscription, groupBy, mergeMap, debounceTime, filter, combineLatest, startWith, BehaviorSubject, map, distinctUntilKeyChanged } from 'rxjs';
2
2
  import creditCardType from 'credit-card-type';
3
3
  import isNumber$1 from 'lodash/isNumber';
4
4
  import { getCurrencySymbol } from '@gaignoux/currency';
@@ -1594,6 +1594,7 @@ const repeated = (value, validations) => {
1594
1594
  *
1595
1595
  * @param value - The value to be validated.
1596
1596
  * @param validations - An object containing validation methods, including a custom callback function.
1597
+ * @param formValues - An object containing the form state, NOTE: validations might be dirty here
1597
1598
  * @returns `true` if the custom callback validation function returns `true`, otherwise `false`.
1598
1599
  *
1599
1600
  * @example
@@ -1612,9 +1613,20 @@ const repeated = (value, validations) => {
1612
1613
  * };
1613
1614
  * ```
1614
1615
  */
1615
- const callback = (value, validations) => {
1616
+ const callback = (value, validations, {
1617
+ values = [],
1618
+ metadata = []
1619
+ } = {
1620
+ values: [],
1621
+ metadata: [],
1622
+ erroredFields: [],
1623
+ isValid: true
1624
+ }) => {
1616
1625
  if (!validations.callback || !((validations === null || validations === void 0 ? void 0 : validations.callback) instanceof Function)) return false;
1617
- return validations.callback(value);
1626
+ return validations.callback(value, {
1627
+ values,
1628
+ metadata
1629
+ });
1618
1630
  };
1619
1631
 
1620
1632
  /**
@@ -2475,9 +2487,9 @@ class SafeSubject extends Subject {
2475
2487
  * const isValid = handleValidation(value, validations, methods, key);
2476
2488
  * console.log(isValid); // Output: true
2477
2489
  */
2478
- function handleValidation(value, validations, methods, key) {
2490
+ function handleValidation(value, validations, methods, key, formValues) {
2479
2491
  if (isFunction(methods[key])) {
2480
- return methods[key](value, validations);
2492
+ return methods[key](value, validations, formValues);
2481
2493
  }
2482
2494
  return namedRule(value, validations[key], methods);
2483
2495
  }
@@ -2518,7 +2530,7 @@ class FormField {
2518
2530
  fieldValidNotification$,
2519
2531
  mountSubject$,
2520
2532
  mapper,
2521
- getFormValues,
2533
+ formValuesStateSubject$,
2522
2534
  submitEvent,
2523
2535
  visibility,
2524
2536
  persistValue
@@ -2550,13 +2562,14 @@ class FormField {
2550
2562
  this.validateVisibility = validateVisibility;
2551
2563
  this.resetValue = resetValue;
2552
2564
  this.resetProperty = resetProperty;
2553
- this.getFormValues = getFormValues;
2554
2565
  this.submitEvent = submitEvent;
2555
2566
  this.templateSubject$ = templateSubject$;
2556
2567
  this.fieldEventSubject$ = fieldEventSubject$;
2557
2568
  this.dataSubject$ = dataSubject$;
2558
2569
  this.fieldValidNotification$ = fieldValidNotification$;
2559
2570
  this.mountSubject$ = mountSubject$;
2571
+ this.formValuesStateSubject$ = formValuesStateSubject$;
2572
+ this.getFormValues = () => this.formValuesStateSubject$.value;
2560
2573
  this._props = FormField.filterProps(cloneDeep(schemaComponent.props || {}));
2561
2574
  this._adapterProps = JSON.stringify(schemaComponent.props || {});
2562
2575
  this._metadata = '';
@@ -2633,7 +2646,7 @@ class FormField {
2633
2646
  */
2634
2647
  set adapterProps(props) {
2635
2648
  const currentProps = JSON.stringify(props || {});
2636
- // it's a very basic comparison to determine if props changed,
2649
+ // it's a very basic comparison to determine if props changed,
2637
2650
  // will need review if we need complex comparisons
2638
2651
  if (currentProps !== this.adapterProps) {
2639
2652
  this.props = FormField.filterProps(props);
@@ -2895,7 +2908,7 @@ class FormField {
2895
2908
  if (typeof mountedStatus === 'undefined' || mountedStatus === this.mounted) return;
2896
2909
  this._mounted = mountedStatus;
2897
2910
  this.initializeObservers();
2898
- this.mountSubject$.next({
2911
+ if (!this.mountSubject$.closed) this.mountSubject$.next({
2899
2912
  key: this.name,
2900
2913
  status: this.mounted
2901
2914
  });
@@ -2912,14 +2925,20 @@ class FormField {
2912
2925
  valueSubscription,
2913
2926
  propsSubscription
2914
2927
  }) {
2928
+ /*
2929
+ NOTE: using emitEvents here will make ON_FIELD_MOUNT emit twice
2930
+ mount logic is managed on form.ts mountActions on first render
2931
+ */
2915
2932
  this.mounted = true;
2916
2933
  this.subscribeValue(valueSubscription);
2917
2934
  this.subscribeState(propsSubscription);
2918
2935
  this.valueSubject$.next(this.stateValue);
2919
2936
  this.propsSubject$.next(this.props);
2920
2937
  this.visibilitySubject$.next(this.visibility);
2921
- this.setFieldValidity({
2922
- event: 'ON_FIELD_MOUNT'
2938
+ this.fieldEventSubject$.next({
2939
+ event: 'ON_FIELD_MOUNT',
2940
+ fieldName: this.name,
2941
+ fieldInstance: this
2923
2942
  });
2924
2943
  }
2925
2944
  /**
@@ -2997,12 +3016,12 @@ class FormField {
2997
3016
  const schemaValidations = (_a = this.validations) === null || _a === void 0 ? void 0 : _a.methods;
2998
3017
  if (schemaValidations) {
2999
3018
  Object.keys(schemaValidations).forEach(validationKey => {
3000
- var _a;
3001
- const error = handleValidation(this.value, schemaValidations, validations, validationKey);
3019
+ var _a, _b;
3020
+ const error = handleValidation(this.value, schemaValidations, validations, validationKey, (_a = this.formValuesStateSubject$) === null || _a === void 0 ? void 0 : _a.value);
3002
3021
  // setting valid flag
3003
3022
  valid = !error && valid;
3004
3023
  // setting error messages
3005
- if (error && ((_a = this.validations) === null || _a === void 0 ? void 0 : _a.messages)) {
3024
+ if (error && ((_b = this.validations) === null || _b === void 0 ? void 0 : _b.messages)) {
3006
3025
  if (validationKey in this.validations.messages) {
3007
3026
  const messages = this.validations.messages;
3008
3027
  errors[validationKey] = messages[validationKey];
@@ -3060,7 +3079,8 @@ class FormField {
3060
3079
  const preConditions = config.preConditions;
3061
3080
  if (preConditions) {
3062
3081
  Object.keys(preConditions).forEach(validationKey => {
3063
- const error = handleValidation(this.value, preConditions, validations, validationKey);
3082
+ var _a;
3083
+ const error = handleValidation(this.value, preConditions, validations, validationKey, (_a = this.formValuesStateSubject$) === null || _a === void 0 ? void 0 : _a.value);
3064
3084
  valid = valid && !error;
3065
3085
  });
3066
3086
  }
@@ -3082,7 +3102,7 @@ class FormField {
3082
3102
  var _b, _c, _d, _e, _f, _g, _h, _j, _k;
3083
3103
  let requestMadeOnce = false;
3084
3104
  const configRequest = config => __awaiter(this, void 0, void 0, function* () {
3085
- var _a;
3105
+ var _a, _b;
3086
3106
  try {
3087
3107
  const {
3088
3108
  status,
@@ -3091,7 +3111,7 @@ class FormField {
3091
3111
  const callbackTransform = (_a = config.transform) === null || _a === void 0 ? void 0 : _a.callback;
3092
3112
  const apiResponseData = callbackTransform ? callbackTransform({
3093
3113
  payload: JSON.parse(String(response)),
3094
- formValues: this.getFormValues()
3114
+ formValues: (_b = this.formValuesStateSubject$) === null || _b === void 0 ? void 0 : _b.value
3095
3115
  }) : JSON.parse(String(response));
3096
3116
  const responseReturn = config.resultPath ? get(apiResponseData, config.resultPath) : apiResponseData;
3097
3117
  // this.apiResponseData = { response };
@@ -3277,11 +3297,31 @@ class FormCore {
3277
3297
  this.submitSubject$ = entry.submitSubject$ ? entry.submitSubject$ : new Subject();
3278
3298
  this.dataSubject$ = entry.dataSubject$ ? entry.dataSubject$ : new Subject();
3279
3299
  this.formValidSubject$ = entry.formValidSubject$ ? entry.formValidSubject$ : new Subject();
3300
+ this.formValuesStateSubject$ = new BehaviorSubject({
3301
+ erroredFields: [],
3302
+ isValid: true,
3303
+ metadata: [],
3304
+ values: []
3305
+ });
3306
+ this.getFormValues = () => this.formValuesStateSubject$.value;
3280
3307
  this.subscribedTemplates = [];
3281
3308
  this.templateSubscription$ = this.templateSubject$.subscribe(this.refreshTemplates.bind(this));
3282
3309
  this.fieldValidNotification$.subscribe(() => {
3283
3310
  this.validateForm();
3284
3311
  });
3312
+ /*
3313
+ @TODO check if this emissions can be merged
3314
+ every value update needs to occur after and before validations on field emitValue change
3315
+ so both callback validation and onData values are synced and fields and validations are correct
3316
+
3317
+ check field.ts emitValue and emitEvents
3318
+ */
3319
+ this.fieldEventSubject$.subscribe(() => {
3320
+ this.formValuesStateSubject$.next(this.getFormState());
3321
+ });
3322
+ this.dataSubject$.subscribe(() => {
3323
+ this.formValuesStateSubject$.next(this.getFormState());
3324
+ });
3285
3325
  this.mountSubject$.subscribe(this.mountActions.bind(this));
3286
3326
  this.initialValues = entry.initialValues || ((_j = entry.schema) === null || _j === void 0 ? void 0 : _j.initialValues);
3287
3327
  this.iVars = entry.iVars || ((_k = entry.schema) === null || _k === void 0 ? void 0 : _k.iVars) || {};
@@ -3803,7 +3843,7 @@ class FormCore {
3803
3843
  structVisibility.forEach(structElement => {
3804
3844
  if (!structElement.events.includes(event)) return;
3805
3845
  Object.keys(structElement.validations).forEach(validationKey => {
3806
- const error = handleValidation(field.value, structElement.validations, validations, validationKey);
3846
+ const error = handleValidation(field.value, structElement.validations, validations, validationKey, this.formValuesStateSubject$.value);
3807
3847
  if (Array.isArray(structElement.fields)) {
3808
3848
  structElement.fields.forEach(fieldKey => {
3809
3849
  this.setFieldVisibility({
@@ -3882,7 +3922,7 @@ class FormCore {
3882
3922
  return handleFieldRestoration();
3883
3923
  }
3884
3924
  Object.keys(structElement.validations).forEach(validationKey => {
3885
- const error = handleValidation(field.value, structElement.validations, validations, validationKey);
3925
+ const error = handleValidation(field.value, structElement.validations, validations, validationKey, this.formValuesStateSubject$.value);
3886
3926
  if (!error) {
3887
3927
  handleFieldRestoration();
3888
3928
  }
@@ -3948,7 +3988,7 @@ class FormCore {
3948
3988
  });
3949
3989
  }
3950
3990
  Object.keys(structElement.validations).forEach(validationKey => {
3951
- const error = handleValidation(field.value, structElement.validations, validations, validationKey);
3991
+ const error = handleValidation(field.value, structElement.validations, validations, validationKey, this.formValuesStateSubject$.value);
3952
3992
  if (!error) {
3953
3993
  this.setResetPathValue({
3954
3994
  key: structElement.field,
@@ -3991,7 +4031,7 @@ class FormCore {
3991
4031
  validateVisibility: this.validateVisibility.bind(this),
3992
4032
  resetValue: this.resetValue.bind(this),
3993
4033
  resetProperty: this.resetProperty.bind(this),
3994
- getFormValues: this.getFormValues.bind(this),
4034
+ formValuesStateSubject$: this.formValuesStateSubject$,
3995
4035
  templateSubject$: this.templateSubject$,
3996
4036
  fieldEventSubject$: this.fieldEventSubject$,
3997
4037
  dataSubject$: this.dataSubject$,
@@ -4102,14 +4142,14 @@ class FormCore {
4102
4142
  * Prints the current values of all form fields.
4103
4143
  */
4104
4144
  printValues() {
4105
- console.table(this.getFormValues().values);
4145
+ console.table(this.formValuesStateSubject$.value.values);
4106
4146
  }
4107
4147
  /**
4108
4148
  * Gets the current values of all form fields.
4109
4149
  *
4110
4150
  * @returns {TFormValues} The current form values.
4111
4151
  */
4112
- getFormValues() {
4152
+ getFormState() {
4113
4153
  const values = {};
4114
4154
  const metadata = {};
4115
4155
  const erroredFields = [];
@@ -4150,7 +4190,7 @@ class FormCore {
4150
4190
  * @returns Subscription
4151
4191
  */
4152
4192
  subscribeOnMount(callback) {
4153
- const sub = this.mountSubject$.pipe(map(() => this.getFormValues())).subscribe({
4193
+ const sub = this.mountSubject$.pipe(map(() => this.formValuesStateSubject$.value)).subscribe({
4154
4194
  next: callback
4155
4195
  });
4156
4196
  return sub;
@@ -4166,7 +4206,7 @@ class FormCore {
4166
4206
  fieldIndex
4167
4207
  }) => ({
4168
4208
  field: fieldIndex,
4169
- data: this.getFormValues()
4209
+ data: this.formValuesStateSubject$.value
4170
4210
  }))).subscribe({
4171
4211
  next: callback
4172
4212
  });
@@ -4216,7 +4256,7 @@ class FormCore {
4216
4256
  });
4217
4257
  });
4218
4258
  if (!this.valid) return;
4219
- const values = this.getFormValues();
4259
+ const values = this.formValuesStateSubject$.value;
4220
4260
  this.submitSubject$.next({
4221
4261
  formIndex: this.index,
4222
4262
  values
@@ -4227,9 +4267,15 @@ class FormCore {
4227
4267
  * recycles all the Suscriptions, to be called from the adapter when the form leaves the page
4228
4268
  */
4229
4269
  destroy() {
4270
+ this.templateSubject$.unsubscribe();
4230
4271
  this.templateSubscription$.unsubscribe();
4272
+ this.submitSubject$.unsubscribe();
4273
+ this.mountSubject$.unsubscribe();
4231
4274
  this.fieldEventSubject$.unsubscribe();
4275
+ this.dataSubject$.unsubscribe();
4276
+ this.formValidSubject$.unsubscribe();
4232
4277
  this.fieldValidNotification$.unsubscribe();
4278
+ this.formValuesStateSubject$.unsubscribe();
4233
4279
  this.fields.forEach(field => field.destroyField());
4234
4280
  }
4235
4281
  }
@@ -4410,7 +4456,7 @@ class FormGroup {
4410
4456
  indexes.forEach(index => {
4411
4457
  var _a, _b;
4412
4458
  (_a = this.forms.get(index)) === null || _a === void 0 ? void 0 : _a.submit();
4413
- const res = (_b = this.forms.get(index)) === null || _b === void 0 ? void 0 : _b.getFormValues();
4459
+ const res = (_b = this.forms.get(index)) === null || _b === void 0 ? void 0 : _b.formValuesStateSubject$.value;
4414
4460
  const formMetadata = typeof (res === null || res === void 0 ? void 0 : res.metadata) === 'object' && res.metadata !== null ? res.metadata : {};
4415
4461
  isValid = isValid && ((res === null || res === void 0 ? void 0 : res.isValid) || false);
4416
4462
  values = Object.assign(Object.assign({}, values), (res === null || res === void 0 ? void 0 : res.values) || {});
@@ -4444,7 +4490,7 @@ class FormGroup {
4444
4490
  acc[curr] = {
4445
4491
  formId: formIndex,
4446
4492
  formField: fieldIndex,
4447
- values: formInstance.getFormValues()
4493
+ values: formInstance.formValuesStateSubject$.value
4448
4494
  };
4449
4495
  }
4450
4496
  return acc;
@@ -4485,7 +4531,7 @@ class FormGroup {
4485
4531
  }) => ids.includes(formIndex)), map(() => ids.reduce((acc, curr) => {
4486
4532
  const formInstance = this.forms.get(curr);
4487
4533
  if (formInstance) {
4488
- acc[curr] = formInstance.getFormValues();
4534
+ acc[curr] = formInstance.formValuesStateSubject$.value;
4489
4535
  }
4490
4536
  return acc;
4491
4537
  }, {}))).subscribe(callback);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolttech/form-engine-core",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "dependencies": {
5
5
  "@gaignoux/currency": "^1.1.0",
6
6
  "credit-card-type": "^10.0.0",