@wix/form-public 0.171.0 → 0.173.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 +82 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +82 -56
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -358,9 +358,9 @@ var init_types_impl = __esm({
|
|
|
358
358
|
LayoutDataImagePosition4["BOTTOM_LEFT"] = "BOTTOM_LEFT";
|
|
359
359
|
LayoutDataImagePosition4["BOTTOM_RIGHT"] = "BOTTOM_RIGHT";
|
|
360
360
|
})(LayoutDataImagePosition || (LayoutDataImagePosition = {}));
|
|
361
|
-
(function(
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
(function(Origin3) {
|
|
362
|
+
Origin3["IMAGE"] = "IMAGE";
|
|
363
|
+
Origin3["LAYOUT"] = "LAYOUT";
|
|
364
364
|
})(Origin || (Origin = {}));
|
|
365
365
|
(function(VerticalAlignmentAlignment5) {
|
|
366
366
|
VerticalAlignmentAlignment5["TOP"] = "TOP";
|
|
@@ -640,10 +640,10 @@ var init_types_impl = __esm({
|
|
|
640
640
|
ResultsDisplay3["PASSING_STATUS"] = "PASSING_STATUS";
|
|
641
641
|
ResultsDisplay3["SCORE_AND_PASSING_STATUS"] = "SCORE_AND_PASSING_STATUS";
|
|
642
642
|
})(ResultsDisplay || (ResultsDisplay = {}));
|
|
643
|
-
(function(
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
643
|
+
(function(ContactAutofill3) {
|
|
644
|
+
ContactAutofill3["UNKNOWN_CONTACT_AUTOFILL"] = "UNKNOWN_CONTACT_AUTOFILL";
|
|
645
|
+
ContactAutofill3["MEMBER_DATA"] = "MEMBER_DATA";
|
|
646
|
+
ContactAutofill3["FORM_INPUT"] = "FORM_INPUT";
|
|
647
647
|
})(ContactAutofill || (ContactAutofill = {}));
|
|
648
648
|
(function(Fieldset2) {
|
|
649
649
|
Fieldset2["UNKNOWN"] = "UNKNOWN";
|
|
@@ -4869,7 +4869,7 @@ var init_max = __esm({
|
|
|
4869
4869
|
});
|
|
4870
4870
|
|
|
4871
4871
|
// ../../node_modules/@wix/ambassador-forms-v1-validation-result/es/build/types.impl.js
|
|
4872
|
-
var ErrorType, Format2, ValidationFormat2, ProductType2, PriceType2, FieldFieldType2, StringTypeFormatEnumFormat2, InputFieldStringComponentType2, NodeType2, WidthType2, PluginContainerDataAlignment2, Type2, Target2, TextAlignment2, LineStyle2, Width2, Alignment2, ViewMode2, LayoutType2, Orientation2, Crop2, ThumbnailsAlignment2, GIFType2, Source2, Position2, MapType3, ViewRole2, VoteRole2, PollLayoutType2, PollLayoutDirection2, BackgroundType2, DecorationType2, FontType2, ImageStylesPosition2, AspectRatio2, Resizing2, Placement2, CardStylesType2, CardStylesAlignment2, CardStylesLayout2, AppType2, InitialExpandedItems2, Direction2, VerticalAlignment2, NullValue2, Scaling2, LayoutDataImagePosition2, VerticalAlignmentAlignment2, ResponsivenessBehaviour2, DesignTarget2, ImagePosition2, AlignmentEnumAlignment2, ImageFit2, NumberOfColumns2, FirstDayOfWeekEnumFirstDayOfWeek2, InputFieldNumberComponentType2, InputFieldBooleanComponentType2, ArrayItemsItemType2, PropertiesTypePropertiesTypeEnum2, ArrayComponentType2, InputFieldWixFileComponentType2, UploadFileFormat2, InputFieldPaymentComponentType2, AddressComponentType2, DefaultCountryConfigType2, ObjectArrayComponentType2, InputFieldSchedulingComponentType2, AppointmentFormat2, InputFieldInputType2, FormFieldContactInfoEmailInfoTag2, FormFieldContactInfoPhoneInfoTag2, AddressInfoTag2, ConfirmationLevel2, FormFieldContactInfoContactField2, DisplayFieldDisplayFieldType2, OverrideEntityType2, Kind2, EmailInfoTag2, PhoneInfoTag2, Tag2, OptInLevel2, ContactField2, SpamFilterProtectionLevel2, RequiredIndicator2, RequiredIndicatorPlacement2, UrlTargetEnumTarget2, SubmitSuccessAction2, ChangeableProperty2, OverrideEntityTypeEnumOverrideEntityType2, Operator2, ResultsDisplay2, ValidationMode, Feature, AscendPlan, ActionType;
|
|
4872
|
+
var ErrorType, Format2, ValidationFormat2, ProductType2, PriceType2, FieldFieldType2, StringTypeFormatEnumFormat2, InputFieldStringComponentType2, NodeType2, WidthType2, PluginContainerDataAlignment2, Type2, Target2, TextAlignment2, LineStyle2, Width2, Alignment2, ViewMode2, LayoutType2, Orientation2, Crop2, ThumbnailsAlignment2, GIFType2, Source2, Position2, MapType3, ViewRole2, VoteRole2, PollLayoutType2, PollLayoutDirection2, BackgroundType2, DecorationType2, FontType2, ImageStylesPosition2, AspectRatio2, Resizing2, Placement2, CardStylesType2, CardStylesAlignment2, CardStylesLayout2, AppType2, InitialExpandedItems2, Direction2, VerticalAlignment2, NullValue2, Scaling2, LayoutDataImagePosition2, Origin2, VerticalAlignmentAlignment2, ResponsivenessBehaviour2, DesignTarget2, ImagePosition2, AlignmentEnumAlignment2, ImageFit2, NumberOfColumns2, FirstDayOfWeekEnumFirstDayOfWeek2, InputFieldNumberComponentType2, InputFieldBooleanComponentType2, ArrayItemsItemType2, PropertiesTypePropertiesTypeEnum2, ArrayComponentType2, InputFieldWixFileComponentType2, UploadFileFormat2, InputFieldPaymentComponentType2, AddressComponentType2, DefaultCountryConfigType2, ObjectArrayComponentType2, InputFieldSchedulingComponentType2, AppointmentFormat2, InputFieldInputType2, FormFieldContactInfoEmailInfoTag2, FormFieldContactInfoPhoneInfoTag2, AddressInfoTag2, ConfirmationLevel2, SubscriptionChannel, FormFieldContactInfoContactField2, DisplayFieldDisplayFieldType2, OverrideEntityType2, Kind2, EmailInfoTag2, PhoneInfoTag2, Tag2, OptInLevel2, ContactField2, SpamFilterProtectionLevel2, RequiredIndicator2, RequiredIndicatorPlacement2, UrlTargetEnumTarget2, SubmitSuccessAction2, ChangeableProperty2, OverrideEntityTypeEnumOverrideEntityType2, Operator2, ResultsDisplay2, ContactAutofill2, ValidationMode, Feature, AscendPlan, ActionType;
|
|
4873
4873
|
var init_types_impl2 = __esm({
|
|
4874
4874
|
"../../node_modules/@wix/ambassador-forms-v1-validation-result/es/build/types.impl.js"() {
|
|
4875
4875
|
(function(ErrorType2) {
|
|
@@ -4907,6 +4907,7 @@ var init_types_impl2 = __esm({
|
|
|
4907
4907
|
ErrorType2["DECIMAL_POINT_ERROR"] = "DECIMAL_POINT_ERROR";
|
|
4908
4908
|
ErrorType2["INCOMPLETE_DATE_ERROR"] = "INCOMPLETE_DATE_ERROR";
|
|
4909
4909
|
ErrorType2["INVALID_VALUE_FOR_PATTERN_ERROR"] = "INVALID_VALUE_FOR_PATTERN_ERROR";
|
|
4910
|
+
ErrorType2["INVALID_DEFAULT_VALUE_ERROR"] = "INVALID_DEFAULT_VALUE_ERROR";
|
|
4910
4911
|
})(ErrorType || (ErrorType = {}));
|
|
4911
4912
|
(function(Format6) {
|
|
4912
4913
|
Format6["UNDEFINED"] = "UNDEFINED";
|
|
@@ -5219,6 +5220,10 @@ var init_types_impl2 = __esm({
|
|
|
5219
5220
|
LayoutDataImagePosition4["BOTTOM_LEFT"] = "BOTTOM_LEFT";
|
|
5220
5221
|
LayoutDataImagePosition4["BOTTOM_RIGHT"] = "BOTTOM_RIGHT";
|
|
5221
5222
|
})(LayoutDataImagePosition2 || (LayoutDataImagePosition2 = {}));
|
|
5223
|
+
(function(Origin3) {
|
|
5224
|
+
Origin3["IMAGE"] = "IMAGE";
|
|
5225
|
+
Origin3["LAYOUT"] = "LAYOUT";
|
|
5226
|
+
})(Origin2 || (Origin2 = {}));
|
|
5222
5227
|
(function(VerticalAlignmentAlignment5) {
|
|
5223
5228
|
VerticalAlignmentAlignment5["TOP"] = "TOP";
|
|
5224
5229
|
VerticalAlignmentAlignment5["MIDDLE"] = "MIDDLE";
|
|
@@ -5362,6 +5367,11 @@ var init_types_impl2 = __esm({
|
|
|
5362
5367
|
ConfirmationLevel4["SINGLE_CONFIRMATION"] = "SINGLE_CONFIRMATION";
|
|
5363
5368
|
ConfirmationLevel4["DOUBLE_CONFIRMATION"] = "DOUBLE_CONFIRMATION";
|
|
5364
5369
|
})(ConfirmationLevel2 || (ConfirmationLevel2 = {}));
|
|
5370
|
+
(function(SubscriptionChannel2) {
|
|
5371
|
+
SubscriptionChannel2["UNKNOWN_SUBSCRIPTION_CHANNEL"] = "UNKNOWN_SUBSCRIPTION_CHANNEL";
|
|
5372
|
+
SubscriptionChannel2["EMAIL"] = "EMAIL";
|
|
5373
|
+
SubscriptionChannel2["SMS"] = "SMS";
|
|
5374
|
+
})(SubscriptionChannel || (SubscriptionChannel = {}));
|
|
5365
5375
|
(function(FormFieldContactInfoContactField3) {
|
|
5366
5376
|
FormFieldContactInfoContactField3["UNKNOWN_CONTACT_FIELD"] = "UNKNOWN_CONTACT_FIELD";
|
|
5367
5377
|
FormFieldContactInfoContactField3["FIRST_NAME"] = "FIRST_NAME";
|
|
@@ -5497,6 +5507,11 @@ var init_types_impl2 = __esm({
|
|
|
5497
5507
|
ResultsDisplay3["PASSING_STATUS"] = "PASSING_STATUS";
|
|
5498
5508
|
ResultsDisplay3["SCORE_AND_PASSING_STATUS"] = "SCORE_AND_PASSING_STATUS";
|
|
5499
5509
|
})(ResultsDisplay2 || (ResultsDisplay2 = {}));
|
|
5510
|
+
(function(ContactAutofill3) {
|
|
5511
|
+
ContactAutofill3["UNKNOWN_CONTACT_AUTOFILL"] = "UNKNOWN_CONTACT_AUTOFILL";
|
|
5512
|
+
ContactAutofill3["MEMBER_DATA"] = "MEMBER_DATA";
|
|
5513
|
+
ContactAutofill3["FORM_INPUT"] = "FORM_INPUT";
|
|
5514
|
+
})(ContactAutofill2 || (ContactAutofill2 = {}));
|
|
5500
5515
|
(function(ValidationMode2) {
|
|
5501
5516
|
ValidationMode2["UNKNOWN"] = "UNKNOWN";
|
|
5502
5517
|
ValidationMode2["UNRESTRICTED_UPDATE"] = "UNRESTRICTED_UPDATE";
|
|
@@ -20250,19 +20265,73 @@ var init_validate_premium_restrictions = __esm({
|
|
|
20250
20265
|
}
|
|
20251
20266
|
});
|
|
20252
20267
|
|
|
20268
|
+
// ../form-validator/dist/esm/lib/schema-validation/default-value-utils.js
|
|
20269
|
+
function getDefaultValue(field) {
|
|
20270
|
+
switch (field?.inputType) {
|
|
20271
|
+
case InputFieldInputType.STRING:
|
|
20272
|
+
return getDefaultStringComponentValue(field.stringOptions) ?? void 0;
|
|
20273
|
+
case InputFieldInputType.NUMBER:
|
|
20274
|
+
return getDefaultNumberComponentValue(field.numberOptions) ?? void 0;
|
|
20275
|
+
case InputFieldInputType.PAYMENT:
|
|
20276
|
+
return getDefaultPaymentComponentValue(field.paymentOptions) ?? void 0;
|
|
20277
|
+
default:
|
|
20278
|
+
return void 0;
|
|
20279
|
+
}
|
|
20280
|
+
}
|
|
20281
|
+
function getDefaultStringComponentValue(stringOptions) {
|
|
20282
|
+
switch (stringOptions?.componentType) {
|
|
20283
|
+
case InputFieldStringComponentType.DATE_TIME:
|
|
20284
|
+
return stringOptions?.dateTimeOptions?.default;
|
|
20285
|
+
case InputFieldStringComponentType.DATE_INPUT:
|
|
20286
|
+
return stringOptions?.dateInputOptions?.default;
|
|
20287
|
+
case InputFieldStringComponentType.DATE_PICKER:
|
|
20288
|
+
return stringOptions?.datePickerOptions?.default;
|
|
20289
|
+
case InputFieldStringComponentType.TEXT_INPUT:
|
|
20290
|
+
return stringOptions?.textInputOptions?.default;
|
|
20291
|
+
case InputFieldStringComponentType.TIME_INPUT:
|
|
20292
|
+
return stringOptions?.timeInputOptions?.default;
|
|
20293
|
+
default:
|
|
20294
|
+
return void 0;
|
|
20295
|
+
}
|
|
20296
|
+
}
|
|
20297
|
+
function getDefaultNumberComponentValue(numberOptions) {
|
|
20298
|
+
switch (numberOptions?.componentType) {
|
|
20299
|
+
case InputFieldNumberComponentType.NUMBER_INPUT:
|
|
20300
|
+
return numberOptions?.numberInputOptions?.default;
|
|
20301
|
+
case InputFieldNumberComponentType.RATING_INPUT:
|
|
20302
|
+
return numberOptions?.ratingInputOptions?.defaultValue;
|
|
20303
|
+
default:
|
|
20304
|
+
return void 0;
|
|
20305
|
+
}
|
|
20306
|
+
}
|
|
20307
|
+
function getDefaultPaymentComponentValue(paymentOptions) {
|
|
20308
|
+
switch (paymentOptions?.componentType) {
|
|
20309
|
+
case InputFieldPaymentComponentType.PAYMENT_INPUT:
|
|
20310
|
+
return paymentOptions?.paymentInputOptions?.default;
|
|
20311
|
+
default:
|
|
20312
|
+
return void 0;
|
|
20313
|
+
}
|
|
20314
|
+
}
|
|
20315
|
+
var init_default_value_utils = __esm({
|
|
20316
|
+
"../form-validator/dist/esm/lib/schema-validation/default-value-utils.js"() {
|
|
20317
|
+
init_types_impl();
|
|
20318
|
+
}
|
|
20319
|
+
});
|
|
20320
|
+
|
|
20253
20321
|
// ../form-validator/dist/esm/lib/schema-validation/form-schema-validator.js
|
|
20254
20322
|
var FormSchemaValidator;
|
|
20255
20323
|
var init_form_schema_validator = __esm({
|
|
20256
20324
|
"../form-validator/dist/esm/lib/schema-validation/form-schema-validator.js"() {
|
|
20257
20325
|
init_types_impl();
|
|
20258
20326
|
init_string_format_options_mapper();
|
|
20327
|
+
init_default_value_utils();
|
|
20259
20328
|
FormSchemaValidator = class {
|
|
20260
20329
|
constructor(submissionValidator) {
|
|
20261
20330
|
this.submissionValidator = submissionValidator;
|
|
20262
20331
|
}
|
|
20263
20332
|
validate(form, timezone) {
|
|
20264
20333
|
const submission = form.formFields?.reduce((acc, { inputOptions }) => {
|
|
20265
|
-
const defaultValue =
|
|
20334
|
+
const defaultValue = getDefaultValue(inputOptions);
|
|
20266
20335
|
const target = inputOptions?.target;
|
|
20267
20336
|
if (defaultValue && target) {
|
|
20268
20337
|
acc[target] = this.buildSubmissionValue(defaultValue, inputOptions, timezone);
|
|
@@ -20274,52 +20343,6 @@ var init_form_schema_validator = __esm({
|
|
|
20274
20343
|
}
|
|
20275
20344
|
return { errors: [] };
|
|
20276
20345
|
}
|
|
20277
|
-
getDefaultValue(field) {
|
|
20278
|
-
switch (field?.inputType) {
|
|
20279
|
-
case InputFieldInputType.STRING:
|
|
20280
|
-
return this.getDefaultStringComponentValue(field.stringOptions) ?? void 0;
|
|
20281
|
-
case InputFieldInputType.NUMBER:
|
|
20282
|
-
return this.getDefaultNumberComponentValue(field.numberOptions) ?? void 0;
|
|
20283
|
-
case InputFieldInputType.PAYMENT:
|
|
20284
|
-
return this.getDefaultPaymentComponentValue(field.paymentOptions) ?? void 0;
|
|
20285
|
-
default:
|
|
20286
|
-
return void 0;
|
|
20287
|
-
}
|
|
20288
|
-
}
|
|
20289
|
-
getDefaultStringComponentValue(stringOptions) {
|
|
20290
|
-
switch (stringOptions?.componentType) {
|
|
20291
|
-
case InputFieldStringComponentType.DATE_TIME:
|
|
20292
|
-
return stringOptions?.dateTimeOptions?.default;
|
|
20293
|
-
case InputFieldStringComponentType.DATE_INPUT:
|
|
20294
|
-
return stringOptions?.dateInputOptions?.default;
|
|
20295
|
-
case InputFieldStringComponentType.DATE_PICKER:
|
|
20296
|
-
return stringOptions?.datePickerOptions?.default;
|
|
20297
|
-
case InputFieldStringComponentType.TEXT_INPUT:
|
|
20298
|
-
return stringOptions?.textInputOptions?.default;
|
|
20299
|
-
case InputFieldStringComponentType.TIME_INPUT:
|
|
20300
|
-
return stringOptions?.timeInputOptions?.default;
|
|
20301
|
-
default:
|
|
20302
|
-
return void 0;
|
|
20303
|
-
}
|
|
20304
|
-
}
|
|
20305
|
-
getDefaultNumberComponentValue(numberOptions) {
|
|
20306
|
-
switch (numberOptions?.componentType) {
|
|
20307
|
-
case InputFieldNumberComponentType.NUMBER_INPUT:
|
|
20308
|
-
return numberOptions?.numberInputOptions?.default;
|
|
20309
|
-
case InputFieldNumberComponentType.RATING_INPUT:
|
|
20310
|
-
return numberOptions?.ratingInputOptions?.defaultValue;
|
|
20311
|
-
default:
|
|
20312
|
-
return void 0;
|
|
20313
|
-
}
|
|
20314
|
-
}
|
|
20315
|
-
getDefaultPaymentComponentValue(paymentOptions) {
|
|
20316
|
-
switch (paymentOptions?.componentType) {
|
|
20317
|
-
case InputFieldPaymentComponentType.PAYMENT_INPUT:
|
|
20318
|
-
return paymentOptions?.paymentInputOptions?.default;
|
|
20319
|
-
default:
|
|
20320
|
-
return void 0;
|
|
20321
|
-
}
|
|
20322
|
-
}
|
|
20323
20346
|
buildSubmissionValue(defaultValue, inputField, timezone) {
|
|
20324
20347
|
switch (inputField.inputType) {
|
|
20325
20348
|
case InputFieldInputType.PAYMENT:
|
|
@@ -20355,6 +20378,7 @@ __export(esm_exports, {
|
|
|
20355
20378
|
FormValidator: () => FormValidator,
|
|
20356
20379
|
ValidationMode: () => ValidationMode,
|
|
20357
20380
|
compareSchemaBackwardCompatibility: () => compareSchemaBackwardCompatibility,
|
|
20381
|
+
getDefaultValue: () => getDefaultValue,
|
|
20358
20382
|
groupErrorsByTarget: () => groupErrorsByTarget,
|
|
20359
20383
|
validatePremiumRestrictions: () => validatePremiumRestrictions
|
|
20360
20384
|
});
|
|
@@ -20364,6 +20388,7 @@ var init_esm2 = __esm({
|
|
|
20364
20388
|
init_compare_shema_backward_compatibility();
|
|
20365
20389
|
init_validate_premium_restrictions();
|
|
20366
20390
|
init_form_schema_validator();
|
|
20391
|
+
init_default_value_utils();
|
|
20367
20392
|
init_errors();
|
|
20368
20393
|
init_calling_country_codes();
|
|
20369
20394
|
init_error_derivation();
|
|
@@ -25938,7 +25963,8 @@ var defaultErrorKeys = {
|
|
|
25938
25963
|
[ErrorType.EXACT_ITEMS_NUMBER_ERROR]: "input.error.message.exact-items-number-error",
|
|
25939
25964
|
[ErrorType.DECIMAL_POINT_ERROR]: "input.error.message.decimal_point_error",
|
|
25940
25965
|
[ErrorType.INCOMPLETE_DATE_ERROR]: "input.error.message.incomplete-date-error",
|
|
25941
|
-
[ErrorType.INVALID_VALUE_FOR_PATTERN_ERROR]: "input.error.message.invalid-value-for-pattern"
|
|
25966
|
+
[ErrorType.INVALID_VALUE_FOR_PATTERN_ERROR]: "input.error.message.invalid-value-for-pattern",
|
|
25967
|
+
[ErrorType.INVALID_DEFAULT_VALUE_ERROR]: "input.error.message.invalid-default-value-error"
|
|
25942
25968
|
};
|
|
25943
25969
|
var getTranslatedError = (_ref) => {
|
|
25944
25970
|
let {
|