@aippy/runtime 0.2.7-dev.1 → 0.2.7-dev.3
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/{bridge-D2d8hnO_.js → bridge-N9ELFpfV.js} +201 -166
- package/dist/core/index.js +1 -1
- package/dist/{helper-CRGxnlsu.js → helper-CKiqfKle.js} +12 -9
- package/dist/index/index.js +86 -84
- package/dist/pwa-CilSlaik.js +249 -0
- package/dist/ui-D6IZ1jrR.js +119 -0
- package/dist/user/bridge.d.ts +1 -3
- package/dist/user/index.js +2 -2
- package/dist/{userSessionInfo-SbuNZ7JR.js → userSessionInfo-DFvsuELU.js} +2 -2
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +9 -7
- package/dist/utils/platform.d.ts +7 -0
- package/dist/utils/ui.d.ts +11 -0
- package/package.json +1 -1
- package/dist/pwa-8DGmPqLV.js +0 -341
package/dist/index/index.js
CHANGED
|
@@ -1,115 +1,117 @@
|
|
|
1
1
|
import { DEFAULT_CONFIG as a, SDK_NAME as s, VERSION as o, getConfigFromEnv as t, getVersionInfo as n, mergeConfig as i } from "../core/index.js";
|
|
2
2
|
import { A as p, E as d, c as m } from "../errors-CDEBaBxB.js";
|
|
3
3
|
import { s as C } from "../container-message-DGrno17o.js";
|
|
4
|
-
import { A as
|
|
4
|
+
import { A as I, C as c, R as l, a as g, p as U } from "../runtime-CmoG3v2m.js";
|
|
5
5
|
import { CameraAPI as S, FileSystemAPI as h, GeolocationAPI as P, SensorsAPI as y, camera as T, fileSystem as x, geolocation as F, isMotionSupported as _, isOrientationSupported as D, requestMotionPermission as R, sensors as M, vibrate as k, watchMotion as O, watchOrientation as v } from "../device/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import { a as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
6
|
+
import { P as w, p as L, s as q } from "../ui-D6IZ1jrR.js";
|
|
7
|
+
import { a as N, P as B, p as H, b as V } from "../pwa-CilSlaik.js";
|
|
8
|
+
import { a as Q, b as z } from "../useTweaks-QxMRmg7i.js";
|
|
9
|
+
import { c as K, a as W, b as Y, i as X, p as Z, u as $ } from "../useAudioContext-CNQQSTab.js";
|
|
10
|
+
import { reportScore as re, sendEvent as ae, updateScore as se } from "../leaderboard/index.js";
|
|
11
|
+
import { A as te, D as ne, d as ie, e as fe, c as pe, U as de, f as me, a as ue, a as Ce, b as Ae, j as Ie, i as ce, l as le, m as ge, g as Ue, n as Ee, h as Se, p as he, s as Pe, v as ye } from "../helper-CKiqfKle.js";
|
|
12
|
+
import { f as xe, q as Fe, b as _e, h as De, l as Re, o as Me, j as ke, n as Oe, w as ve, g as be, k as we, p as Le, e as qe, i as Ge, c as Ne, d as Be, r as He, u as Ve, m as je, s as Qe, a as ze, t as Je, v as Ke } from "../bridge-N9ELFpfV.js";
|
|
13
|
+
import { i as Ye, f as Xe, h as Ze, g as $e, a as er, u as rr, b as ar, d as sr, c as or, e as tr, j as nr } from "../userSessionInfo-DFvsuELU.js";
|
|
14
|
+
import { hasNativeBridge as fr } from "../native-bridge-BnvipFJc.js";
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
te as AIConfigValidationError,
|
|
17
|
+
I as AippyRuntime,
|
|
17
18
|
p as AippyRuntimeError,
|
|
18
19
|
S as CameraAPI,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
c as Cancellable,
|
|
21
|
+
ne as DEFAULT_BASE_URL,
|
|
22
|
+
ie as DEFAULT_CHAT_MODEL,
|
|
23
|
+
fe as DEFAULT_CHAT_SYSTEM,
|
|
23
24
|
a as DEFAULT_CONFIG,
|
|
24
|
-
|
|
25
|
+
pe as DEFAULT_UI_BASE_URL,
|
|
25
26
|
d as ERROR_CODES,
|
|
26
27
|
h as FileSystemAPI,
|
|
27
28
|
P as GeolocationAPI,
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
N as PWAUtils,
|
|
30
|
+
B as PerformanceMonitor,
|
|
30
31
|
w as PlatformDetector,
|
|
31
|
-
|
|
32
|
+
l as ReceiveChannel,
|
|
32
33
|
s as SDK_NAME,
|
|
33
34
|
y as SensorsAPI,
|
|
34
|
-
|
|
35
|
+
de as UI_CHAT_ENDPOINT,
|
|
35
36
|
o as VERSION,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
me as abortedError,
|
|
38
|
+
ue as aippy,
|
|
39
|
+
Ce as aippyAIProvider,
|
|
40
|
+
Ae as aippyChatConfig,
|
|
41
|
+
g as aippyRuntime,
|
|
42
|
+
Q as aippyTweaks,
|
|
43
|
+
z as aippyTweaksRuntime,
|
|
44
|
+
xe as autoRequestCredentials,
|
|
44
45
|
T as camera,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
Fe as clearCachedUserInfo,
|
|
47
|
+
Ye as clearProfileCache,
|
|
48
|
+
Xe as clearUserInfoCache,
|
|
49
|
+
Ie as createAIConfig,
|
|
49
50
|
m as createError,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
K as createHiddenMediaElement,
|
|
52
|
+
W as createHiddenVideoElement,
|
|
53
|
+
Ze as fetchUserProfile,
|
|
53
54
|
x as fileSystem,
|
|
54
55
|
F as geolocation,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
ce as getAIConfigValue,
|
|
57
|
+
_e as getAuthToken,
|
|
58
|
+
De as getAuthTokenAsync,
|
|
59
|
+
Re as getCachedCredentials,
|
|
60
|
+
Me as getCachedUserInfo,
|
|
60
61
|
t as getConfigFromEnv,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
$e as getCurrentUserId,
|
|
63
|
+
ke as getCurrentUserIdAsync,
|
|
64
|
+
Oe as getUserInfoAsync,
|
|
65
|
+
ve as getUserInfoFromParent,
|
|
66
|
+
be as getUserSdkConfig,
|
|
66
67
|
n as getVersionInfo,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
we as hasCredentials,
|
|
69
|
+
fr as hasNativeBridge,
|
|
70
|
+
Le as hasUserInfo,
|
|
71
|
+
qe as initUserBridge,
|
|
72
|
+
Ge as initUserSdk,
|
|
73
|
+
Y as isIOSDevice,
|
|
74
|
+
Ne as isInIframe,
|
|
75
|
+
X as isMediaStreamAudioSupported,
|
|
75
76
|
_ as isMotionSupported,
|
|
76
77
|
D as isOrientationSupported,
|
|
77
|
-
|
|
78
|
+
le as loadAIConfig,
|
|
78
79
|
i as mergeConfig,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
ge as missingTokenError,
|
|
81
|
+
Ue as networkError,
|
|
82
|
+
Ee as normalizeError,
|
|
83
|
+
Se as parseAIConfig,
|
|
84
|
+
he as parseError,
|
|
85
|
+
Z as patchAudioContext,
|
|
86
|
+
H as performanceMonitor,
|
|
87
|
+
L as platform,
|
|
87
88
|
U as processMotionData,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
V as pwa,
|
|
90
|
+
re as reportScore,
|
|
91
|
+
Be as requestCredentialsFromParent,
|
|
92
|
+
He as requestCredentialsFromiOS,
|
|
92
93
|
R as requestMotionPermission,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
Ve as requestUserInfoFromParent,
|
|
95
|
+
je as requestUserInfoFromiOS,
|
|
96
|
+
Pe as sendAIConfigToContainer,
|
|
97
|
+
ae as sendEvent,
|
|
97
98
|
C as sendMessageToContainer,
|
|
98
99
|
M as sensors,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
100
|
+
Qe as setAuthToken,
|
|
101
|
+
ze as setCurrentUserId,
|
|
102
|
+
q as showAlert,
|
|
103
|
+
Je as tryGetCredentialsFromParentStorage,
|
|
104
|
+
Ke as tryGetUserInfoFromParentStorage,
|
|
105
|
+
se as updateScore,
|
|
106
|
+
$ as useAudioContext,
|
|
107
|
+
er as useAuthToken,
|
|
108
|
+
rr as useCurrentUserId,
|
|
109
|
+
ar as useGetCurrentUserProfileQuery,
|
|
110
|
+
sr as useGetJoinedUserProfilesQuery,
|
|
111
|
+
or as useGetUserProfileByIdQuery,
|
|
112
|
+
tr as useUserInfo,
|
|
113
|
+
nr as userSessionInfo,
|
|
114
|
+
ye as validateAIConfig,
|
|
113
115
|
k as vibrate,
|
|
114
116
|
O as watchMotion,
|
|
115
117
|
v as watchOrientation
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
class f {
|
|
2
|
+
/**
|
|
3
|
+
* Get Core Web Vitals metrics
|
|
4
|
+
*/
|
|
5
|
+
async getCoreWebVitals() {
|
|
6
|
+
const r = {};
|
|
7
|
+
try {
|
|
8
|
+
const e = performance.getEntriesByName("first-contentful-paint")[0];
|
|
9
|
+
e && (r.fcp = e.startTime);
|
|
10
|
+
const t = performance.getEntriesByType("largest-contentful-paint");
|
|
11
|
+
if (t.length > 0) {
|
|
12
|
+
const n = t[t.length - 1];
|
|
13
|
+
r.lcp = n.startTime;
|
|
14
|
+
}
|
|
15
|
+
const i = performance.getEntriesByType("first-input");
|
|
16
|
+
if (i.length > 0) {
|
|
17
|
+
const n = i[0];
|
|
18
|
+
r.fid = n.processingStart - n.startTime;
|
|
19
|
+
}
|
|
20
|
+
const o = performance.getEntriesByType("layout-shift");
|
|
21
|
+
if (o.length > 0) {
|
|
22
|
+
let n = 0;
|
|
23
|
+
for (const l of o) {
|
|
24
|
+
const s = l;
|
|
25
|
+
s.hadRecentInput || (n += s.value);
|
|
26
|
+
}
|
|
27
|
+
r.cls = n;
|
|
28
|
+
}
|
|
29
|
+
const a = this.calculateTTI();
|
|
30
|
+
a && (r.tti = a);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
console.warn("Failed to get Core Web Vitals:", e);
|
|
33
|
+
}
|
|
34
|
+
return r;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get navigation timing metrics
|
|
38
|
+
*/
|
|
39
|
+
getNavigationTiming() {
|
|
40
|
+
const r = performance.getEntriesByType("navigation")[0];
|
|
41
|
+
return r ? {
|
|
42
|
+
// DNS lookup time
|
|
43
|
+
dns: r.domainLookupEnd - r.domainLookupStart,
|
|
44
|
+
// TCP connection time
|
|
45
|
+
tcp: r.connectEnd - r.connectStart,
|
|
46
|
+
// Request time
|
|
47
|
+
request: r.responseStart - r.requestStart,
|
|
48
|
+
// Response time
|
|
49
|
+
response: r.responseEnd - r.responseStart,
|
|
50
|
+
// DOM processing time
|
|
51
|
+
domProcessing: r.domComplete - r.domInteractive,
|
|
52
|
+
// Total page load time
|
|
53
|
+
total: r.loadEventEnd - r.fetchStart
|
|
54
|
+
} : null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get resource timing metrics
|
|
58
|
+
*/
|
|
59
|
+
getResourceTiming() {
|
|
60
|
+
return performance.getEntriesByType("resource").map((e) => ({
|
|
61
|
+
name: e.name,
|
|
62
|
+
duration: e.duration,
|
|
63
|
+
size: e.transferSize,
|
|
64
|
+
type: this.getResourceType(e.name)
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Measure function execution time
|
|
69
|
+
*/
|
|
70
|
+
measureFunction(r, e) {
|
|
71
|
+
const t = r();
|
|
72
|
+
return e && (performance.mark(`${e}-start`), performance.mark(`${e}-end`), performance.measure(e, `${e}-start`, `${e}-end`)), t;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Measure async function execution time
|
|
76
|
+
*/
|
|
77
|
+
async measureAsyncFunction(r, e) {
|
|
78
|
+
const t = await r();
|
|
79
|
+
return e && (performance.mark(`${e}-start`), performance.mark(`${e}-end`), performance.measure(e, `${e}-start`, `${e}-end`)), t;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get memory usage (if available)
|
|
83
|
+
*/
|
|
84
|
+
getMemoryUsage() {
|
|
85
|
+
if ("memory" in performance) {
|
|
86
|
+
const r = performance.memory;
|
|
87
|
+
return {
|
|
88
|
+
used: r.usedJSHeapSize,
|
|
89
|
+
total: r.totalJSHeapSize,
|
|
90
|
+
limit: r.jsHeapSizeLimit
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
calculateTTI() {
|
|
96
|
+
const r = performance.getEntriesByType("navigation")[0];
|
|
97
|
+
return r ? r.domContentLoadedEventEnd - r.fetchStart : null;
|
|
98
|
+
}
|
|
99
|
+
getResourceType(r) {
|
|
100
|
+
return r.includes(".js") ? "script" : r.includes(".css") ? "stylesheet" : r.includes(".png") || r.includes(".jpg") || r.includes(".gif") ? "image" : r.includes(".woff") || r.includes(".ttf") ? "font" : "other";
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const p = new f();
|
|
104
|
+
class d {
|
|
105
|
+
/**
|
|
106
|
+
* Get PWA information
|
|
107
|
+
*/
|
|
108
|
+
getPWAInfo() {
|
|
109
|
+
return {
|
|
110
|
+
isInstalled: this.isInstalled(),
|
|
111
|
+
isInstallable: this.isInstallable(),
|
|
112
|
+
canInstall: this.canInstall(),
|
|
113
|
+
isStandalone: this.isStandalone()
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Check if PWA is installed
|
|
118
|
+
*/
|
|
119
|
+
isInstalled() {
|
|
120
|
+
return this.isStandalone() || this.isInApp();
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Check if PWA is installable
|
|
124
|
+
*/
|
|
125
|
+
isInstallable() {
|
|
126
|
+
return "serviceWorker" in navigator && "PushManager" in window;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Check if install prompt is available
|
|
130
|
+
*/
|
|
131
|
+
canInstall() {
|
|
132
|
+
return this.isInstallable() && !this.isInstalled();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Check if running in standalone mode
|
|
136
|
+
*/
|
|
137
|
+
isStandalone() {
|
|
138
|
+
return window.matchMedia("(display-mode: standalone)").matches || window.navigator.standalone === !0;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Check if running in app (iOS)
|
|
142
|
+
*/
|
|
143
|
+
isInApp() {
|
|
144
|
+
return window.navigator.standalone === !0;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Register service worker
|
|
148
|
+
*/
|
|
149
|
+
async registerServiceWorker(r) {
|
|
150
|
+
if (!("serviceWorker" in navigator))
|
|
151
|
+
return console.warn("Service Worker not supported"), null;
|
|
152
|
+
try {
|
|
153
|
+
return await navigator.serviceWorker.register(r);
|
|
154
|
+
} catch (e) {
|
|
155
|
+
return console.error("Service Worker registration failed:", e), null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Unregister service worker
|
|
160
|
+
*/
|
|
161
|
+
async unregisterServiceWorker() {
|
|
162
|
+
if (!("serviceWorker" in navigator))
|
|
163
|
+
return !1;
|
|
164
|
+
try {
|
|
165
|
+
const r = await navigator.serviceWorker.getRegistrations();
|
|
166
|
+
for (const e of r)
|
|
167
|
+
await e.unregister();
|
|
168
|
+
return !0;
|
|
169
|
+
} catch (r) {
|
|
170
|
+
return console.error("Service Worker unregistration failed:", r), !1;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Request notification permission
|
|
175
|
+
*/
|
|
176
|
+
async requestNotificationPermission() {
|
|
177
|
+
if (!("Notification" in window))
|
|
178
|
+
throw new Error("Notifications not supported");
|
|
179
|
+
return Notification.permission === "granted" ? "granted" : Notification.permission === "denied" ? "denied" : await Notification.requestPermission();
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Send notification
|
|
183
|
+
*/
|
|
184
|
+
async sendNotification(r, e) {
|
|
185
|
+
if (!("Notification" in window))
|
|
186
|
+
throw new Error("Notifications not supported");
|
|
187
|
+
if (Notification.permission !== "granted")
|
|
188
|
+
throw new Error("Notification permission not granted");
|
|
189
|
+
const t = new Notification(r, e);
|
|
190
|
+
setTimeout(() => {
|
|
191
|
+
t.close();
|
|
192
|
+
}, 5e3);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Share content using Web Share API
|
|
196
|
+
*/
|
|
197
|
+
async share(r) {
|
|
198
|
+
if (!("share" in navigator))
|
|
199
|
+
throw new Error("Web Share API not supported");
|
|
200
|
+
try {
|
|
201
|
+
await navigator.share(r);
|
|
202
|
+
} catch (e) {
|
|
203
|
+
if (e instanceof Error && e.name !== "AbortError")
|
|
204
|
+
throw new Error(`Share failed: ${e.message}`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Copy text to clipboard
|
|
209
|
+
*/
|
|
210
|
+
async copyToClipboard(r) {
|
|
211
|
+
if (!("clipboard" in navigator))
|
|
212
|
+
throw new Error("Clipboard API not supported");
|
|
213
|
+
try {
|
|
214
|
+
await navigator.clipboard.writeText(r);
|
|
215
|
+
} catch (e) {
|
|
216
|
+
throw new Error(`Copy to clipboard failed: ${e instanceof Error ? e.message : "Unknown error"}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Read text from clipboard
|
|
221
|
+
*/
|
|
222
|
+
async readFromClipboard() {
|
|
223
|
+
if (!("clipboard" in navigator))
|
|
224
|
+
throw new Error("Clipboard API not supported");
|
|
225
|
+
try {
|
|
226
|
+
return await navigator.clipboard.readText();
|
|
227
|
+
} catch (r) {
|
|
228
|
+
throw new Error(`Read from clipboard failed: ${r instanceof Error ? r.message : "Unknown error"}`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Get install prompt event
|
|
233
|
+
*/
|
|
234
|
+
getInstallPromptEvent() {
|
|
235
|
+
return new Promise((r) => {
|
|
236
|
+
const e = (t) => {
|
|
237
|
+
t.preventDefault(), r(t), window.removeEventListener("beforeinstallprompt", e);
|
|
238
|
+
};
|
|
239
|
+
window.addEventListener("beforeinstallprompt", e);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const u = new d();
|
|
244
|
+
export {
|
|
245
|
+
f as P,
|
|
246
|
+
d as a,
|
|
247
|
+
u as b,
|
|
248
|
+
p
|
|
249
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var c = (o, e, n) => e in o ? a(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
|
|
3
|
+
var s = (o, e, n) => c(o, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { UAParser as d } from "ua-parser-js";
|
|
5
|
+
class l {
|
|
6
|
+
constructor() {
|
|
7
|
+
s(this, "parser");
|
|
8
|
+
this.parser = new d();
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get platform information
|
|
12
|
+
*/
|
|
13
|
+
getPlatformInfo() {
|
|
14
|
+
const e = this.parser.getResult(), n = this.normalizePlatformName(e.os.name), t = this.normalizeBrowserName(e.browser.name), r = this.isMobileDevice(), i = !r;
|
|
15
|
+
return {
|
|
16
|
+
name: n,
|
|
17
|
+
version: e.os.version,
|
|
18
|
+
browser: t,
|
|
19
|
+
browserVersion: e.browser.version,
|
|
20
|
+
isMobile: r,
|
|
21
|
+
isDesktop: i
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get platform capabilities
|
|
26
|
+
*/
|
|
27
|
+
getCapabilities() {
|
|
28
|
+
return {
|
|
29
|
+
serviceWorker: "serviceWorker" in navigator,
|
|
30
|
+
pushNotifications: "PushManager" in window,
|
|
31
|
+
webShare: "share" in navigator,
|
|
32
|
+
clipboard: "clipboard" in navigator,
|
|
33
|
+
webRTC: !!(window.RTCPeerConnection || window.webkitRTCPeerConnection),
|
|
34
|
+
webGL: !!this.getWebGLContext(),
|
|
35
|
+
webAssembly: "WebAssembly" in window
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Check if device is mobile
|
|
40
|
+
*/
|
|
41
|
+
isMobileDevice() {
|
|
42
|
+
const e = navigator.userAgent;
|
|
43
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e) || this.isTouchDevice();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Check if device supports touch
|
|
47
|
+
*/
|
|
48
|
+
isTouchDevice() {
|
|
49
|
+
return "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Check if running in standalone mode (PWA)
|
|
53
|
+
*/
|
|
54
|
+
isStandalone() {
|
|
55
|
+
return window.matchMedia("(display-mode: standalone)").matches || window.navigator.standalone === !0;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Check if running in iOS Safari
|
|
59
|
+
*/
|
|
60
|
+
isIOSSafari() {
|
|
61
|
+
const e = this.getPlatformInfo();
|
|
62
|
+
return e.name === "ios" && e.browser === "safari";
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Check if running in Android Chrome
|
|
66
|
+
*/
|
|
67
|
+
isAndroidChrome() {
|
|
68
|
+
const e = this.getPlatformInfo();
|
|
69
|
+
return e.name === "android" && e.browser === "chrome";
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 解析 User-Agent 中的 Aippy App 信息
|
|
73
|
+
*/
|
|
74
|
+
parseAippyInfo() {
|
|
75
|
+
const e = navigator.userAgent, n = /Aippy\/([^\/]+)\/[^\/]+\/(iOS|Android)/i, t = e.match(n);
|
|
76
|
+
if (t) {
|
|
77
|
+
const r = t[1];
|
|
78
|
+
return {
|
|
79
|
+
platform: t[2],
|
|
80
|
+
version: r
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
normalizePlatformName(e) {
|
|
86
|
+
if (!e) return "unknown";
|
|
87
|
+
const n = e.toLowerCase();
|
|
88
|
+
return n.includes("ios") ? "ios" : n.includes("android") ? "android" : n.includes("windows") ? "windows" : n.includes("mac") ? "macos" : n.includes("linux") ? "linux" : "unknown";
|
|
89
|
+
}
|
|
90
|
+
normalizeBrowserName(e) {
|
|
91
|
+
if (!e) return "unknown";
|
|
92
|
+
const n = e.toLowerCase();
|
|
93
|
+
return n.includes("chrome") ? "chrome" : n.includes("firefox") ? "firefox" : n.includes("safari") ? "safari" : n.includes("edge") ? "edge" : "unknown";
|
|
94
|
+
}
|
|
95
|
+
getWebGLContext() {
|
|
96
|
+
try {
|
|
97
|
+
const e = document.createElement("canvas");
|
|
98
|
+
return e.getContext("webgl") || e.getContext("experimental-webgl");
|
|
99
|
+
} catch {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const f = new l();
|
|
105
|
+
function p(o) {
|
|
106
|
+
const e = document.createElement("div");
|
|
107
|
+
e.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.5);display:flex;align-items:center;justify-content:center;z-index:999999";
|
|
108
|
+
const n = document.createElement("div");
|
|
109
|
+
n.style.cssText = "background:#fff;border-radius:12px;padding:24px 32px;max-width:80%;text-align:center;box-shadow:0 4px 20px rgba(0,0,0,0.15)";
|
|
110
|
+
const t = document.createElement("p");
|
|
111
|
+
t.style.cssText = "margin:0 0 20px;font-size:16px;color:#333;line-height:1.5", t.textContent = o;
|
|
112
|
+
const r = document.createElement("button");
|
|
113
|
+
r.style.cssText = "background:#007AFF;color:#fff;border:none;border-radius:8px;padding:10px 32px;font-size:15px;cursor:pointer", r.textContent = "OK", r.onclick = () => e.remove(), n.appendChild(t), n.appendChild(r), e.appendChild(n), document.body.appendChild(e);
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
l as P,
|
|
117
|
+
f as p,
|
|
118
|
+
p as s
|
|
119
|
+
};
|
package/dist/user/bridge.d.ts
CHANGED
|
@@ -141,9 +141,7 @@ export declare function initUserBridge(): void;
|
|
|
141
141
|
*/
|
|
142
142
|
export declare function autoRequestCredentials(): Promise<void>;
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
145
|
-
* Waits for credentials if not already available
|
|
146
|
-
* @returns Promise resolving to token string, or "" if unavailable
|
|
144
|
+
* 异步获取 Auth Token
|
|
147
145
|
*/
|
|
148
146
|
export declare function getAuthTokenAsync(): Promise<string>;
|
|
149
147
|
/**
|
package/dist/user/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as r, q as a, b as t, h as n, l as o, o as u, j as i, n as f, w as U, g as d, k as I, p as C, e as g, i as l, c, d as h, r as m, u as P, m as y, s as k, a as A, t as F, v as S } from "../bridge-
|
|
2
|
-
import { i as G, f as T, h as p, g as Q, a as b, u as j, b as x, d as B, c as O, e as v, j as w } from "../userSessionInfo-
|
|
1
|
+
import { f as r, q as a, b as t, h as n, l as o, o as u, j as i, n as f, w as U, g as d, k as I, p as C, e as g, i as l, c, d as h, r as m, u as P, m as y, s as k, a as A, t as F, v as S } from "../bridge-N9ELFpfV.js";
|
|
2
|
+
import { i as G, f as T, h as p, g as Q, a as b, u as j, b as x, d as B, c as O, e as v, j as w } from "../userSessionInfo-DFvsuELU.js";
|
|
3
3
|
export {
|
|
4
4
|
r as autoRequestCredentials,
|
|
5
5
|
a as clearCachedUserInfo,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState as o, useEffect as y, useCallback as U } from "react";
|
|
2
|
-
import { g as I, b as k } from "./bridge-
|
|
2
|
+
import { g as I, b as k } from "./bridge-N9ELFpfV.js";
|
|
3
3
|
const w = /* @__PURE__ */ new Map();
|
|
4
4
|
async function S(e) {
|
|
5
5
|
const t = I(), n = w.get(e);
|
|
@@ -150,7 +150,7 @@ function j() {
|
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
152
|
console.log("[useUserInfo] Fetching user info"), p = (async () => {
|
|
153
|
-
const { getUserInfoAsync: a, getUserInfoFromParent: i, isInIframe: u } = await import("./bridge-
|
|
153
|
+
const { getUserInfoAsync: a, getUserInfoFromParent: i, isInIframe: u } = await import("./bridge-N9ELFpfV.js").then((l) => l.x), { hasNativeBridge: h } = await import("./native-bridge-BnvipFJc.js");
|
|
154
154
|
let s = null;
|
|
155
155
|
h() ? s = await a() : u() ? s = await i() : s = await a(), s && (g = {
|
|
156
156
|
avatar: String(s.avatar || s.photoUrl || ""),
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P as a, p as s, s as t } from "../ui-D6IZ1jrR.js";
|
|
2
|
+
import { a as p, P as f, p as m, b as P } from "../pwa-CilSlaik.js";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
p as PWAUtils,
|
|
5
|
+
f as PerformanceMonitor,
|
|
6
|
+
a as PlatformDetector,
|
|
7
|
+
m as performanceMonitor,
|
|
8
|
+
s as platform,
|
|
9
|
+
P as pwa,
|
|
10
|
+
t as showAlert
|
|
9
11
|
};
|
package/dist/utils/platform.d.ts
CHANGED
|
@@ -41,6 +41,13 @@ export declare class PlatformDetector {
|
|
|
41
41
|
* Check if running in Android Chrome
|
|
42
42
|
*/
|
|
43
43
|
isAndroidChrome(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* 解析 User-Agent 中的 Aippy App 信息
|
|
46
|
+
*/
|
|
47
|
+
parseAippyInfo(): {
|
|
48
|
+
platform: 'iOS' | 'Android';
|
|
49
|
+
version: string;
|
|
50
|
+
} | null;
|
|
44
51
|
private normalizePlatformName;
|
|
45
52
|
private normalizeBrowserName;
|
|
46
53
|
private getWebGLContext;
|