@zohoim/client-sdk 1.0.0-poc44 → 1.0.0-poc46

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,4 +1,5 @@
1
- import HTTP_METHODS from "./HttpMethods";
1
+ import { HttpMethods } from '@zohoim/http-client';
2
2
  import ModuleNames from "./ModuleNames";
3
3
  const IM_API_PREFIX = '/api/v1';
4
+ const HTTP_METHODS = HttpMethods;
4
5
  export { ModuleNames, IM_API_PREFIX, HTTP_METHODS };
@@ -8,6 +8,14 @@ function validateSchemaKeys(schema, data) {
8
8
  });
9
9
  }
10
10
 
11
+ function isEmpty(value) {
12
+ if (value === null || value === undefined || value === '') {
13
+ return true;
14
+ }
15
+
16
+ return false;
17
+ }
18
+
11
19
  function validateRequiredCheck(_ref) {
12
20
  let {
13
21
  value,
@@ -15,7 +23,7 @@ function validateRequiredCheck(_ref) {
15
23
  path
16
24
  } = _ref;
17
25
 
18
- if (rules.required && !value) {
26
+ if (rules.required && isEmpty(value)) {
19
27
  throw new ValidationError(rules.message || `${path} is required`);
20
28
  }
21
29
  }
@@ -2,7 +2,7 @@ import { ActorType } from "../../enum";
2
2
  const ActorSchema = {
3
3
  name: {
4
4
  type: 'string',
5
- required: true
5
+ required: false
6
6
  },
7
7
  type: {
8
8
  type: 'string',
@@ -19,7 +19,7 @@ const ActorSchema = {
19
19
  },
20
20
  id: {
21
21
  type: 'string',
22
- required: true
22
+ required: false
23
23
  },
24
24
  email: {
25
25
  type: 'string',
@@ -29,7 +29,7 @@ const SessionSchema = {
29
29
  },
30
30
  subject: {
31
31
  type: 'string',
32
- required: true
32
+ required: false
33
33
  },
34
34
  messagesCount: {
35
35
  type: 'string',
@@ -67,7 +67,7 @@ const SessionSchema = {
67
67
  },
68
68
  contactId: {
69
69
  type: 'string',
70
- required: true
70
+ required: false
71
71
  },
72
72
  meta: {
73
73
  type: 'array',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohoim/client-sdk",
3
- "version": "1.0.0-poc44",
3
+ "version": "1.0.0-poc46",
4
4
  "description": "To have the client sdk for the IM",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",
@@ -24,6 +24,9 @@
24
24
  "test": "react-cli test",
25
25
  "docs": "react-cli docs"
26
26
  },
27
+ "dependencies": {
28
+ "@zohoim/http-client": "1.0.0-poc12"
29
+ },
27
30
  "devDependencies": {
28
31
  "@zohodesk-private/client_dev_cert": "1.0.5",
29
32
  "@zohodesk/client_build_tool": "0.0.6-exp.37",
@@ -1,8 +0,0 @@
1
- const HTTP_METHODS = {
2
- GET: 'GET',
3
- POST: 'POST',
4
- PUT: 'PUT',
5
- PATCH: 'PATCH',
6
- DELETE: 'DELETE'
7
- };
8
- export default HTTP_METHODS;