@zohoim/client-sdk 1.0.0-canned09 → 1.0.0-canned11
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/index.js +2 -1
- package/es/application/services/whatsAppPricing/WhatsAppPricingService.js +21 -0
- package/es/application/services/whatsAppPricing/index.js +2 -0
- package/es/core/constants/ModuleNames.js +2 -1
- package/es/core/constants/ModuleTypes.js +5 -0
- package/es/core/constants/index.js +2 -1
- package/es/core/utils/validateSchema.js +12 -0
- package/es/domain/dto/cannedMessages/addTranslationRequest.js +2 -1
- package/es/domain/dto/cannedMessages/getCannedPlaceholdersRequest.js +1 -4
- package/es/domain/dto/cannedMessages/updateTranslationRequest.js +2 -0
- package/es/domain/dto/index.js +2 -1
- package/es/domain/dto/sessions/getSessionAttachmentsRequest.js +6 -1
- package/es/domain/dto/whatsAppPricing/calculateWhatsAppPricingRequest.js +14 -0
- package/es/domain/dto/whatsAppPricing/index.js +1 -0
- package/es/domain/entities/CannedMessage/Translation.js +1 -1
- package/es/domain/entities/TemplateMessage/TemplateTags.js +21 -0
- package/es/domain/entities/TemplateMessage/index.js +2 -1
- package/es/domain/entities/WhatsAppPricing/WhatsAppPricing.js +25 -0
- package/es/domain/entities/WhatsAppPricing/WhatsAppPricingCategory.js +22 -0
- package/es/domain/entities/WhatsAppPricing/index.js +3 -0
- package/es/domain/entities/index.js +2 -1
- package/es/domain/interfaces/repositories/index.js +2 -1
- package/es/domain/interfaces/repositories/whatsAppPricing/IWhatsAppPricingRepository.js +18 -0
- package/es/domain/interfaces/repositories/whatsAppPricing/index.js +2 -0
- package/es/domain/schema/index.js +2 -1
- package/es/domain/schema/templateMessage/TemplateTagsSchema.js +7 -0
- package/es/domain/schema/templateMessage/index.js +2 -1
- package/es/domain/schema/whatsAppPricing/WhatsAppPricingCategorySchema.js +11 -0
- package/es/domain/schema/whatsAppPricing/WhatsAppPricingSchema.js +21 -0
- package/es/domain/schema/whatsAppPricing/index.js +3 -0
- package/es/frameworks/managers/ModuleFactory.js +51 -24
- package/es/frameworks/managers/ModuleManager.js +25 -2
- package/es/frameworks/sdk/IMSDK.js +18 -11
- package/es/frameworks/sdk/whatsAppPricing/WhatsAppPricingSDK.js +28 -0
- package/es/frameworks/sdk/whatsAppPricing/index.js +2 -0
- package/es/infrastructure/adapters/cannedMessages/CannedMessageAdapter.js +2 -3
- package/es/infrastructure/adapters/index.js +2 -1
- package/es/infrastructure/adapters/placeholders/PlaceholderAdapter.js +1 -1
- package/es/infrastructure/adapters/templateMessages/TemplateTagsAdapter.js +19 -0
- package/es/infrastructure/adapters/templateMessages/index.js +2 -1
- package/es/infrastructure/adapters/whatsAppPricing/WhatsAppPricingAdapter.js +22 -0
- package/es/infrastructure/adapters/whatsAppPricing/index.js +2 -0
- package/es/infrastructure/api/BaseAPI.js +5 -4
- package/es/infrastructure/api/index.js +2 -1
- package/es/infrastructure/api/registry/channels/channelAgentAPIRegistry.js +1 -1
- package/es/infrastructure/api/registry/createPublicBaseUrl.js +4 -0
- package/es/infrastructure/api/registry/getRegistryConfig.js +3 -1
- package/es/infrastructure/api/registry/sessions/sessionAPIRegistry.js +1 -1
- package/es/infrastructure/api/registry/whatsAppPricing/constructWhatsAppPricingEndPoint.js +10 -0
- package/es/infrastructure/api/registry/whatsAppPricing/index.js +2 -0
- package/es/infrastructure/api/registry/whatsAppPricing/whatsAppPricingAPIRegistry.js +13 -0
- package/es/infrastructure/api/whatsAppPricing/WhatsAppPricingAPI.js +14 -0
- package/es/infrastructure/api/whatsAppPricing/index.js +2 -0
- package/es/infrastructure/config/configRegistry.js +8 -1
- package/es/infrastructure/repositories/index.js +2 -1
- package/es/infrastructure/repositories/templateMessages/TemplateMessageRepository.js +6 -3
- package/es/infrastructure/repositories/whatsAppPricing/WhatsAppPricingRepository.js +49 -0
- package/es/infrastructure/repositories/whatsAppPricing/index.js +2 -0
- package/package.json +1 -1
|
@@ -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
|
+
}
|
|
@@ -7,6 +7,7 @@ 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
|
+
WHATSAPP_PRICING: 'whatsAppPricing'
|
|
11
12
|
};
|
|
12
13
|
export default ModuleNames;
|
|
@@ -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,18 @@ export const validateSchema = _ref4 => {
|
|
|
94
94
|
path: fieldPath,
|
|
95
95
|
entityName
|
|
96
96
|
});
|
|
97
|
+
} // Array item validation
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
if (rules.type === 'array' && rules.schema && Array.isArray(value)) {
|
|
101
|
+
value.forEach((item, index) => {
|
|
102
|
+
validate({
|
|
103
|
+
schema: rules.schema,
|
|
104
|
+
data: item,
|
|
105
|
+
path: `${fieldPath}[${index}]`,
|
|
106
|
+
entityName
|
|
107
|
+
});
|
|
108
|
+
});
|
|
97
109
|
}
|
|
98
110
|
}
|
|
99
111
|
});
|
|
@@ -7,10 +7,11 @@ function addTranslationRequest() {
|
|
|
7
7
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
8
|
return new RequestBuilder().withParams({
|
|
9
9
|
cannedMessageId: null,
|
|
10
|
-
translationId: null,
|
|
11
10
|
...params
|
|
12
11
|
}).withBody({
|
|
13
12
|
message: null,
|
|
13
|
+
language: null,
|
|
14
|
+
templateItems: {},
|
|
14
15
|
...body
|
|
15
16
|
}).build();
|
|
16
17
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import RequestBuilder from '../RequestBuilder';
|
|
2
2
|
|
|
3
3
|
function getCannedPlaceholdersRequest() {
|
|
4
|
-
|
|
5
|
-
params = {}
|
|
6
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
-
return new RequestBuilder().withParams(params).build();
|
|
4
|
+
return new RequestBuilder().build();
|
|
8
5
|
}
|
|
9
6
|
|
|
10
7
|
export default getCannedPlaceholdersRequest;
|
package/es/domain/dto/index.js
CHANGED
|
@@ -2,11 +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,
|
|
9
10
|
...params
|
|
11
|
+
}).withQuery({
|
|
12
|
+
from: null,
|
|
13
|
+
limit: null,
|
|
14
|
+
...query
|
|
10
15
|
}).build();
|
|
11
16
|
}
|
|
12
17
|
|
|
@@ -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';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { validateSchema } from '../../../core/utils';
|
|
2
|
-
import TranslationsSchema from '../../schema
|
|
2
|
+
import { TranslationsSchema } from '../../schema';
|
|
3
3
|
import { TemplateItemButton, TemplateItemHeader, TemplateItemFooter } from '../TemplateMessage';
|
|
4
4
|
export default class Translation {
|
|
5
5
|
constructor() {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { validateSchema } from '../../../core/utils';
|
|
2
|
+
import { TemplateTagsSchema } from '../../schema';
|
|
3
|
+
export default class TemplateTags {
|
|
4
|
+
constructor() {
|
|
5
|
+
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: TemplateTagsSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'TemplateTags'
|
|
10
|
+
});
|
|
11
|
+
this.data = {
|
|
12
|
+
tags: validatedData.tags
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
toJSON() {
|
|
17
|
+
return { ...this.data
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import TemplateLanguage from './TemplateLanguage';
|
|
2
2
|
import TemplateCreditExhaustStatus from './TemplateCreditExhaustStatus';
|
|
3
|
+
import TemplateTags from './TemplateTags';
|
|
3
4
|
import TemplateItemButton from './TemplateItemButton';
|
|
4
5
|
import TemplateItemHeader from './TemplateItemHeader';
|
|
5
6
|
import TemplateItemFooter from './TemplateItemFooter';
|
|
6
|
-
export { TemplateLanguage, TemplateCreditExhaustStatus, TemplateItemButton, TemplateItemHeader, TemplateItemFooter };
|
|
7
|
+
export { TemplateLanguage, TemplateCreditExhaustStatus, TemplateTags, TemplateItemButton, TemplateItemHeader, TemplateItemFooter };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { validateSchema } from '../../../core/utils';
|
|
2
|
+
import { WhatsAppPricingSchema } from '../../schema';
|
|
3
|
+
import WhatsAppPricingCategory from './WhatsAppPricingCategory';
|
|
4
|
+
export default class WhatsAppPricing {
|
|
5
|
+
constructor() {
|
|
6
|
+
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
const validatedData = validateSchema({
|
|
8
|
+
schema: WhatsAppPricingSchema,
|
|
9
|
+
data,
|
|
10
|
+
entityName: 'WhatsAppPricing'
|
|
11
|
+
});
|
|
12
|
+
this.data = {
|
|
13
|
+
total: validatedData.total,
|
|
14
|
+
creditsCount: validatedData.creditsCount,
|
|
15
|
+
actutalCreditsAmount: validatedData.actutalCreditsAmount,
|
|
16
|
+
category: validatedData.category.map(item => new WhatsAppPricingCategory(item).toJSON())
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
toJSON() {
|
|
21
|
+
return { ...this.data
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { validateSchema } from '../../../core/utils';
|
|
2
|
+
import { WhatsAppPricingCategorySchema } from '../../schema';
|
|
3
|
+
export default class WhatsAppPricingCategory {
|
|
4
|
+
constructor() {
|
|
5
|
+
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: WhatsAppPricingCategorySchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'WhatsAppPricingCategory'
|
|
10
|
+
});
|
|
11
|
+
this.data = {
|
|
12
|
+
type: validatedData.type,
|
|
13
|
+
value: validatedData.value
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
toJSON() {
|
|
18
|
+
return { ...this.data
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
|
2
|
+
import { ModuleNames, ModuleTypes } from '../../../../core/constants';
|
|
3
|
+
import BaseAPI from '../../../../infrastructure/api/BaseAPI';
|
|
4
|
+
import { calculateWhatsAppPricingRequest } from '../../../dto';
|
|
5
|
+
export default class IWhatsAppPricingRepository extends BaseAPI {
|
|
6
|
+
constructor() {
|
|
7
|
+
super({
|
|
8
|
+
module: ModuleNames.WHATSAPP_PRICING,
|
|
9
|
+
moduleType: ModuleTypes.PUBLIC
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async calculateWhatsAppPricing() {
|
|
14
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : calculateWhatsAppPricingRequest();
|
|
15
|
+
throw new Error('Method not implemented');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import TemplateLanguageSchema from './TemplateLanguageSchema';
|
|
2
2
|
import TemplateCreditExhaustStatusSchema from './TemplateCreditExhaustStatusSchema';
|
|
3
|
-
|
|
3
|
+
import TemplateTagsSchema from './TemplateTagsSchema';
|
|
4
|
+
export { TemplateLanguageSchema, TemplateCreditExhaustStatusSchema, TemplateTagsSchema };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import WhatsAppPricingCategorySchema from './WhatsAppPricingCategorySchema';
|
|
2
|
+
const WhatsAppPricingSchema = {
|
|
3
|
+
total: {
|
|
4
|
+
type: 'number',
|
|
5
|
+
required: true
|
|
6
|
+
},
|
|
7
|
+
creditsCount: {
|
|
8
|
+
type: 'number',
|
|
9
|
+
required: true
|
|
10
|
+
},
|
|
11
|
+
actutalCreditsAmount: {
|
|
12
|
+
type: 'number',
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
category: {
|
|
16
|
+
type: 'array',
|
|
17
|
+
required: true,
|
|
18
|
+
schema: WhatsAppPricingCategorySchema
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export default WhatsAppPricingSchema;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModuleNames } from '../../core/constants';
|
|
1
|
+
import { ModuleNames, ModuleTypes } from '../../core/constants';
|
|
2
2
|
import { BotSDK } from '../sdk/bots';
|
|
3
3
|
import { ChannelSDK } from '../sdk/channels';
|
|
4
4
|
import { SessionSDK } from '../sdk/sessions';
|
|
@@ -7,70 +7,97 @@ import { AgentSDK } from '../sdk/agents';
|
|
|
7
7
|
import { ContactSDK } from '../sdk/contacts';
|
|
8
8
|
import { CannedMessageSDK } from '../sdk/cannedMessages';
|
|
9
9
|
import { TemplateMessageSDK } from '../sdk/templateMessages';
|
|
10
|
+
import { WhatsAppPricingSDK } from '../sdk/whatsAppPricing';
|
|
10
11
|
const ModuleFactory = {
|
|
11
12
|
[ModuleNames.CHANNELS]: _ref => {
|
|
12
13
|
let {
|
|
13
14
|
config
|
|
14
15
|
} = _ref;
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
return {
|
|
17
|
+
[ModuleTypes.AUTHENTICATED]: new ChannelSDK({
|
|
18
|
+
config
|
|
19
|
+
}).toJSON()
|
|
20
|
+
};
|
|
18
21
|
},
|
|
19
22
|
[ModuleNames.SESSIONS]: _ref2 => {
|
|
20
23
|
let {
|
|
21
24
|
config
|
|
22
25
|
} = _ref2;
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
return {
|
|
27
|
+
[ModuleTypes.AUTHENTICATED]: new SessionSDK({
|
|
28
|
+
config
|
|
29
|
+
}).toJSON()
|
|
30
|
+
};
|
|
26
31
|
},
|
|
27
32
|
[ModuleNames.BOTS]: _ref3 => {
|
|
28
33
|
let {
|
|
29
34
|
config
|
|
30
35
|
} = _ref3;
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
return {
|
|
37
|
+
[ModuleTypes.AUTHENTICATED]: new BotSDK({
|
|
38
|
+
config
|
|
39
|
+
}).toJSON()
|
|
40
|
+
};
|
|
34
41
|
},
|
|
35
42
|
[ModuleNames.AGENTS]: _ref4 => {
|
|
36
43
|
let {
|
|
37
44
|
config
|
|
38
45
|
} = _ref4;
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
return {
|
|
47
|
+
[ModuleTypes.AUTHENTICATED]: new AgentSDK({
|
|
48
|
+
config
|
|
49
|
+
}).toJSON()
|
|
50
|
+
};
|
|
42
51
|
},
|
|
43
52
|
[ModuleNames.CONTACTS]: _ref5 => {
|
|
44
53
|
let {
|
|
45
54
|
config
|
|
46
55
|
} = _ref5;
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
return {
|
|
57
|
+
[ModuleTypes.AUTHENTICATED]: new ContactSDK({
|
|
58
|
+
config
|
|
59
|
+
}).toJSON()
|
|
60
|
+
};
|
|
50
61
|
},
|
|
51
62
|
[ModuleNames.MESSAGES]: _ref6 => {
|
|
52
63
|
let {
|
|
53
64
|
config
|
|
54
65
|
} = _ref6;
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
return {
|
|
67
|
+
[ModuleTypes.AUTHENTICATED]: new MessageSDK({
|
|
68
|
+
config
|
|
69
|
+
}).toJSON()
|
|
70
|
+
};
|
|
58
71
|
},
|
|
59
72
|
[ModuleNames.CANNED_MESSAGES]: _ref7 => {
|
|
60
73
|
let {
|
|
61
74
|
config
|
|
62
75
|
} = _ref7;
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
return {
|
|
77
|
+
[ModuleTypes.AUTHENTICATED]: new CannedMessageSDK({
|
|
78
|
+
config
|
|
79
|
+
}).toJSON()
|
|
80
|
+
};
|
|
66
81
|
},
|
|
67
82
|
[ModuleNames.TEMPLATE_MESSAGES]: _ref8 => {
|
|
68
83
|
let {
|
|
69
84
|
config
|
|
70
85
|
} = _ref8;
|
|
71
|
-
return
|
|
86
|
+
return {
|
|
87
|
+
[ModuleTypes.AUTHENTICATED]: new TemplateMessageSDK({
|
|
88
|
+
config
|
|
89
|
+
}).toJSON()
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
[ModuleNames.WHATSAPP_PRICING]: _ref9 => {
|
|
93
|
+
let {
|
|
72
94
|
config
|
|
73
|
-
}
|
|
95
|
+
} = _ref9;
|
|
96
|
+
return {
|
|
97
|
+
[ModuleTypes.PUBLIC]: new WhatsAppPricingSDK({
|
|
98
|
+
config
|
|
99
|
+
}).toJSON()
|
|
100
|
+
};
|
|
74
101
|
}
|
|
75
102
|
};
|
|
76
103
|
export default ModuleFactory;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ModuleNames } from '../../core/constants';
|
|
1
|
+
import { ModuleNames, ModuleTypes } from '../../core/constants';
|
|
2
2
|
import ModuleFactory from './ModuleFactory';
|
|
3
3
|
export default class ModuleManager {
|
|
4
4
|
constructor() {
|
|
5
5
|
this._modules = new Map();
|
|
6
|
-
this.supportedModules = [ModuleNames.CHANNELS, ModuleNames.SESSIONS, ModuleNames.BOTS, ModuleNames.MESSAGES, ModuleNames.AGENTS, ModuleNames.CONTACTS, ModuleNames.CANNED_MESSAGES, ModuleNames.TEMPLATE_MESSAGES];
|
|
6
|
+
this.supportedModules = [ModuleNames.CHANNELS, ModuleNames.SESSIONS, ModuleNames.BOTS, ModuleNames.MESSAGES, ModuleNames.AGENTS, ModuleNames.CONTACTS, ModuleNames.CANNED_MESSAGES, ModuleNames.TEMPLATE_MESSAGES, ModuleNames.WHATSAPP_PRICING];
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
initialize(_ref) {
|
|
@@ -37,6 +37,29 @@ export default class ModuleManager {
|
|
|
37
37
|
return this._modules.get(moduleName);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
getModuleByType(moduleName) {
|
|
41
|
+
let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ModuleTypes.AUTHENTICATED;
|
|
42
|
+
const moduleEntry = this.getModule(moduleName);
|
|
43
|
+
|
|
44
|
+
if (!moduleEntry) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return moduleEntry[type];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
getModulesByType(type) {
|
|
52
|
+
const result = {};
|
|
53
|
+
|
|
54
|
+
this._modules.forEach((moduleEntry, moduleName) => {
|
|
55
|
+
if (moduleEntry[type]) {
|
|
56
|
+
result[moduleName] = moduleEntry[type];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
|
|
40
63
|
hasModule(moduleName) {
|
|
41
64
|
return this._modules.has(moduleName);
|
|
42
65
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModuleNames } from '../../core/constants';
|
|
1
|
+
import { ModuleNames, ModuleTypes } from '../../core/constants';
|
|
2
2
|
import configRegistry from '../../infrastructure/config/configRegistry';
|
|
3
3
|
import { ModuleManager } from '../managers';
|
|
4
4
|
export default class IMSDK {
|
|
@@ -6,11 +6,13 @@ export default class IMSDK {
|
|
|
6
6
|
let {
|
|
7
7
|
baseURL,
|
|
8
8
|
apiConfig = {},
|
|
9
|
-
httpClient
|
|
9
|
+
httpClient,
|
|
10
|
+
publicHttpClient
|
|
10
11
|
} = _ref;
|
|
11
12
|
configRegistry.setConfig({
|
|
12
13
|
baseURL,
|
|
13
|
-
httpClient
|
|
14
|
+
httpClient,
|
|
15
|
+
publicHttpClient
|
|
14
16
|
});
|
|
15
17
|
this._moduleManager = new ModuleManager();
|
|
16
18
|
|
|
@@ -20,35 +22,39 @@ export default class IMSDK {
|
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
get channels() {
|
|
23
|
-
return this._moduleManager.
|
|
25
|
+
return this._moduleManager.getModuleByType(ModuleNames.CHANNELS);
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
get sessions() {
|
|
27
|
-
return this._moduleManager.
|
|
29
|
+
return this._moduleManager.getModuleByType(ModuleNames.SESSIONS);
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
get bots() {
|
|
31
|
-
return this._moduleManager.
|
|
33
|
+
return this._moduleManager.getModuleByType(ModuleNames.BOTS);
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
get messages() {
|
|
35
|
-
return this._moduleManager.
|
|
37
|
+
return this._moduleManager.getModuleByType(ModuleNames.MESSAGES);
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
get agents() {
|
|
39
|
-
return this._moduleManager.
|
|
41
|
+
return this._moduleManager.getModuleByType(ModuleNames.AGENTS);
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
get contacts() {
|
|
43
|
-
return this._moduleManager.
|
|
45
|
+
return this._moduleManager.getModuleByType(ModuleNames.CONTACTS);
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
get cannedMessages() {
|
|
47
|
-
return this._moduleManager.
|
|
49
|
+
return this._moduleManager.getModuleByType(ModuleNames.CANNED_MESSAGES);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
get templateMessages() {
|
|
51
|
-
return this._moduleManager.
|
|
53
|
+
return this._moduleManager.getModuleByType(ModuleNames.TEMPLATE_MESSAGES);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get public() {
|
|
57
|
+
return this._moduleManager.getModulesByType(ModuleTypes.PUBLIC);
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
hasModule(moduleName) {
|
|
@@ -65,6 +71,7 @@ export default class IMSDK {
|
|
|
65
71
|
contacts: this.contacts,
|
|
66
72
|
cannedMessages: this.cannedMessages,
|
|
67
73
|
templateMessages: this.templateMessages,
|
|
74
|
+
public: this.public,
|
|
68
75
|
hasModule: this.hasModule.bind(this)
|
|
69
76
|
};
|
|
70
77
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WhatsAppPricingService } from '../../../application/services';
|
|
2
|
+
import { WhatsAppPricingRepository } from '../../../infrastructure/repositories';
|
|
3
|
+
|
|
4
|
+
class WhatsAppPricingSDK {
|
|
5
|
+
constructor(_ref) {
|
|
6
|
+
let {
|
|
7
|
+
config
|
|
8
|
+
} = _ref;
|
|
9
|
+
const {
|
|
10
|
+
whatsAppPricingAPI
|
|
11
|
+
} = config;
|
|
12
|
+
const whatsAppPricingRepository = new WhatsAppPricingRepository({
|
|
13
|
+
whatsAppPricingAPI
|
|
14
|
+
}).toJSON();
|
|
15
|
+
const whatsAppPricingService = new WhatsAppPricingService({
|
|
16
|
+
whatsAppPricingRepository
|
|
17
|
+
}).toJSON();
|
|
18
|
+
this.services = { ...whatsAppPricingService
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
toJSON() {
|
|
23
|
+
return this.services;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default WhatsAppPricingSDK;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AdapterError } from '../../../core/errors';
|
|
2
|
-
import { CannedMessage
|
|
2
|
+
import { CannedMessage } from '../../../domain/entities';
|
|
3
3
|
import { IAdapter } from '../../../domain/interfaces';
|
|
4
4
|
export default class CannedMessageAdapter extends IAdapter {
|
|
5
5
|
adapt(cannedMessageData) {
|
|
@@ -8,7 +8,6 @@ export default class CannedMessageAdapter extends IAdapter {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
try {
|
|
11
|
-
const translations = Array.isArray(cannedMessageData.translations) ? cannedMessageData.translations.map(translation => new Translation(translation).toJSON()) : cannedMessageData.translations;
|
|
12
11
|
return new CannedMessage({
|
|
13
12
|
id: cannedMessageData.id,
|
|
14
13
|
title: cannedMessageData.title,
|
|
@@ -20,7 +19,7 @@ export default class CannedMessageAdapter extends IAdapter {
|
|
|
20
19
|
createdBy: cannedMessageData.createdBy,
|
|
21
20
|
isActive: cannedMessageData.isActive,
|
|
22
21
|
isPrivate: cannedMessageData.isPrivate,
|
|
23
|
-
translations,
|
|
22
|
+
translations: cannedMessageData.translations,
|
|
24
23
|
uuid: cannedMessageData.uuid,
|
|
25
24
|
meta: cannedMessageData.meta,
|
|
26
25
|
rejectedReason: cannedMessageData.rejectedReason,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AdapterError } from '../../../core/errors';
|
|
2
|
-
import { Placeholder } from '../../../domain/entities
|
|
2
|
+
import { Placeholder } from '../../../domain/entities';
|
|
3
3
|
import { IAdapter } from '../../../domain/interfaces';
|
|
4
4
|
export default class PlaceholderAdapter extends IAdapter {
|
|
5
5
|
adapt(placeholderData) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AdapterError } from '../../../core/errors';
|
|
2
|
+
import { TemplateTags } from '../../../domain/entities';
|
|
3
|
+
import { IAdapter } from '../../../domain/interfaces';
|
|
4
|
+
export default class TemplateTagsAdapter extends IAdapter {
|
|
5
|
+
adapt(templateTagsData) {
|
|
6
|
+
if (!templateTagsData) {
|
|
7
|
+
throw new AdapterError('templateTags data is required');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
return new TemplateTags({
|
|
12
|
+
tags: templateTagsData.tags
|
|
13
|
+
}).toJSON();
|
|
14
|
+
} catch (error) {
|
|
15
|
+
throw new AdapterError(`Failed to adapt TemplateTags: ${error.message}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import TemplateLanguageAdapter from './TemplateLanguageAdapter';
|
|
2
2
|
import TemplateCreditExhaustStatusAdapter from './TemplateCreditExhaustStatusAdapter';
|
|
3
|
-
|
|
3
|
+
import TemplateTagsAdapter from './TemplateTagsAdapter';
|
|
4
|
+
export { TemplateLanguageAdapter, TemplateCreditExhaustStatusAdapter, TemplateTagsAdapter };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AdapterError } from '../../../core/errors';
|
|
2
|
+
import { WhatsAppPricing } from '../../../domain/entities';
|
|
3
|
+
import { IAdapter } from '../../../domain/interfaces';
|
|
4
|
+
export default class WhatsAppPricingAdapter extends IAdapter {
|
|
5
|
+
adapt(whatsAppPricingData) {
|
|
6
|
+
if (!whatsAppPricingData) {
|
|
7
|
+
throw new AdapterError('whatsAppPricing data is required');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
return new WhatsAppPricing({
|
|
12
|
+
total: whatsAppPricingData.total,
|
|
13
|
+
creditsCount: whatsAppPricingData.creditsCount,
|
|
14
|
+
actutalCreditsAmount: whatsAppPricingData.actutalCreditsAmount,
|
|
15
|
+
category: whatsAppPricingData.category
|
|
16
|
+
}).toJSON();
|
|
17
|
+
} catch (error) {
|
|
18
|
+
throw new AdapterError(`Failed to adapt WhatsAppPricing: ${error.message}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResponseTypes } from '../../core/constants';
|
|
1
|
+
import { ModuleTypes, ResponseTypes } from '../../core/constants';
|
|
2
2
|
import { ResponseUtils } from '../../core/utils';
|
|
3
3
|
import configRegistry from '../config/configRegistry';
|
|
4
4
|
import { getRegistryConfig } from './registry';
|
|
@@ -7,18 +7,19 @@ export default class BaseAPI {
|
|
|
7
7
|
constructor() {
|
|
8
8
|
let {
|
|
9
9
|
module,
|
|
10
|
+
moduleType = ModuleTypes.AUTHENTICATED,
|
|
10
11
|
configProvider = configRegistry,
|
|
11
12
|
registryProvider = {
|
|
12
13
|
getRegistryConfig
|
|
13
14
|
},
|
|
14
|
-
urlBuilder
|
|
15
|
+
urlBuilder
|
|
15
16
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
17
|
this.configProvider = configProvider;
|
|
17
18
|
this.registryProvider = registryProvider;
|
|
18
|
-
this.httpClient = this.configProvider.getHttpClient();
|
|
19
|
+
this.httpClient = moduleType === ModuleTypes.PUBLIC ? this.configProvider.getPublicHttpClient() : this.configProvider.getHttpClient();
|
|
19
20
|
this.baseURL = this.configProvider.getBaseURL();
|
|
20
21
|
this.module = module;
|
|
21
|
-
this.urlBuilder = urlBuilder;
|
|
22
|
+
this.urlBuilder = urlBuilder || new UrlBuilder(this.baseURL);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
async request(_ref) {
|
|
@@ -4,7 +4,7 @@ import createAPIRegistry from '../createAPIRegistry';
|
|
|
4
4
|
import constructChannelEndPoint from './constructChannelEndPoint';
|
|
5
5
|
|
|
6
6
|
function getAgents() {
|
|
7
|
-
return createAPIRegistry(constructChannelEndPoint('/:channelId/
|
|
7
|
+
return createAPIRegistry(constructChannelEndPoint('/:channelId/users'), HTTP_METHODS.GET, getChannelAgentsRequest());
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export default {
|
|
@@ -7,6 +7,7 @@ import { agentAPIRegistry } from './agents';
|
|
|
7
7
|
import { contactAPIRegistry } from './contacts';
|
|
8
8
|
import { cannedMessageAPIRegistry } from './cannedMessages';
|
|
9
9
|
import { templateMessageAPIRegistry } from './templateMessages';
|
|
10
|
+
import { whatsAppPricingAPIRegistry } from './whatsAppPricing';
|
|
10
11
|
import { ModuleNames } from '../../../core/constants';
|
|
11
12
|
const APIRegistry = {
|
|
12
13
|
[ModuleNames.CHANNELS]: channelAPIRegistry,
|
|
@@ -16,7 +17,8 @@ const APIRegistry = {
|
|
|
16
17
|
[ModuleNames.AGENTS]: agentAPIRegistry,
|
|
17
18
|
[ModuleNames.CONTACTS]: contactAPIRegistry,
|
|
18
19
|
[ModuleNames.CANNED_MESSAGES]: cannedMessageAPIRegistry,
|
|
19
|
-
[ModuleNames.TEMPLATE_MESSAGES]: templateMessageAPIRegistry
|
|
20
|
+
[ModuleNames.TEMPLATE_MESSAGES]: templateMessageAPIRegistry,
|
|
21
|
+
[ModuleNames.WHATSAPP_PRICING]: whatsAppPricingAPIRegistry
|
|
20
22
|
};
|
|
21
23
|
export default function getRegistryConfig(module, operation) {
|
|
22
24
|
const moduleConfig = selectn(module, APIRegistry);
|
|
@@ -9,7 +9,7 @@ const MARK_AS_READ = `${SINGLE_SESSION_URL}/markAsRead`;
|
|
|
9
9
|
const PICKUP_SESSION = `${SINGLE_SESSION_URL}/pickup`;
|
|
10
10
|
|
|
11
11
|
function pickupSession() {
|
|
12
|
-
return createAPIRegistry(constructSessionEndPoint(PICKUP_SESSION), HTTP_METHODS.
|
|
12
|
+
return createAPIRegistry(constructSessionEndPoint(PICKUP_SESSION), HTTP_METHODS.PATCH, pickupSessionRequest());
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function updateAssignee() {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import createPublicBaseUrl from '../createPublicBaseUrl';
|
|
2
|
+
export default function constructWhatsAppPricingEndPoint(extra) {
|
|
3
|
+
const base = '/whatsAppPricing';
|
|
4
|
+
|
|
5
|
+
if (extra) {
|
|
6
|
+
return createPublicBaseUrl(base + extra);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return createPublicBaseUrl(base);
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTTP_METHODS } from '../../../../core/constants';
|
|
2
|
+
import { calculateWhatsAppPricingRequest } from '../../../../domain/dto';
|
|
3
|
+
import createAPIRegistry from '../createAPIRegistry';
|
|
4
|
+
import constructWhatsAppPricingEndPoint from './constructWhatsAppPricingEndPoint';
|
|
5
|
+
|
|
6
|
+
function calculateWhatsAppPricing() {
|
|
7
|
+
return createAPIRegistry(constructWhatsAppPricingEndPoint(), HTTP_METHODS.POST, calculateWhatsAppPricingRequest());
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const whatsAppPricingAPIRegistry = {
|
|
11
|
+
calculateWhatsAppPricing
|
|
12
|
+
};
|
|
13
|
+
export default whatsAppPricingAPIRegistry;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { calculateWhatsAppPricingRequest } from '../../../domain/dto';
|
|
2
|
+
import { IWhatsAppPricingRepository } from '../../../domain/interfaces/repositories';
|
|
3
|
+
export default class WhatsAppPricingAPI extends IWhatsAppPricingRepository {
|
|
4
|
+
async calculateWhatsAppPricing() {
|
|
5
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : calculateWhatsAppPricingRequest();
|
|
6
|
+
const operation = 'calculateWhatsAppPricing';
|
|
7
|
+
const httpRequest = await this.request({
|
|
8
|
+
request,
|
|
9
|
+
operation
|
|
10
|
+
});
|
|
11
|
+
return httpRequest;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -2,15 +2,18 @@ class ConfigRegistry {
|
|
|
2
2
|
constructor() {
|
|
3
3
|
this.baseURL = null;
|
|
4
4
|
this.httpClient = null;
|
|
5
|
+
this.publicHttpClient = null;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
setConfig(_ref) {
|
|
8
9
|
let {
|
|
9
10
|
baseURL,
|
|
10
|
-
httpClient
|
|
11
|
+
httpClient,
|
|
12
|
+
publicHttpClient
|
|
11
13
|
} = _ref;
|
|
12
14
|
this.baseURL = baseURL;
|
|
13
15
|
this.httpClient = httpClient;
|
|
16
|
+
this.publicHttpClient = publicHttpClient || null;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
getBaseURL() {
|
|
@@ -21,6 +24,10 @@ class ConfigRegistry {
|
|
|
21
24
|
return this.httpClient;
|
|
22
25
|
}
|
|
23
26
|
|
|
27
|
+
getPublicHttpClient() {
|
|
28
|
+
return this.publicHttpClient;
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
const configRegistry = new ConfigRegistry();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ITemplateMessageRepository } from '../../../domain/interfaces/repositories';
|
|
2
|
-
import { TemplateLanguageAdapter, TemplateCreditExhaustStatusAdapter } from '../../adapters';
|
|
2
|
+
import { TemplateLanguageAdapter, TemplateCreditExhaustStatusAdapter, TemplateTagsAdapter } from '../../adapters';
|
|
3
3
|
import { TemplateMessageAPI } from '../../api';
|
|
4
4
|
import { ResponseTypes } from '../../../core/constants';
|
|
5
5
|
export default class TemplateMessageRepository extends ITemplateMessageRepository {
|
|
@@ -7,7 +7,8 @@ export default class TemplateMessageRepository extends ITemplateMessageRepositor
|
|
|
7
7
|
let {
|
|
8
8
|
templateMessageAPI,
|
|
9
9
|
templateLanguageAdapter,
|
|
10
|
-
templateCreditExhaustStatusAdapter
|
|
10
|
+
templateCreditExhaustStatusAdapter,
|
|
11
|
+
templateTagsAdapter
|
|
11
12
|
} = _ref;
|
|
12
13
|
super();
|
|
13
14
|
this.defaultAPI = new TemplateMessageAPI();
|
|
@@ -15,6 +16,7 @@ export default class TemplateMessageRepository extends ITemplateMessageRepositor
|
|
|
15
16
|
this.templateMessageAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
|
|
16
17
|
this.templateLanguageAdapter = templateLanguageAdapter || new TemplateLanguageAdapter();
|
|
17
18
|
this.templateCreditExhaustStatusAdapter = templateCreditExhaustStatusAdapter || new TemplateCreditExhaustStatusAdapter();
|
|
19
|
+
this.templateTagsAdapter = templateTagsAdapter || new TemplateTagsAdapter();
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
async invokeTemplateLanguageAPI(_ref2) {
|
|
@@ -71,7 +73,8 @@ export default class TemplateMessageRepository extends ITemplateMessageRepositor
|
|
|
71
73
|
return this.invokeTemplateLanguageAPI({
|
|
72
74
|
operation: 'getTemplateTags',
|
|
73
75
|
request,
|
|
74
|
-
adapter:
|
|
76
|
+
adapter: this.templateTagsAdapter,
|
|
77
|
+
responseType: ResponseTypes.LIST
|
|
75
78
|
});
|
|
76
79
|
}
|
|
77
80
|
|
|
@@ -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
|
+
}
|