@ai-vyumi/livecall 0.1.0
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/dist/VyumiLiveCall.d.ts +122 -0
- package/dist/VyumiLiveCall.js +185 -0
- package/dist/callbacks/callbacks.d.ts +149 -0
- package/dist/callbacks/callbacks.js +2 -0
- package/dist/config/const.d.ts +1 -0
- package/dist/config/const.js +4 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +10 -0
- package/dist/kit/index.d.ts +12 -0
- package/dist/kit/index.js +514 -0
- package/dist/network/axios.d.ts +8 -0
- package/dist/network/axios.js +49 -0
- package/dist/network/route.d.ts +9 -0
- package/dist/network/route.js +41 -0
- package/dist/service/CallService.d.ts +25 -0
- package/dist/service/CallService.js +225 -0
- package/dist/service/InitServices.d.ts +1 -0
- package/dist/service/InitServices.js +32 -0
- package/dist/service/UserServices.d.ts +1 -0
- package/dist/service/UserServices.js +22 -0
- package/dist/service/WebSocketService.d.ts +24 -0
- package/dist/service/WebSocketService.js +85 -0
- package/dist/service/ZegoServices.d.ts +19 -0
- package/dist/service/ZegoServices.js +216 -0
- package/dist/session/SessionManager.d.ts +36 -0
- package/dist/session/SessionManager.js +94 -0
- package/dist/types/types.d.ts +41 -0
- package/dist/types/types.js +2 -0
- package/dist/utils/Logger.d.ts +7 -0
- package/dist/utils/Logger.js +30 -0
- package/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.js +7 -0
- package/package.json +27 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SessionManager.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
class SessionManager {
|
|
5
|
+
constructor() {
|
|
6
|
+
// User
|
|
7
|
+
this.user = null;
|
|
8
|
+
// Call
|
|
9
|
+
this.currentCall = null;
|
|
10
|
+
this.currentZegoCall = null;
|
|
11
|
+
this.currentCallMediaType = 'audio';
|
|
12
|
+
this.localStreamId = '';
|
|
13
|
+
// SDK
|
|
14
|
+
this.companyId = '';
|
|
15
|
+
this.debug = false;
|
|
16
|
+
this.brandConfig = {};
|
|
17
|
+
this.interactionCallback = null;
|
|
18
|
+
this.product_url = null;
|
|
19
|
+
}
|
|
20
|
+
static getInstance() {
|
|
21
|
+
if (!SessionManager.instance) {
|
|
22
|
+
SessionManager.instance = new SessionManager();
|
|
23
|
+
}
|
|
24
|
+
return SessionManager.instance;
|
|
25
|
+
}
|
|
26
|
+
// =========================
|
|
27
|
+
// User Methods
|
|
28
|
+
// =========================
|
|
29
|
+
setUser(user) {
|
|
30
|
+
this.user = user;
|
|
31
|
+
}
|
|
32
|
+
getUser() {
|
|
33
|
+
return this.user;
|
|
34
|
+
}
|
|
35
|
+
clearUser() {
|
|
36
|
+
this.user = null;
|
|
37
|
+
}
|
|
38
|
+
// =========================
|
|
39
|
+
// Call Methods
|
|
40
|
+
// =========================
|
|
41
|
+
setCurrentCall(call) {
|
|
42
|
+
this.currentCall = call;
|
|
43
|
+
}
|
|
44
|
+
getCurrentCall() {
|
|
45
|
+
return this.currentCall;
|
|
46
|
+
}
|
|
47
|
+
setCurrentZegoCall(call) {
|
|
48
|
+
this.currentZegoCall = call;
|
|
49
|
+
}
|
|
50
|
+
getCurrentZegoCall() {
|
|
51
|
+
return this.currentZegoCall;
|
|
52
|
+
}
|
|
53
|
+
clearCall() {
|
|
54
|
+
this.currentCall = null;
|
|
55
|
+
this.currentZegoCall = null;
|
|
56
|
+
this.localStreamId = '';
|
|
57
|
+
this.currentCallMediaType = 'video';
|
|
58
|
+
}
|
|
59
|
+
// =========================
|
|
60
|
+
// SDK Methods
|
|
61
|
+
// =========================
|
|
62
|
+
initialize(config) {
|
|
63
|
+
var _a;
|
|
64
|
+
this.companyId = config.companyId;
|
|
65
|
+
this.debug = (_a = config.debug) !== null && _a !== void 0 ? _a : false;
|
|
66
|
+
}
|
|
67
|
+
getCompanyId() {
|
|
68
|
+
return this.companyId;
|
|
69
|
+
}
|
|
70
|
+
isDebug() {
|
|
71
|
+
return this.debug;
|
|
72
|
+
}
|
|
73
|
+
setBrandConfig(data) {
|
|
74
|
+
this.brandConfig = data;
|
|
75
|
+
}
|
|
76
|
+
getBrandConfig() {
|
|
77
|
+
return this.brandConfig;
|
|
78
|
+
}
|
|
79
|
+
// =========================
|
|
80
|
+
// Clear Everything
|
|
81
|
+
// =========================
|
|
82
|
+
clear() {
|
|
83
|
+
this.user = null;
|
|
84
|
+
this.currentCall = null;
|
|
85
|
+
this.currentZegoCall = null;
|
|
86
|
+
this.currentCallMediaType = 'audio';
|
|
87
|
+
this.localStreamId = '';
|
|
88
|
+
this.product_url = null;
|
|
89
|
+
this.companyId = '';
|
|
90
|
+
this.brandConfig = {};
|
|
91
|
+
this.interactionCallback = null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.default = SessionManager.getInstance();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type UserPayload = {
|
|
2
|
+
name: string;
|
|
3
|
+
mobile_no: string;
|
|
4
|
+
country_code: string;
|
|
5
|
+
company_id?: string;
|
|
6
|
+
};
|
|
7
|
+
export type CountryCode = {
|
|
8
|
+
country_name: string;
|
|
9
|
+
country_code: string;
|
|
10
|
+
};
|
|
11
|
+
export type User = {
|
|
12
|
+
name: string;
|
|
13
|
+
mobile_no: string;
|
|
14
|
+
uuid: string;
|
|
15
|
+
company_id: string;
|
|
16
|
+
country_code: CountryCode[];
|
|
17
|
+
};
|
|
18
|
+
export type Call = {
|
|
19
|
+
call_session_id: string;
|
|
20
|
+
ws_url: string;
|
|
21
|
+
queue_position: number;
|
|
22
|
+
expires_at: string;
|
|
23
|
+
expire_at_unix: number;
|
|
24
|
+
};
|
|
25
|
+
export type ZegoCall = {
|
|
26
|
+
token: string;
|
|
27
|
+
app_id: number;
|
|
28
|
+
room_id: string;
|
|
29
|
+
user_id: string;
|
|
30
|
+
role: string;
|
|
31
|
+
};
|
|
32
|
+
export type MediaType = 'video' | 'audio';
|
|
33
|
+
export type Message = {
|
|
34
|
+
messageText: string;
|
|
35
|
+
name: string;
|
|
36
|
+
};
|
|
37
|
+
export type CallRating = {
|
|
38
|
+
rating: number;
|
|
39
|
+
customer_uuid: string;
|
|
40
|
+
customer_desc: string;
|
|
41
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const SessionManager_1 = __importDefault(require("../session/SessionManager"));
|
|
7
|
+
const canLog = () => SessionManager_1.default.isDebug();
|
|
8
|
+
const Logger = {
|
|
9
|
+
log: (...args) => {
|
|
10
|
+
if (canLog()) {
|
|
11
|
+
console.log('[VYUMI]', ...args);
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
info: (...args) => {
|
|
15
|
+
if (canLog()) {
|
|
16
|
+
console.info('[VYUMI INFO]', ...args);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
warn: (...args) => {
|
|
20
|
+
if (canLog()) {
|
|
21
|
+
console.warn('[VYUMI WARN]', ...args);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
error: (...args) => {
|
|
25
|
+
if (canLog()) {
|
|
26
|
+
console.error('[VYUMI ERROR]', ...args);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
exports.default = Logger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateUniqueId: () => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateUniqueId = void 0;
|
|
4
|
+
const generateUniqueId = () => {
|
|
5
|
+
return Date.now().toString(36) + Math.random().toString(36).substring(2, 12);
|
|
6
|
+
};
|
|
7
|
+
exports.generateUniqueId = generateUniqueId;
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ai-vyumi/livecall",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Video call client for React Native",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"build:watch": "tsc --watch",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"react": "*",
|
|
18
|
+
"react-native": "*",
|
|
19
|
+
"zego-express-engine-reactnative": "*",
|
|
20
|
+
"axios": "*"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "^5.0.0",
|
|
24
|
+
"@types/react": "^18.0.0",
|
|
25
|
+
"@types/react-native": "^0.72.0"
|
|
26
|
+
}
|
|
27
|
+
}
|