@zohoim/client-sdk 1.0.0-replyAreaPoc1 → 1.0.0-replyAreaPoc3
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/cannedMessages/createCannedMessageRequest.js +6 -1
- package/es/domain/dto/cannedMessages/deleteCannedMessageRequest.js +1 -1
- package/es/domain/dto/cannedMessages/disableCannedMessageRequest.js +1 -1
- package/es/domain/dto/cannedMessages/enableCannedMessageRequest.js +1 -1
- package/es/domain/dto/cannedMessages/getCannedMessageRequest.js +1 -1
- package/es/domain/dto/cannedMessages/updateCannedMessageRequest.js +9 -2
- package/es/domain/dto/messages/sendMessageRequest.js +1 -1
- package/es/domain/dto/templateMessages/getTemplateCreditExhaustStatusRequest.js +6 -1
- package/es/domain/entities/CannedMessage/CannedMessage.js +4 -10
- package/es/domain/entities/CustomReplyExtension/CustomReplyExtension.js +1 -1
- package/es/domain/entities/TemplateMessage/TemplateCreditExhaustStatus.js +1 -2
- package/es/domain/enum/cannedMessage/CannedMessageStatus.js +2 -1
- 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 +4 -0
- package/es/domain/enum/cannedMessage/index.js +5 -1
- package/es/domain/enum/templateMessage/index.js +1 -2
- package/es/domain/interfaces/repositories/cannedMessages/ICannedMessageRepository.js +1 -1
- package/es/domain/schema/cannedMessage/CannedMessageSchema.js +6 -3
- 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/templateMessage/TemplateCreditExhaustStatusSchema.js +1 -3
- package/es/domain/schema/templateMessage/TemplateLanguageSchema.js +1 -3
- package/es/infrastructure/adapters/cannedMessages/CannedMessageAdapter.js +8 -8
- package/es/infrastructure/adapters/templateMessages/TemplateCreditExhaustStatusAdapter.js +0 -1
- package/es/infrastructure/api/registry/cannedMessages/cannedMessageAPIRegistry.js +7 -13
- package/es/infrastructure/api/registry/getRegistryConfig.js +3 -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/repositories/templateMessages/TemplateMessageRepository.js +1 -1
- package/package.json +1 -1
- package/es/domain/enum/templateMessage/TemplateLanguage.js +0 -74
|
@@ -6,7 +6,12 @@ function createCannedMessageRequest() {
|
|
|
6
6
|
body = {}
|
|
7
7
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
8
|
return new RequestBuilder().withParams({ ...params
|
|
9
|
-
}).withBody({
|
|
9
|
+
}).withBody({
|
|
10
|
+
title: null,
|
|
11
|
+
message: null,
|
|
12
|
+
tags: null,
|
|
13
|
+
type: null,
|
|
14
|
+
...body
|
|
10
15
|
}).build();
|
|
11
16
|
}
|
|
12
17
|
|
|
@@ -2,11 +2,18 @@ import RequestBuilder from '../RequestBuilder';
|
|
|
2
2
|
|
|
3
3
|
function updateCannedMessageRequest() {
|
|
4
4
|
let {
|
|
5
|
-
params = {}
|
|
5
|
+
params = {},
|
|
6
|
+
body = {}
|
|
6
7
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
8
|
return new RequestBuilder().withParams({
|
|
8
|
-
|
|
9
|
+
cannedMessageId: null,
|
|
9
10
|
...params
|
|
11
|
+
}).withBody({
|
|
12
|
+
title: null,
|
|
13
|
+
message: null,
|
|
14
|
+
tags: null,
|
|
15
|
+
type: null,
|
|
16
|
+
...body
|
|
10
17
|
}).build();
|
|
11
18
|
}
|
|
12
19
|
|
|
@@ -2,9 +2,14 @@ import RequestBuilder from '../RequestBuilder';
|
|
|
2
2
|
|
|
3
3
|
function getTemplateCreditExhaustStatusRequest() {
|
|
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({ ...params
|
|
9
|
+
}).withQuery({
|
|
10
|
+
channelId: null,
|
|
11
|
+
receiverId: null,
|
|
12
|
+
...query
|
|
8
13
|
}).build();
|
|
9
14
|
}
|
|
10
15
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { validateSchema } from '../../../core/utils';
|
|
2
|
-
import { CannedMessageStatus } from '../../enum
|
|
2
|
+
import { CannedMessageStatus } from '../../enum';
|
|
3
3
|
import { CannedMessageSchema } from '../../schema';
|
|
4
|
-
|
|
4
|
+
import { Actor } from '../Actor';
|
|
5
|
+
export default class CannedMessage {
|
|
5
6
|
constructor() {
|
|
6
7
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
8
|
const validatedData = validateSchema(CannedMessageSchema, data);
|
|
@@ -12,7 +13,7 @@ export default class Message {
|
|
|
12
13
|
tags: validatedData.tags,
|
|
13
14
|
status: validatedData.status,
|
|
14
15
|
uuid: validatedData.uuid,
|
|
15
|
-
createdBy: validatedData.createdBy,
|
|
16
|
+
createdBy: new Actor(validatedData.createdBy),
|
|
16
17
|
displayMessage: validatedData.displayMessage,
|
|
17
18
|
type: validatedData.type,
|
|
18
19
|
kind: validatedData.kind,
|
|
@@ -37,13 +38,6 @@ export default class Message {
|
|
|
37
38
|
return status === CannedMessageStatus.PENDING;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
static getMetaValue() {
|
|
41
|
-
let meta = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
42
|
-
let key = arguments.length > 1 ? arguments[1] : undefined;
|
|
43
|
-
const item = meta.find(item => item.name === key);
|
|
44
|
-
return item ? item.value : '';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
41
|
toJSON() {
|
|
48
42
|
return { ...this.data
|
|
49
43
|
};
|
|
@@ -9,7 +9,7 @@ export default class CustomReplyExtension {
|
|
|
9
9
|
title: validatedData.title,
|
|
10
10
|
message: validatedData.message,
|
|
11
11
|
displayMessage: validatedData.displayMessage,
|
|
12
|
-
webUrl: validatedData.webUrl ||
|
|
12
|
+
webUrl: validatedData.webUrl || null,
|
|
13
13
|
categoryName: validatedData.categoryName
|
|
14
14
|
};
|
|
15
15
|
}
|
|
@@ -7,8 +7,7 @@ export default class TemplateCreditExhaustStatus {
|
|
|
7
7
|
const validatedData = validateSchema(TemplateCreditExhaustStatusSchema, data);
|
|
8
8
|
this.data = {
|
|
9
9
|
code: validatedData.code,
|
|
10
|
-
message: validatedData.message
|
|
11
|
-
error: validatedData.error
|
|
10
|
+
message: validatedData.message
|
|
12
11
|
};
|
|
13
12
|
}
|
|
14
13
|
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import CannedMessageStatus from './CannedMessageStatus';
|
|
2
|
-
|
|
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 };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ModuleNames } from '../../../../core/constants';
|
|
3
3
|
import BaseAPI from '../../../../infrastructure/api/BaseAPI';
|
|
4
4
|
import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, disableCannedMessageRequest, enableCannedMessageRequest } from '../../../dto';
|
|
5
|
-
export default class
|
|
5
|
+
export default class ICannedMessageRepository extends BaseAPI {
|
|
6
6
|
constructor() {
|
|
7
7
|
super({
|
|
8
8
|
module: ModuleNames.CANNED_MESSAGES
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import '../../enum';
|
|
1
|
+
import { CannedMessageType } from '../../enum';
|
|
2
2
|
import { ActorSchema } from '../actor';
|
|
3
|
+
import TranslationsSchema from './TranslationsSchema';
|
|
3
4
|
const CannedMessageSchema = {
|
|
4
5
|
id: {
|
|
5
6
|
type: 'string',
|
|
@@ -32,11 +33,13 @@ const CannedMessageSchema = {
|
|
|
32
33
|
},
|
|
33
34
|
type: {
|
|
34
35
|
type: 'string',
|
|
35
|
-
required: true
|
|
36
|
+
required: true,
|
|
37
|
+
enum: Object.values(CannedMessageType)
|
|
36
38
|
},
|
|
37
39
|
translations: {
|
|
38
40
|
type: 'array',
|
|
39
|
-
required: false
|
|
41
|
+
required: false,
|
|
42
|
+
schema: TranslationsSchema
|
|
40
43
|
},
|
|
41
44
|
isPrivate: {
|
|
42
45
|
type: 'bool',
|
|
@@ -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;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { TemplateCreditExhaustStatusCode } from '../../enum';
|
|
2
1
|
const TemplateCreditExhaustStatusSchema = {
|
|
3
2
|
code: {
|
|
4
3
|
type: 'string',
|
|
5
|
-
required:
|
|
6
|
-
enum: Object.values(TemplateCreditExhaustStatusCode)
|
|
4
|
+
required: true
|
|
7
5
|
},
|
|
8
6
|
message: {
|
|
9
7
|
type: 'string',
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { TemplateLanguage } from '../../enum';
|
|
2
1
|
const TemplateLanguageSchema = {
|
|
3
2
|
code: {
|
|
4
3
|
type: 'string',
|
|
@@ -6,8 +5,7 @@ const TemplateLanguageSchema = {
|
|
|
6
5
|
},
|
|
7
6
|
language: {
|
|
8
7
|
type: 'string',
|
|
9
|
-
required: true
|
|
10
|
-
enum: Object.values(TemplateLanguage)
|
|
8
|
+
required: true
|
|
11
9
|
}
|
|
12
10
|
};
|
|
13
11
|
export default TemplateLanguageSchema;
|
|
@@ -10,14 +10,14 @@ export default class CannedMessageAdapter extends IAdapter {
|
|
|
10
10
|
try {
|
|
11
11
|
return new CannedMessage({
|
|
12
12
|
id: cannedMessageData.id,
|
|
13
|
-
title: cannedMessageData.
|
|
14
|
-
tags: cannedMessageData.
|
|
15
|
-
status: cannedMessageData.
|
|
16
|
-
createdBy: cannedMessageData.
|
|
17
|
-
isActive: cannedMessageData.
|
|
18
|
-
isPrivate: cannedMessageData.
|
|
19
|
-
translations: cannedMessageData.
|
|
20
|
-
uuid: cannedMessageData.
|
|
13
|
+
title: cannedMessageData.title,
|
|
14
|
+
tags: cannedMessageData.tags,
|
|
15
|
+
status: cannedMessageData.status,
|
|
16
|
+
createdBy: cannedMessageData.createdBy,
|
|
17
|
+
isActive: cannedMessageData.isActive,
|
|
18
|
+
isPrivate: cannedMessageData.isPrivate,
|
|
19
|
+
translations: cannedMessageData.translations,
|
|
20
|
+
uuid: cannedMessageData.uuid,
|
|
21
21
|
meta: cannedMessageData.meta
|
|
22
22
|
}).toJSON();
|
|
23
23
|
} catch (error) {
|
|
@@ -10,7 +10,6 @@ export default class TemplateCreditExhaustStatusAdapter extends IAdapter {
|
|
|
10
10
|
try {
|
|
11
11
|
return new TemplateCreditExhaustStatus({
|
|
12
12
|
code: templateCreditExhaustStatusData.code,
|
|
13
|
-
error: templateCreditExhaustStatusData.error,
|
|
14
13
|
message: templateCreditExhaustStatusData.message
|
|
15
14
|
}).toJSON();
|
|
16
15
|
} catch (error) {
|
|
@@ -2,39 +2,33 @@ import { HTTP_METHODS } from '../../../../core/constants';
|
|
|
2
2
|
import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest } from '../../../../domain/dto';
|
|
3
3
|
import constructCannedMessageEndPoint from './constructCannedMessageEndPoint';
|
|
4
4
|
import createAPIRegistry from '../createAPIRegistry';
|
|
5
|
-
const SINGLE_SESSION_URL = '/:sessionId';
|
|
6
|
-
const MESSAGES_URL = `${SINGLE_SESSION_URL}/messages`;
|
|
7
|
-
const SINGLE_MESSAGE_URL = `${MESSAGES_URL}/:messageId`;
|
|
8
|
-
const FULL_CONTENT_URL = `${SINGLE_MESSAGE_URL}/fullContent`;
|
|
9
|
-
const RESEND_MESSAGE_URL = `${SINGLE_MESSAGE_URL}/resend`;
|
|
10
|
-
const ATTACHMENTS_URL = `${SINGLE_SESSION_URL}/attachments`;
|
|
11
5
|
|
|
12
6
|
function getCannedMessages() {
|
|
13
|
-
return createAPIRegistry(constructCannedMessageEndPoint(
|
|
7
|
+
return createAPIRegistry(constructCannedMessageEndPoint(), HTTP_METHODS.GET, getCannedMessagesRequest());
|
|
14
8
|
}
|
|
15
9
|
|
|
16
10
|
function getCannedMessage() {
|
|
17
|
-
return createAPIRegistry(constructCannedMessageEndPoint(
|
|
11
|
+
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId'), HTTP_METHODS.GET, getCannedMessageRequest());
|
|
18
12
|
}
|
|
19
13
|
|
|
20
14
|
function createCannedMessage() {
|
|
21
|
-
return createAPIRegistry(constructCannedMessageEndPoint(
|
|
15
|
+
return createAPIRegistry(constructCannedMessageEndPoint(), HTTP_METHODS.POST, createCannedMessageRequest());
|
|
22
16
|
}
|
|
23
17
|
|
|
24
18
|
function updateCannedMessage() {
|
|
25
|
-
return createAPIRegistry(constructCannedMessageEndPoint(
|
|
19
|
+
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId'), HTTP_METHODS.PATCH, updateCannedMessageRequest());
|
|
26
20
|
}
|
|
27
21
|
|
|
28
22
|
function enableCannedMessage() {
|
|
29
|
-
return createAPIRegistry(constructCannedMessageEndPoint(
|
|
23
|
+
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId/activation'), HTTP_METHODS.PATCH, enableCannedMessageRequest());
|
|
30
24
|
}
|
|
31
25
|
|
|
32
26
|
function disableCannedMessage() {
|
|
33
|
-
return createAPIRegistry(constructCannedMessageEndPoint(
|
|
27
|
+
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId/activation'), HTTP_METHODS.DELETE, disableCannedMessageRequest());
|
|
34
28
|
}
|
|
35
29
|
|
|
36
30
|
function deleteCannedMessage() {
|
|
37
|
-
return createAPIRegistry(constructCannedMessageEndPoint(
|
|
31
|
+
return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId'), HTTP_METHODS.DELETE, deleteCannedMessageRequest());
|
|
38
32
|
}
|
|
39
33
|
|
|
40
34
|
export default {
|
|
@@ -6,6 +6,7 @@ import { messageAPIRegistry } from './messages';
|
|
|
6
6
|
import { agentAPIRegistry } from './agents';
|
|
7
7
|
import { contactAPIRegistry } from './contacts';
|
|
8
8
|
import { cannedMessageAPIRegistry } from './cannedMessages';
|
|
9
|
+
import { templateMessageAPIRegistry } from './templateMessages';
|
|
9
10
|
import { ModuleNames } from '../../../core/constants';
|
|
10
11
|
const APIRegistry = {
|
|
11
12
|
[ModuleNames.CHANNELS]: channelAPIRegistry,
|
|
@@ -14,7 +15,8 @@ const APIRegistry = {
|
|
|
14
15
|
[ModuleNames.MESSAGES]: messageAPIRegistry,
|
|
15
16
|
[ModuleNames.AGENTS]: agentAPIRegistry,
|
|
16
17
|
[ModuleNames.CONTACTS]: contactAPIRegistry,
|
|
17
|
-
[ModuleNames.CANNED_MESSAGES]: cannedMessageAPIRegistry
|
|
18
|
+
[ModuleNames.CANNED_MESSAGES]: cannedMessageAPIRegistry,
|
|
19
|
+
[ModuleNames.TEMPLATE_MESSAGES]: templateMessageAPIRegistry
|
|
18
20
|
};
|
|
19
21
|
export default function getRegistryConfig(module, operation) {
|
|
20
22
|
const moduleConfig = selectn(module, APIRegistry);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IntegrationServices } from '../../../../domain/enum';
|
|
2
|
+
import createBaseUrl from '../createBaseUrl';
|
|
3
|
+
export default function constructTemplateMessageEndPoint(extra) {
|
|
4
|
+
const base = `/integrations/${IntegrationServices.WHATSAPP}`;
|
|
5
|
+
|
|
6
|
+
if (extra) {
|
|
7
|
+
return createBaseUrl(base + extra);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return createBaseUrl(base);
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HTTP_METHODS } from '../../../../core/constants';
|
|
2
|
+
import { getTemplateLanguagesRequest, getTemplateCreditExhaustStatusRequest } from '../../../../domain/dto';
|
|
3
|
+
import createAPIRegistry from '../createAPIRegistry';
|
|
4
|
+
import constructTemplateMessageEndPoint from './constructTemplateMessageEndPoint';
|
|
5
|
+
|
|
6
|
+
function getTemplateLanguages() {
|
|
7
|
+
return createAPIRegistry(constructTemplateMessageEndPoint('/templateLanguages'), HTTP_METHODS.GET, getTemplateLanguagesRequest());
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function getTemplateCreditExhaustStatus() {
|
|
11
|
+
return createAPIRegistry(constructTemplateMessageEndPoint('/templateCreditExhaustStatus'), // NO I18N
|
|
12
|
+
HTTP_METHODS.GET, getTemplateCreditExhaustStatusRequest());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
getTemplateLanguages,
|
|
17
|
+
getTemplateCreditExhaustStatus
|
|
18
|
+
};
|
|
@@ -38,7 +38,7 @@ export default class TemplateMessageRepository extends ITemplateMessageRepositor
|
|
|
38
38
|
let {
|
|
39
39
|
operation,
|
|
40
40
|
request,
|
|
41
|
-
adapter = this.
|
|
41
|
+
adapter = this.templateCreditExhaustStatusAdapter,
|
|
42
42
|
responseType
|
|
43
43
|
} = _ref3;
|
|
44
44
|
return this.executeAPICall({
|
package/package.json
CHANGED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
const TemplateLanguage = {
|
|
2
|
-
Afrikaans: 'Afrikaans',
|
|
3
|
-
Albanian: 'Albanian',
|
|
4
|
-
Arabic: 'Arabic',
|
|
5
|
-
Azerbaijani: 'Azerbaijani',
|
|
6
|
-
Bengali: 'Bengali',
|
|
7
|
-
Bulgarian: 'Bulgarian',
|
|
8
|
-
Catalan: 'Catalan',
|
|
9
|
-
'Chinese (CHN)': 'Chinese (CHN)',
|
|
10
|
-
'Chinese (HKG)': 'Chinese (HKG)',
|
|
11
|
-
'Chinese (TAI)': 'Chinese (TAI)',
|
|
12
|
-
Croatian: 'Croatian',
|
|
13
|
-
Czech: 'Czech',
|
|
14
|
-
Danish: 'Danish',
|
|
15
|
-
Dutch: 'Dutch',
|
|
16
|
-
English: 'English',
|
|
17
|
-
'English (UK)': 'English (UK)',
|
|
18
|
-
'English (US)': 'English (US)',
|
|
19
|
-
Estonian: 'Estonian',
|
|
20
|
-
Filipino: 'Filipino',
|
|
21
|
-
Finnish: 'Finnish',
|
|
22
|
-
French: 'French',
|
|
23
|
-
Georgian: 'Georgian',
|
|
24
|
-
German: 'German',
|
|
25
|
-
Greek: 'Greek',
|
|
26
|
-
Gujarati: 'Gujarati',
|
|
27
|
-
Hausa: 'Hausa',
|
|
28
|
-
Hebrew: 'Hebrew',
|
|
29
|
-
Hindi: 'Hindi',
|
|
30
|
-
Hungarian: 'Hungarian',
|
|
31
|
-
Indonesian: 'Indonesian',
|
|
32
|
-
Irish: 'Irish',
|
|
33
|
-
Italian: 'Italian',
|
|
34
|
-
Japanese: 'Japanese',
|
|
35
|
-
Kannada: 'Kannada',
|
|
36
|
-
Kazakh: 'Kazakh',
|
|
37
|
-
Kinyarwanda: 'Kinyarwanda',
|
|
38
|
-
Korean: 'Korean',
|
|
39
|
-
'Kyrgyz (Kyrgyzstan)': 'Kyrgyz (Kyrgyzstan)',
|
|
40
|
-
Lao: 'Lao',
|
|
41
|
-
Latvian: 'Latvian',
|
|
42
|
-
Lithuanian: 'Lithuanian',
|
|
43
|
-
Macedonian: 'Macedonian',
|
|
44
|
-
Malay: 'Malay',
|
|
45
|
-
Malayalam: 'Malayalam',
|
|
46
|
-
Marathi: 'Marathi',
|
|
47
|
-
Norwegian: 'Norwegian',
|
|
48
|
-
Persian: 'Persian',
|
|
49
|
-
Polish: 'Polish',
|
|
50
|
-
'Portuguese (BR)': 'Portuguese (BR)',
|
|
51
|
-
'Portuguese (POR)': 'Portuguese (POR)',
|
|
52
|
-
Punjabi: 'Punjabi',
|
|
53
|
-
Romanian: 'Romanian',
|
|
54
|
-
Russian: 'Russian',
|
|
55
|
-
Serbian: 'Serbian',
|
|
56
|
-
Slovak: 'Slovak',
|
|
57
|
-
Slovenian: 'Slovenian',
|
|
58
|
-
Spanish: 'Spanish',
|
|
59
|
-
'Spanish (ARG)': 'Spanish (ARG)',
|
|
60
|
-
'Spanish (SPA)': 'Spanish (SPA)',
|
|
61
|
-
'Spanish (MEX)': 'Spanish (MEX)',
|
|
62
|
-
Swahili: 'Swahili',
|
|
63
|
-
Swedish: 'Swedish',
|
|
64
|
-
Tamil: 'Tamil',
|
|
65
|
-
Telugu: 'Telugu',
|
|
66
|
-
Thai: 'Thai',
|
|
67
|
-
Turkish: 'Turkish',
|
|
68
|
-
Ukrainian: 'Ukrainian',
|
|
69
|
-
Urdu: 'Urdu',
|
|
70
|
-
Uzbek: 'Uzbek',
|
|
71
|
-
Vietnamese: 'Vietnamese',
|
|
72
|
-
Zulu: 'Zulu'
|
|
73
|
-
};
|
|
74
|
-
export default TemplateLanguage;
|