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

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 (72) 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/index.js +3 -1
  4. package/es/application/services/whatsAppPricing/WhatsAppPricingService.js +21 -0
  5. package/es/application/services/whatsAppPricing/index.js +2 -0
  6. package/es/core/constants/ModuleNames.js +3 -1
  7. package/es/core/constants/ModuleTypes.js +5 -0
  8. package/es/core/constants/index.js +2 -1
  9. package/es/core/utils/validateSchema.js +12 -0
  10. package/es/domain/dto/calls/getCallRequest.js +14 -0
  11. package/es/domain/dto/calls/getCallsRequest.js +20 -0
  12. package/es/domain/dto/calls/index.js +4 -0
  13. package/es/domain/dto/calls/initiateCallRequest.js +15 -0
  14. package/es/domain/dto/calls/updateCallStatusRequest.js +15 -0
  15. package/es/domain/dto/index.js +3 -1
  16. package/es/domain/dto/sessions/getSessionAttachmentsRequest.js +5 -2
  17. package/es/domain/dto/whatsAppPricing/calculateWhatsAppPricingRequest.js +14 -0
  18. package/es/domain/dto/whatsAppPricing/index.js +1 -0
  19. package/es/domain/entities/Actor/Actor.js +4 -0
  20. package/es/domain/entities/Call/Call.js +47 -0
  21. package/es/domain/entities/Call/index.js +1 -0
  22. package/es/domain/entities/WhatsAppPricing/WhatsAppPricing.js +25 -0
  23. package/es/domain/entities/WhatsAppPricing/WhatsAppPricingCategory.js +22 -0
  24. package/es/domain/entities/WhatsAppPricing/index.js +3 -0
  25. package/es/domain/entities/index.js +3 -1
  26. package/es/domain/enum/call/CallStatus.js +8 -0
  27. package/es/domain/enum/call/index.js +1 -0
  28. package/es/domain/enum/index.js +2 -1
  29. package/es/domain/interfaces/repositories/calls/ICallRepository.js +32 -0
  30. package/es/domain/interfaces/repositories/calls/index.js +1 -0
  31. package/es/domain/interfaces/repositories/index.js +3 -1
  32. package/es/domain/interfaces/repositories/whatsAppPricing/IWhatsAppPricingRepository.js +18 -0
  33. package/es/domain/interfaces/repositories/whatsAppPricing/index.js +2 -0
  34. package/es/domain/schema/call/CallSchema.js +63 -0
  35. package/es/domain/schema/call/index.js +1 -0
  36. package/es/domain/schema/index.js +3 -1
  37. package/es/domain/schema/whatsAppPricing/WhatsAppPricingCategorySchema.js +11 -0
  38. package/es/domain/schema/whatsAppPricing/WhatsAppPricingSchema.js +21 -0
  39. package/es/domain/schema/whatsAppPricing/index.js +3 -0
  40. package/es/frameworks/managers/ModuleFactory.js +59 -23
  41. package/es/frameworks/managers/ModuleManager.js +25 -2
  42. package/es/frameworks/sdk/IMSDK.js +23 -11
  43. package/es/frameworks/sdk/calls/CallSDK.js +27 -0
  44. package/es/frameworks/sdk/calls/index.js +1 -0
  45. package/es/frameworks/sdk/whatsAppPricing/WhatsAppPricingSDK.js +28 -0
  46. package/es/frameworks/sdk/whatsAppPricing/index.js +2 -0
  47. package/es/infrastructure/adapters/calls/CallAdapter.js +31 -0
  48. package/es/infrastructure/adapters/calls/index.js +1 -0
  49. package/es/infrastructure/adapters/index.js +3 -1
  50. package/es/infrastructure/adapters/whatsAppPricing/WhatsAppPricingAdapter.js +22 -0
  51. package/es/infrastructure/adapters/whatsAppPricing/index.js +2 -0
  52. package/es/infrastructure/api/BaseAPI.js +5 -4
  53. package/es/infrastructure/api/calls/CallAPI.js +44 -0
  54. package/es/infrastructure/api/calls/index.js +1 -0
  55. package/es/infrastructure/api/index.js +3 -1
  56. package/es/infrastructure/api/registry/calls/callAPIRegistry.js +29 -0
  57. package/es/infrastructure/api/registry/calls/constructCallEndPoint.js +10 -0
  58. package/es/infrastructure/api/registry/calls/index.js +1 -0
  59. package/es/infrastructure/api/registry/createPublicBaseUrl.js +4 -0
  60. package/es/infrastructure/api/registry/getRegistryConfig.js +5 -1
  61. package/es/infrastructure/api/registry/whatsAppPricing/constructWhatsAppPricingEndPoint.js +10 -0
  62. package/es/infrastructure/api/registry/whatsAppPricing/index.js +2 -0
  63. package/es/infrastructure/api/registry/whatsAppPricing/whatsAppPricingAPIRegistry.js +13 -0
  64. package/es/infrastructure/api/whatsAppPricing/WhatsAppPricingAPI.js +14 -0
  65. package/es/infrastructure/api/whatsAppPricing/index.js +2 -0
  66. package/es/infrastructure/config/configRegistry.js +8 -1
  67. package/es/infrastructure/repositories/calls/CallRepository.js +73 -0
  68. package/es/infrastructure/repositories/calls/index.js +1 -0
  69. package/es/infrastructure/repositories/index.js +3 -1
  70. package/es/infrastructure/repositories/whatsAppPricing/WhatsAppPricingRepository.js +49 -0
  71. package/es/infrastructure/repositories/whatsAppPricing/index.js +2 -0
  72. package/package.json +2 -2
@@ -0,0 +1,73 @@
1
+ import { CallAdapter } from '../../adapters';
2
+ import { CallAPI } from '../../api';
3
+ import { ICallRepository } from '../../../domain/interfaces/repositories/calls';
4
+ import { ResponseTypes } from '../../../core/constants';
5
+ export default class CallRepository extends ICallRepository {
6
+ constructor(_ref) {
7
+ let {
8
+ callAPI,
9
+ callAdapter
10
+ } = _ref;
11
+ super();
12
+ this.defaultAPI = new CallAPI();
13
+ this.customAPI = callAPI;
14
+ this.callAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
15
+ this.callAdapter = callAdapter || new CallAdapter();
16
+ }
17
+
18
+ async invokeAPI(_ref2) {
19
+ let {
20
+ operation,
21
+ request,
22
+ adapter = this.callAdapter,
23
+ responseType
24
+ } = _ref2;
25
+ return this.executeAPICall({
26
+ operation,
27
+ request,
28
+ apiProxy: this.callAPI,
29
+ customAPI: this.customAPI,
30
+ adapter,
31
+ responseType
32
+ });
33
+ }
34
+
35
+ async getCalls(request) {
36
+ return this.invokeAPI({
37
+ operation: 'getCalls',
38
+ request,
39
+ responseType: ResponseTypes.LIST
40
+ });
41
+ }
42
+
43
+ async getCall(request) {
44
+ return this.invokeAPI({
45
+ operation: 'getCall',
46
+ request
47
+ });
48
+ }
49
+
50
+ async updateCallStatus(request) {
51
+ return this.invokeAPI({
52
+ operation: 'updateCallStatus',
53
+ request
54
+ });
55
+ }
56
+
57
+ async initiateCall(request) {
58
+ return this.invokeAPI({
59
+ operation: 'initiateCall',
60
+ request
61
+ });
62
+ }
63
+
64
+ toJSON() {
65
+ return {
66
+ getCalls: this.getCalls.bind(this),
67
+ getCall: this.getCall.bind(this),
68
+ updateCallStatus: this.updateCallStatus.bind(this),
69
+ initiateCall: this.initiateCall.bind(this)
70
+ };
71
+ }
72
+
73
+ }
@@ -0,0 +1 @@
1
+ export { default as CallRepository } from './CallRepository';
@@ -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 './whatsAppPricing';
10
+ export * from './calls';
@@ -0,0 +1,49 @@
1
+ import { IWhatsAppPricingRepository } from '../../../domain/interfaces/repositories';
2
+ import { WhatsAppPricingAdapter } from '../../adapters';
3
+ import { WhatsAppPricingAPI } from '../../api';
4
+ import { ResponseTypes } from '../../../core/constants';
5
+ export default class WhatsAppPricingRepository extends IWhatsAppPricingRepository {
6
+ constructor(_ref) {
7
+ let {
8
+ whatsAppPricingAPI,
9
+ whatsAppPricingAdapter
10
+ } = _ref;
11
+ super();
12
+ this.defaultAPI = new WhatsAppPricingAPI();
13
+ this.customAPI = whatsAppPricingAPI;
14
+ this.whatsAppPricingAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
15
+ this.whatsAppPricingAdapter = whatsAppPricingAdapter || new WhatsAppPricingAdapter();
16
+ }
17
+
18
+ async invokeAPI(_ref2) {
19
+ let {
20
+ operation,
21
+ request,
22
+ adapter = this.whatsAppPricingAdapter,
23
+ responseType
24
+ } = _ref2;
25
+ return this.executeAPICall({
26
+ operation,
27
+ request,
28
+ apiProxy: this.whatsAppPricingAPI,
29
+ customAPI: this.customAPI,
30
+ adapter,
31
+ responseType
32
+ });
33
+ }
34
+
35
+ async calculateWhatsAppPricing(request) {
36
+ return this.invokeAPI({
37
+ operation: 'calculateWhatsAppPricing',
38
+ request,
39
+ responseType: ResponseTypes.SINGLE
40
+ });
41
+ }
42
+
43
+ toJSON() {
44
+ return {
45
+ calculateWhatsAppPricing: this.calculateWhatsAppPricing.bind(this)
46
+ };
47
+ }
48
+
49
+ }
@@ -0,0 +1,2 @@
1
+ import WhatsAppPricingRepository from './WhatsAppPricingRepository';
2
+ export { WhatsAppPricingRepository };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohoim/client-sdk",
3
- "version": "1.1.0-attachmentsList",
3
+ "version": "1.1.0-calls",
4
4
  "description": "To have the client sdk for the IM",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",
@@ -32,4 +32,4 @@
32
32
  "@zohodesk/docs-builder": "1.0.2",
33
33
  "@testing-library/jest-dom": "^5.16.5"
34
34
  }
35
- }
35
+ }