@zohoim/client-sdk 1.0.0-canned05 → 1.0.0-canned08

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.
Files changed (30) hide show
  1. package/es/application/services/cannedMessages/CannedMessageService.js +6 -1
  2. package/es/domain/dto/cannedMessages/getCannedPlaceholdersRequest.js +10 -0
  3. package/es/domain/dto/cannedMessages/index.js +2 -1
  4. package/es/domain/entities/CannedMessage/CannedMessage.js +1 -1
  5. package/es/domain/entities/CannedMessage/Translation.js +21 -2
  6. package/es/domain/entities/Placeholder/Placeholder.js +24 -0
  7. package/es/domain/entities/Placeholder/index.js +2 -0
  8. package/es/domain/entities/TemplateMessage/TemplateItemButton.js +48 -0
  9. package/es/domain/entities/TemplateMessage/TemplateItemFooter.js +27 -0
  10. package/es/domain/entities/TemplateMessage/TemplateItemHeader.js +48 -0
  11. package/es/domain/entities/TemplateMessage/index.js +4 -1
  12. package/es/domain/entities/index.js +2 -1
  13. package/es/domain/enum/cannedMessage/TemplateItemButtonType.js +2 -1
  14. package/es/domain/enum/cannedMessage/TemplateItemHeaderType.js +3 -1
  15. package/es/domain/interfaces/repositories/cannedMessages/ICannedMessageRepository.js +6 -1
  16. package/es/domain/schema/cannedMessage/TemplateItem/TemplateItemButtonsSchema.js +1 -1
  17. package/es/domain/schema/cannedMessage/index.js +1 -0
  18. package/es/domain/schema/index.js +2 -1
  19. package/es/domain/schema/placeholder/PlaceholderSchema.js +19 -0
  20. package/es/domain/schema/placeholder/index.js +2 -0
  21. package/es/infrastructure/adapters/cannedMessages/CannedMessageAdapter.js +3 -2
  22. package/es/infrastructure/adapters/cannedMessages/TranslationAdapter.js +27 -0
  23. package/es/infrastructure/adapters/cannedMessages/index.js +2 -1
  24. package/es/infrastructure/adapters/index.js +2 -1
  25. package/es/infrastructure/adapters/placeholders/PlaceholderAdapter.js +22 -0
  26. package/es/infrastructure/adapters/placeholders/index.js +2 -0
  27. package/es/infrastructure/api/cannedMessages/CannedMessageAPI.js +11 -1
  28. package/es/infrastructure/api/registry/cannedMessages/cannedMessageAPIRegistry.js +7 -2
  29. package/es/infrastructure/repositories/cannedMessages/CannedMessageRepository.js +20 -5
  30. package/package.json +1 -1
@@ -48,6 +48,10 @@ export default class CannedMessageService extends ICannedMessageRepository {
48
48
  return this.cannedMessageRepository.deleteTranslation(request);
49
49
  }
50
50
 
51
+ async getCannedPlaceholders(request) {
52
+ return this.cannedMessageRepository.getCannedPlaceholders(request);
53
+ }
54
+
51
55
  toJSON() {
52
56
  return {
53
57
  getCannedMessages: this.getCannedMessages.bind(this),
@@ -59,7 +63,8 @@ export default class CannedMessageService extends ICannedMessageRepository {
59
63
  disableCannedMessage: this.disableCannedMessage.bind(this),
60
64
  addTranslation: this.addTranslation.bind(this),
61
65
  updateTranslation: this.updateTranslation.bind(this),
62
- deleteTranslation: this.deleteTranslation.bind(this)
66
+ deleteTranslation: this.deleteTranslation.bind(this),
67
+ getCannedPlaceholders: this.getCannedPlaceholders.bind(this)
63
68
  };
64
69
  }
65
70
 
@@ -0,0 +1,10 @@
1
+ import RequestBuilder from '../RequestBuilder';
2
+
3
+ function getCannedPlaceholdersRequest() {
4
+ let {
5
+ params = {}
6
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ return new RequestBuilder().withParams(params).build();
8
+ }
9
+
10
+ export default getCannedPlaceholdersRequest;
@@ -7,4 +7,5 @@ export { default as disableCannedMessageRequest } from './disableCannedMessageRe
7
7
  export { default as updateCannedMessageRequest } from './updateCannedMessageRequest';
8
8
  export { default as addTranslationRequest } from './addTranslationRequest';
9
9
  export { default as updateTranslationRequest } from './updateTranslationRequest';
10
- export { default as deleteTranslationRequest } from './deleteTranslationRequest';
10
+ export { default as deleteTranslationRequest } from './deleteTranslationRequest';
11
+ export { default as getCannedPlaceholdersRequest } from './getCannedPlaceholdersRequest';
@@ -9,7 +9,7 @@ export default class CannedMessage {
9
9
  const validatedData = validateSchema({
10
10
  schema: CannedMessageSchema,
11
11
  data,
12
- entityName: 'CannedMessage'
12
+ entityName: `CannedMessage${data?.id ? `_${data.id}` : ''}`
13
13
  });
14
14
  let {
15
15
  createdBy,
@@ -1,13 +1,32 @@
1
1
  import { validateSchema } from '../../../core/utils';
2
2
  import TranslationsSchema from '../../schema/cannedMessage/TranslationsSchema';
3
+ import { TemplateItemButton, TemplateItemHeader, TemplateItemFooter } from '../TemplateMessage';
3
4
  export default class Translation {
4
5
  constructor() {
5
6
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
7
  const validatedData = validateSchema({
7
8
  schema: TranslationsSchema,
8
9
  data,
9
- entityName: 'Translation'
10
+ entityName: `Translation${data?.id ? `_${data.id}` : ''}`
10
11
  });
12
+ const {
13
+ templateItems
14
+ } = validatedData;
15
+ let adaptedTemplateItems = null;
16
+
17
+ if (templateItems) {
18
+ const {
19
+ header,
20
+ footer,
21
+ buttons
22
+ } = templateItems;
23
+ adaptedTemplateItems = {
24
+ header: header ? new TemplateItemHeader(header).toJSON() : null,
25
+ footer: footer ? new TemplateItemFooter(footer).toJSON() : null,
26
+ buttons: Array.isArray(buttons) ? buttons.map(btn => new TemplateItemButton(btn).toJSON()) : null
27
+ };
28
+ }
29
+
11
30
  this.data = {
12
31
  id: validatedData.id,
13
32
  language: validatedData.language,
@@ -17,7 +36,7 @@ export default class Translation {
17
36
  status: validatedData.status,
18
37
  modifiedTime: validatedData.modifiedTime,
19
38
  failedReason: validatedData.failedReason,
20
- templateItems: validatedData.templateItems
39
+ templateItems: adaptedTemplateItems
21
40
  };
22
41
  }
23
42
 
@@ -0,0 +1,24 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { PlaceholderSchema } from '../../schema/placeholder';
3
+ export default class Placeholder {
4
+ constructor() {
5
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ const validatedData = validateSchema({
7
+ schema: PlaceholderSchema,
8
+ data,
9
+ entityName: 'Placeholder'
10
+ });
11
+ this.data = {
12
+ apiName: validatedData.apiName,
13
+ i18nFieldLabel: validatedData.i18nFieldLabel,
14
+ fieldLabel: validatedData.fieldLabel,
15
+ placeHolder: validatedData.placeHolder
16
+ };
17
+ }
18
+
19
+ toJSON() {
20
+ return { ...this.data
21
+ };
22
+ }
23
+
24
+ }
@@ -0,0 +1,2 @@
1
+ import Placeholder from './Placeholder';
2
+ export { Placeholder };
@@ -0,0 +1,48 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { TemplateItemButtonType } from '../../enum';
3
+ import { TemplateItemButtonsSchema } from '../../schema';
4
+ export default class TemplateItemButton {
5
+ constructor() {
6
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ const validatedData = validateSchema({
8
+ schema: TemplateItemButtonsSchema,
9
+ data,
10
+ entityName: 'TemplateItemButton'
11
+ });
12
+ this.data = {
13
+ type: validatedData.type,
14
+ message: validatedData.message,
15
+ action: validatedData.action
16
+ };
17
+ }
18
+
19
+ static isPhoneNumber(type) {
20
+ return type === TemplateItemButtonType.PHONE_NUMBER;
21
+ }
22
+
23
+ static isURL(type) {
24
+ return type === TemplateItemButtonType.URL;
25
+ }
26
+
27
+ static isCallToAction(type) {
28
+ return TemplateItemButton.isPhoneNumber(type) || TemplateItemButton.isURL(type);
29
+ }
30
+
31
+ static isQuickReply(type) {
32
+ return type === TemplateItemButtonType.QUICK_REPLY;
33
+ }
34
+
35
+ static isOTP(type) {
36
+ return type === TemplateItemButtonType.OTP;
37
+ }
38
+
39
+ static isCatalog(type) {
40
+ return type === TemplateItemButtonType.CATALOG;
41
+ }
42
+
43
+ toJSON() {
44
+ return { ...this.data
45
+ };
46
+ }
47
+
48
+ }
@@ -0,0 +1,27 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { TemplateItemFooterType } from '../../enum';
3
+ import { TemplateItemFooterSchema } from '../../schema';
4
+ export default class TemplateItemFooter {
5
+ constructor() {
6
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ const validatedData = validateSchema({
8
+ schema: TemplateItemFooterSchema,
9
+ data,
10
+ entityName: 'TemplateItemFooter'
11
+ });
12
+ this.data = {
13
+ type: validatedData.type,
14
+ message: validatedData.message
15
+ };
16
+ }
17
+
18
+ static isText(type) {
19
+ return type === TemplateItemFooterType.TEXT;
20
+ }
21
+
22
+ toJSON() {
23
+ return { ...this.data
24
+ };
25
+ }
26
+
27
+ }
@@ -0,0 +1,48 @@
1
+ import { validateSchema } from '../../../core/utils';
2
+ import { TemplateItemHeaderType } from '../../enum';
3
+ import { TemplateItemHeaderSchema } from '../../schema';
4
+ export default class TemplateItemHeader {
5
+ constructor() {
6
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ const validatedData = validateSchema({
8
+ schema: TemplateItemHeaderSchema,
9
+ data,
10
+ entityName: 'TemplateItemHeader'
11
+ });
12
+ this.data = {
13
+ type: validatedData.type,
14
+ message: validatedData.message,
15
+ attachment: validatedData.attachment
16
+ };
17
+ }
18
+
19
+ static isNone(type) {
20
+ return type === TemplateItemHeaderType.NONE;
21
+ }
22
+
23
+ static isText(type) {
24
+ return type === TemplateItemHeaderType.TEXT;
25
+ }
26
+
27
+ static isImage(type) {
28
+ return type === TemplateItemHeaderType.IMAGE;
29
+ }
30
+
31
+ static isVideo(type) {
32
+ return type === TemplateItemHeaderType.VIDEO;
33
+ }
34
+
35
+ static isDocument(type) {
36
+ return type === TemplateItemHeaderType.DOCUMENT;
37
+ }
38
+
39
+ static isMedia(type) {
40
+ return TemplateItemHeader.isImage(type) || TemplateItemHeader.isVideo(type) || TemplateItemHeader.isDocument(type);
41
+ }
42
+
43
+ toJSON() {
44
+ return { ...this.data
45
+ };
46
+ }
47
+
48
+ }
@@ -1,3 +1,6 @@
1
1
  import TemplateLanguage from './TemplateLanguage';
2
2
  import TemplateCreditExhaustStatus from './TemplateCreditExhaustStatus';
3
- export { TemplateLanguage, TemplateCreditExhaustStatus };
3
+ import TemplateItemButton from './TemplateItemButton';
4
+ import TemplateItemHeader from './TemplateItemHeader';
5
+ import TemplateItemFooter from './TemplateItemFooter';
6
+ export { TemplateLanguage, TemplateCreditExhaustStatus, TemplateItemButton, TemplateItemHeader, TemplateItemFooter };
@@ -9,4 +9,5 @@ export * from './Contact';
9
9
  export * from './IntegrationService';
10
10
  export * from './CannedMessage';
11
11
  export * from './TemplateMessage';
12
- export * from './CustomReplyExtension';
12
+ export * from './CustomReplyExtension';
13
+ export * from './Placeholder';
@@ -6,6 +6,7 @@ const TemplateItemButtonType = {
6
6
  CATALOG: 'CATALOG',
7
7
  MPM: 'MPM',
8
8
  CALL_PERMISSION_REQUEST: 'CALL_PERMISSION_REQUEST',
9
- VOICE_CALL: 'VOICE_CALL'
9
+ VOICE_CALL: 'VOICE_CALL',
10
+ NONE: 'NONE'
10
11
  };
11
12
  export default TemplateItemButtonType;
@@ -1,6 +1,8 @@
1
1
  const TemplateItemHeaderType = {
2
- IMAGE: 'IMAGE',
2
+ NONE: 'NONE',
3
3
  TEXT: 'TEXT',
4
+ MEDIA: 'MEDIA',
5
+ IMAGE: 'IMAGE',
4
6
  VIDEO: 'VIDEO',
5
7
  DOCUMENT: 'DOCUMENT'
6
8
  };
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import { ModuleNames } from '../../../../core/constants';
3
3
  import BaseAPI from '../../../../infrastructure/api/BaseAPI';
4
- import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, disableCannedMessageRequest, enableCannedMessageRequest, addTranslationRequest, updateTranslationRequest, deleteTranslationRequest } from '../../../dto';
4
+ import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, disableCannedMessageRequest, enableCannedMessageRequest, addTranslationRequest, updateTranslationRequest, deleteTranslationRequest, getCannedPlaceholdersRequest } from '../../../dto';
5
5
  export default class ICannedMessageRepository extends BaseAPI {
6
6
  constructor() {
7
7
  super({
@@ -59,4 +59,9 @@ export default class ICannedMessageRepository extends BaseAPI {
59
59
  throw new Error('Method not implemented.');
60
60
  }
61
61
 
62
+ getCannedPlaceholders() {
63
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCannedPlaceholdersRequest();
64
+ throw new Error('Method not implemented.');
65
+ }
66
+
62
67
  }
@@ -11,7 +11,7 @@ const TemplateItemButtonsSchema = {
11
11
  },
12
12
  action: {
13
13
  type: 'string',
14
- required: true
14
+ required: false
15
15
  }
16
16
  };
17
17
  export default TemplateItemButtonsSchema;
@@ -1,3 +1,4 @@
1
1
  import CannedMessageSchema from './CannedMessageSchema';
2
2
  import TranslationsSchema from './TranslationsSchema';
3
+ export * from './TemplateItem';
3
4
  export { CannedMessageSchema, TranslationsSchema };
@@ -8,4 +8,5 @@ export * from './integrationService';
8
8
  export * from './contact';
9
9
  export * from './cannedMessage';
10
10
  export * from './templateMessage';
11
- export * from './customReplyExtension';
11
+ export * from './customReplyExtension';
12
+ export * from './placeholder';
@@ -0,0 +1,19 @@
1
+ const PlaceholderSchema = {
2
+ apiName: {
3
+ type: 'string',
4
+ required: false
5
+ },
6
+ i18nFieldLabel: {
7
+ type: 'string',
8
+ required: true
9
+ },
10
+ fieldLabel: {
11
+ type: 'string',
12
+ required: true
13
+ },
14
+ placeHolder: {
15
+ type: 'string',
16
+ required: true
17
+ }
18
+ };
19
+ export default PlaceholderSchema;
@@ -0,0 +1,2 @@
1
+ import PlaceholderSchema from './PlaceholderSchema';
2
+ export { PlaceholderSchema };
@@ -1,5 +1,5 @@
1
1
  import { AdapterError } from '../../../core/errors';
2
- import { CannedMessage } from '../../../domain/entities';
2
+ import { CannedMessage, Translation } from '../../../domain/entities';
3
3
  import { IAdapter } from '../../../domain/interfaces';
4
4
  export default class CannedMessageAdapter extends IAdapter {
5
5
  adapt(cannedMessageData) {
@@ -8,6 +8,7 @@ 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;
11
12
  return new CannedMessage({
12
13
  id: cannedMessageData.id,
13
14
  title: cannedMessageData.title,
@@ -19,7 +20,7 @@ export default class CannedMessageAdapter extends IAdapter {
19
20
  createdBy: cannedMessageData.createdBy,
20
21
  isActive: cannedMessageData.isActive,
21
22
  isPrivate: cannedMessageData.isPrivate,
22
- translations: cannedMessageData.translations,
23
+ translations,
23
24
  uuid: cannedMessageData.uuid,
24
25
  meta: cannedMessageData.meta,
25
26
  rejectedReason: cannedMessageData.rejectedReason,
@@ -0,0 +1,27 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { Translation } from '../../../domain/entities';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class TranslationAdapter extends IAdapter {
5
+ adapt(translationData) {
6
+ if (!translationData) {
7
+ throw new AdapterError('Translation data is required');
8
+ }
9
+
10
+ try {
11
+ return new Translation({
12
+ id: translationData.id,
13
+ language: translationData.language,
14
+ message: translationData.message,
15
+ displayMessage: translationData.displayMessage,
16
+ uuid: translationData.uuid,
17
+ status: translationData.status,
18
+ modifiedTime: translationData.modifiedTime,
19
+ failedReason: translationData.failedReason,
20
+ templateItems: translationData.templateItems
21
+ }).toJSON();
22
+ } catch (error) {
23
+ throw new AdapterError(`Failed to adapt translation: ${error.message}`);
24
+ }
25
+ }
26
+
27
+ }
@@ -1,2 +1,3 @@
1
1
  import CannedMessageAdapter from './CannedMessageAdapter';
2
- export { CannedMessageAdapter };
2
+ import TranslationAdapter from './TranslationAdapter';
3
+ export { CannedMessageAdapter, TranslationAdapter };
@@ -7,4 +7,5 @@ export * from './agents';
7
7
  export * from './contacts';
8
8
  export * from './cannedMessages';
9
9
  export * from './templateMessages';
10
- export * from './customReplyExtension';
10
+ export * from './customReplyExtension';
11
+ export * from './placeholders';
@@ -0,0 +1,22 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { Placeholder } from '../../../domain/entities/Placeholder';
3
+ import { IAdapter } from '../../../domain/interfaces';
4
+ export default class PlaceholderAdapter extends IAdapter {
5
+ adapt(placeholderData) {
6
+ if (!placeholderData) {
7
+ throw new AdapterError('Placeholder data is required');
8
+ }
9
+
10
+ try {
11
+ return new Placeholder({
12
+ apiName: placeholderData.apiName,
13
+ i18nFieldLabel: placeholderData.i18nFieldLabel,
14
+ fieldLabel: placeholderData.fieldLabel,
15
+ placeHolder: placeholderData.placeHolder
16
+ }).toJSON();
17
+ } catch (error) {
18
+ throw new AdapterError(`Failed to adapt placeholder: ${error.message}`);
19
+ }
20
+ }
21
+
22
+ }
@@ -0,0 +1,2 @@
1
+ import PlaceholderAdapter from './PlaceholderAdapter';
2
+ export { PlaceholderAdapter };
@@ -1,4 +1,4 @@
1
- import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest, addTranslationRequest, updateTranslationRequest, deleteTranslationRequest } from '../../../domain/dto';
1
+ import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest, addTranslationRequest, updateTranslationRequest, deleteTranslationRequest, getCannedPlaceholdersRequest } from '../../../domain/dto';
2
2
  import { ICannedMessageRepository } from '../../../domain/interfaces/repositories';
3
3
  export default class CannedMessageAPI extends ICannedMessageRepository {
4
4
  async getCannedMessages() {
@@ -101,4 +101,14 @@ export default class CannedMessageAPI extends ICannedMessageRepository {
101
101
  return httpRequest;
102
102
  }
103
103
 
104
+ async getCannedPlaceholders() {
105
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getCannedPlaceholdersRequest();
106
+ const operation = 'getCannedPlaceholders';
107
+ const httpRequest = await this.request({
108
+ operation,
109
+ request
110
+ });
111
+ return httpRequest;
112
+ }
113
+
104
114
  }
@@ -1,5 +1,5 @@
1
1
  import { HTTP_METHODS } from '../../../../core/constants';
2
- import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest, addTranslationRequest, updateTranslationRequest, deleteTranslationRequest } from '../../../../domain/dto';
2
+ import { getCannedMessageRequest, getCannedMessagesRequest, createCannedMessageRequest, updateCannedMessageRequest, deleteCannedMessageRequest, enableCannedMessageRequest, disableCannedMessageRequest, addTranslationRequest, updateTranslationRequest, deleteTranslationRequest, getCannedPlaceholdersRequest } from '../../../../domain/dto';
3
3
  import constructCannedMessageEndPoint from './constructCannedMessageEndPoint';
4
4
  import createAPIRegistry from '../createAPIRegistry';
5
5
 
@@ -43,6 +43,10 @@ function deleteTranslation() {
43
43
  return createAPIRegistry(constructCannedMessageEndPoint('/:cannedMessageId/translations/:translationId'), HTTP_METHODS.DELETE, deleteTranslationRequest());
44
44
  }
45
45
 
46
+ function getCannedPlaceholders() {
47
+ return createAPIRegistry(constructCannedMessageEndPoint('/placeholders'), HTTP_METHODS.GET, getCannedPlaceholdersRequest());
48
+ }
49
+
46
50
  export default {
47
51
  getCannedMessage,
48
52
  getCannedMessages,
@@ -53,5 +57,6 @@ export default {
53
57
  disableCannedMessage,
54
58
  addTranslation,
55
59
  updateTranslation,
56
- deleteTranslation
60
+ deleteTranslation,
61
+ getCannedPlaceholders
57
62
  };
@@ -1,4 +1,4 @@
1
- import { CannedMessageAdapter } from '../../adapters';
1
+ import { CannedMessageAdapter, PlaceholderAdapter, TranslationAdapter } from '../../adapters';
2
2
  import { CannedMessageAPI } from '../../api';
3
3
  import { ICannedMessageRepository } from '../../../domain/interfaces/repositories/cannedMessages';
4
4
  import { ResponseTypes } from '../../../core/constants';
@@ -6,13 +6,16 @@ export default class CannedMessageRepository extends ICannedMessageRepository {
6
6
  constructor(_ref) {
7
7
  let {
8
8
  cannedMessageAPI,
9
- cannedMessageAdapter
9
+ cannedMessageAdapter,
10
+ placeholderAdapter
10
11
  } = _ref;
11
12
  super();
12
13
  this.defaultAPI = new CannedMessageAPI();
13
14
  this.customAPI = cannedMessageAPI;
14
15
  this.cannedMessageAPI = this.createAPIProxy(this.customAPI, this.defaultAPI);
15
16
  this.cannedMessageAdapter = cannedMessageAdapter || new CannedMessageAdapter();
17
+ this.translationAdapter = new TranslationAdapter();
18
+ this.placeholderAdapter = placeholderAdapter || new PlaceholderAdapter();
16
19
  }
17
20
 
18
21
  async invokeAPI(_ref2) {
@@ -88,14 +91,16 @@ export default class CannedMessageRepository extends ICannedMessageRepository {
88
91
  async addTranslation(request) {
89
92
  return this.invokeAPI({
90
93
  operation: 'addTranslation',
91
- request
94
+ request,
95
+ adapter: this.translationAdapter
92
96
  });
93
97
  }
94
98
 
95
99
  async updateTranslation(request) {
96
100
  return this.invokeAPI({
97
101
  operation: 'updateTranslation',
98
- request
102
+ request,
103
+ adapter: this.translationAdapter
99
104
  });
100
105
  }
101
106
 
@@ -107,6 +112,15 @@ export default class CannedMessageRepository extends ICannedMessageRepository {
107
112
  });
108
113
  }
109
114
 
115
+ async getCannedPlaceholders(request) {
116
+ return this.invokeAPI({
117
+ operation: 'getCannedPlaceholders',
118
+ request,
119
+ adapter: this.placeholderAdapter,
120
+ responseType: ResponseTypes.LIST
121
+ });
122
+ }
123
+
110
124
  toJSON() {
111
125
  return {
112
126
  getCannedMessages: this.getCannedMessages.bind(this),
@@ -118,7 +132,8 @@ export default class CannedMessageRepository extends ICannedMessageRepository {
118
132
  disableCannedMessage: this.disableCannedMessage.bind(this),
119
133
  addTranslation: this.addTranslation.bind(this),
120
134
  updateTranslation: this.updateTranslation.bind(this),
121
- deleteTranslation: this.deleteTranslation.bind(this)
135
+ deleteTranslation: this.deleteTranslation.bind(this),
136
+ getCannedPlaceholders: this.getCannedPlaceholders.bind(this)
122
137
  };
123
138
  }
124
139
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohoim/client-sdk",
3
- "version": "1.0.0-canned05",
3
+ "version": "1.0.0-canned08",
4
4
  "description": "To have the client sdk for the IM",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",