@zohoim/client-sdk 1.0.0-poc2 → 1.0.0-poc21

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 (94) hide show
  1. package/es/config/urls/bots/bots-api-url.js +11 -0
  2. package/es/config/urls/bots/index.js +2 -0
  3. package/es/config/urls/channels/channel-agents-api-url.js +11 -0
  4. package/es/config/urls/channels/index.js +2 -0
  5. package/es/config/urls/sessions/index.js +2 -0
  6. package/es/config/urls/sessions/sessions-api-url.js +12 -0
  7. package/es/core/constants/HttpMethods.js +8 -0
  8. package/es/core/constants/ModuleNames.js +6 -0
  9. package/es/core/constants/index.js +4 -0
  10. package/es/core/errors/AdapterError.js +7 -0
  11. package/es/core/errors/index.js +3 -0
  12. package/es/core/utils/index.js +2 -0
  13. package/es/core/utils/validateSchema.js +68 -0
  14. package/es/domain/entities/Actor/Actor.js +23 -0
  15. package/es/domain/entities/Actor/index.js +2 -2
  16. package/es/domain/entities/Agent/Agent.js +13 -102
  17. package/es/domain/entities/Agent/index.js +1 -1
  18. package/es/domain/entities/Bot/Bot.js +23 -0
  19. package/es/domain/entities/Bot/index.js +2 -0
  20. package/es/domain/entities/Session/Session.js +36 -0
  21. package/es/domain/entities/Session/index.js +2 -0
  22. package/es/domain/entities/index.js +3 -1
  23. package/es/domain/enum/actor/index.js +2 -0
  24. package/es/domain/enum/bot/BotServiceType.js +5 -0
  25. package/es/domain/enum/bot/index.js +2 -0
  26. package/es/domain/enum/index.js +4 -0
  27. package/es/domain/enum/integrationServices/IntegrationServices.js +11 -0
  28. package/es/domain/enum/integrationServices/index.js +2 -0
  29. package/es/domain/enum/session/SessionReplyStatus.js +20 -0
  30. package/es/domain/enum/session/SessionStatus.js +9 -0
  31. package/es/domain/enum/session/index.js +3 -0
  32. package/es/domain/interfaces/BaseAPI.js +63 -0
  33. package/es/domain/interfaces/bots/IBot.js +10 -0
  34. package/es/domain/interfaces/bots/index.js +2 -0
  35. package/es/domain/interfaces/channels/IChannelAgent.js +6 -2
  36. package/es/domain/interfaces/index.js +3 -1
  37. package/es/domain/interfaces/sessions/ISession.js +10 -0
  38. package/es/domain/interfaces/sessions/index.js +2 -0
  39. package/es/domain/schema/actor/ActorSchema.js +33 -0
  40. package/es/domain/schema/actor/AgentSchema.js +29 -0
  41. package/es/domain/schema/actor/index.js +3 -0
  42. package/es/domain/schema/bot/BotSchema.js +33 -0
  43. package/es/domain/schema/bot/index.js +2 -0
  44. package/es/domain/schema/index.js +3 -0
  45. package/es/domain/schema/session/SessionSchema.js +86 -0
  46. package/es/domain/schema/session/index.js +2 -0
  47. package/es/domain/services/bots/BotService.js +31 -0
  48. package/es/domain/services/bots/index.js +2 -0
  49. package/es/domain/services/channels/ChannelAgentService.js +23 -6
  50. package/es/domain/services/index.js +3 -1
  51. package/es/domain/services/sessions/SessionService.js +31 -0
  52. package/es/domain/services/sessions/index.js +2 -0
  53. package/es/index.js +8 -1
  54. package/es/infrastructure/adapters/BaseAdapter.js +23 -0
  55. package/es/infrastructure/adapters/bots/BotAdapter.js +25 -0
  56. package/es/infrastructure/adapters/bots/index.js +2 -0
  57. package/es/infrastructure/adapters/channels/ChannelAgentAdapter.js +35 -0
  58. package/es/infrastructure/adapters/channels/index.js +2 -0
  59. package/es/infrastructure/adapters/index.js +3 -0
  60. package/es/infrastructure/adapters/sessions/SessionAdapter.js +37 -0
  61. package/es/infrastructure/adapters/sessions/index.js +2 -0
  62. package/es/infrastructure/api/bots/BotAPI.js +22 -0
  63. package/es/infrastructure/api/bots/index.js +2 -0
  64. package/es/infrastructure/api/channels/ChannelAgentAPI.js +22 -0
  65. package/es/infrastructure/api/channels/index.js +2 -0
  66. package/es/infrastructure/api/index.js +3 -0
  67. package/es/infrastructure/api/sessions/SessionAPI.js +22 -0
  68. package/es/infrastructure/api/sessions/index.js +2 -0
  69. package/es/infrastructure/interfaces/api/bots/GetBotsRequest.js +14 -0
  70. package/es/infrastructure/interfaces/api/bots/index.js +2 -0
  71. package/es/infrastructure/interfaces/api/channels/agents/GetChannelAgentsRequest.js +13 -0
  72. package/es/infrastructure/interfaces/api/channels/agents/index.js +2 -0
  73. package/es/infrastructure/interfaces/api/channels/index.js +1 -0
  74. package/es/infrastructure/interfaces/api/index.js +3 -0
  75. package/es/infrastructure/interfaces/api/sessions/UpdateSessionAssigneeRequest.js +12 -0
  76. package/es/infrastructure/interfaces/api/sessions/index.js +2 -0
  77. package/es/infrastructure/interfaces/index.js +1 -0
  78. package/es/infrastructure/managers/ModuleFactory.js +31 -0
  79. package/es/infrastructure/managers/ModuleManager.js +44 -0
  80. package/es/infrastructure/managers/index.js +2 -0
  81. package/es/infrastructure/sdk/IMSDK.js +47 -0
  82. package/es/infrastructure/sdk/bots/BotSDK.js +20 -0
  83. package/es/infrastructure/sdk/bots/index.js +2 -0
  84. package/es/infrastructure/sdk/channels/ChannelSDK.js +23 -0
  85. package/es/infrastructure/sdk/channels/index.js +2 -0
  86. package/es/infrastructure/sdk/config/configRegistry.js +27 -0
  87. package/es/infrastructure/sdk/config/index.js +2 -0
  88. package/es/infrastructure/sdk/index.js +2 -0
  89. package/es/infrastructure/sdk/sessions/SessionSDK.js +20 -0
  90. package/es/infrastructure/sdk/sessions/index.js +2 -0
  91. package/package.json +1 -7
  92. package/es/domain/index.js +0 -3
  93. /package/es/{domain → core}/errors/ValidationError.js +0 -0
  94. /package/es/domain/{entities/Actor → enum/actor}/ActorType.js +0 -0
@@ -0,0 +1,33 @@
1
+ import { BotServiceType } from '../../enum';
2
+ const BotSchema = {
3
+ id: {
4
+ type: 'string',
5
+ required: true
6
+ },
7
+ botServiceType: {
8
+ type: 'string',
9
+ required: true,
10
+ enum: [BotServiceType.DESK_GC_BOT, BotServiceType.DESK_ZIA_BOT]
11
+ },
12
+ name: {
13
+ type: 'string',
14
+ required: true
15
+ },
16
+ isActive: {
17
+ type: 'boolean',
18
+ required: true
19
+ },
20
+ createdTime: {
21
+ type: 'string',
22
+ required: true
23
+ },
24
+ logoURL: {
25
+ type: 'string',
26
+ required: true
27
+ },
28
+ createdBy: {
29
+ type: 'string',
30
+ required: true
31
+ }
32
+ };
33
+ export default BotSchema;
@@ -0,0 +1,2 @@
1
+ import BotSchema from './BotSchema';
2
+ export { BotSchema };
@@ -0,0 +1,3 @@
1
+ export * from './actor';
2
+ export * from './session';
3
+ export * from './bot';
@@ -0,0 +1,86 @@
1
+ import { IntegrationServices, SessionReplyStatus, SessionStatus } from '../../enum';
2
+ import { ActorSchema } from '../actor';
3
+ const SessionSchema = {
4
+ channelId: {
5
+ type: 'string',
6
+ required: true
7
+ },
8
+ status: {
9
+ type: 'string',
10
+ required: true,
11
+ enum: Object.values(SessionStatus)
12
+ },
13
+ createdTime: {
14
+ type: 'string',
15
+ required: true
16
+ },
17
+ agentId: {
18
+ type: 'string',
19
+ required: false
20
+ },
21
+ botId: {
22
+ type: 'string',
23
+ required: false
24
+ },
25
+ actor: {
26
+ type: 'object',
27
+ required: true,
28
+ schema: ActorSchema
29
+ },
30
+ subject: {
31
+ type: 'string',
32
+ required: true
33
+ },
34
+ messagesCount: {
35
+ type: 'string',
36
+ required: true
37
+ },
38
+ agentLastActiveTime: {
39
+ type: 'string',
40
+ required: true
41
+ },
42
+ contactLastActiveTime: {
43
+ type: 'string',
44
+ required: true
45
+ },
46
+ lastActiveTime: {
47
+ type: 'string',
48
+ required: true
49
+ },
50
+ unreadMessagesCount: {
51
+ type: 'string',
52
+ required: true
53
+ },
54
+ integrationServiceId: {
55
+ type: 'string',
56
+ required: true,
57
+ enum: Object.values(IntegrationServices)
58
+ },
59
+ replyStatus: {
60
+ type: 'string',
61
+ required: true,
62
+ enum: Object.values(SessionReplyStatus)
63
+ },
64
+ id: {
65
+ type: 'string',
66
+ required: true
67
+ },
68
+ contactId: {
69
+ type: 'string',
70
+ required: true
71
+ },
72
+ meta: {
73
+ type: 'array',
74
+ required: false
75
+ },
76
+ assignee: {
77
+ type: 'object',
78
+ required: false,
79
+ schema: ActorSchema
80
+ },
81
+ channel: {
82
+ type: 'string',
83
+ required: true
84
+ }
85
+ };
86
+ export default SessionSchema;
@@ -0,0 +1,2 @@
1
+ import SessionSchema from './SessionSchema';
2
+ export { SessionSchema };
@@ -0,0 +1,31 @@
1
+ import { BOTS_API_URLS } from '../../../config/urls/bots';
2
+ import { BotAdapter } from '../../../infrastructure/adapters';
3
+ import { BotAPI } from '../../../infrastructure/api';
4
+ import { GetBotsRequest } from '../../../infrastructure/interfaces/api';
5
+ import { IBot } from '../../interfaces';
6
+ export default class BotService extends IBot {
7
+ constructor(_ref) {
8
+ let {
9
+ botAPI,
10
+ botAdapter
11
+ } = _ref;
12
+ super();
13
+ this.botAPI = botAPI || new BotAPI({
14
+ urlConfig: BOTS_API_URLS
15
+ });
16
+ this.botAdapter = botAdapter || new BotAdapter();
17
+ }
18
+
19
+ async getBots() {
20
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : GetBotsRequest;
21
+ const bots = await this.botAPI.getBots(request);
22
+ return bots.map(this.botAdapter.adapt);
23
+ }
24
+
25
+ toJSON() {
26
+ return {
27
+ getBots: this.getBots.bind(this)
28
+ };
29
+ }
30
+
31
+ }
@@ -0,0 +1,2 @@
1
+ import BotService from './BotService';
2
+ export { BotService };
@@ -1,14 +1,31 @@
1
- import IChannelAgent from '../../interfaces/channels/IChannelAgent';
1
+ import { CHANNEL_AGENTS_API_URLS } from '../../../config/urls/channels';
2
+ import { ChannelAgentAdapter } from '../../../infrastructure/adapters';
3
+ import { ChannelAgentAPI } from '../../../infrastructure/api';
4
+ import { GetChannelAgentsRequest } from '../../../infrastructure/interfaces/api';
5
+ import { IChannelAgent } from '../../interfaces';
2
6
  export default class ChannelAgentService extends IChannelAgent {
3
- constructor(channelAPI, channelAgentAdapter) {
7
+ constructor(_ref) {
8
+ let {
9
+ channelAgentAPI,
10
+ channelAgentAdapter
11
+ } = _ref;
4
12
  super();
5
- this.channelAPI = channelAPI;
6
- this.channelAgentAdapter = channelAgentAdapter;
13
+ this.channelAgentAPI = channelAgentAPI || new ChannelAgentAPI({
14
+ urlConfig: CHANNEL_AGENTS_API_URLS
15
+ });
16
+ this.channelAgentAdapter = channelAgentAdapter || new ChannelAgentAdapter();
7
17
  }
8
18
 
9
- async getChannelAgents() {
10
- const channelAgents = await this.channelAPI.getChannelAgents();
19
+ async getAgents() {
20
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : GetChannelAgentsRequest;
21
+ const channelAgents = await this.channelAgentAPI.getAgents(request);
11
22
  return channelAgents.map(this.channelAgentAdapter.adapt);
12
23
  }
13
24
 
25
+ toJSON() {
26
+ return {
27
+ getAgents: this.getAgents.bind(this)
28
+ };
29
+ }
30
+
14
31
  }
@@ -1 +1,3 @@
1
- export * from './channels';
1
+ export * from './channels';
2
+ export * from './sessions';
3
+ export * from './bots';
@@ -0,0 +1,31 @@
1
+ import { SESSIONS_API_URLS } from '../../../config/urls/sessions';
2
+ import { SessionAdapter } from '../../../infrastructure/adapters';
3
+ import { SessionAPI } from '../../../infrastructure/api';
4
+ import { UpdateSessionAssigneeRequest } from '../../../infrastructure/interfaces/api';
5
+ import { ISession } from '../../interfaces';
6
+ export default class SessionService extends ISession {
7
+ constructor(_ref) {
8
+ let {
9
+ sessionAPI,
10
+ sessionAdapter
11
+ } = _ref;
12
+ super();
13
+ this.sessionAPI = sessionAPI || new SessionAPI({
14
+ urlConfig: SESSIONS_API_URLS
15
+ });
16
+ this.sessionAdapter = sessionAdapter || new SessionAdapter();
17
+ }
18
+
19
+ async updateAssignee() {
20
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : UpdateSessionAssigneeRequest;
21
+ const session = await this.sessionAPI.updateAssignee(request);
22
+ return this.sessionAdapter.adapt(session);
23
+ }
24
+
25
+ toJSON() {
26
+ return {
27
+ updateAssignee: this.updateAssignee.bind(this)
28
+ };
29
+ }
30
+
31
+ }
@@ -0,0 +1,2 @@
1
+ import SessionService from './SessionService';
2
+ export { SessionService };
package/es/index.js CHANGED
@@ -1 +1,8 @@
1
- export * from './domain';
1
+ export * from './domain/entities';
2
+ export * from './domain/enum';
3
+ export * from './domain/interfaces';
4
+ export * from './domain/services';
5
+ export * from './infrastructure/sdk';
6
+ export * from './infrastructure/adapters';
7
+ export * from './infrastructure/api';
8
+ export * from './infrastructure/interfaces/api';
@@ -0,0 +1,23 @@
1
+ import { AdapterError } from '../../core/errors';
2
+ /**
3
+ * Base adapter class that defines the contract for all adapters
4
+ * @abstract
5
+ */
6
+
7
+ export default class BaseAdapter {
8
+ /**
9
+ * Adapts the input data to required format
10
+ * @param {*} data - Data to adapt
11
+ * @throws {AdapterError} When method is not implemented
12
+ */
13
+ adapt(data) {
14
+ if (this.constructor === BaseAdapter) {
15
+ throw new AdapterError(`${this.constructor.name}: adapt() must be implemented by subclass`);
16
+ }
17
+
18
+ if (!data) {
19
+ throw new AdapterError(`${this.constructor.name}: data parameter is required`);
20
+ }
21
+ }
22
+
23
+ }
@@ -0,0 +1,25 @@
1
+ import { AdapterError } from '../../../core/errors';
2
+ import { Bot } from '../../../domain/entities';
3
+ import BaseAdapter from '../BaseAdapter';
4
+ export default class BotAdapter extends BaseAdapter {
5
+ static adapt(botData) {
6
+ if (!botData) {
7
+ throw new AdapterError('Bot data is required');
8
+ }
9
+
10
+ try {
11
+ return new Bot({
12
+ id: botData.id,
13
+ botServiceType: botData.botService.id,
14
+ name: botData.name,
15
+ isActive: botData.isActive,
16
+ createdTime: botData.createdTime,
17
+ logoURL: botData.logoURL,
18
+ createdBy: botData.createdBy
19
+ }).toJSON();
20
+ } catch (error) {
21
+ throw new AdapterError(`Failed to adapt bot: ${error.message}`);
22
+ }
23
+ }
24
+
25
+ }
@@ -0,0 +1,2 @@
1
+ import BotAdapter from './BotAdapter';
2
+ export { BotAdapter };
@@ -0,0 +1,35 @@
1
+ import BaseAdapter from '../BaseAdapter';
2
+ import { AdapterError } from '../../../core/errors';
3
+ import { Agent } from '../../../domain/entities';
4
+ /**
5
+ * Adapter for Channel Agent data
6
+ * @extends BaseAdapter
7
+ */
8
+
9
+ export default class ChannelAgentAdapter extends BaseAdapter {
10
+ /**
11
+ * Adapts channel agent data to Agent entity
12
+ * @param {Object} channelAgent - Channel agent data to adapt
13
+ * @returns {Object} Adapted agent data
14
+ * @throws {AdapterError} When adaptation fails
15
+ */
16
+ static adapt(channelAgent) {
17
+ if (!channelAgent) {
18
+ throw new AdapterError('Channel agent data is required');
19
+ }
20
+
21
+ try {
22
+ return new Agent({
23
+ id: channelAgent.id,
24
+ name: channelAgent.name,
25
+ email: channelAgent.email,
26
+ photoURL: channelAgent.photoURL || '',
27
+ zuid: channelAgent.zuid,
28
+ type: channelAgent.type
29
+ }).toJSON();
30
+ } catch (error) {
31
+ throw new AdapterError(`Failed to adapt channel agent: ${error.message}`);
32
+ }
33
+ }
34
+
35
+ }
@@ -0,0 +1,2 @@
1
+ import ChannelAgentAdapter from './ChannelAgentAdapter';
2
+ export { ChannelAgentAdapter };
@@ -0,0 +1,3 @@
1
+ export * from './channels';
2
+ export * from './sessions';
3
+ export * from './bots';
@@ -0,0 +1,37 @@
1
+ import BaseAdapter from '../BaseAdapter';
2
+ import { AdapterError } from '../../../core/errors';
3
+ import { Session } from '../../../domain/entities';
4
+ export default class SessionAdapter extends BaseAdapter {
5
+ static adapt(sessionData) {
6
+ if (!sessionData) {
7
+ throw new AdapterError('Session data is required');
8
+ }
9
+
10
+ try {
11
+ return new Session({
12
+ id: sessionData.id,
13
+ channelId: sessionData.channelId,
14
+ status: sessionData.status,
15
+ createdTime: sessionData.createdTime,
16
+ agentId: sessionData.agentId,
17
+ botId: sessionData.botId,
18
+ actor: sessionData.actor,
19
+ subject: sessionData.subject,
20
+ messagesCount: sessionData.messagesCount,
21
+ agentLastActiveTime: sessionData.agentLastActiveTime,
22
+ contactLastActiveTime: sessionData.contactLastActiveTime,
23
+ lastActiveTime: sessionData.lastActiveTime,
24
+ unreadMessagesCount: sessionData.unreadMessagesCount,
25
+ integrationServiceId: sessionData.integrationServiceId,
26
+ replyStatus: sessionData.replyStatus,
27
+ contactId: sessionData.contactId,
28
+ meta: sessionData.meta,
29
+ assignee: sessionData.assignee,
30
+ channel: sessionData.channel
31
+ }).toJSON();
32
+ } catch (error) {
33
+ throw new AdapterError(`Failed to adapt session: ${error.message}`);
34
+ }
35
+ }
36
+
37
+ }
@@ -0,0 +1,2 @@
1
+ import SessionAdapter from './SessionAdapter';
2
+ export { SessionAdapter };
@@ -0,0 +1,22 @@
1
+ import { IBot } from '../../../domain/interfaces';
2
+ import { GetBotsRequest } from '../../interfaces/api';
3
+ export default class BotAPI extends IBot {
4
+ constructor(_ref) {
5
+ let {
6
+ urlConfig
7
+ } = _ref;
8
+ super();
9
+ this.urlConfig = urlConfig;
10
+ }
11
+
12
+ async getBots() {
13
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : GetBotsRequest;
14
+ const urlConfig = this.urlConfig.LIST;
15
+ const httpRequest = await this.request({
16
+ urlConfig,
17
+ request
18
+ });
19
+ return httpRequest;
20
+ }
21
+
22
+ }
@@ -0,0 +1,2 @@
1
+ import BotAPI from './BotAPI';
2
+ export { BotAPI };
@@ -0,0 +1,22 @@
1
+ import IChannelAgent from '../../../domain/interfaces/channels/IChannelAgent';
2
+ import { GetChannelAgentsRequest } from '../../interfaces/api';
3
+ export default class ChannelAgentAPI extends IChannelAgent {
4
+ constructor(_ref) {
5
+ let {
6
+ urlConfig
7
+ } = _ref;
8
+ super();
9
+ this.urlConfig = urlConfig;
10
+ }
11
+
12
+ async getAgents() {
13
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : GetChannelAgentsRequest;
14
+ const urlConfig = this.urlConfig.LIST;
15
+ const httpRequest = await this.request({
16
+ urlConfig,
17
+ request
18
+ });
19
+ return httpRequest;
20
+ }
21
+
22
+ }
@@ -0,0 +1,2 @@
1
+ import ChannelAgentAPI from './ChannelAgentAPI';
2
+ export { ChannelAgentAPI };
@@ -0,0 +1,3 @@
1
+ export * from './channels';
2
+ export * from './sessions';
3
+ export * from './bots';
@@ -0,0 +1,22 @@
1
+ import { ISession } from '../../../domain/interfaces';
2
+ import { UpdateSessionAssigneeRequest } from '../../interfaces/api';
3
+ export default class SessionAPI extends ISession {
4
+ constructor(_ref) {
5
+ let {
6
+ urlConfig
7
+ } = _ref;
8
+ super();
9
+ this.urlConfig = urlConfig;
10
+ }
11
+
12
+ async updateAssignee() {
13
+ let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : UpdateSessionAssigneeRequest;
14
+ const urlConfig = this.urlConfig.UPDATE_SESSION_ASSIGNEE;
15
+ const httpRequest = await this.request({
16
+ urlConfig,
17
+ request
18
+ });
19
+ return httpRequest;
20
+ }
21
+
22
+ }
@@ -0,0 +1,2 @@
1
+ import SessionAPI from './SessionAPI';
2
+ export { SessionAPI };
@@ -0,0 +1,14 @@
1
+ const params = {};
2
+ const query = {
3
+ from: 0,
4
+ limit: 10,
5
+ modifiedAfter: null,
6
+ botServiceId: null,
7
+ externalAccountId: null,
8
+ searchStr: null
9
+ };
10
+ const GetBotsRequest = {
11
+ params,
12
+ query
13
+ };
14
+ export default GetBotsRequest;
@@ -0,0 +1,2 @@
1
+ import GetBotsRequest from './GetBotsRequest';
2
+ export { GetBotsRequest };
@@ -0,0 +1,13 @@
1
+ const params = {
2
+ channelId: null
3
+ };
4
+ const query = {
5
+ from: 0,
6
+ limit: 10,
7
+ searchStr: null
8
+ };
9
+ const GetChannelAgentsRequest = {
10
+ params,
11
+ query
12
+ };
13
+ export default GetChannelAgentsRequest;
@@ -0,0 +1,2 @@
1
+ import GetChannelAgentsRequest from './GetChannelAgentsRequest';
2
+ export { GetChannelAgentsRequest };
@@ -0,0 +1 @@
1
+ export * from './agents';
@@ -0,0 +1,3 @@
1
+ export * from './channels';
2
+ export * from './sessions';
3
+ export * from './bots';
@@ -0,0 +1,12 @@
1
+ const params = {
2
+ sessionId: null
3
+ };
4
+ const query = {
5
+ agentId: null,
6
+ botId: null
7
+ };
8
+ const UpdateSessionAssigneeRequest = {
9
+ params,
10
+ query
11
+ };
12
+ export default UpdateSessionAssigneeRequest;
@@ -0,0 +1,2 @@
1
+ import UpdateSessionAssigneeRequest from './UpdateSessionAssigneeRequest';
2
+ export { UpdateSessionAssigneeRequest };
@@ -0,0 +1 @@
1
+ export * from './api';
@@ -0,0 +1,31 @@
1
+ import { ModuleNames } from '../../core/constants';
2
+ import { BotSDK } from '../sdk/bots';
3
+ import { ChannelSDK } from '../sdk/channels';
4
+ import { SessionSDK } from '../sdk/sessions';
5
+ const ModuleFactory = {
6
+ [ModuleNames.CHANNELS]: _ref => {
7
+ let {
8
+ config
9
+ } = _ref;
10
+ return new ChannelSDK({
11
+ config
12
+ }).toJSON();
13
+ },
14
+ [ModuleNames.SESSIONS]: _ref2 => {
15
+ let {
16
+ config
17
+ } = _ref2;
18
+ return new SessionSDK({
19
+ config
20
+ }).toJSON();
21
+ },
22
+ [ModuleNames.BOTS]: _ref3 => {
23
+ let {
24
+ config
25
+ } = _ref3;
26
+ return new BotSDK({
27
+ config
28
+ }).toJSON();
29
+ }
30
+ };
31
+ export default ModuleFactory;
@@ -0,0 +1,44 @@
1
+ import { ModuleNames } from '../../core/constants';
2
+ import ModuleFactory from './ModuleFactory';
3
+ export default class ModuleManager {
4
+ constructor() {
5
+ this._modules = new Map();
6
+ this.supportedModules = [ModuleNames.CHANNELS, ModuleNames.SESSIONS, ModuleNames.BOTS];
7
+ }
8
+
9
+ initialize(_ref) {
10
+ let {
11
+ apiConfig
12
+ } = _ref;
13
+ this.supportedModules.forEach(moduleName => {
14
+ const moduleConfig = apiConfig ? apiConfig[moduleName] : {} || {};
15
+ this.initializeModule({
16
+ moduleName,
17
+ config: moduleConfig
18
+ });
19
+ });
20
+ }
21
+
22
+ initializeModule(_ref2) {
23
+ let {
24
+ moduleName,
25
+ config
26
+ } = _ref2;
27
+ const createModule = ModuleFactory[moduleName];
28
+
29
+ if (createModule) {
30
+ this._modules.set(moduleName, createModule({
31
+ config
32
+ }));
33
+ }
34
+ }
35
+
36
+ getModule(moduleName) {
37
+ return this._modules.get(moduleName);
38
+ }
39
+
40
+ hasModule(moduleName) {
41
+ return this._modules.has(moduleName);
42
+ }
43
+
44
+ }
@@ -0,0 +1,2 @@
1
+ import ModuleManager from './ModuleManager';
2
+ export { ModuleManager };