@wix/form-public 0.15.0 → 0.17.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/_tsup-dts-rollup.d.cts +7 -7
- package/dist/_tsup-dts-rollup.d.ts +7 -7
- package/dist/index.cjs +14 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/package.json +11 -3
|
@@ -12,13 +12,6 @@ export declare const CheckboxGroupMapper: PropsMapper;
|
|
|
12
12
|
|
|
13
13
|
export declare const CheckboxMapper: PropsMapper;
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* Deeply converts all object keys from snake_case to camelCase
|
|
17
|
-
* @param obj - The object to convert
|
|
18
|
-
* @returns The object with all nested keys converted to camelCase
|
|
19
|
-
*/
|
|
20
|
-
export declare function convertKeysToCamelCase<T = unknown>(obj: T): T;
|
|
21
|
-
|
|
22
15
|
export declare type Currency = {
|
|
23
16
|
sign?: string;
|
|
24
17
|
code?: string;
|
|
@@ -71,6 +64,13 @@ export declare const ImageChoiceMapper: PropsMapper;
|
|
|
71
64
|
|
|
72
65
|
export declare const MultilineAddressMapper: PropsMapper;
|
|
73
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Normalizes object schema by removing underscore prefixes and converting keys to camelCase
|
|
69
|
+
* @param obj - The object to normalize
|
|
70
|
+
* @returns The object with all nested keys normalized
|
|
71
|
+
*/
|
|
72
|
+
export declare function normalizeSchema<T = unknown>(obj: T): T;
|
|
73
|
+
|
|
74
74
|
export declare const NumberInputMapper: PropsMapper;
|
|
75
75
|
|
|
76
76
|
export declare const PaymentInputMapper: PropsMapper;
|
|
@@ -12,13 +12,6 @@ export declare const CheckboxGroupMapper: PropsMapper;
|
|
|
12
12
|
|
|
13
13
|
export declare const CheckboxMapper: PropsMapper;
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* Deeply converts all object keys from snake_case to camelCase
|
|
17
|
-
* @param obj - The object to convert
|
|
18
|
-
* @returns The object with all nested keys converted to camelCase
|
|
19
|
-
*/
|
|
20
|
-
export declare function convertKeysToCamelCase<T = unknown>(obj: T): T;
|
|
21
|
-
|
|
22
15
|
export declare type Currency = {
|
|
23
16
|
sign?: string;
|
|
24
17
|
code?: string;
|
|
@@ -71,6 +64,13 @@ export declare const ImageChoiceMapper: PropsMapper;
|
|
|
71
64
|
|
|
72
65
|
export declare const MultilineAddressMapper: PropsMapper;
|
|
73
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Normalizes object schema by removing underscore prefixes and converting keys to camelCase
|
|
69
|
+
* @param obj - The object to normalize
|
|
70
|
+
* @returns The object with all nested keys normalized
|
|
71
|
+
*/
|
|
72
|
+
export declare function normalizeSchema<T = unknown>(obj: T): T;
|
|
73
|
+
|
|
74
74
|
export declare const NumberInputMapper: PropsMapper;
|
|
75
75
|
|
|
76
76
|
export declare const PaymentInputMapper: PropsMapper;
|
package/dist/index.cjs
CHANGED
|
@@ -20487,7 +20487,8 @@ var COMMON_FIELD_TYPES = {
|
|
|
20487
20487
|
};
|
|
20488
20488
|
var SHEDULING_FIELD_TYPES = {
|
|
20489
20489
|
APPOINTMENT: "APPOINTMENT",
|
|
20490
|
-
SERVICES_DROPDOWN: "SERVICES_DROPDOWN"
|
|
20490
|
+
SERVICES_DROPDOWN: "SERVICES_DROPDOWN",
|
|
20491
|
+
SERVICES_MULTI_CHOICE: "SERVICES_MULTI_CHOICE"
|
|
20491
20492
|
};
|
|
20492
20493
|
var PAYMENTS_FIELD_TYPES = {
|
|
20493
20494
|
PRODUCT_LIST: "PRODUCT_LIST",
|
|
@@ -28296,7 +28297,8 @@ var ADDITIONAL_FIELD_VALIDATION = {
|
|
|
28296
28297
|
[FIELD_TYPES.BOOKINGS_ADDRESS]: null,
|
|
28297
28298
|
[FIELD_TYPES.APPOINTMENT]: null,
|
|
28298
28299
|
[FIELD_TYPES.IDENTITY_PASSWORD]: null,
|
|
28299
|
-
[FIELD_TYPES.SERVICES_DROPDOWN]: null
|
|
28300
|
+
[FIELD_TYPES.SERVICES_DROPDOWN]: null,
|
|
28301
|
+
[FIELD_TYPES.SERVICES_MULTI_CHOICE]: null
|
|
28300
28302
|
};
|
|
28301
28303
|
|
|
28302
28304
|
// ../form-viewer/dist/esm/services/get-field-errors.js
|
|
@@ -28683,7 +28685,8 @@ var NORMALIZED_VALUE = {
|
|
|
28683
28685
|
[FIELD_TYPES.BOOKINGS_ADDRESS]: normalizeMultilineAddress,
|
|
28684
28686
|
[FIELD_TYPES.APPOINTMENT]: acceptObjectValue,
|
|
28685
28687
|
[FIELD_TYPES.IDENTITY_PASSWORD]: acceptStringValue,
|
|
28686
|
-
[FIELD_TYPES.SERVICES_DROPDOWN]: acceptStringValue
|
|
28688
|
+
[FIELD_TYPES.SERVICES_DROPDOWN]: acceptStringValue,
|
|
28689
|
+
[FIELD_TYPES.SERVICES_MULTI_CHOICE]: removeInvalidOptions
|
|
28687
28690
|
};
|
|
28688
28691
|
function keepValueUnchanged({ fieldValue }) {
|
|
28689
28692
|
return fieldValue;
|
|
@@ -29979,19 +29982,19 @@ var FIELD_TYPE_MAP = {
|
|
|
29979
29982
|
RICH_TEXT: "TEXT",
|
|
29980
29983
|
SUBMIT_BUTTON: "SUBMIT_BUTTON"
|
|
29981
29984
|
};
|
|
29982
|
-
function
|
|
29985
|
+
function normalizeSchema(obj) {
|
|
29983
29986
|
if (Array.isArray(obj)) {
|
|
29984
|
-
return obj.map(
|
|
29987
|
+
return obj.map(normalizeSchema);
|
|
29985
29988
|
}
|
|
29986
29989
|
if (obj !== null && typeof obj === "object") {
|
|
29987
|
-
const converted = mapKeys__default.default(
|
|
29988
|
-
|
|
29989
|
-
|
|
29990
|
-
);
|
|
29990
|
+
const converted = mapKeys__default.default(obj, (_23, key) => {
|
|
29991
|
+
const keyWithoutUnderscore = key.startsWith("_") ? key.substring(1) : key;
|
|
29992
|
+
return camelCase__default.default(keyWithoutUnderscore);
|
|
29993
|
+
});
|
|
29991
29994
|
return Object.fromEntries(
|
|
29992
29995
|
Object.entries(converted).map(([key, value]) => [
|
|
29993
29996
|
key,
|
|
29994
|
-
|
|
29997
|
+
normalizeSchema(value)
|
|
29995
29998
|
])
|
|
29996
29999
|
);
|
|
29997
30000
|
}
|
|
@@ -30017,7 +30020,7 @@ var Form2 = ({
|
|
|
30017
30020
|
errors,
|
|
30018
30021
|
onValidate
|
|
30019
30022
|
}) => {
|
|
30020
|
-
const form =
|
|
30023
|
+
const form = normalizeSchema(unformattedForm);
|
|
30021
30024
|
const siteConfig = {
|
|
30022
30025
|
locale: {
|
|
30023
30026
|
languageCode: "en"
|