@aippy/runtime 0.2.7-dev.7 → 0.3.0

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 CHANGED
@@ -1,6 +1,6 @@
1
- import { D as i, d as r, e, c as n, U as C, a as _, b as E, f as I, g as T, l as f, n as g, p, s as U, v as t } from "../helper-BjRhidue.js";
1
+ import { D as i, d as r, e, c as n, U as C, a as _, b as E, f as I, g as T, l as f, n as g, p, s as U, v as t } from "../helper-I-UkGE0O.js";
2
2
  import "react";
3
- import "../bridge-BQQ3PfSO.js";
3
+ import "../bridge-CqV1iP30.js";
4
4
  export {
5
5
  i as DEFAULT_BASE_URL,
6
6
  r as DEFAULT_CHAT_MODEL,
@@ -1,42 +1,42 @@
1
- var l = Object.defineProperty;
2
- var m = (r, e, n) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
- var c = (r, e, n) => m(r, typeof e != "symbol" ? e + "" : e, n);
4
- import { UAParser as f } from "ua-parser-js";
5
- import { hasNativeBridge as w } from "./native-bridge-BnvipFJc.js";
6
- import { c as h, a as g } from "./errors-B3bDbQbD.js";
7
- function b() {
1
+ var w = Object.defineProperty;
2
+ var h = (t, e, n) => e in t ? w(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var u = (t, e, n) => h(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { UAParser as g } from "ua-parser-js";
5
+ import { hasNativeBridge as b } from "./native-bridge-BnvipFJc.js";
6
+ import { c as v, a as x } from "./errors-B3bDbQbD.js";
7
+ function y() {
8
8
  try {
9
9
  return typeof window < "u" && window.parent !== window;
10
10
  } catch {
11
11
  return !0;
12
12
  }
13
13
  }
14
- function v(r, e) {
15
- const n = r.split(".").map(Number), t = e.split(".").map(Number), i = Math.max(n.length, t.length);
16
- for (let o = 0; o < i; o++) {
17
- const p = n[o] || 0, s = t[o] || 0;
14
+ function f(t, e) {
15
+ const n = t.split(".").map(Number), r = e.split(".").map(Number), o = Math.max(n.length, r.length);
16
+ for (let i = 0; i < o; i++) {
17
+ const p = n[i] || 0, s = r[i] || 0;
18
18
  if (p < s) return -1;
19
19
  if (p > s) return 1;
20
20
  }
21
21
  return 0;
22
22
  }
23
- class x {
23
+ class A {
24
24
  constructor() {
25
- c(this, "parser");
26
- this.parser = new f();
25
+ u(this, "parser");
26
+ this.parser = new g();
27
27
  }
28
28
  /**
29
29
  * Get platform information
30
30
  */
31
31
  getPlatformInfo() {
32
- const e = this.parser.getResult(), n = this.normalizePlatformName(e.os.name), t = this.normalizeBrowserName(e.browser.name), i = this.isMobileDevice(), o = !i;
32
+ const e = this.parser.getResult(), n = this.normalizePlatformName(e.os.name), r = this.normalizeBrowserName(e.browser.name), o = this.isMobileDevice(), i = !o;
33
33
  return {
34
34
  name: n,
35
35
  version: e.os.version,
36
- browser: t,
36
+ browser: r,
37
37
  browserVersion: e.browser.version,
38
- isMobile: i,
39
- isDesktop: o
38
+ isMobile: o,
39
+ isDesktop: i
40
40
  };
41
41
  }
42
42
  /**
@@ -105,15 +105,15 @@ class x {
105
105
  checkAppEnvironment(e) {
106
106
  const n = this.parseAippyInfo();
107
107
  if (n) {
108
- const t = e[n.platform], i = v(n.version, t) >= 0;
108
+ const r = e[n.platform], o = f(n.version, r) >= 0;
109
109
  return {
110
110
  type: "new_app",
111
- isValid: i,
111
+ isValid: o,
112
112
  aippyInfo: n,
113
- message: i ? void 0 : `App version ${n.version} < ${t}`
113
+ message: o ? void 0 : `App version ${n.version} < ${r}`
114
114
  };
115
115
  }
116
- return w() ? {
116
+ return b() ? {
117
117
  type: "old_ios_app",
118
118
  isValid: !1,
119
119
  message: "Native bridge exists but no Aippy info (old iOS version)"
@@ -121,18 +121,18 @@ class x {
121
121
  type: "old_android_app",
122
122
  isValid: !1,
123
123
  message: "Android WebView detected but no Aippy info (old Android version)"
124
- } : b() ? { type: "iframe", isValid: !0 } : { type: "web", isValid: !0 };
124
+ } : y() ? { type: "iframe", isValid: !0 } : { type: "web", isValid: !0 };
125
125
  }
126
126
  /**
127
127
  * Parse Aippy App info from User-Agent
128
128
  */
129
129
  parseAippyInfo() {
130
- const e = navigator.userAgent, n = /Aippy\/([^/]+)\/[^/]+\/(iOS|Android)/i, t = e.match(n);
131
- if (t) {
132
- const i = t[1];
130
+ const e = navigator.userAgent, n = /Aippy\/([^/]+)\/[^/]+\/(iOS|Android)/i, r = e.match(n);
131
+ if (r) {
132
+ const o = r[1];
133
133
  return {
134
- platform: t[2],
135
- version: i
134
+ platform: r[2],
135
+ version: o
136
136
  };
137
137
  }
138
138
  return null;
@@ -156,60 +156,67 @@ class x {
156
156
  }
157
157
  }
158
158
  }
159
- const y = new x(), d = "https://cdn.aippy.ai/asset/fd292077086044ee9565bd36ac3a8b78.svg";
160
- async function A(r, e = "update") {
159
+ const m = new A(), C = { iOS: "1.6.7", Android: "1.1.8" }, k = { iOS: "1.6.7", Android: "1.1.8" }, d = {
160
+ userCredentials: C,
161
+ userInfo: k
162
+ }, l = "https://cdn.aippy.ai/asset/fd292077086044ee9565bd36ac3a8b78.svg";
163
+ function P() {
164
+ const t = m.parseAippyInfo();
165
+ if (!t) return !1;
166
+ const e = d.userCredentials[t.platform];
167
+ return f(t.version, e) >= 0;
168
+ }
169
+ async function V(t, e = "update") {
161
170
  const n = document.createElement("div");
162
171
  n.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:12px;display:flex;align-items:flex-end;justify-content:center;z-index:999999;pointer-events:none";
163
- const t = document.createElement("div");
164
- t.style.cssText = "background:#323232;border-radius:32px;padding:12px 12px 12px 12px;width:370px;max-width:90%;display:flex;align-items:center;gap:8px;pointer-events:auto";
165
- let i = !1;
172
+ const r = document.createElement("div");
173
+ r.style.cssText = "background:#323232;border-radius:32px;padding:12px 12px 12px 12px;width:370px;max-width:90%;display:flex;align-items:center;gap:8px;pointer-events:auto";
174
+ let o = !1;
166
175
  try {
167
- i = (await fetch(d, { method: "HEAD" })).ok;
176
+ o = (await fetch(l, { method: "HEAD" })).ok;
168
177
  } catch {
169
- i = !1;
178
+ o = !1;
170
179
  }
171
- if (i) {
180
+ if (o) {
172
181
  const a = document.createElement("img");
173
- a.src = d, a.style.cssText = "width:36px;height:36px;flex-shrink:0", t.appendChild(a);
174
- }
175
- const o = document.createElement("span");
176
- o.style.cssText = "font-size:14px;font-weight:600;color:#fff;line-height:1.4;white-space:pre-line", o.textContent = r;
177
- const p = e === "signin" ? "Sign in" : "Update", s = document.createElement("button");
178
- s.style.cssText = "background:#fff;color:#000;font-size:14px;font-weight:600;border:none;border-radius:32px;height:36px;min-width:80px;padding:0 16px;cursor:pointer;flex-shrink:0;white-space:nowrap", s.textContent = p, s.onclick = () => {
179
- if (e === "signin")
180
- try {
181
- window.parent.postMessage({ type: "navigator.appstore" }, "*");
182
- } catch {
183
- }
184
- else
185
- window.webkit?.messageHandlers?.aippyListener?.postMessage({ command: "navigator.appstore" });
186
- }, t.appendChild(o), t.appendChild(s), n.appendChild(t), document.body.appendChild(n);
182
+ a.src = l, a.style.cssText = "width:36px;height:36px;flex-shrink:0", r.appendChild(a);
183
+ }
184
+ const i = e === "signin" || e === "update" && P(), p = i ? t.replace(/\n/g, "") : t, s = document.createElement("span");
185
+ if (s.style.cssText = "font-size:14px;font-weight:600;color:#fff;line-height:1.4;white-space:pre-line", s.textContent = p, r.appendChild(s), i) {
186
+ const a = e === "signin" ? "Sign in" : "Update", c = document.createElement("button");
187
+ c.style.cssText = "background:#fff;color:#000;font-size:14px;font-weight:600;border:none;border-radius:32px;height:36px;min-width:80px;padding:0 16px;cursor:pointer;flex-shrink:0;white-space:nowrap", c.textContent = a, c.onclick = () => {
188
+ if (e === "signin")
189
+ try {
190
+ window.parent.postMessage({ type: "navigator.appstore" }, "*");
191
+ } catch {
192
+ }
193
+ else
194
+ window.webkit?.messageHandlers?.aippyListener?.postMessage({ command: "navigator.appstore" });
195
+ }, r.appendChild(c);
196
+ }
197
+ n.appendChild(r), document.body.appendChild(n);
187
198
  }
188
- const C = { iOS: "1.6.7", Android: "1.1.8" }, k = { iOS: "1.6.7", Android: "1.1.8" }, u = {
189
- userCredentials: C,
190
- userInfo: k
191
- };
192
- function P(r) {
193
- const e = u[r];
194
- return e || (console.warn(`[AppVersionChecker] Unknown feature: ${r}`), { iOS: "999.0.0", Android: "999.0.0" });
199
+ function _(t) {
200
+ const e = d[t];
201
+ return e || (console.warn(`[AppVersionChecker] Unknown feature: ${t}`), { iOS: "999.0.0", Android: "999.0.0" });
195
202
  }
196
- function _(r) {
197
- const e = P(r), n = y.checkAppEnvironment(e), t = n.aippyInfo?.version, i = n.aippyInfo ? e[n.aippyInfo.platform] : void 0;
203
+ function R(t) {
204
+ const e = _(t), n = m.checkAppEnvironment(e), r = n.aippyInfo?.version, o = n.aippyInfo ? e[n.aippyInfo.platform] : void 0;
198
205
  switch (n.type) {
199
206
  case "new_app":
200
207
  return {
201
208
  supported: n.isValid,
202
209
  envCheck: n,
203
- currentVersion: t,
204
- requiredVersion: i,
205
- message: n.isValid ? void 0 : `App version ${t} does not support ${r}. Minimum required: ${i}`
210
+ currentVersion: r,
211
+ requiredVersion: o,
212
+ message: n.isValid ? void 0 : `App version ${r} does not support ${t}. Minimum required: ${o}`
206
213
  };
207
214
  case "old_ios_app":
208
215
  case "old_android_app":
209
216
  return {
210
217
  supported: !1,
211
218
  envCheck: n,
212
- message: `Old app version detected. Please upgrade to use ${r}.`
219
+ message: `Old app version detected. Please upgrade to use ${t}.`
213
220
  };
214
221
  default:
215
222
  return {
@@ -218,23 +225,24 @@ function _(r) {
218
225
  };
219
226
  }
220
227
  }
221
- function E(r) {
222
- const e = _(r);
228
+ function L(t) {
229
+ const e = R(t);
223
230
  if (!e.supported && (e.envCheck.type === "new_app" || e.envCheck.type === "old_ios_app" || e.envCheck.type === "old_android_app"))
224
- throw console.warn(`[AppVersionChecker] ${e.message}`), A("This project needs a newer version.Update to view it.", "update"), h(`App version too old: ${e.message}`, g.NOT_SUPPORTED);
231
+ throw console.warn(`[AppVersionChecker] ${e.message}`), V(`This project needs a newer version.
232
+ Update to view it.`, "update"), v(`App version too old: ${e.message}`, x.NOT_SUPPORTED);
225
233
  return e;
226
234
  }
227
- function I() {
228
- return Object.keys(u);
235
+ function M() {
236
+ return Object.keys(d);
229
237
  }
230
238
  export {
231
- x as P,
232
- _ as a,
233
- I as b,
234
- v as c,
235
- P as g,
236
- b as i,
237
- y as p,
238
- E as r,
239
- A as s
239
+ A as P,
240
+ R as a,
241
+ M as b,
242
+ f as c,
243
+ _ as g,
244
+ y as i,
245
+ m as p,
246
+ L as r,
247
+ V as s
240
248
  };
@@ -1,5 +1,5 @@
1
1
  import { a as U } from "./runtime-CmoG3v2m.js";
2
- import { r as v, s as L, i as p } from "./app-version-checker-B1UXEcy9.js";
2
+ import { r as v, s as L, i as p } from "./app-version-checker-Bz7FrEZz.js";
3
3
  import { c as B, a as I } from "./errors-B3bDbQbD.js";
4
4
  const f = {
5
5
  apiBaseUrl: "https://api.aippy.dev/api",
@@ -1,6 +1,6 @@
1
1
  import "react";
2
- import { getAuthTokenAsync as a } from "./bridge-BQQ3PfSO.js";
3
- const r = "0.2.7-dev.7", i = {
2
+ import { getAuthTokenAsync as a } from "./bridge-CqV1iP30.js";
3
+ const r = "0.3.0", i = {
4
4
  version: r
5
5
  }, o = i.version, c = "@aippy/runtime";
6
6
  function w() {
@@ -1,6 +1,6 @@
1
1
  import { D as s, g as r, m as o } from "../config-B0A7gHQM.js";
2
2
  import { A as p, a as t, E as i, b as R, c as E } from "../errors-B3bDbQbD.js";
3
- import { S as m, V as A, c as C, a as g, g as f, s as y } from "../container-message-YB3cWpWj.js";
3
+ import { S as m, V as A, c as C, a as g, g as f, s as y } from "../container-message-C9G89m7k.js";
4
4
  import { A as O, C as d, R as l, a as x, p as F } from "../runtime-CmoG3v2m.js";
5
5
  export {
6
6
  O as AippyRuntime,
@@ -1,5 +1,5 @@
1
1
  import { createOpenAICompatible as d } from "@ai-sdk/openai-compatible";
2
- import { s as f, a as b } from "./container-message-YB3cWpWj.js";
2
+ import { s as f, a as b } from "./container-message-C9G89m7k.js";
3
3
  import { AISDKError as c, DefaultChatTransport as h } from "ai";
4
4
  import { E as m, b as p, a as u } from "./errors-B3bDbQbD.js";
5
5
  import { j as A } from "./url-c26cuIpu.js";
@@ -15,7 +15,7 @@ async function v() {
15
15
  console.log("🔍 [useUserInfo] fetchUserInfoFromBridge started");
16
16
  const n = A();
17
17
  try {
18
- const { getUserInfoAsync: o, getUserInfoFromParent: c, isInIframe: t } = await import("./bridge-BQQ3PfSO.js"), { hasNativeBridge: f } = await import("./native-bridge-BnvipFJc.js"), i = f(), l = t();
18
+ const { getUserInfoAsync: o, getUserInfoFromParent: c, isInIframe: t } = await import("./bridge-CqV1iP30.js"), { hasNativeBridge: f } = await import("./native-bridge-BnvipFJc.js"), i = f(), l = t();
19
19
  console.log("🔍 [useUserInfo] Environment check:", {
20
20
  hasNativeBridge: i,
21
21
  isInIframe: l,
@@ -1,17 +1,17 @@
1
1
  import { D as r, g as o, m as s } from "../config-B0A7gHQM.js";
2
2
  import { A as i, a as n, E as p, b as m, c as A } from "../errors-B3bDbQbD.js";
3
- import { S as f, V as u, c as C, a as E, g, s as I } from "../container-message-YB3cWpWj.js";
3
+ import { S as f, V as u, c as C, a as E, g, s as I } from "../container-message-C9G89m7k.js";
4
4
  import { A as l, C as S, R as x, a as R, p as T } from "../runtime-CmoG3v2m.js";
5
5
  import { CameraAPI as D, FileSystemAPI as U, GeolocationAPI as y, SensorsAPI as F, camera as P, fileSystem as M, geolocation as h, isMotionSupported as v, isOrientationSupported as O, requestMotionPermission as b, sensors as L, vibrate as w, watchMotion as H, watchOrientation as N } from "../device/index.js";
6
- import { P as k, a as q, c as B, b as j, g as G, i as z, p as K, r as W, s as X } from "../app-version-checker-B1UXEcy9.js";
6
+ import { P as k, a as q, c as B, b as j, g as G, i as z, p as K, r as W, s as X } from "../app-version-checker-Bz7FrEZz.js";
7
7
  import { a as J, P as Q, p as Z, b as $ } from "../pwa-C5nXU0DN.js";
8
8
  import { j as ae } from "../url-c26cuIpu.js";
9
9
  import { a as oe, b as se } from "../useTweaks-B7Muzo78.js";
10
10
  import { c as ie, a as ne, i as pe, p as me, u as Ae } from "../useAudioContext-D9F3x80Y.js";
11
11
  import { reportScore as fe, sendEvent as ue, updateScore as Ce } from "../leaderboard/index.js";
12
- import { D as ge, d as Ie, e as de, c as le, U as Se, a as xe, b as Re, f as Te, g as _e, l as De, n as Ue, p as ye, s as Fe, v as Pe } from "../helper-BjRhidue.js";
13
- import { c as he, u as ve } from "../hooks-C7VP176R.js";
14
- import { getAuthTokenAsync as be } from "../bridge-BQQ3PfSO.js";
12
+ import { D as ge, d as Ie, e as de, c as le, U as Se, a as xe, b as Re, f as Te, g as _e, l as De, n as Ue, p as ye, s as Fe, v as Pe } from "../helper-I-UkGE0O.js";
13
+ import { c as he, u as ve } from "../hooks-Dmr_Dcnz.js";
14
+ import { getAuthTokenAsync as be } from "../bridge-CqV1iP30.js";
15
15
  import { hasNativeBridge as we } from "../native-bridge-BnvipFJc.js";
16
16
  export {
17
17
  l as AippyRuntime,
@@ -1,6 +1,6 @@
1
- import { c as o, u as s } from "../hooks-C7VP176R.js";
2
- import { getAuthTokenAsync as f } from "../bridge-BQQ3PfSO.js";
3
- import { i as t } from "../app-version-checker-B1UXEcy9.js";
1
+ import { c as o, u as s } from "../hooks-Dmr_Dcnz.js";
2
+ import { getAuthTokenAsync as f } from "../bridge-CqV1iP30.js";
3
+ import { i as t } from "../app-version-checker-Bz7FrEZz.js";
4
4
  export {
5
5
  o as clearUserInfoCache,
6
6
  f as getAuthTokenAsync,
@@ -1,4 +1,4 @@
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-B1UXEcy9.js";
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-Bz7FrEZz.js";
2
2
  import { a as c, P as l, p as P, b as F } from "../pwa-C5nXU0DN.js";
3
3
  import { j as g } from "../url-c26cuIpu.js";
4
4
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aippy/runtime",
3
- "version": "0.2.7-dev.7",
3
+ "version": "0.3.0",
4
4
  "description": "Aippy Runtime SDK - Runtime SDK for Aippy projects",
5
5
  "private": false,
6
6
  "type": "module",