@zohoim/client-sdk 1.0.0-replyAreaPoc9 → 1.0.0-subscription2
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/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/subscription/SubscriptionService.js +36 -0
- package/es/application/services/subscription/index.js +2 -0
- 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/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 +6 -1
- package/es/domain/dto/sessions/getSessionMetricsRequest.js +16 -0
- package/es/domain/dto/sessions/index.js +2 -1
- package/es/domain/dto/subscription/buyAddOnRequest.js +18 -0
- package/es/domain/dto/subscription/getAddOnsRequest.js +15 -0
- package/es/domain/dto/subscription/getLicenseDetailsRequest.js +7 -0
- package/es/domain/dto/subscription/index.js +4 -0
- package/es/domain/dto/subscription/modifyAddOnRequest.js +18 -0
- 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/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/Subscription/AddOn.js +26 -0
- package/es/domain/entities/Subscription/LicenseDetails.js +21 -0
- package/es/domain/entities/Subscription/SubscriptionInfo.js +26 -0
- package/es/domain/entities/Subscription/index.js +4 -0
- 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/index.js +3 -1
- package/es/domain/enum/session/AssigneeFilter.js +6 -0
- package/es/domain/enum/session/SessionReplyStatus.js +4 -1
- package/es/domain/enum/session/SessionStatus.js +2 -1
- package/es/domain/enum/session/index.js +2 -1
- package/es/domain/enum/subscription/AddOnModule.js +5 -0
- package/es/domain/enum/subscription/AddOnName.js +5 -0
- package/es/domain/enum/subscription/AddOnType.js +5 -0
- package/es/domain/enum/subscription/SubscriptionStatus.js +4 -0
- package/es/domain/enum/subscription/index.js +5 -0
- package/es/domain/enum/userPreference/CollapseSidePanel.js +5 -0
- package/es/domain/enum/userPreference/index.js +2 -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/subscription/ISubscriptionRepository.js +32 -0
- package/es/domain/interfaces/repositories/subscription/index.js +2 -0
- 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/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/subscription/AddOnSchema.js +29 -0
- package/es/domain/schema/subscription/LicenseDetailsSchema.js +7 -0
- package/es/domain/schema/subscription/SubscriptionInfoSchema.js +29 -0
- package/es/domain/schema/subscription/index.js +4 -0
- 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 +84 -24
- package/es/frameworks/managers/ModuleManager.js +25 -2
- package/es/frameworks/sdk/IMSDK.js +33 -11
- package/es/frameworks/sdk/integrationServices/IntegrationServiceSDK.js +30 -0
- package/es/frameworks/sdk/integrationServices/index.js +2 -0
- package/es/frameworks/sdk/subscription/SubscriptionSDK.js +32 -0
- package/es/frameworks/sdk/subscription/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/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/subscription/AddOnAdapter.js +24 -0
- package/es/infrastructure/adapters/subscription/LicenseDetailsAdapter.js +20 -0
- package/es/infrastructure/adapters/subscription/index.js +3 -0
- 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/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/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/subscription/constructSubscriptionEndPoint.js +10 -0
- package/es/infrastructure/api/registry/subscription/index.js +2 -0
- package/es/infrastructure/api/registry/subscription/subscriptionAPIRegistry.js +30 -0
- 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/subscription/SubscriptionAPI.js +48 -0
- package/es/infrastructure/api/subscription/index.js +2 -0
- 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/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/subscription/SubscriptionRepository.js +83 -0
- package/es/infrastructure/repositories/subscription/index.js +2 -0
- 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 +1 -1
|
@@ -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 './subscription';
|
|
@@ -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
|
+
}
|
|
@@ -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';
|
|
10
12
|
import { ModuleNames } from '../../../core/constants';
|
|
13
|
+
import { userPreferenceAPIRegistry } from './userPreferences';
|
|
14
|
+
import { subscriptionAPIRegistry } from './subscription';
|
|
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.SUBSCRIPTION]: subscriptionAPIRegistry
|
|
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,30 @@
|
|
|
1
|
+
import { HTTP_METHODS } from '../../../../core/constants';
|
|
2
|
+
import { getAddOnsRequest, buyAddOnRequest, modifyAddOnRequest, getLicenseDetailsRequest } from '../../../../domain/dto';
|
|
3
|
+
import createAPIRegistry from '../createAPIRegistry';
|
|
4
|
+
import constructSubscriptionEndPoint from './constructSubscriptionEndPoint';
|
|
5
|
+
const ADD_ON_URL = '/addOn';
|
|
6
|
+
const LICENSE_URL = '/license';
|
|
7
|
+
|
|
8
|
+
function getAddOns() {
|
|
9
|
+
return createAPIRegistry(constructSubscriptionEndPoint(ADD_ON_URL), HTTP_METHODS.GET, getAddOnsRequest());
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function buyAddOn() {
|
|
13
|
+
return createAPIRegistry(constructSubscriptionEndPoint(ADD_ON_URL), HTTP_METHODS.POST, buyAddOnRequest());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function modifyAddOn() {
|
|
17
|
+
return createAPIRegistry(constructSubscriptionEndPoint(ADD_ON_URL), HTTP_METHODS.PATCH, modifyAddOnRequest());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getLicenseDetails() {
|
|
21
|
+
return createAPIRegistry(constructSubscriptionEndPoint(LICENSE_URL), HTTP_METHODS.GET, getLicenseDetailsRequest());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const subscriptionAPIRegistry = {
|
|
25
|
+
getAddOns,
|
|
26
|
+
buyAddOn,
|
|
27
|
+
modifyAddOn,
|
|
28
|
+
getLicenseDetails
|
|
29
|
+
};
|
|
30
|
+
export default subscriptionAPIRegistry;
|
|
@@ -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,48 @@
|
|
|
1
|
+
import { getAddOnsRequest, buyAddOnRequest, modifyAddOnRequest, getLicenseDetailsRequest } from '../../../domain/dto';
|
|
2
|
+
import { ISubscriptionRepository } from '../../../domain/interfaces/repositories';
|
|
3
|
+
export default class SubscriptionAPI extends ISubscriptionRepository {
|
|
4
|
+
async getAddOns() {
|
|
5
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getAddOnsRequest();
|
|
6
|
+
const operation = 'getAddOns'; // No I18N
|
|
7
|
+
|
|
8
|
+
const httpRequest = await this.request({
|
|
9
|
+
request,
|
|
10
|
+
operation
|
|
11
|
+
});
|
|
12
|
+
return httpRequest;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async buyAddOn() {
|
|
16
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : buyAddOnRequest();
|
|
17
|
+
const operation = 'buyAddOn'; // No I18N
|
|
18
|
+
|
|
19
|
+
const httpRequest = await this.request({
|
|
20
|
+
request,
|
|
21
|
+
operation
|
|
22
|
+
});
|
|
23
|
+
return httpRequest;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async modifyAddOn() {
|
|
27
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : modifyAddOnRequest();
|
|
28
|
+
const operation = 'modifyAddOn'; // No I18N
|
|
29
|
+
|
|
30
|
+
const httpRequest = await this.request({
|
|
31
|
+
request,
|
|
32
|
+
operation
|
|
33
|
+
});
|
|
34
|
+
return httpRequest;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async getLicenseDetails() {
|
|
38
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getLicenseDetailsRequest();
|
|
39
|
+
const operation = 'getLicenseDetails'; // No I18N
|
|
40
|
+
|
|
41
|
+
const httpRequest = await this.request({
|
|
42
|
+
request,
|
|
43
|
+
operation
|
|
44
|
+
});
|
|
45
|
+
return httpRequest;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
@@ -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();
|
|
@@ -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 './subscription';
|
|
@@ -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,83 @@
|
|
|
1
|
+
import { AddOnAdapter, LicenseDetailsAdapter } from '../../adapters/index';
|
|
2
|
+
import { ISubscriptionRepository } from '../../../domain/interfaces/repositories';
|
|
3
|
+
import { SubscriptionAPI } from '../../api';
|
|
4
|
+
import { ResponseTypes } from '../../../core/constants';
|
|
5
|
+
export default class SubscriptionRepository extends ISubscriptionRepository {
|
|
6
|
+
constructor(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
subscriptionAPI,
|
|
9
|
+
addOnAdapter,
|
|
10
|
+
licenseDetailsAdapter
|
|
11
|
+
} = _ref;
|
|
12
|
+
super();
|
|
13
|
+
this.defaultAPI = new SubscriptionAPI();
|
|
14
|
+
this.customAPI = subscriptionAPI;
|
|
15
|
+
this.subscriptionAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
|
|
16
|
+
this.addOnAdapter = addOnAdapter || new AddOnAdapter();
|
|
17
|
+
this.licenseDetailsAdapter = licenseDetailsAdapter || new LicenseDetailsAdapter();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async invokeAPI(_ref2) {
|
|
21
|
+
let {
|
|
22
|
+
operation,
|
|
23
|
+
request,
|
|
24
|
+
adapter = this.addOnAdapter,
|
|
25
|
+
responseType
|
|
26
|
+
} = _ref2;
|
|
27
|
+
return this.executeAPICall({
|
|
28
|
+
operation,
|
|
29
|
+
request,
|
|
30
|
+
apiProxy: this.subscriptionAPI,
|
|
31
|
+
customAPI: this.customAPI,
|
|
32
|
+
adapter,
|
|
33
|
+
responseType
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async getAddOns(request) {
|
|
38
|
+
return this.invokeAPI({
|
|
39
|
+
operation: 'getAddOns',
|
|
40
|
+
// No I18N
|
|
41
|
+
request,
|
|
42
|
+
responseType: ResponseTypes.LIST
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async buyAddOn(request) {
|
|
47
|
+
return this.invokeAPI({
|
|
48
|
+
operation: 'buyAddOn',
|
|
49
|
+
// No I18N
|
|
50
|
+
request,
|
|
51
|
+
responseType: ResponseTypes.SINGLE
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async modifyAddOn(request) {
|
|
56
|
+
return this.invokeAPI({
|
|
57
|
+
operation: 'modifyAddOn',
|
|
58
|
+
// No I18N
|
|
59
|
+
request,
|
|
60
|
+
responseType: ResponseTypes.SINGLE
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async getLicenseDetails(request) {
|
|
65
|
+
return this.invokeAPI({
|
|
66
|
+
operation: 'getLicenseDetails',
|
|
67
|
+
// No I18N
|
|
68
|
+
request,
|
|
69
|
+
adapter: this.licenseDetailsAdapter,
|
|
70
|
+
responseType: ResponseTypes.SINGLE
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
toJSON() {
|
|
75
|
+
return {
|
|
76
|
+
getAddOns: this.getAddOns.bind(this),
|
|
77
|
+
buyAddOn: this.buyAddOn.bind(this),
|
|
78
|
+
modifyAddOn: this.modifyAddOn.bind(this),
|
|
79
|
+
getLicenseDetails: this.getLicenseDetails.bind(this)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}
|