liveroom-client-element 0.0.44 → 0.0.45
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/{constants-D2eonWil.js → constants-C3YM3f23.js} +12 -10
- package/dist/constants-CSWpxxUh.cjs +1 -0
- package/dist/liveroom-client-element.cjs +9 -9
- package/dist/liveroom-client-element.js +2348 -2331
- package/dist/main.cjs +1 -1
- package/dist/main.js +45 -39
- package/package.json +1 -1
- package/dist/constants-BJHM5eo7.cjs +0 -1
package/dist/main.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("./constants-CSWpxxUh.cjs"),E=e=>Object.freeze(Object.defineProperty({__proto__:null,default:e},Symbol.toStringTag,{value:"Module"}));let a,m,r;u();S();function S(){window.addEventListener("popstate",u)}async function u(){const e=document.querySelector("script[src*='/liveroom-client-element']");e==null||e.setAttribute("version",n.VERSION);const{roomId:t,roomToken:o}=A(e);if(t&&o&&(t!=a||o!=m)){a=t,m=o,sessionStorage==null||sessionStorage.setItem(n.SESSION_STORAGE_KEY_ROOM_ID,a),sessionStorage==null||sessionStorage.setItem(n.SESSION_STORAGE_KEY_ROOM_TOKEN,m),r&&(r.remove(),r=void 0);const s=e==null?void 0:e.getAttribute("data-url");await O(s||"wss://liveroom.app/room",a,m)}}async function O(e,t,o){if(!t||!o)return!1;await Promise.resolve().then(()=>E(require("./liveroom-client-element.cjs"))),console.log(`[Liveroom] Installed successfully (v${n.VERSION})`),r=document.createElement(n.ELEMENT_TAG),r.setAttribute("url",e),r.setAttribute("version",n.VERSION),t&&r.setAttribute("room_id",t),t&&r.setAttribute("room_token",o);const s=R();s&&r.setAttribute("user_name",s);const _=f();return _&&r.setAttribute("user_color",_),document.body.appendChild(r),console.log("[Liveroom] Injected successfully"),!0}function R(){const t=new URLSearchParams(window.location.search).get(n.QUERY_PARAM_KEY_USER_NAME),o=sessionStorage==null?void 0:sessionStorage.getItem(n.SESSION_STORAGE_KEY_USER_NAME);return t||o||null}function f(){const t=new URLSearchParams(window.location.search).get(n.QUERY_PARAM_KEY_USER_COLOR),o=sessionStorage==null?void 0:sessionStorage.getItem(n.SESSION_STORAGE_KEY_USER_COLOR);return t||o||null}function A(e){const t=new URLSearchParams(window.location.search),o=t.get(n.QUERY_PARAM_KEY_ROOM_ID),s=t.get(n.QUERY_PARAM_KEY_ROOM_TOKEN),_=sessionStorage==null?void 0:sessionStorage.getItem(n.SESSION_STORAGE_KEY_ROOM_ID),l=sessionStorage==null?void 0:sessionStorage.getItem(n.SESSION_STORAGE_KEY_ROOM_TOKEN),c=(e==null?void 0:e.getAttribute("data-roomid"))||null,i=(e==null?void 0:e.getAttribute("data-roomtoken"))||null;return{roomId:g(o||_||c),roomToken:s||l||i}}function g(e){const t=e==null?void 0:e.split("https://meet.google.com/"),o=t==null?void 0:t[1];return(o?o.split("?")[0]:t==null?void 0:t[0])||null}
|
package/dist/main.js
CHANGED
|
@@ -1,60 +1,66 @@
|
|
|
1
|
-
import { V as
|
|
2
|
-
let
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
window.addEventListener("popstate",
|
|
1
|
+
import { V as _, S as u, a as c, E as f, Q as R, b as A, c as g, d, e as O, f as I } from "./constants-C3YM3f23.js";
|
|
2
|
+
let a, m, s;
|
|
3
|
+
l();
|
|
4
|
+
b();
|
|
5
|
+
function b() {
|
|
6
|
+
window.addEventListener("popstate", l);
|
|
7
7
|
}
|
|
8
|
-
async function
|
|
8
|
+
async function l() {
|
|
9
9
|
const e = (
|
|
10
10
|
// prod
|
|
11
11
|
document.querySelector(
|
|
12
12
|
"script[src*='/liveroom-client-element']"
|
|
13
13
|
)
|
|
14
14
|
);
|
|
15
|
-
e == null || e.setAttribute("version",
|
|
16
|
-
const t =
|
|
17
|
-
if (t && t !=
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
await
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
e == null || e.setAttribute("version", _);
|
|
16
|
+
const { roomId: t, roomToken: o } = Y(e);
|
|
17
|
+
if (t && o && (t != a || o != m)) {
|
|
18
|
+
a = t, m = o, sessionStorage == null || sessionStorage.setItem(u, a), sessionStorage == null || sessionStorage.setItem(c, m), s && (s.remove(), s = void 0);
|
|
19
|
+
const n = e == null ? void 0 : e.getAttribute("data-url");
|
|
20
|
+
await U(
|
|
21
|
+
n || "wss://liveroom.app/room",
|
|
22
|
+
a,
|
|
23
|
+
m
|
|
23
24
|
);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
async function
|
|
27
|
-
if (!t)
|
|
27
|
+
async function U(e, t, o) {
|
|
28
|
+
if (!t || !o)
|
|
28
29
|
return !1;
|
|
29
|
-
await import("./liveroom-client-element.js"), console.log(`[Liveroom] Installed successfully (v${
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
return
|
|
30
|
+
await import("./liveroom-client-element.js"), console.log(`[Liveroom] Installed successfully (v${_})`), s = document.createElement(f), s.setAttribute("url", e), s.setAttribute("version", _), t && s.setAttribute("room_id", t), t && s.setAttribute("room_token", o);
|
|
31
|
+
const n = w();
|
|
32
|
+
n && s.setAttribute("user_name", n);
|
|
33
|
+
const r = y();
|
|
34
|
+
return r && s.setAttribute("user_color", r), document.body.appendChild(s), console.log("[Liveroom] Injected successfully"), !0;
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
const t = new URLSearchParams(window.location.search).get(
|
|
37
|
-
|
|
36
|
+
function w() {
|
|
37
|
+
const t = new URLSearchParams(window.location.search).get(R), o = sessionStorage == null ? void 0 : sessionStorage.getItem(
|
|
38
|
+
A
|
|
38
39
|
);
|
|
39
|
-
return t ||
|
|
40
|
+
return t || o || null;
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
const t = new URLSearchParams(window.location.search).get(
|
|
43
|
-
|
|
42
|
+
function y() {
|
|
43
|
+
const t = new URLSearchParams(window.location.search).get(g), o = sessionStorage == null ? void 0 : sessionStorage.getItem(
|
|
44
|
+
d
|
|
44
45
|
);
|
|
45
|
-
return t ||
|
|
46
|
+
return t || o || null;
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
-
const
|
|
48
|
+
function Y(e) {
|
|
49
|
+
const t = new URLSearchParams(window.location.search), o = t.get(O), n = t.get(I), r = sessionStorage == null ? void 0 : sessionStorage.getItem(
|
|
50
|
+
u
|
|
51
|
+
), i = sessionStorage == null ? void 0 : sessionStorage.getItem(
|
|
49
52
|
c
|
|
50
|
-
),
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
), E = (e == null ? void 0 : e.getAttribute("data-roomid")) || null, S = (e == null ? void 0 : e.getAttribute("data-roomtoken")) || null;
|
|
54
|
+
return {
|
|
55
|
+
roomId: M(
|
|
56
|
+
o || r || E
|
|
57
|
+
),
|
|
58
|
+
roomToken: n || i || S
|
|
59
|
+
};
|
|
54
60
|
}
|
|
55
|
-
function
|
|
61
|
+
function M(e) {
|
|
56
62
|
const t = e == null ? void 0 : e.split(
|
|
57
63
|
"https://meet.google.com/"
|
|
58
|
-
),
|
|
59
|
-
return (
|
|
64
|
+
), o = t == null ? void 0 : t[1];
|
|
65
|
+
return (o ? o.split("?")[0] : t == null ? void 0 : t[0]) || null;
|
|
60
66
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e="liveroom-client-element",t="0.0.44",i="module",s="./dist/main.js",o="./dist/main.cjs",n=["dist","!dist/vite.svg"],_={".":{import:"./dist/main.js",require:"./dist/main.cjs"},"./liveroom-client-element":{import:"./dist/liveroom-client-element.js",require:"./dist/liveroom-client-element.cjs"}},c={dev:"vite",build:"vite build",preview:"vite preview",format:"prettier --write .","check-format":"prettier . --check",check:"svelte-check --tsconfig ./tsconfig.json",lint:"npm run check-format && npm run check"},E={"livekit-client":"2.0.2","phx-live-state":"0.11.2"},r={"@sveltejs/vite-plugin-svelte":"3.0.2","@tsconfig/svelte":"5.0.2",prettier:"3.2.5",svelte:"4.2.11","svelte-check":"3.6.4",tslib:"2.6.2",typescript:"5.3.3",vite:"5.1.3"},l={name:e,private:!1,version:t,type:i,module:s,main:o,files:n,exports:_,scripts:c,dependencies:E,devDependencies:r},m=l.version,R="liveroom-client-element",v="_liveroom",S="_liveroom_user_name",O="_liveroom_user_color",p="liveroom-room-id",A="liveroom-user-name",d="liveroom-user-color";exports.ELEMENT_TAG=R;exports.QUERY_PARAM_KEY_ROOM_ID=v;exports.QUERY_PARAM_KEY_USER_COLOR=O;exports.QUERY_PARAM_KEY_USER_NAME=S;exports.SESSION_STORAGE_KEY_ROOM_ID=p;exports.SESSION_STORAGE_KEY_USER_COLOR=d;exports.SESSION_STORAGE_KEY_USER_NAME=A;exports.VERSION=m;
|