@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.
- package/es/domain/services/channels/ChannelAgentService.js +6 -0
- package/es/domain/services/sessions/SessionService.js +6 -0
- package/es/infrastructure/managers/ModuleFactory.js +2 -2
- package/es/infrastructure/managers/ModuleManager.js +7 -5
- package/es/infrastructure/sdk/IMSDK.js +2 -2
- package/es/infrastructure/sdk/channels/ChannelSDK.js +9 -3
- package/package.json +1 -1
- package/es/infrastructure/sdk/channels/ChannelAgentsSDK.js +0 -20
|
@@ -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
|
-
|
|
11
|
+
apiConfig
|
|
10
12
|
} = _ref;
|
|
11
|
-
|
|
12
|
-
|
|
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(
|
|
22
|
+
initializeModule(_ref2) {
|
|
21
23
|
let {
|
|
22
24
|
moduleName,
|
|
23
25
|
config
|
|
24
|
-
} =
|
|
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
|
-
|
|
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
|
-
|
|
18
|
+
apiConfig
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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
|
|
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,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
|
-
}
|