@whereby.com/browser-sdk 3.9.1 → 3.9.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/dist/cdn/v3-embed.js +1 -1
- package/dist/cdn/v3-react.js +1 -1
- package/dist/embed/index.cjs +179 -0
- package/dist/react/index.cjs +2251 -0
- package/dist/react/index.esm.js +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var heresy = require('heresy');
|
|
6
|
+
var core = require('@whereby.com/core');
|
|
7
|
+
|
|
8
|
+
const boolAttrs = [
|
|
9
|
+
"aec",
|
|
10
|
+
"agc",
|
|
11
|
+
"audio",
|
|
12
|
+
"audioDenoiser",
|
|
13
|
+
"autoHideSelfView",
|
|
14
|
+
"autoSpotlight",
|
|
15
|
+
"background",
|
|
16
|
+
"bottomToolbar",
|
|
17
|
+
"breakout",
|
|
18
|
+
"callQualityMonitoring",
|
|
19
|
+
"cameraAccess",
|
|
20
|
+
"chat",
|
|
21
|
+
"embed",
|
|
22
|
+
"emptyRoomInvitation",
|
|
23
|
+
"floatSelf",
|
|
24
|
+
"help",
|
|
25
|
+
"leaveButton",
|
|
26
|
+
"locking",
|
|
27
|
+
"localization",
|
|
28
|
+
"logo",
|
|
29
|
+
"lowData",
|
|
30
|
+
"moreButton",
|
|
31
|
+
"participantCount",
|
|
32
|
+
"personality",
|
|
33
|
+
"pipButton",
|
|
34
|
+
"precallCeremony",
|
|
35
|
+
"precallCeremonyCanSkip",
|
|
36
|
+
"precallPermissionsHelpLink",
|
|
37
|
+
"precallReview",
|
|
38
|
+
"people",
|
|
39
|
+
"reactions",
|
|
40
|
+
"recording",
|
|
41
|
+
"roomIntegrations",
|
|
42
|
+
"screenshare",
|
|
43
|
+
"settingsButton",
|
|
44
|
+
"skipMediaPermissionPrompt",
|
|
45
|
+
"subgridLabels",
|
|
46
|
+
"timer",
|
|
47
|
+
"toolbarDarkText",
|
|
48
|
+
"topToolbar",
|
|
49
|
+
"video",
|
|
50
|
+
];
|
|
51
|
+
heresy.define("WherebyEmbed", {
|
|
52
|
+
oninit() {
|
|
53
|
+
this.iframe = heresy.ref();
|
|
54
|
+
},
|
|
55
|
+
onconnected() {
|
|
56
|
+
window.addEventListener("message", this.onmessage.bind(this));
|
|
57
|
+
},
|
|
58
|
+
ondisconnected() {
|
|
59
|
+
window.removeEventListener("message", this.onmessage.bind(this));
|
|
60
|
+
},
|
|
61
|
+
observedAttributes: [
|
|
62
|
+
"displayName",
|
|
63
|
+
"minimal",
|
|
64
|
+
"room",
|
|
65
|
+
"subdomain",
|
|
66
|
+
"lang",
|
|
67
|
+
"metadata",
|
|
68
|
+
"groups",
|
|
69
|
+
"virtualBackgroundUrl",
|
|
70
|
+
"avatarUrl",
|
|
71
|
+
"externalId",
|
|
72
|
+
"title",
|
|
73
|
+
"cameraEffect",
|
|
74
|
+
"emojiSkinTone",
|
|
75
|
+
...boolAttrs,
|
|
76
|
+
].map((a) => a.toLowerCase()),
|
|
77
|
+
onattributechanged({ attributeName, oldValue }) {
|
|
78
|
+
if (["room", "subdomain"].includes(attributeName) && oldValue == null)
|
|
79
|
+
return;
|
|
80
|
+
this.render();
|
|
81
|
+
},
|
|
82
|
+
style(self) {
|
|
83
|
+
return `
|
|
84
|
+
${self} {
|
|
85
|
+
display: block;
|
|
86
|
+
}
|
|
87
|
+
${self} iframe {
|
|
88
|
+
border: none;
|
|
89
|
+
height: 100%;
|
|
90
|
+
width: 100%;
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
},
|
|
94
|
+
_postCommand(command, args = []) {
|
|
95
|
+
if (this.iframe.current) {
|
|
96
|
+
this.iframe.current.contentWindow.postMessage({ command, args }, this.roomUrl.origin);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
endMeeting() {
|
|
100
|
+
this._postCommand("end_meeting");
|
|
101
|
+
},
|
|
102
|
+
knock() {
|
|
103
|
+
this._postCommand("knock");
|
|
104
|
+
},
|
|
105
|
+
leaveRoom() {
|
|
106
|
+
this._postCommand("leave_room");
|
|
107
|
+
},
|
|
108
|
+
openSettings(settingsPane = "media") {
|
|
109
|
+
this._postCommand("open_settings", [settingsPane]);
|
|
110
|
+
},
|
|
111
|
+
startRecording() {
|
|
112
|
+
this._postCommand("start_recording");
|
|
113
|
+
},
|
|
114
|
+
stopRecording() {
|
|
115
|
+
this._postCommand("stop_recording");
|
|
116
|
+
},
|
|
117
|
+
startStreaming() {
|
|
118
|
+
this._postCommand("start_streaming");
|
|
119
|
+
},
|
|
120
|
+
stopStreaming() {
|
|
121
|
+
this._postCommand("stop_streaming");
|
|
122
|
+
},
|
|
123
|
+
startLiveTranscription() {
|
|
124
|
+
this._postCommand("start_live_transcription");
|
|
125
|
+
},
|
|
126
|
+
stopLiveTranscription() {
|
|
127
|
+
this._postCommand("stop_live_transcription");
|
|
128
|
+
},
|
|
129
|
+
toggleBreakout(open) {
|
|
130
|
+
this._postCommand("toggle_breakout", [open]);
|
|
131
|
+
},
|
|
132
|
+
toggleCamera(enabled) {
|
|
133
|
+
this._postCommand("toggle_camera", [enabled]);
|
|
134
|
+
},
|
|
135
|
+
toggleMicrophone(enabled) {
|
|
136
|
+
this._postCommand("toggle_microphone", [enabled]);
|
|
137
|
+
},
|
|
138
|
+
togglePeople(enabled) {
|
|
139
|
+
this._postCommand("toggle_people", [enabled]);
|
|
140
|
+
},
|
|
141
|
+
toggleScreenshare(enabled) {
|
|
142
|
+
this._postCommand("toggle_screenshare", [enabled]);
|
|
143
|
+
},
|
|
144
|
+
toggleChat(enabled) {
|
|
145
|
+
this._postCommand("toggle_chat", [enabled]);
|
|
146
|
+
},
|
|
147
|
+
onmessage({ origin, data, }) {
|
|
148
|
+
if (!this.roomUrl || origin !== this.roomUrl.origin)
|
|
149
|
+
return;
|
|
150
|
+
const { type, payload: detail } = data;
|
|
151
|
+
this.dispatchEvent(new CustomEvent(type, { detail }));
|
|
152
|
+
},
|
|
153
|
+
render() {
|
|
154
|
+
const { avatarurl: avatarUrl, displayname: displayName, cameraeffect: cameraEffect, emojiskintone: emojiSkinTone, lang, metadata, externalid: externalId, minimal, room, groups, virtualbackgroundurl: virtualBackgroundUrl, title, } = this;
|
|
155
|
+
let roomUrl, subdomain;
|
|
156
|
+
try {
|
|
157
|
+
({ roomUrl, subdomain } = core.parseRoomUrlAndSubdomain(room, this.subdomain));
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
return this.html `Whereby: ${error instanceof Error ? error.message : "unknown error"}`;
|
|
161
|
+
}
|
|
162
|
+
this.roomUrl = roomUrl;
|
|
163
|
+
Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "1", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang: lang })), (metadata && { metadata: metadata })), (emojiSkinTone && { emojiSkinTone })), (externalId && { externalId })), (groups && { groups: groups })), (virtualBackgroundUrl && { virtualBackgroundUrl: virtualBackgroundUrl })), (avatarUrl && { avatarUrl: avatarUrl })), (cameraEffect && { cameraEffect: cameraEffect })), (minimal != null && { embed: minimal })), boolAttrs.reduce((o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
|
|
164
|
+
if (!this.roomUrl.searchParams.has(k)) {
|
|
165
|
+
this.roomUrl.searchParams.set(k, v);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
this.html `
|
|
169
|
+
<iframe
|
|
170
|
+
title=${title || "Video calling component"}
|
|
171
|
+
ref=${this.iframe}
|
|
172
|
+
src=${this.roomUrl}
|
|
173
|
+
allow="autoplay; camera; microphone; fullscreen; speaker; display-capture; media-capture" />
|
|
174
|
+
`;
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
var index = { sdkVersion: "1" };
|
|
178
|
+
|
|
179
|
+
exports.default = index;
|