@zohoim/client-sdk 1.0.0-poc14 → 1.0.0-poc16
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/interfaces/BaseAPI.js +12 -4
- 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 +2 -2
- 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
|
@@ -32,15 +32,23 @@ export default class BaseAPI {
|
|
|
32
32
|
return `${this.baseURL}${_url}`;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
buildQuery(
|
|
36
|
-
|
|
35
|
+
buildQuery(query) {
|
|
36
|
+
const filteredQuery = Object.entries(query).filter(_ref3 => {
|
|
37
|
+
let [, value] = _ref3;
|
|
38
|
+
return value !== undefined && value !== null && value !== '';
|
|
39
|
+
}).reduce((acc, _ref4) => {
|
|
40
|
+
let [key, value] = _ref4;
|
|
41
|
+
acc[key] = value;
|
|
42
|
+
return acc;
|
|
43
|
+
}, {});
|
|
44
|
+
return new URLSearchParams(filteredQuery).toString();
|
|
37
45
|
}
|
|
38
46
|
|
|
39
|
-
async request(
|
|
47
|
+
async request(_ref5) {
|
|
40
48
|
let {
|
|
41
49
|
urlConfig,
|
|
42
50
|
request
|
|
43
|
-
} =
|
|
51
|
+
} = _ref5;
|
|
44
52
|
const url = this.buildUrl({
|
|
45
53
|
url: urlConfig.url,
|
|
46
54
|
params: request.params,
|
|
@@ -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;
|
|
@@ -8,10 +8,10 @@ export default class ModuleManager {
|
|
|
8
8
|
|
|
9
9
|
initialize(_ref) {
|
|
10
10
|
let {
|
|
11
|
-
|
|
11
|
+
apiConfig
|
|
12
12
|
} = _ref;
|
|
13
13
|
this.supportedModules.forEach(moduleName => {
|
|
14
|
-
const moduleConfig =
|
|
14
|
+
const moduleConfig = apiConfig[moduleName] || {};
|
|
15
15
|
this.initializeModule({
|
|
16
16
|
moduleName,
|
|
17
17
|
config: moduleConfig
|
|
@@ -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
|
-
}
|