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