@zohoim/client-sdk 0.0.5 → 0.0.6
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/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
|
@@ -3,7 +3,11 @@ import { InfoTargetSchema } from '../../schema/message';
|
|
|
3
3
|
export default class InfoTarget {
|
|
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: InfoTargetSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'InfoTarget'
|
|
10
|
+
});
|
|
7
11
|
this.data = {
|
|
8
12
|
id: validatedData.id,
|
|
9
13
|
name: validatedData.name || null,
|
|
@@ -3,7 +3,11 @@ import { LocationSchema } from '../../schema';
|
|
|
3
3
|
export default class Location {
|
|
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: LocationSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'Location'
|
|
10
|
+
});
|
|
7
11
|
this.data = {
|
|
8
12
|
latitude: validatedData.latitude,
|
|
9
13
|
longitude: validatedData.longitude
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { validateSchema } from '../../../core/utils';
|
|
2
|
-
import { MessageDirection, MessageStatus, MessageTypes, MessageMeta, MetaSystemMessageType } from '../../enum';
|
|
2
|
+
import { MessageDirection, MessageStatus, MessageTypes, MessageMeta, MetaSystemMessageType, MetaMessageSourceType } from '../../enum';
|
|
3
3
|
import { MessageSchema } from '../../schema';
|
|
4
4
|
import { Actor } from '../Actor';
|
|
5
5
|
import { Attachment } from '../Attachment';
|
|
@@ -10,7 +10,11 @@ import Location from './Location';
|
|
|
10
10
|
export default class Message {
|
|
11
11
|
constructor() {
|
|
12
12
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13
|
-
const validatedData = validateSchema(
|
|
13
|
+
const validatedData = validateSchema({
|
|
14
|
+
schema: MessageSchema,
|
|
15
|
+
data,
|
|
16
|
+
entityName: 'Message'
|
|
17
|
+
});
|
|
14
18
|
this.data = {
|
|
15
19
|
id: validatedData.id,
|
|
16
20
|
sessionId: validatedData.sessionId,
|
|
@@ -121,6 +125,25 @@ export default class Message {
|
|
|
121
125
|
return messageType === MetaSystemMessageType.UN_SUPPORTED_FILE;
|
|
122
126
|
}
|
|
123
127
|
|
|
128
|
+
static getMessageSourceValue(meta) {
|
|
129
|
+
return Message.getMetaValue(meta, MessageMeta.MESSAGE_SOURCE);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static isHistoryMessage(meta) {
|
|
133
|
+
const messageType = Message.getMessageSourceValue(meta);
|
|
134
|
+
return messageType === MetaMessageSourceType.HISTORY_MESSAGE;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
static isHistoryMessageViaMobileWBApp(meta) {
|
|
138
|
+
const messageType = Message.getMessageSourceValue(meta);
|
|
139
|
+
return messageType === MetaMessageSourceType.HISTORY_MESSAGE_VIA_MOBILE_WHATSAPP_BUSINESS_APP;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
static isMessageViaMobileWBApp(meta) {
|
|
143
|
+
const messageType = Message.getMessageSourceValue(meta);
|
|
144
|
+
return messageType === MetaMessageSourceType.VIA_MOBILE_WHATSAPP_BUSINESS_APP;
|
|
145
|
+
}
|
|
146
|
+
|
|
124
147
|
static isFailed(status) {
|
|
125
148
|
return status === MessageStatus.FAILED;
|
|
126
149
|
}
|
|
@@ -5,7 +5,11 @@ import Message from './Message';
|
|
|
5
5
|
export default class MessageWithSession {
|
|
6
6
|
constructor() {
|
|
7
7
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
|
-
const validatedData = validateSchema(
|
|
8
|
+
const validatedData = validateSchema({
|
|
9
|
+
schema: MessageWithSessionSchema,
|
|
10
|
+
data,
|
|
11
|
+
entityName: 'MessageWithSession'
|
|
12
|
+
});
|
|
9
13
|
const messageData = new Message(validatedData).toJSON();
|
|
10
14
|
const sessionData = new Session(validatedData.session).toJSON();
|
|
11
15
|
this.data = { ...messageData,
|
|
@@ -5,7 +5,11 @@ import { SessionReplyStatus, SessionStatus } from '../../enum';
|
|
|
5
5
|
export default class Session {
|
|
6
6
|
constructor() {
|
|
7
7
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
|
-
const validatedData = validateSchema(
|
|
8
|
+
const validatedData = validateSchema({
|
|
9
|
+
schema: SessionSchema,
|
|
10
|
+
data,
|
|
11
|
+
entityName: 'Session'
|
|
12
|
+
});
|
|
9
13
|
this.data = {
|
|
10
14
|
channelId: validatedData.channelId,
|
|
11
15
|
status: validatedData.status,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { validateSchema } from '../../../core/utils';
|
|
2
|
+
import { TemplateCreditExhaustStatusCode } from '../../enum';
|
|
3
|
+
import { TemplateCreditExhaustStatusSchema } from '../../schema';
|
|
4
|
+
export default class TemplateCreditExhaustStatus {
|
|
5
|
+
constructor() {
|
|
6
|
+
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
+
const validatedData = validateSchema({
|
|
8
|
+
schema: TemplateCreditExhaustStatusSchema,
|
|
9
|
+
data,
|
|
10
|
+
entityName: 'TemplateCreditExhaustStatus'
|
|
11
|
+
});
|
|
12
|
+
this.data = {
|
|
13
|
+
code: validatedData.code,
|
|
14
|
+
message: validatedData.message
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static isInSufficientCredits(code) {
|
|
19
|
+
return code === TemplateCreditExhaustStatusCode.INSUFFICIENT_CREDITS;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
toJSON() {
|
|
23
|
+
return { ...this.data
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { validateSchema } from '../../../core/utils';
|
|
2
|
+
import { TemplateLanguageSchema } from '../../schema';
|
|
3
|
+
export default class TemplateLanguage {
|
|
4
|
+
constructor() {
|
|
5
|
+
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
+
const validatedData = validateSchema({
|
|
7
|
+
schema: TemplateLanguageSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'TemplateLanguage'
|
|
10
|
+
});
|
|
11
|
+
this.data = {
|
|
12
|
+
code: validatedData.code,
|
|
13
|
+
language: validatedData.language
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
toJSON() {
|
|
18
|
+
return { ...this.data
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -6,4 +6,7 @@ export * from './Attachment';
|
|
|
6
6
|
export * from './Message';
|
|
7
7
|
export * from './Channel';
|
|
8
8
|
export * from './Contact';
|
|
9
|
-
export * from './IntegrationService';
|
|
9
|
+
export * from './IntegrationService';
|
|
10
|
+
export * from './CannedMessage';
|
|
11
|
+
export * from './TemplateMessage';
|
|
12
|
+
export * from './CustomReplyExtension';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import CannedMessageStatus from './CannedMessageStatus';
|
|
2
|
+
import CannedMessageType from './CannedMessageType';
|
|
3
|
+
import TemplateItemHeaderType from './TemplateItemHeaderType';
|
|
4
|
+
import TemplateItemFooterType from './TemplateItemFooterType';
|
|
5
|
+
import TemplateItemButtonType from './TemplateItemButtonType';
|
|
6
|
+
export { CannedMessageStatus, CannedMessageType, TemplateItemHeaderType, TemplateItemFooterType, TemplateItemButtonType };
|
package/es/domain/enum/index.js
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const MetaMessageSourceType = {
|
|
2
|
+
HISTORY_MESSAGE_VIA_MOBILE_WHATSAPP_BUSINESS_APP: 'HISTORY_MESSAGE_VIA_MOBILE_WHATSAPP_BUSINESS_APP',
|
|
3
|
+
HISTORY_MESSAGE: 'HISTORY_MESSAGE',
|
|
4
|
+
VIA_MOBILE_WHATSAPP_BUSINESS_APP: 'VIA_MOBILE_WHATSAPP_BUSINESS_APP'
|
|
5
|
+
};
|
|
6
|
+
export default MetaMessageSourceType;
|
|
@@ -10,4 +10,5 @@ import InfoAction from './InfoAction';
|
|
|
10
10
|
import ActionSubType from './ActionSubType';
|
|
11
11
|
import InfoTargetType from './InfoTargetType';
|
|
12
12
|
import MetaSystemMessageType from './MetaSystemMessageType';
|
|
13
|
-
|
|
13
|
+
import MetaMessageSourceType from './MetaMessageSourceType';
|
|
14
|
+
export { MessageTypes, MessageStatus, MessageDirection, MessageContentType, MessageMeta, ActionType, ActionSubType, ExternalInfoAction, InfoSessionStatus, InfoAction, InfoTargetType, MetaSystemMessageType, MetaMessageSourceType };
|
|
@@ -16,6 +16,9 @@ const SessionReplyStatus = {
|
|
|
16
16
|
CHANNEL_DELETED: 'CHANNEL_DELETED',
|
|
17
17
|
ENDUSER_OFFLINE: 'ENDUSER_OFFLINE',
|
|
18
18
|
CONFIG_SKIPPED_CHANNEL: 'CONFIG_SKIPPED_CHANNEL',
|
|
19
|
-
ASSIGNED_TO_OTHER_SERVICE: 'ASSIGNED_TO_OTHER_SERVICE'
|
|
19
|
+
ASSIGNED_TO_OTHER_SERVICE: 'ASSIGNED_TO_OTHER_SERVICE',
|
|
20
|
+
WECOM_TRAIL_EXPIRED: 'WECOM_TRAIL_EXPIRED',
|
|
21
|
+
WECOM_LICENSE_EXPIRED: 'WECOM_LICENSE_EXPIRED',
|
|
22
|
+
OUTGOING_LIMIT_REACHED: 'OUTGOING_LIMIT_REACHED'
|
|
20
23
|
};
|
|
21
24
|
export default SessionReplyStatus;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
|
2
|
+
import { ModuleNames } from '../../../../core/constants';
|
|
3
|
+
import BaseAPI from '../../../../infrastructure/api/BaseAPI';
|
|
4
|
+
import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, disableCannedMessageRequest, enableCannedMessageRequest } from '../../../dto';
|
|
5
|
+
export default class ICannedMessageRepository extends BaseAPI {
|
|
6
|
+
constructor() {
|
|
7
|
+
super({
|
|
8
|
+
module: ModuleNames.CANNED_MESSAGES
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
getCannedMessages() {
|
|
13
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCannedMessagesRequest();
|
|
14
|
+
throw new Error('Method not implemented.');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getCannedMessage() {
|
|
18
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCannedMessageRequest();
|
|
19
|
+
throw new Error('Method not implemented.');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
createCannedMessage() {
|
|
23
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : createCannedMessageRequest();
|
|
24
|
+
throw new Error('Method not implemented.');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
updateCannedMessage() {
|
|
28
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : updateCannedMessageRequest();
|
|
29
|
+
throw new Error('Method not implemented.');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
deleteCannedMessage() {
|
|
33
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : deleteCannedMessageRequest();
|
|
34
|
+
throw new Error('Method not implemented.');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
enableCannedMessage() {
|
|
38
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : enableCannedMessageRequest();
|
|
39
|
+
throw new Error('Method not implemented.');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
disableCannedMessage() {
|
|
43
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : disableCannedMessageRequest();
|
|
44
|
+
throw new Error('Method not implemented.');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ModuleNames } from '../../../../core/constants';
|
|
2
|
+
import BaseAPI from '../../../../infrastructure/api/BaseAPI';
|
|
3
|
+
import { getTemplateCreditExhaustStatusRequest, getTemplateLanguagesRequest } from '../../../dto';
|
|
4
|
+
export default class ITemplateMessageRepository extends BaseAPI {
|
|
5
|
+
constructor() {
|
|
6
|
+
super({
|
|
7
|
+
module: ModuleNames.TEMPLATE_MESSAGES
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async getTemplateLanguages() {
|
|
12
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getTemplateLanguagesRequest();
|
|
13
|
+
throw new Error('Method not implemented');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async getWhatsAppTemplateCreditExhaustStatus() {
|
|
17
|
+
let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getTemplateCreditExhaustStatusRequest();
|
|
18
|
+
throw new Error('Method not implemented');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { CannedMessageType } from '../../enum'; // import { ActorSchema } from '../actor';
|
|
2
|
+
|
|
3
|
+
import TranslationsSchema from './TranslationsSchema';
|
|
4
|
+
const CannedMessageSchema = {
|
|
5
|
+
id: {
|
|
6
|
+
type: 'string',
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
title: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
tags: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
required: false
|
|
16
|
+
},
|
|
17
|
+
status: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
required: false
|
|
20
|
+
},
|
|
21
|
+
createdBy: {
|
|
22
|
+
type: 'object',
|
|
23
|
+
required: true // schema: ActorSchema
|
|
24
|
+
|
|
25
|
+
},
|
|
26
|
+
uuid: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
required: false
|
|
29
|
+
},
|
|
30
|
+
displayMessage: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
required: true
|
|
33
|
+
},
|
|
34
|
+
type: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
required: true,
|
|
37
|
+
enum: Object.values(CannedMessageType)
|
|
38
|
+
},
|
|
39
|
+
translations: {
|
|
40
|
+
type: 'array',
|
|
41
|
+
required: false,
|
|
42
|
+
schema: TranslationsSchema
|
|
43
|
+
},
|
|
44
|
+
isPrivate: {
|
|
45
|
+
type: 'bool',
|
|
46
|
+
required: false
|
|
47
|
+
},
|
|
48
|
+
isActive: {
|
|
49
|
+
type: 'bool',
|
|
50
|
+
required: true
|
|
51
|
+
},
|
|
52
|
+
meta: {
|
|
53
|
+
type: 'array',
|
|
54
|
+
required: false
|
|
55
|
+
},
|
|
56
|
+
message: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
required: false
|
|
59
|
+
},
|
|
60
|
+
parameters: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
required: false
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
export default CannedMessageSchema;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TemplateItemButtonType } from '../../../enum';
|
|
2
|
+
const TemplateItemButtonsSchema = {
|
|
3
|
+
type: {
|
|
4
|
+
type: 'string',
|
|
5
|
+
required: true,
|
|
6
|
+
enum: Object.values(TemplateItemButtonType)
|
|
7
|
+
},
|
|
8
|
+
message: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
action: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
required: true
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export default TemplateItemButtonsSchema;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TemplateItemFooterType } from '../../../enum';
|
|
2
|
+
const TemplateItemFooterSchema = {
|
|
3
|
+
type: {
|
|
4
|
+
type: 'string',
|
|
5
|
+
required: true,
|
|
6
|
+
enum: Object.values(TemplateItemFooterType)
|
|
7
|
+
},
|
|
8
|
+
message: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
required: true
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export default TemplateItemFooterSchema;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TemplateItemHeaderType } from '../../../enum';
|
|
2
|
+
import { AttachmentSchema } from '../../attachment';
|
|
3
|
+
const TemplateItemHeaderSchema = {
|
|
4
|
+
attachment: {
|
|
5
|
+
type: 'string',
|
|
6
|
+
required: false,
|
|
7
|
+
schema: AttachmentSchema
|
|
8
|
+
},
|
|
9
|
+
type: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
required: true,
|
|
12
|
+
enum: Object.values(TemplateItemHeaderType)
|
|
13
|
+
},
|
|
14
|
+
message: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
required: false
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export default TemplateItemHeaderSchema;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import TemplateItemButtonsSchema from './TemplateItemButtonsSchema';
|
|
2
|
+
import TemplateItemFooterSchema from './TemplateItemFooterSchema';
|
|
3
|
+
import TemplateItemHeaderSchema from './TemplateItemHeaderSchema';
|
|
4
|
+
export { TemplateItemButtonsSchema, TemplateItemFooterSchema, TemplateItemHeaderSchema };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import TemplateItemButtonsSchema from './TemplateItem/TemplateItemButtonsSchema';
|
|
2
|
+
import TemplateItemFooterSchema from './TemplateItem/TemplateItemFooterSchema';
|
|
3
|
+
import TemplateItemHeaderSchema from './TemplateItem/TemplateItemHeaderSchema';
|
|
4
|
+
const TemplateItemsSchema = {
|
|
5
|
+
header: {
|
|
6
|
+
type: 'string',
|
|
7
|
+
required: false,
|
|
8
|
+
schema: TemplateItemHeaderSchema
|
|
9
|
+
},
|
|
10
|
+
footer: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
required: false,
|
|
13
|
+
schema: TemplateItemFooterSchema
|
|
14
|
+
},
|
|
15
|
+
buttons: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
required: false,
|
|
18
|
+
schema: TemplateItemButtonsSchema
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export default TemplateItemsSchema;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CannedMessageStatus } from '../../enum';
|
|
2
|
+
import TemplateItemsSchema from './TemplateItemsSchema';
|
|
3
|
+
const TranslationsSchema = {
|
|
4
|
+
displayMessage: {
|
|
5
|
+
type: 'string',
|
|
6
|
+
required: true
|
|
7
|
+
},
|
|
8
|
+
id: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
language: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
message: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
20
|
+
uuid: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
failedReason: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
required: false
|
|
27
|
+
},
|
|
28
|
+
modifiedTime: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
required: false
|
|
31
|
+
},
|
|
32
|
+
status: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
required: true,
|
|
35
|
+
enum: Object.values(CannedMessageStatus)
|
|
36
|
+
},
|
|
37
|
+
templateItems: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
required: false,
|
|
40
|
+
schema: TemplateItemsSchema
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export default TranslationsSchema;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import '../../enum';
|
|
2
|
+
const CustomReplyExtensionSchema = {
|
|
3
|
+
id: {
|
|
4
|
+
type: 'string',
|
|
5
|
+
required: true
|
|
6
|
+
},
|
|
7
|
+
title: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
required: true
|
|
10
|
+
},
|
|
11
|
+
displayMessage: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
message: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
required: false
|
|
18
|
+
},
|
|
19
|
+
webUrl: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
required: false
|
|
22
|
+
},
|
|
23
|
+
categoryName: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
required: false
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export default CustomReplyExtensionSchema;
|
|
@@ -5,4 +5,7 @@ export * from './attachment';
|
|
|
5
5
|
export * from './message';
|
|
6
6
|
export * from './channel';
|
|
7
7
|
export * from './integrationService';
|
|
8
|
-
export * from './contact';
|
|
8
|
+
export * from './contact';
|
|
9
|
+
export * from './cannedMessage';
|
|
10
|
+
export * from './templateMessage';
|
|
11
|
+
export * from './customReplyExtension';
|