@tidal-music/player-web-components 0.1.1 → 0.1.2

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,16 +1,16 @@
1
1
  function y() {
2
- let o = [], t, i, d, c;
3
- const r = /* @__PURE__ */ new Map();
2
+ let o = [], t, r, d, c;
3
+ const i = /* @__PURE__ */ new Map();
4
4
  function l() {
5
- return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(
6
- /[018]/g,
7
- (a) => (a ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> a / 4).toString(16)
8
- );
5
+ return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, (a) => {
6
+ const e = crypto.getRandomValues(new Uint8Array(1))[0];
7
+ return (a ^ (e ?? 0) & 15 >> a / 4).toString(16);
8
+ });
9
9
  }
10
10
  async function p(a, e) {
11
- if (r.has(e))
12
- return r.get(e);
13
- r.clear();
11
+ if (i.has(e))
12
+ return i.get(e);
13
+ i.clear();
14
14
  const n = await (await fetch(a + "/sessions", {
15
15
  headers: new Headers({
16
16
  Authorization: "Bearer " + e
@@ -19,7 +19,7 @@ function y() {
19
19
  // @ts-ignore - It is a thing.
20
20
  importance: "low"
21
21
  })).json();
22
- return r.set(e, n), n;
22
+ return i.set(e, n), n;
23
23
  }
24
24
  setInterval(async () => {
25
25
  if (o.length > 0 && t && c) {
@@ -29,7 +29,7 @@ function y() {
29
29
  };
30
30
  try {
31
31
  const e = new Headers();
32
- if (t && e.append("authorization", "Bearer " + t), i && e.append("x-tidal-token", i), e.append("content-type", "application/json; boundary=player-sdk"), (await fetch(c, {
32
+ if (t && e.append("authorization", "Bearer " + t), r && e.append("x-tidal-token", r), e.append("content-type", "application/json; boundary=player-sdk"), (await fetch(c, {
33
33
  body: JSON.stringify(a),
34
34
  headers: e,
35
35
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -56,7 +56,7 @@ function y() {
56
56
  const n = await p(e.apiUrl, e.accessToken);
57
57
  e.accessToken && (t = e.accessToken), t || console.trace(
58
58
  "An accessToken is missing. Make sure to send at least one commit-payload with it defined, we cannot send events unless we have an access token."
59
- ), e.clientId && (i = e.clientId), e.clientPlatform && (d = e.clientPlatform), e.events.forEach((s) => {
59
+ ), e.clientId && (r = e.clientId), e.clientPlatform && (d = e.clientPlatform), e.events.forEach((s) => {
60
60
  s.name === "progress" && "streamingSessionId" in s.payload && (postMessage({
61
61
  command: "cleanUp",
62
62
  eventName: s.name,
@@ -65,7 +65,7 @@ function y() {
65
65
  const m = {
66
66
  client: {
67
67
  platform: d,
68
- token: i,
68
+ token: r,
69
69
  version: e.appVersion
70
70
  },
71
71
  group: e.type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidal-music/player-web-components",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,26 +13,23 @@
13
13
  },
14
14
  "license": "Apache-2.0",
15
15
  "exports": {
16
- ".": {
17
- "default": "./dist/index.js",
18
- "import": "./dist/index.js",
19
- "types": "./dist/index.d.ts"
20
- }
16
+ "default": "./dist/index.js",
17
+ "import": "./dist/index.js"
21
18
  },
22
19
  "keywords": [
23
20
  "tidal-music",
24
21
  "web-components"
25
22
  ],
26
23
  "devDependencies": {
27
- "@vitest/coverage-v8": "0.34.6",
28
- "@vitest/ui": "0.34.7",
29
- "typescript": "5.3.3",
30
- "vite": "5.0.12",
31
- "vite-plugin-dts": "3.7.1",
32
- "vitest": "0.34.6",
33
- "@tidal-music/auth": "^1.1.2",
34
- "@tidal-music/player": "^0.1.1",
35
- "@tidal-music/common": "^0.1.4"
24
+ "@vitest/coverage-v8": "1.6.0",
25
+ "@vitest/ui": "1.6.0",
26
+ "typescript": "5.4.5",
27
+ "vite": "5.2.11",
28
+ "vite-plugin-dts": "3.9.1",
29
+ "vitest": "1.6.0",
30
+ "@tidal-music/common": "^0.1.5",
31
+ "@tidal-music/auth": "^1.3.0",
32
+ "@tidal-music/player": "^0.2.0"
36
33
  },
37
34
  "scripts": {
38
35
  "build": "vite build",
@@ -43,9 +40,9 @@
43
40
  "lint:ci": "eslint . --quiet",
44
41
  "lint:fix": "pnpm run lint --fix",
45
42
  "preview": "vite preview",
46
- "test": "vitest",
47
- "test:coverage": "vitest run --coverage",
48
- "test:ui": "vitest --ui --coverage",
49
- "types": "tsc"
43
+ "test": "vitest --sequence.concurrent",
44
+ "test:coverage": "pnpm run test --coverage",
45
+ "test:ui": "pnpm run test:coverage --ui",
46
+ "typecheck": "tsc"
50
47
  }
51
48
  }