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