@vonage/client-sdk 0.1.4-alpha.6 → 0.1.4-rc.1
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 +23 -0
- package/dist/index.d.ts +1 -4
- package/dist/index.mjs +1 -0
- package/dist/kotlin/clientsdk-clientcore_js.d.ts +7 -7
- package/dist/{HttpClient.d.ts → lib/HttpClient.d.ts} +2 -2
- package/dist/{MediaClient.d.ts → lib/MediaClient.d.ts} +2 -2
- package/dist/{SocketClient.d.ts → lib/SocketClient.d.ts} +2 -2
- package/dist/{Client.d.ts → voice/VoiceClient.d.ts} +4 -4
- package/dist/{index.cjs.js → voice/index.cjs} +10203 -10967
- package/dist/voice/index.d.ts +2 -0
- package/dist/{index.js → voice/index.mjs} +10200 -10968
- package/dist/vonageClientSDK.js +10196 -10208
- package/dist/vonageClientSDK.min.js +2 -2
- package/dist/vonageClientSDK.min.mjs +2 -0
- package/dist/{vonageClientSDK.esm.js → vonageClientSDK.mjs} +10196 -10208
- package/package.json +25 -4
- package/rollup.config.js +54 -32
- package/dist/vonageClientSDK.esm.min.js +0 -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
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var voice = require('./voice');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, 'ClientConfig', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return voice.ClientConfig; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, 'ConfigRegion', {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return voice.ConfigRegion; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, 'LoggingLevel', {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return voice.LoggingLevel; }
|
|
18
|
+
});
|
|
19
|
+
exports.VoiceClient = voice;
|
|
20
|
+
Object.defineProperty(exports, 'setDefaultLoggingLevel', {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return voice.setDefaultLoggingLevel; }
|
|
23
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export type { Invite, VoiceCall, Conversation, RTCQuality } from './Client';
|
|
3
|
-
export { default as VoiceClient, ClientConfig, ConfigRegion, setDefaultLoggingLevel, LoggingLevel } from './Client';
|
|
4
|
-
export {} from './coreExtend';
|
|
1
|
+
export { default as VoiceClient, ClientConfig, ConfigRegion, setDefaultLoggingLevel, LoggingLevel, Invite, VoiceCall, Conversation, RTCQuality } from './voice';
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ClientConfig, ConfigRegion, LoggingLevel, default as VoiceClient, setDefaultLoggingLevel } from './voice';
|
|
@@ -6,13 +6,13 @@ export namespace vonage {
|
|
|
6
6
|
reconnecting(): void;
|
|
7
7
|
reconnection(): void;
|
|
8
8
|
sessionError(reason: string): void;
|
|
9
|
-
callInvite(invite: vonage.VoiceInviteJS): void;
|
|
10
|
-
callTransfer(
|
|
11
|
-
mute(
|
|
12
|
-
earmuff(
|
|
13
|
-
dtmf(
|
|
14
|
-
rtcHangup(
|
|
15
|
-
legStatusUpdate(
|
|
9
|
+
callInvite(callId: string, invite: vonage.VoiceInviteJS): void;
|
|
10
|
+
callTransfer(callId: string, cid: vonage.ConversationJS, prevConversation: vonage.ConversationJS): void;
|
|
11
|
+
mute(callId: string, legId: string, isMuted: boolean): void;
|
|
12
|
+
earmuff(callId: string, legId: string, earmuffStatus: boolean): void;
|
|
13
|
+
dtmf(callId: string, legId: string, digits: string): void;
|
|
14
|
+
rtcHangup(callId: string, legId: string, callQuality: vonage.RTCQualityJS): void;
|
|
15
|
+
legStatusUpdate(callId: string, legId: string, status: string): void;
|
|
16
16
|
}
|
|
17
17
|
interface CallSayParams {
|
|
18
18
|
readonly text: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as KMPPackage from '
|
|
2
|
-
import { vonage } from '
|
|
1
|
+
import * as KMPPackage from '../kotlin/clientsdk-clientcore_js';
|
|
2
|
+
import { vonage } from '../kotlin/clientsdk-clientcore_js';
|
|
3
3
|
type HttpHeaders = Record<string, string | number | boolean>;
|
|
4
4
|
declare class HttpClient implements vonage.HttpClientJS {
|
|
5
5
|
private stringToVerb;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as KMPPackage from '
|
|
2
|
-
import { vonage } from '
|
|
1
|
+
import * as KMPPackage from '../kotlin/clientsdk-clientcore_js';
|
|
2
|
+
import { vonage } from '../kotlin/clientsdk-clientcore_js';
|
|
3
3
|
declare class MediaClient implements vonage.MediaClientJS {
|
|
4
4
|
delegate: KMPPackage.Nullable<vonage.MediaClientDelegateJS>;
|
|
5
5
|
private pcs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as KMPPackage from '
|
|
2
|
-
import { vonage } from '
|
|
1
|
+
import * as KMPPackage from '../kotlin/clientsdk-clientcore_js';
|
|
2
|
+
import { vonage } from '../kotlin/clientsdk-clientcore_js';
|
|
3
3
|
declare class SocketClient implements vonage.SocketClientJS {
|
|
4
4
|
delegate: KMPPackage.Nullable<vonage.SocketClientDelegateJS>;
|
|
5
5
|
private socket;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { vonage } from '
|
|
2
|
-
import '
|
|
3
|
-
import '
|
|
1
|
+
import { vonage } from '../kotlin/clientsdk-clientcore_js';
|
|
2
|
+
import '../coreExtend';
|
|
3
|
+
import '../global';
|
|
4
4
|
/**
|
|
5
5
|
* Minimal Interface built on top of KMP export
|
|
6
6
|
* DO NOT ADD CODE HERE UNLESS REALLY NEEDEED!!111!
|
|
@@ -16,7 +16,7 @@ export declare const setDefaultLoggingLevel: typeof vonage.setDefaultLoggingLeve
|
|
|
16
16
|
export declare class ClientConfig extends vonage.CoreClientConfigJS {
|
|
17
17
|
constructor(region?: vonage.CoreClientConfigRegionJS);
|
|
18
18
|
}
|
|
19
|
-
declare class VoiceClient extends vonage.CoreClientJS {
|
|
19
|
+
export declare class VoiceClient extends vonage.CoreClientJS {
|
|
20
20
|
private callbacks;
|
|
21
21
|
constructor();
|
|
22
22
|
on<T extends keyof VonageEvent, Fn extends VonageEvent[T]>(event: T, callback: Fn): void;
|