@zohoim/client-sdk 1.0.0-replyAreaPoc6 → 1.0.0-replyAreaPoc8
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/domain/dto/templateMessages/getTemplateCreditExhaustStatusRequest.js +3 -6
- package/es/domain/entities/CannedMessage/CannedMessage.js +14 -2
- package/es/domain/entities/CustomReplyExtension/CustomReplyExtension.js +5 -1
- package/es/domain/entities/TemplateMessage/TemplateCreditExhaustStatus.js +5 -1
- package/es/domain/entities/TemplateMessage/TemplateLanguage.js +5 -1
- package/es/domain/schema/cannedMessage/CannedMessageSchema.js +4 -4
- package/es/infrastructure/adapters/cannedMessages/CannedMessageAdapter.js +7 -1
- package/es/infrastructure/adapters/messages/MessageAdapter.js +5 -1
- package/es/infrastructure/api/registry/templateMessages/templateMessageAPIRegistry.js +4 -4
- package/package.json +1 -1
|
@@ -2,14 +2,11 @@ import RequestBuilder from '../RequestBuilder';
|
|
|
2
2
|
|
|
3
3
|
function getTemplateCreditExhaustStatusRequest() {
|
|
4
4
|
let {
|
|
5
|
-
params = {}
|
|
6
|
-
query = {}
|
|
5
|
+
params = {}
|
|
7
6
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
|
-
return new RequestBuilder().withParams({ ...params
|
|
9
|
-
}).withQuery({
|
|
7
|
+
return new RequestBuilder().withParams({ ...params,
|
|
10
8
|
channelId: null,
|
|
11
|
-
receiverId: null
|
|
12
|
-
...query
|
|
9
|
+
receiverId: null
|
|
13
10
|
}).build();
|
|
14
11
|
}
|
|
15
12
|
|
|
@@ -5,7 +5,19 @@ import { Actor } from '../Actor';
|
|
|
5
5
|
export default class CannedMessage {
|
|
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: 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
|
+
|
|
9
21
|
this.data = {
|
|
10
22
|
id: validatedData.id,
|
|
11
23
|
title: validatedData.title,
|
|
@@ -13,7 +25,7 @@ export default class CannedMessage {
|
|
|
13
25
|
tags: validatedData.tags,
|
|
14
26
|
status: validatedData.status,
|
|
15
27
|
uuid: validatedData.uuid,
|
|
16
|
-
createdBy
|
|
28
|
+
createdBy,
|
|
17
29
|
displayMessage: validatedData.displayMessage,
|
|
18
30
|
type: validatedData.type,
|
|
19
31
|
kind: validatedData.kind,
|
|
@@ -3,7 +3,11 @@ import { CustomReplyExtensionSchema } from '../../schema';
|
|
|
3
3
|
export default class CustomReplyExtension {
|
|
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: CustomReplyExtensionSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'CustomReplyExtension'
|
|
10
|
+
});
|
|
7
11
|
this.data = {
|
|
8
12
|
id: validatedData.id,
|
|
9
13
|
title: validatedData.title,
|
|
@@ -4,7 +4,11 @@ import { TemplateCreditExhaustStatusSchema } from '../../schema';
|
|
|
4
4
|
export default class TemplateCreditExhaustStatus {
|
|
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: TemplateCreditExhaustStatusSchema,
|
|
9
|
+
data,
|
|
10
|
+
entityName: 'TemplateCreditExhaustStatus'
|
|
11
|
+
});
|
|
8
12
|
this.data = {
|
|
9
13
|
code: validatedData.code,
|
|
10
14
|
message: validatedData.message
|
|
@@ -3,7 +3,11 @@ import { TemplateLanguageSchema } from '../../schema';
|
|
|
3
3
|
export default class TemplateLanguage {
|
|
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: TemplateLanguageSchema,
|
|
8
|
+
data,
|
|
9
|
+
entityName: 'TemplateLanguage'
|
|
10
|
+
});
|
|
7
11
|
this.data = {
|
|
8
12
|
code: validatedData.code,
|
|
9
13
|
language: validatedData.language
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CannedMessageType } from '../../enum';
|
|
2
|
-
|
|
1
|
+
import { CannedMessageType } from '../../enum'; //import { ActorSchema } from '../actor';
|
|
2
|
+
|
|
3
3
|
import TranslationsSchema from './TranslationsSchema';
|
|
4
4
|
const CannedMessageSchema = {
|
|
5
5
|
id: {
|
|
@@ -20,8 +20,8 @@ const CannedMessageSchema = {
|
|
|
20
20
|
},
|
|
21
21
|
createdBy: {
|
|
22
22
|
type: 'object',
|
|
23
|
-
required: true
|
|
24
|
-
|
|
23
|
+
required: true // schema: ActorSchema
|
|
24
|
+
|
|
25
25
|
},
|
|
26
26
|
uuid: {
|
|
27
27
|
type: 'string',
|
|
@@ -12,13 +12,19 @@ export default class CannedMessageAdapter extends IAdapter {
|
|
|
12
12
|
id: cannedMessageData.id,
|
|
13
13
|
title: cannedMessageData.title,
|
|
14
14
|
tags: cannedMessageData.tags,
|
|
15
|
+
displayMessage: cannedMessageData.displayMessage,
|
|
16
|
+
type: cannedMessageData.type,
|
|
17
|
+
message: cannedMessageData.message,
|
|
15
18
|
status: cannedMessageData.status,
|
|
16
19
|
createdBy: cannedMessageData.createdBy,
|
|
17
20
|
isActive: cannedMessageData.isActive,
|
|
18
21
|
isPrivate: cannedMessageData.isPrivate,
|
|
19
22
|
translations: cannedMessageData.translations,
|
|
20
23
|
uuid: cannedMessageData.uuid,
|
|
21
|
-
meta: cannedMessageData.meta
|
|
24
|
+
meta: cannedMessageData.meta,
|
|
25
|
+
rejectedReason: cannedMessageData.rejectedReason,
|
|
26
|
+
modifiedTime: cannedMessageData.modifiedTime,
|
|
27
|
+
kind: cannedMessageData.kind
|
|
22
28
|
}).toJSON();
|
|
23
29
|
} catch (error) {
|
|
24
30
|
throw new AdapterError(`Failed to adapt canned message: ${error.message}`);
|
|
@@ -8,6 +8,10 @@ export default class MessageAdapter extends IAdapter {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
try {
|
|
11
|
+
const {
|
|
12
|
+
template
|
|
13
|
+
} = messageData;
|
|
14
|
+
const normalizedTemplate = template && Object.keys(template).length > 0 ? template : null;
|
|
11
15
|
return new Message({
|
|
12
16
|
id: messageData.id,
|
|
13
17
|
sessionId: messageData.sessionId,
|
|
@@ -28,7 +32,7 @@ export default class MessageAdapter extends IAdapter {
|
|
|
28
32
|
contentType: messageData.contentType,
|
|
29
33
|
fullContentURL: messageData.fullContentURL,
|
|
30
34
|
attachment: messageData.attachment,
|
|
31
|
-
template:
|
|
35
|
+
template: normalizedTemplate,
|
|
32
36
|
type: messageData.type,
|
|
33
37
|
isRead: messageData.isRead,
|
|
34
38
|
article: messageData.article
|
|
@@ -4,15 +4,15 @@ import createAPIRegistry from '../createAPIRegistry';
|
|
|
4
4
|
import constructTemplateMessageEndPoint from './constructTemplateMessageEndPoint';
|
|
5
5
|
|
|
6
6
|
function getTemplateLanguages() {
|
|
7
|
-
return createAPIRegistry(constructTemplateMessageEndPoint('/templateLanguages'), HTTP_METHODS.
|
|
7
|
+
return createAPIRegistry(constructTemplateMessageEndPoint('/templateLanguages'), HTTP_METHODS.POST, getTemplateLanguagesRequest());
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
function
|
|
10
|
+
function getWhatsAppTemplateCreditExhaustStatus() {
|
|
11
11
|
return createAPIRegistry(constructTemplateMessageEndPoint('/templateCreditExhaustStatus'), // NO I18N
|
|
12
|
-
HTTP_METHODS.
|
|
12
|
+
HTTP_METHODS.POST, getTemplateCreditExhaustStatusRequest());
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export default {
|
|
16
16
|
getTemplateLanguages,
|
|
17
|
-
|
|
17
|
+
getWhatsAppTemplateCreditExhaustStatus
|
|
18
18
|
};
|