@vonage/client-sdk 0.1.3 → 0.1.4-alpha.3
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 +43 -13
- package/dist/MediaClient.d.ts +5 -2
- package/dist/MediaClient.js +51 -32
- package/dist/coreExtend.d.ts +3 -0
- package/dist/kotlin/Kermit-kermit-js-ir.js +46 -46
- package/dist/kotlin/clientsdk-clientcore.js +9593 -8703
- package/dist/kotlin/clientsdk-clientcore.js.map +1 -1
- package/dist/kotlin/clientsdk-clientcore_js.d.ts +7 -3
- package/dist/kotlin/clientsdk-clientcore_js.js +278 -275
- package/dist/kotlin/clientsdk-clientcore_js.js.map +1 -1
- package/dist/kotlin/kotlin-kotlin-stdlib-js-ir.js +1009 -987
- package/dist/kotlin/kotlin-kotlin-stdlib-js-ir.js.map +1 -1
- package/dist/kotlin/kotlinx-serialization-kotlinx-serialization-core-js-ir.js +1650 -1650
- package/dist/kotlin/kotlinx-serialization-kotlinx-serialization-json-js-ir.js +1480 -1480
- package/dist/kotlin/kotlinx-serialization-kotlinx-serialization-json-js-ir.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,24 +1,54 @@
|
|
|
1
1
|
# Vonage Voice SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Client SDK is intended to provide a ready solution for developers to build Programmable Conversation applications across multiple Channels including: Messages, Voice, SIP, websockets, and App.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- enable SSO for new token, see [here](https://docs.github.com/en/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on)
|
|
9
|
-
|
|
10
|
-
### 2. Authenticate with Github packages
|
|
7
|
+
The SDK can be installed using the npm install command
|
|
11
8
|
|
|
12
9
|
```
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
> Username: USERNAME //github user
|
|
16
|
-
> Password: TOKEN // Personal access token
|
|
17
|
-
> Email: github email
|
|
10
|
+
npm i @vonage/client-sdk
|
|
18
11
|
```
|
|
19
12
|
|
|
20
|
-
|
|
13
|
+
## SDK setup
|
|
14
|
+
|
|
15
|
+
To use the client SDK in a Webpack or Vite project:
|
|
21
16
|
|
|
22
17
|
```
|
|
23
|
-
|
|
18
|
+
import './App.css';
|
|
19
|
+
import VoiceClient, { ClientConfig, ConfigRegion } from '@vonage/client-sdk';
|
|
20
|
+
|
|
21
|
+
const client = new VoiceClient();
|
|
22
|
+
|
|
23
|
+
// Config is optional but recomended, default region is US
|
|
24
|
+
const config = new ClientConfig(ConfigRegion.US)
|
|
25
|
+
client.setConfig(config)
|
|
26
|
+
|
|
27
|
+
function App() {
|
|
28
|
+
|
|
29
|
+
const createSession = async () => {
|
|
30
|
+
const token = "my-token"
|
|
31
|
+
await client.createSession(token)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<button onClick={createSession}> create session </button>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default App;
|
|
24
40
|
```
|
|
41
|
+
|
|
42
|
+
## Documentation and examples
|
|
43
|
+
|
|
44
|
+
Visit [vonage website] (https://developer.vonage.com/tools)
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
Copyright (c) 2023 Vonage, Inc. All rights reserved. Licensed only under the Vonage Client SDK License Agreement (the "License") located at [LICENCE](https://github.com/nexmoinc/conversation-js-sdk/blob/master/LICENSE).
|
|
49
|
+
|
|
50
|
+
By downloading or otherwise using our software or services, you acknowledge that you have read, understand and agree to be bound by the Vonage Client SDK License Agreement and Privacy Policy.
|
|
51
|
+
|
|
52
|
+
You may not use, exercise any rights with respect to or exploit this SDK, or any modifications or derivative works thereof, except in accordance with the License.
|
|
53
|
+
|
|
54
|
+
[<img src="https://developer.nexmo.com/images/logos/vbc-logo.svg" width="30%">](https://www.vonage.com/communications-apis/)
|
package/dist/MediaClient.d.ts
CHANGED
|
@@ -6,10 +6,13 @@ declare class MediaClient implements vonage.MediaClientJS {
|
|
|
6
6
|
private audio;
|
|
7
7
|
private stream;
|
|
8
8
|
constructor();
|
|
9
|
-
|
|
9
|
+
enableMediaInbound(closure: (err: unknown, offerSDP: KMPPackage.Nullable<string>) => void, offerSDP: string, rtcId: string): Promise<void>;
|
|
10
|
+
enableMediaOutbound(closure: (err: unknown, offerSDP: KMPPackage.Nullable<string>, callback: (legId: string) => void) => void): Promise<void>;
|
|
11
|
+
private getNewPC;
|
|
10
12
|
mute(id: string): Promise<void>;
|
|
11
13
|
unmute(id: string): Promise<void>;
|
|
12
|
-
|
|
14
|
+
getPeerConnection(id: string): RTCPeerConnection | undefined;
|
|
15
|
+
processAnswer(id: string, sdp: string): void;
|
|
13
16
|
disableMedia(id: string): void;
|
|
14
17
|
private setMediaTracksEnabled;
|
|
15
18
|
}
|
package/dist/MediaClient.js
CHANGED
|
@@ -15,39 +15,58 @@ class MediaClient {
|
|
|
15
15
|
this.pcs = new Map();
|
|
16
16
|
this.audio = undefined;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
var _a, _b;
|
|
18
|
+
enableMediaInbound(closure, offerSDP, rtcId) {
|
|
20
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
let sdp;
|
|
21
|
+
let error;
|
|
21
22
|
try {
|
|
22
|
-
const pc = yield
|
|
23
|
-
this.pcs.set(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
23
|
+
const pc = yield this.getNewPC();
|
|
24
|
+
this.pcs.set(rtcId, pc);
|
|
25
|
+
sdp = yield (0, createRtcAudioConnection_1.createAnswer)(pc, offerSDP);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
error = err;
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
closure(error, sdp);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
enableMediaOutbound(closure) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
let error;
|
|
38
|
+
let pc;
|
|
39
|
+
let sdp;
|
|
40
|
+
try {
|
|
41
|
+
pc = yield this.getNewPC();
|
|
42
|
+
sdp = yield (0, createRtcAudioConnection_1.createOffer)(pc);
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
error = err;
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
finally {
|
|
48
|
+
closure(error, sdp, (legId) => {
|
|
49
|
+
this.pcs.set(legId, pc);
|
|
50
|
+
});
|
|
48
51
|
}
|
|
49
52
|
});
|
|
50
53
|
}
|
|
54
|
+
getNewPC() {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const pc = yield (0, createRtcAudioConnection_1.createRtcAudioConnection)();
|
|
57
|
+
pc.ontrack = (evt) => {
|
|
58
|
+
const stream = evt.streams[0];
|
|
59
|
+
if (stream) {
|
|
60
|
+
const audio = new Audio();
|
|
61
|
+
audio.srcObject = stream;
|
|
62
|
+
audio.autoplay = true;
|
|
63
|
+
this.audio = audio;
|
|
64
|
+
this.stream = stream;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return pc;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
51
70
|
mute(id) {
|
|
52
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
72
|
this.setMediaTracksEnabled(id, false);
|
|
@@ -58,17 +77,17 @@ class MediaClient {
|
|
|
58
77
|
this.setMediaTracksEnabled(id, true);
|
|
59
78
|
});
|
|
60
79
|
}
|
|
80
|
+
getPeerConnection(id) {
|
|
81
|
+
const pc = this.pcs.get(id);
|
|
82
|
+
return pc;
|
|
83
|
+
}
|
|
61
84
|
// async getLocalStream(): Promise<MediaStream> {
|
|
62
85
|
// return await navigator.mediaDevices.getUserMedia({
|
|
63
86
|
// video: false,
|
|
64
87
|
// audio: true
|
|
65
88
|
// });
|
|
66
89
|
// }
|
|
67
|
-
processAnswer(id, sdp
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
69
|
-
streamId,
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
71
|
-
legId) {
|
|
90
|
+
processAnswer(id, sdp) {
|
|
72
91
|
const remoteDescription = new RTCSessionDescription({
|
|
73
92
|
type: 'answer',
|
|
74
93
|
sdp
|
package/dist/coreExtend.d.ts
CHANGED
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
}(this, function (_, kotlin_kotlin) {
|
|
13
13
|
'use strict';
|
|
14
14
|
//region block: imports
|
|
15
|
-
var classMeta = kotlin_kotlin.$_$.
|
|
16
|
-
var objectMeta = kotlin_kotlin.$_$.
|
|
17
|
-
var listOf = kotlin_kotlin.$_$.
|
|
18
|
-
var interfaceMeta = kotlin_kotlin.$_$.
|
|
19
|
-
var THROW_ISE = kotlin_kotlin.$_$.
|
|
20
|
-
var Unit_getInstance = kotlin_kotlin.$_$.
|
|
21
|
-
var Enum = kotlin_kotlin.$_$.
|
|
22
|
-
var stackTraceToString = kotlin_kotlin.$_$.
|
|
15
|
+
var classMeta = kotlin_kotlin.$_$.j5;
|
|
16
|
+
var objectMeta = kotlin_kotlin.$_$.j6;
|
|
17
|
+
var listOf = kotlin_kotlin.$_$.h4;
|
|
18
|
+
var interfaceMeta = kotlin_kotlin.$_$.q5;
|
|
19
|
+
var THROW_ISE = kotlin_kotlin.$_$.z7;
|
|
20
|
+
var Unit_getInstance = kotlin_kotlin.$_$.p2;
|
|
21
|
+
var Enum = kotlin_kotlin.$_$.s7;
|
|
22
|
+
var stackTraceToString = kotlin_kotlin.$_$.p8;
|
|
23
23
|
//endregion
|
|
24
24
|
//region block: pre-declaration
|
|
25
25
|
Companion.prototype = Object.create(Logger.prototype);
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
//endregion
|
|
32
32
|
function LogWriter() {
|
|
33
33
|
}
|
|
34
|
-
LogWriter.prototype.
|
|
34
|
+
LogWriter.prototype.a1a = function (severity) {
|
|
35
35
|
return true;
|
|
36
36
|
};
|
|
37
37
|
LogWriter.$metadata$ = classMeta('LogWriter');
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
}
|
|
53
53
|
function Companion() {
|
|
54
54
|
Companion_instance = this;
|
|
55
|
-
var tmp = LoggerGlobal_getInstance().
|
|
55
|
+
var tmp = LoggerGlobal_getInstance().c1a_1;
|
|
56
56
|
Logger_init_$Init$(tmp, null, 2, null, this);
|
|
57
57
|
}
|
|
58
|
-
Companion.prototype.
|
|
58
|
+
Companion.prototype.f1a = function () {
|
|
59
59
|
return get_defaultTag();
|
|
60
60
|
};
|
|
61
|
-
Companion.prototype.
|
|
62
|
-
LoggerGlobal_getInstance().
|
|
61
|
+
Companion.prototype.g1a = function (severity) {
|
|
62
|
+
LoggerGlobal_getInstance().c1a_1.h1a(severity);
|
|
63
63
|
};
|
|
64
|
-
Companion.prototype.
|
|
64
|
+
Companion.prototype.i1a = function (tag) {
|
|
65
65
|
set_defaultTag(tag);
|
|
66
66
|
};
|
|
67
67
|
Companion.$metadata$ = objectMeta('Companion', undefined, undefined, undefined, undefined, Logger.prototype);
|
|
@@ -73,51 +73,51 @@
|
|
|
73
73
|
}
|
|
74
74
|
function Logger(config, tag) {
|
|
75
75
|
Companion_getInstance();
|
|
76
|
-
this.
|
|
77
|
-
this.
|
|
76
|
+
this.j1a_1 = config;
|
|
77
|
+
this.k1a_1 = tag;
|
|
78
78
|
}
|
|
79
|
-
Logger.prototype.
|
|
80
|
-
return this.
|
|
79
|
+
Logger.prototype.l1a = function () {
|
|
80
|
+
return this.j1a_1;
|
|
81
81
|
};
|
|
82
|
-
Logger.prototype.
|
|
83
|
-
return this.
|
|
82
|
+
Logger.prototype.f1a = function () {
|
|
83
|
+
return this.k1a_1;
|
|
84
84
|
};
|
|
85
|
-
Logger.prototype.
|
|
86
|
-
return new Logger(this.
|
|
85
|
+
Logger.prototype.m1a = function (tag) {
|
|
86
|
+
return new Logger(this.j1a_1, tag);
|
|
87
87
|
};
|
|
88
|
-
Logger.prototype.
|
|
89
|
-
if (this.
|
|
90
|
-
this.
|
|
88
|
+
Logger.prototype.n1a = function (message) {
|
|
89
|
+
if (this.j1a_1.r1a().s3(Severity_Info_getInstance()) <= 0) {
|
|
90
|
+
this.q1a(Severity_Info_getInstance(), this.f1a(), null, message());
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
Logger.prototype.
|
|
94
|
-
if (this.
|
|
95
|
-
this.
|
|
93
|
+
Logger.prototype.o1a = function (message) {
|
|
94
|
+
if (this.j1a_1.r1a().s3(Severity_Error_getInstance()) <= 0) {
|
|
95
|
+
this.q1a(Severity_Error_getInstance(), this.f1a(), null, message());
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
-
Logger.prototype.
|
|
99
|
-
if (this.
|
|
100
|
-
this.
|
|
98
|
+
Logger.prototype.p1a = function (message) {
|
|
99
|
+
if (this.j1a_1.r1a().s3(Severity_Error_getInstance()) <= 0) {
|
|
100
|
+
this.q1a(Severity_Error_getInstance(), this.f1a(), null, message);
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
Logger.prototype.
|
|
103
|
+
Logger.prototype.q1a = function (severity, tag, throwable, message) {
|
|
104
104
|
// Inline function 'co.touchlab.kermit.Logger.processLog' call
|
|
105
105
|
// Inline function 'kotlin.collections.forEach' call
|
|
106
|
-
var tmp0_forEach = this.
|
|
106
|
+
var tmp0_forEach = this.j1a_1.s1a();
|
|
107
107
|
var tmp0_iterator = tmp0_forEach.g();
|
|
108
108
|
while (tmp0_iterator.h()) {
|
|
109
109
|
var element = tmp0_iterator.i();
|
|
110
110
|
// Inline function 'co.touchlab.kermit.Logger.processLog.<anonymous>' call
|
|
111
|
-
if (element.
|
|
111
|
+
if (element.a1a(severity)) {
|
|
112
112
|
// Inline function 'co.touchlab.kermit.Logger.log.<anonymous>' call
|
|
113
|
-
element.
|
|
113
|
+
element.b1a(severity, message, tag, throwable);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
Logger.$metadata$ = classMeta('Logger');
|
|
118
118
|
function LoggerGlobal() {
|
|
119
119
|
LoggerGlobal_instance = this;
|
|
120
|
-
this.
|
|
120
|
+
this.c1a_1 = mutableKermitConfigInit(listOf(platformLogWriter()));
|
|
121
121
|
}
|
|
122
122
|
LoggerGlobal.$metadata$ = objectMeta('LoggerGlobal');
|
|
123
123
|
var LoggerGlobal_instance;
|
|
@@ -209,7 +209,7 @@
|
|
|
209
209
|
function ConsoleWriter() {
|
|
210
210
|
LogWriter.call(this);
|
|
211
211
|
}
|
|
212
|
-
ConsoleWriter.prototype.
|
|
212
|
+
ConsoleWriter.prototype.b1a = function (severity, message, tag, throwable) {
|
|
213
213
|
var output = '[' + tag + '] ' + message;
|
|
214
214
|
var tmp0_safe_receiver = throwable;
|
|
215
215
|
if (tmp0_safe_receiver == null)
|
|
@@ -222,7 +222,7 @@
|
|
|
222
222
|
tmp$ret$0 = Unit_getInstance();
|
|
223
223
|
}
|
|
224
224
|
var tmp1_subject = severity;
|
|
225
|
-
var tmp0 = tmp1_subject.
|
|
225
|
+
var tmp0 = tmp1_subject.q3_1;
|
|
226
226
|
switch (tmp0) {
|
|
227
227
|
case 5:
|
|
228
228
|
case 4:
|
|
@@ -246,17 +246,17 @@
|
|
|
246
246
|
};
|
|
247
247
|
ConsoleWriter.$metadata$ = classMeta('ConsoleWriter', undefined, undefined, undefined, undefined, LogWriter.prototype);
|
|
248
248
|
function JsMutableLoggerConfig(logWriters) {
|
|
249
|
-
this.
|
|
250
|
-
this.
|
|
249
|
+
this.t1a_1 = get_DEFAULT_MIN_SEVERITY();
|
|
250
|
+
this.u1a_1 = logWriters;
|
|
251
251
|
}
|
|
252
|
-
JsMutableLoggerConfig.prototype.
|
|
253
|
-
this.
|
|
252
|
+
JsMutableLoggerConfig.prototype.h1a = function (_set____db54di) {
|
|
253
|
+
this.t1a_1 = _set____db54di;
|
|
254
254
|
};
|
|
255
|
-
JsMutableLoggerConfig.prototype.
|
|
256
|
-
return this.
|
|
255
|
+
JsMutableLoggerConfig.prototype.r1a = function () {
|
|
256
|
+
return this.t1a_1;
|
|
257
257
|
};
|
|
258
|
-
JsMutableLoggerConfig.prototype.
|
|
259
|
-
return this.
|
|
258
|
+
JsMutableLoggerConfig.prototype.s1a = function () {
|
|
259
|
+
return this.u1a_1;
|
|
260
260
|
};
|
|
261
261
|
JsMutableLoggerConfig.$metadata$ = classMeta('JsMutableLoggerConfig', [MutableLoggerConfig]);
|
|
262
262
|
function set_defaultTag(_set____db54di) {
|