@tellescope/video-chat 1.3.26 → 1.3.27
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/lib/cjs/index.d.ts +1 -2
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +1 -5
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/index.native.d.ts +1 -2
- package/lib/cjs/index.native.d.ts.map +1 -1
- package/lib/cjs/index.native.js +2 -5
- package/lib/cjs/index.native.js.map +1 -1
- package/lib/cjs/video.d.ts +18 -11
- package/lib/cjs/video.d.ts.map +1 -1
- package/lib/cjs/video.js +106 -39
- package/lib/cjs/video.js.map +1 -1
- package/lib/cjs/video.native.d.ts +6 -2
- package/lib/cjs/video.native.d.ts.map +1 -1
- package/lib/cjs/video.native.js +86 -9
- package/lib/cjs/video.native.js.map +1 -1
- package/lib/cjs/video_shared.d.ts +18 -2
- package/lib/cjs/video_shared.d.ts.map +1 -1
- package/lib/cjs/video_shared.js +114 -4
- package/lib/cjs/video_shared.js.map +1 -1
- package/lib/esm/controls.d.ts +0 -1
- package/lib/esm/controls.d.ts.map +1 -1
- package/lib/esm/hooks.d.ts +1 -13
- package/lib/esm/hooks.d.ts.map +1 -1
- package/lib/esm/hooks.js +1 -137
- package/lib/esm/hooks.js.map +1 -1
- package/lib/esm/index.d.ts +1 -2
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/index.native.d.ts +1 -2
- package/lib/esm/index.native.d.ts.map +1 -1
- package/lib/esm/index.native.js +1 -2
- package/lib/esm/index.native.js.map +1 -1
- package/lib/esm/video.d.ts +18 -11
- package/lib/esm/video.d.ts.map +1 -1
- package/lib/esm/video.js +103 -39
- package/lib/esm/video.js.map +1 -1
- package/lib/esm/video.native.d.ts +6 -2
- package/lib/esm/video.native.d.ts.map +1 -1
- package/lib/esm/video.native.js +85 -10
- package/lib/esm/video.native.js.map +1 -1
- package/lib/esm/video_shared.d.ts +18 -2
- package/lib/esm/video_shared.d.ts.map +1 -1
- package/lib/esm/video_shared.js +89 -1
- package/lib/esm/video_shared.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/index.native.ts +1 -5
- package/src/index.ts +1 -5
- package/src/video.native.tsx +103 -4
- package/src/video.tsx +106 -40
- package/src/video_shared.tsx +140 -2
- package/src/hooks.ts +0 -98
package/lib/cjs/video_shared.js
CHANGED
|
@@ -1,13 +1,123 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
37
|
+
var t = {};
|
|
38
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39
|
+
t[p] = s[p];
|
|
40
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
41
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
43
|
+
t[p[i]] = s[p[i]];
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
46
|
+
};
|
|
47
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
48
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
49
|
+
if (ar || !(i in from)) {
|
|
50
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
51
|
+
ar[i] = from[i];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
4
55
|
};
|
|
5
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useCurrentCallContext = exports.CurrentCallContext = void 0;
|
|
7
|
-
var
|
|
57
|
+
exports.WaitingRoom = exports.CreateCalendarEventForAttendees = exports.useCurrentCallContext = exports.CurrentCallContext = void 0;
|
|
58
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
59
|
+
var react_1 = __importStar(require("react"));
|
|
60
|
+
var react_components_1 = require("@tellescope/react-components");
|
|
61
|
+
var video_1 = require("./video");
|
|
8
62
|
exports.CurrentCallContext = react_1.default.createContext({});
|
|
9
63
|
var useCurrentCallContext = function () {
|
|
10
64
|
return react_1.default.useContext(exports.CurrentCallContext);
|
|
11
65
|
};
|
|
12
66
|
exports.useCurrentCallContext = useCurrentCallContext;
|
|
67
|
+
var CreateCalendarEventForAttendees = function (_a) {
|
|
68
|
+
var _b;
|
|
69
|
+
var onSuccess = _a.onSuccess, onError = _a.onError, eventProps = _a.eventProps, props = __rest(_a, ["onSuccess", "onError", "eventProps"]);
|
|
70
|
+
var _c = (0, react_components_1.useCalendarEvents)({ dontFetch: true }), createEvent = _c[1].createElement;
|
|
71
|
+
var eventTitle = (0, react_1.useState)((_b = eventProps === null || eventProps === void 0 ? void 0 : eventProps.title) !== null && _b !== void 0 ? _b : 'Video Call')[0];
|
|
72
|
+
var session = (0, react_components_1.useResolvedSession)();
|
|
73
|
+
var handleCreateRoom = (0, react_1.useCallback)(function (_a) {
|
|
74
|
+
var _b;
|
|
75
|
+
var users = _a.users, endusers = _a.endusers;
|
|
76
|
+
var userIds = users.map(function (u) { return u.id; });
|
|
77
|
+
var enduserIds = endusers.map(function (e) { return e.id; });
|
|
78
|
+
createEvent({
|
|
79
|
+
title: eventTitle,
|
|
80
|
+
attendees: (__spreadArray(__spreadArray([], userIds.map(function (id) { return ({ type: 'user', id: id }); }), true), enduserIds.map(function (id) { return ({ type: 'enduser', id: id }); }), true)),
|
|
81
|
+
startTimeInMS: (_b = eventProps === null || eventProps === void 0 ? void 0 : eventProps.startTimeInMS) !== null && _b !== void 0 ? _b : Date.now(),
|
|
82
|
+
durationInMinutes: (eventProps === null || eventProps === void 0 ? void 0 : eventProps.durationInMinutes) || 30,
|
|
83
|
+
enableVideoCall: true,
|
|
84
|
+
})
|
|
85
|
+
.then(function (r) {
|
|
86
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(r);
|
|
87
|
+
})
|
|
88
|
+
.catch(onError);
|
|
89
|
+
}, [session, onSuccess, onError]);
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.UserAndEnduserSelector, __assign({}, props, { onSelect: handleCreateRoom })));
|
|
91
|
+
};
|
|
92
|
+
exports.CreateCalendarEventForAttendees = CreateCalendarEventForAttendees;
|
|
93
|
+
var WaitingRoom = function (_a) {
|
|
94
|
+
var _b;
|
|
95
|
+
var calendarEvent = _a.calendarEvent, onGoBack = _a.onGoBack;
|
|
96
|
+
var session = (0, react_components_1.useSession)();
|
|
97
|
+
var _c = (0, react_components_1.useCalendarEvents)(), findEvent = _c[1].findById;
|
|
98
|
+
var _d = (0, react_components_1.useMeetings)(), findMeeting = _d[1].findById;
|
|
99
|
+
var startAndJoinMeeting = (0, video_1.useStartAndJoinMeetingForCalendarEvent)(calendarEvent.id).startAndJoinMeeting;
|
|
100
|
+
var joinMeeting = (0, video_1.useJoinVideoCall)().joinMeeting;
|
|
101
|
+
var tsMeeting = findMeeting((_b = calendarEvent === null || calendarEvent === void 0 ? void 0 : calendarEvent.meetingId) !== null && _b !== void 0 ? _b : '');
|
|
102
|
+
// poll to check for started meeting
|
|
103
|
+
(0, react_1.useEffect)(function () {
|
|
104
|
+
var t = setInterval(function () {
|
|
105
|
+
var _a;
|
|
106
|
+
var event = findEvent(calendarEvent.id, { reload: true });
|
|
107
|
+
findMeeting((_a = event === null || event === void 0 ? void 0 : event.meetingId) !== null && _a !== void 0 ? _a : '', { reload: true }); // reloads tsMeeting
|
|
108
|
+
}, 2500);
|
|
109
|
+
return function () { clearInterval(t); };
|
|
110
|
+
}, [calendarEvent, findMeeting, findEvent]);
|
|
111
|
+
var meetingIsStarted = (tsMeeting === null || tsMeeting === void 0 ? void 0 : tsMeeting.status) === 'live';
|
|
112
|
+
var isHost = session.userInfo.id === (calendarEvent === null || calendarEvent === void 0 ? void 0 : calendarEvent.creator);
|
|
113
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.Flex, __assign({ flex: 1, column: true, alignItems: "center", justifyContent: "center" }, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Typography, __assign({ style: { fontSize: 20, fontWeight: 'bold' } }, { children: calendarEvent.title })), (0, jsx_runtime_1.jsx)(react_components_1.Typography, __assign({ style: { marginBottom: 15 } }, { children: "Waiting Room" })), (0, jsx_runtime_1.jsx)(video_1.LocalPreview, {}), (0, jsx_runtime_1.jsx)(react_components_1.LoadingButton, { variant: "contained", disabled: (!meetingIsStarted && !isHost)
|
|
114
|
+
|| (meetingIsStarted && !tsMeeting), onClick: meetingIsStarted
|
|
115
|
+
? function () { return joinMeeting(tsMeeting.id); }
|
|
116
|
+
: startAndJoinMeeting, submitText: meetingIsStarted ? "Join Meeting" : "Start Meeting", submittingText: meetingIsStarted ? "Joining" : "Starting", style: {
|
|
117
|
+
marginTop: 15,
|
|
118
|
+
} }), onGoBack &&
|
|
119
|
+
(0, jsx_runtime_1.jsx)(react_components_1.Button, __assign({ onClick: onGoBack, style: { width: '100%' } }, { children: "Back" })), !meetingIsStarted && !isHost &&
|
|
120
|
+
(0, jsx_runtime_1.jsx)(react_components_1.Typography, __assign({ style: { marginTop: 5 } }, { children: "Waiting for the host to start the meeting" }))] })));
|
|
121
|
+
};
|
|
122
|
+
exports.WaitingRoom = WaitingRoom;
|
|
13
123
|
//# sourceMappingURL=video_shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video_shared.js","sourceRoot":"","sources":["../../src/video_shared.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"video_shared.js","sourceRoot":"","sources":["../../src/video_shared.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA8E;AAiB9E,iEAWqC;AACrC,iCAAgG;AAcnF,QAAA,kBAAkB,GAAG,eAAK,CAAC,aAAa,CAAC,EAAiB,CAAC,CAAA;AAEjE,IAAM,qBAAqB,GAAG;IACnC,OAA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,EAErD,cAAc,EACZ,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAE3C,KAAK,EAAE;oBACL,SAAS,EAAE,EAAE;iBACd,GACD,EAED,QAAQ;gBACP,uBAAC,yBAAM,aAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,0BAE1C,EAGV,CAAC,gBAAgB,IAAI,CAAC,MAAM;gBAC3B,uBAAC,6BAAU,aAAC,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,+DAEtB,KAEV,CACR,CAAA;AACH,CAAC,CAAA;AApEY,QAAA,WAAW,eAoEvB"}
|
package/lib/esm/controls.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../src/controls.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../src/controls.tsx"],"names":[],"mappings":"AAGA,OAAO,EASL,MAAM,EACP,MAAM,8BAA8B,CAAA;AAMrC,UAAU,WAAW;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AACD,eAAO,MAAM,WAAW,aAAmC,WAAW,gBAQrE,CAAA;AAED,eAAO,MAAM,gBAAgB,aAAkC,WAAW,gBAQzE,CAAA;AAGD,eAAO,MAAM,UAAU,sBAA2C,WAAW,GAAG,iBAAiB,gBAWhG,CAAA;AAED,UAAU,iBAAiB;IACzB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AACD,eAAO,MAAM,YAAY,sBAA4C,iBAAiB,GAAG,WAAW,gBAWnG,CAAA;AAED,UAAU,eAAe;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CAEf;AACD,eAAO,MAAM,UAAU,sCAA2C,eAAe,GAAG,iBAAiB,GAAG,MAAM,gBAmB7G,CAAA"}
|
package/lib/esm/hooks.d.ts
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const useStartAndJoinMeetingForCalendarEvent: (calendarEventId: string) => {
|
|
3
|
-
startAndJoinMeeting: () => Promise<void>;
|
|
4
|
-
};
|
|
5
|
-
export declare const useJoinMeeting: () => {
|
|
6
|
-
joinMeeting: (meeting: Meeting) => Promise<void>;
|
|
7
|
-
};
|
|
8
|
-
export declare const useMeetingForCalendarEvent: (event: CalendarEvent) => {
|
|
9
|
-
startAndJoinMeeting: () => Promise<void>;
|
|
10
|
-
joinMeeting: (meeting: Meeting) => Promise<void>;
|
|
11
|
-
meeting: import("@tellescope/types-models/src").MeetingInfo | undefined;
|
|
12
|
-
meetingStatus: string;
|
|
13
|
-
};
|
|
1
|
+
export {};
|
|
14
2
|
//# sourceMappingURL=hooks.d.ts.map
|
package/lib/esm/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":""}
|
package/lib/esm/hooks.js
CHANGED
|
@@ -1,138 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (_) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { useCallback, useContext } from "react";
|
|
38
|
-
import { useCalendarEvents, useResolvedSession, useSession } from "@tellescope/react-components";
|
|
39
|
-
import { useMeetingManager } from "amazon-chime-sdk-component-library-react";
|
|
40
|
-
import { CurrentCallContext, useCurrentCallContext } from "./index";
|
|
41
|
-
export var useStartAndJoinMeetingForCalendarEvent = function (calendarEventId) {
|
|
42
|
-
var session = useSession();
|
|
43
|
-
var _a = useCalendarEvents(), updateLocalEvent = _a[1].updateLocalElement;
|
|
44
|
-
var meetingManager = useMeetingManager();
|
|
45
|
-
var _b = useContext(CurrentCallContext), setMeeting = _b.setMeeting, setIsHost = _b.setIsHost;
|
|
46
|
-
if (!(!!setMeeting && setIsHost)) {
|
|
47
|
-
throw new Error("Missing CurrentCallContext");
|
|
48
|
-
}
|
|
49
|
-
var startAndJoinMeeting = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
-
var _a, meeting, host, id;
|
|
51
|
-
return __generator(this, function (_b) {
|
|
52
|
-
switch (_b.label) {
|
|
53
|
-
case 0: return [4 /*yield*/, session.api.meetings.start_meeting_for_event({ calendarEventId: calendarEventId })];
|
|
54
|
-
case 1:
|
|
55
|
-
_a = _b.sent(), meeting = _a.meeting, host = _a.host, id = _a.id;
|
|
56
|
-
updateLocalEvent(calendarEventId, { meetingId: id });
|
|
57
|
-
setMeeting(meeting);
|
|
58
|
-
return [4 /*yield*/, meetingManager.join({ meetingInfo: meeting, attendeeInfo: host.info })];
|
|
59
|
-
case 2:
|
|
60
|
-
_b.sent(); // Use the join API to create a meeting session
|
|
61
|
-
return [4 /*yield*/, meetingManager.start()];
|
|
62
|
-
case 3:
|
|
63
|
-
_b.sent(); // At this point you can let users setup their devices, or start the session immediately
|
|
64
|
-
setMeeting(meeting.Meeting);
|
|
65
|
-
setIsHost(true);
|
|
66
|
-
return [2 /*return*/];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}); }, [session, calendarEventId, updateLocalEvent, meetingManager, setMeeting, setIsHost]);
|
|
70
|
-
return {
|
|
71
|
-
startAndJoinMeeting: startAndJoinMeeting,
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
export var useJoinMeeting = function () {
|
|
75
|
-
var session = useResolvedSession();
|
|
76
|
-
var meetingManager = useMeetingManager();
|
|
77
|
-
var _a = useContext(CurrentCallContext), setMeeting = _a.setMeeting, setIsHost = _a.setIsHost;
|
|
78
|
-
if (!(!!setMeeting && setIsHost)) {
|
|
79
|
-
throw new Error("Missing CurrentCallContext");
|
|
80
|
-
}
|
|
81
|
-
var joinMeeting = useCallback(function (meeting) { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
|
-
var attendeeInfo, calendarEventId, result;
|
|
83
|
-
var _a;
|
|
84
|
-
return __generator(this, function (_b) {
|
|
85
|
-
switch (_b.label) {
|
|
86
|
-
case 0:
|
|
87
|
-
setMeeting(meeting.meetingInfo.Meeting);
|
|
88
|
-
setIsHost(meeting.creator === session.userInfo.id);
|
|
89
|
-
attendeeInfo = (_a = meeting.attendees.find(function (a) { return a.id === session.userInfo.id; })) === null || _a === void 0 ? void 0 : _a.info;
|
|
90
|
-
if (!!attendeeInfo) return [3 /*break*/, 3];
|
|
91
|
-
calendarEventId = meeting.calendarEventId;
|
|
92
|
-
if (!calendarEventId) return [3 /*break*/, 2];
|
|
93
|
-
return [4 /*yield*/, session.api.meetings.join_meeting_for_event({ calendarEventId: calendarEventId })];
|
|
94
|
-
case 1:
|
|
95
|
-
result = _b.sent();
|
|
96
|
-
attendeeInfo = result.attendee.info;
|
|
97
|
-
_b.label = 2;
|
|
98
|
-
case 2:
|
|
99
|
-
if (!attendeeInfo) {
|
|
100
|
-
console.error("Could not find attendee info for joining meeting and failed to join");
|
|
101
|
-
return [2 /*return*/];
|
|
102
|
-
}
|
|
103
|
-
_b.label = 3;
|
|
104
|
-
case 3: return [4 /*yield*/, meetingManager.join({
|
|
105
|
-
meetingInfo: meeting.meetingInfo,
|
|
106
|
-
attendeeInfo: attendeeInfo,
|
|
107
|
-
})];
|
|
108
|
-
case 4:
|
|
109
|
-
_b.sent(); // Use the join API to create a meeting session
|
|
110
|
-
return [4 /*yield*/, meetingManager.start()];
|
|
111
|
-
case 5:
|
|
112
|
-
_b.sent(); // At this point you can let users setup their devices, or start the session immediately
|
|
113
|
-
return [2 /*return*/];
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}); }, [setMeeting, meetingManager, setMeeting, setIsHost]);
|
|
117
|
-
return {
|
|
118
|
-
joinMeeting: joinMeeting,
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
export var useMeetingForCalendarEvent = function (event) {
|
|
122
|
-
var meeting = useCurrentCallContext().meeting;
|
|
123
|
-
var startAndJoinMeeting = useStartAndJoinMeetingForCalendarEvent(event.id).startAndJoinMeeting;
|
|
124
|
-
var joinMeeting = useJoinMeeting().joinMeeting;
|
|
125
|
-
return {
|
|
126
|
-
startAndJoinMeeting: startAndJoinMeeting,
|
|
127
|
-
joinMeeting: joinMeeting,
|
|
128
|
-
meeting: meeting,
|
|
129
|
-
meetingStatus: (!event.enableVideoCall
|
|
130
|
-
? 'disabled'
|
|
131
|
-
: !(event.meetingId)
|
|
132
|
-
? 'waiting-room'
|
|
133
|
-
: !!meeting
|
|
134
|
-
? 'joined'
|
|
135
|
-
: 'loading')
|
|
136
|
-
};
|
|
137
|
-
};
|
|
1
|
+
export {};
|
|
138
2
|
//# sourceMappingURL=hooks.js.map
|
package/lib/esm/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":""}
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
|
package/lib/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from "./video";
|
|
2
|
-
export * from "./hooks";
|
|
3
2
|
export * from "./controls";
|
|
4
|
-
export
|
|
3
|
+
export * from "./video_shared";
|
|
5
4
|
export { RNVideoRenderView, } from "./native/RNVideoRenderView";
|
|
6
5
|
export { MobileSDKEvent, NativeFunction, getSDKEventEmitter, } from "./native/bridge";
|
|
7
6
|
//# sourceMappingURL=index.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.native.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.native.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EACL,iBAAiB,GAClB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,iBAAiB,CAAA"}
|
package/lib/esm/index.native.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from "./video";
|
|
2
|
-
export * from "./hooks";
|
|
3
2
|
export * from "./controls";
|
|
4
|
-
export
|
|
3
|
+
export * from "./video_shared";
|
|
5
4
|
export { RNVideoRenderView, } from "./native/RNVideoRenderView";
|
|
6
5
|
export { MobileSDKEvent, NativeFunction, getSDKEventEmitter, } from "./native/bridge";
|
|
7
6
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../src/index.native.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../src/index.native.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EACL,iBAAiB,GAClB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,iBAAiB,CAAA"}
|
package/lib/esm/video.d.ts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import { Styled
|
|
3
|
-
import {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Styled } from "@tellescope/react-components";
|
|
3
|
+
import { Meeting, MeetingInfo } from '@tellescope/types-models';
|
|
4
4
|
import { VideoTileGrid } from 'amazon-chime-sdk-component-library-react';
|
|
5
|
+
import { VideoCallNativeProps } from "./index";
|
|
5
6
|
import { VideoProps, VideoViewProps, JoinVideoCallReturnType, StartVideoCallReturnType, JoinVideoCallProps } from "./video_shared";
|
|
7
|
+
import { CalendarEvent } from "@tellescope/types-client";
|
|
8
|
+
export declare const useMeetingForCalendarEvent: (event: CalendarEvent) => {
|
|
9
|
+
startAndJoinMeeting: () => Promise<void>;
|
|
10
|
+
joinMeeting: (meeting: Meeting) => Promise<void>;
|
|
11
|
+
meeting: MeetingInfo | undefined;
|
|
12
|
+
meetingStatus: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const useStartAndJoinMeetingForCalendarEvent: (calendarEventId: string) => {
|
|
15
|
+
startAndJoinMeeting: () => Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
export declare const useJoinMeeting: () => {
|
|
18
|
+
joinMeeting: (meeting: Meeting) => Promise<void>;
|
|
19
|
+
};
|
|
6
20
|
export declare const WithVideo: ({ children }: VideoProps) => JSX.Element;
|
|
7
21
|
export declare const useStartVideoCall: () => StartVideoCallReturnType;
|
|
8
22
|
export declare const useJoinVideoCall: (props?: JoinVideoCallProps | undefined) => JoinVideoCallReturnType;
|
|
@@ -10,12 +24,5 @@ export declare const SelfView: ({ style }: VideoViewProps) => JSX.Element;
|
|
|
10
24
|
export declare const useRemoteViews: (props?: VideoViewProps) => JSX.Element[];
|
|
11
25
|
export declare const LocalPreview: ({ style }: Styled) => JSX.Element;
|
|
12
26
|
export { VideoTileGrid };
|
|
13
|
-
export
|
|
14
|
-
onSuccess?: ({ id }: {
|
|
15
|
-
id: string;
|
|
16
|
-
}) => void;
|
|
17
|
-
onError?: (e: APIError) => void;
|
|
18
|
-
roomTitle?: string;
|
|
19
|
-
}
|
|
20
|
-
export declare const CreateMeeting: ({ roomTitle: defaultRoomTitle, onSuccess, onError, ...props }: CreateMeetingProps) => JSX.Element;
|
|
27
|
+
export declare const VideoCallNative: React.JSXElementConstructor<VideoCallNativeProps>;
|
|
21
28
|
//# sourceMappingURL=video.d.ts.map
|
package/lib/esm/video.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../src/video.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../src/video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuD,MAAM,OAAO,CAAA;AAE3E,OAAO,EAGL,MAAM,EACP,MAAM,8BAA8B,CAAA;AAKrC,OAAO,EAEL,OAAO,EACP,WAAW,EACZ,MAAM,0BAA0B,CAAA;AAIjC,OAAO,EAKL,aAAa,EAgBd,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAEL,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAChB,OAAO,EAEL,UAAU,EACV,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,gBAAgB,CAAA;AAKvB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,eAAO,MAAM,0BAA0B,UAAW,aAAa;;2BA6Db,OAAO;;;CAzCxD,CAAA;AAED,eAAO,MAAM,sCAAsC,oBAAqB,MAAM;;CA4B7E,CAAA;AAED,eAAO,MAAM,cAAc;2BASuB,OAAO;CA8BxD,CAAA;AAmCD,eAAO,MAAM,SAAS,iBAAkB,UAAU,gBAQjD,CAAA;AAED,eAAO,MAAM,iBAAiB,QAAO,wBA8CpC,CAAA;AAED,eAAO,MAAM,gBAAgB,8CAAiC,uBA+C7D,CAAA;AAED,eAAO,MAAM,QAAQ,cAAe,cAAc,gBAA2C,CAAA;AAE7F,eAAO,MAAM,cAAc,2CAO1B,CAAA;AAsCD,eAAO,MAAM,YAAY,cAAmC,MAAM,gBAyBjE,CAAA;AACD,OAAO,EAAE,aAAa,EAAE,CAAA;AAGxB,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,qBAAqB,CAAC,oBAAoB,CAE7E,CAAA"}
|
package/lib/esm/video.js
CHANGED
|
@@ -45,29 +45,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
-
var t = {};
|
|
50
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
-
t[p] = s[p];
|
|
52
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
-
t[p[i]] = s[p[i]];
|
|
56
|
-
}
|
|
57
|
-
return t;
|
|
58
|
-
};
|
|
59
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
60
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
61
|
-
if (ar || !(i in from)) {
|
|
62
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
63
|
-
ar[i] = from[i];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
67
|
-
};
|
|
68
48
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
69
|
-
import React, { useCallback, useState, useEffect } from "react";
|
|
70
|
-
import { useResolvedSession, useSession,
|
|
49
|
+
import React, { useCallback, useContext, useState, useEffect } from "react";
|
|
50
|
+
import { useResolvedSession, useSession, } from "@tellescope/react-components";
|
|
71
51
|
import { ThemeProvider } from 'styled-components';
|
|
72
52
|
import { MeetingProvider, darkTheme, useContentShareState,
|
|
73
53
|
// LocalVideo,
|
|
@@ -83,6 +63,105 @@ LocalVideo, useLocalVideo, useMeetingManager, useRosterState, useRemoteVideoTile
|
|
|
83
63
|
} from 'amazon-chime-sdk-component-library-react';
|
|
84
64
|
import { CurrentCallContext, } from "./index";
|
|
85
65
|
import { ConsoleLogger, DefaultDeviceController, LogLevel } from "amazon-chime-sdk-js";
|
|
66
|
+
import { useCalendarEvents } from "@tellescope/react-components";
|
|
67
|
+
import { useCurrentCallContext } from "./index";
|
|
68
|
+
export var useMeetingForCalendarEvent = function (event) {
|
|
69
|
+
var meeting = useCurrentCallContext().meeting;
|
|
70
|
+
var startAndJoinMeeting = useStartAndJoinMeetingForCalendarEvent(event.id).startAndJoinMeeting;
|
|
71
|
+
var joinMeeting = useJoinMeeting().joinMeeting;
|
|
72
|
+
return {
|
|
73
|
+
startAndJoinMeeting: startAndJoinMeeting,
|
|
74
|
+
joinMeeting: joinMeeting,
|
|
75
|
+
meeting: meeting,
|
|
76
|
+
meetingStatus: (!event.enableVideoCall
|
|
77
|
+
? 'disabled'
|
|
78
|
+
: !(event.meetingId)
|
|
79
|
+
? 'waiting-room'
|
|
80
|
+
: !!meeting
|
|
81
|
+
? 'joined'
|
|
82
|
+
: 'loading')
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export var useStartAndJoinMeetingForCalendarEvent = function (calendarEventId) {
|
|
86
|
+
var session = useSession();
|
|
87
|
+
var _a = useCalendarEvents(), updateLocalEvent = _a[1].updateLocalElement;
|
|
88
|
+
var meetingManager = useMeetingManager();
|
|
89
|
+
var _b = useContext(CurrentCallContext), setMeeting = _b.setMeeting, setIsHost = _b.setIsHost;
|
|
90
|
+
if (!(!!setMeeting && setIsHost)) {
|
|
91
|
+
throw new Error("Missing CurrentCallContext");
|
|
92
|
+
}
|
|
93
|
+
var startAndJoinMeeting = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
94
|
+
var _a, meeting, host, id;
|
|
95
|
+
return __generator(this, function (_b) {
|
|
96
|
+
switch (_b.label) {
|
|
97
|
+
case 0: return [4 /*yield*/, session.api.meetings.start_meeting_for_event({ calendarEventId: calendarEventId })];
|
|
98
|
+
case 1:
|
|
99
|
+
_a = _b.sent(), meeting = _a.meeting, host = _a.host, id = _a.id;
|
|
100
|
+
updateLocalEvent(calendarEventId, { meetingId: id });
|
|
101
|
+
setMeeting(meeting);
|
|
102
|
+
return [4 /*yield*/, meetingManager.join({ meetingInfo: meeting, attendeeInfo: host.info })];
|
|
103
|
+
case 2:
|
|
104
|
+
_b.sent(); // Use the join API to create a meeting session
|
|
105
|
+
return [4 /*yield*/, meetingManager.start()];
|
|
106
|
+
case 3:
|
|
107
|
+
_b.sent(); // At this point you can let users setup their devices, or start the session immediately
|
|
108
|
+
setMeeting(meeting.Meeting);
|
|
109
|
+
setIsHost(true);
|
|
110
|
+
return [2 /*return*/];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}); }, [session, calendarEventId, updateLocalEvent, meetingManager, setMeeting, setIsHost]);
|
|
114
|
+
return {
|
|
115
|
+
startAndJoinMeeting: startAndJoinMeeting,
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export var useJoinMeeting = function () {
|
|
119
|
+
var session = useResolvedSession();
|
|
120
|
+
var meetingManager = useMeetingManager();
|
|
121
|
+
var _a = useContext(CurrentCallContext), setMeeting = _a.setMeeting, setIsHost = _a.setIsHost;
|
|
122
|
+
if (!(!!setMeeting && setIsHost)) {
|
|
123
|
+
throw new Error("Missing CurrentCallContext");
|
|
124
|
+
}
|
|
125
|
+
var joinMeeting = useCallback(function (meeting) { return __awaiter(void 0, void 0, void 0, function () {
|
|
126
|
+
var attendeeInfo, calendarEventId, result;
|
|
127
|
+
var _a;
|
|
128
|
+
return __generator(this, function (_b) {
|
|
129
|
+
switch (_b.label) {
|
|
130
|
+
case 0:
|
|
131
|
+
setMeeting(meeting.meetingInfo.Meeting);
|
|
132
|
+
setIsHost(meeting.creator === session.userInfo.id);
|
|
133
|
+
attendeeInfo = (_a = meeting.attendees.find(function (a) { return a.id === session.userInfo.id; })) === null || _a === void 0 ? void 0 : _a.info;
|
|
134
|
+
if (!!attendeeInfo) return [3 /*break*/, 3];
|
|
135
|
+
calendarEventId = meeting.calendarEventId;
|
|
136
|
+
if (!calendarEventId) return [3 /*break*/, 2];
|
|
137
|
+
return [4 /*yield*/, session.api.meetings.join_meeting_for_event({ calendarEventId: calendarEventId })];
|
|
138
|
+
case 1:
|
|
139
|
+
result = _b.sent();
|
|
140
|
+
attendeeInfo = result.attendee.info;
|
|
141
|
+
_b.label = 2;
|
|
142
|
+
case 2:
|
|
143
|
+
if (!attendeeInfo) {
|
|
144
|
+
console.error("Could not find attendee info for joining meeting and failed to join");
|
|
145
|
+
return [2 /*return*/];
|
|
146
|
+
}
|
|
147
|
+
_b.label = 3;
|
|
148
|
+
case 3: return [4 /*yield*/, meetingManager.join({
|
|
149
|
+
meetingInfo: meeting.meetingInfo,
|
|
150
|
+
attendeeInfo: attendeeInfo,
|
|
151
|
+
})];
|
|
152
|
+
case 4:
|
|
153
|
+
_b.sent(); // Use the join API to create a meeting session
|
|
154
|
+
return [4 /*yield*/, meetingManager.start()];
|
|
155
|
+
case 5:
|
|
156
|
+
_b.sent(); // At this point you can let users setup their devices, or start the session immediately
|
|
157
|
+
return [2 /*return*/];
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}); }, [setMeeting, meetingManager, setMeeting, setIsHost]);
|
|
161
|
+
return {
|
|
162
|
+
joinMeeting: joinMeeting,
|
|
163
|
+
};
|
|
164
|
+
};
|
|
86
165
|
var WithContext = function (_a) {
|
|
87
166
|
var children = _a.children;
|
|
88
167
|
var _b = useState(undefined), meeting = _b[0], setMeeting = _b[1];
|
|
@@ -323,21 +402,6 @@ export var LocalPreview = function (_a) {
|
|
|
323
402
|
return _jsx("video", { id: PREVIEW_ELEMENT_ID, style: style }, void 0);
|
|
324
403
|
};
|
|
325
404
|
export { VideoTileGrid };
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
var session = useSession();
|
|
329
|
-
var handleCreateRoom = useCallback(function (_a) {
|
|
330
|
-
var users = _a.users, endusers = _a.endusers;
|
|
331
|
-
var userIds = users.map(function (u) { return u.id; });
|
|
332
|
-
var enduserIds = endusers.map(function (e) { return e.id; });
|
|
333
|
-
session.api.meetings.start_meeting({
|
|
334
|
-
attendees: (__spreadArray(__spreadArray([], userIds.map(function (id) { return ({ type: 'user', id: id }); }), true), enduserIds.map(function (id) { return ({ type: 'enduser', id: id }); }), true))
|
|
335
|
-
})
|
|
336
|
-
.then(function (r) {
|
|
337
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(r);
|
|
338
|
-
})
|
|
339
|
-
.catch(onError);
|
|
340
|
-
}, [session, onSuccess, onError]);
|
|
341
|
-
return (_jsx(UserAndEnduserSelector, __assign({}, props, { onSelect: handleCreateRoom }), void 0));
|
|
342
|
-
};
|
|
405
|
+
// unimplemented for web
|
|
406
|
+
export var VideoCallNative = function () { return (null); };
|
|
343
407
|
//# sourceMappingURL=video.js.map
|