@vonage/client-sdk 0.1.4-alpha.7 → 0.1.4
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/README.md +53 -13
- package/dist/index.cjs +1 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -12,36 +12,76 @@ npm i @vonage/client-sdk
|
|
|
12
12
|
|
|
13
13
|
## SDK setup
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
### With budler (webpack or vite)
|
|
16
16
|
|
|
17
|
-
```
|
|
17
|
+
```js
|
|
18
18
|
import './App.css';
|
|
19
|
-
import VoiceClient,
|
|
19
|
+
import { VoiceClient, ClientConfig, ConfigRegion } from '@vonage/client-sdk';
|
|
20
|
+
import VoiceClient, { ClientConfig, ConfigRegion } from '@vonage/client-sdk/voice'; // NextJS/Webpack users see note below
|
|
20
21
|
|
|
21
22
|
const client = new VoiceClient();
|
|
22
23
|
|
|
23
24
|
// Config is optional but recomended, default region is US
|
|
24
|
-
const config = new ClientConfig(ConfigRegion.US)
|
|
25
|
-
client.setConfig(config)
|
|
25
|
+
const config = new ClientConfig(ConfigRegion.US);
|
|
26
|
+
client.setConfig(config);
|
|
26
27
|
|
|
27
28
|
function App() {
|
|
28
|
-
|
|
29
29
|
const createSession = async () => {
|
|
30
|
-
const token =
|
|
31
|
-
await client.createSession(token)
|
|
32
|
-
}
|
|
30
|
+
const token = 'my-token';
|
|
31
|
+
await client.createSession(token);
|
|
32
|
+
};
|
|
33
33
|
|
|
34
|
-
return
|
|
35
|
-
<button onClick={createSession}> create session </button>
|
|
36
|
-
);
|
|
34
|
+
return <button onClick={createSession}> create session </button>;
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
export default App;
|
|
40
38
|
```
|
|
41
39
|
|
|
40
|
+
- **Node**: We have a known issue with NextJS / Webpack that means the main import from `@vonage/client-sdk` doesn't work, however if you import from `@vonage/client-sdk/voice` the voice client successfully imports. we are working on a fix.
|
|
41
|
+
|
|
42
|
+
### With script tag (UMD)
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<!-- <script src="./node_modules/@vonage/client-sdk/dist/vonageClientSDK.js"></script> -->
|
|
46
|
+
<!-- <script src="https://cdn.jsdelivr.net/npm/@vonage/client-sdk@0.1.4/dist/vonageClientSDK.min.js"></script> -->
|
|
47
|
+
<script src="./node_modules/@vonage/client-sdk/dist/vonageClientSDK.min.js"></script>
|
|
48
|
+
<script>
|
|
49
|
+
const token = 'some-token';
|
|
50
|
+
const client = new vonageClientSDK.VoiceClient();
|
|
51
|
+
const config = new vonageClientSDK.ClientConfig(
|
|
52
|
+
vonageClientSDK.ConfigRegion.EU
|
|
53
|
+
);
|
|
54
|
+
client.setConfig(config);
|
|
55
|
+
|
|
56
|
+
client.createSession(token).then((Session) => {});
|
|
57
|
+
</script>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### With CDN (ES)
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
import {
|
|
64
|
+
VoiceClient,
|
|
65
|
+
ClientConfig,
|
|
66
|
+
ConfigRegion
|
|
67
|
+
} from 'https://cdn.jsdelivr.net/npm/@vonage/client-sdk@0.1.4/dist/vonageClientSDK.esm.min.js';
|
|
68
|
+
|
|
69
|
+
const client = new VoiceClient();
|
|
70
|
+
|
|
71
|
+
// Config is optional but recomended, default region is US
|
|
72
|
+
const config = new ClientConfig(ConfigRegion.US);
|
|
73
|
+
client.setConfig(config);
|
|
74
|
+
|
|
75
|
+
const token = 'my-token';
|
|
76
|
+
client
|
|
77
|
+
.createSession(token)
|
|
78
|
+
.then((sessionId) => console.log(sessionId))
|
|
79
|
+
.catch((err) => console.log(err));
|
|
80
|
+
```
|
|
81
|
+
|
|
42
82
|
## Documentation and examples
|
|
43
83
|
|
|
44
|
-
Visit [vonage website] (https://developer.vonage.com/tools)
|
|
84
|
+
Visit [vonage website] (<https://developer.vonage.com/tools>)
|
|
45
85
|
|
|
46
86
|
## License
|
|
47
87
|
|
package/dist/index.cjs
CHANGED
|
@@ -16,10 +16,7 @@ Object.defineProperty(exports, 'LoggingLevel', {
|
|
|
16
16
|
enumerable: true,
|
|
17
17
|
get: function () { return voice.LoggingLevel; }
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () { return voice.VoiceClient; }
|
|
22
|
-
});
|
|
19
|
+
exports.VoiceClient = voice;
|
|
23
20
|
Object.defineProperty(exports, 'setDefaultLoggingLevel', {
|
|
24
21
|
enumerable: true,
|
|
25
22
|
get: function () { return voice.setDefaultLoggingLevel; }
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { VoiceClient, ClientConfig, ConfigRegion, setDefaultLoggingLevel, LoggingLevel, Invite, VoiceCall, Conversation, RTCQuality } from './voice';
|
|
1
|
+
export { default as VoiceClient, ClientConfig, ConfigRegion, setDefaultLoggingLevel, LoggingLevel, Invite, VoiceCall, Conversation, RTCQuality } from './voice';
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ClientConfig, ConfigRegion, LoggingLevel, VoiceClient, setDefaultLoggingLevel } from './voice';
|
|
1
|
+
export { ClientConfig, ConfigRegion, LoggingLevel, default as VoiceClient, setDefaultLoggingLevel } from './voice';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonage/client-sdk",
|
|
3
|
-
"version": "0.1.4
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@rollup/plugin-commonjs": "^24.0.0",
|
|
58
58
|
"@rollup/plugin-json": "^6.0.0",
|
|
59
|
-
"@rollup/plugin-multi-entry": "^6.0.0",
|
|
60
59
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
61
60
|
"@rollup/plugin-terser": "^0.2.1",
|
|
62
61
|
"@swc/core": "^1.3.24",
|