@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.
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ declare const Logger: {
2
+ log: (...args: any[]) => void;
3
+ info: (...args: any[]) => void;
4
+ warn: (...args: any[]) => void;
5
+ error: (...args: any[]) => void;
6
+ };
7
+ export default Logger;
@@ -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
+ }