@aippy/runtime 0.2.7-dev.5 → 0.2.7-dev.6
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/ai/index.js +2 -2
- package/dist/ai/shared/fetch.d.ts +0 -4
- package/dist/ai/shared/index.d.ts +1 -1
- package/dist/{ui-y5N62DqC.js → app-version-checker-GLONqMxq.js} +87 -32
- package/dist/bridge-BKcAlLAd.js +237 -0
- package/dist/config-B0A7gHQM.js +28 -0
- package/dist/container-message-WJolNXso.js +56 -0
- package/dist/core/headers.d.ts +31 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +20 -50
- package/dist/helper-yKJ_6uB-.js +240 -0
- package/dist/hooks-DgadJdiM.js +98 -0
- package/dist/index/index.js +86 -78
- package/dist/url-c26cuIpu.js +7 -0
- package/dist/user/hooks.d.ts +6 -2
- package/dist/user/index.d.ts +1 -0
- package/dist/user/index.js +3 -3
- package/dist/utils/app-version-checker.d.ts +62 -0
- package/dist/utils/app-version-requirements.json.d.ts +13 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +17 -11
- package/dist/utils/ui.d.ts +1 -1
- package/dist/utils/url.d.ts +7 -0
- package/package.json +1 -1
- package/dist/bridge-Ca3H2iN1.js +0 -197
- package/dist/container-message-DGrno17o.js +0 -31
- package/dist/helper-BENVYOU-.js +0 -247
- package/dist/hooks-CE9cjXHP.js +0 -46
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { createOpenAICompatible as l } from "@ai-sdk/openai-compatible";
|
|
2
|
+
import { s as u, a as y } from "./container-message-WJolNXso.js";
|
|
3
|
+
import { AISDKError as f, DefaultChatTransport as d } from "ai";
|
|
4
|
+
import { j as h } from "./url-c26cuIpu.js";
|
|
5
|
+
const c = "https://api.aippy.dev", b = `${c}/aisdk/v1/`, A = `${c}/aisdk/v1/ui/`, w = "gpt-5-nano", v = "";
|
|
6
|
+
function I(n = {}) {
|
|
7
|
+
return {
|
|
8
|
+
baseUrl: n.baseUrl ?? b
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function C(n = {}) {
|
|
12
|
+
return {
|
|
13
|
+
baseUrl: n.baseUrl ?? A
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function E(n, e) {
|
|
17
|
+
const r = n.status;
|
|
18
|
+
if (e && typeof e == "object" && "error" in e) {
|
|
19
|
+
const t = e, o = t.error.code, s = o != null ? `AippyAIError_${o}` : `AippyAIError_${r}`, a = e;
|
|
20
|
+
return "appMessage" in a && a.appMessage !== void 0 && u(a.appMessage), new f({
|
|
21
|
+
name: s,
|
|
22
|
+
message: t.error.message,
|
|
23
|
+
cause: {
|
|
24
|
+
type: t.error.type ?? void 0,
|
|
25
|
+
param: t.error.param ?? void 0,
|
|
26
|
+
status: r
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (e && typeof e == "object" && e !== null) {
|
|
31
|
+
const t = e;
|
|
32
|
+
"appMessage" in t && t.appMessage !== void 0 && u(t.appMessage);
|
|
33
|
+
}
|
|
34
|
+
return new f({
|
|
35
|
+
name: `AippyAIError_${r}`,
|
|
36
|
+
message: `Request failed with status ${r}`,
|
|
37
|
+
cause: { status: r }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function m() {
|
|
41
|
+
return async (n, e) => {
|
|
42
|
+
const r = await y(e?.headers), t = await globalThis.fetch(n, { ...e, headers: r });
|
|
43
|
+
if (!t.ok) {
|
|
44
|
+
const o = await t.text().catch(() => null);
|
|
45
|
+
let s = null;
|
|
46
|
+
if (o)
|
|
47
|
+
try {
|
|
48
|
+
s = JSON.parse(o);
|
|
49
|
+
} catch {
|
|
50
|
+
s = { message: o };
|
|
51
|
+
}
|
|
52
|
+
throw E(t, s);
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const S = [
|
|
58
|
+
"gpt-image-1",
|
|
59
|
+
"gpt-image-1-mini",
|
|
60
|
+
"gpt-image-1.5"
|
|
61
|
+
];
|
|
62
|
+
function O(n) {
|
|
63
|
+
try {
|
|
64
|
+
const e = JSON.parse(n);
|
|
65
|
+
if (e.model && S.some((r) => e.model.startsWith(r))) {
|
|
66
|
+
const { response_format: r, ...t } = e;
|
|
67
|
+
return JSON.stringify(t);
|
|
68
|
+
}
|
|
69
|
+
} catch {
|
|
70
|
+
}
|
|
71
|
+
return n;
|
|
72
|
+
}
|
|
73
|
+
function L(n = {}) {
|
|
74
|
+
const { baseUrl: e } = I(n), r = m();
|
|
75
|
+
return l({
|
|
76
|
+
name: "aippy",
|
|
77
|
+
baseURL: e,
|
|
78
|
+
fetch: async (o, s) => o.toString().includes("/images/generations") && s?.method?.toUpperCase() === "POST" && s?.body ? r(o, {
|
|
79
|
+
...s,
|
|
80
|
+
body: O(s.body)
|
|
81
|
+
}) : r(o, s),
|
|
82
|
+
// Enable structured outputs support (json_schema response format)
|
|
83
|
+
// This is required for Output.object() and Output.array() to work properly
|
|
84
|
+
supportsStructuredOutputs: !0
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const _ = "/chat";
|
|
88
|
+
function N(n = {}) {
|
|
89
|
+
const { baseUrl: e } = C(n), r = n.model ?? w, t = n.system ?? v, o = n.api ?? h(e, _), s = { model: r, system: t }, a = m();
|
|
90
|
+
return {
|
|
91
|
+
transport: new d({
|
|
92
|
+
api: o,
|
|
93
|
+
body: s,
|
|
94
|
+
// Ensure token is fetched fresh for every request
|
|
95
|
+
fetch: a
|
|
96
|
+
})
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
class p extends Error {
|
|
100
|
+
constructor(e, r) {
|
|
101
|
+
super(e), this.errors = r, this.name = "AIConfigValidationError";
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function g(n) {
|
|
105
|
+
const e = [];
|
|
106
|
+
if (!n || typeof n != "object")
|
|
107
|
+
throw new p("AIConfig must be an object", []);
|
|
108
|
+
const r = n;
|
|
109
|
+
for (const [t, o] of Object.entries(r)) {
|
|
110
|
+
if (!o || typeof o != "object") {
|
|
111
|
+
e.push({ key: t, message: "Item must be an object" });
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const s = o;
|
|
115
|
+
typeof s.index != "number" && e.push({ key: t, message: "index must be a number" }), typeof s.name != "string" && e.push({ key: t, message: "name must be a string" }), typeof s.description != "string" && e.push({ key: t, message: "description must be a string" });
|
|
116
|
+
const a = s.type;
|
|
117
|
+
if (!["number", "boolean", "text", "enum"].includes(a)) {
|
|
118
|
+
e.push({
|
|
119
|
+
key: t,
|
|
120
|
+
message: `type must be one of: number, boolean, text, enum (got: ${a})`
|
|
121
|
+
});
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (a === "number")
|
|
125
|
+
typeof s.value != "number" && e.push({ key: t, message: 'value must be a number for type "number"' }), s.min !== void 0 && typeof s.min != "number" && e.push({ key: t, message: "min must be a number" }), s.max !== void 0 && typeof s.max != "number" && e.push({ key: t, message: "max must be a number" }), s.step !== void 0 && typeof s.step != "number" && e.push({ key: t, message: "step must be a number" });
|
|
126
|
+
else if (a === "boolean")
|
|
127
|
+
typeof s.value != "boolean" && e.push({ key: t, message: 'value must be a boolean for type "boolean"' });
|
|
128
|
+
else if (a === "text")
|
|
129
|
+
typeof s.value != "string" && e.push({ key: t, message: 'value must be a string for type "text"' });
|
|
130
|
+
else if (a === "enum") {
|
|
131
|
+
if (!Array.isArray(s.options))
|
|
132
|
+
e.push({ key: t, message: 'options must be an array for type "enum"' });
|
|
133
|
+
else if (s.options.length === 0)
|
|
134
|
+
e.push({ key: t, message: 'options array cannot be empty for type "enum"' });
|
|
135
|
+
else
|
|
136
|
+
for (let i = 0; i < s.options.length; i++)
|
|
137
|
+
typeof s.options[i] != "string" && e.push({
|
|
138
|
+
key: t,
|
|
139
|
+
message: `options[${i}] must be a string`
|
|
140
|
+
});
|
|
141
|
+
typeof s.value != "string" ? e.push({ key: t, message: 'value must be a string for type "enum"' }) : Array.isArray(s.options) && !s.options.includes(s.value) && e.push({
|
|
142
|
+
key: t,
|
|
143
|
+
message: `value "${s.value}" is not in options: [${s.options.join(", ")}]`
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
s.group !== void 0 && typeof s.group != "string" && e.push({ key: t, message: "group must be a string" });
|
|
147
|
+
}
|
|
148
|
+
if (e.length > 0)
|
|
149
|
+
throw new p(
|
|
150
|
+
`AIConfig validation failed with ${e.length} error(s)`,
|
|
151
|
+
e
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function D(n) {
|
|
155
|
+
let e;
|
|
156
|
+
try {
|
|
157
|
+
e = JSON.parse(n);
|
|
158
|
+
} catch (r) {
|
|
159
|
+
throw new p("Invalid JSON", [
|
|
160
|
+
{
|
|
161
|
+
key: "",
|
|
162
|
+
message: `JSON parse error: ${r instanceof Error ? r.message : String(r)}`
|
|
163
|
+
}
|
|
164
|
+
]);
|
|
165
|
+
}
|
|
166
|
+
return g(e), e;
|
|
167
|
+
}
|
|
168
|
+
function U(n) {
|
|
169
|
+
return g(n), n;
|
|
170
|
+
}
|
|
171
|
+
function T(n, e) {
|
|
172
|
+
const r = n[e];
|
|
173
|
+
if (!r)
|
|
174
|
+
throw new Error(`AIConfig key "${e}" not found`);
|
|
175
|
+
return r.value;
|
|
176
|
+
}
|
|
177
|
+
function x(n) {
|
|
178
|
+
if (!(typeof window > "u"))
|
|
179
|
+
try {
|
|
180
|
+
const e = window.webkit?.messageHandlers?.aippyListener;
|
|
181
|
+
if (e)
|
|
182
|
+
try {
|
|
183
|
+
const r = {
|
|
184
|
+
command: "ai.initialize",
|
|
185
|
+
parameters: JSON.stringify(n)
|
|
186
|
+
};
|
|
187
|
+
e.postMessage(r);
|
|
188
|
+
} catch (r) {
|
|
189
|
+
console.warn("❌ [Aippy AI Config] Failed to send config to iOS app:", r);
|
|
190
|
+
}
|
|
191
|
+
if (window.parent && window.parent !== window)
|
|
192
|
+
try {
|
|
193
|
+
const r = {
|
|
194
|
+
type: "ai.initialize",
|
|
195
|
+
config: JSON.stringify(n)
|
|
196
|
+
};
|
|
197
|
+
window.parent.postMessage(r, "*");
|
|
198
|
+
} catch (r) {
|
|
199
|
+
console.warn("❌ [Aippy AI Config] Failed to send config to parent window:", r);
|
|
200
|
+
}
|
|
201
|
+
} catch (e) {
|
|
202
|
+
console.warn("⚠️ [Aippy AI Config] Failed to send config:", e);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function J(n) {
|
|
206
|
+
const e = U(n);
|
|
207
|
+
return x(e), new Proxy({}, {
|
|
208
|
+
get(r, t) {
|
|
209
|
+
if (typeof t == "string")
|
|
210
|
+
try {
|
|
211
|
+
return T(e, t);
|
|
212
|
+
} catch {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
has(r, t) {
|
|
217
|
+
return typeof t != "string" ? !1 : t in e;
|
|
218
|
+
},
|
|
219
|
+
ownKeys(r) {
|
|
220
|
+
return Object.keys(e);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
export {
|
|
225
|
+
p as A,
|
|
226
|
+
b as D,
|
|
227
|
+
_ as U,
|
|
228
|
+
L as a,
|
|
229
|
+
N as b,
|
|
230
|
+
A as c,
|
|
231
|
+
w as d,
|
|
232
|
+
v as e,
|
|
233
|
+
J as f,
|
|
234
|
+
T as g,
|
|
235
|
+
U as l,
|
|
236
|
+
E as n,
|
|
237
|
+
D as p,
|
|
238
|
+
x as s,
|
|
239
|
+
g as v
|
|
240
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useState as U, useEffect as y, useCallback as p } from "react";
|
|
2
|
+
const g = {
|
|
3
|
+
avatar: "",
|
|
4
|
+
nickName: "用户",
|
|
5
|
+
username: "",
|
|
6
|
+
uid: ""
|
|
7
|
+
};
|
|
8
|
+
let s = null, a = null;
|
|
9
|
+
const d = /* @__PURE__ */ new Set();
|
|
10
|
+
function h() {
|
|
11
|
+
d.forEach((n) => n());
|
|
12
|
+
}
|
|
13
|
+
const u = [100, 300, 500, 1e3], w = (n) => new Promise((o) => setTimeout(o, n)), A = () => /Aippy\/[\d.]+\/\d+\/Android/i.test(navigator.userAgent);
|
|
14
|
+
async function v() {
|
|
15
|
+
console.log("🔍 [useUserInfo] fetchUserInfoFromBridge started");
|
|
16
|
+
const n = A();
|
|
17
|
+
try {
|
|
18
|
+
const { getUserInfoAsync: o, getUserInfoFromParent: c, isInIframe: t } = await import("./bridge-BKcAlLAd.js"), { hasNativeBridge: f } = await import("./native-bridge-BnvipFJc.js"), i = f(), l = t();
|
|
19
|
+
console.log("🔍 [useUserInfo] Environment check:", {
|
|
20
|
+
hasNativeBridge: i,
|
|
21
|
+
isInIframe: l,
|
|
22
|
+
isAndroid: n,
|
|
23
|
+
userAgent: navigator.userAgent
|
|
24
|
+
});
|
|
25
|
+
let e = null;
|
|
26
|
+
if (i)
|
|
27
|
+
console.log("📱 [useUserInfo] Using native bridge to get user info..."), e = await o(), console.log("📱 [useUserInfo] Native bridge returned:", e);
|
|
28
|
+
else if (l)
|
|
29
|
+
console.log("🖼️ [useUserInfo] Using iframe parent to get user info..."), e = await c(), console.log("🖼️ [useUserInfo] Iframe parent returned:", e);
|
|
30
|
+
else {
|
|
31
|
+
if (console.log("🌐 [useUserInfo] Bridge not ready, trying getUserInfoAsync..."), e = await o(), !e && n) {
|
|
32
|
+
console.log("🤖 [useUserInfo] Android: First attempt failed, retrying...");
|
|
33
|
+
for (let r = 0; r < u.length; r++) {
|
|
34
|
+
const I = u[r];
|
|
35
|
+
if (console.log(`🔄 [useUserInfo] Android retry ${r + 1}/${u.length} after ${I}ms...`), await w(I), e = await o(), e) {
|
|
36
|
+
console.log(`✅ [useUserInfo] Retry ${r + 1} succeeded:`, e);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
console.log("🌐 [useUserInfo] Result:", e);
|
|
42
|
+
}
|
|
43
|
+
if (e) {
|
|
44
|
+
const r = {
|
|
45
|
+
avatar: String(e.avatar || e.photoUrl || ""),
|
|
46
|
+
nickName: String(e.nickName || e.nickname || e.displayName || "用户"),
|
|
47
|
+
username: String(e.username || ""),
|
|
48
|
+
uid: String(e.uid || "")
|
|
49
|
+
};
|
|
50
|
+
return console.log("✅ [useUserInfo] Parsed user info:", r), r;
|
|
51
|
+
}
|
|
52
|
+
return console.warn("⚠️ [useUserInfo] No user info received (info is null/undefined)"), null;
|
|
53
|
+
} catch (o) {
|
|
54
|
+
return console.error("❌ [useUserInfo] fetchUserInfoFromBridge failed:", o), null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async function m() {
|
|
58
|
+
if (console.log("🔄 [useUserInfo] getOrFetchUserInfo called, cachedUserInfo:", s), s)
|
|
59
|
+
return console.log("✅ [useUserInfo] Returning cached user info"), s;
|
|
60
|
+
if (a) {
|
|
61
|
+
console.log("⏳ [useUserInfo] Already fetching, waiting for existing promise...");
|
|
62
|
+
const n = await a;
|
|
63
|
+
return console.log("⏳ [useUserInfo] Existing promise resolved:", n), n || g;
|
|
64
|
+
}
|
|
65
|
+
console.log("🚀 [useUserInfo] Starting new fetch..."), a = v();
|
|
66
|
+
try {
|
|
67
|
+
const n = await a;
|
|
68
|
+
return console.log("🚀 [useUserInfo] Fetch completed:", n), n && (s = n, h()), n || g;
|
|
69
|
+
} finally {
|
|
70
|
+
a = null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function N() {
|
|
74
|
+
const [n, o] = U(s || g), [c, t] = U(!s);
|
|
75
|
+
y(() => {
|
|
76
|
+
const i = () => {
|
|
77
|
+
s && (o(s), t(!1));
|
|
78
|
+
};
|
|
79
|
+
return d.add(i), s || (t(!0), m().then((l) => {
|
|
80
|
+
o(l), t(!1);
|
|
81
|
+
})), () => {
|
|
82
|
+
d.delete(i);
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
const f = p(async () => {
|
|
86
|
+
t(!0), s = null, a = null;
|
|
87
|
+
const i = await m();
|
|
88
|
+
o(i), t(!1);
|
|
89
|
+
}, []);
|
|
90
|
+
return { ...n, isLoading: c, refetch: f };
|
|
91
|
+
}
|
|
92
|
+
function S() {
|
|
93
|
+
s = null, a = null, h();
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
S as c,
|
|
97
|
+
N as u
|
|
98
|
+
};
|
package/dist/index/index.js
CHANGED
|
@@ -1,83 +1,91 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A, E as
|
|
3
|
-
import {
|
|
4
|
-
import { A as
|
|
5
|
-
import { CameraAPI as
|
|
6
|
-
import { P as N, c as b, i as
|
|
7
|
-
import { a as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { c as Te,
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
1
|
+
import { D as o, g as r, m as s } from "../config-B0A7gHQM.js";
|
|
2
|
+
import { A as i, E as n, c as p } from "../errors-CDEBaBxB.js";
|
|
3
|
+
import { S as m, V as f, c, a as u, g as C, s as g } from "../container-message-WJolNXso.js";
|
|
4
|
+
import { A as I, C as d, R as E, a as S, p as x } from "../runtime-CmoG3v2m.js";
|
|
5
|
+
import { CameraAPI as D, FileSystemAPI as U, GeolocationAPI as _, SensorsAPI as y, camera as R, fileSystem as F, geolocation as M, isMotionSupported as P, isOrientationSupported as h, requestMotionPermission as v, sensors as O, vibrate as L, watchMotion as b, watchOrientation as V } from "../device/index.js";
|
|
6
|
+
import { P as H, a as N, c as k, b as q, g as B, i as j, p as G, r as z, s as K } from "../app-version-checker-GLONqMxq.js";
|
|
7
|
+
import { a as Y, P as J, p as Q, b as X } from "../pwa-CilSlaik.js";
|
|
8
|
+
import { j as $ } from "../url-c26cuIpu.js";
|
|
9
|
+
import { a as ae, b as oe } from "../useTweaks-QxMRmg7i.js";
|
|
10
|
+
import { c as se, a as te, i as ie, p as ne, u as pe } from "../useAudioContext-D9F3x80Y.js";
|
|
11
|
+
import { reportScore as me, sendEvent as fe, updateScore as ce } from "../leaderboard/index.js";
|
|
12
|
+
import { A as Ce, D as ge, d as le, e as Ie, c as de, U as Ee, a as Se, b as xe, f as Te, g as De, l as Ue, n as _e, p as ye, s as Re, v as Fe } from "../helper-yKJ_6uB-.js";
|
|
13
|
+
import { c as Pe, u as he } from "../hooks-DgadJdiM.js";
|
|
14
|
+
import { getAuthTokenAsync as Oe } from "../bridge-BKcAlLAd.js";
|
|
15
|
+
import { hasNativeBridge as be } from "../native-bridge-BnvipFJc.js";
|
|
15
16
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
Ce as AIConfigValidationError,
|
|
18
|
+
I as AippyRuntime,
|
|
19
|
+
i as AippyRuntimeError,
|
|
20
|
+
D as CameraAPI,
|
|
20
21
|
d as Cancellable,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
ge as DEFAULT_BASE_URL,
|
|
23
|
+
le as DEFAULT_CHAT_MODEL,
|
|
24
|
+
Ie as DEFAULT_CHAT_SYSTEM,
|
|
24
25
|
o as DEFAULT_CONFIG,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
de as DEFAULT_UI_BASE_URL,
|
|
27
|
+
n as ERROR_CODES,
|
|
28
|
+
U as FileSystemAPI,
|
|
28
29
|
_ as GeolocationAPI,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
30
|
+
Y as PWAUtils,
|
|
31
|
+
J as PerformanceMonitor,
|
|
32
|
+
H as PlatformDetector,
|
|
33
|
+
E as ReceiveChannel,
|
|
34
|
+
m as SDK_NAME,
|
|
35
|
+
y as SensorsAPI,
|
|
36
|
+
Ee as UI_CHAT_ENDPOINT,
|
|
37
|
+
f as VERSION,
|
|
38
|
+
Se as aippyAIProvider,
|
|
39
|
+
xe as aippyChatConfig,
|
|
40
|
+
S as aippyRuntime,
|
|
41
|
+
ae as aippyTweaks,
|
|
42
|
+
oe as aippyTweaksRuntime,
|
|
43
|
+
R as camera,
|
|
44
|
+
N as checkFeatureSupport,
|
|
45
|
+
Pe as clearUserInfoCache,
|
|
46
|
+
k as compareVersions,
|
|
47
|
+
Te as createAIConfig,
|
|
48
|
+
c as createAippyHeaders,
|
|
49
|
+
u as createAippyHeadersAsync,
|
|
50
|
+
p as createError,
|
|
51
|
+
se as createHiddenMediaElement,
|
|
52
|
+
F as fileSystem,
|
|
53
|
+
M as geolocation,
|
|
54
|
+
De as getAIConfigValue,
|
|
55
|
+
Oe as getAuthTokenAsync,
|
|
56
|
+
q as getAvailableFeatures,
|
|
57
|
+
r as getConfigFromEnv,
|
|
58
|
+
B as getFeatureVersionRequirements,
|
|
59
|
+
C as getVersionInfo,
|
|
60
|
+
be as hasNativeBridge,
|
|
61
|
+
te as isIOSDevice,
|
|
62
|
+
j as isInIframe,
|
|
63
|
+
ie as isMediaStreamAudioSupported,
|
|
64
|
+
P as isMotionSupported,
|
|
65
|
+
h as isOrientationSupported,
|
|
66
|
+
$ as joinUrl,
|
|
67
|
+
Ue as loadAIConfig,
|
|
68
|
+
s as mergeConfig,
|
|
69
|
+
_e as normalizeError,
|
|
70
|
+
ye as parseAIConfig,
|
|
71
|
+
ne as patchAudioContext,
|
|
72
|
+
Q as performanceMonitor,
|
|
73
|
+
G as platform,
|
|
74
|
+
x as processMotionData,
|
|
75
|
+
X as pwa,
|
|
76
|
+
me as reportScore,
|
|
77
|
+
v as requestMotionPermission,
|
|
78
|
+
z as requireFeatureSupport,
|
|
79
|
+
Re as sendAIConfigToContainer,
|
|
80
|
+
fe as sendEvent,
|
|
81
|
+
g as sendMessageToContainer,
|
|
82
|
+
O as sensors,
|
|
83
|
+
K as showAlert,
|
|
84
|
+
ce as updateScore,
|
|
85
|
+
pe as useAudioContext,
|
|
86
|
+
he as useUserInfo,
|
|
87
|
+
Fe as validateAIConfig,
|
|
88
|
+
L as vibrate,
|
|
89
|
+
b as watchMotion,
|
|
90
|
+
V as watchOrientation
|
|
83
91
|
};
|
package/dist/user/hooks.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* User SDK Hooks
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
export declare function useUserInfo(): {
|
|
4
|
+
export interface UserInfo {
|
|
6
5
|
avatar: string;
|
|
7
6
|
nickName: string;
|
|
8
7
|
username: string;
|
|
9
8
|
uid: string;
|
|
9
|
+
}
|
|
10
|
+
/** Hook to get user info (avatar, nickName, username, uid) with loading state */
|
|
11
|
+
export declare function useUserInfo(): UserInfo & {
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
refetch: () => Promise<void>;
|
|
10
14
|
};
|
|
11
15
|
/** Clear cached user info */
|
|
12
16
|
export declare function clearUserInfoCache(): void;
|
package/dist/user/index.d.ts
CHANGED
package/dist/user/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as o, u as s } from "../hooks-
|
|
2
|
-
import { getAuthTokenAsync as f } from "../bridge-
|
|
3
|
-
import { i as t } from "../
|
|
1
|
+
import { c as o, u as s } from "../hooks-DgadJdiM.js";
|
|
2
|
+
import { getAuthTokenAsync as f } from "../bridge-BKcAlLAd.js";
|
|
3
|
+
import { i as t } from "../app-version-checker-GLONqMxq.js";
|
|
4
4
|
export {
|
|
5
5
|
o as clearUserInfoCache,
|
|
6
6
|
f as getAuthTokenAsync,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { AppVersionConfig, AppEnvironmentCheckResult } from './platform';
|
|
2
|
+
import { default as versionRequirements } from './app-version-requirements.json';
|
|
3
|
+
/**
|
|
4
|
+
* Feature support check result
|
|
5
|
+
*/
|
|
6
|
+
export interface FeatureSupportResult {
|
|
7
|
+
/** Whether the feature is supported in current environment */
|
|
8
|
+
supported: boolean;
|
|
9
|
+
/** Environment check result from platform detector */
|
|
10
|
+
envCheck: AppEnvironmentCheckResult;
|
|
11
|
+
/** Current app version (if in app) */
|
|
12
|
+
currentVersion?: string;
|
|
13
|
+
/** Minimum required version for this feature */
|
|
14
|
+
requiredVersion?: string;
|
|
15
|
+
/** Error message if not supported */
|
|
16
|
+
message?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Available feature names for version checking
|
|
20
|
+
*/
|
|
21
|
+
export type FeatureName = keyof typeof versionRequirements;
|
|
22
|
+
/**
|
|
23
|
+
* Get version requirements for a feature
|
|
24
|
+
*/
|
|
25
|
+
export declare function getFeatureVersionRequirements(featureName: FeatureName): AppVersionConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Check if app version supports a specific feature
|
|
28
|
+
*
|
|
29
|
+
* @param featureName - The feature to check (e.g., 'userCredentials', 'userInfo')
|
|
30
|
+
* @returns FeatureSupportResult with support status and details
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const result = checkFeatureSupport('userCredentials');
|
|
35
|
+
* if (!result.supported) {
|
|
36
|
+
* console.log('Feature not supported:', result.message);
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function checkFeatureSupport(featureName: FeatureName): FeatureSupportResult;
|
|
41
|
+
/**
|
|
42
|
+
* Check feature support and handle old version automatically
|
|
43
|
+
*
|
|
44
|
+
* This is a convenience function that:
|
|
45
|
+
* 1. Checks if the feature is supported
|
|
46
|
+
* 2. If not supported due to old app version, shows an alert and throws an error
|
|
47
|
+
*
|
|
48
|
+
* @param featureName - The feature to check
|
|
49
|
+
* @returns FeatureSupportResult (only returns if supported or web/iframe environment)
|
|
50
|
+
* @throws Error if app version is too old
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* const result = requireFeatureSupport('userCredentials');
|
|
55
|
+
* // Code here only runs if feature is supported
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function requireFeatureSupport(featureName: FeatureName): FeatureSupportResult;
|
|
59
|
+
/**
|
|
60
|
+
* Get all available feature names
|
|
61
|
+
*/
|
|
62
|
+
export declare function getAvailableFeatures(): FeatureName[];
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { P as
|
|
2
|
-
import { a as
|
|
1
|
+
import { P as a, a as s, c as o, b as t, g as p, i, p as m, r as n, s as f } from "../app-version-checker-GLONqMxq.js";
|
|
2
|
+
import { a as c, P as l, p as P, b as F } from "../pwa-CilSlaik.js";
|
|
3
|
+
import { j as g } from "../url-c26cuIpu.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
s as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
c as PWAUtils,
|
|
6
|
+
l as PerformanceMonitor,
|
|
7
|
+
a as PlatformDetector,
|
|
8
|
+
s as checkFeatureSupport,
|
|
9
|
+
o as compareVersions,
|
|
10
|
+
t as getAvailableFeatures,
|
|
11
|
+
p as getFeatureVersionRequirements,
|
|
12
|
+
i as isInIframe,
|
|
13
|
+
g as joinUrl,
|
|
14
|
+
P as performanceMonitor,
|
|
15
|
+
m as platform,
|
|
16
|
+
F as pwa,
|
|
17
|
+
n as requireFeatureSupport,
|
|
18
|
+
f as showAlert
|
|
13
19
|
};
|