@zohoim/client-sdk 1.0.0-poc67 → 1.0.0-poc69
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.
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
export default class ResponseUtils {
|
|
2
|
-
static adaptListResponse(response, adapter) {
|
|
3
|
-
if (!response) {
|
|
2
|
+
static async adaptListResponse(response, adapter) {
|
|
3
|
+
if (!response || !adapter) {
|
|
4
4
|
return response;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
if (!response.data) {
|
|
7
|
+
if (!response.data || !adapter) {
|
|
8
8
|
return response;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
return { ...response,
|
|
12
|
-
data: response.data.map(item => adapter(item))
|
|
12
|
+
data: await Promise.all(response.data.map(item => adapter(item)))
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
static adaptSingleResponse(response, adapter) {
|
|
17
|
-
if (!response) {
|
|
17
|
+
if (!response || !adapter) {
|
|
18
18
|
return response;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { ValidationError } from "../errors";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
-
}
|
|
1
|
+
import { ValidationError } from "../errors"; // function validateSchemaKeys(schema, data) {
|
|
2
|
+
// Object.keys(schema).forEach((key) => {
|
|
3
|
+
// if (!(key in data)) {
|
|
4
|
+
// throw new ValidationError(`Key '${key}' is missing in the data`);
|
|
5
|
+
// }
|
|
6
|
+
// });
|
|
7
|
+
// }
|
|
10
8
|
|
|
11
9
|
function isEmpty(value) {
|
|
12
10
|
if (value === null || value === undefined || value === '') {
|
|
@@ -44,8 +42,8 @@ export const validateSchema = (schema, data) => {
|
|
|
44
42
|
const validate = function (schemaObj, dataObj) {
|
|
45
43
|
let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
46
44
|
// Check if all schema keys exist in data
|
|
47
|
-
validateSchemaKeys(schemaObj, dataObj);
|
|
48
|
-
|
|
45
|
+
// validateSchemaKeys(schemaObj, dataObj);
|
|
46
|
+
// Validate each field
|
|
49
47
|
Object.entries(schemaObj).forEach(_ref3 => {
|
|
50
48
|
let [field, rules] = _ref3;
|
|
51
49
|
const value = dataObj[field];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const uiConfig = {
|
|
2
|
+
theme: {
|
|
3
|
+
primaryColor: '#1A73E8'
|
|
4
|
+
},
|
|
5
|
+
labels: {
|
|
6
|
+
session: {},
|
|
7
|
+
conversation: {}
|
|
8
|
+
},
|
|
9
|
+
renderers: {
|
|
10
|
+
session: {},
|
|
11
|
+
conversation: {
|
|
12
|
+
renderInfoMessage: () => {},
|
|
13
|
+
getHoverActions: () => {}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
navigation: {}
|
|
17
|
+
};
|
|
18
|
+
const serviceInfo = {
|
|
19
|
+
serviceName: 'desk',
|
|
20
|
+
bundledServiceName: 'crmPlus'
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohoim/client-sdk",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-poc69",
|
|
4
4
|
"description": "To have the client sdk for the IM",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"docs": "react-cli docs"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@zohoim/http-client": "1.0.0
|
|
28
|
+
"@zohoim/http-client": "1.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@zohodesk-private/client_dev_cert": "1.0.5",
|