@wix/form-public 0.16.0 → 0.18.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 +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +17 -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
|
@@ -29982,19 +29982,19 @@ var FIELD_TYPE_MAP = {
|
|
|
29982
29982
|
RICH_TEXT: "TEXT",
|
|
29983
29983
|
SUBMIT_BUTTON: "SUBMIT_BUTTON"
|
|
29984
29984
|
};
|
|
29985
|
-
function
|
|
29985
|
+
function normalizeSchema(obj) {
|
|
29986
29986
|
if (Array.isArray(obj)) {
|
|
29987
|
-
return obj.map(
|
|
29987
|
+
return obj.map(normalizeSchema);
|
|
29988
29988
|
}
|
|
29989
29989
|
if (obj !== null && typeof obj === "object") {
|
|
29990
|
-
const converted = mapKeys__default.default(
|
|
29991
|
-
|
|
29992
|
-
|
|
29993
|
-
);
|
|
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
|
+
});
|
|
29994
29994
|
return Object.fromEntries(
|
|
29995
29995
|
Object.entries(converted).map(([key, value]) => [
|
|
29996
29996
|
key,
|
|
29997
|
-
|
|
29997
|
+
normalizeSchema(value)
|
|
29998
29998
|
])
|
|
29999
29999
|
);
|
|
30000
30000
|
}
|
|
@@ -30020,7 +30020,7 @@ var Form2 = ({
|
|
|
30020
30020
|
errors,
|
|
30021
30021
|
onValidate
|
|
30022
30022
|
}) => {
|
|
30023
|
-
const form =
|
|
30023
|
+
const form = normalizeSchema(unformattedForm);
|
|
30024
30024
|
const siteConfig = {
|
|
30025
30025
|
locale: {
|
|
30026
30026
|
languageCode: "en"
|