@zohoim/client-sdk 0.0.5 → 1.0.0-attachmentsList
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/application/services/cannedMessages/CannedMessageService.js +51 -0
- package/es/application/services/cannedMessages/index.js +2 -0
- package/es/application/services/index.js +3 -1
- package/es/application/services/templateMessages/TemplateMessageService.js +26 -0
- package/es/application/services/templateMessages/index.js +2 -0
- package/es/core/constants/ModuleNames.js +4 -1
- package/es/core/utils/validateSchema.js +60 -26
- package/es/domain/dto/cannedMessages/createCannedMessageRequest.js +18 -0
- package/es/domain/dto/cannedMessages/deleteCannedMessageRequest.js +13 -0
- package/es/domain/dto/cannedMessages/disableCannedMessageRequest.js +13 -0
- package/es/domain/dto/cannedMessages/enableCannedMessageRequest.js +13 -0
- package/es/domain/dto/cannedMessages/getCannedMessageRequest.js +13 -0
- package/es/domain/dto/cannedMessages/getCannedMessagesRequest.js +18 -0
- package/es/domain/dto/cannedMessages/index.js +7 -0
- package/es/domain/dto/cannedMessages/updateCannedMessageRequest.js +20 -0
- package/es/domain/dto/index.js +3 -1
- package/es/domain/dto/messages/initiateSessionRequest.js +2 -0
- package/es/domain/dto/sessions/getSessionAttachmentsRequest.js +2 -0
- package/es/domain/dto/sessions/getSessionsRequest.js +1 -0
- package/es/domain/dto/templateMessages/getTemplateCreditExhaustStatusRequest.js +13 -0
- package/es/domain/dto/templateMessages/getTemplateLanguagesRequest.js +7 -0
- package/es/domain/dto/templateMessages/index.js +2 -0
- package/es/domain/entities/Actor/Actor.js +5 -1
- package/es/domain/entities/Agent/Agent.js +5 -1
- package/es/domain/entities/Attachment/Attachment.js +5 -1
- package/es/domain/entities/Bot/Bot.js +5 -1
- package/es/domain/entities/CannedMessage/CannedMessage.js +58 -0
- package/es/domain/entities/CannedMessage/index.js +2 -0
- package/es/domain/entities/Channel/Channel.js +5 -1
- package/es/domain/entities/Contact/Contact.js +5 -1
- package/es/domain/entities/CustomReplyExtension/CustomReplyExtension.js +26 -0
- package/es/domain/entities/CustomReplyExtension/index.js +2 -0
- package/es/domain/entities/IntegrationService/IntegrationService.js +5 -1
- package/es/domain/entities/Message/Action.js +5 -1
- package/es/domain/entities/Message/ExternalInfo.js +5 -1
- package/es/domain/entities/Message/Info.js +5 -1
- package/es/domain/entities/Message/InfoTarget.js +5 -1
- package/es/domain/entities/Message/Location.js +5 -1
- package/es/domain/entities/Message/Message.js +25 -2
- package/es/domain/entities/Message/MessageWithSession.js +5 -1
- package/es/domain/entities/Session/Session.js +5 -1
- package/es/domain/entities/TemplateMessage/TemplateCreditExhaustStatus.js +27 -0
- package/es/domain/entities/TemplateMessage/TemplateLanguage.js +22 -0
- package/es/domain/entities/TemplateMessage/index.js +3 -0
- package/es/domain/entities/index.js +4 -1
- package/es/domain/enum/cannedMessage/CannedMessageStatus.js +7 -0
- package/es/domain/enum/cannedMessage/CannedMessageType.js +5 -0
- package/es/domain/enum/cannedMessage/TemplateItemButtonType.js +6 -0
- package/es/domain/enum/cannedMessage/TemplateItemFooterType.js +4 -0
- package/es/domain/enum/cannedMessage/TemplateItemHeaderType.js +7 -0
- package/es/domain/enum/cannedMessage/index.js +6 -0
- package/es/domain/enum/index.js +3 -1
- package/es/domain/enum/message/MessageMeta.js +2 -1
- package/es/domain/enum/message/MetaMessageSourceType.js +6 -0
- package/es/domain/enum/message/index.js +2 -1
- package/es/domain/enum/session/SessionReplyStatus.js +4 -1
- package/es/domain/enum/templateMessage/TemplateCreditExhaustStatusCode.js +4 -0
- package/es/domain/enum/templateMessage/index.js +2 -0
- package/es/domain/interfaces/repositories/cannedMessages/ICannedMessageRepository.js +47 -0
- package/es/domain/interfaces/repositories/cannedMessages/index.js +2 -0
- package/es/domain/interfaces/repositories/index.js +3 -1
- package/es/domain/interfaces/repositories/templateMessages/ITemplateMessageRepository.js +21 -0
- package/es/domain/interfaces/repositories/templateMessages/index.js +2 -0
- package/es/domain/schema/cannedMessage/CannedMessageSchema.js +65 -0
- package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemButtonsSchema.js +17 -0
- package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemFooterSchema.js +13 -0
- package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemHeaderSchema.js +19 -0
- package/es/domain/schema/cannedMessage/TemplateItem/index.js +4 -0
- package/es/domain/schema/cannedMessage/TemplateItemsSchema.js +21 -0
- package/es/domain/schema/cannedMessage/TranslationsSchema.js +43 -0
- package/es/domain/schema/cannedMessage/index.js +2 -0
- package/es/domain/schema/customReplyExtension/CustomReplyExtensionSchema.js +28 -0
- package/es/domain/schema/customReplyExtension/index.js +2 -0
- package/es/domain/schema/index.js +4 -1
- package/es/domain/schema/templateMessage/TemplateCreditExhaustStatusSchema.js +11 -0
- package/es/domain/schema/templateMessage/TemplateLanguageSchema.js +11 -0
- package/es/domain/schema/templateMessage/index.js +3 -0
- package/es/frameworks/managers/ModuleFactory.js +18 -0
- package/es/frameworks/managers/ModuleManager.js +1 -1
- package/es/frameworks/sdk/IMSDK.js +10 -0
- package/es/frameworks/sdk/cannedMessages/CannedMessageSDK.js +30 -0
- package/es/frameworks/sdk/cannedMessages/index.js +2 -0
- package/es/frameworks/sdk/templateMessages/TemplateMessageSDK.js +30 -0
- package/es/frameworks/sdk/templateMessages/index.js +2 -0
- package/es/infrastructure/adapters/cannedMessages/CannedMessageAdapter.js +34 -0
- package/es/infrastructure/adapters/cannedMessages/index.js +2 -0
- package/es/infrastructure/adapters/customReplyExtension/CustomReplyExtensionAdapter.js +24 -0
- package/es/infrastructure/adapters/customReplyExtension/index.js +2 -0
- package/es/infrastructure/adapters/index.js +4 -1
- package/es/infrastructure/adapters/messages/MessageAdapter.js +5 -1
- package/es/infrastructure/adapters/templateMessages/TemplateCreditExhaustStatusAdapter.js +20 -0
- package/es/infrastructure/adapters/templateMessages/TemplateLanguageAdapter.js +20 -0
- package/es/infrastructure/adapters/templateMessages/index.js +3 -0
- package/es/infrastructure/api/cannedMessages/CannedMessageAPI.js +74 -0
- package/es/infrastructure/api/cannedMessages/index.js +2 -0
- package/es/infrastructure/api/index.js +3 -1
- package/es/infrastructure/api/registry/cannedMessages/cannedMessageAPIRegistry.js +42 -0
- package/es/infrastructure/api/registry/cannedMessages/constructCannedMessageEndPoint.js +10 -0
- package/es/infrastructure/api/registry/cannedMessages/index.js +2 -0
- package/es/infrastructure/api/registry/getRegistryConfig.js +5 -1
- package/es/infrastructure/api/registry/templateMessages/constructTemplateMessageEndPoint.js +11 -0
- package/es/infrastructure/api/registry/templateMessages/index.js +2 -0
- package/es/infrastructure/api/registry/templateMessages/templateMessageAPIRegistry.js +18 -0
- package/es/infrastructure/api/templateMessages/TemplateMessageAPI.js +24 -0
- package/es/infrastructure/api/templateMessages/index.js +2 -0
- package/es/infrastructure/repositories/cannedMessages/CannedMessageRepository.js +97 -0
- package/es/infrastructure/repositories/cannedMessages/index.js +2 -0
- package/es/infrastructure/repositories/index.js +3 -1
- package/es/infrastructure/repositories/templateMessages/TemplateMessageRepository.js +77 -0
- package/es/infrastructure/repositories/templateMessages/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ICannedMessageRepository } from '../../../domain/interfaces/repositories';
|
|
2
|
+
export default class CannedMessageService extends ICannedMessageRepository {
|
|
3
|
+
constructor(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
cannedMessageRepository
|
|
6
|
+
} = _ref;
|
|
7
|
+
super();
|
|
8
|
+
this.cannedMessageRepository = cannedMessageRepository;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async getCannedMessages(request) {
|
|
12
|
+
return this.cannedMessageRepository.getCannedMessages(request);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async getCannedMessage(request) {
|
|
16
|
+
return this.cannedMessageRepository.getCannedMessage(request);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async createCannedMessage(request) {
|
|
20
|
+
return this.cannedMessageRepository.createCannedMessage(request);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async deleteCannedMessage(request) {
|
|
24
|
+
return this.cannedMessageRepository.deleteCannedMessage(request);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async updateCannedMessage(request) {
|
|
28
|
+
return this.cannedMessageRepository.updateCannedMessage(request);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async enableCannedMessage(request) {
|
|
32
|
+
return this.cannedMessageRepository.enableCannedMessage(request);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async disableCannedMessage(request) {
|
|
36
|
+
return this.cannedMessageRepository.disableCannedMessage(request);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
toJSON() {
|
|
40
|
+
return {
|
|
41
|
+
getCannedMessages: this.getCannedMessages.bind(this),
|
|
42
|
+
getCannedMessage: this.getCannedMessage.bind(this),
|
|
43
|
+
createCannedMessage: this.createCannedMessage.bind(this),
|
|
44
|
+
deleteCannedMessage: this.deleteCannedMessage.bind(this),
|
|
45
|
+
updateCannedMessage: this.updateCannedMessage.bind(this),
|
|
46
|
+
enableCannedMessage: this.enableCannedMessage.bind(this),
|
|
47
|
+
disableCannedMessage: this.disableCannedMessage.bind(this)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ITemplateMessageRepository } from '../../../domain/interfaces/repositories';
|
|
2
|
+
export default class TemplateMessageService extends ITemplateMessageRepository {
|
|
3
|
+
constructor(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
templateMessageRepository
|
|
6
|
+
} = _ref;
|
|
7
|
+
super();
|
|
8
|
+
this.templateMessageRepository = templateMessageRepository;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async getTemplateLanguages(request) {
|
|
12
|
+
return this.templateMessageRepository.getTemplateLanguages(request);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async getWhatsAppTemplateCreditExhaustStatus(request) {
|
|
16
|
+
return this.templateMessageRepository.getWhatsAppTemplateCreditExhaustStatus(request);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
toJSON() {
|
|
20
|
+
return {
|
|
21
|
+
getTemplateLanguages: this.getTemplateLanguages.bind(this),
|
|
22
|
+
getWhatsAppTemplateCreditExhaustStatus: this.getWhatsAppTemplateCreditExhaustStatus.bind(this)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
@@ -4,6 +4,9 @@ const ModuleNames = {
|
|
|
4
4
|
BOTS: 'bots',
|
|
5
5
|
MESSAGES: 'messages',
|
|
6
6
|
CONTACTS: 'contacts',
|
|
7
|
-
AGENTS: 'agents'
|
|
7
|
+
AGENTS: 'agents',
|
|
8
|
+
CANNED_MESSAGES: 'cannedMessages',
|
|
9
|
+
TEMPLATE_MESSAGES: 'templateMessages',
|
|
10
|
+
CUSTOM_REPLY_EXTENSIONS: 'articles'
|
|
8
11
|
};
|
|
9
12
|
export default ModuleNames;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
function validateSchemaKeys(_ref) {
|
|
2
|
+
let {
|
|
3
|
+
schema = {},
|
|
4
|
+
data = {},
|
|
5
|
+
entityName = ''
|
|
6
|
+
} = _ref;
|
|
7
|
+
Object.keys(schema).forEach(key => {
|
|
8
|
+
if (!(key in data)) {
|
|
9
|
+
console.warn(`${entityName} - Key '${key}' is missing in the data`);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
function isEmpty(value) {
|
|
10
15
|
if (value === null || value === undefined || value === '') {
|
|
@@ -14,44 +19,63 @@ function isEmpty(value) {
|
|
|
14
19
|
return false;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
function validateRequiredCheck(
|
|
22
|
+
function validateRequiredCheck(_ref2) {
|
|
18
23
|
let {
|
|
19
24
|
value,
|
|
20
25
|
rules,
|
|
21
|
-
path
|
|
22
|
-
|
|
26
|
+
path,
|
|
27
|
+
entityName
|
|
28
|
+
} = _ref2;
|
|
23
29
|
|
|
24
30
|
if (rules.required && isEmpty(value)) {
|
|
25
|
-
|
|
31
|
+
console.warn(`${entityName} - ${path} is required`);
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
|
|
29
|
-
function validateEnumCheck(
|
|
35
|
+
function validateEnumCheck(_ref3) {
|
|
30
36
|
let {
|
|
31
37
|
value,
|
|
32
38
|
rules,
|
|
33
|
-
path
|
|
34
|
-
|
|
39
|
+
path,
|
|
40
|
+
entityName
|
|
41
|
+
} = _ref3;
|
|
35
42
|
|
|
36
43
|
if (rules.enum && !rules.enum.includes(value)) {
|
|
37
|
-
|
|
44
|
+
console.warn(`${entityName} - ${path} must be one of: ${rules.enum.join(', ')}. Received: ${value}`);
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
47
|
|
|
41
|
-
export const validateSchema =
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
export const validateSchema = _ref4 => {
|
|
49
|
+
let {
|
|
50
|
+
schema,
|
|
51
|
+
data,
|
|
52
|
+
entityName = ''
|
|
53
|
+
} = _ref4;
|
|
54
|
+
|
|
55
|
+
const validate = _ref5 => {
|
|
56
|
+
let {
|
|
57
|
+
schema: schemaObj,
|
|
58
|
+
data: dataObj,
|
|
59
|
+
path = '',
|
|
60
|
+
entityName
|
|
61
|
+
} = _ref5;
|
|
44
62
|
// Check if all schema keys exist in data
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
63
|
+
validateSchemaKeys({
|
|
64
|
+
schema: schemaObj,
|
|
65
|
+
data: dataObj,
|
|
66
|
+
entityName,
|
|
67
|
+
path
|
|
68
|
+
}); // Validate each field
|
|
69
|
+
|
|
70
|
+
Object.entries(schemaObj).forEach(_ref6 => {
|
|
71
|
+
let [field, rules] = _ref6;
|
|
49
72
|
const value = dataObj[field];
|
|
50
73
|
const fieldPath = path ? `${path}.${field}` : field;
|
|
51
74
|
validateRequiredCheck({
|
|
52
75
|
value,
|
|
53
76
|
rules,
|
|
54
|
-
path: fieldPath
|
|
77
|
+
path: fieldPath,
|
|
78
|
+
entityName
|
|
55
79
|
});
|
|
56
80
|
|
|
57
81
|
if (value !== null && value !== undefined) {
|
|
@@ -59,16 +83,26 @@ export const validateSchema = (schema, data) => {
|
|
|
59
83
|
validateEnumCheck({
|
|
60
84
|
value,
|
|
61
85
|
rules,
|
|
62
|
-
path: fieldPath
|
|
86
|
+
path: fieldPath,
|
|
87
|
+
entityName
|
|
63
88
|
}); // Nested object validation
|
|
64
89
|
|
|
65
90
|
if (rules.type === 'object' && rules.schema) {
|
|
66
|
-
validate(
|
|
91
|
+
validate({
|
|
92
|
+
schema: rules.schema,
|
|
93
|
+
data: value,
|
|
94
|
+
path: fieldPath,
|
|
95
|
+
entityName
|
|
96
|
+
});
|
|
67
97
|
}
|
|
68
98
|
}
|
|
69
99
|
});
|
|
70
100
|
return dataObj;
|
|
71
101
|
};
|
|
72
102
|
|
|
73
|
-
return validate(
|
|
103
|
+
return validate({
|
|
104
|
+
schema,
|
|
105
|
+
data,
|
|
106
|
+
entityName
|
|
107
|
+
});
|
|
74
108
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function createCannedMessageRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {},
|
|
6
|
+
body = {}
|
|
7
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
|
+
return new RequestBuilder().withParams({ ...params
|
|
9
|
+
}).withBody({
|
|
10
|
+
title: null,
|
|
11
|
+
message: null,
|
|
12
|
+
tags: null,
|
|
13
|
+
type: null,
|
|
14
|
+
...body
|
|
15
|
+
}).build();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default createCannedMessageRequest;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function deleteCannedMessageRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {}
|
|
6
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
return new RequestBuilder().withParams({
|
|
8
|
+
cannedMessageId: null,
|
|
9
|
+
...params
|
|
10
|
+
}).build();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default deleteCannedMessageRequest;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function disableCannedMessageRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {}
|
|
6
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
return new RequestBuilder().withParams({
|
|
8
|
+
cannedMessageId: null,
|
|
9
|
+
...params
|
|
10
|
+
}).build();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default disableCannedMessageRequest;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function enableCannedMessageRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {}
|
|
6
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
return new RequestBuilder().withParams({
|
|
8
|
+
cannedMessageId: null,
|
|
9
|
+
...params
|
|
10
|
+
}).build();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default enableCannedMessageRequest;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function getCannedMessageRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {}
|
|
6
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
return new RequestBuilder().withParams({
|
|
8
|
+
cannedMessageId: null,
|
|
9
|
+
...params
|
|
10
|
+
}).build();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default getCannedMessageRequest;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function getCannedMessagesRequest() {
|
|
4
|
+
let {
|
|
5
|
+
query = {},
|
|
6
|
+
params = {}
|
|
7
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
|
+
return new RequestBuilder().withParams({ ...params
|
|
9
|
+
}).withQuery({
|
|
10
|
+
from: 0,
|
|
11
|
+
limit: 10,
|
|
12
|
+
modifiedAfter: null,
|
|
13
|
+
type: null,
|
|
14
|
+
...query
|
|
15
|
+
}).build();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default getCannedMessagesRequest;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as getCannedMessagesRequest } from './getCannedMessagesRequest';
|
|
2
|
+
export { default as getCannedMessageRequest } from './getCannedMessageRequest';
|
|
3
|
+
export { default as deleteCannedMessageRequest } from './deleteCannedMessageRequest';
|
|
4
|
+
export { default as createCannedMessageRequest } from './createCannedMessageRequest';
|
|
5
|
+
export { default as enableCannedMessageRequest } from './enableCannedMessageRequest';
|
|
6
|
+
export { default as disableCannedMessageRequest } from './disableCannedMessageRequest';
|
|
7
|
+
export { default as updateCannedMessageRequest } from './updateCannedMessageRequest';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function updateCannedMessageRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {},
|
|
6
|
+
body = {}
|
|
7
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
|
+
return new RequestBuilder().withParams({
|
|
9
|
+
cannedMessageId: null,
|
|
10
|
+
...params
|
|
11
|
+
}).withBody({
|
|
12
|
+
title: null,
|
|
13
|
+
message: null,
|
|
14
|
+
tags: null,
|
|
15
|
+
type: null,
|
|
16
|
+
...body
|
|
17
|
+
}).build();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default updateCannedMessageRequest;
|
package/es/domain/dto/index.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import RequestBuilder from '../RequestBuilder';
|
|
2
|
+
|
|
3
|
+
function getTemplateCreditExhaustStatusRequest() {
|
|
4
|
+
let {
|
|
5
|
+
params = {}
|
|
6
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
return new RequestBuilder().withParams({ ...params,
|
|
8
|
+
channelId: null,
|
|
9
|
+
receiverId: null
|
|
10
|
+
}).build();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default getTemplateCreditExhaustStatusRequest;
|
|
@@ -4,7 +4,11 @@ import { ActorSchema } from '../../schema';
|
|
|
4
4
|
export default class Actor {
|
|
5
5
|
constructor() {
|
|
6
6
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
-
const validatedData = validateSchema(
|
|
7
|
+
const validatedData = validateSchema({
|
|
8
|
+
schema: ActorSchema,
|
|
9
|
+
data,
|
|
10
|
+
entityName: 'Actor'
|
|
11
|
+
});
|
|
8
12
|
this.data = {
|
|
9
13
|
name: validatedData.name,
|
|
10
14
|
type: validatedData.type,
|
|
@@ -3,7 +3,11 @@ import { AgentSchema } from '../../schema';
|
|
|
3
3
|
export default class Agent {
|
|
4
4
|
constructor() {
|
|
5
5
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
-
const validatedData = validateSchema(
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: AgentSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'Agent'
|
|
10
|
+
});
|
|
7
11
|
this.data = {
|
|
8
12
|
id: validatedData.id,
|
|
9
13
|
firstName: validatedData.firstName,
|
|
@@ -3,7 +3,11 @@ import { AttachmentSchema } from '../../schema';
|
|
|
3
3
|
export default class Attachment {
|
|
4
4
|
constructor() {
|
|
5
5
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
-
const validatedData = validateSchema(
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: AttachmentSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'Attachment'
|
|
10
|
+
});
|
|
7
11
|
this.data = {
|
|
8
12
|
id: validatedData.id,
|
|
9
13
|
name: validatedData.name,
|
|
@@ -3,7 +3,11 @@ import { BotSchema } from '../../schema';
|
|
|
3
3
|
export default class Bot {
|
|
4
4
|
constructor() {
|
|
5
5
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
-
const validatedData = validateSchema(
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: BotSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'Bot'
|
|
10
|
+
});
|
|
7
11
|
this.data = {
|
|
8
12
|
id: validatedData.id,
|
|
9
13
|
botServiceType: validatedData.botServiceType,
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { validateSchema } from '../../../core/utils';
|
|
2
|
+
import { CannedMessageStatus } from '../../enum';
|
|
3
|
+
import { CannedMessageSchema } from '../../schema';
|
|
4
|
+
import { Actor } from '../Actor';
|
|
5
|
+
export default class CannedMessage {
|
|
6
|
+
constructor() {
|
|
7
|
+
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
|
+
const validatedData = validateSchema({
|
|
9
|
+
schema: CannedMessageSchema,
|
|
10
|
+
data,
|
|
11
|
+
entityName: 'CannedMessage'
|
|
12
|
+
});
|
|
13
|
+
let {
|
|
14
|
+
createdBy
|
|
15
|
+
} = validatedData;
|
|
16
|
+
|
|
17
|
+
if (createdBy && typeof createdBy === 'object' && !Array.isArray(createdBy)) {
|
|
18
|
+
createdBy = new Actor(createdBy);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
this.data = {
|
|
22
|
+
id: validatedData.id,
|
|
23
|
+
title: validatedData.title,
|
|
24
|
+
message: validatedData.message,
|
|
25
|
+
tags: validatedData.tags,
|
|
26
|
+
status: validatedData.status,
|
|
27
|
+
uuid: validatedData.uuid,
|
|
28
|
+
createdBy,
|
|
29
|
+
displayMessage: validatedData.displayMessage,
|
|
30
|
+
type: validatedData.type,
|
|
31
|
+
isActive: validatedData.isActive,
|
|
32
|
+
meta: validatedData.meta,
|
|
33
|
+
isPrivate: validatedData.isPrivate,
|
|
34
|
+
rejectionReason: validatedData.rejectionReason,
|
|
35
|
+
modifiedTime: validatedData.modifiedTime,
|
|
36
|
+
translations: validatedData.translations,
|
|
37
|
+
parameters: validatedData.parameters
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static isApproved(status) {
|
|
42
|
+
return status === CannedMessageStatus.APPROVED;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static isRejected(status) {
|
|
46
|
+
return status === CannedMessageStatus.REJECTED;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static isPending(status) {
|
|
50
|
+
return status === CannedMessageStatus.PENDING;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
toJSON() {
|
|
54
|
+
return { ...this.data
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
}
|
|
@@ -3,7 +3,11 @@ import { ChannelSchema } from '../../schema';
|
|
|
3
3
|
export default class Channel {
|
|
4
4
|
constructor() {
|
|
5
5
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
-
const validatedData = validateSchema(
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: ChannelSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'Channel'
|
|
10
|
+
}); // Set required properties from schema
|
|
7
11
|
|
|
8
12
|
this.id = validatedData.id;
|
|
9
13
|
this.integrationService = validatedData.integrationService;
|
|
@@ -3,7 +3,11 @@ import { ContactSchema } from '../../schema';
|
|
|
3
3
|
export default class Contact {
|
|
4
4
|
constructor() {
|
|
5
5
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
-
const validatedData = validateSchema(
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: ContactSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'Contact'
|
|
10
|
+
});
|
|
7
11
|
this.data = {
|
|
8
12
|
id: validatedData.id,
|
|
9
13
|
name: validatedData.name,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { validateSchema } from '../../../core/utils';
|
|
2
|
+
import { CustomReplyExtensionSchema } from '../../schema';
|
|
3
|
+
export default class CustomReplyExtension {
|
|
4
|
+
constructor() {
|
|
5
|
+
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: CustomReplyExtensionSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'CustomReplyExtension'
|
|
10
|
+
});
|
|
11
|
+
this.data = {
|
|
12
|
+
id: validatedData.id,
|
|
13
|
+
title: validatedData.title,
|
|
14
|
+
message: validatedData.message,
|
|
15
|
+
displayMessage: validatedData.displayMessage,
|
|
16
|
+
webUrl: validatedData.webUrl || null,
|
|
17
|
+
categoryName: validatedData.categoryName
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
toJSON() {
|
|
22
|
+
return { ...this.data
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
@@ -4,7 +4,11 @@ import { IntegrationServiceSchema } from '../../schema';
|
|
|
4
4
|
export default class IntegrationService {
|
|
5
5
|
constructor() {
|
|
6
6
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
-
const validatedData = validateSchema(
|
|
7
|
+
const validatedData = validateSchema({
|
|
8
|
+
schema: IntegrationServiceSchema,
|
|
9
|
+
data,
|
|
10
|
+
entityName: 'IntegrationService'
|
|
11
|
+
});
|
|
8
12
|
this.data = {
|
|
9
13
|
label: validatedData.label || '',
|
|
10
14
|
id: validatedData.id || '',
|
|
@@ -4,7 +4,11 @@ import { ActionSchema } from '../../schema';
|
|
|
4
4
|
export default class Action {
|
|
5
5
|
constructor() {
|
|
6
6
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
-
const validatedData = validateSchema(
|
|
7
|
+
const validatedData = validateSchema({
|
|
8
|
+
schema: ActionSchema,
|
|
9
|
+
data,
|
|
10
|
+
entityName: 'Action'
|
|
11
|
+
});
|
|
8
12
|
this.data = {
|
|
9
13
|
type: validatedData.type,
|
|
10
14
|
subType: validatedData.subType,
|
|
@@ -4,7 +4,11 @@ import { ExternalInfoSchema } from '../../schema';
|
|
|
4
4
|
export default class ExternalInfo {
|
|
5
5
|
constructor() {
|
|
6
6
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
-
const validatedData = validateSchema(
|
|
7
|
+
const validatedData = validateSchema({
|
|
8
|
+
schema: ExternalInfoSchema,
|
|
9
|
+
data,
|
|
10
|
+
entityName: 'ExternalInfo'
|
|
11
|
+
});
|
|
8
12
|
this.data = {
|
|
9
13
|
action: validatedData.action
|
|
10
14
|
};
|