@zohoim/client-sdk 1.0.0-canned08 → 1.0.0-leftPanelPoc2
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/cannedMessages/CannedMessageService.js +1 -21
- package/es/application/services/channels/ChannelService.js +6 -1
- package/es/application/services/index.js +3 -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/templateMessages/TemplateMessageService.js +1 -6
- package/es/application/services/userPreferences/UserPreferenceService.js +26 -0
- package/es/application/services/userPreferences/index.js +2 -0
- package/es/core/constants/ModuleNames.js +3 -1
- package/es/domain/dto/cannedMessages/index.js +1 -5
- package/es/domain/dto/{cannedMessages/deleteTranslationRequest.js → channels/getChannelRequest.js} +3 -4
- package/es/domain/dto/channels/getChannelsRequest.js +3 -1
- package/es/domain/dto/channels/index.js +2 -1
- package/es/domain/dto/index.js +3 -1
- package/es/domain/dto/{templateMessages/getTemplateTagsRequest.js → integrationServices/getIntegrationsRequest.js} +2 -2
- package/es/domain/dto/integrationServices/index.js +1 -0
- package/es/domain/dto/sessions/getSessionMetricsRequest.js +16 -0
- package/es/domain/dto/sessions/index.js +2 -1
- package/es/domain/dto/templateMessages/index.js +1 -2
- 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/entities/CannedMessage/CannedMessage.js +6 -34
- package/es/domain/entities/CannedMessage/index.js +1 -2
- 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/TemplateMessage/index.js +1 -4
- package/es/domain/entities/UserPreference/UserPreference.js +26 -0
- package/es/domain/entities/UserPreference/index.js +2 -0
- package/es/domain/entities/index.js +1 -1
- package/es/domain/enum/cannedMessage/CannedMessageStatus.js +1 -11
- package/es/domain/enum/cannedMessage/CannedMessageType.js +1 -3
- package/es/domain/enum/cannedMessage/TemplateItemButtonType.js +1 -7
- package/es/domain/enum/cannedMessage/TemplateItemHeaderType.js +1 -3
- package/es/domain/enum/index.js +2 -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/cannedMessages/ICannedMessageRepository.js +1 -21
- package/es/domain/interfaces/repositories/channels/IChannelRepository.js +7 -1
- package/es/domain/interfaces/repositories/index.js +3 -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/templateMessages/ITemplateMessageRepository.js +1 -7
- package/es/domain/interfaces/repositories/userPreferences/IUserPreferenceRepository.js +23 -0
- package/es/domain/interfaces/repositories/userPreferences/index.js +2 -0
- package/es/domain/schema/cannedMessage/CannedMessageSchema.js +0 -12
- package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemButtonsSchema.js +1 -1
- package/es/domain/schema/cannedMessage/TranslationsSchema.js +1 -1
- package/es/domain/schema/cannedMessage/index.js +1 -3
- package/es/domain/schema/channel/ChannelSchema.js +39 -5
- package/es/domain/schema/index.js +1 -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/frameworks/managers/ModuleFactory.js +18 -0
- package/es/frameworks/managers/ModuleManager.js +1 -1
- package/es/frameworks/sdk/IMSDK.js +10 -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/infrastructure/adapters/cannedMessages/CannedMessageAdapter.js +2 -3
- package/es/infrastructure/adapters/cannedMessages/index.js +1 -2
- package/es/infrastructure/adapters/channels/ChannelAdapter.js +16 -2
- package/es/infrastructure/adapters/index.js +2 -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/api/cannedMessages/CannedMessageAPI.js +1 -41
- package/es/infrastructure/api/index.js +3 -1
- package/es/infrastructure/api/integrationServices/IntegrationServiceAPI.js +14 -0
- package/es/infrastructure/api/integrationServices/index.js +2 -0
- package/es/infrastructure/api/registry/cannedMessages/cannedMessageAPIRegistry.js +2 -22
- package/es/infrastructure/api/registry/getRegistryConfig.js +5 -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/templateMessages/templateMessageAPIRegistry.js +2 -7
- 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/sessions/SessionAPI.js +11 -1
- package/es/infrastructure/api/templateMessages/TemplateMessageAPI.js +1 -11
- package/es/infrastructure/api/userPreferences/UserPreferenceAPI.js +24 -0
- package/es/infrastructure/api/userPreferences/index.js +2 -0
- package/es/infrastructure/repositories/cannedMessages/CannedMessageRepository.js +7 -50
- package/es/infrastructure/repositories/channels/ChannelRepository.js +10 -1
- package/es/infrastructure/repositories/index.js +3 -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/templateMessages/TemplateMessageRepository.js +1 -10
- package/es/infrastructure/repositories/userPreferences/UserPreferenceRepository.js +58 -0
- package/es/infrastructure/repositories/userPreferences/index.js +2 -0
- package/package.json +1 -1
- package/es/domain/dto/cannedMessages/addTranslationRequest.js +0 -18
- package/es/domain/dto/cannedMessages/getCannedPlaceholdersRequest.js +0 -10
- package/es/domain/dto/cannedMessages/updateTranslationRequest.js +0 -18
- package/es/domain/entities/CannedMessage/Translation.js +0 -48
- package/es/domain/entities/Placeholder/Placeholder.js +0 -24
- package/es/domain/entities/Placeholder/index.js +0 -2
- package/es/domain/entities/TemplateMessage/TemplateItemButton.js +0 -48
- package/es/domain/entities/TemplateMessage/TemplateItemFooter.js +0 -27
- package/es/domain/entities/TemplateMessage/TemplateItemHeader.js +0 -48
- package/es/domain/schema/placeholder/PlaceholderSchema.js +0 -19
- package/es/domain/schema/placeholder/index.js +0 -2
- package/es/infrastructure/adapters/cannedMessages/TranslationAdapter.js +0 -27
- package/es/infrastructure/adapters/placeholders/PlaceholderAdapter.js +0 -22
- package/es/infrastructure/adapters/placeholders/index.js +0 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AdapterError } from '../../../core/errors';
|
|
2
|
+
import { UserPreference } from '../../../domain/entities';
|
|
3
|
+
import { IAdapter } from '../../../domain/interfaces';
|
|
4
|
+
export default class UserPreferencesAdapter extends IAdapter {
|
|
5
|
+
adapt(preferenceData) {
|
|
6
|
+
if (!preferenceData) {
|
|
7
|
+
throw new AdapterError('UserPreference data is required');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
return new UserPreference({
|
|
12
|
+
collapseSidePanel: preferenceData.collapseSidePanel
|
|
13
|
+
}).toJSON();
|
|
14
|
+
} catch (error) {
|
|
15
|
+
throw new AdapterError(`Failed to adapt user preference: ${error.message}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest
|
|
1
|
+
import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest } from '../../../domain/dto';
|
|
2
2
|
import { ICannedMessageRepository } from '../../../domain/interfaces/repositories';
|
|
3
3
|
export default class CannedMessageAPI extends ICannedMessageRepository {
|
|
4
4
|
async getCannedMessages() {
|
|
@@ -71,44 +71,4 @@ export default class CannedMessageAPI extends ICannedMessageRepository {
|
|
|
71
71
|
return httpRequest;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
async addTranslation() {
|
|
75
|
-
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : addTranslationRequest();
|
|
76
|
-
const operation = 'addTranslation';
|
|
77
|
-
const httpRequest = await this.request({
|
|
78
|
-
operation,
|
|
79
|
-
request
|
|
80
|
-
});
|
|
81
|
-
return httpRequest;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
async updateTranslation() {
|
|
85
|
-
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updateTranslationRequest();
|
|
86
|
-
const operation = 'updateTranslation';
|
|
87
|
-
const httpRequest = await this.request({
|
|
88
|
-
operation,
|
|
89
|
-
request
|
|
90
|
-
});
|
|
91
|
-
return httpRequest;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async deleteTranslation() {
|
|
95
|
-
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : deleteTranslationRequest();
|
|
96
|
-
const operation = 'deleteTranslation';
|
|
97
|
-
const httpRequest = await this.request({
|
|
98
|
-
operation,
|
|
99
|
-
request
|
|
100
|
-
});
|
|
101
|
-
return httpRequest;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
async getCannedPlaceholders() {
|
|
105
|
-
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCannedPlaceholdersRequest();
|
|
106
|
-
const operation = 'getCannedPlaceholders';
|
|
107
|
-
const httpRequest = await this.request({
|
|
108
|
-
operation,
|
|
109
|
-
request
|
|
110
|
-
});
|
|
111
|
-
return httpRequest;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
74
|
}
|
|
@@ -5,4 +5,6 @@ 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';
|
|
@@ -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
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTTP_METHODS } from '../../../../core/constants';
|
|
2
|
-
import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest
|
|
2
|
+
import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest } from '../../../../domain/dto';
|
|
3
3
|
import constructCannedMessageEndPoint from './constructCannedMessageEndPoint';
|
|
4
4
|
import createAPIRegistry from '../createAPIRegistry';
|
|
5
5
|
|
|
@@ -31,22 +31,6 @@ function deleteCannedMessage() {
|
|
|
31
31
|
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId'), HTTP_METHODS.DELETE, deleteCannedMessageRequest());
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
function addTranslation() {
|
|
35
|
-
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId/translations'), HTTP_METHODS.POST, addTranslationRequest());
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function updateTranslation() {
|
|
39
|
-
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId/translations/:translationId'), HTTP_METHODS.PATCH, updateTranslationRequest());
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function deleteTranslation() {
|
|
43
|
-
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId/translations/:translationId'), HTTP_METHODS.DELETE, deleteTranslationRequest());
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function getCannedPlaceholders() {
|
|
47
|
-
return createAPIRegistry(constructCannedMessageEndPoint('/placeholders'), HTTP_METHODS.GET, getCannedPlaceholdersRequest());
|
|
48
|
-
}
|
|
49
|
-
|
|
50
34
|
export default {
|
|
51
35
|
getCannedMessage,
|
|
52
36
|
getCannedMessages,
|
|
@@ -54,9 +38,5 @@ export default {
|
|
|
54
38
|
updateCannedMessage,
|
|
55
39
|
deleteCannedMessage,
|
|
56
40
|
enableCannedMessage,
|
|
57
|
-
disableCannedMessage
|
|
58
|
-
addTranslation,
|
|
59
|
-
updateTranslation,
|
|
60
|
-
deleteTranslation,
|
|
61
|
-
getCannedPlaceholders
|
|
41
|
+
disableCannedMessage
|
|
62
42
|
};
|
|
@@ -7,7 +7,9 @@ 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';
|
|
10
11
|
import { ModuleNames } from '../../../core/constants';
|
|
12
|
+
import { userPreferenceAPIRegistry } from './userPreferences';
|
|
11
13
|
const APIRegistry = {
|
|
12
14
|
[ModuleNames.CHANNELS]: channelAPIRegistry,
|
|
13
15
|
[ModuleNames.SESSIONS]: sessionAPIRegistry,
|
|
@@ -16,7 +18,9 @@ const APIRegistry = {
|
|
|
16
18
|
[ModuleNames.AGENTS]: agentAPIRegistry,
|
|
17
19
|
[ModuleNames.CONTACTS]: contactAPIRegistry,
|
|
18
20
|
[ModuleNames.CANNED_MESSAGES]: cannedMessageAPIRegistry,
|
|
19
|
-
[ModuleNames.TEMPLATE_MESSAGES]: templateMessageAPIRegistry
|
|
21
|
+
[ModuleNames.TEMPLATE_MESSAGES]: templateMessageAPIRegistry,
|
|
22
|
+
[ModuleNames.INTEGRATION_SERVICES]: integrationServiceAPIRegistry,
|
|
23
|
+
[ModuleNames.USER_PREFERENCES]: userPreferenceAPIRegistry
|
|
20
24
|
};
|
|
21
25
|
export default function getRegistryConfig(module, operation) {
|
|
22
26
|
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
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTTP_METHODS } from '../../../../core/constants';
|
|
2
|
-
import { getTemplateLanguagesRequest, getTemplateCreditExhaustStatusRequest
|
|
2
|
+
import { getTemplateLanguagesRequest, getTemplateCreditExhaustStatusRequest } from '../../../../domain/dto';
|
|
3
3
|
import createAPIRegistry from '../createAPIRegistry';
|
|
4
4
|
import constructTemplateMessageEndPoint from './constructTemplateMessageEndPoint';
|
|
5
5
|
|
|
@@ -12,12 +12,7 @@ function getWhatsAppTemplateCreditExhaustStatus() {
|
|
|
12
12
|
HTTP_METHODS.POST, getTemplateCreditExhaustStatusRequest());
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
function getTemplateTags() {
|
|
16
|
-
return createAPIRegistry(constructTemplateMessageEndPoint('/templateTags'), HTTP_METHODS.GET, getTemplateTagsRequest());
|
|
17
|
-
}
|
|
18
|
-
|
|
19
15
|
export default {
|
|
20
16
|
getTemplateLanguages,
|
|
21
|
-
getWhatsAppTemplateCreditExhaustStatus
|
|
22
|
-
getTemplateTags
|
|
17
|
+
getWhatsAppTemplateCreditExhaustStatus
|
|
23
18
|
};
|
|
@@ -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
|
+
};
|
|
@@ -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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getTemplateLanguagesRequest, getTemplateCreditExhaustStatusRequest
|
|
1
|
+
import { getTemplateLanguagesRequest, getTemplateCreditExhaustStatusRequest } from '../../../domain/dto';
|
|
2
2
|
import { ITemplateMessageRepository } from '../../../domain/interfaces/repositories';
|
|
3
3
|
export default class TemplateMessageAPI extends ITemplateMessageRepository {
|
|
4
4
|
async getTemplateLanguages() {
|
|
@@ -21,14 +21,4 @@ export default class TemplateMessageAPI extends ITemplateMessageRepository {
|
|
|
21
21
|
return httpRequest;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
async getTemplateTags() {
|
|
25
|
-
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getTemplateTagsRequest();
|
|
26
|
-
const operation = 'getTemplateTags';
|
|
27
|
-
const httpRequest = await this.request({
|
|
28
|
-
request,
|
|
29
|
-
operation
|
|
30
|
-
});
|
|
31
|
-
return httpRequest;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
24
|
}
|
|
@@ -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
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CannedMessageAdapter
|
|
1
|
+
import { CannedMessageAdapter } from '../../adapters';
|
|
2
2
|
import { CannedMessageAPI } from '../../api';
|
|
3
3
|
import { ICannedMessageRepository } from '../../../domain/interfaces/repositories/cannedMessages';
|
|
4
4
|
import { ResponseTypes } from '../../../core/constants';
|
|
@@ -6,16 +6,13 @@ export default class CannedMessageRepository extends ICannedMessageRepository {
|
|
|
6
6
|
constructor(_ref) {
|
|
7
7
|
let {
|
|
8
8
|
cannedMessageAPI,
|
|
9
|
-
cannedMessageAdapter
|
|
10
|
-
placeholderAdapter
|
|
9
|
+
cannedMessageAdapter
|
|
11
10
|
} = _ref;
|
|
12
11
|
super();
|
|
13
12
|
this.defaultAPI = new CannedMessageAPI();
|
|
14
13
|
this.customAPI = cannedMessageAPI;
|
|
15
14
|
this.cannedMessageAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
|
|
16
15
|
this.cannedMessageAdapter = cannedMessageAdapter || new CannedMessageAdapter();
|
|
17
|
-
this.translationAdapter = new TranslationAdapter();
|
|
18
|
-
this.placeholderAdapter = placeholderAdapter || new PlaceholderAdapter();
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
async invokeAPI(_ref2) {
|
|
@@ -60,8 +57,7 @@ export default class CannedMessageRepository extends ICannedMessageRepository {
|
|
|
60
57
|
async deleteCannedMessage(request) {
|
|
61
58
|
return this.invokeAPI({
|
|
62
59
|
operation: 'deleteCannedMessage',
|
|
63
|
-
request
|
|
64
|
-
responseType: ResponseTypes.NONE
|
|
60
|
+
request
|
|
65
61
|
});
|
|
66
62
|
}
|
|
67
63
|
|
|
@@ -75,49 +71,14 @@ export default class CannedMessageRepository extends ICannedMessageRepository {
|
|
|
75
71
|
async enableCannedMessage(request) {
|
|
76
72
|
return this.invokeAPI({
|
|
77
73
|
operation: 'enableCannedMessage',
|
|
78
|
-
request
|
|
79
|
-
responseType: ResponseTypes.NONE
|
|
74
|
+
request
|
|
80
75
|
});
|
|
81
76
|
}
|
|
82
77
|
|
|
83
78
|
async disableCannedMessage(request) {
|
|
84
79
|
return this.invokeAPI({
|
|
85
80
|
operation: 'disableCannedMessage',
|
|
86
|
-
request
|
|
87
|
-
responseType: ResponseTypes.NONE
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async addTranslation(request) {
|
|
92
|
-
return this.invokeAPI({
|
|
93
|
-
operation: 'addTranslation',
|
|
94
|
-
request,
|
|
95
|
-
adapter: this.translationAdapter
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
async updateTranslation(request) {
|
|
100
|
-
return this.invokeAPI({
|
|
101
|
-
operation: 'updateTranslation',
|
|
102
|
-
request,
|
|
103
|
-
adapter: this.translationAdapter
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
async deleteTranslation(request) {
|
|
108
|
-
return this.invokeAPI({
|
|
109
|
-
operation: 'deleteTranslation',
|
|
110
|
-
request,
|
|
111
|
-
responseType: ResponseTypes.NONE
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async getCannedPlaceholders(request) {
|
|
116
|
-
return this.invokeAPI({
|
|
117
|
-
operation: 'getCannedPlaceholders',
|
|
118
|
-
request,
|
|
119
|
-
adapter: this.placeholderAdapter,
|
|
120
|
-
responseType: ResponseTypes.LIST
|
|
81
|
+
request
|
|
121
82
|
});
|
|
122
83
|
}
|
|
123
84
|
|
|
@@ -128,12 +89,8 @@ export default class CannedMessageRepository extends ICannedMessageRepository {
|
|
|
128
89
|
createCannedMessage: this.createCannedMessage.bind(this),
|
|
129
90
|
updateCannedMessage: this.updateCannedMessage.bind(this),
|
|
130
91
|
deleteCannedMessage: this.deleteCannedMessage.bind(this),
|
|
131
|
-
|
|
132
|
-
disableCannedMessage: this.disableCannedMessage.bind(this)
|
|
133
|
-
addTranslation: this.addTranslation.bind(this),
|
|
134
|
-
updateTranslation: this.updateTranslation.bind(this),
|
|
135
|
-
deleteTranslation: this.deleteTranslation.bind(this),
|
|
136
|
-
getCannedPlaceholders: this.getCannedPlaceholders.bind(this)
|
|
92
|
+
enableCannedMssage: this.enableCannedMessage.bind(this),
|
|
93
|
+
disableCannedMessage: this.disableCannedMessage.bind(this)
|
|
137
94
|
};
|
|
138
95
|
}
|
|
139
96
|
|
|
@@ -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,6 @@ 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';
|
|
@@ -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
|
|
|
@@ -67,19 +67,10 @@ export default class TemplateMessageRepository extends ITemplateMessageRepositor
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
async getTemplateTags(request) {
|
|
71
|
-
return this.invokeTemplateLanguageAPI({
|
|
72
|
-
operation: 'getTemplateTags',
|
|
73
|
-
request,
|
|
74
|
-
adapter: null
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
70
|
toJSON() {
|
|
79
71
|
return {
|
|
80
72
|
getTemplateLanguages: this.getTemplateLanguages.bind(this),
|
|
81
|
-
getWhatsAppTemplateCreditExhaustStatus: this.getWhatsAppTemplateCreditExhaustStatus.bind(this)
|
|
82
|
-
getTemplateTags: this.getTemplateTags.bind(this)
|
|
73
|
+
getWhatsAppTemplateCreditExhaustStatus: this.getWhatsAppTemplateCreditExhaustStatus.bind(this)
|
|
83
74
|
};
|
|
84
75
|
}
|
|
85
76
|
|