@zohoim/client-sdk 0.0.5 → 1.0.0-calls1

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 (134) hide show
  1. package/es/application/services/calls/CallService.js +36 -0
  2. package/es/application/services/calls/index.js +1 -0
  3. package/es/application/services/cannedMessages/CannedMessageService.js +51 -0
  4. package/es/application/services/cannedMessages/index.js +2 -0
  5. package/es/application/services/index.js +4 -1
  6. package/es/application/services/templateMessages/TemplateMessageService.js +26 -0
  7. package/es/application/services/templateMessages/index.js +2 -0
  8. package/es/core/constants/ModuleNames.js +5 -1
  9. package/es/core/utils/validateSchema.js +60 -26
  10. package/es/domain/dto/calls/getCallRequest.js +14 -0
  11. package/es/domain/dto/calls/getCallsRequest.js +19 -0
  12. package/es/domain/dto/calls/index.js +4 -0
  13. package/es/domain/dto/calls/initiateCallRequest.js +15 -0
  14. package/es/domain/dto/calls/updateCallStatusRequest.js +16 -0
  15. package/es/domain/dto/cannedMessages/createCannedMessageRequest.js +18 -0
  16. package/es/domain/dto/cannedMessages/deleteCannedMessageRequest.js +13 -0
  17. package/es/domain/dto/cannedMessages/disableCannedMessageRequest.js +13 -0
  18. package/es/domain/dto/cannedMessages/enableCannedMessageRequest.js +13 -0
  19. package/es/domain/dto/cannedMessages/getCannedMessageRequest.js +13 -0
  20. package/es/domain/dto/cannedMessages/getCannedMessagesRequest.js +18 -0
  21. package/es/domain/dto/cannedMessages/index.js +7 -0
  22. package/es/domain/dto/cannedMessages/updateCannedMessageRequest.js +20 -0
  23. package/es/domain/dto/index.js +4 -1
  24. package/es/domain/dto/messages/initiateSessionRequest.js +2 -0
  25. package/es/domain/dto/sessions/getSessionsRequest.js +1 -0
  26. package/es/domain/dto/templateMessages/getTemplateCreditExhaustStatusRequest.js +16 -0
  27. package/es/domain/dto/templateMessages/getTemplateLanguagesRequest.js +7 -0
  28. package/es/domain/dto/templateMessages/index.js +2 -0
  29. package/es/domain/entities/Actor/Actor.js +5 -1
  30. package/es/domain/entities/Agent/Agent.js +5 -1
  31. package/es/domain/entities/Attachment/Attachment.js +5 -1
  32. package/es/domain/entities/Bot/Bot.js +5 -1
  33. package/es/domain/entities/Call/Call.js +44 -0
  34. package/es/domain/entities/Call/index.js +1 -0
  35. package/es/domain/entities/CannedMessage/CannedMessage.js +50 -0
  36. package/es/domain/entities/CannedMessage/index.js +2 -0
  37. package/es/domain/entities/Channel/Channel.js +5 -1
  38. package/es/domain/entities/Contact/Contact.js +5 -1
  39. package/es/domain/entities/CustomReplyExtension/CustomReplyExtension.js +26 -0
  40. package/es/domain/entities/CustomReplyExtension/index.js +2 -0
  41. package/es/domain/entities/IntegrationService/IntegrationService.js +5 -1
  42. package/es/domain/entities/Message/Action.js +5 -1
  43. package/es/domain/entities/Message/ExternalInfo.js +5 -1
  44. package/es/domain/entities/Message/Info.js +5 -1
  45. package/es/domain/entities/Message/InfoTarget.js +5 -1
  46. package/es/domain/entities/Message/Location.js +5 -1
  47. package/es/domain/entities/Message/Message.js +25 -2
  48. package/es/domain/entities/Message/MessageWithSession.js +5 -1
  49. package/es/domain/entities/Session/Session.js +5 -1
  50. package/es/domain/entities/TemplateMessage/TemplateCreditExhaustStatus.js +27 -0
  51. package/es/domain/entities/TemplateMessage/TemplateLanguage.js +22 -0
  52. package/es/domain/entities/TemplateMessage/index.js +3 -0
  53. package/es/domain/entities/index.js +5 -1
  54. package/es/domain/enum/call/CallStatus.js +8 -0
  55. package/es/domain/enum/call/index.js +1 -0
  56. package/es/domain/enum/cannedMessage/CannedMessageStatus.js +7 -0
  57. package/es/domain/enum/cannedMessage/CannedMessageType.js +5 -0
  58. package/es/domain/enum/cannedMessage/TemplateItemButtonType.js +6 -0
  59. package/es/domain/enum/cannedMessage/TemplateItemFooterType.js +4 -0
  60. package/es/domain/enum/cannedMessage/TemplateItemHeaderType.js +7 -0
  61. package/es/domain/enum/cannedMessage/index.js +6 -0
  62. package/es/domain/enum/index.js +4 -1
  63. package/es/domain/enum/message/MessageMeta.js +2 -1
  64. package/es/domain/enum/message/MetaMessageSourceType.js +6 -0
  65. package/es/domain/enum/message/index.js +2 -1
  66. package/es/domain/enum/templateMessage/TemplateCreditExhaustStatusCode.js +4 -0
  67. package/es/domain/enum/templateMessage/index.js +2 -0
  68. package/es/domain/interfaces/repositories/calls/ICallRepository.js +32 -0
  69. package/es/domain/interfaces/repositories/calls/index.js +1 -0
  70. package/es/domain/interfaces/repositories/cannedMessages/ICannedMessageRepository.js +47 -0
  71. package/es/domain/interfaces/repositories/cannedMessages/index.js +2 -0
  72. package/es/domain/interfaces/repositories/index.js +4 -1
  73. package/es/domain/interfaces/repositories/templateMessages/ITemplateMessageRepository.js +21 -0
  74. package/es/domain/interfaces/repositories/templateMessages/index.js +2 -0
  75. package/es/domain/schema/call/CallSchema.js +59 -0
  76. package/es/domain/schema/call/index.js +1 -0
  77. package/es/domain/schema/cannedMessage/CannedMessageSchema.js +61 -0
  78. package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemButtonsSchema.js +17 -0
  79. package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemFooterSchema.js +13 -0
  80. package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemHeaderSchema.js +19 -0
  81. package/es/domain/schema/cannedMessage/TemplateItem/index.js +4 -0
  82. package/es/domain/schema/cannedMessage/TemplateItemsSchema.js +21 -0
  83. package/es/domain/schema/cannedMessage/TranslationsSchema.js +43 -0
  84. package/es/domain/schema/cannedMessage/index.js +2 -0
  85. package/es/domain/schema/customReplyExtension/CustomReplyExtensionSchema.js +28 -0
  86. package/es/domain/schema/customReplyExtension/index.js +2 -0
  87. package/es/domain/schema/index.js +5 -1
  88. package/es/domain/schema/templateMessage/TemplateCreditExhaustStatusSchema.js +11 -0
  89. package/es/domain/schema/templateMessage/TemplateLanguageSchema.js +11 -0
  90. package/es/domain/schema/templateMessage/index.js +3 -0
  91. package/es/frameworks/managers/ModuleFactory.js +27 -0
  92. package/es/frameworks/managers/ModuleManager.js +1 -1
  93. package/es/frameworks/sdk/IMSDK.js +15 -0
  94. package/es/frameworks/sdk/calls/CallSDK.js +27 -0
  95. package/es/frameworks/sdk/calls/index.js +1 -0
  96. package/es/frameworks/sdk/cannedMessages/CannedMessageSDK.js +30 -0
  97. package/es/frameworks/sdk/cannedMessages/index.js +2 -0
  98. package/es/frameworks/sdk/templateMessages/TemplateMessageSDK.js +30 -0
  99. package/es/frameworks/sdk/templateMessages/index.js +2 -0
  100. package/es/infrastructure/adapters/calls/CallAdapter.js +30 -0
  101. package/es/infrastructure/adapters/calls/index.js +1 -0
  102. package/es/infrastructure/adapters/cannedMessages/CannedMessageAdapter.js +28 -0
  103. package/es/infrastructure/adapters/cannedMessages/index.js +2 -0
  104. package/es/infrastructure/adapters/customReplyExtension/CustomReplyExtensionAdapter.js +24 -0
  105. package/es/infrastructure/adapters/customReplyExtension/index.js +2 -0
  106. package/es/infrastructure/adapters/index.js +5 -1
  107. package/es/infrastructure/adapters/templateMessages/TemplateCreditExhaustStatusAdapter.js +20 -0
  108. package/es/infrastructure/adapters/templateMessages/TemplateLanguageAdapter.js +20 -0
  109. package/es/infrastructure/adapters/templateMessages/index.js +3 -0
  110. package/es/infrastructure/api/calls/CallAPI.js +44 -0
  111. package/es/infrastructure/api/calls/index.js +1 -0
  112. package/es/infrastructure/api/cannedMessages/CannedMessageAPI.js +74 -0
  113. package/es/infrastructure/api/cannedMessages/index.js +2 -0
  114. package/es/infrastructure/api/index.js +4 -1
  115. package/es/infrastructure/api/registry/calls/callAPIRegistry.js +29 -0
  116. package/es/infrastructure/api/registry/calls/constructCallEndPoint.js +10 -0
  117. package/es/infrastructure/api/registry/calls/index.js +1 -0
  118. package/es/infrastructure/api/registry/cannedMessages/cannedMessageAPIRegistry.js +42 -0
  119. package/es/infrastructure/api/registry/cannedMessages/constructCannedMessageEndPoint.js +10 -0
  120. package/es/infrastructure/api/registry/cannedMessages/index.js +2 -0
  121. package/es/infrastructure/api/registry/getRegistryConfig.js +7 -1
  122. package/es/infrastructure/api/registry/templateMessages/constructTemplateMessageEndPoint.js +11 -0
  123. package/es/infrastructure/api/registry/templateMessages/index.js +2 -0
  124. package/es/infrastructure/api/registry/templateMessages/templateMessageAPIRegistry.js +18 -0
  125. package/es/infrastructure/api/templateMessages/TemplateMessageAPI.js +24 -0
  126. package/es/infrastructure/api/templateMessages/index.js +2 -0
  127. package/es/infrastructure/repositories/calls/CallRepository.js +73 -0
  128. package/es/infrastructure/repositories/calls/index.js +1 -0
  129. package/es/infrastructure/repositories/cannedMessages/CannedMessageRepository.js +97 -0
  130. package/es/infrastructure/repositories/cannedMessages/index.js +2 -0
  131. package/es/infrastructure/repositories/index.js +4 -1
  132. package/es/infrastructure/repositories/templateMessages/TemplateMessageRepository.js +77 -0
  133. package/es/infrastructure/repositories/templateMessages/index.js +2 -0
  134. package/package.json +2 -2
@@ -0,0 +1,50 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { CannedMessageStatus } from '../../enum';
3
+ import { CannedMessageSchema } from '../../schema';
4
+ import { Actor } from '../Actor';
5
+ export default class CannedMessage {
6
+ constructor() {
7
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
+ const validatedData = validateSchema({
9
+ schema: CannedMessageSchema,
10
+ data,
11
+ entityName: 'CannedMessage'
12
+ });
13
+ this.data = {
14
+ id: validatedData.id,
15
+ title: validatedData.title,
16
+ message: validatedData.message,
17
+ tags: validatedData.tags,
18
+ status: validatedData.status,
19
+ uuid: validatedData.uuid,
20
+ createdBy: new Actor(validatedData.createdBy),
21
+ displayMessage: validatedData.displayMessage,
22
+ type: validatedData.type,
23
+ kind: validatedData.kind,
24
+ isActive: validatedData.isActive,
25
+ meta: validatedData.meta,
26
+ isPrivate: validatedData.isPrivate,
27
+ rejectionReason: validatedData.rejectionReason,
28
+ modifiedTime: validatedData.modifiedTime,
29
+ translations: validatedData.translations
30
+ };
31
+ }
32
+
33
+ static isApproved(status) {
34
+ return status === CannedMessageStatus.APPROVED;
35
+ }
36
+
37
+ static isRejected(status) {
38
+ return status === CannedMessageStatus.REJECTED;
39
+ }
40
+
41
+ static isPending(status) {
42
+ return status === CannedMessageStatus.PENDING;
43
+ }
44
+
45
+ toJSON() {
46
+ return { ...this.data
47
+ };
48
+ }
49
+
50
+ }
@@ -0,0 +1,2 @@
1
+ import CannedMessage from './CannedMessage';
2
+ export { CannedMessage };
@@ -3,7 +3,11 @@ import { ChannelSchema } from '../../schema';
3
3
  export default class Channel {
4
4
  constructor() {
5
5
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
- const validatedData = validateSchema(ChannelSchema, data); // Set required properties from schema
6
+ const validatedData = validateSchema({
7
+ schema: ChannelSchema,
8
+ data,
9
+ entityName: 'Channel'
10
+ }); // Set required properties from schema
7
11
 
8
12
  this.id = validatedData.id;
9
13
  this.integrationService = validatedData.integrationService;
@@ -3,7 +3,11 @@ import { ContactSchema } from '../../schema';
3
3
  export default class Contact {
4
4
  constructor() {
5
5
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
- const validatedData = validateSchema(ContactSchema, data);
6
+ const validatedData = validateSchema({
7
+ schema: ContactSchema,
8
+ data,
9
+ entityName: 'Contact'
10
+ });
7
11
  this.data = {
8
12
  id: validatedData.id,
9
13
  name: validatedData.name,
@@ -0,0 +1,26 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { CustomReplyExtensionSchema } from '../../schema';
3
+ export default class CustomReplyExtension {
4
+ constructor() {
5
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const validatedData = validateSchema({
7
+ schema: CustomReplyExtensionSchema,
8
+ data,
9
+ entityName: 'CustomReplyExtension'
10
+ });
11
+ this.data = {
12
+ id: validatedData.id,
13
+ title: validatedData.title,
14
+ message: validatedData.message,
15
+ displayMessage: validatedData.displayMessage,
16
+ webUrl: validatedData.webUrl || null,
17
+ categoryName: validatedData.categoryName
18
+ };
19
+ }
20
+
21
+ toJSON() {
22
+ return { ...this.data
23
+ };
24
+ }
25
+
26
+ }
@@ -0,0 +1,2 @@
1
+ import CustomReplyExtension from './CustomReplyExtension';
2
+ export { CustomReplyExtension };
@@ -4,7 +4,11 @@ import { IntegrationServiceSchema } from '../../schema';
4
4
  export default class IntegrationService {
5
5
  constructor() {
6
6
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
- const validatedData = validateSchema(IntegrationServiceSchema, data);
7
+ const validatedData = validateSchema({
8
+ schema: IntegrationServiceSchema,
9
+ data,
10
+ entityName: 'IntegrationService'
11
+ });
8
12
  this.data = {
9
13
  label: validatedData.label || '',
10
14
  id: validatedData.id || '',
@@ -4,7 +4,11 @@ import { ActionSchema } from '../../schema';
4
4
  export default class Action {
5
5
  constructor() {
6
6
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
- const validatedData = validateSchema(ActionSchema, data);
7
+ const validatedData = validateSchema({
8
+ schema: ActionSchema,
9
+ data,
10
+ entityName: 'Action'
11
+ });
8
12
  this.data = {
9
13
  type: validatedData.type,
10
14
  subType: validatedData.subType,
@@ -4,7 +4,11 @@ import { ExternalInfoSchema } from '../../schema';
4
4
  export default class ExternalInfo {
5
5
  constructor() {
6
6
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
- const validatedData = validateSchema(ExternalInfoSchema, data);
7
+ const validatedData = validateSchema({
8
+ schema: ExternalInfoSchema,
9
+ data,
10
+ entityName: 'ExternalInfo'
11
+ });
8
12
  this.data = {
9
13
  action: validatedData.action
10
14
  };
@@ -12,7 +12,11 @@ function adaptTargets() {
12
12
  export default class Info {
13
13
  constructor() {
14
14
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15
- const validatedData = validateSchema(InfoSchema, data);
15
+ const validatedData = validateSchema({
16
+ schema: InfoSchema,
17
+ data,
18
+ entityName: 'Info'
19
+ });
16
20
  this.data = {
17
21
  actor: new Actor(validatedData.actor).toJSON(),
18
22
  action: validatedData.action,
@@ -3,7 +3,11 @@ import { InfoTargetSchema } from '../../schema/message';
3
3
  export default class InfoTarget {
4
4
  constructor() {
5
5
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
- const validatedData = validateSchema(InfoTargetSchema, data);
6
+ const validatedData = validateSchema({
7
+ schema: InfoTargetSchema,
8
+ data,
9
+ entityName: 'InfoTarget'
10
+ });
7
11
  this.data = {
8
12
  id: validatedData.id,
9
13
  name: validatedData.name || null,
@@ -3,7 +3,11 @@ import { LocationSchema } from '../../schema';
3
3
  export default class Location {
4
4
  constructor() {
5
5
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
- const validatedData = validateSchema(LocationSchema, data);
6
+ const validatedData = validateSchema({
7
+ schema: LocationSchema,
8
+ data,
9
+ entityName: 'Location'
10
+ });
7
11
  this.data = {
8
12
  latitude: validatedData.latitude,
9
13
  longitude: validatedData.longitude
@@ -1,5 +1,5 @@
1
1
  import { validateSchema } from '../../../core/utils';
2
- import { MessageDirection, MessageStatus, MessageTypes, MessageMeta, MetaSystemMessageType } from '../../enum';
2
+ import { MessageDirection, MessageStatus, MessageTypes, MessageMeta, MetaSystemMessageType, MetaMessageSourceType } from '../../enum';
3
3
  import { MessageSchema } from '../../schema';
4
4
  import { Actor } from '../Actor';
5
5
  import { Attachment } from '../Attachment';
@@ -10,7 +10,11 @@ import Location from './Location';
10
10
  export default class Message {
11
11
  constructor() {
12
12
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13
- const validatedData = validateSchema(MessageSchema, data);
13
+ const validatedData = validateSchema({
14
+ schema: MessageSchema,
15
+ data,
16
+ entityName: 'Message'
17
+ });
14
18
  this.data = {
15
19
  id: validatedData.id,
16
20
  sessionId: validatedData.sessionId,
@@ -121,6 +125,25 @@ export default class Message {
121
125
  return messageType === MetaSystemMessageType.UN_SUPPORTED_FILE;
122
126
  }
123
127
 
128
+ static getMessageSourceValue(meta) {
129
+ return Message.getMetaValue(meta, MessageMeta.MESSAGE_SOURCE);
130
+ }
131
+
132
+ static isHistoryMessage(meta) {
133
+ const messageType = Message.getMessageSourceValue(meta);
134
+ return messageType === MetaMessageSourceType.HISTORY_MESSAGE;
135
+ }
136
+
137
+ static isHistoryMessageViaMobileWBApp(meta) {
138
+ const messageType = Message.getMessageSourceValue(meta);
139
+ return messageType === MetaMessageSourceType.HISTORY_MESSAGE_VIA_MOBILE_WHATSAPP_BUSINESS_APP;
140
+ }
141
+
142
+ static isMessageViaMobileWBApp(meta) {
143
+ const messageType = Message.getMessageSourceValue(meta);
144
+ return messageType === MetaMessageSourceType.VIA_MOBILE_WHATSAPP_BUSINESS_APP;
145
+ }
146
+
124
147
  static isFailed(status) {
125
148
  return status === MessageStatus.FAILED;
126
149
  }
@@ -5,7 +5,11 @@ import Message from './Message';
5
5
  export default class MessageWithSession {
6
6
  constructor() {
7
7
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
- const validatedData = validateSchema(MessageWithSessionSchema, data);
8
+ const validatedData = validateSchema({
9
+ schema: MessageWithSessionSchema,
10
+ data,
11
+ entityName: 'MessageWithSession'
12
+ });
9
13
  const messageData = new Message(validatedData).toJSON();
10
14
  const sessionData = new Session(validatedData.session).toJSON();
11
15
  this.data = { ...messageData,
@@ -5,7 +5,11 @@ 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] : {};
8
- const validatedData = validateSchema(SessionSchema, data);
8
+ const validatedData = validateSchema({
9
+ schema: SessionSchema,
10
+ data,
11
+ entityName: 'Session'
12
+ });
9
13
  this.data = {
10
14
  channelId: validatedData.channelId,
11
15
  status: validatedData.status,
@@ -0,0 +1,27 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { TemplateCreditExhaustStatusCode } from '../../enum';
3
+ import { TemplateCreditExhaustStatusSchema } from '../../schema';
4
+ export default class TemplateCreditExhaustStatus {
5
+ constructor() {
6
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ const validatedData = validateSchema({
8
+ schema: TemplateCreditExhaustStatusSchema,
9
+ data,
10
+ entityName: 'TemplateCreditExhaustStatus'
11
+ });
12
+ this.data = {
13
+ code: validatedData.code,
14
+ message: validatedData.message
15
+ };
16
+ }
17
+
18
+ static isInSufficientCredits(code) {
19
+ return code === TemplateCreditExhaustStatusCode.INSUFFICIENT_CREDITS;
20
+ }
21
+
22
+ toJSON() {
23
+ return { ...this.data
24
+ };
25
+ }
26
+
27
+ }
@@ -0,0 +1,22 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { TemplateLanguageSchema } from '../../schema';
3
+ export default class TemplateLanguage {
4
+ constructor() {
5
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const validatedData = validateSchema({
7
+ schema: TemplateLanguageSchema,
8
+ data,
9
+ entityName: 'TemplateLanguage'
10
+ });
11
+ this.data = {
12
+ code: validatedData.code,
13
+ language: validatedData.language
14
+ };
15
+ }
16
+
17
+ toJSON() {
18
+ return { ...this.data
19
+ };
20
+ }
21
+
22
+ }
@@ -0,0 +1,3 @@
1
+ import TemplateLanguage from './TemplateLanguage';
2
+ import TemplateCreditExhaustStatus from './TemplateCreditExhaustStatus';
3
+ export { TemplateLanguage, TemplateCreditExhaustStatus };
@@ -6,4 +6,8 @@ export * from './Attachment';
6
6
  export * from './Message';
7
7
  export * from './Channel';
8
8
  export * from './Contact';
9
- export * from './IntegrationService';
9
+ export * from './IntegrationService';
10
+ export * from './CannedMessage';
11
+ export * from './TemplateMessage';
12
+ export * from './CustomReplyExtension';
13
+ export * from './Call';
@@ -0,0 +1,8 @@
1
+ const CallStatus = {
2
+ INITIATED: 'INITIATED',
3
+ IN_PROGRESS: 'IN_PROGRESS',
4
+ ENDED: 'ENDED',
5
+ REJECTED: 'REJECTED',
6
+ MISSED: 'MISSED'
7
+ };
8
+ export default CallStatus;
@@ -0,0 +1 @@
1
+ export { default as CallStatus } from './CallStatus';
@@ -0,0 +1,7 @@
1
+ const CannedMessageStatus = {
2
+ APPROVED: 'APPROVED',
3
+ PENDING: 'PENDING',
4
+ REJECTED: 'REJECTED',
5
+ FAILED: 'FAILED'
6
+ };
7
+ export default CannedMessageStatus;
@@ -0,0 +1,5 @@
1
+ const CannedMessageType = {
2
+ CANNED: 'CANNED',
3
+ TEMPLATE: 'TEMPLATE'
4
+ };
5
+ export default CannedMessageType;
@@ -0,0 +1,6 @@
1
+ const TemplateItemButtonType = {
2
+ QUICK_REPLY: 'QUICK_REPLY',
3
+ URL: 'URL',
4
+ PHONE_NUMBER: 'PHONE_NUMBER'
5
+ };
6
+ export default TemplateItemButtonType;
@@ -0,0 +1,4 @@
1
+ const TemplateItemFooterType = {
2
+ TEXT: 'TEXT'
3
+ };
4
+ export default TemplateItemFooterType;
@@ -0,0 +1,7 @@
1
+ const TemplateItemHeaderType = {
2
+ IMAGE: 'IMAGE',
3
+ TEXT: 'TEXT',
4
+ VIDEO: 'VIDEO',
5
+ DOCUMENT: 'DOCUMENT'
6
+ };
7
+ export default TemplateItemHeaderType;
@@ -0,0 +1,6 @@
1
+ import CannedMessageStatus from './CannedMessageStatus';
2
+ import CannedMessageType from './CannedMessageType';
3
+ import TemplateItemHeaderType from './TemplateItemHeaderType';
4
+ import TemplateItemFooterType from './TemplateItemFooterType';
5
+ import TemplateItemButtonType from './TemplateItemButtonType';
6
+ export { CannedMessageStatus, CannedMessageType, TemplateItemHeaderType, TemplateItemFooterType, TemplateItemButtonType };
@@ -3,4 +3,7 @@ export * from './session';
3
3
  export * from './actor';
4
4
  export * from './bot';
5
5
  export * from './message';
6
- export * from './attachment';
6
+ export * from './attachment';
7
+ export * from './cannedMessage';
8
+ export * from './templateMessage';
9
+ export * from './call';
@@ -1,4 +1,5 @@
1
1
  const MessageMeta = {
2
- SYSTEM_MESSAGE_TYPE: 'SYSTEM_MESSAGE_TYPE'
2
+ SYSTEM_MESSAGE_TYPE: 'SYSTEM_MESSAGE_TYPE',
3
+ MESSAGE_SOURCE: 'MESSAGE_SOURCE'
3
4
  };
4
5
  export default MessageMeta;
@@ -0,0 +1,6 @@
1
+ const MetaMessageSourceType = {
2
+ HISTORY_MESSAGE_VIA_MOBILE_WHATSAPP_BUSINESS_APP: 'HISTORY_MESSAGE_VIA_MOBILE_WHATSAPP_BUSINESS_APP',
3
+ HISTORY_MESSAGE: 'HISTORY_MESSAGE',
4
+ VIA_MOBILE_WHATSAPP_BUSINESS_APP: 'VIA_MOBILE_WHATSAPP_BUSINESS_APP'
5
+ };
6
+ export default MetaMessageSourceType;
@@ -10,4 +10,5 @@ import InfoAction from './InfoAction';
10
10
  import ActionSubType from './ActionSubType';
11
11
  import InfoTargetType from './InfoTargetType';
12
12
  import MetaSystemMessageType from './MetaSystemMessageType';
13
- export { MessageTypes, MessageStatus, MessageDirection, MessageContentType, MessageMeta, ActionType, ActionSubType, ExternalInfoAction, InfoSessionStatus, InfoAction, InfoTargetType, MetaSystemMessageType };
13
+ import MetaMessageSourceType from './MetaMessageSourceType';
14
+ export { MessageTypes, MessageStatus, MessageDirection, MessageContentType, MessageMeta, ActionType, ActionSubType, ExternalInfoAction, InfoSessionStatus, InfoAction, InfoTargetType, MetaSystemMessageType, MetaMessageSourceType };
@@ -0,0 +1,4 @@
1
+ const TemplateCreditExhaustStatusCode = {
2
+ INSUFFICIENT_CREDITS: 'INSUFFICIENT_CREDITS'
3
+ };
4
+ export default TemplateCreditExhaustStatusCode;
@@ -0,0 +1,2 @@
1
+ import TemplateCreditExhaustStatusCode from './TemplateCreditExhaustStatusCode';
2
+ export { TemplateCreditExhaustStatusCode };
@@ -0,0 +1,32 @@
1
+ /* eslint-disable no-unused-vars */
2
+ import { ModuleNames } from '../../../../core/constants';
3
+ import BaseAPI from '../../../../infrastructure/api/BaseAPI';
4
+ import { getCallsRequest, getCallRequest, initiateCallRequest, updateCallStatusRequest } from '../../../dto';
5
+ export default class ICallRepository extends BaseAPI {
6
+ constructor() {
7
+ super({
8
+ module: ModuleNames.CALLS
9
+ });
10
+ }
11
+
12
+ getCalls() {
13
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCallsRequest();
14
+ throw new Error('Method not implemented.');
15
+ }
16
+
17
+ getCall() {
18
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCallRequest();
19
+ throw new Error('Method not implemented.');
20
+ }
21
+
22
+ updateCallStatus() {
23
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updateCallStatusRequest();
24
+ throw new Error('Method not implemented.');
25
+ }
26
+
27
+ initiateCall() {
28
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initiateCallRequest();
29
+ throw new Error('Method not implemented.');
30
+ }
31
+
32
+ }
@@ -0,0 +1 @@
1
+ export { default as ICallRepository } from './ICallRepository';
@@ -0,0 +1,47 @@
1
+ /* eslint-disable no-unused-vars */
2
+ import { ModuleNames } from '../../../../core/constants';
3
+ import BaseAPI from '../../../../infrastructure/api/BaseAPI';
4
+ import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, disableCannedMessageRequest, enableCannedMessageRequest } from '../../../dto';
5
+ export default class ICannedMessageRepository extends BaseAPI {
6
+ constructor() {
7
+ super({
8
+ module: ModuleNames.CANNED_MESSAGES
9
+ });
10
+ }
11
+
12
+ getCannedMessages() {
13
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCannedMessagesRequest();
14
+ throw new Error('Method not implemented.');
15
+ }
16
+
17
+ getCannedMessage() {
18
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCannedMessageRequest();
19
+ throw new Error('Method not implemented.');
20
+ }
21
+
22
+ createCannedMessage() {
23
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : createCannedMessageRequest();
24
+ throw new Error('Method not implemented.');
25
+ }
26
+
27
+ updateCannedMessage() {
28
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updateCannedMessageRequest();
29
+ throw new Error('Method not implemented.');
30
+ }
31
+
32
+ deleteCannedMessage() {
33
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : deleteCannedMessageRequest();
34
+ throw new Error('Method not implemented.');
35
+ }
36
+
37
+ enableCannedMessage() {
38
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : enableCannedMessageRequest();
39
+ throw new Error('Method not implemented.');
40
+ }
41
+
42
+ disableCannedMessage() {
43
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : disableCannedMessageRequest();
44
+ throw new Error('Method not implemented.');
45
+ }
46
+
47
+ }
@@ -0,0 +1,2 @@
1
+ import ICannedMessageRepository from './ICannedMessageRepository';
2
+ export { ICannedMessageRepository };
@@ -3,4 +3,7 @@ export * from './sessions';
3
3
  export * from './bots';
4
4
  export * from './messages';
5
5
  export * from './agents';
6
- export * from './contacts';
6
+ export * from './contacts';
7
+ export * from './cannedMessages';
8
+ export * from './templateMessages';
9
+ export * from './calls';
@@ -0,0 +1,21 @@
1
+ import { ModuleNames } from '../../../../core/constants';
2
+ import BaseAPI from '../../../../infrastructure/api/BaseAPI';
3
+ import { getTemplateCreditExhaustStatusRequest, getTemplateLanguagesRequest } from '../../../dto';
4
+ export default class ITemplateMessageRepository extends BaseAPI {
5
+ constructor() {
6
+ super({
7
+ module: ModuleNames.TEMPLATE_MESSAGES
8
+ });
9
+ }
10
+
11
+ async getTemplateLanguages() {
12
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getTemplateLanguagesRequest();
13
+ throw new Error('Method not implemented');
14
+ }
15
+
16
+ async getWhatsAppTemplateCreditExhaustStatus() {
17
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getTemplateCreditExhaustStatusRequest();
18
+ throw new Error('Method not implemented');
19
+ }
20
+
21
+ }
@@ -0,0 +1,2 @@
1
+ import ITemplateMessageRepository from './ITemplateMessageRepository';
2
+ export { ITemplateMessageRepository };
@@ -0,0 +1,59 @@
1
+ import { MessageDirection } from '../../enum/message';
2
+ import { CallStatus } from '../../enum/call';
3
+ import { ActorSchema } from '../actor';
4
+ import { IntegrationServices } from '../../enum';
5
+ const CallSchema = {
6
+ id: {
7
+ type: 'string',
8
+ required: true
9
+ },
10
+ actor: {
11
+ type: 'object',
12
+ required: true,
13
+ schema: ActorSchema
14
+ },
15
+ channelId: {
16
+ type: 'string',
17
+ required: true
18
+ },
19
+ createdTime: {
20
+ type: 'string',
21
+ required: true
22
+ },
23
+ direction: {
24
+ type: 'string',
25
+ required: true,
26
+ enum: Object.values(MessageDirection)
27
+ },
28
+ integrationServiceId: {
29
+ type: 'string',
30
+ required: true,
31
+ enum: Object.values(IntegrationServices)
32
+ },
33
+ meta: {
34
+ type: 'array',
35
+ required: false
36
+ },
37
+ participants: {
38
+ type: 'array',
39
+ required: false
40
+ },
41
+ sessionId: {
42
+ type: 'string',
43
+ required: true
44
+ },
45
+ session: {
46
+ type: 'object',
47
+ required: false
48
+ },
49
+ status: {
50
+ type: 'string',
51
+ required: true,
52
+ enum: Object.values(CallStatus)
53
+ },
54
+ statuses: {
55
+ type: 'array',
56
+ required: false
57
+ }
58
+ };
59
+ export default CallSchema;
@@ -0,0 +1 @@
1
+ export { default as CallSchema } from './CallSchema';