@wix/form-public 0.209.0 → 0.211.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
@@ -44,7 +44,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
44
44
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
45
45
 
46
46
  // ../../node_modules/@wix/ambassador-forms-v4-form/es/build/types.impl.js
47
- var Format, DayOfWeek, ValidationFormat, ProductType, PriceType, PropertiesTypeEnum, FieldFieldType, StringTypeFormatEnumFormat, InputFieldStringComponentType, NodeType, StylesBackgroundType, GradientType, WidthType, PluginContainerDataAlignment, Type, Target, TextAlignment, LineStyle, Width, Alignment, ViewMode, LayoutType, Orientation, Crop, ThumbnailsAlignment, GIFType, Source, Position, MapType, ViewRole, VoteRole, PollLayoutType, PollLayoutDirection, BackgroundType, DecorationType, FontType, ImageStylesPosition, AspectRatio, Resizing, Placement, CardStylesType, CardStylesAlignment, CardStylesLayout, AppType, InitialExpandedItems, Direction, VerticalAlignment, NullValue, Scaling, LayoutDataImagePosition, Origin, LayoutDataBackgroundType, BackdropType, VerticalAlignmentAlignment, ResponsivenessBehaviour, DesignTarget, ImageScalingScaling, ImagePositionPosition, CardDataBackgroundType, ListStyle, Indentation, ImagePosition, AlignmentEnumAlignment, ImageFit, NumberOfColumns, FirstDayOfWeekEnumFirstDayOfWeek, InputFieldNumberComponentType, InputFieldBooleanComponentType, ArrayItemsItemType, PropertiesTypePropertiesTypeEnum, ArrayComponentType, InputFieldWixFileComponentType, UploadFileFormat, InputFieldPaymentComponentType, AddressComponentType, DefaultCountryConfigType, ObjectArrayComponentType, InputFieldSchedulingComponentType, AppointmentFormat, MeetingType, StaffStrategySelection, InputFieldInputType, FormFieldContactInfoEmailInfoTag, FormFieldContactInfoPhoneInfoTag, AddressInfoTag, ConfirmationLevel, SubscriptionChannel, FormFieldContactInfoContactField, DisplayFieldDisplayFieldType, OverrideEntityType, Kind, EmailInfoTag, PhoneInfoTag, Tag, OptInLevel, ContactField, SpamFilterProtectionLevel, RequiredIndicator, RequiredIndicatorPlacement, UrlTargetEnumTarget, SubmitSuccessAction, ChangeableProperty, OverrideEntityTypeEnumOverrideEntityType, Operator, ResultsDisplay, ContactAutofill, Fieldset, SortOrder, CountFormsFieldset, ListFormsOrderEnumListFormsOrder, FilterType, ListFormsOrder, ListDeletedFormsOrder, FieldInputType, WebhookIdentityType;
47
+ var Format, DayOfWeek, ValidationFormat, ProductType, PriceType, PropertiesTypeEnum, FieldFieldType, StringTypeFormatEnumFormat, InputFieldStringComponentType, NodeType, StylesBackgroundType, GradientType, WidthType, PluginContainerDataAlignment, Type, Target, TextAlignment, LineStyle, Width, Alignment, ViewMode, LayoutType, Orientation, Crop, ThumbnailsAlignment, GIFType, Source, Position, MapType, ViewRole, VoteRole, PollLayoutType, PollLayoutDirection, BackgroundType, DecorationType, FontType, ImageStylesPosition, AspectRatio, Resizing, Placement, CardStylesType, CardStylesAlignment, CardStylesLayout, AppType, InitialExpandedItems, Direction, VerticalAlignment, NullValue, Scaling, LayoutDataImagePosition, Origin, LayoutDataBackgroundType, BackdropType, VerticalAlignmentAlignment, ResponsivenessBehaviour, DesignTarget, ImageScalingScaling, ImagePositionPosition, CardDataBackgroundType, ListStyle, Indentation, ImagePosition, AlignmentEnumAlignment, ImageFit, NumberOfColumns, FirstDayOfWeekEnumFirstDayOfWeek, InputFieldNumberComponentType, InputFieldBooleanComponentType, ArrayItemsItemType, PropertiesTypePropertiesTypeEnum, ArrayComponentType, InputFieldWixFileComponentType, UploadFileFormat, InputFieldPaymentComponentType, AddressComponentType, DefaultCountryConfigType, ObjectArrayComponentType, InputFieldSchedulingComponentType, AppointmentFormat, MeetingType, StaffStrategySelection, InputFieldInputType, FormFieldContactInfoEmailInfoTag, FormFieldContactInfoPhoneInfoTag, AddressInfoTag, ConfirmationLevel, SubscriptionChannel, FormFieldContactInfoContactField, DisplayFieldDisplayFieldType, OverrideEntityType, Kind, EmailInfoTag, PhoneInfoTag, Tag, OptInLevel, ContactField, SpamFilterProtectionLevel, RequiredIndicator, RequiredIndicatorPlacement, UrlTargetEnumTarget, SubmitSuccessAction, ChangeableProperty, OverrideEntityTypeEnumOverrideEntityType, Operator, ResultsDisplay, ContactAutofill, SubmissionAccess, Fieldset, SortOrder, CountFormsFieldset, ListFormsOrderEnumListFormsOrder, FilterType, ListFormsOrder, ListDeletedFormsOrder, FieldInputType, WebhookIdentityType;
48
48
  var init_types_impl = __esm({
49
49
  "../../node_modules/@wix/ambassador-forms-v4-form/es/build/types.impl.js"() {
50
50
  (function(Format6) {
@@ -678,6 +678,7 @@ var init_types_impl = __esm({
678
678
  SubmitSuccessAction5["NO_ACTION"] = "NO_ACTION";
679
679
  SubmitSuccessAction5["THANK_YOU_MESSAGE"] = "THANK_YOU_MESSAGE";
680
680
  SubmitSuccessAction5["REDIRECT"] = "REDIRECT";
681
+ SubmitSuccessAction5["POPUP"] = "POPUP";
681
682
  })(SubmitSuccessAction || (SubmitSuccessAction = {}));
682
683
  (function(ChangeableProperty4) {
683
684
  ChangeableProperty4["UNKNOWN_CHANGEABLE_PROPERTY"] = "UNKNOWN_CHANGEABLE_PROPERTY";
@@ -730,6 +731,12 @@ var init_types_impl = __esm({
730
731
  ContactAutofill5["MEMBER_DATA"] = "MEMBER_DATA";
731
732
  ContactAutofill5["FORM_INPUT"] = "FORM_INPUT";
732
733
  })(ContactAutofill || (ContactAutofill = {}));
734
+ (function(SubmissionAccess2) {
735
+ SubmissionAccess2["UNKNOWN_SUBMISSION_ACCESS"] = "UNKNOWN_SUBMISSION_ACCESS";
736
+ SubmissionAccess2["OWNER_AND_COLLABORATORS"] = "OWNER_AND_COLLABORATORS";
737
+ SubmissionAccess2["MEMBERS"] = "MEMBERS";
738
+ SubmissionAccess2["PUBLIC"] = "PUBLIC";
739
+ })(SubmissionAccess || (SubmissionAccess = {}));
733
740
  (function(Fieldset2) {
734
741
  Fieldset2["UNKNOWN"] = "UNKNOWN";
735
742
  Fieldset2["NESTED_FORMS"] = "NESTED_FORMS";
@@ -27882,6 +27889,7 @@ function useFormView() {
27882
27889
  }
27883
27890
  return context;
27884
27891
  }
27892
+ var FormValuesContext = /* @__PURE__ */ createContext(void 0);
27885
27893
 
27886
27894
  // ../form-fields/dist/esm/ui/form/components/form/create-form-fields.js
27887
27895
  var createFormFields = (_ref) => {
@@ -27911,16 +27919,18 @@ var createFormFields = (_ref) => {
27911
27919
  }
27912
27920
  }, /* @__PURE__ */ React42__default.createElement(FormViewContext.Provider, {
27913
27921
  value: form
27922
+ }, /* @__PURE__ */ React42__default.createElement(FormValuesContext.Provider, {
27923
+ value: values
27914
27924
  }, /* @__PURE__ */ React42__default.createElement(FormField, {
27915
27925
  key: formField.id,
27916
27926
  field: formField,
27917
27927
  values,
27918
27928
  errors,
27919
- onFieldChange,
27920
27929
  onBlur,
27921
27930
  onFocus,
27931
+ onFieldChange,
27922
27932
  FieldLayout
27923
- }))))));
27933
+ })))))));
27924
27934
  return {
27925
27935
  id: formField.id,
27926
27936
  fieldType: formField.fieldType,
@@ -31315,8 +31325,7 @@ var getFieldErrors = async (fieldsToValidate, form, addressTemplates, externalDa
31315
31325
  return fieldErrors;
31316
31326
  };
31317
31327
  var findErrorByNormalizedPath = (fieldsToValidate, errorPath) => {
31318
- const path = errorPath.split("/").length > 2 ? errorPath.split("/").at(0) : errorPath;
31319
- return !!fieldsToValidate.find((field) => path === field.path);
31328
+ return !!fieldsToValidate.find((field) => errorPath === field.path || errorPath.startsWith(`${field.path}/`));
31320
31329
  };
31321
31330
  function setValue(object, path, value) {
31322
31331
  const delimiter = "/";
@@ -32807,7 +32816,7 @@ var NORMALIZED_VALUE = {
32807
32816
  [FIELD_TYPES.MLA_STREET_NAME]: acceptStringValue,
32808
32817
  [FIELD_TYPES.MLA_STREET_NUMBER]: acceptStringValue,
32809
32818
  [FIELD_TYPES.MLA_APARTMENT]: acceptStringValue,
32810
- [FIELD_TYPES.FULL_NAME]: acceptObjectValue,
32819
+ [FIELD_TYPES.FULL_NAME]: acceptFullNameValue,
32811
32820
  [FIELD_TYPES.FULL_NAME_FIRST_NAME]: acceptStringValue,
32812
32821
  [FIELD_TYPES.FULL_NAME_LAST_NAME]: acceptStringValue,
32813
32822
  [FIELD_TYPES.VAT_ID]: normalizeVatIDValue,
@@ -33003,6 +33012,10 @@ function acceptObjectValue({ fieldValue }) {
33003
33012
  }
33004
33013
  return typeof fieldValue === "object" ? fieldValue : EMPTY_VALUE;
33005
33014
  }
33015
+ function acceptFullNameValue(args) {
33016
+ const result2 = acceptObjectValue(args);
33017
+ return result2 === EMPTY_VALUE ? {} : result2;
33018
+ }
33006
33019
  function acceptRatingValue({ fieldValue }) {
33007
33020
  const isEmptyValue = fieldValue === 0 || fieldValue === EMPTY_VALUE;
33008
33021
  if (isEmptyValue) {