@zohoim/client-sdk 1.1.0-attachmentsList → 1.1.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 (143) 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/channels/ChannelService.js +6 -1
  4. package/es/application/services/index.js +5 -1
  5. package/es/application/services/integrationServices/IntegrationService.js +21 -0
  6. package/es/application/services/integrationServices/index.js +2 -0
  7. package/es/application/services/sessions/SessionService.js +6 -1
  8. package/es/application/services/userPreferences/UserPreferenceService.js +26 -0
  9. package/es/application/services/userPreferences/index.js +2 -0
  10. package/es/application/services/whatsAppPricing/WhatsAppPricingService.js +21 -0
  11. package/es/application/services/whatsAppPricing/index.js +2 -0
  12. package/es/core/constants/ModuleNames.js +5 -1
  13. package/es/core/constants/ModuleTypes.js +5 -0
  14. package/es/core/constants/index.js +2 -1
  15. package/es/core/utils/validateSchema.js +25 -0
  16. package/es/domain/dto/calls/getCallRequest.js +14 -0
  17. package/es/domain/dto/calls/getCallsRequest.js +20 -0
  18. package/es/domain/dto/calls/index.js +4 -0
  19. package/es/domain/dto/calls/initiateCallRequest.js +15 -0
  20. package/es/domain/dto/calls/updateCallStatusRequest.js +15 -0
  21. package/es/domain/dto/channels/getChannelRequest.js +13 -0
  22. package/es/domain/dto/channels/getChannelsRequest.js +3 -1
  23. package/es/domain/dto/channels/index.js +2 -1
  24. package/es/domain/dto/index.js +5 -1
  25. package/es/domain/dto/integrationServices/getIntegrationsRequest.js +7 -0
  26. package/es/domain/dto/integrationServices/index.js +1 -0
  27. package/es/domain/dto/sessions/getSessionAttachmentsRequest.js +5 -2
  28. package/es/domain/dto/sessions/getSessionMetricsRequest.js +16 -0
  29. package/es/domain/dto/sessions/index.js +2 -1
  30. package/es/domain/dto/userPreferences/getPreferencesRequest.js +7 -0
  31. package/es/domain/dto/userPreferences/index.js +2 -0
  32. package/es/domain/dto/userPreferences/updatePreferencesRequest.js +9 -0
  33. package/es/domain/dto/whatsAppPricing/calculateWhatsAppPricingRequest.js +14 -0
  34. package/es/domain/dto/whatsAppPricing/index.js +1 -0
  35. package/es/domain/entities/Actor/Actor.js +4 -0
  36. package/es/domain/entities/Call/Call.js +47 -0
  37. package/es/domain/entities/Call/index.js +1 -0
  38. package/es/domain/entities/Channel/Channel.js +22 -4
  39. package/es/domain/entities/IntegrationService/IntegrationService.js +8 -1
  40. package/es/domain/entities/Session/SessionMetrics.js +21 -0
  41. package/es/domain/entities/Session/index.js +2 -1
  42. package/es/domain/entities/UserPreference/UserPreference.js +26 -0
  43. package/es/domain/entities/UserPreference/index.js +2 -0
  44. package/es/domain/entities/WhatsAppPricing/WhatsAppPricing.js +25 -0
  45. package/es/domain/entities/WhatsAppPricing/WhatsAppPricingCategory.js +22 -0
  46. package/es/domain/entities/WhatsAppPricing/index.js +3 -0
  47. package/es/domain/entities/index.js +4 -1
  48. package/es/domain/enum/call/CallStatus.js +8 -0
  49. package/es/domain/enum/call/index.js +1 -0
  50. package/es/domain/enum/index.js +3 -1
  51. package/es/domain/enum/session/AssigneeFilter.js +6 -0
  52. package/es/domain/enum/session/SessionStatus.js +2 -1
  53. package/es/domain/enum/session/index.js +2 -1
  54. package/es/domain/enum/userPreference/CollapseSidePanel.js +5 -0
  55. package/es/domain/enum/userPreference/index.js +2 -0
  56. package/es/domain/interfaces/repositories/calls/ICallRepository.js +32 -0
  57. package/es/domain/interfaces/repositories/calls/index.js +1 -0
  58. package/es/domain/interfaces/repositories/channels/IChannelRepository.js +7 -1
  59. package/es/domain/interfaces/repositories/index.js +5 -1
  60. package/es/domain/interfaces/repositories/integrationServices/IIntegrationServiceRepository.js +17 -0
  61. package/es/domain/interfaces/repositories/integrationServices/index.js +2 -0
  62. package/es/domain/interfaces/repositories/sessions/ISessionRepository.js +6 -1
  63. package/es/domain/interfaces/repositories/userPreferences/IUserPreferenceRepository.js +23 -0
  64. package/es/domain/interfaces/repositories/userPreferences/index.js +2 -0
  65. package/es/domain/interfaces/repositories/whatsAppPricing/IWhatsAppPricingRepository.js +18 -0
  66. package/es/domain/interfaces/repositories/whatsAppPricing/index.js +2 -0
  67. package/es/domain/schema/call/CallSchema.js +63 -0
  68. package/es/domain/schema/call/index.js +1 -0
  69. package/es/domain/schema/channel/ChannelSchema.js +39 -5
  70. package/es/domain/schema/index.js +4 -1
  71. package/es/domain/schema/integrationService/IntegrationServiceSchema.js +12 -0
  72. package/es/domain/schema/session/SessionMetrics/AssigneeSchema.js +20 -0
  73. package/es/domain/schema/session/SessionMetrics/SessionMetricsForAssigneeSchema.js +32 -0
  74. package/es/domain/schema/session/SessionMetrics/index.js +2 -0
  75. package/es/domain/schema/session/SessionMetricsSchema.js +9 -0
  76. package/es/domain/schema/session/index.js +2 -1
  77. package/es/domain/schema/userPreference/UserPreferenceSchema.js +9 -0
  78. package/es/domain/schema/userPreference/index.js +2 -0
  79. package/es/domain/schema/whatsAppPricing/WhatsAppPricingCategorySchema.js +11 -0
  80. package/es/domain/schema/whatsAppPricing/WhatsAppPricingSchema.js +21 -0
  81. package/es/domain/schema/whatsAppPricing/index.js +3 -0
  82. package/es/frameworks/managers/ModuleFactory.js +81 -23
  83. package/es/frameworks/managers/ModuleManager.js +25 -2
  84. package/es/frameworks/sdk/IMSDK.js +33 -11
  85. package/es/frameworks/sdk/calls/CallSDK.js +27 -0
  86. package/es/frameworks/sdk/calls/index.js +1 -0
  87. package/es/frameworks/sdk/integrationServices/IntegrationServiceSDK.js +30 -0
  88. package/es/frameworks/sdk/integrationServices/index.js +2 -0
  89. package/es/frameworks/sdk/userPreferences/UserPreferencesSDK.js +30 -0
  90. package/es/frameworks/sdk/userPreferences/index.js +2 -0
  91. package/es/frameworks/sdk/whatsAppPricing/WhatsAppPricingSDK.js +28 -0
  92. package/es/frameworks/sdk/whatsAppPricing/index.js +2 -0
  93. package/es/infrastructure/adapters/calls/CallAdapter.js +31 -0
  94. package/es/infrastructure/adapters/calls/index.js +1 -0
  95. package/es/infrastructure/adapters/channels/ChannelAdapter.js +16 -2
  96. package/es/infrastructure/adapters/index.js +5 -1
  97. package/es/infrastructure/adapters/integrationServices/IntegrationServiceAdapter.js +25 -0
  98. package/es/infrastructure/adapters/integrationServices/index.js +2 -0
  99. package/es/infrastructure/adapters/sessions/SessionMetricsAdapter.js +19 -0
  100. package/es/infrastructure/adapters/sessions/index.js +2 -1
  101. package/es/infrastructure/adapters/userPreferences/UserPreferenceAdapter.js +19 -0
  102. package/es/infrastructure/adapters/userPreferences/index.js +2 -0
  103. package/es/infrastructure/adapters/whatsAppPricing/WhatsAppPricingAdapter.js +22 -0
  104. package/es/infrastructure/adapters/whatsAppPricing/index.js +2 -0
  105. package/es/infrastructure/api/BaseAPI.js +5 -4
  106. package/es/infrastructure/api/calls/CallAPI.js +44 -0
  107. package/es/infrastructure/api/calls/index.js +1 -0
  108. package/es/infrastructure/api/index.js +5 -1
  109. package/es/infrastructure/api/integrationServices/IntegrationServiceAPI.js +14 -0
  110. package/es/infrastructure/api/integrationServices/index.js +2 -0
  111. package/es/infrastructure/api/registry/calls/callAPIRegistry.js +29 -0
  112. package/es/infrastructure/api/registry/calls/constructCallEndPoint.js +10 -0
  113. package/es/infrastructure/api/registry/calls/index.js +1 -0
  114. package/es/infrastructure/api/registry/createPublicBaseUrl.js +4 -0
  115. package/es/infrastructure/api/registry/getRegistryConfig.js +9 -1
  116. package/es/infrastructure/api/registry/integrationServices/constructIntegrationServiceEndPoint.js +10 -0
  117. package/es/infrastructure/api/registry/integrationServices/index.js +2 -0
  118. package/es/infrastructure/api/registry/integrationServices/integrationServiceAPIRegistry.js +12 -0
  119. package/es/infrastructure/api/registry/sessions/sessionAPIRegistry.js +8 -2
  120. package/es/infrastructure/api/registry/userPreferences/constructUserPreferencesEndPoint.js +10 -0
  121. package/es/infrastructure/api/registry/userPreferences/index.js +2 -0
  122. package/es/infrastructure/api/registry/userPreferences/userPreferenceAPIRegistry.js +17 -0
  123. package/es/infrastructure/api/registry/whatsAppPricing/constructWhatsAppPricingEndPoint.js +10 -0
  124. package/es/infrastructure/api/registry/whatsAppPricing/index.js +2 -0
  125. package/es/infrastructure/api/registry/whatsAppPricing/whatsAppPricingAPIRegistry.js +13 -0
  126. package/es/infrastructure/api/sessions/SessionAPI.js +11 -1
  127. package/es/infrastructure/api/userPreferences/UserPreferenceAPI.js +24 -0
  128. package/es/infrastructure/api/userPreferences/index.js +2 -0
  129. package/es/infrastructure/api/whatsAppPricing/WhatsAppPricingAPI.js +14 -0
  130. package/es/infrastructure/api/whatsAppPricing/index.js +2 -0
  131. package/es/infrastructure/config/configRegistry.js +8 -1
  132. package/es/infrastructure/repositories/calls/CallRepository.js +73 -0
  133. package/es/infrastructure/repositories/calls/index.js +1 -0
  134. package/es/infrastructure/repositories/channels/ChannelRepository.js +10 -1
  135. package/es/infrastructure/repositories/index.js +5 -1
  136. package/es/infrastructure/repositories/integrationServices/IntegrationServiceRepository.js +49 -0
  137. package/es/infrastructure/repositories/integrationServices/index.js +2 -0
  138. package/es/infrastructure/repositories/sessions/SessionRepository.js +14 -3
  139. package/es/infrastructure/repositories/userPreferences/UserPreferenceRepository.js +58 -0
  140. package/es/infrastructure/repositories/userPreferences/index.js +2 -0
  141. package/es/infrastructure/repositories/whatsAppPricing/WhatsAppPricingRepository.js +49 -0
  142. package/es/infrastructure/repositories/whatsAppPricing/index.js +2 -0
  143. package/package.json +2 -2
@@ -0,0 +1,44 @@
1
+ import { getCallsRequest, getCallRequest, updateCallStatusRequest, initiateCallRequest } from '../../../domain/dto';
2
+ import { ICallRepository } from '../../../domain/interfaces/repositories';
3
+ export default class CallAPI extends ICallRepository {
4
+ async getCalls() {
5
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCallsRequest();
6
+ const operation = 'getCalls';
7
+ const httpRequest = await this.request({
8
+ operation,
9
+ request
10
+ });
11
+ return httpRequest;
12
+ }
13
+
14
+ async getCall() {
15
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCallRequest();
16
+ const operation = 'getCall';
17
+ const httpRequest = await this.request({
18
+ operation,
19
+ request
20
+ });
21
+ return httpRequest;
22
+ }
23
+
24
+ async updateCallStatus() {
25
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updateCallStatusRequest();
26
+ const operation = 'updateCallStatus';
27
+ const httpRequest = await this.request({
28
+ operation,
29
+ request
30
+ });
31
+ return httpRequest;
32
+ }
33
+
34
+ async initiateCall() {
35
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initiateCallRequest();
36
+ const operation = 'initiateCall';
37
+ const httpRequest = await this.request({
38
+ operation,
39
+ request
40
+ });
41
+ return httpRequest;
42
+ }
43
+
44
+ }
@@ -0,0 +1 @@
1
+ export { default as CallAPI } from './CallAPI';
@@ -5,4 +5,8 @@ export * from './messages';
5
5
  export * from './agents';
6
6
  export * from './contacts';
7
7
  export * from './cannedMessages';
8
- export * from './templateMessages';
8
+ export * from './templateMessages';
9
+ export * from './integrationServices';
10
+ export * from './userPreferences';
11
+ export * from './whatsAppPricing';
12
+ export * from './calls';
@@ -0,0 +1,14 @@
1
+ import { getIntegrationsRequest } from '../../../domain/dto';
2
+ import { IIntegrationServiceRepository } from '../../../domain/interfaces/repositories';
3
+ export default class IntegrationServiceAPI extends IIntegrationServiceRepository {
4
+ async getIntegrations() {
5
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getIntegrationsRequest();
6
+ const operation = 'getIntegrations';
7
+ const httpRequest = await this.request({
8
+ request,
9
+ operation
10
+ });
11
+ return httpRequest;
12
+ }
13
+
14
+ }
@@ -0,0 +1,2 @@
1
+ import IntegrationServiceAPI from './IntegrationServiceAPI';
2
+ export { IntegrationServiceAPI };
@@ -0,0 +1,29 @@
1
+ import { HTTP_METHODS } from '../../../../core/constants';
2
+ import { getCallsRequest, getCallRequest, updateCallStatusRequest, initiateCallRequest } from '../../../../domain/dto';
3
+ import constructCallEndPoint from './constructCallEndPoint';
4
+ import createAPIRegistry from '../createAPIRegistry';
5
+ const SINGLE_CALL_URL = '/:callId';
6
+ const UPDATE_CALL_URL = `${SINGLE_CALL_URL}/status`;
7
+
8
+ function getCalls() {
9
+ return createAPIRegistry(constructCallEndPoint(), HTTP_METHODS.GET, getCallsRequest());
10
+ }
11
+
12
+ function getCall() {
13
+ return createAPIRegistry(constructCallEndPoint(SINGLE_CALL_URL), HTTP_METHODS.GET, getCallRequest());
14
+ }
15
+
16
+ function updateCallStatus() {
17
+ return createAPIRegistry(constructCallEndPoint(UPDATE_CALL_URL), HTTP_METHODS.PATCH, updateCallStatusRequest());
18
+ }
19
+
20
+ function initiateCall() {
21
+ return createAPIRegistry(constructCallEndPoint(), HTTP_METHODS.POST, initiateCallRequest());
22
+ }
23
+
24
+ export default {
25
+ getCalls,
26
+ getCall,
27
+ updateCallStatus,
28
+ initiateCall
29
+ };
@@ -0,0 +1,10 @@
1
+ import createBaseUrl from '../createBaseUrl';
2
+ export default function constructCallsEndPoint(extra) {
3
+ const base = '/calls';
4
+
5
+ if (extra) {
6
+ return createBaseUrl(base + extra);
7
+ }
8
+
9
+ return createBaseUrl(base);
10
+ }
@@ -0,0 +1 @@
1
+ export { default as callAPIRegistry } from './callAPIRegistry';
@@ -0,0 +1,4 @@
1
+ import createBaseUrl from './createBaseUrl';
2
+ export default function createPublicBaseUrl(path) {
3
+ return createBaseUrl(`/public${path}`);
4
+ }
@@ -7,7 +7,11 @@ import { agentAPIRegistry } from './agents';
7
7
  import { contactAPIRegistry } from './contacts';
8
8
  import { cannedMessageAPIRegistry } from './cannedMessages';
9
9
  import { templateMessageAPIRegistry } from './templateMessages';
10
+ import { integrationServiceAPIRegistry } from './integrationServices';
11
+ import { whatsAppPricingAPIRegistry } from './whatsAppPricing';
12
+ import { callAPIRegistry } from './calls';
10
13
  import { ModuleNames } from '../../../core/constants';
14
+ import { userPreferenceAPIRegistry } from './userPreferences';
11
15
  const APIRegistry = {
12
16
  [ModuleNames.CHANNELS]: channelAPIRegistry,
13
17
  [ModuleNames.SESSIONS]: sessionAPIRegistry,
@@ -16,7 +20,11 @@ const APIRegistry = {
16
20
  [ModuleNames.AGENTS]: agentAPIRegistry,
17
21
  [ModuleNames.CONTACTS]: contactAPIRegistry,
18
22
  [ModuleNames.CANNED_MESSAGES]: cannedMessageAPIRegistry,
19
- [ModuleNames.TEMPLATE_MESSAGES]: templateMessageAPIRegistry
23
+ [ModuleNames.TEMPLATE_MESSAGES]: templateMessageAPIRegistry,
24
+ [ModuleNames.INTEGRATION_SERVICES]: integrationServiceAPIRegistry,
25
+ [ModuleNames.USER_PREFERENCES]: userPreferenceAPIRegistry,
26
+ [ModuleNames.WHATSAPP_PRICING]: whatsAppPricingAPIRegistry,
27
+ [ModuleNames.CALLS]: callAPIRegistry
20
28
  };
21
29
  export default function getRegistryConfig(module, operation) {
22
30
  const moduleConfig = selectn(module, APIRegistry);
@@ -0,0 +1,10 @@
1
+ import createBaseUrl from '../createBaseUrl';
2
+ export default function constructIntegrationServiceEndPoint(extra) {
3
+ const base = '/integrations';
4
+
5
+ if (extra) {
6
+ return createBaseUrl(base + extra);
7
+ }
8
+
9
+ return createBaseUrl(base);
10
+ }
@@ -0,0 +1,2 @@
1
+ import integrationServiceAPIRegistry from './integrationServiceAPIRegistry';
2
+ export { integrationServiceAPIRegistry };
@@ -0,0 +1,12 @@
1
+ import { HTTP_METHODS } from '../../../../core/constants';
2
+ import { getIntegrationsRequest } from '../../../../domain/dto';
3
+ import createAPIRegistry from '../createAPIRegistry';
4
+ import constructIntegrationServiceEndPoint from './constructIntegrationServiceEndPoint';
5
+
6
+ function getIntegrations() {
7
+ return createAPIRegistry(constructIntegrationServiceEndPoint(), HTTP_METHODS.GET, getIntegrationsRequest());
8
+ }
9
+
10
+ export default {
11
+ getIntegrations
12
+ };
@@ -1,5 +1,5 @@
1
1
  import { HTTP_METHODS } from '../../../../core/constants';
2
- import { updateSessionAssigneeRequest, getSessionAttachmentsRequest, getSessionLastMessagesRequest, getSessionRequest, getSessionsRequest, markSessionAsReadRequest, updateSessionStatusRequest, pickupSessionRequest } from '../../../../domain/dto';
2
+ import { updateSessionAssigneeRequest, getSessionAttachmentsRequest, getSessionLastMessagesRequest, getSessionRequest, getSessionsRequest, markSessionAsReadRequest, updateSessionStatusRequest, pickupSessionRequest, getSessionMetricsRequest } from '../../../../domain/dto';
3
3
  import createAPIRegistry from '../createAPIRegistry';
4
4
  import constructSessionEndPoint from './constructSessionEndPoint';
5
5
  const SINGLE_SESSION_URL = '/:sessionId';
@@ -7,6 +7,7 @@ const SESSION_ATTACHMENTS_URL = `${SINGLE_SESSION_URL}/attachments`;
7
7
  const SESSION_LAST_MESSAGE = '/lastMessages';
8
8
  const MARK_AS_READ = `${SINGLE_SESSION_URL}/markAsRead`;
9
9
  const PICKUP_SESSION = `${SINGLE_SESSION_URL}/pickup`;
10
+ const SESSION_METRICS = '/metrics';
10
11
 
11
12
  function pickupSession() {
12
13
  return createAPIRegistry(constructSessionEndPoint(PICKUP_SESSION), HTTP_METHODS.POST, pickupSessionRequest());
@@ -40,6 +41,10 @@ function updateSessionStatus() {
40
41
  return createAPIRegistry(constructSessionEndPoint(SINGLE_SESSION_URL), HTTP_METHODS.PATCH, updateSessionStatusRequest());
41
42
  }
42
43
 
44
+ function getSessionMetrics() {
45
+ return createAPIRegistry(constructSessionEndPoint(SESSION_METRICS), HTTP_METHODS.GET, getSessionMetricsRequest());
46
+ }
47
+
43
48
  export default {
44
49
  updateAssignee,
45
50
  getSessions,
@@ -48,5 +53,6 @@ export default {
48
53
  getSessionLastMessages,
49
54
  markSessionAsRead,
50
55
  updateSessionStatus,
51
- pickupSession
56
+ pickupSession,
57
+ getSessionMetrics
52
58
  };
@@ -0,0 +1,10 @@
1
+ import createBaseUrl from '../createBaseUrl';
2
+ export default function constructUserPreferencesEndPoint(extra) {
3
+ const base = '/userPreferences';
4
+
5
+ if (extra) {
6
+ return createBaseUrl(base + extra);
7
+ }
8
+
9
+ return createBaseUrl(base);
10
+ }
@@ -0,0 +1,2 @@
1
+ import userPreferenceAPIRegistry from './userPreferenceAPIRegistry';
2
+ export { userPreferenceAPIRegistry };
@@ -0,0 +1,17 @@
1
+ import { HTTP_METHODS } from '../../../../core/constants';
2
+ import { getPreferencesRequest, updatePreferencesRequest } from '../../../../domain/dto';
3
+ import createAPIRegistry from '../createAPIRegistry';
4
+ import constructUserPreferencesEndPoint from './constructUserPreferencesEndPoint';
5
+
6
+ function getPreferences() {
7
+ return createAPIRegistry(constructUserPreferencesEndPoint(), HTTP_METHODS.GET, getPreferencesRequest());
8
+ }
9
+
10
+ function updatePreferences() {
11
+ return createAPIRegistry(constructUserPreferencesEndPoint(), HTTP_METHODS.PUT, updatePreferencesRequest());
12
+ }
13
+
14
+ export default {
15
+ getPreferences,
16
+ updatePreferences
17
+ };
@@ -0,0 +1,10 @@
1
+ import createPublicBaseUrl from '../createPublicBaseUrl';
2
+ export default function constructWhatsAppPricingEndPoint(extra) {
3
+ const base = '/whatsAppPricing';
4
+
5
+ if (extra) {
6
+ return createPublicBaseUrl(base + extra);
7
+ }
8
+
9
+ return createPublicBaseUrl(base);
10
+ }
@@ -0,0 +1,2 @@
1
+ import whatsAppPricingAPIRegistry from './whatsAppPricingAPIRegistry';
2
+ export { whatsAppPricingAPIRegistry };
@@ -0,0 +1,13 @@
1
+ import { HTTP_METHODS } from '../../../../core/constants';
2
+ import { calculateWhatsAppPricingRequest } from '../../../../domain/dto';
3
+ import createAPIRegistry from '../createAPIRegistry';
4
+ import constructWhatsAppPricingEndPoint from './constructWhatsAppPricingEndPoint';
5
+
6
+ function calculateWhatsAppPricing() {
7
+ return createAPIRegistry(constructWhatsAppPricingEndPoint(), HTTP_METHODS.POST, calculateWhatsAppPricingRequest());
8
+ }
9
+
10
+ const whatsAppPricingAPIRegistry = {
11
+ calculateWhatsAppPricing
12
+ };
13
+ export default whatsAppPricingAPIRegistry;
@@ -1,4 +1,4 @@
1
- import { updateSessionAssigneeRequest, getSessionsRequest, getSessionRequest, getSessionAttachmentsRequest, getSessionLastMessagesRequest, markSessionAsReadRequest, updateSessionStatusRequest, pickupSessionRequest } from '../../../domain/dto';
1
+ import { updateSessionAssigneeRequest, getSessionsRequest, getSessionRequest, getSessionAttachmentsRequest, getSessionLastMessagesRequest, markSessionAsReadRequest, updateSessionStatusRequest, pickupSessionRequest, getSessionMetricsRequest } from '../../../domain/dto';
2
2
  import { ISessionRepository } from '../../../domain/interfaces/repositories';
3
3
  export default class SessionAPI extends ISessionRepository {
4
4
  async pickupSession() {
@@ -81,4 +81,14 @@ export default class SessionAPI extends ISessionRepository {
81
81
  return httpRequest;
82
82
  }
83
83
 
84
+ async getSessionMetrics() {
85
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getSessionMetricsRequest();
86
+ const operation = 'getSessionMetrics';
87
+ const httpRequest = await this.request({
88
+ request,
89
+ operation
90
+ });
91
+ return httpRequest;
92
+ }
93
+
84
94
  }
@@ -0,0 +1,24 @@
1
+ import { getPreferencesRequest, updatePreferencesRequest } from '../../../domain/dto';
2
+ import { IUserPreferenceRepository } from '../../../domain/interfaces/repositories';
3
+ export default class UserPreferenceAPI extends IUserPreferenceRepository {
4
+ async getPreferences() {
5
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getPreferencesRequest();
6
+ const operation = 'getPreferences';
7
+ const httpRequest = await this.request({
8
+ request,
9
+ operation
10
+ });
11
+ return httpRequest;
12
+ }
13
+
14
+ async updatePreferences() {
15
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updatePreferencesRequest();
16
+ const operation = 'updatePreferences';
17
+ const httpRequest = await this.request({
18
+ request,
19
+ operation
20
+ });
21
+ return httpRequest;
22
+ }
23
+
24
+ }
@@ -0,0 +1,2 @@
1
+ import UserPreferenceAPI from './UserPreferenceAPI';
2
+ export { UserPreferenceAPI };
@@ -0,0 +1,14 @@
1
+ import { calculateWhatsAppPricingRequest } from '../../../domain/dto';
2
+ import { IWhatsAppPricingRepository } from '../../../domain/interfaces/repositories';
3
+ export default class WhatsAppPricingAPI extends IWhatsAppPricingRepository {
4
+ async calculateWhatsAppPricing() {
5
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : calculateWhatsAppPricingRequest();
6
+ const operation = 'calculateWhatsAppPricing';
7
+ const httpRequest = await this.request({
8
+ request,
9
+ operation
10
+ });
11
+ return httpRequest;
12
+ }
13
+
14
+ }
@@ -0,0 +1,2 @@
1
+ import WhatsAppPricingAPI from './WhatsAppPricingAPI';
2
+ export { WhatsAppPricingAPI };
@@ -2,15 +2,18 @@ class ConfigRegistry {
2
2
  constructor() {
3
3
  this.baseURL = null;
4
4
  this.httpClient = null;
5
+ this.publicHttpClient = null;
5
6
  }
6
7
 
7
8
  setConfig(_ref) {
8
9
  let {
9
10
  baseURL,
10
- httpClient
11
+ httpClient,
12
+ publicHttpClient
11
13
  } = _ref;
12
14
  this.baseURL = baseURL;
13
15
  this.httpClient = httpClient;
16
+ this.publicHttpClient = publicHttpClient || null;
14
17
  }
15
18
 
16
19
  getBaseURL() {
@@ -21,6 +24,10 @@ class ConfigRegistry {
21
24
  return this.httpClient;
22
25
  }
23
26
 
27
+ getPublicHttpClient() {
28
+ return this.publicHttpClient;
29
+ }
30
+
24
31
  }
25
32
 
26
33
  const configRegistry = new ConfigRegistry();
@@ -0,0 +1,73 @@
1
+ import { CallAdapter } from '../../adapters';
2
+ import { CallAPI } from '../../api';
3
+ import { ICallRepository } from '../../../domain/interfaces/repositories/calls';
4
+ import { ResponseTypes } from '../../../core/constants';
5
+ export default class CallRepository extends ICallRepository {
6
+ constructor(_ref) {
7
+ let {
8
+ callAPI,
9
+ callAdapter
10
+ } = _ref;
11
+ super();
12
+ this.defaultAPI = new CallAPI();
13
+ this.customAPI = callAPI;
14
+ this.callAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
15
+ this.callAdapter = callAdapter || new CallAdapter();
16
+ }
17
+
18
+ async invokeAPI(_ref2) {
19
+ let {
20
+ operation,
21
+ request,
22
+ adapter = this.callAdapter,
23
+ responseType
24
+ } = _ref2;
25
+ return this.executeAPICall({
26
+ operation,
27
+ request,
28
+ apiProxy: this.callAPI,
29
+ customAPI: this.customAPI,
30
+ adapter,
31
+ responseType
32
+ });
33
+ }
34
+
35
+ async getCalls(request) {
36
+ return this.invokeAPI({
37
+ operation: 'getCalls',
38
+ request,
39
+ responseType: ResponseTypes.LIST
40
+ });
41
+ }
42
+
43
+ async getCall(request) {
44
+ return this.invokeAPI({
45
+ operation: 'getCall',
46
+ request
47
+ });
48
+ }
49
+
50
+ async updateCallStatus(request) {
51
+ return this.invokeAPI({
52
+ operation: 'updateCallStatus',
53
+ request
54
+ });
55
+ }
56
+
57
+ async initiateCall(request) {
58
+ return this.invokeAPI({
59
+ operation: 'initiateCall',
60
+ request
61
+ });
62
+ }
63
+
64
+ toJSON() {
65
+ return {
66
+ getCalls: this.getCalls.bind(this),
67
+ getCall: this.getCall.bind(this),
68
+ updateCallStatus: this.updateCallStatus.bind(this),
69
+ initiateCall: this.initiateCall.bind(this)
70
+ };
71
+ }
72
+
73
+ }
@@ -0,0 +1 @@
1
+ export { default as CallRepository } from './CallRepository';
@@ -40,9 +40,18 @@ export default class ChannelRepository extends IChannelRepository {
40
40
  });
41
41
  }
42
42
 
43
+ async getChannel(request) {
44
+ return this.invokeAPI({
45
+ operation: 'getChannel',
46
+ request,
47
+ responseType: ResponseTypes.SINGLE
48
+ });
49
+ }
50
+
43
51
  toJSON() {
44
52
  return {
45
- getChannels: this.getChannels.bind(this)
53
+ getChannels: this.getChannels.bind(this),
54
+ getChannel: this.getChannel.bind(this)
46
55
  };
47
56
  }
48
57
 
@@ -5,4 +5,8 @@ export * from './messages';
5
5
  export * from './agents';
6
6
  export * from './contacts';
7
7
  export * from './cannedMessages';
8
- export * from './templateMessages';
8
+ export * from './templateMessages';
9
+ export * from './integrationServices';
10
+ export * from './userPreferences';
11
+ export * from './whatsAppPricing';
12
+ export * from './calls';
@@ -0,0 +1,49 @@
1
+ import { IIntegrationServiceRepository } from '../../../domain/interfaces/repositories';
2
+ import { IntegrationServiceAdapter } from '../../adapters';
3
+ import { IntegrationServiceAPI } from '../../api';
4
+ import { ResponseTypes } from '../../../core/constants';
5
+ export default class IntegrationServiceRepository extends IIntegrationServiceRepository {
6
+ constructor(_ref) {
7
+ let {
8
+ integrationServiceAPI,
9
+ integrationServiceAdapter
10
+ } = _ref;
11
+ super();
12
+ this.defaultAPI = new IntegrationServiceAPI();
13
+ this.customAPI = integrationServiceAPI;
14
+ this.integrationServiceAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
15
+ this.integrationServiceAdapter = integrationServiceAdapter || new IntegrationServiceAdapter();
16
+ }
17
+
18
+ async invokeAPI(_ref2) {
19
+ let {
20
+ operation,
21
+ request,
22
+ adapter = this.integrationServiceAdapter,
23
+ responseType
24
+ } = _ref2;
25
+ return this.executeAPICall({
26
+ operation,
27
+ request,
28
+ apiProxy: this.integrationServiceAPI,
29
+ customAPI: this.customAPI,
30
+ adapter,
31
+ responseType
32
+ });
33
+ }
34
+
35
+ async getIntegrations(request) {
36
+ return this.invokeAPI({
37
+ operation: 'getIntegrations',
38
+ request,
39
+ responseType: ResponseTypes.LIST
40
+ });
41
+ }
42
+
43
+ toJSON() {
44
+ return {
45
+ getIntegrations: this.getIntegrations.bind(this)
46
+ };
47
+ }
48
+
49
+ }
@@ -0,0 +1,2 @@
1
+ import IntegrationServiceRepository from './IntegrationServiceRepository';
2
+ export { IntegrationServiceRepository };
@@ -1,4 +1,4 @@
1
- import { AttachmentAdapter, MessageAdapter, SessionAdapter } from '../../adapters/index';
1
+ import { AttachmentAdapter, MessageAdapter, SessionAdapter, SessionMetricsAdapter } from '../../adapters/index';
2
2
  import { ISessionRepository } from '../../../domain/interfaces/repositories';
3
3
  import { SessionAPI } from '../../api';
4
4
  import { ResponseTypes } from '../../../core/constants';
@@ -8,7 +8,8 @@ export default class SessionRepository extends ISessionRepository {
8
8
  sessionAPI,
9
9
  sessionAdapter,
10
10
  attachmentAdapter,
11
- messageAdapter
11
+ messageAdapter,
12
+ sessionMetricsAdapter
12
13
  } = _ref;
13
14
  super();
14
15
  this.defaultAPI = new SessionAPI();
@@ -17,6 +18,7 @@ export default class SessionRepository extends ISessionRepository {
17
18
  this.sessionAdapter = sessionAdapter || new SessionAdapter();
18
19
  this.attachmentAdapter = attachmentAdapter || new AttachmentAdapter();
19
20
  this.messageAdapter = messageAdapter || new MessageAdapter();
21
+ this.sessionMetricsAdapter = sessionMetricsAdapter || new SessionMetricsAdapter();
20
22
  }
21
23
 
22
24
  async invokeAPI(_ref2) {
@@ -97,6 +99,14 @@ export default class SessionRepository extends ISessionRepository {
97
99
  });
98
100
  }
99
101
 
102
+ async getSessionMetrics(request) {
103
+ return this.invokeAPI({
104
+ operation: 'getSessionMetrics',
105
+ request,
106
+ adapter: this.sessionMetricsAdapter
107
+ });
108
+ }
109
+
100
110
  toJSON() {
101
111
  return {
102
112
  pickupSession: this.pickupSession.bind(this),
@@ -106,7 +116,8 @@ export default class SessionRepository extends ISessionRepository {
106
116
  getSessionAttachments: this.getSessionAttachments.bind(this),
107
117
  getSessionLastMessages: this.getSessionLastMessages.bind(this),
108
118
  markSessionAsRead: this.markSessionAsRead.bind(this),
109
- updateSessionStatus: this.updateSessionStatus.bind(this)
119
+ updateSessionStatus: this.updateSessionStatus.bind(this),
120
+ getSessionMetrics: this.getSessionMetrics.bind(this)
110
121
  };
111
122
  }
112
123
 
@@ -0,0 +1,58 @@
1
+ import { IUserPreferenceRepository } from '../../../domain/interfaces/repositories';
2
+ import { UserPreferenceAdapter } from '../../adapters';
3
+ import { UserPreferenceAPI } from '../../api';
4
+ import { ResponseTypes } from '../../../core/constants';
5
+ export default class UserPreferenceRepository extends IUserPreferenceRepository {
6
+ constructor(_ref) {
7
+ let {
8
+ userPreferenceAPI,
9
+ userPreferenceAdapter
10
+ } = _ref;
11
+ super();
12
+ this.defaultAPI = new UserPreferenceAPI();
13
+ this.customAPI = userPreferenceAPI;
14
+ this.userPreferenceAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
15
+ this.userPreferenceAdapter = userPreferenceAdapter || new UserPreferenceAdapter();
16
+ }
17
+
18
+ async invokeAPI(_ref2) {
19
+ let {
20
+ operation,
21
+ request,
22
+ adapter = this.userPreferenceAdapter,
23
+ responseType
24
+ } = _ref2;
25
+ return this.executeAPICall({
26
+ operation,
27
+ request,
28
+ apiProxy: this.userPreferenceAPI,
29
+ customAPI: this.customAPI,
30
+ adapter,
31
+ responseType
32
+ });
33
+ }
34
+
35
+ async getPreferences(request) {
36
+ return this.invokeAPI({
37
+ operation: 'getPreferences',
38
+ request,
39
+ responseType: ResponseTypes.SINGLE
40
+ });
41
+ }
42
+
43
+ async updatePreferences(request) {
44
+ return this.invokeAPI({
45
+ operation: 'updatePreferences',
46
+ request,
47
+ responseType: ResponseTypes.SINGLE
48
+ });
49
+ }
50
+
51
+ toJSON() {
52
+ return {
53
+ getPreferences: this.getPreferences.bind(this),
54
+ updatePreferences: this.updatePreferences.bind(this)
55
+ };
56
+ }
57
+
58
+ }
@@ -0,0 +1,2 @@
1
+ import UserPreferenceRepository from './UserPreferenceRepository';
2
+ export { UserPreferenceRepository };