@aippy/runtime 0.2.7-dev.5 → 0.2.7-dev.7

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.
Files changed (41) hide show
  1. package/dist/ai/config/index.d.ts +1 -1
  2. package/dist/ai/config/parser.d.ts +5 -12
  3. package/dist/ai/errors.d.ts +1 -0
  4. package/dist/ai/index.d.ts +1 -1
  5. package/dist/ai/index.js +15 -16
  6. package/dist/ai/shared/fetch.d.ts +0 -4
  7. package/dist/ai/shared/index.d.ts +1 -1
  8. package/dist/app-version-checker-B1UXEcy9.js +240 -0
  9. package/dist/bridge-BQQ3PfSO.js +237 -0
  10. package/dist/config-B0A7gHQM.js +28 -0
  11. package/dist/container-message-YB3cWpWj.js +56 -0
  12. package/dist/core/errors.d.ts +22 -3
  13. package/dist/core/headers.d.ts +31 -0
  14. package/dist/core/index.d.ts +1 -0
  15. package/dist/core/index.js +22 -50
  16. package/dist/device/index.js +194 -194
  17. package/dist/errors-B3bDbQbD.js +40 -0
  18. package/dist/helper-BjRhidue.js +238 -0
  19. package/dist/hooks-C7VP176R.js +98 -0
  20. package/dist/index/index.js +89 -80
  21. package/dist/pwa-C5nXU0DN.js +250 -0
  22. package/dist/tweaks/index.js +1 -1
  23. package/dist/url-c26cuIpu.js +7 -0
  24. package/dist/{useTweaks-QxMRmg7i.js → useTweaks-B7Muzo78.js} +10 -9
  25. package/dist/user/hooks.d.ts +6 -2
  26. package/dist/user/index.d.ts +1 -0
  27. package/dist/user/index.js +3 -3
  28. package/dist/utils/app-version-checker.d.ts +62 -0
  29. package/dist/utils/app-version-requirements.json.d.ts +13 -0
  30. package/dist/utils/index.d.ts +2 -0
  31. package/dist/utils/index.js +17 -11
  32. package/dist/utils/ui.d.ts +3 -1
  33. package/dist/utils/url.d.ts +7 -0
  34. package/package.json +1 -1
  35. package/dist/bridge-Ca3H2iN1.js +0 -197
  36. package/dist/container-message-DGrno17o.js +0 -31
  37. package/dist/errors-CDEBaBxB.js +0 -26
  38. package/dist/helper-BENVYOU-.js +0 -247
  39. package/dist/hooks-CE9cjXHP.js +0 -46
  40. package/dist/pwa-CilSlaik.js +0 -249
  41. package/dist/ui-y5N62DqC.js +0 -175
@@ -1,249 +0,0 @@
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
- };
@@ -1,175 +0,0 @@
1
- var d = Object.defineProperty;
2
- var l = (o, e, n) => e in o ? d(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
3
- var c = (o, e, n) => l(o, typeof e != "symbol" ? e + "" : e, n);
4
- import { UAParser as u } from "ua-parser-js";
5
- import { hasNativeBridge as p } from "./native-bridge-BnvipFJc.js";
6
- function m() {
7
- try {
8
- return typeof window < "u" && window.parent !== window;
9
- } catch {
10
- return !0;
11
- }
12
- }
13
- function f(o, e) {
14
- const n = o.split(".").map(Number), r = e.split(".").map(Number), t = Math.max(n.length, r.length);
15
- for (let i = 0; i < t; i++) {
16
- const s = n[i] || 0, a = r[i] || 0;
17
- if (s < a) return -1;
18
- if (s > a) return 1;
19
- }
20
- return 0;
21
- }
22
- class w {
23
- constructor() {
24
- c(this, "parser");
25
- this.parser = new u();
26
- }
27
- /**
28
- * Get platform information
29
- */
30
- getPlatformInfo() {
31
- const e = this.parser.getResult(), n = this.normalizePlatformName(e.os.name), r = this.normalizeBrowserName(e.browser.name), t = this.isMobileDevice(), i = !t;
32
- return {
33
- name: n,
34
- version: e.os.version,
35
- browser: r,
36
- browserVersion: e.browser.version,
37
- isMobile: t,
38
- isDesktop: i
39
- };
40
- }
41
- /**
42
- * Get raw UA parser result
43
- */
44
- getRawParserResult() {
45
- return this.parser.getResult();
46
- }
47
- /**
48
- * Get platform capabilities
49
- */
50
- getCapabilities() {
51
- return {
52
- serviceWorker: "serviceWorker" in navigator,
53
- pushNotifications: "PushManager" in window,
54
- webShare: "share" in navigator,
55
- clipboard: "clipboard" in navigator,
56
- webRTC: !!(window.RTCPeerConnection || window.webkitRTCPeerConnection),
57
- webGL: !!this.getWebGLContext(),
58
- webAssembly: "WebAssembly" in window
59
- };
60
- }
61
- /**
62
- * Check if device is mobile
63
- */
64
- isMobileDevice() {
65
- const e = navigator.userAgent;
66
- return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e) || this.isTouchDevice();
67
- }
68
- /**
69
- * Check if device supports touch
70
- */
71
- isTouchDevice() {
72
- return "ontouchstart" in window || navigator.maxTouchPoints > 0;
73
- }
74
- /**
75
- * Check if running in standalone mode (PWA)
76
- */
77
- isStandalone() {
78
- return window.matchMedia("(display-mode: standalone)").matches || window.navigator.standalone === !0;
79
- }
80
- /**
81
- * Check if running in iOS Safari
82
- */
83
- isIOSSafari() {
84
- const e = this.getPlatformInfo();
85
- return e.name === "ios" && e.browser === "safari";
86
- }
87
- /**
88
- * Check if running in Android Chrome
89
- */
90
- isAndroidChrome() {
91
- const e = this.getPlatformInfo();
92
- return e.name === "android" && e.browser === "chrome";
93
- }
94
- /**
95
- * Check if running in Android WebView (old app version)
96
- * Detects by checking if browser name contains "webview"
97
- */
98
- isAndroidWebView() {
99
- return (this.parser.getResult().browser.name || "").toLowerCase().includes("webview");
100
- }
101
- /**
102
- * Check app environment and validate version
103
- */
104
- checkAppEnvironment(e) {
105
- const n = this.parseAippyInfo();
106
- if (n) {
107
- const r = e[n.platform], t = f(n.version, r) >= 0;
108
- return {
109
- type: "new_app",
110
- isValid: t,
111
- aippyInfo: n,
112
- message: t ? void 0 : `App version ${n.version} < ${r}`
113
- };
114
- }
115
- return p() ? {
116
- type: "old_ios_app",
117
- isValid: !1,
118
- message: "Native bridge exists but no Aippy info (old iOS version)"
119
- } : this.isAndroidWebView() ? {
120
- type: "old_android_app",
121
- isValid: !1,
122
- message: "Android WebView detected but no Aippy info (old Android version)"
123
- } : m() ? { type: "iframe", isValid: !0 } : { type: "web", isValid: !0 };
124
- }
125
- /**
126
- * Parse Aippy App info from User-Agent
127
- */
128
- parseAippyInfo() {
129
- const e = navigator.userAgent, n = /Aippy\/([^/]+)\/[^/]+\/(iOS|Android)/i, r = e.match(n);
130
- if (r) {
131
- const t = r[1];
132
- return {
133
- platform: r[2],
134
- version: t
135
- };
136
- }
137
- return null;
138
- }
139
- normalizePlatformName(e) {
140
- if (!e) return "unknown";
141
- const n = e.toLowerCase();
142
- return n.includes("ios") ? "ios" : n.includes("android") ? "android" : n.includes("windows") ? "windows" : n.includes("mac") ? "macos" : n.includes("linux") ? "linux" : "unknown";
143
- }
144
- normalizeBrowserName(e) {
145
- if (!e) return "unknown";
146
- const n = e.toLowerCase();
147
- return n.includes("chrome") ? "chrome" : n.includes("firefox") ? "firefox" : n.includes("safari") ? "safari" : n.includes("edge") ? "edge" : "unknown";
148
- }
149
- getWebGLContext() {
150
- try {
151
- const e = document.createElement("canvas");
152
- return e.getContext("webgl") || e.getContext("experimental-webgl");
153
- } catch {
154
- return null;
155
- }
156
- }
157
- }
158
- const x = new w();
159
- function v(o) {
160
- const e = document.createElement("div");
161
- 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";
162
- const n = document.createElement("div");
163
- 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)";
164
- const r = document.createElement("p");
165
- r.style.cssText = "margin:0 0 20px;font-size:16px;color:#333;line-height:1.5", r.textContent = o;
166
- const t = document.createElement("button");
167
- t.style.cssText = "background:#007AFF;color:#fff;border:none;border-radius:8px;padding:10px 32px;font-size:15px;cursor:pointer", t.textContent = "OK", t.onclick = () => e.remove(), n.appendChild(r), n.appendChild(t), e.appendChild(n), document.body.appendChild(e);
168
- }
169
- export {
170
- w as P,
171
- f as c,
172
- m as i,
173
- x as p,
174
- v as s
175
- };