@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.cjs
CHANGED
|
@@ -384,9 +384,9 @@ var init_types_impl = __esm({
|
|
|
384
384
|
LayoutDataImagePosition4["BOTTOM_LEFT"] = "BOTTOM_LEFT";
|
|
385
385
|
LayoutDataImagePosition4["BOTTOM_RIGHT"] = "BOTTOM_RIGHT";
|
|
386
386
|
})(LayoutDataImagePosition || (LayoutDataImagePosition = {}));
|
|
387
|
-
(function(
|
|
388
|
-
|
|
389
|
-
|
|
387
|
+
(function(Origin3) {
|
|
388
|
+
Origin3["IMAGE"] = "IMAGE";
|
|
389
|
+
Origin3["LAYOUT"] = "LAYOUT";
|
|
390
390
|
})(Origin || (Origin = {}));
|
|
391
391
|
(function(VerticalAlignmentAlignment5) {
|
|
392
392
|
VerticalAlignmentAlignment5["TOP"] = "TOP";
|
|
@@ -666,10 +666,10 @@ var init_types_impl = __esm({
|
|
|
666
666
|
ResultsDisplay3["PASSING_STATUS"] = "PASSING_STATUS";
|
|
667
667
|
ResultsDisplay3["SCORE_AND_PASSING_STATUS"] = "SCORE_AND_PASSING_STATUS";
|
|
668
668
|
})(ResultsDisplay || (ResultsDisplay = {}));
|
|
669
|
-
(function(
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
669
|
+
(function(ContactAutofill3) {
|
|
670
|
+
ContactAutofill3["UNKNOWN_CONTACT_AUTOFILL"] = "UNKNOWN_CONTACT_AUTOFILL";
|
|
671
|
+
ContactAutofill3["MEMBER_DATA"] = "MEMBER_DATA";
|
|
672
|
+
ContactAutofill3["FORM_INPUT"] = "FORM_INPUT";
|
|
673
673
|
})(ContactAutofill || (ContactAutofill = {}));
|
|
674
674
|
(function(Fieldset2) {
|
|
675
675
|
Fieldset2["UNKNOWN"] = "UNKNOWN";
|
|
@@ -4895,7 +4895,7 @@ var init_max = __esm({
|
|
|
4895
4895
|
});
|
|
4896
4896
|
|
|
4897
4897
|
// ../../node_modules/@wix/ambassador-forms-v1-validation-result/es/build/types.impl.js
|
|
4898
|
-
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;
|
|
4898
|
+
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;
|
|
4899
4899
|
var init_types_impl2 = __esm({
|
|
4900
4900
|
"../../node_modules/@wix/ambassador-forms-v1-validation-result/es/build/types.impl.js"() {
|
|
4901
4901
|
(function(ErrorType2) {
|
|
@@ -4933,6 +4933,7 @@ var init_types_impl2 = __esm({
|
|
|
4933
4933
|
ErrorType2["DECIMAL_POINT_ERROR"] = "DECIMAL_POINT_ERROR";
|
|
4934
4934
|
ErrorType2["INCOMPLETE_DATE_ERROR"] = "INCOMPLETE_DATE_ERROR";
|
|
4935
4935
|
ErrorType2["INVALID_VALUE_FOR_PATTERN_ERROR"] = "INVALID_VALUE_FOR_PATTERN_ERROR";
|
|
4936
|
+
ErrorType2["INVALID_DEFAULT_VALUE_ERROR"] = "INVALID_DEFAULT_VALUE_ERROR";
|
|
4936
4937
|
})(ErrorType || (ErrorType = {}));
|
|
4937
4938
|
(function(Format6) {
|
|
4938
4939
|
Format6["UNDEFINED"] = "UNDEFINED";
|
|
@@ -5245,6 +5246,10 @@ var init_types_impl2 = __esm({
|
|
|
5245
5246
|
LayoutDataImagePosition4["BOTTOM_LEFT"] = "BOTTOM_LEFT";
|
|
5246
5247
|
LayoutDataImagePosition4["BOTTOM_RIGHT"] = "BOTTOM_RIGHT";
|
|
5247
5248
|
})(LayoutDataImagePosition2 || (LayoutDataImagePosition2 = {}));
|
|
5249
|
+
(function(Origin3) {
|
|
5250
|
+
Origin3["IMAGE"] = "IMAGE";
|
|
5251
|
+
Origin3["LAYOUT"] = "LAYOUT";
|
|
5252
|
+
})(Origin2 || (Origin2 = {}));
|
|
5248
5253
|
(function(VerticalAlignmentAlignment5) {
|
|
5249
5254
|
VerticalAlignmentAlignment5["TOP"] = "TOP";
|
|
5250
5255
|
VerticalAlignmentAlignment5["MIDDLE"] = "MIDDLE";
|
|
@@ -5388,6 +5393,11 @@ var init_types_impl2 = __esm({
|
|
|
5388
5393
|
ConfirmationLevel4["SINGLE_CONFIRMATION"] = "SINGLE_CONFIRMATION";
|
|
5389
5394
|
ConfirmationLevel4["DOUBLE_CONFIRMATION"] = "DOUBLE_CONFIRMATION";
|
|
5390
5395
|
})(ConfirmationLevel2 || (ConfirmationLevel2 = {}));
|
|
5396
|
+
(function(SubscriptionChannel2) {
|
|
5397
|
+
SubscriptionChannel2["UNKNOWN_SUBSCRIPTION_CHANNEL"] = "UNKNOWN_SUBSCRIPTION_CHANNEL";
|
|
5398
|
+
SubscriptionChannel2["EMAIL"] = "EMAIL";
|
|
5399
|
+
SubscriptionChannel2["SMS"] = "SMS";
|
|
5400
|
+
})(SubscriptionChannel || (SubscriptionChannel = {}));
|
|
5391
5401
|
(function(FormFieldContactInfoContactField3) {
|
|
5392
5402
|
FormFieldContactInfoContactField3["UNKNOWN_CONTACT_FIELD"] = "UNKNOWN_CONTACT_FIELD";
|
|
5393
5403
|
FormFieldContactInfoContactField3["FIRST_NAME"] = "FIRST_NAME";
|
|
@@ -5523,6 +5533,11 @@ var init_types_impl2 = __esm({
|
|
|
5523
5533
|
ResultsDisplay3["PASSING_STATUS"] = "PASSING_STATUS";
|
|
5524
5534
|
ResultsDisplay3["SCORE_AND_PASSING_STATUS"] = "SCORE_AND_PASSING_STATUS";
|
|
5525
5535
|
})(ResultsDisplay2 || (ResultsDisplay2 = {}));
|
|
5536
|
+
(function(ContactAutofill3) {
|
|
5537
|
+
ContactAutofill3["UNKNOWN_CONTACT_AUTOFILL"] = "UNKNOWN_CONTACT_AUTOFILL";
|
|
5538
|
+
ContactAutofill3["MEMBER_DATA"] = "MEMBER_DATA";
|
|
5539
|
+
ContactAutofill3["FORM_INPUT"] = "FORM_INPUT";
|
|
5540
|
+
})(ContactAutofill2 || (ContactAutofill2 = {}));
|
|
5526
5541
|
(function(ValidationMode2) {
|
|
5527
5542
|
ValidationMode2["UNKNOWN"] = "UNKNOWN";
|
|
5528
5543
|
ValidationMode2["UNRESTRICTED_UPDATE"] = "UNRESTRICTED_UPDATE";
|
|
@@ -20276,19 +20291,73 @@ var init_validate_premium_restrictions = __esm({
|
|
|
20276
20291
|
}
|
|
20277
20292
|
});
|
|
20278
20293
|
|
|
20294
|
+
// ../form-validator/dist/esm/lib/schema-validation/default-value-utils.js
|
|
20295
|
+
function getDefaultValue(field) {
|
|
20296
|
+
switch (field?.inputType) {
|
|
20297
|
+
case InputFieldInputType.STRING:
|
|
20298
|
+
return getDefaultStringComponentValue(field.stringOptions) ?? void 0;
|
|
20299
|
+
case InputFieldInputType.NUMBER:
|
|
20300
|
+
return getDefaultNumberComponentValue(field.numberOptions) ?? void 0;
|
|
20301
|
+
case InputFieldInputType.PAYMENT:
|
|
20302
|
+
return getDefaultPaymentComponentValue(field.paymentOptions) ?? void 0;
|
|
20303
|
+
default:
|
|
20304
|
+
return void 0;
|
|
20305
|
+
}
|
|
20306
|
+
}
|
|
20307
|
+
function getDefaultStringComponentValue(stringOptions) {
|
|
20308
|
+
switch (stringOptions?.componentType) {
|
|
20309
|
+
case InputFieldStringComponentType.DATE_TIME:
|
|
20310
|
+
return stringOptions?.dateTimeOptions?.default;
|
|
20311
|
+
case InputFieldStringComponentType.DATE_INPUT:
|
|
20312
|
+
return stringOptions?.dateInputOptions?.default;
|
|
20313
|
+
case InputFieldStringComponentType.DATE_PICKER:
|
|
20314
|
+
return stringOptions?.datePickerOptions?.default;
|
|
20315
|
+
case InputFieldStringComponentType.TEXT_INPUT:
|
|
20316
|
+
return stringOptions?.textInputOptions?.default;
|
|
20317
|
+
case InputFieldStringComponentType.TIME_INPUT:
|
|
20318
|
+
return stringOptions?.timeInputOptions?.default;
|
|
20319
|
+
default:
|
|
20320
|
+
return void 0;
|
|
20321
|
+
}
|
|
20322
|
+
}
|
|
20323
|
+
function getDefaultNumberComponentValue(numberOptions) {
|
|
20324
|
+
switch (numberOptions?.componentType) {
|
|
20325
|
+
case InputFieldNumberComponentType.NUMBER_INPUT:
|
|
20326
|
+
return numberOptions?.numberInputOptions?.default;
|
|
20327
|
+
case InputFieldNumberComponentType.RATING_INPUT:
|
|
20328
|
+
return numberOptions?.ratingInputOptions?.defaultValue;
|
|
20329
|
+
default:
|
|
20330
|
+
return void 0;
|
|
20331
|
+
}
|
|
20332
|
+
}
|
|
20333
|
+
function getDefaultPaymentComponentValue(paymentOptions) {
|
|
20334
|
+
switch (paymentOptions?.componentType) {
|
|
20335
|
+
case InputFieldPaymentComponentType.PAYMENT_INPUT:
|
|
20336
|
+
return paymentOptions?.paymentInputOptions?.default;
|
|
20337
|
+
default:
|
|
20338
|
+
return void 0;
|
|
20339
|
+
}
|
|
20340
|
+
}
|
|
20341
|
+
var init_default_value_utils = __esm({
|
|
20342
|
+
"../form-validator/dist/esm/lib/schema-validation/default-value-utils.js"() {
|
|
20343
|
+
init_types_impl();
|
|
20344
|
+
}
|
|
20345
|
+
});
|
|
20346
|
+
|
|
20279
20347
|
// ../form-validator/dist/esm/lib/schema-validation/form-schema-validator.js
|
|
20280
20348
|
var FormSchemaValidator;
|
|
20281
20349
|
var init_form_schema_validator = __esm({
|
|
20282
20350
|
"../form-validator/dist/esm/lib/schema-validation/form-schema-validator.js"() {
|
|
20283
20351
|
init_types_impl();
|
|
20284
20352
|
init_string_format_options_mapper();
|
|
20353
|
+
init_default_value_utils();
|
|
20285
20354
|
FormSchemaValidator = class {
|
|
20286
20355
|
constructor(submissionValidator) {
|
|
20287
20356
|
this.submissionValidator = submissionValidator;
|
|
20288
20357
|
}
|
|
20289
20358
|
validate(form, timezone) {
|
|
20290
20359
|
const submission = form.formFields?.reduce((acc, { inputOptions }) => {
|
|
20291
|
-
const defaultValue =
|
|
20360
|
+
const defaultValue = getDefaultValue(inputOptions);
|
|
20292
20361
|
const target = inputOptions?.target;
|
|
20293
20362
|
if (defaultValue && target) {
|
|
20294
20363
|
acc[target] = this.buildSubmissionValue(defaultValue, inputOptions, timezone);
|
|
@@ -20300,52 +20369,6 @@ var init_form_schema_validator = __esm({
|
|
|
20300
20369
|
}
|
|
20301
20370
|
return { errors: [] };
|
|
20302
20371
|
}
|
|
20303
|
-
getDefaultValue(field) {
|
|
20304
|
-
switch (field?.inputType) {
|
|
20305
|
-
case InputFieldInputType.STRING:
|
|
20306
|
-
return this.getDefaultStringComponentValue(field.stringOptions) ?? void 0;
|
|
20307
|
-
case InputFieldInputType.NUMBER:
|
|
20308
|
-
return this.getDefaultNumberComponentValue(field.numberOptions) ?? void 0;
|
|
20309
|
-
case InputFieldInputType.PAYMENT:
|
|
20310
|
-
return this.getDefaultPaymentComponentValue(field.paymentOptions) ?? void 0;
|
|
20311
|
-
default:
|
|
20312
|
-
return void 0;
|
|
20313
|
-
}
|
|
20314
|
-
}
|
|
20315
|
-
getDefaultStringComponentValue(stringOptions) {
|
|
20316
|
-
switch (stringOptions?.componentType) {
|
|
20317
|
-
case InputFieldStringComponentType.DATE_TIME:
|
|
20318
|
-
return stringOptions?.dateTimeOptions?.default;
|
|
20319
|
-
case InputFieldStringComponentType.DATE_INPUT:
|
|
20320
|
-
return stringOptions?.dateInputOptions?.default;
|
|
20321
|
-
case InputFieldStringComponentType.DATE_PICKER:
|
|
20322
|
-
return stringOptions?.datePickerOptions?.default;
|
|
20323
|
-
case InputFieldStringComponentType.TEXT_INPUT:
|
|
20324
|
-
return stringOptions?.textInputOptions?.default;
|
|
20325
|
-
case InputFieldStringComponentType.TIME_INPUT:
|
|
20326
|
-
return stringOptions?.timeInputOptions?.default;
|
|
20327
|
-
default:
|
|
20328
|
-
return void 0;
|
|
20329
|
-
}
|
|
20330
|
-
}
|
|
20331
|
-
getDefaultNumberComponentValue(numberOptions) {
|
|
20332
|
-
switch (numberOptions?.componentType) {
|
|
20333
|
-
case InputFieldNumberComponentType.NUMBER_INPUT:
|
|
20334
|
-
return numberOptions?.numberInputOptions?.default;
|
|
20335
|
-
case InputFieldNumberComponentType.RATING_INPUT:
|
|
20336
|
-
return numberOptions?.ratingInputOptions?.defaultValue;
|
|
20337
|
-
default:
|
|
20338
|
-
return void 0;
|
|
20339
|
-
}
|
|
20340
|
-
}
|
|
20341
|
-
getDefaultPaymentComponentValue(paymentOptions) {
|
|
20342
|
-
switch (paymentOptions?.componentType) {
|
|
20343
|
-
case InputFieldPaymentComponentType.PAYMENT_INPUT:
|
|
20344
|
-
return paymentOptions?.paymentInputOptions?.default;
|
|
20345
|
-
default:
|
|
20346
|
-
return void 0;
|
|
20347
|
-
}
|
|
20348
|
-
}
|
|
20349
20372
|
buildSubmissionValue(defaultValue, inputField, timezone) {
|
|
20350
20373
|
switch (inputField.inputType) {
|
|
20351
20374
|
case InputFieldInputType.PAYMENT:
|
|
@@ -20381,6 +20404,7 @@ __export(esm_exports, {
|
|
|
20381
20404
|
FormValidator: () => FormValidator,
|
|
20382
20405
|
ValidationMode: () => ValidationMode,
|
|
20383
20406
|
compareSchemaBackwardCompatibility: () => compareSchemaBackwardCompatibility,
|
|
20407
|
+
getDefaultValue: () => getDefaultValue,
|
|
20384
20408
|
groupErrorsByTarget: () => groupErrorsByTarget,
|
|
20385
20409
|
validatePremiumRestrictions: () => validatePremiumRestrictions
|
|
20386
20410
|
});
|
|
@@ -20390,6 +20414,7 @@ var init_esm2 = __esm({
|
|
|
20390
20414
|
init_compare_shema_backward_compatibility();
|
|
20391
20415
|
init_validate_premium_restrictions();
|
|
20392
20416
|
init_form_schema_validator();
|
|
20417
|
+
init_default_value_utils();
|
|
20393
20418
|
init_errors();
|
|
20394
20419
|
init_calling_country_codes();
|
|
20395
20420
|
init_error_derivation();
|
|
@@ -25964,7 +25989,8 @@ var defaultErrorKeys = {
|
|
|
25964
25989
|
[ErrorType.EXACT_ITEMS_NUMBER_ERROR]: "input.error.message.exact-items-number-error",
|
|
25965
25990
|
[ErrorType.DECIMAL_POINT_ERROR]: "input.error.message.decimal_point_error",
|
|
25966
25991
|
[ErrorType.INCOMPLETE_DATE_ERROR]: "input.error.message.incomplete-date-error",
|
|
25967
|
-
[ErrorType.INVALID_VALUE_FOR_PATTERN_ERROR]: "input.error.message.invalid-value-for-pattern"
|
|
25992
|
+
[ErrorType.INVALID_VALUE_FOR_PATTERN_ERROR]: "input.error.message.invalid-value-for-pattern",
|
|
25993
|
+
[ErrorType.INVALID_DEFAULT_VALUE_ERROR]: "input.error.message.invalid-default-value-error"
|
|
25968
25994
|
};
|
|
25969
25995
|
var getTranslatedError = (_ref) => {
|
|
25970
25996
|
let {
|