@zohoim/client-sdk 1.0.0-poc13 → 1.0.0-poc15

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.
@@ -22,4 +22,10 @@ export default class ChannelAgentService extends IChannelAgent {
22
22
  return channelAgents.map(this.channelAgentAdapter.adapt);
23
23
  }
24
24
 
25
+ toJSON() {
26
+ return {
27
+ getAgents: this.getAgents.bind(this)
28
+ };
29
+ }
30
+
25
31
  }
@@ -22,4 +22,10 @@ export default class SessionService extends ISession {
22
22
  return this.channelAgentAdapter.adapt(session);
23
23
  }
24
24
 
25
+ toJSON() {
26
+ return {
27
+ updateAssignee: this.updateAssignee.bind(this)
28
+ };
29
+ }
30
+
25
31
  }
@@ -8,7 +8,7 @@ const ModuleFactory = {
8
8
  } = _ref;
9
9
  return new ChannelSDK({
10
10
  config
11
- });
11
+ }).toJSON();
12
12
  },
13
13
  [ModuleNames.SESSIONS]: _ref2 => {
14
14
  let {
@@ -16,7 +16,7 @@ const ModuleFactory = {
16
16
  } = _ref2;
17
17
  return new SessionSDK({
18
18
  config
19
- });
19
+ }).toJSON();
20
20
  }
21
21
  };
22
22
  export default ModuleFactory;
@@ -1,15 +1,17 @@
1
+ import { ModuleNames } from '../../core/constants';
1
2
  import ModuleFactory from './ModuleFactory';
2
3
  export default class ModuleManager {
3
4
  constructor() {
4
5
  this._modules = new Map();
6
+ this.supportedModules = [ModuleNames.CHANNELS, ModuleNames.SESSIONS];
5
7
  }
6
8
 
7
9
  initialize(_ref) {
8
10
  let {
9
- config
11
+ apiConfig
10
12
  } = _ref;
11
- Object.entries(config).forEach(_ref2 => {
12
- let [moduleName, moduleConfig] = _ref2;
13
+ this.supportedModules.forEach(moduleName => {
14
+ const moduleConfig = apiConfig[moduleName] || {};
13
15
  this.initializeModule({
14
16
  moduleName,
15
17
  config: moduleConfig
@@ -17,11 +19,11 @@ export default class ModuleManager {
17
19
  });
18
20
  }
19
21
 
20
- initializeModule(_ref3) {
22
+ initializeModule(_ref2) {
21
23
  let {
22
24
  moduleName,
23
25
  config
24
- } = _ref3;
26
+ } = _ref2;
25
27
  const createModule = ModuleFactory[moduleName];
26
28
 
27
29
  if (createModule) {
@@ -5,7 +5,7 @@ export default class IMSDK {
5
5
  constructor(_ref) {
6
6
  let {
7
7
  baseURL,
8
- config = {},
8
+ apiConfig = {},
9
9
  httpClient
10
10
  } = _ref;
11
11
  configRegistry.setConfig({
@@ -15,7 +15,7 @@ export default class IMSDK {
15
15
  this._moduleManager = new ModuleManager();
16
16
 
17
17
  this._moduleManager.initialize({
18
- config
18
+ apiConfig
19
19
  });
20
20
  }
21
21
 
@@ -1,4 +1,4 @@
1
- import ChannelAgentsSDK from './ChannelAgentsSDK';
1
+ import { ChannelAgentService } from '../../../domain/services';
2
2
  export default class ChannelSDK {
3
3
  constructor(_ref) {
4
4
  let {
@@ -8,10 +8,16 @@ export default class ChannelSDK {
8
8
  channelAgentAPI,
9
9
  channelAgentAdapter
10
10
  } = config;
11
- this.agents = new ChannelAgentsSDK({
11
+ this.agents = new ChannelAgentService({
12
12
  channelAgentAPI,
13
13
  channelAgentAdapter
14
- });
14
+ }).toJSON();
15
+ }
16
+
17
+ toJSON() {
18
+ return {
19
+ agents: this.agents
20
+ };
15
21
  }
16
22
 
17
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohoim/client-sdk",
3
- "version": "1.0.0-poc13",
3
+ "version": "1.0.0-poc15",
4
4
  "description": "To have the client sdk for the IM",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",
@@ -1,20 +0,0 @@
1
- import { ChannelAgentService } from '../../../domain/services';
2
- import { GetChannelAgentsRequest } from '../../interfaces/api';
3
- export default class ChannelAgentsSDK {
4
- constructor(_ref) {
5
- let {
6
- channelAgentAPI,
7
- channelAgentAdapter
8
- } = _ref;
9
- this.channelAgentService = new ChannelAgentService({
10
- channelAgentAPI,
11
- channelAgentAdapter
12
- });
13
- }
14
-
15
- async getAgents() {
16
- let request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : GetChannelAgentsRequest;
17
- return this.channelAgentService.getAgents(request);
18
- }
19
-
20
- }