@inupedia/spotlight-vue 0.9.13 → 0.9.14

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 +1 @@
1
- {"version":3,"file":"phonePairing.d.ts","sourceRoot":"","sources":["../../../src/avatar/voice/phonePairing.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,SAAS,SAAK,GAAG,OAAO,CAE5D;AAED,iFAAiF;AACjF,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CASjE;AAED,kEAAkE;AAClE,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAmB,GAChE,MAAM,CAOR;AAED,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,GACvD,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAE/C;AAED,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GACvC,OAAO,CAAC,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAK9C"}
1
+ {"version":3,"file":"phonePairing.d.ts","sourceRoot":"","sources":["../../../src/avatar/voice/phonePairing.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,SAAS,SAAK,GAAG,OAAO,CAE5D;AAED,iFAAiF;AACjF,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CASjE;AAED,kEAAkE;AAClE,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAmB,GAChE,MAAM,CAOR;AAED,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,GACvD,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAgB/C;AAED,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GACvC,OAAO,CAAC,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAK9C"}
@@ -1,21 +1,25 @@
1
- function s(t) {
1
+ function i(t) {
2
2
  const e = t.replace(/\/index\.html$/i, "/");
3
3
  if (e.endsWith("/")) return e || "/";
4
4
  if ((e.split("/").pop() ?? "").includes(".")) {
5
- const o = e.lastIndexOf("/");
6
- return o >= 0 ? e.slice(0, o + 1) : "/";
5
+ const n = e.lastIndexOf("/");
6
+ return n >= 0 ? e.slice(0, n + 1) : "/";
7
7
  }
8
8
  return `${e}/`;
9
9
  }
10
- function i(t, e = window.location) {
11
- const n = new URL(
12
- `${s(e.pathname)}voice-remote.html`,
10
+ function r(t, e = window.location) {
11
+ const o = new URL(
12
+ `${i(e.pathname)}voice-remote.html`,
13
13
  e.origin
14
14
  );
15
- return n.searchParams.set("p", t), n.toString();
15
+ return o.searchParams.set("p", t), o.toString();
16
16
  }
17
- async function r(t) {
18
- return t("/v1/voice-remote/sessions", {});
17
+ async function s(t) {
18
+ const e = await t("/v1/voice-remote/sessions", {}), o = e && typeof e == "object" && "token" in e && typeof e.token == "string" ? e.token.trim() : "";
19
+ if (!o)
20
+ throw new Error("Spotlight 没有返回手机配对码,请检查连接后重试。");
21
+ const n = e && typeof e == "object" && "expiresAt" in e && typeof e.expiresAt == "number" ? e.expiresAt : 0;
22
+ return { token: o, expiresAt: n };
19
23
  }
20
24
  async function c(t, e) {
21
25
  return (await e(
@@ -23,8 +27,8 @@ async function c(t, e) {
23
27
  )).utterances ?? [];
24
28
  }
25
29
  export {
26
- r as createVoiceRemoteSession,
30
+ s as createVoiceRemoteSession,
27
31
  c as pullVoiceRemoteUtterances,
28
- s as voiceRemotePageDirectory,
29
- i as voiceRemotePageUrl
32
+ i as voiceRemotePageDirectory,
33
+ r as voiceRemotePageUrl
30
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"usePhoneVoicePairing.d.ts","sourceRoot":"","sources":["../../../src/avatar/voice/usePhoneVoicePairing.ts"],"names":[],"mappings":"AASA,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C;;;;;;;;;;;;EA2HA"}
1
+ {"version":3,"file":"usePhoneVoicePairing.d.ts","sourceRoot":"","sources":["../../../src/avatar/voice/usePhoneVoicePairing.ts"],"names":[],"mappings":"AASA,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C;;;;;;;;;;;;EAwHA"}
@@ -3,8 +3,8 @@ import { renderSVG as I } from "../../node_modules/.pnpm/uqr@0.1.3/node_modules/
3
3
  import { postSpotlightJson as V, getSpotlightJson as g } from "../../remote/serverJson.js";
4
4
  import { createVoiceRemoteSession as b, voiceRemotePageUrl as x, pullVoiceRemoteUtterances as k } from "./phonePairing.js";
5
5
  function _(f) {
6
- const e = o(""), l = o(""), v = o(""), p = o(!1), t = o(""), c = o(!1);
7
- let r = null, u = !1;
6
+ const e = o(""), l = o(""), v = o(""), p = o(!1), t = o(""), a = o(!1);
7
+ let r = null, c = !1;
8
8
  const P = R(() => f.enabled);
9
9
  function d() {
10
10
  r != null && (window.clearInterval(r), r = null);
@@ -18,7 +18,7 @@ function _(f) {
18
18
  whiteColor: "#ffffff"
19
19
  }));
20
20
  }
21
- async function i() {
21
+ async function u() {
22
22
  if (!(typeof window > "u") && !window.location.pathname.includes("voice-remote") && !e.value)
23
23
  try {
24
24
  const n = await b(V);
@@ -28,41 +28,41 @@ function _(f) {
28
28
  }
29
29
  }
30
30
  async function m() {
31
- if (!u && !(!e.value && (await i(), !e.value)))
31
+ if (!c && e.value)
32
32
  try {
33
33
  const [n, s] = await Promise.all([
34
34
  k(e.value, g),
35
35
  g(
36
36
  `/v1/voice-remote/sessions/${encodeURIComponent(e.value)}`
37
- ).catch((a) => ((a.code === "VOICE_REMOTE_EXPIRED" || a.status === 404) && (e.value = "", i()), null))
37
+ ).catch((i) => ((i.code === "VOICE_REMOTE_EXPIRED" || i.status === 404) && (e.value = "", u()), null))
38
38
  ]);
39
39
  s && "phoneConnected" in s && (p.value = !!s.phoneConnected);
40
- for (const a of n) {
41
- const h = a.text?.trim();
42
- if (h) {
43
- u = !0;
40
+ for (const i of n) {
41
+ const w = i.text?.trim();
42
+ if (w) {
43
+ c = !0;
44
44
  try {
45
- await f.onUtterance(h);
45
+ await f.onUtterance(w);
46
46
  } finally {
47
- u = !1;
47
+ c = !1;
48
48
  }
49
49
  }
50
50
  }
51
51
  } catch {
52
52
  }
53
53
  }
54
- function w() {
55
- d(), i().then(() => {
54
+ function h() {
55
+ d(), u().then(() => {
56
56
  m(), r = window.setInterval(() => {
57
57
  m();
58
58
  }, 1200);
59
59
  });
60
60
  }
61
61
  function S() {
62
- c.value = !0, w();
62
+ a.value = !0, h();
63
63
  }
64
64
  function y() {
65
- c.value = !1;
65
+ a.value = !1;
66
66
  }
67
67
  function C() {
68
68
  t.value = "";
@@ -75,12 +75,12 @@ function _(f) {
75
75
  qrSvg: v,
76
76
  phoneConnected: p,
77
77
  pairError: t,
78
- panelOpen: c,
78
+ panelOpen: a,
79
79
  openPanel: S,
80
80
  closePanel: y,
81
81
  clearPairError: C,
82
- startPolling: w,
83
- ensureSession: i
82
+ startPolling: h,
83
+ ensureSession: u
84
84
  };
85
85
  }
86
86
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inupedia/spotlight-vue",
3
- "version": "0.9.13",
3
+ "version": "0.9.14",
4
4
  "description": "Thin Vue runtime for Inupedia Spotlight Client Tools",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -93,8 +93,8 @@
93
93
  "prettier": "^3.8.1",
94
94
  "uqr": "^0.1.3",
95
95
  "yaml": "^2.8.4",
96
- "@inupedia/spotlight-client": "0.9.13",
97
- "@inupedia/spotlight-protocol": "0.9.13"
96
+ "@inupedia/spotlight-client": "0.9.14",
97
+ "@inupedia/spotlight-protocol": "0.9.14"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "@inspira-ui/plugins": "^0.0.2",