@zohoim/client-sdk 1.1.0-attachmentsList → 1.1.0-calls1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/es/application/services/calls/CallService.js +36 -0
  2. package/es/application/services/calls/index.js +1 -0
  3. package/es/application/services/channels/ChannelService.js +6 -1
  4. package/es/application/services/index.js +5 -1
  5. package/es/application/services/integrationServices/IntegrationService.js +21 -0
  6. package/es/application/services/integrationServices/index.js +2 -0
  7. package/es/application/services/sessions/SessionService.js +6 -1
  8. package/es/application/services/userPreferences/UserPreferenceService.js +26 -0
  9. package/es/application/services/userPreferences/index.js +2 -0
  10. package/es/application/services/whatsAppPricing/WhatsAppPricingService.js +21 -0
  11. package/es/application/services/whatsAppPricing/index.js +2 -0
  12. package/es/core/constants/ModuleNames.js +5 -1
  13. package/es/core/constants/ModuleTypes.js +5 -0
  14. package/es/core/constants/index.js +2 -1
  15. package/es/core/utils/validateSchema.js +25 -0
  16. package/es/domain/dto/calls/getCallRequest.js +14 -0
  17. package/es/domain/dto/calls/getCallsRequest.js +20 -0
  18. package/es/domain/dto/calls/index.js +4 -0
  19. package/es/domain/dto/calls/initiateCallRequest.js +15 -0
  20. package/es/domain/dto/calls/updateCallStatusRequest.js +15 -0
  21. package/es/domain/dto/channels/getChannelRequest.js +13 -0
  22. package/es/domain/dto/channels/getChannelsRequest.js +3 -1
  23. package/es/domain/dto/channels/index.js +2 -1
  24. package/es/domain/dto/index.js +5 -1
  25. package/es/domain/dto/integrationServices/getIntegrationsRequest.js +7 -0
  26. package/es/domain/dto/integrationServices/index.js +1 -0
  27. package/es/domain/dto/sessions/getSessionAttachmentsRequest.js +5 -2
  28. package/es/domain/dto/sessions/getSessionMetricsRequest.js +16 -0
  29. package/es/domain/dto/sessions/index.js +2 -1
  30. package/es/domain/dto/userPreferences/getPreferencesRequest.js +7 -0
  31. package/es/domain/dto/userPreferences/index.js +2 -0
  32. package/es/domain/dto/userPreferences/updatePreferencesRequest.js +9 -0
  33. package/es/domain/dto/whatsAppPricing/calculateWhatsAppPricingRequest.js +14 -0
  34. package/es/domain/dto/whatsAppPricing/index.js +1 -0
  35. package/es/domain/entities/Actor/Actor.js +4 -0
  36. package/es/domain/entities/Call/Call.js +47 -0
  37. package/es/domain/entities/Call/index.js +1 -0
  38. package/es/domain/entities/Channel/Channel.js +22 -4
  39. package/es/domain/entities/IntegrationService/IntegrationService.js +8 -1
  40. package/es/domain/entities/Session/SessionMetrics.js +21 -0
  41. package/es/domain/entities/Session/index.js +2 -1
  42. package/es/domain/entities/UserPreference/UserPreference.js +26 -0
  43. package/es/domain/entities/UserPreference/index.js +2 -0
  44. package/es/domain/entities/WhatsAppPricing/WhatsAppPricing.js +25 -0
  45. package/es/domain/entities/WhatsAppPricing/WhatsAppPricingCategory.js +22 -0
  46. package/es/domain/entities/WhatsAppPricing/index.js +3 -0
  47. package/es/domain/entities/index.js +4 -1
  48. package/es/domain/enum/call/CallStatus.js +8 -0
  49. package/es/domain/enum/call/index.js +1 -0
  50. package/es/domain/enum/index.js +3 -1
  51. package/es/domain/enum/session/AssigneeFilter.js +6 -0
  52. package/es/domain/enum/session/SessionStatus.js +2 -1
  53. package/es/domain/enum/session/index.js +2 -1
  54. package/es/domain/enum/userPreference/CollapseSidePanel.js +5 -0
  55. package/es/domain/enum/userPreference/index.js +2 -0
  56. package/es/domain/interfaces/repositories/calls/ICallRepository.js +32 -0
  57. package/es/domain/interfaces/repositories/calls/index.js +1 -0
  58. package/es/domain/interfaces/repositories/channels/IChannelRepository.js +7 -1
  59. package/es/domain/interfaces/repositories/index.js +5 -1
  60. package/es/domain/interfaces/repositories/integrationServices/IIntegrationServiceRepository.js +17 -0
  61. package/es/domain/interfaces/repositories/integrationServices/index.js +2 -0
  62. package/es/domain/interfaces/repositories/sessions/ISessionRepository.js +6 -1
  63. package/es/domain/interfaces/repositories/userPreferences/IUserPreferenceRepository.js +23 -0
  64. package/es/domain/interfaces/repositories/userPreferences/index.js +2 -0
  65. package/es/domain/interfaces/repositories/whatsAppPricing/IWhatsAppPricingRepository.js +18 -0
  66. package/es/domain/interfaces/repositories/whatsAppPricing/index.js +2 -0
  67. package/es/domain/schema/call/CallSchema.js +63 -0
  68. package/es/domain/schema/call/index.js +1 -0
  69. package/es/domain/schema/channel/ChannelSchema.js +39 -5
  70. package/es/domain/schema/index.js +4 -1
  71. package/es/domain/schema/integrationService/IntegrationServiceSchema.js +12 -0
  72. package/es/domain/schema/session/SessionMetrics/AssigneeSchema.js +20 -0
  73. package/es/domain/schema/session/SessionMetrics/SessionMetricsForAssigneeSchema.js +32 -0
  74. package/es/domain/schema/session/SessionMetrics/index.js +2 -0
  75. package/es/domain/schema/session/SessionMetricsSchema.js +9 -0
  76. package/es/domain/schema/session/index.js +2 -1
  77. package/es/domain/schema/userPreference/UserPreferenceSchema.js +9 -0
  78. package/es/domain/schema/userPreference/index.js +2 -0
  79. package/es/domain/schema/whatsAppPricing/WhatsAppPricingCategorySchema.js +11 -0
  80. package/es/domain/schema/whatsAppPricing/WhatsAppPricingSchema.js +21 -0
  81. package/es/domain/schema/whatsAppPricing/index.js +3 -0
  82. package/es/frameworks/managers/ModuleFactory.js +81 -23
  83. package/es/frameworks/managers/ModuleManager.js +25 -2
  84. package/es/frameworks/sdk/IMSDK.js +33 -11
  85. package/es/frameworks/sdk/calls/CallSDK.js +27 -0
  86. package/es/frameworks/sdk/calls/index.js +1 -0
  87. package/es/frameworks/sdk/integrationServices/IntegrationServiceSDK.js +30 -0
  88. package/es/frameworks/sdk/integrationServices/index.js +2 -0
  89. package/es/frameworks/sdk/userPreferences/UserPreferencesSDK.js +30 -0
  90. package/es/frameworks/sdk/userPreferences/index.js +2 -0
  91. package/es/frameworks/sdk/whatsAppPricing/WhatsAppPricingSDK.js +28 -0
  92. package/es/frameworks/sdk/whatsAppPricing/index.js +2 -0
  93. package/es/infrastructure/adapters/calls/CallAdapter.js +31 -0
  94. package/es/infrastructure/adapters/calls/index.js +1 -0
  95. package/es/infrastructure/adapters/channels/ChannelAdapter.js +16 -2
  96. package/es/infrastructure/adapters/index.js +5 -1
  97. package/es/infrastructure/adapters/integrationServices/IntegrationServiceAdapter.js +25 -0
  98. package/es/infrastructure/adapters/integrationServices/index.js +2 -0
  99. package/es/infrastructure/adapters/sessions/SessionMetricsAdapter.js +19 -0
  100. package/es/infrastructure/adapters/sessions/index.js +2 -1
  101. package/es/infrastructure/adapters/userPreferences/UserPreferenceAdapter.js +19 -0
  102. package/es/infrastructure/adapters/userPreferences/index.js +2 -0
  103. package/es/infrastructure/adapters/whatsAppPricing/WhatsAppPricingAdapter.js +22 -0
  104. package/es/infrastructure/adapters/whatsAppPricing/index.js +2 -0
  105. package/es/infrastructure/api/BaseAPI.js +5 -4
  106. package/es/infrastructure/api/calls/CallAPI.js +44 -0
  107. package/es/infrastructure/api/calls/index.js +1 -0
  108. package/es/infrastructure/api/index.js +5 -1
  109. package/es/infrastructure/api/integrationServices/IntegrationServiceAPI.js +14 -0
  110. package/es/infrastructure/api/integrationServices/index.js +2 -0
  111. package/es/infrastructure/api/registry/calls/callAPIRegistry.js +29 -0
  112. package/es/infrastructure/api/registry/calls/constructCallEndPoint.js +10 -0
  113. package/es/infrastructure/api/registry/calls/index.js +1 -0
  114. package/es/infrastructure/api/registry/createPublicBaseUrl.js +4 -0
  115. package/es/infrastructure/api/registry/getRegistryConfig.js +9 -1
  116. package/es/infrastructure/api/registry/integrationServices/constructIntegrationServiceEndPoint.js +10 -0
  117. package/es/infrastructure/api/registry/integrationServices/index.js +2 -0
  118. package/es/infrastructure/api/registry/integrationServices/integrationServiceAPIRegistry.js +12 -0
  119. package/es/infrastructure/api/registry/sessions/sessionAPIRegistry.js +8 -2
  120. package/es/infrastructure/api/registry/userPreferences/constructUserPreferencesEndPoint.js +10 -0
  121. package/es/infrastructure/api/registry/userPreferences/index.js +2 -0
  122. package/es/infrastructure/api/registry/userPreferences/userPreferenceAPIRegistry.js +17 -0
  123. package/es/infrastructure/api/registry/whatsAppPricing/constructWhatsAppPricingEndPoint.js +10 -0
  124. package/es/infrastructure/api/registry/whatsAppPricing/index.js +2 -0
  125. package/es/infrastructure/api/registry/whatsAppPricing/whatsAppPricingAPIRegistry.js +13 -0
  126. package/es/infrastructure/api/sessions/SessionAPI.js +11 -1
  127. package/es/infrastructure/api/userPreferences/UserPreferenceAPI.js +24 -0
  128. package/es/infrastructure/api/userPreferences/index.js +2 -0
  129. package/es/infrastructure/api/whatsAppPricing/WhatsAppPricingAPI.js +14 -0
  130. package/es/infrastructure/api/whatsAppPricing/index.js +2 -0
  131. package/es/infrastructure/config/configRegistry.js +8 -1
  132. package/es/infrastructure/repositories/calls/CallRepository.js +73 -0
  133. package/es/infrastructure/repositories/calls/index.js +1 -0
  134. package/es/infrastructure/repositories/channels/ChannelRepository.js +10 -1
  135. package/es/infrastructure/repositories/index.js +5 -1
  136. package/es/infrastructure/repositories/integrationServices/IntegrationServiceRepository.js +49 -0
  137. package/es/infrastructure/repositories/integrationServices/index.js +2 -0
  138. package/es/infrastructure/repositories/sessions/SessionRepository.js +14 -3
  139. package/es/infrastructure/repositories/userPreferences/UserPreferenceRepository.js +58 -0
  140. package/es/infrastructure/repositories/userPreferences/index.js +2 -0
  141. package/es/infrastructure/repositories/whatsAppPricing/WhatsAppPricingRepository.js +49 -0
  142. package/es/infrastructure/repositories/whatsAppPricing/index.js +2 -0
  143. package/package.json +2 -2
@@ -0,0 +1,36 @@
1
+ import { ICallRepository } from '../../../domain/interfaces/repositories';
2
+ export default class CallService extends ICallRepository {
3
+ constructor(_ref) {
4
+ let {
5
+ callRepository
6
+ } = _ref;
7
+ super();
8
+ this.callRepository = callRepository;
9
+ }
10
+
11
+ async getCalls(request) {
12
+ return this.callRepository.getCalls(request);
13
+ }
14
+
15
+ async getCall(request) {
16
+ return this.callRepository.getCall(request);
17
+ }
18
+
19
+ async updateCallStatus(request) {
20
+ return this.callRepository.updateCallStatus(request);
21
+ }
22
+
23
+ async initiateCall(request) {
24
+ return this.callRepository.initiateCall(request);
25
+ }
26
+
27
+ toJSON() {
28
+ return {
29
+ getCalls: this.getCalls.bind(this),
30
+ getCall: this.getCall.bind(this),
31
+ updateCallStatus: this.updateCallStatus.bind(this),
32
+ initiateCall: this.initiateCall.bind(this)
33
+ };
34
+ }
35
+
36
+ }
@@ -0,0 +1 @@
1
+ export { default as CallService } from './CallService';
@@ -12,9 +12,14 @@ export default class ChannelService extends IChannelRepository {
12
12
  return this.channelRepository.getChannels(request);
13
13
  }
14
14
 
15
+ async getChannel(request) {
16
+ return this.channelRepository.getChannel(request);
17
+ }
18
+
15
19
  toJSON() {
16
20
  return {
17
- getChannels: this.getChannels.bind(this)
21
+ getChannels: this.getChannels.bind(this),
22
+ getChannel: this.getChannel.bind(this)
18
23
  };
19
24
  }
20
25
 
@@ -5,4 +5,8 @@ export * from './messages';
5
5
  export * from './agents';
6
6
  export * from './contacts';
7
7
  export * from './cannedMessages';
8
- export * from './templateMessages';
8
+ export * from './templateMessages';
9
+ export * from './integrationServices';
10
+ export * from './userPreferences';
11
+ export * from './whatsAppPricing';
12
+ export * from './calls';
@@ -0,0 +1,21 @@
1
+ import { IIntegrationServiceRepository } from '../../../domain/interfaces/repositories';
2
+ export default class IntegrationService extends IIntegrationServiceRepository {
3
+ constructor(_ref) {
4
+ let {
5
+ integrationServiceRepository
6
+ } = _ref;
7
+ super();
8
+ this.integrationServiceRepository = integrationServiceRepository;
9
+ }
10
+
11
+ async getIntegrations(request) {
12
+ return this.integrationServiceRepository.getIntegrations(request);
13
+ }
14
+
15
+ toJSON() {
16
+ return {
17
+ getIntegrations: this.getIntegrations.bind(this)
18
+ };
19
+ }
20
+
21
+ }
@@ -0,0 +1,2 @@
1
+ import IntegrationService from './IntegrationService';
2
+ export { IntegrationService };
@@ -40,6 +40,10 @@ export default class SessionService extends ISessionRepository {
40
40
  return this.sessionRepository.updateSessionStatus(request);
41
41
  }
42
42
 
43
+ async getSessionMetrics(request) {
44
+ return this.sessionRepository.getSessionMetrics(request);
45
+ }
46
+
43
47
  toJSON() {
44
48
  return {
45
49
  pickupSession: this.pickupSession.bind(this),
@@ -49,7 +53,8 @@ export default class SessionService extends ISessionRepository {
49
53
  getSessionAttachments: this.getSessionAttachments.bind(this),
50
54
  getSessionLastMessages: this.getSessionLastMessages.bind(this),
51
55
  markSessionAsRead: this.markSessionAsRead.bind(this),
52
- updateSessionStatus: this.updateSessionStatus.bind(this)
56
+ updateSessionStatus: this.updateSessionStatus.bind(this),
57
+ getSessionMetrics: this.getSessionMetrics.bind(this)
53
58
  };
54
59
  }
55
60
 
@@ -0,0 +1,26 @@
1
+ import { IUserPreferenceRepository } from '../../../domain/interfaces/repositories';
2
+ export default class UserPreferenceService extends IUserPreferenceRepository {
3
+ constructor(_ref) {
4
+ let {
5
+ userPreferenceRepository
6
+ } = _ref;
7
+ super();
8
+ this.userPreferenceRepository = userPreferenceRepository;
9
+ }
10
+
11
+ async getPreferences(request) {
12
+ return this.userPreferenceRepository.getPreferences(request);
13
+ }
14
+
15
+ async updatePreferences(request) {
16
+ return this.userPreferenceRepository.updatePreferences(request);
17
+ }
18
+
19
+ toJSON() {
20
+ return {
21
+ getPreferences: this.getPreferences.bind(this),
22
+ updatePreferences: this.updatePreferences.bind(this)
23
+ };
24
+ }
25
+
26
+ }
@@ -0,0 +1,2 @@
1
+ import UserPreferenceService from './UserPreferenceService';
2
+ export { UserPreferenceService };
@@ -0,0 +1,21 @@
1
+ import { IWhatsAppPricingRepository } from '../../../domain/interfaces/repositories';
2
+ export default class WhatsAppPricingService extends IWhatsAppPricingRepository {
3
+ constructor(_ref) {
4
+ let {
5
+ whatsAppPricingRepository
6
+ } = _ref;
7
+ super();
8
+ this.whatsAppPricingRepository = whatsAppPricingRepository;
9
+ }
10
+
11
+ async calculateWhatsAppPricing(request) {
12
+ return this.whatsAppPricingRepository.calculateWhatsAppPricing(request);
13
+ }
14
+
15
+ toJSON() {
16
+ return {
17
+ calculateWhatsAppPricing: this.calculateWhatsAppPricing.bind(this)
18
+ };
19
+ }
20
+
21
+ }
@@ -0,0 +1,2 @@
1
+ import WhatsAppPricingService from './WhatsAppPricingService';
2
+ export { WhatsAppPricingService };
@@ -7,6 +7,10 @@ const ModuleNames = {
7
7
  AGENTS: 'agents',
8
8
  CANNED_MESSAGES: 'cannedMessages',
9
9
  TEMPLATE_MESSAGES: 'templateMessages',
10
- CUSTOM_REPLY_EXTENSIONS: 'articles'
10
+ CUSTOM_REPLY_EXTENSIONS: 'articles',
11
+ INTEGRATION_SERVICES: 'integrationServices',
12
+ USER_PREFERENCES: 'userPreferences',
13
+ WHATSAPP_PRICING: 'whatsAppPricing',
14
+ CALLS: 'calls'
11
15
  };
12
16
  export default ModuleNames;
@@ -0,0 +1,5 @@
1
+ const ModuleTypes = {
2
+ AUTHENTICATED: 'authenticated',
3
+ PUBLIC: 'public'
4
+ };
5
+ export default ModuleTypes;
@@ -1,6 +1,7 @@
1
1
  import { HttpMethods } from '@zohoim/http-client';
2
2
  import ModuleNames from './ModuleNames';
3
+ import ModuleTypes from './ModuleTypes';
3
4
  import ResponseTypes from './ResponseTypes';
4
5
  const IM_API_PREFIX = '/api/v1';
5
6
  const HTTP_METHODS = HttpMethods;
6
- export { ModuleNames, IM_API_PREFIX, HTTP_METHODS, ResponseTypes };
7
+ export { ModuleNames, ModuleTypes, IM_API_PREFIX, HTTP_METHODS, ResponseTypes };
@@ -94,6 +94,31 @@ export const validateSchema = _ref4 => {
94
94
  path: fieldPath,
95
95
  entityName
96
96
  });
97
+ } // Array validation — schema (objects) or enum (primitives), not both
98
+
99
+
100
+ if (rules.type === 'array' && Array.isArray(value)) {
101
+ if (rules.schema && rules.enum) {
102
+ console.warn(`${entityName} - ${fieldPath} must define either schema or enum for array, not both`);
103
+ } else if (rules.schema) {
104
+ value.forEach((item, index) => {
105
+ validate({
106
+ schema: rules.schema,
107
+ data: item,
108
+ path: `${fieldPath}[${index}]`,
109
+ entityName
110
+ });
111
+ });
112
+ } else if (rules.enum) {
113
+ value.forEach((item, index) => {
114
+ validateEnumCheck({
115
+ value: item,
116
+ rules,
117
+ path: `${fieldPath}[${index}]`,
118
+ entityName
119
+ });
120
+ });
121
+ }
97
122
  }
98
123
  }
99
124
  });
@@ -0,0 +1,14 @@
1
+ import RequestBuilder from '../RequestBuilder';
2
+ export default function getCallRequest() {
3
+ let {
4
+ params = {},
5
+ query = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withParams({
8
+ callId: null,
9
+ ...params
10
+ }).withQuery({
11
+ include: null,
12
+ ...query
13
+ }).build();
14
+ }
@@ -0,0 +1,20 @@
1
+ import RequestBuilder from '../RequestBuilder';
2
+ export default function getCallsRequest() {
3
+ let {
4
+ query = {}
5
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ return new RequestBuilder().withQuery({
7
+ from: 0,
8
+ limit: 10,
9
+ status: null,
10
+ integrationServiceId: null,
11
+ userType: null,
12
+ callIds: null,
13
+ sessionIds: null,
14
+ include: null,
15
+ userId: null,
16
+ channelIds: null,
17
+ exclude: null,
18
+ ...query
19
+ }).build();
20
+ }
@@ -0,0 +1,4 @@
1
+ export { default as getCallRequest } from './getCallRequest';
2
+ export { default as getCallsRequest } from './getCallsRequest';
3
+ export { default as initiateCallRequest } from './initiateCallRequest';
4
+ export { default as updateCallStatusRequest } from './updateCallStatusRequest';
@@ -0,0 +1,15 @@
1
+ import RequestBuilder from '../RequestBuilder';
2
+ export default function initiateCall() {
3
+ let {
4
+ params = {},
5
+ body = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withParams({
8
+ callId: null,
9
+ ...params
10
+ }).withBody({
11
+ platform: null,
12
+ meta: null,
13
+ ...body
14
+ }).build();
15
+ }
@@ -0,0 +1,15 @@
1
+ import RequestBuilder from '../RequestBuilder';
2
+ export default function updateCallStatusRequest() {
3
+ let {
4
+ params = {},
5
+ body = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withParams({
8
+ callId: null,
9
+ ...params
10
+ }).withBody({
11
+ status: null,
12
+ meta: null,
13
+ ...body
14
+ }).build();
15
+ }
@@ -0,0 +1,13 @@
1
+ import RequestBuilder from '../RequestBuilder';
2
+
3
+ function getChannelRequest() {
4
+ let {
5
+ params = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withParams({
8
+ channelId: null,
9
+ ...params
10
+ }).build();
11
+ }
12
+
13
+ export default getChannelRequest;
@@ -16,7 +16,9 @@ function getChannelsRequest() {
16
16
  channelIds: null,
17
17
  include: null,
18
18
  // meta|configParams
19
- includeUnsubscribed: null
19
+ includeUnsubscribed: null,
20
+ excludeConfigName: null,
21
+ excludeConfigValue: null
20
22
  }).build();
21
23
  }
22
24
 
@@ -1,3 +1,4 @@
1
1
  import getChannelsRequest from './getChannelsRequest';
2
+ import getChannelRequest from './getChannelRequest';
2
3
  export * from './agents';
3
- export { getChannelsRequest };
4
+ export { getChannelsRequest, getChannelRequest };
@@ -5,4 +5,8 @@ export * from './messages';
5
5
  export * from './agents';
6
6
  export * from './contacts';
7
7
  export * from './cannedMessages';
8
- export * from './templateMessages';
8
+ export * from './templateMessages';
9
+ export * from './integrationServices';
10
+ export * from './userPreferences';
11
+ export * from './whatsAppPricing';
12
+ export * from './calls';
@@ -0,0 +1,7 @@
1
+ import RequestBuilder from '../RequestBuilder';
2
+
3
+ function getIntegrationsRequest() {
4
+ return new RequestBuilder().build();
5
+ }
6
+
7
+ export default getIntegrationsRequest;
@@ -0,0 +1 @@
1
+ export { default as getIntegrationsRequest } from './getIntegrationsRequest';
@@ -2,13 +2,16 @@ import RequestBuilder from '../RequestBuilder';
2
2
 
3
3
  function getSessionAttachmentsRequest() {
4
4
  let {
5
- params = {}
5
+ params = {},
6
+ query = {}
6
7
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
8
  return new RequestBuilder().withParams({
8
9
  sessionId: null,
10
+ ...params
11
+ }).withQuery({
9
12
  from: null,
10
13
  limit: null,
11
- ...params
14
+ ...query
12
15
  }).build();
13
16
  }
14
17
 
@@ -0,0 +1,16 @@
1
+ import RequestBuilder from '../RequestBuilder';
2
+
3
+ function getSessionMetricsRequest() {
4
+ let {
5
+ query = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withQuery({
8
+ channelIds: null,
9
+ integrationServiceId: null,
10
+ excludeSyncingChannels: false,
11
+ assignmentType: null,
12
+ ...query
13
+ }).build();
14
+ }
15
+
16
+ export default getSessionMetricsRequest;
@@ -5,4 +5,5 @@ export { default as getSessionAttachmentsRequest } from './getSessionAttachments
5
5
  export { default as getSessionLastMessagesRequest } from './getSessionLastMessagesRequest';
6
6
  export { default as markSessionAsReadRequest } from './markSessionAsReadRequest';
7
7
  export { default as updateSessionStatusRequest } from './updateSessionStatusRequest';
8
- export { default as pickupSessionRequest } from './pickupSessionRequest';
8
+ export { default as pickupSessionRequest } from './pickupSessionRequest';
9
+ export { default as getSessionMetricsRequest } from './getSessionMetricsRequest';
@@ -0,0 +1,7 @@
1
+ import RequestBuilder from '../RequestBuilder';
2
+
3
+ function getPreferencesRequest() {
4
+ return new RequestBuilder().build();
5
+ }
6
+
7
+ export default getPreferencesRequest;
@@ -0,0 +1,2 @@
1
+ export { default as getPreferencesRequest } from './getPreferencesRequest';
2
+ export { default as updatePreferencesRequest } from './updatePreferencesRequest';
@@ -0,0 +1,9 @@
1
+ import RequestBuilder from '../RequestBuilder';
2
+
3
+ function updatePreferencesRequest() {
4
+ return new RequestBuilder().withBody({
5
+ collapseSidePanel: null
6
+ }).build();
7
+ }
8
+
9
+ export default updatePreferencesRequest;
@@ -0,0 +1,14 @@
1
+ import RequestBuilder from '../RequestBuilder';
2
+
3
+ function calculateWhatsAppPricingRequest() {
4
+ let {
5
+ body = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withBody({
8
+ currency: null,
9
+ data: null,
10
+ ...body
11
+ }).build();
12
+ }
13
+
14
+ export default calculateWhatsAppPricingRequest;
@@ -0,0 +1 @@
1
+ export { default as calculateWhatsAppPricingRequest } from './calculateWhatsAppPricingRequest';
@@ -33,6 +33,10 @@ export default class Actor {
33
33
  return type === ActorType.ENDUSER;
34
34
  }
35
35
 
36
+ static isAgent(type) {
37
+ return type === ActorType.AGENT;
38
+ }
39
+
36
40
  toJSON() {
37
41
  return { ...this.data
38
42
  };
@@ -0,0 +1,47 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { CallSchema } from '../../schema';
3
+ import { Actor } from '../Actor';
4
+ export default class Call {
5
+ constructor() {
6
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ const validatedData = validateSchema({
8
+ schema: CallSchema,
9
+ data,
10
+ entityName: 'Call'
11
+ }); // Set required properties from schema
12
+
13
+ this.id = validatedData.id;
14
+ this.integrationServiceId = validatedData.integrationServiceId;
15
+ this.actor = new Actor(validatedData.actor).toJSON();
16
+ this.channelId = validatedData.channelId;
17
+ this.createdTime = validatedData.createdTime;
18
+ this.direction = validatedData.direction;
19
+ this.sessionId = validatedData.sessionId;
20
+ this.status = validatedData.status; // Set optional properties from schema
21
+
22
+ this.meta = validatedData.meta || null;
23
+ this.participants = validatedData.participants || null;
24
+ this.session = validatedData.session || false;
25
+ this.statuses = validatedData.statuses || null;
26
+ this.duration = validatedData.duration || null;
27
+ }
28
+
29
+ toJSON() {
30
+ return {
31
+ id: this.id,
32
+ integrationServiceId: this.integrationServiceId,
33
+ actor: this.actor,
34
+ channelId: this.channelId,
35
+ createdTime: this.createdTime,
36
+ direction: this.direction,
37
+ sessionId: this.sessionId,
38
+ status: this.status,
39
+ meta: this.meta,
40
+ participants: this.participants,
41
+ session: this.session,
42
+ statuses: this.statuses,
43
+ duration: this.duration
44
+ };
45
+ }
46
+
47
+ }
@@ -0,0 +1 @@
1
+ export { default as Call } from './Call';
@@ -10,32 +10,50 @@ export default class Channel {
10
10
  }); // Set required properties from schema
11
11
 
12
12
  this.id = validatedData.id;
13
- this.integrationService = validatedData.integrationService;
14
13
  this.name = validatedData.name;
15
14
  this.isActive = validatedData.isActive;
16
- this.createdTime = validatedData.createdTime; // Set optional properties from schema
15
+ this.isDeleted = validatedData.isDeleted;
16
+ this.isSandBox = validatedData.isSandBox;
17
+ this.createdTime = validatedData.createdTime;
18
+ this.universalLink = validatedData.universalLink; // Set optional properties from schema
17
19
 
20
+ this.integrationServiceType = validatedData.integrationServiceType || '';
21
+ this.integrationServiceId = validatedData.integrationServiceId || '';
18
22
  this.defaultBotId = validatedData.defaultBotId || null;
19
23
  this.accountName = validatedData.accountName || null;
20
24
  this.isSubscribed = validatedData.isSubscribed || false;
21
25
  this.createdBy = validatedData.createdBy || null;
22
26
  this.isOwner = validatedData.isOwner || false;
23
27
  this.photoURL = validatedData.photoURL || null;
28
+ this.configParams = validatedData.configParams || null;
29
+ this.authorizationPending = validatedData.authorizationPending || false;
30
+ this.meta = validatedData.meta || [];
31
+ this.logoURL = validatedData.logoURL || null;
32
+ this.workspaceId = validatedData.workspaceId || '';
24
33
  }
25
34
 
26
35
  toJSON() {
27
36
  return {
28
37
  id: this.id,
29
- integrationService: this.integrationService,
38
+ integrationServiceType: this.integrationServiceType,
39
+ integrationServiceId: this.integrationServiceId,
30
40
  name: this.name,
31
41
  defaultBotId: this.defaultBotId,
32
42
  isActive: this.isActive,
43
+ isDeleted: this.isDeleted,
44
+ isSandBox: this.isSandBox,
33
45
  createdTime: this.createdTime,
34
46
  accountName: this.accountName,
47
+ universalLink: this.universalLink,
35
48
  isSubscribed: this.isSubscribed,
36
49
  createdBy: this.createdBy,
37
50
  isOwner: this.isOwner,
38
- photoURL: this.photoURL
51
+ photoURL: this.photoURL,
52
+ configParams: this.configParams,
53
+ authorizationPending: this.authorizationPending,
54
+ meta: this.meta,
55
+ logoURL: this.logoURL,
56
+ workspaceId: this.workspaceId
39
57
  };
40
58
  }
41
59
 
@@ -13,7 +13,10 @@ export default class IntegrationService {
13
13
  label: validatedData.label || '',
14
14
  id: validatedData.id || '',
15
15
  provider: validatedData.provider || {},
16
- logoURL: validatedData.logoURL || null
16
+ logoURL: validatedData.logoURL || null,
17
+ domain: validatedData.domain || '',
18
+ channelAlias: validatedData.channelAlias,
19
+ isParentAccountNeeded: validatedData.isParentAccountNeeded
17
20
  };
18
21
  }
19
22
 
@@ -29,6 +32,10 @@ export default class IntegrationService {
29
32
  return integrationServiceId === IntegrationServices.IM_TALK;
30
33
  }
31
34
 
35
+ static isWecom(integrationServiceId) {
36
+ return integrationServiceId === IntegrationServices.WECOM;
37
+ }
38
+
32
39
  toJSON() {
33
40
  return { ...this.data
34
41
  };
@@ -0,0 +1,21 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { SessionMetricsSchema } from '../../schema';
3
+ export default class SessionMetrics {
4
+ constructor() {
5
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const validatedData = validateSchema({
7
+ schema: SessionMetricsSchema,
8
+ data,
9
+ entityName: 'SessionMetrics'
10
+ });
11
+ this.data = {
12
+ assignee: validatedData.assignee
13
+ };
14
+ }
15
+
16
+ toJSON() {
17
+ return { ...this.data
18
+ };
19
+ }
20
+
21
+ }
@@ -1,2 +1,3 @@
1
1
  import Session from './Session';
2
- export { Session };
2
+ import SessionMetrics from './SessionMetrics';
3
+ export { Session, SessionMetrics };
@@ -0,0 +1,26 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { UserPreferenceSchema } from '../../schema';
3
+ import { CollapseSidePanel } from '../../enum';
4
+ export default class UserPreference {
5
+ constructor() {
6
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ const validatedData = validateSchema({
8
+ schema: UserPreferenceSchema,
9
+ data,
10
+ entityName: 'UserPreference'
11
+ });
12
+ this.data = {
13
+ collapseSidePanel: validatedData.collapseSidePanel
14
+ };
15
+ }
16
+
17
+ static isCollpseView(view) {
18
+ return view === CollapseSidePanel.ENABLED;
19
+ }
20
+
21
+ toJSON() {
22
+ return { ...this.data
23
+ };
24
+ }
25
+
26
+ }
@@ -0,0 +1,2 @@
1
+ import UserPreference from './UserPreference';
2
+ export { UserPreference };