@zohoim/client-sdk 1.0.0-poc49 → 1.0.0-poc50

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.
Files changed (120) hide show
  1. package/es/application/services/agents/AgentService.js +21 -0
  2. package/es/application/services/agents/index.js +2 -0
  3. package/es/application/services/contacts/ContactService.js +26 -0
  4. package/es/application/services/contacts/index.js +2 -0
  5. package/es/application/services/index.js +4 -1
  6. package/es/application/services/messages/MessageService.js +56 -0
  7. package/es/application/services/messages/index.js +2 -0
  8. package/es/application/services/sessions/SessionService.js +31 -1
  9. package/es/core/constants/ModuleNames.js +4 -1
  10. package/es/domain/dto/agents/getAgentsRequest.js +12 -0
  11. package/es/domain/dto/agents/index.js +1 -0
  12. package/es/domain/dto/bots/index.js +1 -2
  13. package/es/domain/dto/channels/agents/index.js +1 -2
  14. package/es/domain/dto/contacts/getContactsRequest.js +10 -0
  15. package/es/domain/dto/contacts/index.js +2 -0
  16. package/es/domain/dto/contacts/searchContactsRequest.js +11 -0
  17. package/es/domain/dto/index.js +4 -1
  18. package/es/domain/dto/messages/deleteMessageRequest.js +14 -0
  19. package/es/domain/dto/messages/getFullContentRequest.js +14 -0
  20. package/es/domain/dto/messages/getMessagesRequest.js +20 -0
  21. package/es/domain/dto/messages/getSearchedMessagesRequest.js +22 -0
  22. package/es/domain/dto/messages/index.js +8 -0
  23. package/es/domain/dto/messages/initiateSessionRequest.js +21 -0
  24. package/es/domain/dto/messages/resendMessageRequest.js +14 -0
  25. package/es/domain/dto/messages/sendAttachmentRequest.js +20 -0
  26. package/es/domain/dto/messages/sendMessageRequest.js +17 -0
  27. package/es/domain/dto/sessions/getSessionAttachmentsRequest.js +13 -0
  28. package/es/domain/dto/sessions/getSessionLastMessagesRequest.js +13 -0
  29. package/es/domain/dto/sessions/getSessionRequest.js +13 -0
  30. package/es/domain/dto/sessions/getSessionsRequest.js +26 -0
  31. package/es/domain/dto/sessions/index.js +7 -2
  32. package/es/domain/dto/sessions/markSessionAsReadRequest.js +13 -0
  33. package/es/domain/dto/sessions/updateSessionStatusRequest.js +17 -0
  34. package/es/domain/entities/Attachment/Attachment.js +22 -0
  35. package/es/domain/entities/Attachment/index.js +2 -0
  36. package/es/domain/entities/Contact/Contact.js +22 -0
  37. package/es/domain/entities/Contact/index.js +2 -0
  38. package/es/domain/entities/Message/Action.js +19 -0
  39. package/es/domain/entities/Message/ExternalInfo.js +17 -0
  40. package/es/domain/entities/Message/Info.js +21 -0
  41. package/es/domain/entities/Message/Location.js +18 -0
  42. package/es/domain/entities/Message/Message.js +45 -0
  43. package/es/domain/entities/Message/MessageWithSession.js +21 -0
  44. package/es/domain/entities/Message/index.js +6 -0
  45. package/es/domain/entities/index.js +4 -1
  46. package/es/domain/enum/actor/ActorType.js +2 -1
  47. package/es/domain/enum/index.js +2 -1
  48. package/es/domain/enum/message/MessageContentType.js +6 -0
  49. package/es/domain/enum/message/MessageDirection.js +6 -0
  50. package/es/domain/enum/message/MessageStatus.js +11 -0
  51. package/es/domain/enum/message/MessageType.js +11 -0
  52. package/es/domain/enum/message/index.js +5 -0
  53. package/es/domain/interfaces/repositories/agents/IAgentRepository.js +9 -0
  54. package/es/domain/interfaces/repositories/agents/index.js +2 -0
  55. package/es/domain/interfaces/repositories/contacts/IContactRepository.js +14 -0
  56. package/es/domain/interfaces/repositories/contacts/index.js +2 -0
  57. package/es/domain/interfaces/repositories/index.js +4 -1
  58. package/es/domain/interfaces/repositories/messages/IMessageRepository.js +43 -0
  59. package/es/domain/interfaces/repositories/messages/index.js +2 -0
  60. package/es/domain/interfaces/repositories/sessions/ISessionRepository.js +32 -2
  61. package/es/domain/schema/attachment/AttachmentSchema.js +27 -0
  62. package/es/domain/schema/attachment/index.js +2 -0
  63. package/es/domain/schema/contact/ContactSchema.js +27 -0
  64. package/es/domain/schema/contact/index.js +2 -0
  65. package/es/domain/schema/index.js +4 -1
  66. package/es/domain/schema/message/ActionSchema.js +15 -0
  67. package/es/domain/schema/message/ExternalInfoSchema.js +7 -0
  68. package/es/domain/schema/message/InfoSchema.js +21 -0
  69. package/es/domain/schema/message/LocationSchema.js +11 -0
  70. package/es/domain/schema/message/MessageSchema.js +112 -0
  71. package/es/domain/schema/message/MessageWithSessionSchema.js +10 -0
  72. package/es/domain/schema/message/index.js +7 -0
  73. package/es/frameworks/managers/ModuleFactory.js +27 -0
  74. package/es/frameworks/managers/ModuleManager.js +1 -1
  75. package/es/frameworks/sdk/IMSDK.js +15 -0
  76. package/es/frameworks/sdk/agents/AgentSDK.js +30 -0
  77. package/es/frameworks/sdk/agents/index.js +2 -0
  78. package/es/frameworks/sdk/contacts/ContactSDK.js +30 -0
  79. package/es/frameworks/sdk/contacts/index.js +2 -0
  80. package/es/frameworks/sdk/messages/MessageSDK.js +32 -0
  81. package/es/frameworks/sdk/messages/index.js +2 -0
  82. package/es/frameworks/sdk/sessions/SessionSDK.js +6 -2
  83. package/es/infrastructure/adapters/agents/agentAdapter.js +27 -0
  84. package/es/infrastructure/adapters/agents/index.js +2 -0
  85. package/es/infrastructure/adapters/attachments/AttachmentAdapter.js +24 -0
  86. package/es/infrastructure/adapters/attachments/index.js +2 -0
  87. package/es/infrastructure/adapters/contacts/contactAdapter.js +24 -0
  88. package/es/infrastructure/adapters/contacts/index.js +2 -0
  89. package/es/infrastructure/adapters/index.js +5 -1
  90. package/es/infrastructure/adapters/message/MessageAdapter.js +41 -0
  91. package/es/infrastructure/adapters/message/MessageWithSessionAdapter.js +23 -0
  92. package/es/infrastructure/adapters/message/index.js +2 -0
  93. package/es/infrastructure/api/agents/AgentAPI.js +21 -0
  94. package/es/infrastructure/api/agents/index.js +2 -0
  95. package/es/infrastructure/api/contacts/ContactAPI.js +31 -0
  96. package/es/infrastructure/api/contacts/index.js +2 -0
  97. package/es/infrastructure/api/index.js +4 -1
  98. package/es/infrastructure/api/messages/MessageAPI.js +91 -0
  99. package/es/infrastructure/api/messages/index.js +2 -0
  100. package/es/infrastructure/api/registry/agents/agentAPIRegistry.js +12 -0
  101. package/es/infrastructure/api/registry/agents/constructAgentEndPoint.js +10 -0
  102. package/es/infrastructure/api/registry/agents/index.js +2 -0
  103. package/es/infrastructure/api/registry/contacts/constructContactEndPoint.js +10 -0
  104. package/es/infrastructure/api/registry/contacts/contactAPIRegistry.js +17 -0
  105. package/es/infrastructure/api/registry/contacts/index.js +2 -0
  106. package/es/infrastructure/api/registry/getRegistryConfig.js +7 -1
  107. package/es/infrastructure/api/registry/messages/constructMessageEndPoint.js +10 -0
  108. package/es/infrastructure/api/registry/messages/index.js +2 -0
  109. package/es/infrastructure/api/registry/messages/messageAPIRegistry.js +57 -0
  110. package/es/infrastructure/api/registry/sessions/sessionAPIRegistry.js +37 -3
  111. package/es/infrastructure/api/sessions/SessionAPI.js +61 -1
  112. package/es/infrastructure/repositories/agents/AgentRepository.js +27 -0
  113. package/es/infrastructure/repositories/agents/index.js +2 -0
  114. package/es/infrastructure/repositories/contacts/ContactRepository.js +33 -0
  115. package/es/infrastructure/repositories/contacts/index.js +2 -0
  116. package/es/infrastructure/repositories/index.js +4 -1
  117. package/es/infrastructure/repositories/messages/MessageRepository.js +72 -0
  118. package/es/infrastructure/repositories/messages/index.js +2 -0
  119. package/es/infrastructure/repositories/sessions/SessionRepository.js +43 -3
  120. package/package.json +1 -1
@@ -0,0 +1,45 @@
1
+ import { validateSchema } from "../../../core/utils";
2
+ import { MessageSchema } from "../../schema";
3
+ import { Actor } from "../Actor";
4
+ import { Attachment } from "../Attachment";
5
+ import Action from "./Action";
6
+ import ExternalInfo from "./ExternalInfo";
7
+ import Info from "./Info";
8
+ import Location from "./Location";
9
+ export default class Message {
10
+ constructor() {
11
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
+ const validatedData = validateSchema(MessageSchema, data);
13
+ this.data = {
14
+ id: validatedData.id,
15
+ sessionId: validatedData.sessionId,
16
+ displayMessage: validatedData.displayMessage,
17
+ statusUpdatedTime: validatedData.statusUpdatedTime,
18
+ actor: new Actor(validatedData.actor).toJSON(),
19
+ direction: validatedData.direction,
20
+ createdTime: validatedData.createdTime,
21
+ index: validatedData.index,
22
+ replyToMessage: validatedData.replyToMessage ? new Message(validatedData.replyToMessage).toJSON() : null,
23
+ status: validatedData.status,
24
+ info: validatedData.info ? new Info(validatedData.info).toJSON() : null,
25
+ location: validatedData.location ? new Location(validatedData.location).toJSON() : null,
26
+ externalInfo: validatedData.externalInfo ? new ExternalInfo(validatedData.externalInfo).toJSON() : null,
27
+ layout: validatedData.layout,
28
+ action: validatedData.action ? new Action(validatedData.action).toJSON() : null,
29
+ meta: validatedData.meta,
30
+ contentType: validatedData.contentType,
31
+ fullContentURL: validatedData.fullContentURL,
32
+ attachment: validatedData.attachment ? new Attachment(validatedData.attachment).toJSON() : null,
33
+ template: validatedData.template,
34
+ type: validatedData.type,
35
+ isRead: validatedData.isRead,
36
+ article: validatedData.article
37
+ };
38
+ }
39
+
40
+ toJSON() {
41
+ return { ...this.data
42
+ };
43
+ }
44
+
45
+ }
@@ -0,0 +1,21 @@
1
+ import { validateSchema } from "../../../core/utils";
2
+ import { MessageWithSessionSchema } from "../../schema";
3
+ import { Session } from "../Session";
4
+ import Message from "./Message";
5
+ export default class MessageWithSession {
6
+ constructor() {
7
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
+ const validatedData = validateSchema(MessageWithSessionSchema, data);
9
+ const messageData = new Message(validatedData).toJSON();
10
+ const sessionData = new Session(validatedData.session).toJSON();
11
+ this.data = { ...messageData,
12
+ session: sessionData
13
+ };
14
+ }
15
+
16
+ toJSON() {
17
+ return { ...this.data
18
+ };
19
+ }
20
+
21
+ }
@@ -0,0 +1,6 @@
1
+ export { default as Message } from "./Message";
2
+ export { default as Info } from "./Info";
3
+ export { default as Action } from "./Action";
4
+ export { default as ExternalInfo } from "./ExternalInfo";
5
+ export { default as Location } from "./Location";
6
+ export { default as MessageWithSession } from "./MessageWithSession";
@@ -2,4 +2,7 @@ export * from "./Actor";
2
2
  export * from "./Agent";
3
3
  export * from "./Session";
4
4
  export * from "./Bot";
5
- export * from "./Channel";
5
+ export * from "./Attachment";
6
+ export * from "./Message";
7
+ export * from "./Channel";
8
+ export * from "./Contact";
@@ -1,6 +1,7 @@
1
1
  const ActorType = {
2
2
  AGENT: 'AGENT',
3
3
  BOT: 'BOT',
4
- ENDUSER: 'ENDUSER'
4
+ ENDUSER: 'ENDUSER',
5
+ SYSTEM: 'SYSTEM'
5
6
  };
6
7
  export default ActorType;
@@ -1,4 +1,5 @@
1
1
  export * from "./integrationServices";
2
2
  export * from "./session";
3
3
  export * from "./actor";
4
- export * from "./bot";
4
+ export * from "./bot";
5
+ export * from "./message";
@@ -0,0 +1,6 @@
1
+ const MessageContentType = {
2
+ HTML_TEXT: 'text/html',
3
+ PLAIN_TEXT: 'text/plain',
4
+ APPLICATION_JSON: 'application/json'
5
+ };
6
+ export default MessageContentType;
@@ -0,0 +1,6 @@
1
+ const MessageDirection = {
2
+ OUT: 'OUT',
3
+ IN: 'IN'
4
+ }; // For im api need to changes this as out and in
5
+
6
+ export default MessageDirection;
@@ -0,0 +1,11 @@
1
+ const MessageStatus = {
2
+ SAVED: 'SAVED',
3
+ FAILED: 'FAILED',
4
+ QUEUED: 'QUEUED',
5
+ SENT: 'SENT',
6
+ DELIVERED: 'DELIVERED',
7
+ READ: 'READ',
8
+ DELETED: 'DELETED',
9
+ MISSED: 'MISSED'
10
+ };
11
+ export default MessageStatus;
@@ -0,0 +1,11 @@
1
+ const MessageTypes = {
2
+ TEXT: 'TEXT',
3
+ INFO: 'INFO',
4
+ ATTACHMENT: 'ATTACHMENT',
5
+ LOCATION: 'LOCATION',
6
+ LAYOUT: 'LAYOUT',
7
+ EXTERNAL_INFO: 'EXTERNAL_INFO',
8
+ TEMPLATE: 'TEMPLATE',
9
+ ACTION: 'ACTION'
10
+ };
11
+ export default MessageTypes;
@@ -0,0 +1,5 @@
1
+ import MessageTypes from "./MessageType";
2
+ import MessageStatus from "./MessageStatus";
3
+ import MessageDirection from "./MessageDirection";
4
+ import MessageContentType from "./MessageContentType";
5
+ export { MessageTypes, MessageStatus, MessageDirection, MessageContentType };
@@ -0,0 +1,9 @@
1
+ import { getAgentsRequest } from "../../../dto";
2
+ export default class IAgentRepository {
3
+ // eslint-disable-next-line no-unused-vars
4
+ async getAgents() {
5
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getAgentsRequest();
6
+ throw new Error('Method not implemented');
7
+ }
8
+
9
+ }
@@ -0,0 +1,2 @@
1
+ import IAgentRepository from "./IAgentRepository";
2
+ export { IAgentRepository };
@@ -0,0 +1,14 @@
1
+ import { getContactsRequest, searchContactsRequest } from "../../../dto";
2
+ export default class IContactRepository {
3
+ // eslint-disable-next-line no-unused-vars
4
+ async getContacts() {
5
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getContactsRequest();
6
+ throw new Error('Method not implemented');
7
+ }
8
+
9
+ async searchContacts() {
10
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : searchContactsRequest();
11
+ throw new Error('Method not implemented');
12
+ }
13
+
14
+ }
@@ -0,0 +1,2 @@
1
+ import IContactRepository from "./IContactRepository";
2
+ export { IContactRepository };
@@ -1,3 +1,6 @@
1
1
  export * from "./channels";
2
2
  export * from "./sessions";
3
- export * from "./bots";
3
+ export * from "./bots";
4
+ export * from "./messages";
5
+ export * from "./agents";
6
+ export * from "./contacts";
@@ -0,0 +1,43 @@
1
+ /* eslint-disable no-unused-vars */
2
+ import { getMessagesRequest, deleteMessageRequest, getFullContentRequest, resendMessageRequest, sendAttachmentRequest, sendMessageRequest, initiateSessionRequest } from "../../../dto";
3
+ export default class IMessageRepository {
4
+ getMessages() {
5
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getMessagesRequest();
6
+ throw new Error('Method not implemented.');
7
+ }
8
+
9
+ getFullContent() {
10
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getFullContentRequest();
11
+ throw new Error('Method not implemented.');
12
+ }
13
+
14
+ sendMessage() {
15
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : sendMessageRequest();
16
+ throw new Error('Method not implemented.');
17
+ }
18
+
19
+ sendAttachment() {
20
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : sendAttachmentRequest();
21
+ throw new Error('Method not implemented.');
22
+ }
23
+
24
+ resendMessage() {
25
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : resendMessageRequest();
26
+ throw new Error('Method not implemented.');
27
+ }
28
+
29
+ deleteMessage() {
30
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : deleteMessageRequest();
31
+ throw new Error('Method not implemented.');
32
+ }
33
+
34
+ initiateSession() {
35
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initiateSessionRequest();
36
+ throw new Error('Method not implemented.');
37
+ }
38
+
39
+ getSearchedMessages() {
40
+ throw new Error('Method not implemented.');
41
+ }
42
+
43
+ }
@@ -0,0 +1,2 @@
1
+ import IMessageRepository from "./IMessageRepository";
2
+ export { IMessageRepository };
@@ -1,9 +1,39 @@
1
- import { updateSessionAssigneeRequest } from "../../../dto";
1
+ /* eslint-disable no-unused-vars */
2
+ import { updateSessionAssigneeRequest, getSessionsRequest, getSessionRequest, getSessionAttachmentsRequest, getSessionLastMessagesRequest, markSessionAsReadRequest, updateSessionStatusRequest } from "../../../dto";
2
3
  export default class ISessionRepository {
3
- // eslint-disable-next-line no-unused-vars
4
4
  updateAssignee() {
5
5
  let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updateSessionAssigneeRequest();
6
6
  throw new Error('Method not implemented.');
7
7
  }
8
8
 
9
+ getSessions() {
10
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getSessionsRequest();
11
+ throw new Error('Method not implemented.');
12
+ }
13
+
14
+ getSession() {
15
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getSessionRequest();
16
+ throw new Error('Method not implemented.');
17
+ }
18
+
19
+ getSessionAttachments() {
20
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getSessionAttachmentsRequest();
21
+ throw new Error('Method not implemented.');
22
+ }
23
+
24
+ getSessionLastMessages() {
25
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getSessionLastMessagesRequest();
26
+ throw new Error('Method not implemented.');
27
+ }
28
+
29
+ markSessionAsRead() {
30
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : markSessionAsReadRequest();
31
+ throw new Error('Method not implemented.');
32
+ }
33
+
34
+ updateSessionStatus() {
35
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updateSessionStatusRequest();
36
+ throw new Error('Method not implemented.');
37
+ }
38
+
9
39
  }
@@ -0,0 +1,27 @@
1
+ const AttachmentSchema = {
2
+ id: {
3
+ type: 'string',
4
+ required: true
5
+ },
6
+ name: {
7
+ type: 'string',
8
+ required: true
9
+ },
10
+ type: {
11
+ type: 'string',
12
+ required: true
13
+ },
14
+ createdTime: {
15
+ type: 'string',
16
+ required: false
17
+ },
18
+ size: {
19
+ type: 'number',
20
+ required: true
21
+ },
22
+ url: {
23
+ type: 'string',
24
+ required: true
25
+ }
26
+ };
27
+ export default AttachmentSchema;
@@ -0,0 +1,2 @@
1
+ import AttachmentSchema from "./AttachmentSchema";
2
+ export { AttachmentSchema };
@@ -0,0 +1,27 @@
1
+ const ContactSchema = {
2
+ id: {
3
+ type: 'string',
4
+ required: true
5
+ },
6
+ name: {
7
+ type: 'string',
8
+ required: true
9
+ },
10
+ email: {
11
+ type: 'string',
12
+ required: false
13
+ },
14
+ photoURL: {
15
+ type: 'string',
16
+ required: false
17
+ },
18
+ phone: {
19
+ type: 'string',
20
+ required: false
21
+ },
22
+ mobile: {
23
+ type: 'string',
24
+ required: false
25
+ }
26
+ };
27
+ export default ContactSchema;
@@ -0,0 +1,2 @@
1
+ import ContactSchema from "./ContactSchema";
2
+ export { ContactSchema };
@@ -1,5 +1,8 @@
1
1
  export * from "./actor";
2
2
  export * from "./session";
3
3
  export * from "./bot";
4
+ export * from "./attachment";
5
+ export * from "./message";
4
6
  export * from "./channel";
5
- export * from "./integrationService";
7
+ export * from "./integrationService";
8
+ export * from "./contact";
@@ -0,0 +1,15 @@
1
+ const ActionSchema = {
2
+ type: {
3
+ type: 'string',
4
+ required: true
5
+ },
6
+ subType: {
7
+ type: 'string',
8
+ required: true
9
+ },
10
+ value: {
11
+ type: 'string',
12
+ required: false
13
+ }
14
+ };
15
+ export default ActionSchema;
@@ -0,0 +1,7 @@
1
+ const ExternalInfoSchema = {
2
+ action: {
3
+ type: 'string',
4
+ required: true
5
+ }
6
+ };
7
+ export default ExternalInfoSchema;
@@ -0,0 +1,21 @@
1
+ import { ActorSchema } from "../actor";
2
+ const InfoSchema = {
3
+ actor: {
4
+ type: 'object',
5
+ required: false,
6
+ schema: ActorSchema
7
+ },
8
+ action: {
9
+ type: 'string',
10
+ required: true
11
+ },
12
+ sessionStatus: {
13
+ type: 'string',
14
+ required: false
15
+ },
16
+ targets: {
17
+ type: 'array',
18
+ required: false
19
+ }
20
+ };
21
+ export default InfoSchema;
@@ -0,0 +1,11 @@
1
+ const LocationSchema = {
2
+ latitude: {
3
+ type: 'string',
4
+ required: true
5
+ },
6
+ longitude: {
7
+ type: 'string',
8
+ required: true
9
+ }
10
+ };
11
+ export default LocationSchema;
@@ -0,0 +1,112 @@
1
+ import { MessageStatus, MessageTypes, MessageDirection, MessageContentType } from "../../enum/message";
2
+ import { ActorSchema } from "../actor";
3
+ import { AttachmentSchema } from "../attachment";
4
+ import LocationSchema from "./LocationSchema";
5
+ import ActionSchema from "./ActionSchema";
6
+ import ExternalInfoSchema from "./ExternalInfoSchema";
7
+ import InfoSchema from "./InfoSchema";
8
+ const MessageSchema = {
9
+ id: {
10
+ type: 'string',
11
+ required: true
12
+ },
13
+ sessionId: {
14
+ type: 'string',
15
+ required: true
16
+ },
17
+ displayMessage: {
18
+ type: 'string',
19
+ required: false
20
+ },
21
+ statusUpdatedTime: {
22
+ type: 'string',
23
+ required: true
24
+ },
25
+ actor: {
26
+ type: 'object',
27
+ required: true,
28
+ schema: ActorSchema
29
+ },
30
+ direction: {
31
+ type: 'string',
32
+ required: true,
33
+ enum: Object.values(MessageDirection)
34
+ },
35
+ createdTime: {
36
+ type: 'string',
37
+ required: true
38
+ },
39
+ index: {
40
+ type: 'string',
41
+ required: true
42
+ },
43
+ replyToMessage: {
44
+ type: 'object',
45
+ required: false
46
+ },
47
+ status: {
48
+ type: 'string',
49
+ required: true,
50
+ enum: Object.values(MessageStatus)
51
+ },
52
+ info: {
53
+ type: 'object',
54
+ required: false,
55
+ schema: InfoSchema
56
+ },
57
+ location: {
58
+ type: 'object',
59
+ required: false,
60
+ schema: LocationSchema
61
+ },
62
+ externalInfo: {
63
+ type: 'object',
64
+ required: false,
65
+ schema: ExternalInfoSchema
66
+ },
67
+ layout: {
68
+ type: 'object',
69
+ required: false
70
+ },
71
+ action: {
72
+ type: 'object',
73
+ required: false,
74
+ action: ActionSchema
75
+ },
76
+ meta: {
77
+ type: 'array',
78
+ required: false
79
+ },
80
+ contentType: {
81
+ type: 'string',
82
+ required: true,
83
+ enum: Object.values(MessageContentType)
84
+ },
85
+ fullContentURL: {
86
+ type: 'string',
87
+ required: false
88
+ },
89
+ attachment: {
90
+ type: 'object',
91
+ required: false,
92
+ schema: AttachmentSchema
93
+ },
94
+ template: {
95
+ type: 'object',
96
+ required: false
97
+ },
98
+ type: {
99
+ type: 'string',
100
+ required: true,
101
+ enum: Object.values(MessageTypes)
102
+ },
103
+ isRead: {
104
+ type: 'boolean',
105
+ required: true
106
+ },
107
+ article: {
108
+ type: 'object',
109
+ required: false
110
+ }
111
+ };
112
+ export default MessageSchema;
@@ -0,0 +1,10 @@
1
+ import { SessionSchema } from "../session";
2
+ import MessageSchema from "./MessageSchema";
3
+ const MessageWithSessionSchema = { ...MessageSchema,
4
+ session: {
5
+ type: 'object',
6
+ required: true,
7
+ schema: SessionSchema
8
+ }
9
+ };
10
+ export default MessageWithSessionSchema;
@@ -0,0 +1,7 @@
1
+ import MessageSchema from "./MessageSchema";
2
+ import ActionSchema from "./ActionSchema";
3
+ import ExternalInfoSchema from "./ExternalInfoSchema";
4
+ import InfoSchema from "./InfoSchema";
5
+ import LocationSchema from "./LocationSchema";
6
+ import MessageWithSessionSchema from "./MessageWithSessionSchema";
7
+ export { MessageSchema, ActionSchema, ExternalInfoSchema, InfoSchema, LocationSchema, MessageWithSessionSchema };
@@ -2,6 +2,9 @@ import { ModuleNames } from "../../core/constants";
2
2
  import { BotSDK } from "../sdk/bots";
3
3
  import { ChannelSDK } from "../sdk/channels";
4
4
  import { SessionSDK } from "../sdk/sessions";
5
+ import { MessageSDK } from "../sdk/messages";
6
+ import { AgentSDK } from "../sdk/agents";
7
+ import { ContactSDK } from "../sdk/contacts";
5
8
  const ModuleFactory = {
6
9
  [ModuleNames.CHANNELS]: _ref => {
7
10
  let {
@@ -26,6 +29,30 @@ const ModuleFactory = {
26
29
  return new BotSDK({
27
30
  config
28
31
  }).toJSON();
32
+ },
33
+ [ModuleNames.AGENTS]: _ref4 => {
34
+ let {
35
+ config
36
+ } = _ref4;
37
+ return new AgentSDK({
38
+ config
39
+ }).toJSON();
40
+ },
41
+ [ModuleNames.CONTACTS]: _ref5 => {
42
+ let {
43
+ config
44
+ } = _ref5;
45
+ return new ContactSDK({
46
+ config
47
+ }).toJSON();
48
+ },
49
+ [ModuleNames.MESSAGES]: _ref6 => {
50
+ let {
51
+ config
52
+ } = _ref6;
53
+ return new MessageSDK({
54
+ config
55
+ }).toJSON();
29
56
  }
30
57
  };
31
58
  export default ModuleFactory;
@@ -3,7 +3,7 @@ import ModuleFactory from "./ModuleFactory";
3
3
  export default class ModuleManager {
4
4
  constructor() {
5
5
  this._modules = new Map();
6
- this.supportedModules = [ModuleNames.CHANNELS, ModuleNames.SESSIONS, ModuleNames.BOTS];
6
+ this.supportedModules = [ModuleNames.CHANNELS, ModuleNames.SESSIONS, ModuleNames.BOTS, ModuleNames.MESSAGES, ModuleNames.AGENTS, ModuleNames.CONTACTS];
7
7
  }
8
8
 
9
9
  initialize(_ref) {
@@ -31,6 +31,18 @@ export default class IMSDK {
31
31
  return this._moduleManager.getModule(ModuleNames.BOTS);
32
32
  }
33
33
 
34
+ get messages() {
35
+ return this._moduleManager.getModule(ModuleNames.MESSAGES);
36
+ }
37
+
38
+ get agents() {
39
+ return this._moduleManager.getModule(ModuleNames.AGENTS);
40
+ }
41
+
42
+ get contacts() {
43
+ return this._moduleManager.getModule(ModuleNames.CONTACTS);
44
+ }
45
+
34
46
  hasModule(moduleName) {
35
47
  return this._moduleManager.hasModule(moduleName);
36
48
  }
@@ -40,6 +52,9 @@ export default class IMSDK {
40
52
  channels: this.channels,
41
53
  sessions: this.sessions,
42
54
  bots: this.bots,
55
+ messages: this.messages,
56
+ agents: this.agents,
57
+ contacts: this.contacts,
43
58
  hasModule: this.hasModule.bind(this)
44
59
  };
45
60
  }
@@ -0,0 +1,30 @@
1
+ import { AgentService } from "../../../application/services";
2
+ import { AgentRepository } from "../../../infrastructure/repositories";
3
+
4
+ class AgentSDK {
5
+ constructor(_ref) {
6
+ const {
7
+ config
8
+ } = _ref;
9
+ const {
10
+ agentAPI,
11
+ agentAdapter
12
+ } = config;
13
+ const agentRepository = new AgentRepository({
14
+ agentAPI,
15
+ agentAdapter
16
+ }).toJSON();
17
+ const agentService = new AgentService({
18
+ agentRepository
19
+ }).toJSON();
20
+ this.services = { ...agentService
21
+ };
22
+ }
23
+
24
+ toJSON() {
25
+ return this.services;
26
+ }
27
+
28
+ }
29
+
30
+ export default AgentSDK;
@@ -0,0 +1,2 @@
1
+ import AgentSDK from "./AgentSDK";
2
+ export { AgentSDK };