@zohoim/client-sdk 1.0.0-poc69 → 1.0.0-poc70

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.
@@ -0,0 +1,33 @@
1
+ import { validateSchema } from "../../../core/utils";
2
+ import { IntegrationServices } from "../../enum";
3
+ import { IntegrationServiceSchema } from "../../schema";
4
+ export default class IntegrationService {
5
+ constructor() {
6
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ const validatedData = validateSchema(IntegrationServiceSchema, data);
8
+ this.data = {
9
+ label: validatedData.label || '',
10
+ id: validatedData.id || '',
11
+ provider: validatedData.provider || {},
12
+ logoURL: validatedData.logoURL || null
13
+ };
14
+ }
15
+
16
+ static isWhatsApp(integrationServiceId) {
17
+ return integrationServiceId === IntegrationServices.WHATSAPP;
18
+ }
19
+
20
+ static isTwilio(integrationServiceId) {
21
+ return integrationServiceId === IntegrationServices.TWILIO;
22
+ }
23
+
24
+ static isBusinessMessaging(integrationServiceId) {
25
+ return integrationServiceId === IntegrationServices.IM_TALK;
26
+ }
27
+
28
+ toJSON() {
29
+ return { ...this.data
30
+ };
31
+ }
32
+
33
+ }
@@ -0,0 +1,2 @@
1
+ import IntegrationService from "./IntegrationService";
2
+ export { IntegrationService };
@@ -1,4 +1,5 @@
1
1
  import { validateSchema } from "../../../core/utils";
2
+ import { MessageDirection, MessageStatus, MessageTypes } from "../../enum";
2
3
  import { MessageSchema } from "../../schema";
3
4
  import { Actor } from "../Actor";
4
5
  import { Attachment } from "../Attachment";
@@ -37,6 +38,26 @@ export default class Message {
37
38
  };
38
39
  }
39
40
 
41
+ static isLocationMessage(type) {
42
+ return type === MessageTypes.LOCATION;
43
+ }
44
+
45
+ static isDeletedMessage(status) {
46
+ return status === MessageStatus.DELETED;
47
+ }
48
+
49
+ static isOutgoing(direction) {
50
+ return direction === MessageDirection.OUT;
51
+ }
52
+
53
+ static isInfoMessage(type) {
54
+ return type === MessageTypes.INFO;
55
+ }
56
+
57
+ static isAttachment(type) {
58
+ return type === MessageTypes.ATTACHMENT;
59
+ }
60
+
40
61
  toJSON() {
41
62
  return { ...this.data
42
63
  };
@@ -1,7 +1,7 @@
1
1
  import { validateSchema } from "../../../core/utils";
2
2
  import { SessionSchema } from "../../schema";
3
3
  import { Actor } from "../Actor";
4
- import { IntegrationServices, SessionReplyStatus, SessionStatus } from "../../enum";
4
+ import { SessionReplyStatus, SessionStatus } from "../../enum";
5
5
  export default class Session {
6
6
  constructor() {
7
7
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -28,18 +28,6 @@ export default class Session {
28
28
  };
29
29
  }
30
30
 
31
- static isWhatsApp(integrationServiceId) {
32
- return integrationServiceId === IntegrationServices.WHATSAPP;
33
- }
34
-
35
- static isTwilio(integrationServiceId) {
36
- return integrationServiceId === IntegrationServices.TWILIO;
37
- }
38
-
39
- static isIMTalk(integrationServiceId) {
40
- return integrationServiceId === IntegrationServices.IM_TALK;
41
- }
42
-
43
31
  static isEnded(sessionStatus) {
44
32
  return sessionStatus === SessionStatus.ENDED;
45
33
  }
@@ -5,4 +5,5 @@ export * from "./Bot";
5
5
  export * from "./Attachment";
6
6
  export * from "./Message";
7
7
  export * from "./Channel";
8
- export * from "./Contact";
8
+ export * from "./Contact";
9
+ export * from "./IntegrationService";
@@ -5,6 +5,6 @@ const SessionStatus = {
5
5
  ON_HOLD: 'ON_HOLD',
6
6
  ENDED: 'ENDED',
7
7
  BLOCKED: 'BLOCKED',
8
- UN_ASSIGNED: 'UNASSIGNED'
8
+ UNASSIGNED: 'UNASSIGNED'
9
9
  };
10
10
  export default SessionStatus;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohoim/client-sdk",
3
- "version": "1.0.0-poc69",
3
+ "version": "1.0.0-poc70",
4
4
  "description": "To have the client sdk for the IM",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",
@@ -1,21 +0,0 @@
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
- };