@shipengine/js-api 4.5.0 → 4.5.1

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/index.js CHANGED
@@ -1071,9 +1071,9 @@ const getEndUserIpAddress = () => __async$7(void 0, null, function* () {
1071
1071
  }
1072
1072
  });
1073
1073
 
1074
- const camelizeKeys = (obj) => {
1074
+ const camelizeKeys = (obj, parentKey) => {
1075
1075
  if (Array.isArray(obj)) {
1076
- return obj.map(camelizeKeys);
1076
+ return obj.map((item) => camelizeKeys(item, parentKey));
1077
1077
  } else if (obj !== null && typeof obj === "object") {
1078
1078
  const newObj = {};
1079
1079
  for (const key in obj) {
@@ -1093,7 +1093,11 @@ const camelizeKeys = (obj) => {
1093
1093
  newKey += char;
1094
1094
  }
1095
1095
  }
1096
- newObj[newKey] = camelizeKeys(obj[key]);
1096
+ if (parentKey === "formSchema" && ["jsonSchema", "uiSchema", "brandedContent"].includes(newKey)) {
1097
+ newObj[newKey] = obj[key];
1098
+ } else {
1099
+ newObj[newKey] = camelizeKeys(obj[key], newKey);
1100
+ }
1097
1101
  }
1098
1102
  }
1099
1103
  return newObj;
package/index.mjs CHANGED
@@ -1067,9 +1067,9 @@ const getEndUserIpAddress = () => __async$7(void 0, null, function* () {
1067
1067
  }
1068
1068
  });
1069
1069
 
1070
- const camelizeKeys = (obj) => {
1070
+ const camelizeKeys = (obj, parentKey) => {
1071
1071
  if (Array.isArray(obj)) {
1072
- return obj.map(camelizeKeys);
1072
+ return obj.map((item) => camelizeKeys(item, parentKey));
1073
1073
  } else if (obj !== null && typeof obj === "object") {
1074
1074
  const newObj = {};
1075
1075
  for (const key in obj) {
@@ -1089,7 +1089,11 @@ const camelizeKeys = (obj) => {
1089
1089
  newKey += char;
1090
1090
  }
1091
1091
  }
1092
- newObj[newKey] = camelizeKeys(obj[key]);
1092
+ if (parentKey === "formSchema" && ["jsonSchema", "uiSchema", "brandedContent"].includes(newKey)) {
1093
+ newObj[newKey] = obj[key];
1094
+ } else {
1095
+ newObj[newKey] = camelizeKeys(obj[key], newKey);
1096
+ }
1093
1097
  }
1094
1098
  }
1095
1099
  return newObj;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "4.5.0",
3
+ "version": "4.5.1",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -1,2 +1,2 @@
1
- export declare const camelizeKeys: (obj: any) => any;
1
+ export declare const camelizeKeys: (obj: any, parentKey?: string) => any;
2
2
  export declare const decamelizeKeys: (obj: any, separator?: string) => any;