@whereby.com/browser-sdk 2.1.0 → 2.2.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.
@@ -1,26 +1,5 @@
1
1
  import { define, ref } from 'heresy';
2
-
3
- function parseRoomUrlAndSubdomain(roomAttribute, subdomainAttribute) {
4
- if (!roomAttribute) {
5
- throw new Error("Missing room attribute");
6
- }
7
- // Get subdomain from room URL, or use it specified
8
- const m = /https:\/\/([^.]+)(\.whereby\.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(roomAttribute);
9
- const subdomain = (m && m[1]) || subdomainAttribute;
10
- if (!subdomain) {
11
- throw new Error("Missing subdomain attribute");
12
- }
13
- if (!m) {
14
- throw new Error("Could not parse room URL");
15
- }
16
- const roomUrl = new URL(roomAttribute);
17
- return {
18
- subdomain,
19
- roomUrl,
20
- };
21
- }
22
-
23
- const sdkVersion = "2.1.0";
2
+ import { parseRoomUrlAndSubdomain } from '@whereby.com/core/utils';
24
3
 
25
4
  const boolAttrs = [
26
5
  "audio",
@@ -89,7 +68,6 @@ define("WherebyEmbed", {
89
68
  }
90
69
  `;
91
70
  },
92
- // Commands
93
71
  _postCommand(command, args = []) {
94
72
  if (this.iframe.current) {
95
73
  this.iframe.current.contentWindow.postMessage({ command, args }, this.roomUrl.origin);
@@ -135,9 +113,7 @@ define("WherebyEmbed", {
135
113
  return this.html `Whereby: ${error instanceof Error ? error.message : "unknown error"}`;
136
114
  }
137
115
  this.roomUrl = roomUrl;
138
- Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: sdkVersion, iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang: lang })), (metadata && { metadata: metadata })), (externalId && { externalId })), (groups && { groups: groups })), (virtualBackgroundUrl && { virtualBackgroundUrl: virtualBackgroundUrl })), (avatarUrl && { avatarUrl: avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
139
- // add to URL if set in any way
140
- (o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
116
+ Object.entries(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 })), (externalId && { externalId })), (groups && { groups: groups })), (virtualBackgroundUrl && { virtualBackgroundUrl: virtualBackgroundUrl })), (avatarUrl && { avatarUrl: avatarUrl })), (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]) => {
141
117
  if (!this.roomUrl.searchParams.has(k)) {
142
118
  this.roomUrl.searchParams.set(k, v);
143
119
  }
@@ -151,6 +127,6 @@ define("WherebyEmbed", {
151
127
  `;
152
128
  },
153
129
  });
154
- var index = { sdkVersion: sdkVersion };
130
+ var index = { sdkVersion: "1" };
155
131
 
156
132
  export { index as default };