@wix/form-public 0.550.0 → 0.551.0

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.
package/dist/index.cjs CHANGED
@@ -14773,12 +14773,25 @@ var init_form_validator = __esm({
14773
14773
  }))));
14774
14774
  const addressForms = this.getAddressForms(currentlyValidatableForm, submission);
14775
14775
  const objectArrayForms = this.getObjectArrayForms(currentlyValidatableForm);
14776
- return createAjvSchemaValidator([
14776
+ const ajv = createAjvSchemaValidator([
14777
14777
  ...this.formSchemas,
14778
14778
  ...nestedForms,
14779
14779
  ...addressForms,
14780
14780
  ...objectArrayForms
14781
14781
  ]);
14782
+ this.addPlaceholdersForMissingDeletedAddressForms(ajv, currentlyValidatableForm);
14783
+ return ajv;
14784
+ }
14785
+ // A deleted address field still references its address form. Without that
14786
+ // form the schema cannot compile, so accept any value for the field instead.
14787
+ addPlaceholdersForMissingDeletedAddressForms(ajv, form) {
14788
+ (form.deletedFields ?? []).filter((field) => field.target && field.validation?.predefined?.format === types$1.ValidationFormat.MULTILINE_ADDRESS).forEach((field) => {
14789
+ if (!ajv.getSchema(field.target)) {
14790
+ ajv.addSchema({
14791
+ $id: field.target
14792
+ });
14793
+ }
14794
+ });
14782
14795
  }
14783
14796
  // eslint-disable-next-line max-params
14784
14797
  constructor(formSchemas, validationMode, platformisedFieldBasedValidation = false, addressFormProvider = () => void 0, submissionValueProvider, lenientPhoneValidation = false) {