@zohoim/client-sdk 1.0.0-replyAreaPoc9 → 1.0.0-rightPanelSessionInfo-2

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 (239) 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 +21 -1
  4. package/es/application/services/channels/ChannelService.js +6 -1
  5. package/es/application/services/contacts/ContactService.js +6 -1
  6. package/es/application/services/index.js +6 -1
  7. package/es/application/services/integrationServices/IntegrationService.js +21 -0
  8. package/es/application/services/integrationServices/index.js +2 -0
  9. package/es/application/services/sessions/SessionService.js +6 -1
  10. package/es/application/services/subscription/SubscriptionService.js +36 -0
  11. package/es/application/services/subscription/index.js +2 -0
  12. package/es/application/services/templateMessages/TemplateMessageService.js +6 -1
  13. package/es/application/services/userPreferences/UserPreferenceService.js +26 -0
  14. package/es/application/services/userPreferences/index.js +2 -0
  15. package/es/application/services/whatsAppPricing/WhatsAppPricingService.js +21 -0
  16. package/es/application/services/whatsAppPricing/index.js +2 -0
  17. package/es/core/constants/ModuleNames.js +6 -1
  18. package/es/core/constants/ModuleTypes.js +5 -0
  19. package/es/core/constants/index.js +2 -1
  20. package/es/core/utils/validateSchema.js +27 -2
  21. package/es/domain/dto/calls/getCallRequest.js +14 -0
  22. package/es/domain/dto/calls/getCallsRequest.js +20 -0
  23. package/es/domain/dto/calls/index.js +4 -0
  24. package/es/domain/dto/calls/initiateCallRequest.js +15 -0
  25. package/es/domain/dto/calls/updateCallStatusRequest.js +15 -0
  26. package/es/domain/dto/cannedMessages/addTranslationRequest.js +19 -0
  27. package/es/domain/dto/cannedMessages/deleteTranslationRequest.js +14 -0
  28. package/es/domain/dto/cannedMessages/getCannedPlaceholdersRequest.js +7 -0
  29. package/es/domain/dto/cannedMessages/index.js +5 -1
  30. package/es/domain/dto/cannedMessages/updateTranslationRequest.js +20 -0
  31. package/es/domain/dto/channels/getChannelRequest.js +13 -0
  32. package/es/domain/dto/channels/getChannelsRequest.js +3 -1
  33. package/es/domain/dto/channels/index.js +2 -1
  34. package/es/domain/dto/contacts/getContactRequest.js +13 -0
  35. package/es/domain/dto/contacts/index.js +2 -1
  36. package/es/domain/dto/index.js +6 -1
  37. package/es/domain/dto/integrationServices/getIntegrationsRequest.js +7 -0
  38. package/es/domain/dto/integrationServices/index.js +1 -0
  39. package/es/domain/dto/sessions/getSessionAttachmentsRequest.js +6 -1
  40. package/es/domain/dto/sessions/getSessionMetricsRequest.js +16 -0
  41. package/es/domain/dto/sessions/index.js +2 -1
  42. package/es/domain/dto/subscription/buyAddOnRequest.js +18 -0
  43. package/es/domain/dto/subscription/getAddOnsRequest.js +15 -0
  44. package/es/domain/dto/subscription/getLicenseDetailsRequest.js +7 -0
  45. package/es/domain/dto/subscription/index.js +4 -0
  46. package/es/domain/dto/subscription/modifyAddOnRequest.js +18 -0
  47. package/es/domain/dto/templateMessages/getTemplateCreditExhaustStatusRequest.js +3 -2
  48. package/es/domain/dto/templateMessages/getTemplateTagsRequest.js +7 -0
  49. package/es/domain/dto/templateMessages/index.js +2 -1
  50. package/es/domain/dto/userPreferences/getPreferencesRequest.js +7 -0
  51. package/es/domain/dto/userPreferences/index.js +2 -0
  52. package/es/domain/dto/userPreferences/updatePreferencesRequest.js +9 -0
  53. package/es/domain/dto/whatsAppPricing/calculateWhatsAppPricingRequest.js +14 -0
  54. package/es/domain/dto/whatsAppPricing/index.js +1 -0
  55. package/es/domain/entities/Actor/Actor.js +4 -0
  56. package/es/domain/entities/Call/Call.js +47 -0
  57. package/es/domain/entities/Call/index.js +1 -0
  58. package/es/domain/entities/CannedMessage/CannedMessage.js +34 -6
  59. package/es/domain/entities/CannedMessage/Translation.js +48 -0
  60. package/es/domain/entities/CannedMessage/index.js +2 -1
  61. package/es/domain/entities/Channel/Channel.js +22 -4
  62. package/es/domain/entities/Contact/Contact.js +4 -1
  63. package/es/domain/entities/IntegrationService/IntegrationService.js +8 -1
  64. package/es/domain/entities/Placeholder/Placeholder.js +24 -0
  65. package/es/domain/entities/Placeholder/index.js +2 -0
  66. package/es/domain/entities/Session/SessionMetrics.js +21 -0
  67. package/es/domain/entities/Session/index.js +2 -1
  68. package/es/domain/entities/Subscription/AddOn.js +26 -0
  69. package/es/domain/entities/Subscription/LicenseDetails.js +21 -0
  70. package/es/domain/entities/Subscription/SubscriptionInfo.js +26 -0
  71. package/es/domain/entities/Subscription/index.js +4 -0
  72. package/es/domain/entities/TemplateMessage/TemplateItemButton.js +48 -0
  73. package/es/domain/entities/TemplateMessage/TemplateItemFooter.js +27 -0
  74. package/es/domain/entities/TemplateMessage/TemplateItemHeader.js +48 -0
  75. package/es/domain/entities/TemplateMessage/TemplateTags.js +21 -0
  76. package/es/domain/entities/TemplateMessage/index.js +5 -1
  77. package/es/domain/entities/UserPreference/UserPreference.js +26 -0
  78. package/es/domain/entities/UserPreference/index.js +2 -0
  79. package/es/domain/entities/WhatsAppPricing/WhatsAppPricing.js +25 -0
  80. package/es/domain/entities/WhatsAppPricing/WhatsAppPricingCategory.js +22 -0
  81. package/es/domain/entities/WhatsAppPricing/index.js +3 -0
  82. package/es/domain/entities/index.js +6 -1
  83. package/es/domain/enum/call/CallStatus.js +8 -0
  84. package/es/domain/enum/call/index.js +1 -0
  85. package/es/domain/enum/cannedMessage/CannedMessageStatus.js +11 -1
  86. package/es/domain/enum/cannedMessage/CannedMessageType.js +3 -1
  87. package/es/domain/enum/cannedMessage/TemplateItemButtonType.js +7 -1
  88. package/es/domain/enum/cannedMessage/TemplateItemHeaderType.js +3 -1
  89. package/es/domain/enum/index.js +4 -1
  90. package/es/domain/enum/message/InfoAction.js +4 -1
  91. package/es/domain/enum/session/AssigneeFilter.js +6 -0
  92. package/es/domain/enum/session/SessionReplyStatus.js +4 -1
  93. package/es/domain/enum/session/SessionStatus.js +2 -1
  94. package/es/domain/enum/session/index.js +2 -1
  95. package/es/domain/enum/subscription/AddOnModule.js +5 -0
  96. package/es/domain/enum/subscription/AddOnName.js +5 -0
  97. package/es/domain/enum/subscription/AddOnType.js +5 -0
  98. package/es/domain/enum/subscription/SubscriptionStatus.js +4 -0
  99. package/es/domain/enum/subscription/index.js +5 -0
  100. package/es/domain/enum/userPreference/CollapseSidePanel.js +5 -0
  101. package/es/domain/enum/userPreference/index.js +2 -0
  102. package/es/domain/interfaces/repositories/calls/ICallRepository.js +32 -0
  103. package/es/domain/interfaces/repositories/calls/index.js +1 -0
  104. package/es/domain/interfaces/repositories/cannedMessages/ICannedMessageRepository.js +21 -1
  105. package/es/domain/interfaces/repositories/channels/IChannelRepository.js +7 -1
  106. package/es/domain/interfaces/repositories/contacts/IContactRepository.js +7 -1
  107. package/es/domain/interfaces/repositories/index.js +6 -1
  108. package/es/domain/interfaces/repositories/integrationServices/IIntegrationServiceRepository.js +17 -0
  109. package/es/domain/interfaces/repositories/integrationServices/index.js +2 -0
  110. package/es/domain/interfaces/repositories/sessions/ISessionRepository.js +6 -1
  111. package/es/domain/interfaces/repositories/subscription/ISubscriptionRepository.js +32 -0
  112. package/es/domain/interfaces/repositories/subscription/index.js +2 -0
  113. package/es/domain/interfaces/repositories/templateMessages/ITemplateMessageRepository.js +7 -1
  114. package/es/domain/interfaces/repositories/userPreferences/IUserPreferenceRepository.js +23 -0
  115. package/es/domain/interfaces/repositories/userPreferences/index.js +2 -0
  116. package/es/domain/interfaces/repositories/whatsAppPricing/IWhatsAppPricingRepository.js +18 -0
  117. package/es/domain/interfaces/repositories/whatsAppPricing/index.js +2 -0
  118. package/es/domain/schema/call/CallSchema.js +63 -0
  119. package/es/domain/schema/call/index.js +1 -0
  120. package/es/domain/schema/cannedMessage/CannedMessageSchema.js +12 -0
  121. package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemButtonsSchema.js +1 -1
  122. package/es/domain/schema/cannedMessage/TranslationsSchema.js +2 -2
  123. package/es/domain/schema/cannedMessage/index.js +3 -1
  124. package/es/domain/schema/channel/ChannelSchema.js +39 -5
  125. package/es/domain/schema/contact/ContactSchema.js +12 -0
  126. package/es/domain/schema/index.js +6 -1
  127. package/es/domain/schema/integrationService/IntegrationServiceSchema.js +12 -0
  128. package/es/domain/schema/placeholder/PlaceholderSchema.js +19 -0
  129. package/es/domain/schema/placeholder/index.js +2 -0
  130. package/es/domain/schema/session/SessionMetrics/AssigneeSchema.js +20 -0
  131. package/es/domain/schema/session/SessionMetrics/SessionMetricsForAssigneeSchema.js +32 -0
  132. package/es/domain/schema/session/SessionMetrics/index.js +2 -0
  133. package/es/domain/schema/session/SessionMetricsSchema.js +9 -0
  134. package/es/domain/schema/session/index.js +2 -1
  135. package/es/domain/schema/subscription/AddOnSchema.js +29 -0
  136. package/es/domain/schema/subscription/LicenseDetailsSchema.js +7 -0
  137. package/es/domain/schema/subscription/SubscriptionInfoSchema.js +29 -0
  138. package/es/domain/schema/subscription/index.js +4 -0
  139. package/es/domain/schema/templateMessage/TemplateTagsSchema.js +7 -0
  140. package/es/domain/schema/templateMessage/index.js +2 -1
  141. package/es/domain/schema/userPreference/UserPreferenceSchema.js +9 -0
  142. package/es/domain/schema/userPreference/index.js +2 -0
  143. package/es/domain/schema/whatsAppPricing/WhatsAppPricingCategorySchema.js +11 -0
  144. package/es/domain/schema/whatsAppPricing/WhatsAppPricingSchema.js +21 -0
  145. package/es/domain/schema/whatsAppPricing/index.js +3 -0
  146. package/es/frameworks/managers/ModuleFactory.js +95 -24
  147. package/es/frameworks/managers/ModuleManager.js +25 -2
  148. package/es/frameworks/sdk/IMSDK.js +38 -11
  149. package/es/frameworks/sdk/calls/CallSDK.js +27 -0
  150. package/es/frameworks/sdk/calls/index.js +1 -0
  151. package/es/frameworks/sdk/integrationServices/IntegrationServiceSDK.js +30 -0
  152. package/es/frameworks/sdk/integrationServices/index.js +2 -0
  153. package/es/frameworks/sdk/subscription/SubscriptionSDK.js +32 -0
  154. package/es/frameworks/sdk/subscription/index.js +2 -0
  155. package/es/frameworks/sdk/userPreferences/UserPreferencesSDK.js +30 -0
  156. package/es/frameworks/sdk/userPreferences/index.js +2 -0
  157. package/es/frameworks/sdk/whatsAppPricing/WhatsAppPricingSDK.js +28 -0
  158. package/es/frameworks/sdk/whatsAppPricing/index.js +2 -0
  159. package/es/infrastructure/adapters/calls/CallAdapter.js +31 -0
  160. package/es/infrastructure/adapters/calls/index.js +1 -0
  161. package/es/infrastructure/adapters/cannedMessages/CannedMessageAdapter.js +3 -1
  162. package/es/infrastructure/adapters/cannedMessages/TranslationAdapter.js +27 -0
  163. package/es/infrastructure/adapters/cannedMessages/index.js +2 -1
  164. package/es/infrastructure/adapters/channels/ChannelAdapter.js +16 -2
  165. package/es/infrastructure/adapters/contacts/ContactAdapter.js +4 -1
  166. package/es/infrastructure/adapters/index.js +7 -1
  167. package/es/infrastructure/adapters/integrationServices/IntegrationServiceAdapter.js +25 -0
  168. package/es/infrastructure/adapters/integrationServices/index.js +2 -0
  169. package/es/infrastructure/adapters/placeholders/PlaceholderAdapter.js +22 -0
  170. package/es/infrastructure/adapters/placeholders/index.js +2 -0
  171. package/es/infrastructure/adapters/sessions/SessionMetricsAdapter.js +19 -0
  172. package/es/infrastructure/adapters/sessions/index.js +2 -1
  173. package/es/infrastructure/adapters/subscription/AddOnAdapter.js +24 -0
  174. package/es/infrastructure/adapters/subscription/LicenseDetailsAdapter.js +20 -0
  175. package/es/infrastructure/adapters/subscription/index.js +3 -0
  176. package/es/infrastructure/adapters/templateMessages/TemplateTagsAdapter.js +21 -0
  177. package/es/infrastructure/adapters/templateMessages/index.js +2 -1
  178. package/es/infrastructure/adapters/userPreferences/UserPreferenceAdapter.js +19 -0
  179. package/es/infrastructure/adapters/userPreferences/index.js +2 -0
  180. package/es/infrastructure/adapters/whatsAppPricing/WhatsAppPricingAdapter.js +22 -0
  181. package/es/infrastructure/adapters/whatsAppPricing/index.js +2 -0
  182. package/es/infrastructure/api/BaseAPI.js +5 -4
  183. package/es/infrastructure/api/calls/CallAPI.js +44 -0
  184. package/es/infrastructure/api/calls/index.js +1 -0
  185. package/es/infrastructure/api/cannedMessages/CannedMessageAPI.js +41 -1
  186. package/es/infrastructure/api/channels/ChannelAPI.js +11 -1
  187. package/es/infrastructure/api/contacts/ContactAPI.js +11 -1
  188. package/es/infrastructure/api/index.js +6 -1
  189. package/es/infrastructure/api/integrationServices/IntegrationServiceAPI.js +14 -0
  190. package/es/infrastructure/api/integrationServices/index.js +2 -0
  191. package/es/infrastructure/api/registry/calls/callAPIRegistry.js +29 -0
  192. package/es/infrastructure/api/registry/calls/constructCallEndPoint.js +10 -0
  193. package/es/infrastructure/api/registry/calls/index.js +1 -0
  194. package/es/infrastructure/api/registry/cannedMessages/cannedMessageAPIRegistry.js +22 -2
  195. package/es/infrastructure/api/registry/channels/channelAPIRegistry.js +7 -1
  196. package/es/infrastructure/api/registry/channels/channelAgentAPIRegistry.js +1 -1
  197. package/es/infrastructure/api/registry/contacts/contactAPIRegistry.js +8 -2
  198. package/es/infrastructure/api/registry/createPublicBaseUrl.js +4 -0
  199. package/es/infrastructure/api/registry/getRegistryConfig.js +11 -1
  200. package/es/infrastructure/api/registry/integrationServices/constructIntegrationServiceEndPoint.js +10 -0
  201. package/es/infrastructure/api/registry/integrationServices/index.js +2 -0
  202. package/es/infrastructure/api/registry/integrationServices/integrationServiceAPIRegistry.js +12 -0
  203. package/es/infrastructure/api/registry/sessions/sessionAPIRegistry.js +9 -3
  204. package/es/infrastructure/api/registry/subscription/constructSubscriptionEndPoint.js +10 -0
  205. package/es/infrastructure/api/registry/subscription/index.js +2 -0
  206. package/es/infrastructure/api/registry/subscription/subscriptionAPIRegistry.js +30 -0
  207. package/es/infrastructure/api/registry/templateMessages/templateMessageAPIRegistry.js +7 -2
  208. package/es/infrastructure/api/registry/userPreferences/constructUserPreferencesEndPoint.js +10 -0
  209. package/es/infrastructure/api/registry/userPreferences/index.js +2 -0
  210. package/es/infrastructure/api/registry/userPreferences/userPreferenceAPIRegistry.js +17 -0
  211. package/es/infrastructure/api/registry/whatsAppPricing/constructWhatsAppPricingEndPoint.js +10 -0
  212. package/es/infrastructure/api/registry/whatsAppPricing/index.js +2 -0
  213. package/es/infrastructure/api/registry/whatsAppPricing/whatsAppPricingAPIRegistry.js +13 -0
  214. package/es/infrastructure/api/sessions/SessionAPI.js +11 -1
  215. package/es/infrastructure/api/subscription/SubscriptionAPI.js +48 -0
  216. package/es/infrastructure/api/subscription/index.js +2 -0
  217. package/es/infrastructure/api/templateMessages/TemplateMessageAPI.js +11 -1
  218. package/es/infrastructure/api/userPreferences/UserPreferenceAPI.js +24 -0
  219. package/es/infrastructure/api/userPreferences/index.js +2 -0
  220. package/es/infrastructure/api/whatsAppPricing/WhatsAppPricingAPI.js +14 -0
  221. package/es/infrastructure/api/whatsAppPricing/index.js +2 -0
  222. package/es/infrastructure/config/configRegistry.js +8 -1
  223. package/es/infrastructure/repositories/calls/CallRepository.js +73 -0
  224. package/es/infrastructure/repositories/calls/index.js +1 -0
  225. package/es/infrastructure/repositories/cannedMessages/CannedMessageRepository.js +50 -7
  226. package/es/infrastructure/repositories/channels/ChannelRepository.js +10 -1
  227. package/es/infrastructure/repositories/contacts/ContactRepository.js +9 -1
  228. package/es/infrastructure/repositories/index.js +6 -1
  229. package/es/infrastructure/repositories/integrationServices/IntegrationServiceRepository.js +49 -0
  230. package/es/infrastructure/repositories/integrationServices/index.js +2 -0
  231. package/es/infrastructure/repositories/sessions/SessionRepository.js +14 -3
  232. package/es/infrastructure/repositories/subscription/SubscriptionRepository.js +83 -0
  233. package/es/infrastructure/repositories/subscription/index.js +2 -0
  234. package/es/infrastructure/repositories/templateMessages/TemplateMessageRepository.js +15 -3
  235. package/es/infrastructure/repositories/userPreferences/UserPreferenceRepository.js +58 -0
  236. package/es/infrastructure/repositories/userPreferences/index.js +2 -0
  237. package/es/infrastructure/repositories/whatsAppPricing/WhatsAppPricingRepository.js +49 -0
  238. package/es/infrastructure/repositories/whatsAppPricing/index.js +2 -0
  239. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import { ModuleNames } from '../../core/constants';
1
+ import { ModuleNames, ModuleTypes } from '../../core/constants';
2
2
  import configRegistry from '../../infrastructure/config/configRegistry';
3
3
  import { ModuleManager } from '../managers';
4
4
  export default class IMSDK {
@@ -6,11 +6,13 @@ export default class IMSDK {
6
6
  let {
7
7
  baseURL,
8
8
  apiConfig = {},
9
- httpClient
9
+ httpClient,
10
+ publicHttpClient
10
11
  } = _ref;
11
12
  configRegistry.setConfig({
12
13
  baseURL,
13
- httpClient
14
+ httpClient,
15
+ publicHttpClient
14
16
  });
15
17
  this._moduleManager = new ModuleManager();
16
18
 
@@ -20,35 +22,55 @@ export default class IMSDK {
20
22
  }
21
23
 
22
24
  get channels() {
23
- return this._moduleManager.getModule(ModuleNames.CHANNELS);
25
+ return this._moduleManager.getModuleByType(ModuleNames.CHANNELS);
24
26
  }
25
27
 
26
28
  get sessions() {
27
- return this._moduleManager.getModule(ModuleNames.SESSIONS);
29
+ return this._moduleManager.getModuleByType(ModuleNames.SESSIONS);
28
30
  }
29
31
 
30
32
  get bots() {
31
- return this._moduleManager.getModule(ModuleNames.BOTS);
33
+ return this._moduleManager.getModuleByType(ModuleNames.BOTS);
32
34
  }
33
35
 
34
36
  get messages() {
35
- return this._moduleManager.getModule(ModuleNames.MESSAGES);
37
+ return this._moduleManager.getModuleByType(ModuleNames.MESSAGES);
36
38
  }
37
39
 
38
40
  get agents() {
39
- return this._moduleManager.getModule(ModuleNames.AGENTS);
41
+ return this._moduleManager.getModuleByType(ModuleNames.AGENTS);
40
42
  }
41
43
 
42
44
  get contacts() {
43
- return this._moduleManager.getModule(ModuleNames.CONTACTS);
45
+ return this._moduleManager.getModuleByType(ModuleNames.CONTACTS);
44
46
  }
45
47
 
46
48
  get cannedMessages() {
47
- return this._moduleManager.getModule(ModuleNames.CANNED_MESSAGES);
49
+ return this._moduleManager.getModuleByType(ModuleNames.CANNED_MESSAGES);
48
50
  }
49
51
 
50
52
  get templateMessages() {
51
- return this._moduleManager.getModule(ModuleNames.TEMPLATE_MESSAGES);
53
+ return this._moduleManager.getModuleByType(ModuleNames.TEMPLATE_MESSAGES);
54
+ }
55
+
56
+ get public() {
57
+ return this._moduleManager.getModulesByType(ModuleTypes.PUBLIC);
58
+ }
59
+
60
+ get integrationServices() {
61
+ return this._moduleManager.getModuleByType(ModuleNames.INTEGRATION_SERVICES);
62
+ }
63
+
64
+ get userPreferences() {
65
+ return this._moduleManager.getModuleByType(ModuleNames.USER_PREFERENCES);
66
+ }
67
+
68
+ get calls() {
69
+ return this._moduleManager.getModuleByType(ModuleNames.CALLS);
70
+ }
71
+
72
+ get subscription() {
73
+ return this._moduleManager.getModuleByType(ModuleNames.SUBSCRIPTION);
52
74
  }
53
75
 
54
76
  hasModule(moduleName) {
@@ -65,6 +87,11 @@ export default class IMSDK {
65
87
  contacts: this.contacts,
66
88
  cannedMessages: this.cannedMessages,
67
89
  templateMessages: this.templateMessages,
90
+ integrationServices: this.integrationServices,
91
+ userPreferences: this.userPreferences,
92
+ subscription: this.subscription,
93
+ public: this.public,
94
+ calls: this.calls,
68
95
  hasModule: this.hasModule.bind(this)
69
96
  };
70
97
  }
@@ -0,0 +1,27 @@
1
+ import { CallService } from '../../../application/services';
2
+ import { CallRepository } from '../../../infrastructure/repositories';
3
+ export default class CallSDK {
4
+ constructor(_ref) {
5
+ let {
6
+ config
7
+ } = _ref;
8
+ const {
9
+ callAPI,
10
+ callAdapter
11
+ } = config;
12
+ const callRepository = new CallRepository({
13
+ callAPI,
14
+ callAdapter
15
+ }).toJSON();
16
+ const callService = new CallService({
17
+ callRepository
18
+ }).toJSON();
19
+ this.services = { ...callService
20
+ };
21
+ }
22
+
23
+ toJSON() {
24
+ return this.services;
25
+ }
26
+
27
+ }
@@ -0,0 +1 @@
1
+ export { default as CallSDK } from './CallSDK';
@@ -0,0 +1,30 @@
1
+ import { IntegrationService } from '../../../application/services';
2
+ import { IntegrationServiceRepository } from '../../../infrastructure/repositories';
3
+
4
+ class IntegrationServiceSDK {
5
+ constructor(_ref) {
6
+ let {
7
+ config
8
+ } = _ref;
9
+ const {
10
+ integrationServiceAPI,
11
+ integrationServiceAdapter
12
+ } = config;
13
+ const integrationServiceRepository = new IntegrationServiceRepository({
14
+ integrationServiceAPI,
15
+ integrationServiceAdapter
16
+ }).toJSON();
17
+ const integrationService = new IntegrationService({
18
+ integrationServiceRepository
19
+ }).toJSON();
20
+ this.services = { ...integrationService
21
+ };
22
+ }
23
+
24
+ toJSON() {
25
+ return this.services;
26
+ }
27
+
28
+ }
29
+
30
+ export default IntegrationServiceSDK;
@@ -0,0 +1,2 @@
1
+ import IntegrationServiceSDK from './IntegrationServiceSDK';
2
+ export { IntegrationServiceSDK };
@@ -0,0 +1,32 @@
1
+ import { SubscriptionService } from '../../../application/services';
2
+ import { SubscriptionRepository } from '../../../infrastructure/repositories';
3
+
4
+ class SubscriptionSDK {
5
+ constructor(_ref) {
6
+ let {
7
+ config
8
+ } = _ref;
9
+ const {
10
+ subscriptionAPI,
11
+ addOnAdapter,
12
+ licenseDetailsAdapter
13
+ } = config;
14
+ const subscriptionRepository = new SubscriptionRepository({
15
+ subscriptionAPI,
16
+ addOnAdapter,
17
+ licenseDetailsAdapter
18
+ }).toJSON();
19
+ const subscriptionService = new SubscriptionService({
20
+ subscriptionRepository
21
+ }).toJSON();
22
+ this.services = { ...subscriptionService
23
+ };
24
+ }
25
+
26
+ toJSON() {
27
+ return this.services;
28
+ }
29
+
30
+ }
31
+
32
+ export default SubscriptionSDK;
@@ -0,0 +1,2 @@
1
+ import SubscriptionSDK from './SubscriptionSDK';
2
+ export { SubscriptionSDK };
@@ -0,0 +1,30 @@
1
+ import { UserPreferenceService } from '../../../application/services';
2
+ import { UserPreferenceRepository } from '../../../infrastructure/repositories';
3
+
4
+ class UserPreferencesSDK {
5
+ constructor(_ref) {
6
+ let {
7
+ config
8
+ } = _ref;
9
+ const {
10
+ userPreferenceAPI,
11
+ userPreferenceAdapter
12
+ } = config;
13
+ const userPreferenceRepository = new UserPreferenceRepository({
14
+ userPreferenceAPI,
15
+ userPreferenceAdapter
16
+ }).toJSON();
17
+ const userPreferenceService = new UserPreferenceService({
18
+ userPreferenceRepository
19
+ }).toJSON();
20
+ this.services = { ...userPreferenceService
21
+ };
22
+ }
23
+
24
+ toJSON() {
25
+ return this.services;
26
+ }
27
+
28
+ }
29
+
30
+ export default UserPreferencesSDK;
@@ -0,0 +1,2 @@
1
+ import UserPreferencesSDK from './UserPreferencesSDK';
2
+ export { UserPreferencesSDK };
@@ -0,0 +1,28 @@
1
+ import { WhatsAppPricingService } from '../../../application/services';
2
+ import { WhatsAppPricingRepository } from '../../../infrastructure/repositories';
3
+
4
+ class WhatsAppPricingSDK {
5
+ constructor(_ref) {
6
+ let {
7
+ config
8
+ } = _ref;
9
+ const {
10
+ whatsAppPricingAPI
11
+ } = config;
12
+ const whatsAppPricingRepository = new WhatsAppPricingRepository({
13
+ whatsAppPricingAPI
14
+ }).toJSON();
15
+ const whatsAppPricingService = new WhatsAppPricingService({
16
+ whatsAppPricingRepository
17
+ }).toJSON();
18
+ this.services = { ...whatsAppPricingService
19
+ };
20
+ }
21
+
22
+ toJSON() {
23
+ return this.services;
24
+ }
25
+
26
+ }
27
+
28
+ export default WhatsAppPricingSDK;
@@ -0,0 +1,2 @@
1
+ import WhatsAppPricingSDK from './WhatsAppPricingSDK';
2
+ export { WhatsAppPricingSDK };
@@ -0,0 +1,31 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { Call } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class CallAdapter extends IAdapter {
5
+ adapt(callData) {
6
+ if (!callData) {
7
+ throw new AdapterError('Call data is required');
8
+ }
9
+
10
+ try {
11
+ return new Call({
12
+ id: callData.id,
13
+ integrationServiceId: callData.integrationServiceId,
14
+ actor: callData.actor,
15
+ channelId: callData.channelId,
16
+ createdTime: callData.createdTime,
17
+ direction: callData.direction,
18
+ sessionId: callData.sessionId,
19
+ status: callData.status,
20
+ meta: callData.meta,
21
+ participants: callData.participants,
22
+ session: callData.session,
23
+ statuses: callData.statuses,
24
+ duration: callData.duration
25
+ }).toJSON();
26
+ } catch (error) {
27
+ throw new AdapterError(`Failed to adapt message: ${error.message}`);
28
+ }
29
+ }
30
+
31
+ }
@@ -0,0 +1 @@
1
+ export { default as CallAdapter } from './CallAdapter';
@@ -20,11 +20,13 @@ export default class CannedMessageAdapter extends IAdapter {
20
20
  isActive: cannedMessageData.isActive,
21
21
  isPrivate: cannedMessageData.isPrivate,
22
22
  translations: cannedMessageData.translations,
23
+ primaryLanguage: cannedMessageData.primaryLanguage,
23
24
  uuid: cannedMessageData.uuid,
24
25
  meta: cannedMessageData.meta,
25
26
  rejectedReason: cannedMessageData.rejectedReason,
26
27
  modifiedTime: cannedMessageData.modifiedTime,
27
- parameters: cannedMessageData.parameters || null
28
+ parameters: cannedMessageData.parameters || null,
29
+ wabaId: cannedMessageData.wabaId
28
30
  }).toJSON();
29
31
  } catch (error) {
30
32
  throw new AdapterError(`Failed to adapt canned message: ${error.message}`);
@@ -0,0 +1,27 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { Translation } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class TranslationAdapter extends IAdapter {
5
+ adapt(translationData) {
6
+ if (!translationData) {
7
+ throw new AdapterError('Translation data is required');
8
+ }
9
+
10
+ try {
11
+ return new Translation({
12
+ id: translationData.id,
13
+ language: translationData.language,
14
+ message: translationData.message,
15
+ displayMessage: translationData.displayMessage,
16
+ uuid: translationData.uuid,
17
+ status: translationData.status,
18
+ modifiedTime: translationData.modifiedTime,
19
+ failedReason: translationData.failedReason,
20
+ templateItems: translationData.templateItems
21
+ }).toJSON();
22
+ } catch (error) {
23
+ throw new AdapterError(`Failed to adapt translation: ${error.message}`);
24
+ }
25
+ }
26
+
27
+ }
@@ -1,2 +1,3 @@
1
1
  import CannedMessageAdapter from './CannedMessageAdapter';
2
- export { CannedMessageAdapter };
2
+ import TranslationAdapter from './TranslationAdapter';
3
+ export { CannedMessageAdapter, TranslationAdapter };
@@ -8,18 +8,32 @@ export default class ChannelAdapter extends IAdapter {
8
8
  }
9
9
 
10
10
  try {
11
+ const {
12
+ integrationServiceId = '',
13
+ integrationService = {}
14
+ } = rawChannel;
15
+ const updatedIntegrationServiceId = integrationServiceId || integrationService.id;
11
16
  return new Channel({
12
17
  id: rawChannel.id,
13
- integrationService: rawChannel.integrationService,
18
+ integrationServiceType: updatedIntegrationServiceId,
19
+ integrationServiceId: updatedIntegrationServiceId,
14
20
  name: rawChannel.name,
15
21
  defaultBotId: rawChannel.defaultBotId,
16
22
  isActive: rawChannel.isActive,
23
+ isDeleted: rawChannel.isDeleted,
24
+ isSandBox: rawChannel.isSandBox,
17
25
  createdTime: rawChannel.createdTime,
18
26
  accountName: rawChannel.accountName,
27
+ universalLink: rawChannel.universalLink,
19
28
  isSubscribed: rawChannel.isSubscribed,
20
29
  createdBy: rawChannel.createdBy,
21
30
  isOwner: rawChannel.isOwner,
22
- photoURL: rawChannel.logoURL
31
+ photoURL: rawChannel.photoURL,
32
+ configParams: rawChannel.configParams,
33
+ authorizationPending: rawChannel.authorizationPending,
34
+ meta: rawChannel.meta,
35
+ logoURL: rawChannel.logoURL,
36
+ workspaceId: rawChannel.workspaceId
23
37
  }).toJSON();
24
38
  } catch (error) {
25
39
  throw new AdapterError(`Failed to adapt channel: ${error.message}`);
@@ -14,7 +14,10 @@ export default class ContactAdapter extends IAdapter {
14
14
  photoURL: contactData.photoURL,
15
15
  email: contactData.email,
16
16
  mobile: contactData.mobile,
17
- phone: contactData.phone
17
+ phone: contactData.phone,
18
+ customFields: contactData.customFields,
19
+ webUrl: contactData.webUrl,
20
+ layoutId: contactData.layoutId
18
21
  }).toJSON();
19
22
  } catch (error) {
20
23
  throw new AdapterError(`Failed to adapt Contact: ${error.message}`);
@@ -7,4 +7,10 @@ export * from './agents';
7
7
  export * from './contacts';
8
8
  export * from './cannedMessages';
9
9
  export * from './templateMessages';
10
- export * from './customReplyExtension';
10
+ export * from './customReplyExtension';
11
+ export * from './placeholders';
12
+ export * from './integrationServices';
13
+ export * from './userPreferences';
14
+ export * from './whatsAppPricing';
15
+ export * from './calls';
16
+ export * from './subscription';
@@ -0,0 +1,25 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { IntegrationService } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class IntegrationServiceAdapter extends IAdapter {
5
+ adapt(integrationServiceData) {
6
+ if (!integrationServiceData) {
7
+ throw new AdapterError('IntegrationService data is required');
8
+ }
9
+
10
+ try {
11
+ return new IntegrationService({
12
+ id: integrationServiceData.id,
13
+ label: integrationServiceData.label,
14
+ provider: integrationServiceData.provider,
15
+ domain: integrationServiceData.domain,
16
+ channelAlias: integrationServiceData.channelAlias,
17
+ logoURL: integrationServiceData.logoURL,
18
+ isParentAccountNeeded: integrationServiceData.isParentAccountNeeded
19
+ }).toJSON();
20
+ } catch (error) {
21
+ throw new AdapterError(`Failed to adapt integrationService: ${error.message}`);
22
+ }
23
+ }
24
+
25
+ }
@@ -0,0 +1,2 @@
1
+ import IntegrationServiceAdapter from './IntegrationServiceAdapter';
2
+ export { IntegrationServiceAdapter };
@@ -0,0 +1,22 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { Placeholder } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class PlaceholderAdapter extends IAdapter {
5
+ adapt(placeholderData) {
6
+ if (!placeholderData) {
7
+ throw new AdapterError('Placeholder data is required');
8
+ }
9
+
10
+ try {
11
+ return new Placeholder({
12
+ apiName: placeholderData.apiName,
13
+ i18nFieldLabel: placeholderData.i18nFieldLabel,
14
+ fieldLabel: placeholderData.fieldLabel,
15
+ placeHolder: placeholderData.placeHolder
16
+ }).toJSON();
17
+ } catch (error) {
18
+ throw new AdapterError(`Failed to adapt placeholder: ${error.message}`);
19
+ }
20
+ }
21
+
22
+ }
@@ -0,0 +1,2 @@
1
+ import PlaceholderAdapter from './PlaceholderAdapter';
2
+ export { PlaceholderAdapter };
@@ -0,0 +1,19 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { SessionMetrics } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class SessionMetricsAdapter extends IAdapter {
5
+ adapt(sessionMetricsData) {
6
+ if (!sessionMetricsData) {
7
+ throw new AdapterError('Session metrics data is required');
8
+ }
9
+
10
+ try {
11
+ return new SessionMetrics({
12
+ assignee: sessionMetricsData.assignee
13
+ }).toJSON();
14
+ } catch (error) {
15
+ throw new AdapterError(`Failed to adapt session Metrics Data: ${error.message}`);
16
+ }
17
+ }
18
+
19
+ }
@@ -1,2 +1,3 @@
1
1
  import SessionAdapter from './SessionAdapter';
2
- export { SessionAdapter };
2
+ import SessionMetricsAdapter from './SessionMetricsAdapter';
3
+ export { SessionAdapter, SessionMetricsAdapter };
@@ -0,0 +1,24 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { AddOn } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class AddOnAdapter extends IAdapter {
5
+ adapt(data) {
6
+ if (!data) {
7
+ throw new AdapterError('AddOn data is required'); // No I18N
8
+ }
9
+
10
+ try {
11
+ return new AddOn({
12
+ name: data.name,
13
+ type: data.type,
14
+ module: data.module,
15
+ cost: data.cost,
16
+ subscriptionInfo: data.subscriptionInfo
17
+ }).toJSON();
18
+ } catch (error) {
19
+ throw new AdapterError(`Failed to adapt addOn: ${error.message}` // No I18N
20
+ );
21
+ }
22
+ }
23
+
24
+ }
@@ -0,0 +1,20 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { LicenseDetails } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class LicenseDetailsAdapter extends IAdapter {
5
+ adapt(data) {
6
+ if (!data) {
7
+ throw new AdapterError('LicenseDetails data is required'); // No I18N
8
+ }
9
+
10
+ try {
11
+ return new LicenseDetails({
12
+ paymentSource: data.paymentSource
13
+ }).toJSON();
14
+ } catch (error) {
15
+ throw new AdapterError(`Failed to adapt licenseDetails: ${error.message}` // No I18N
16
+ );
17
+ }
18
+ }
19
+
20
+ }
@@ -0,0 +1,3 @@
1
+ import AddOnAdapter from './AddOnAdapter';
2
+ import LicenseDetailsAdapter from './LicenseDetailsAdapter';
3
+ export { AddOnAdapter, LicenseDetailsAdapter };
@@ -0,0 +1,21 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { TemplateTags } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class TemplateTagsAdapter extends IAdapter {
5
+ adapt(templateTagsData) {
6
+ const tags = templateTagsData?.data?.tags;
7
+
8
+ if (!tags) {
9
+ throw new AdapterError('templateTags data is required');
10
+ }
11
+
12
+ try {
13
+ return new TemplateTags({
14
+ tags: tags
15
+ }).toJSON();
16
+ } catch (error) {
17
+ throw new AdapterError(`Failed to adapt TemplateTags: ${error.message}`);
18
+ }
19
+ }
20
+
21
+ }
@@ -1,3 +1,4 @@
1
1
  import TemplateLanguageAdapter from './TemplateLanguageAdapter';
2
2
  import TemplateCreditExhaustStatusAdapter from './TemplateCreditExhaustStatusAdapter';
3
- export { TemplateLanguageAdapter, TemplateCreditExhaustStatusAdapter };
3
+ import TemplateTagsAdapter from './TemplateTagsAdapter';
4
+ export { TemplateLanguageAdapter, TemplateCreditExhaustStatusAdapter, TemplateTagsAdapter };
@@ -0,0 +1,19 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { UserPreference } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class UserPreferencesAdapter extends IAdapter {
5
+ adapt(preferenceData) {
6
+ if (!preferenceData) {
7
+ throw new AdapterError('UserPreference data is required');
8
+ }
9
+
10
+ try {
11
+ return new UserPreference({
12
+ collapseSidePanel: preferenceData.collapseSidePanel
13
+ }).toJSON();
14
+ } catch (error) {
15
+ throw new AdapterError(`Failed to adapt user preference: ${error.message}`);
16
+ }
17
+ }
18
+
19
+ }
@@ -0,0 +1,2 @@
1
+ import UserPreferenceAdapter from './UserPreferenceAdapter';
2
+ export { UserPreferenceAdapter };
@@ -0,0 +1,22 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { WhatsAppPricing } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class WhatsAppPricingAdapter extends IAdapter {
5
+ adapt(whatsAppPricingData) {
6
+ if (!whatsAppPricingData) {
7
+ throw new AdapterError('whatsAppPricing data is required');
8
+ }
9
+
10
+ try {
11
+ return new WhatsAppPricing({
12
+ total: whatsAppPricingData.total,
13
+ creditsCount: whatsAppPricingData.creditsCount,
14
+ actutalCreditsAmount: whatsAppPricingData.actutalCreditsAmount,
15
+ category: whatsAppPricingData.category
16
+ }).toJSON();
17
+ } catch (error) {
18
+ throw new AdapterError(`Failed to adapt WhatsAppPricing: ${error.message}`);
19
+ }
20
+ }
21
+
22
+ }
@@ -0,0 +1,2 @@
1
+ import WhatsAppPricingAdapter from './WhatsAppPricingAdapter';
2
+ export { WhatsAppPricingAdapter };
@@ -1,4 +1,4 @@
1
- import { ResponseTypes } from '../../core/constants';
1
+ import { ModuleTypes, ResponseTypes } from '../../core/constants';
2
2
  import { ResponseUtils } from '../../core/utils';
3
3
  import configRegistry from '../config/configRegistry';
4
4
  import { getRegistryConfig } from './registry';
@@ -7,18 +7,19 @@ export default class BaseAPI {
7
7
  constructor() {
8
8
  let {
9
9
  module,
10
+ moduleType = ModuleTypes.AUTHENTICATED,
10
11
  configProvider = configRegistry,
11
12
  registryProvider = {
12
13
  getRegistryConfig
13
14
  },
14
- urlBuilder = new UrlBuilder()
15
+ urlBuilder
15
16
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16
17
  this.configProvider = configProvider;
17
18
  this.registryProvider = registryProvider;
18
- this.httpClient = this.configProvider.getHttpClient();
19
+ this.httpClient = moduleType === ModuleTypes.PUBLIC ? this.configProvider.getPublicHttpClient() : this.configProvider.getHttpClient();
19
20
  this.baseURL = this.configProvider.getBaseURL();
20
21
  this.module = module;
21
- this.urlBuilder = urlBuilder;
22
+ this.urlBuilder = urlBuilder || new UrlBuilder(this.baseURL);
22
23
  }
23
24
 
24
25
  async request(_ref) {