@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.
Files changed (125) hide show
  1. package/es/application/services/cannedMessages/CannedMessageService.js +1 -21
  2. package/es/application/services/channels/ChannelService.js +6 -1
  3. package/es/application/services/index.js +3 -1
  4. package/es/application/services/integrationServices/IntegrationService.js +21 -0
  5. package/es/application/services/integrationServices/index.js +2 -0
  6. package/es/application/services/sessions/SessionService.js +6 -1
  7. package/es/application/services/templateMessages/TemplateMessageService.js +1 -6
  8. package/es/application/services/userPreferences/UserPreferenceService.js +26 -0
  9. package/es/application/services/userPreferences/index.js +2 -0
  10. package/es/core/constants/ModuleNames.js +3 -1
  11. package/es/domain/dto/cannedMessages/index.js +1 -5
  12. package/es/domain/dto/{cannedMessages/deleteTranslationRequest.js → channels/getChannelRequest.js} +3 -4
  13. package/es/domain/dto/channels/getChannelsRequest.js +3 -1
  14. package/es/domain/dto/channels/index.js +2 -1
  15. package/es/domain/dto/index.js +3 -1
  16. package/es/domain/dto/{templateMessages/getTemplateTagsRequest.js → integrationServices/getIntegrationsRequest.js} +2 -2
  17. package/es/domain/dto/integrationServices/index.js +1 -0
  18. package/es/domain/dto/sessions/getSessionMetricsRequest.js +16 -0
  19. package/es/domain/dto/sessions/index.js +2 -1
  20. package/es/domain/dto/templateMessages/index.js +1 -2
  21. package/es/domain/dto/userPreferences/getPreferencesRequest.js +7 -0
  22. package/es/domain/dto/userPreferences/index.js +2 -0
  23. package/es/domain/dto/userPreferences/updatePreferencesRequest.js +9 -0
  24. package/es/domain/entities/CannedMessage/CannedMessage.js +6 -34
  25. package/es/domain/entities/CannedMessage/index.js +1 -2
  26. package/es/domain/entities/Channel/Channel.js +22 -4
  27. package/es/domain/entities/IntegrationService/IntegrationService.js +8 -1
  28. package/es/domain/entities/Session/SessionMetrics.js +21 -0
  29. package/es/domain/entities/Session/index.js +2 -1
  30. package/es/domain/entities/TemplateMessage/index.js +1 -4
  31. package/es/domain/entities/UserPreference/UserPreference.js +26 -0
  32. package/es/domain/entities/UserPreference/index.js +2 -0
  33. package/es/domain/entities/index.js +1 -1
  34. package/es/domain/enum/cannedMessage/CannedMessageStatus.js +1 -11
  35. package/es/domain/enum/cannedMessage/CannedMessageType.js +1 -3
  36. package/es/domain/enum/cannedMessage/TemplateItemButtonType.js +1 -7
  37. package/es/domain/enum/cannedMessage/TemplateItemHeaderType.js +1 -3
  38. package/es/domain/enum/index.js +2 -1
  39. package/es/domain/enum/session/AssigneeFilter.js +6 -0
  40. package/es/domain/enum/session/SessionStatus.js +2 -1
  41. package/es/domain/enum/session/index.js +2 -1
  42. package/es/domain/enum/userPreference/CollapseSidePanel.js +5 -0
  43. package/es/domain/enum/userPreference/index.js +2 -0
  44. package/es/domain/interfaces/repositories/cannedMessages/ICannedMessageRepository.js +1 -21
  45. package/es/domain/interfaces/repositories/channels/IChannelRepository.js +7 -1
  46. package/es/domain/interfaces/repositories/index.js +3 -1
  47. package/es/domain/interfaces/repositories/integrationServices/IIntegrationServiceRepository.js +17 -0
  48. package/es/domain/interfaces/repositories/integrationServices/index.js +2 -0
  49. package/es/domain/interfaces/repositories/sessions/ISessionRepository.js +6 -1
  50. package/es/domain/interfaces/repositories/templateMessages/ITemplateMessageRepository.js +1 -7
  51. package/es/domain/interfaces/repositories/userPreferences/IUserPreferenceRepository.js +23 -0
  52. package/es/domain/interfaces/repositories/userPreferences/index.js +2 -0
  53. package/es/domain/schema/cannedMessage/CannedMessageSchema.js +0 -12
  54. package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemButtonsSchema.js +1 -1
  55. package/es/domain/schema/cannedMessage/TranslationsSchema.js +1 -1
  56. package/es/domain/schema/cannedMessage/index.js +1 -3
  57. package/es/domain/schema/channel/ChannelSchema.js +39 -5
  58. package/es/domain/schema/index.js +1 -1
  59. package/es/domain/schema/integrationService/IntegrationServiceSchema.js +12 -0
  60. package/es/domain/schema/session/SessionMetrics/AssigneeSchema.js +20 -0
  61. package/es/domain/schema/session/SessionMetrics/SessionMetricsForAssigneeSchema.js +32 -0
  62. package/es/domain/schema/session/SessionMetrics/index.js +2 -0
  63. package/es/domain/schema/session/SessionMetricsSchema.js +9 -0
  64. package/es/domain/schema/session/index.js +2 -1
  65. package/es/domain/schema/userPreference/UserPreferenceSchema.js +9 -0
  66. package/es/domain/schema/userPreference/index.js +2 -0
  67. package/es/frameworks/managers/ModuleFactory.js +18 -0
  68. package/es/frameworks/managers/ModuleManager.js +1 -1
  69. package/es/frameworks/sdk/IMSDK.js +10 -0
  70. package/es/frameworks/sdk/integrationServices/IntegrationServiceSDK.js +30 -0
  71. package/es/frameworks/sdk/integrationServices/index.js +2 -0
  72. package/es/frameworks/sdk/userPreferences/UserPreferencesSDK.js +30 -0
  73. package/es/frameworks/sdk/userPreferences/index.js +2 -0
  74. package/es/infrastructure/adapters/cannedMessages/CannedMessageAdapter.js +2 -3
  75. package/es/infrastructure/adapters/cannedMessages/index.js +1 -2
  76. package/es/infrastructure/adapters/channels/ChannelAdapter.js +16 -2
  77. package/es/infrastructure/adapters/index.js +2 -1
  78. package/es/infrastructure/adapters/integrationServices/IntegrationServiceAdapter.js +25 -0
  79. package/es/infrastructure/adapters/integrationServices/index.js +2 -0
  80. package/es/infrastructure/adapters/sessions/SessionMetricsAdapter.js +19 -0
  81. package/es/infrastructure/adapters/sessions/index.js +2 -1
  82. package/es/infrastructure/adapters/userPreferences/UserPreferenceAdapter.js +19 -0
  83. package/es/infrastructure/adapters/userPreferences/index.js +2 -0
  84. package/es/infrastructure/api/cannedMessages/CannedMessageAPI.js +1 -41
  85. package/es/infrastructure/api/index.js +3 -1
  86. package/es/infrastructure/api/integrationServices/IntegrationServiceAPI.js +14 -0
  87. package/es/infrastructure/api/integrationServices/index.js +2 -0
  88. package/es/infrastructure/api/registry/cannedMessages/cannedMessageAPIRegistry.js +2 -22
  89. package/es/infrastructure/api/registry/getRegistryConfig.js +5 -1
  90. package/es/infrastructure/api/registry/integrationServices/constructIntegrationServiceEndPoint.js +10 -0
  91. package/es/infrastructure/api/registry/integrationServices/index.js +2 -0
  92. package/es/infrastructure/api/registry/integrationServices/integrationServiceAPIRegistry.js +12 -0
  93. package/es/infrastructure/api/registry/sessions/sessionAPIRegistry.js +8 -2
  94. package/es/infrastructure/api/registry/templateMessages/templateMessageAPIRegistry.js +2 -7
  95. package/es/infrastructure/api/registry/userPreferences/constructUserPreferencesEndPoint.js +10 -0
  96. package/es/infrastructure/api/registry/userPreferences/index.js +2 -0
  97. package/es/infrastructure/api/registry/userPreferences/userPreferenceAPIRegistry.js +17 -0
  98. package/es/infrastructure/api/sessions/SessionAPI.js +11 -1
  99. package/es/infrastructure/api/templateMessages/TemplateMessageAPI.js +1 -11
  100. package/es/infrastructure/api/userPreferences/UserPreferenceAPI.js +24 -0
  101. package/es/infrastructure/api/userPreferences/index.js +2 -0
  102. package/es/infrastructure/repositories/cannedMessages/CannedMessageRepository.js +7 -50
  103. package/es/infrastructure/repositories/channels/ChannelRepository.js +10 -1
  104. package/es/infrastructure/repositories/index.js +3 -1
  105. package/es/infrastructure/repositories/integrationServices/IntegrationServiceRepository.js +49 -0
  106. package/es/infrastructure/repositories/integrationServices/index.js +2 -0
  107. package/es/infrastructure/repositories/sessions/SessionRepository.js +14 -3
  108. package/es/infrastructure/repositories/templateMessages/TemplateMessageRepository.js +1 -10
  109. package/es/infrastructure/repositories/userPreferences/UserPreferenceRepository.js +58 -0
  110. package/es/infrastructure/repositories/userPreferences/index.js +2 -0
  111. package/package.json +1 -1
  112. package/es/domain/dto/cannedMessages/addTranslationRequest.js +0 -18
  113. package/es/domain/dto/cannedMessages/getCannedPlaceholdersRequest.js +0 -10
  114. package/es/domain/dto/cannedMessages/updateTranslationRequest.js +0 -18
  115. package/es/domain/entities/CannedMessage/Translation.js +0 -48
  116. package/es/domain/entities/Placeholder/Placeholder.js +0 -24
  117. package/es/domain/entities/Placeholder/index.js +0 -2
  118. package/es/domain/entities/TemplateMessage/TemplateItemButton.js +0 -48
  119. package/es/domain/entities/TemplateMessage/TemplateItemFooter.js +0 -27
  120. package/es/domain/entities/TemplateMessage/TemplateItemHeader.js +0 -48
  121. package/es/domain/schema/placeholder/PlaceholderSchema.js +0 -19
  122. package/es/domain/schema/placeholder/index.js +0 -2
  123. package/es/infrastructure/adapters/cannedMessages/TranslationAdapter.js +0 -27
  124. package/es/infrastructure/adapters/placeholders/PlaceholderAdapter.js +0 -22
  125. package/es/infrastructure/adapters/placeholders/index.js +0 -2
@@ -1,2 +1,3 @@
1
1
  import SessionAdapter from './SessionAdapter';
2
- export { SessionAdapter };
2
+ import SessionMetricsAdapter from './SessionMetricsAdapter';
3
+ export { SessionAdapter, SessionMetricsAdapter };
@@ -0,0 +1,19 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { UserPreference } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class UserPreferencesAdapter extends IAdapter {
5
+ adapt(preferenceData) {
6
+ if (!preferenceData) {
7
+ throw new AdapterError('UserPreference data is required');
8
+ }
9
+
10
+ try {
11
+ return new UserPreference({
12
+ collapseSidePanel: preferenceData.collapseSidePanel
13
+ }).toJSON();
14
+ } catch (error) {
15
+ throw new AdapterError(`Failed to adapt user preference: ${error.message}`);
16
+ }
17
+ }
18
+
19
+ }
@@ -0,0 +1,2 @@
1
+ import UserPreferenceAdapter from './UserPreferenceAdapter';
2
+ export { UserPreferenceAdapter };
@@ -1,4 +1,4 @@
1
- import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest, addTranslationRequest, updateTranslationRequest, deleteTranslationRequest, getCannedPlaceholdersRequest } from '../../../domain/dto';
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
+ }
@@ -0,0 +1,2 @@
1
+ import IntegrationServiceAPI from './IntegrationServiceAPI';
2
+ export { IntegrationServiceAPI };
@@ -1,5 +1,5 @@
1
1
  import { HTTP_METHODS } from '../../../../core/constants';
2
- import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest, addTranslationRequest, updateTranslationRequest, deleteTranslationRequest, getCannedPlaceholdersRequest } from '../../../../domain/dto';
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,10 @@
1
+ import createBaseUrl from '../createBaseUrl';
2
+ export default function constructIntegrationServiceEndPoint(extra) {
3
+ const base = '/integrations';
4
+
5
+ if (extra) {
6
+ return createBaseUrl(base + extra);
7
+ }
8
+
9
+ return createBaseUrl(base);
10
+ }
@@ -0,0 +1,2 @@
1
+ import integrationServiceAPIRegistry from './integrationServiceAPIRegistry';
2
+ export { integrationServiceAPIRegistry };
@@ -0,0 +1,12 @@
1
+ import { HTTP_METHODS } from '../../../../core/constants';
2
+ import { getIntegrationsRequest } from '../../../../domain/dto';
3
+ import createAPIRegistry from '../createAPIRegistry';
4
+ import constructIntegrationServiceEndPoint from './constructIntegrationServiceEndPoint';
5
+
6
+ function getIntegrations() {
7
+ return createAPIRegistry(constructIntegrationServiceEndPoint(), HTTP_METHODS.GET, getIntegrationsRequest());
8
+ }
9
+
10
+ export default {
11
+ getIntegrations
12
+ };
@@ -1,5 +1,5 @@
1
1
  import { HTTP_METHODS } from '../../../../core/constants';
2
- import { updateSessionAssigneeRequest, getSessionAttachmentsRequest, getSessionLastMessagesRequest, getSessionRequest, getSessionsRequest, markSessionAsReadRequest, updateSessionStatusRequest, pickupSessionRequest } from '../../../../domain/dto';
2
+ import { updateSessionAssigneeRequest, getSessionAttachmentsRequest, getSessionLastMessagesRequest, getSessionRequest, getSessionsRequest, markSessionAsReadRequest, updateSessionStatusRequest, pickupSessionRequest, getSessionMetricsRequest } from '../../../../domain/dto';
3
3
  import createAPIRegistry from '../createAPIRegistry';
4
4
  import constructSessionEndPoint from './constructSessionEndPoint';
5
5
  const SINGLE_SESSION_URL = '/:sessionId';
@@ -7,6 +7,7 @@ const SESSION_ATTACHMENTS_URL = `${SINGLE_SESSION_URL}/attachments`;
7
7
  const SESSION_LAST_MESSAGE = '/lastMessages';
8
8
  const MARK_AS_READ = `${SINGLE_SESSION_URL}/markAsRead`;
9
9
  const PICKUP_SESSION = `${SINGLE_SESSION_URL}/pickup`;
10
+ const SESSION_METRICS = '/metrics';
10
11
 
11
12
  function pickupSession() {
12
13
  return createAPIRegistry(constructSessionEndPoint(PICKUP_SESSION), HTTP_METHODS.POST, pickupSessionRequest());
@@ -40,6 +41,10 @@ function updateSessionStatus() {
40
41
  return createAPIRegistry(constructSessionEndPoint(SINGLE_SESSION_URL), HTTP_METHODS.PATCH, updateSessionStatusRequest());
41
42
  }
42
43
 
44
+ function getSessionMetrics() {
45
+ return createAPIRegistry(constructSessionEndPoint(SESSION_METRICS), HTTP_METHODS.GET, getSessionMetricsRequest());
46
+ }
47
+
43
48
  export default {
44
49
  updateAssignee,
45
50
  getSessions,
@@ -48,5 +53,6 @@ export default {
48
53
  getSessionLastMessages,
49
54
  markSessionAsRead,
50
55
  updateSessionStatus,
51
- pickupSession
56
+ pickupSession,
57
+ getSessionMetrics
52
58
  };
@@ -1,5 +1,5 @@
1
1
  import { HTTP_METHODS } from '../../../../core/constants';
2
- import { getTemplateLanguagesRequest, getTemplateCreditExhaustStatusRequest, getTemplateTagsRequest } from '../../../../domain/dto';
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,10 @@
1
+ import createBaseUrl from '../createBaseUrl';
2
+ export default function constructUserPreferencesEndPoint(extra) {
3
+ const base = '/userPreferences';
4
+
5
+ if (extra) {
6
+ return createBaseUrl(base + extra);
7
+ }
8
+
9
+ return createBaseUrl(base);
10
+ }
@@ -0,0 +1,2 @@
1
+ import userPreferenceAPIRegistry from './userPreferenceAPIRegistry';
2
+ export { userPreferenceAPIRegistry };
@@ -0,0 +1,17 @@
1
+ import { HTTP_METHODS } from '../../../../core/constants';
2
+ import { getPreferencesRequest, updatePreferencesRequest } from '../../../../domain/dto';
3
+ import createAPIRegistry from '../createAPIRegistry';
4
+ import constructUserPreferencesEndPoint from './constructUserPreferencesEndPoint';
5
+
6
+ function getPreferences() {
7
+ return createAPIRegistry(constructUserPreferencesEndPoint(), HTTP_METHODS.GET, getPreferencesRequest());
8
+ }
9
+
10
+ function updatePreferences() {
11
+ return createAPIRegistry(constructUserPreferencesEndPoint(), HTTP_METHODS.PUT, updatePreferencesRequest());
12
+ }
13
+
14
+ export default {
15
+ getPreferences,
16
+ updatePreferences
17
+ };
@@ -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, getTemplateTagsRequest } from '../../../domain/dto';
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
+ }
@@ -0,0 +1,2 @@
1
+ import UserPreferenceAPI from './UserPreferenceAPI';
2
+ export { UserPreferenceAPI };
@@ -1,4 +1,4 @@
1
- import { CannedMessageAdapter, PlaceholderAdapter, TranslationAdapter } from '../../adapters';
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
- enableCannedMessage: this.enableCannedMessage.bind(this),
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
+ }
@@ -0,0 +1,2 @@
1
+ import IntegrationServiceRepository from './IntegrationServiceRepository';
2
+ export { IntegrationServiceRepository };
@@ -1,4 +1,4 @@
1
- import { AttachmentAdapter, MessageAdapter, SessionAdapter } from '../../adapters/index';
1
+ import { AttachmentAdapter, MessageAdapter, SessionAdapter, SessionMetricsAdapter } from '../../adapters/index';
2
2
  import { ISessionRepository } from '../../../domain/interfaces/repositories';
3
3
  import { SessionAPI } from '../../api';
4
4
  import { ResponseTypes } from '../../../core/constants';
@@ -8,7 +8,8 @@ export default class SessionRepository extends ISessionRepository {
8
8
  sessionAPI,
9
9
  sessionAdapter,
10
10
  attachmentAdapter,
11
- messageAdapter
11
+ messageAdapter,
12
+ sessionMetricsAdapter
12
13
  } = _ref;
13
14
  super();
14
15
  this.defaultAPI = new SessionAPI();
@@ -17,6 +18,7 @@ export default class SessionRepository extends ISessionRepository {
17
18
  this.sessionAdapter = sessionAdapter || new SessionAdapter();
18
19
  this.attachmentAdapter = attachmentAdapter || new AttachmentAdapter();
19
20
  this.messageAdapter = messageAdapter || new MessageAdapter();
21
+ this.sessionMetricsAdapter = sessionMetricsAdapter || new SessionMetricsAdapter();
20
22
  }
21
23
 
22
24
  async invokeAPI(_ref2) {
@@ -97,6 +99,14 @@ export default class SessionRepository extends ISessionRepository {
97
99
  });
98
100
  }
99
101
 
102
+ async getSessionMetrics(request) {
103
+ return this.invokeAPI({
104
+ operation: 'getSessionMetrics',
105
+ request,
106
+ adapter: this.sessionMetricsAdapter
107
+ });
108
+ }
109
+
100
110
  toJSON() {
101
111
  return {
102
112
  pickupSession: this.pickupSession.bind(this),
@@ -106,7 +116,8 @@ export default class SessionRepository extends ISessionRepository {
106
116
  getSessionAttachments: this.getSessionAttachments.bind(this),
107
117
  getSessionLastMessages: this.getSessionLastMessages.bind(this),
108
118
  markSessionAsRead: this.markSessionAsRead.bind(this),
109
- updateSessionStatus: this.updateSessionStatus.bind(this)
119
+ updateSessionStatus: this.updateSessionStatus.bind(this),
120
+ getSessionMetrics: this.getSessionMetrics.bind(this)
110
121
  };
111
122
  }
112
123
 
@@ -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