@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.
- package/es/application/services/calls/CallService.js +36 -0
- package/es/application/services/calls/index.js +1 -0
- package/es/application/services/channels/ChannelService.js +6 -1
- package/es/application/services/index.js +5 -1
- package/es/application/services/integrationServices/IntegrationService.js +21 -0
- package/es/application/services/integrationServices/index.js +2 -0
- package/es/application/services/sessions/SessionService.js +6 -1
- package/es/application/services/userPreferences/UserPreferenceService.js +26 -0
- package/es/application/services/userPreferences/index.js +2 -0
- package/es/application/services/whatsAppPricing/WhatsAppPricingService.js +21 -0
- package/es/application/services/whatsAppPricing/index.js +2 -0
- package/es/core/constants/ModuleNames.js +5 -1
- package/es/core/constants/ModuleTypes.js +5 -0
- package/es/core/constants/index.js +2 -1
- package/es/core/utils/validateSchema.js +25 -0
- package/es/domain/dto/calls/getCallRequest.js +14 -0
- package/es/domain/dto/calls/getCallsRequest.js +20 -0
- package/es/domain/dto/calls/index.js +4 -0
- package/es/domain/dto/calls/initiateCallRequest.js +15 -0
- package/es/domain/dto/calls/updateCallStatusRequest.js +15 -0
- package/es/domain/dto/channels/getChannelRequest.js +13 -0
- package/es/domain/dto/channels/getChannelsRequest.js +3 -1
- package/es/domain/dto/channels/index.js +2 -1
- package/es/domain/dto/index.js +5 -1
- package/es/domain/dto/integrationServices/getIntegrationsRequest.js +7 -0
- package/es/domain/dto/integrationServices/index.js +1 -0
- package/es/domain/dto/sessions/getSessionAttachmentsRequest.js +5 -2
- package/es/domain/dto/sessions/getSessionMetricsRequest.js +16 -0
- package/es/domain/dto/sessions/index.js +2 -1
- package/es/domain/dto/userPreferences/getPreferencesRequest.js +7 -0
- package/es/domain/dto/userPreferences/index.js +2 -0
- package/es/domain/dto/userPreferences/updatePreferencesRequest.js +9 -0
- package/es/domain/dto/whatsAppPricing/calculateWhatsAppPricingRequest.js +14 -0
- package/es/domain/dto/whatsAppPricing/index.js +1 -0
- package/es/domain/entities/Actor/Actor.js +4 -0
- package/es/domain/entities/Call/Call.js +47 -0
- package/es/domain/entities/Call/index.js +1 -0
- package/es/domain/entities/Channel/Channel.js +22 -4
- package/es/domain/entities/IntegrationService/IntegrationService.js +8 -1
- package/es/domain/entities/Session/SessionMetrics.js +21 -0
- package/es/domain/entities/Session/index.js +2 -1
- package/es/domain/entities/UserPreference/UserPreference.js +26 -0
- package/es/domain/entities/UserPreference/index.js +2 -0
- package/es/domain/entities/WhatsAppPricing/WhatsAppPricing.js +25 -0
- package/es/domain/entities/WhatsAppPricing/WhatsAppPricingCategory.js +22 -0
- package/es/domain/entities/WhatsAppPricing/index.js +3 -0
- package/es/domain/entities/index.js +4 -1
- package/es/domain/enum/call/CallStatus.js +8 -0
- package/es/domain/enum/call/index.js +1 -0
- package/es/domain/enum/index.js +3 -1
- package/es/domain/enum/session/AssigneeFilter.js +6 -0
- package/es/domain/enum/session/SessionStatus.js +2 -1
- package/es/domain/enum/session/index.js +2 -1
- package/es/domain/enum/userPreference/CollapseSidePanel.js +5 -0
- package/es/domain/enum/userPreference/index.js +2 -0
- package/es/domain/interfaces/repositories/calls/ICallRepository.js +32 -0
- package/es/domain/interfaces/repositories/calls/index.js +1 -0
- package/es/domain/interfaces/repositories/channels/IChannelRepository.js +7 -1
- package/es/domain/interfaces/repositories/index.js +5 -1
- package/es/domain/interfaces/repositories/integrationServices/IIntegrationServiceRepository.js +17 -0
- package/es/domain/interfaces/repositories/integrationServices/index.js +2 -0
- package/es/domain/interfaces/repositories/sessions/ISessionRepository.js +6 -1
- package/es/domain/interfaces/repositories/userPreferences/IUserPreferenceRepository.js +23 -0
- package/es/domain/interfaces/repositories/userPreferences/index.js +2 -0
- package/es/domain/interfaces/repositories/whatsAppPricing/IWhatsAppPricingRepository.js +18 -0
- package/es/domain/interfaces/repositories/whatsAppPricing/index.js +2 -0
- package/es/domain/schema/call/CallSchema.js +63 -0
- package/es/domain/schema/call/index.js +1 -0
- package/es/domain/schema/channel/ChannelSchema.js +39 -5
- package/es/domain/schema/index.js +4 -1
- package/es/domain/schema/integrationService/IntegrationServiceSchema.js +12 -0
- package/es/domain/schema/session/SessionMetrics/AssigneeSchema.js +20 -0
- package/es/domain/schema/session/SessionMetrics/SessionMetricsForAssigneeSchema.js +32 -0
- package/es/domain/schema/session/SessionMetrics/index.js +2 -0
- package/es/domain/schema/session/SessionMetricsSchema.js +9 -0
- package/es/domain/schema/session/index.js +2 -1
- package/es/domain/schema/userPreference/UserPreferenceSchema.js +9 -0
- package/es/domain/schema/userPreference/index.js +2 -0
- package/es/domain/schema/whatsAppPricing/WhatsAppPricingCategorySchema.js +11 -0
- package/es/domain/schema/whatsAppPricing/WhatsAppPricingSchema.js +21 -0
- package/es/domain/schema/whatsAppPricing/index.js +3 -0
- package/es/frameworks/managers/ModuleFactory.js +81 -23
- package/es/frameworks/managers/ModuleManager.js +25 -2
- package/es/frameworks/sdk/IMSDK.js +33 -11
- package/es/frameworks/sdk/calls/CallSDK.js +27 -0
- package/es/frameworks/sdk/calls/index.js +1 -0
- package/es/frameworks/sdk/integrationServices/IntegrationServiceSDK.js +30 -0
- package/es/frameworks/sdk/integrationServices/index.js +2 -0
- package/es/frameworks/sdk/userPreferences/UserPreferencesSDK.js +30 -0
- package/es/frameworks/sdk/userPreferences/index.js +2 -0
- package/es/frameworks/sdk/whatsAppPricing/WhatsAppPricingSDK.js +28 -0
- package/es/frameworks/sdk/whatsAppPricing/index.js +2 -0
- package/es/infrastructure/adapters/calls/CallAdapter.js +31 -0
- package/es/infrastructure/adapters/calls/index.js +1 -0
- package/es/infrastructure/adapters/channels/ChannelAdapter.js +16 -2
- package/es/infrastructure/adapters/index.js +5 -1
- package/es/infrastructure/adapters/integrationServices/IntegrationServiceAdapter.js +25 -0
- package/es/infrastructure/adapters/integrationServices/index.js +2 -0
- package/es/infrastructure/adapters/sessions/SessionMetricsAdapter.js +19 -0
- package/es/infrastructure/adapters/sessions/index.js +2 -1
- package/es/infrastructure/adapters/userPreferences/UserPreferenceAdapter.js +19 -0
- package/es/infrastructure/adapters/userPreferences/index.js +2 -0
- package/es/infrastructure/adapters/whatsAppPricing/WhatsAppPricingAdapter.js +22 -0
- package/es/infrastructure/adapters/whatsAppPricing/index.js +2 -0
- package/es/infrastructure/api/BaseAPI.js +5 -4
- package/es/infrastructure/api/calls/CallAPI.js +44 -0
- package/es/infrastructure/api/calls/index.js +1 -0
- package/es/infrastructure/api/index.js +5 -1
- package/es/infrastructure/api/integrationServices/IntegrationServiceAPI.js +14 -0
- package/es/infrastructure/api/integrationServices/index.js +2 -0
- package/es/infrastructure/api/registry/calls/callAPIRegistry.js +29 -0
- package/es/infrastructure/api/registry/calls/constructCallEndPoint.js +10 -0
- package/es/infrastructure/api/registry/calls/index.js +1 -0
- package/es/infrastructure/api/registry/createPublicBaseUrl.js +4 -0
- package/es/infrastructure/api/registry/getRegistryConfig.js +9 -1
- package/es/infrastructure/api/registry/integrationServices/constructIntegrationServiceEndPoint.js +10 -0
- package/es/infrastructure/api/registry/integrationServices/index.js +2 -0
- package/es/infrastructure/api/registry/integrationServices/integrationServiceAPIRegistry.js +12 -0
- package/es/infrastructure/api/registry/sessions/sessionAPIRegistry.js +8 -2
- package/es/infrastructure/api/registry/userPreferences/constructUserPreferencesEndPoint.js +10 -0
- package/es/infrastructure/api/registry/userPreferences/index.js +2 -0
- package/es/infrastructure/api/registry/userPreferences/userPreferenceAPIRegistry.js +17 -0
- package/es/infrastructure/api/registry/whatsAppPricing/constructWhatsAppPricingEndPoint.js +10 -0
- package/es/infrastructure/api/registry/whatsAppPricing/index.js +2 -0
- package/es/infrastructure/api/registry/whatsAppPricing/whatsAppPricingAPIRegistry.js +13 -0
- package/es/infrastructure/api/sessions/SessionAPI.js +11 -1
- package/es/infrastructure/api/userPreferences/UserPreferenceAPI.js +24 -0
- package/es/infrastructure/api/userPreferences/index.js +2 -0
- package/es/infrastructure/api/whatsAppPricing/WhatsAppPricingAPI.js +14 -0
- package/es/infrastructure/api/whatsAppPricing/index.js +2 -0
- package/es/infrastructure/config/configRegistry.js +8 -1
- package/es/infrastructure/repositories/calls/CallRepository.js +73 -0
- package/es/infrastructure/repositories/calls/index.js +1 -0
- package/es/infrastructure/repositories/channels/ChannelRepository.js +10 -1
- package/es/infrastructure/repositories/index.js +5 -1
- package/es/infrastructure/repositories/integrationServices/IntegrationServiceRepository.js +49 -0
- package/es/infrastructure/repositories/integrationServices/index.js +2 -0
- package/es/infrastructure/repositories/sessions/SessionRepository.js +14 -3
- package/es/infrastructure/repositories/userPreferences/UserPreferenceRepository.js +58 -0
- package/es/infrastructure/repositories/userPreferences/index.js +2 -0
- package/es/infrastructure/repositories/whatsAppPricing/WhatsAppPricingRepository.js +49 -0
- package/es/infrastructure/repositories/whatsAppPricing/index.js +2 -0
- 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,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 @@
|
|
|
1
|
+
export { default as callAPIRegistry } from './callAPIRegistry';
|
|
@@ -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,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,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,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,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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|