@aippy/runtime 0.2.5-dev.0 โ†’ 0.2.5-dev.1

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.
@@ -0,0 +1,148 @@
1
+ import { createOpenAICompatible as A } from "@ai-sdk/openai-compatible";
2
+ import "react";
3
+ import { h as i } from "./bridge-DdAH4txB.js";
4
+ import { DefaultChatTransport as f, AISDKError as n } from "ai";
5
+ const m = "https://api.aippy.dev", l = `${m}/api/aisdk/v1`, d = `${m}/api/aisdk/v1/ui`, g = "gpt-5", _ = "";
6
+ function h(e = {}) {
7
+ return {
8
+ baseUrl: e.baseUrl ?? l
9
+ };
10
+ }
11
+ function u(e = {}) {
12
+ return {
13
+ baseUrl: e.baseUrl ?? d
14
+ };
15
+ }
16
+ const y = [
17
+ "gpt-image-1",
18
+ "gpt-image-1-mini",
19
+ "gpt-image-1.5"
20
+ ];
21
+ function U(e) {
22
+ try {
23
+ const r = JSON.parse(e);
24
+ if (r.model && y.some((t) => r.model.startsWith(t))) {
25
+ const { response_format: t, ...s } = r;
26
+ return JSON.stringify(s);
27
+ }
28
+ } catch {
29
+ }
30
+ return e;
31
+ }
32
+ function w(e = {}) {
33
+ const { baseUrl: r } = h(e);
34
+ return A({
35
+ name: "aippy",
36
+ baseURL: r,
37
+ fetch: async (s, a) => {
38
+ const o = await i(), c = new Headers(a?.headers);
39
+ c.set("Authorization", `Bearer ${o}`);
40
+ let p = a;
41
+ return s.toString().includes("/images/generations") && a?.method?.toUpperCase() === "POST" && a?.body && (p = {
42
+ ...a,
43
+ body: U(a.body)
44
+ }), globalThis.fetch(s, {
45
+ ...p,
46
+ headers: c
47
+ });
48
+ }
49
+ });
50
+ }
51
+ const I = "/chat", T = "/completion", E = "/object";
52
+ async function C(e = {}) {
53
+ const { baseUrl: r } = u(e), t = await i(), s = e.model ?? g, a = e.system ?? _, o = e.api ?? `${r}${I}`, c = { Authorization: `Bearer ${t}` }, p = { model: s, system: a };
54
+ return {
55
+ transport: new f({
56
+ api: o,
57
+ headers: c,
58
+ body: p
59
+ })
60
+ };
61
+ }
62
+ async function N(e = {}) {
63
+ const { baseUrl: r } = u(e), t = await i();
64
+ return {
65
+ api: `${r}${T}`,
66
+ headers: { Authorization: `Bearer ${t}` }
67
+ };
68
+ }
69
+ async function k(e) {
70
+ const { schemaId: r, ...t } = e, { baseUrl: s } = u(t), a = await i();
71
+ return {
72
+ api: `${s}${E}`,
73
+ headers: { Authorization: `Bearer ${a}` },
74
+ schemaId: r
75
+ };
76
+ }
77
+ async function B(e = {}) {
78
+ const { baseUrl: r } = u(e), t = await i();
79
+ return {
80
+ api: `${r}${E}`,
81
+ headers: { Authorization: `Bearer ${t}` }
82
+ };
83
+ }
84
+ function D(e, r) {
85
+ const t = e.status;
86
+ if (r && typeof r == "object" && "error" in r) {
87
+ const s = r, a = s.error.code, o = a != null ? `AippyAIError_${a}` : `AippyAIError_${t}`;
88
+ return new n({
89
+ name: o,
90
+ message: s.error.message,
91
+ cause: {
92
+ type: s.error.type ?? void 0,
93
+ param: s.error.param ?? void 0,
94
+ status: t
95
+ }
96
+ });
97
+ }
98
+ return new n({
99
+ name: `AippyAIError_${t}`,
100
+ message: `Request failed with status ${t}`,
101
+ cause: { status: t }
102
+ });
103
+ }
104
+ function L() {
105
+ return new n({
106
+ name: "AippyAIError_MISSING_TOKEN",
107
+ message: "User token is required. Ensure user credentials are available via initUserBridge()."
108
+ });
109
+ }
110
+ function v() {
111
+ return new n({
112
+ name: "AippyAIError_REQUEST_ABORTED",
113
+ message: "Request was aborted"
114
+ });
115
+ }
116
+ function F(e) {
117
+ const r = e instanceof Error ? e.message : "Network request failed";
118
+ return new n({
119
+ name: "AippyAIError_NETWORK_ERROR",
120
+ message: r,
121
+ cause: e instanceof Error ? e : String(e)
122
+ });
123
+ }
124
+ function P(e) {
125
+ return new n({
126
+ name: "AippyAIError_PARSE_ERROR",
127
+ message: `Failed to parse response: ${e}`
128
+ });
129
+ }
130
+ export {
131
+ l as D,
132
+ I as U,
133
+ w as a,
134
+ C as b,
135
+ N as c,
136
+ k as d,
137
+ B as e,
138
+ T as f,
139
+ E as g,
140
+ d as h,
141
+ g as i,
142
+ _ as j,
143
+ v as k,
144
+ F as l,
145
+ L as m,
146
+ D as n,
147
+ P as p
148
+ };
@@ -1,55 +1,101 @@
1
- import { DEFAULT_CONFIG as o, SDK_NAME as t, VERSION as r, getConfigFromEnv as i, getVersionInfo as s, mergeConfig as n } from "../core/index.js";
2
- import { a as m, A as c, C as d, E as f, R as u, b as l, c as A, p as S } from "../runtime-DjBdOttl.js";
3
- import { CameraAPI as C, FileSystemAPI as R, GeolocationAPI as x, SensorsAPI as M, camera as P, fileSystem as I, geolocation as g, hasNativeBridge as y, isMotionSupported as O, isOrientationSupported as b, requestMotionPermission as v, sensors as D, vibrate as h, watchMotion as w, watchOrientation as F } from "../device/index.js";
4
- import { c as T, a as V, P as _, b as k, p as G, d as H } from "../pwa-8DGmPqLV.js";
5
- import { a as q, b as B } from "../useTweaks-QxMRmg7i.js";
6
- import { c as L, a as W, b as j, i as z, p as J, u as Q } from "../useAudioContext-CNQQSTab.js";
7
- import { reportScore as Y, sendEvent as Z, updateScore as $ } from "../leaderboard/index.js";
1
+ import { DEFAULT_CONFIG as r, SDK_NAME as s, VERSION as o, getConfigFromEnv as t, getVersionInfo as i, mergeConfig as n } from "../core/index.js";
2
+ import { A as m, E as d, c as u } from "../errors-CDEBaBxB.js";
3
+ import { A as C, C as c, R as E, a as l, p as A } from "../runtime-CmoG3v2m.js";
4
+ import { CameraAPI as I, FileSystemAPI as U, GeolocationAPI as S, SensorsAPI as T, camera as P, fileSystem as y, geolocation as h, isMotionSupported as _, isOrientationSupported as O, requestMotionPermission as D, sensors as x, vibrate as R, watchMotion as k, watchOrientation as M } from "../device/index.js";
5
+ import { c as F, a as N, P as L, b as B, p as v, d as w } from "../pwa-8DGmPqLV.js";
6
+ import { a as H, b as j } from "../useTweaks-QxMRmg7i.js";
7
+ import { c as Q, a as V, b as J, i as z, p as K, u as W } from "../useAudioContext-CNQQSTab.js";
8
+ import { reportScore as X, sendEvent as Z, updateScore as $ } from "../leaderboard/index.js";
9
+ import { D as ae, i as re, j as se, h as oe, U as te, f as ie, g as ne, k as pe, a as me, b as de, c as ue, e as fe, d as Ce, m as ce, l as Ee, n as le, p as Ae } from "../errors-D29z-Qus.js";
10
+ import { f as Ie, b as Ue, h as Se, l as Te, j as Pe, g as ye, k as he, e as _e, i as Oe, c as De, d as xe, r as Re, s as ke, a as Me, t as be } from "../bridge-DdAH4txB.js";
11
+ import { e as Ne, f as Le, g as Be, a as ve, u as we, b as Ge, d as He, c as je, h as qe } from "../userSessionInfo-CBk9ywXi.js";
12
+ import { h as Ve } from "../native-bridge-JAmH-zTN.js";
8
13
  export {
9
- m as AippyRuntime,
10
- c as AippyRuntimeError,
11
- C as CameraAPI,
12
- d as Cancellable,
13
- o as DEFAULT_CONFIG,
14
- f as ERROR_CODES,
15
- R as FileSystemAPI,
16
- x as GeolocationAPI,
17
- T as PWAUtils,
18
- V as PerformanceMonitor,
19
- _ as PlatformDetector,
20
- u as ReceiveChannel,
21
- t as SDK_NAME,
22
- M as SensorsAPI,
23
- r as VERSION,
14
+ C as AippyRuntime,
15
+ m as AippyRuntimeError,
16
+ I as CameraAPI,
17
+ c as Cancellable,
18
+ ae as DEFAULT_BASE_URL,
19
+ re as DEFAULT_CHAT_MODEL,
20
+ se as DEFAULT_CHAT_SYSTEM,
21
+ r as DEFAULT_CONFIG,
22
+ oe as DEFAULT_UI_BASE_URL,
23
+ d as ERROR_CODES,
24
+ U as FileSystemAPI,
25
+ S as GeolocationAPI,
26
+ F as PWAUtils,
27
+ N as PerformanceMonitor,
28
+ L as PlatformDetector,
29
+ E as ReceiveChannel,
30
+ s as SDK_NAME,
31
+ T as SensorsAPI,
32
+ te as UI_CHAT_ENDPOINT,
33
+ ie as UI_COMPLETION_ENDPOINT,
34
+ ne as UI_OBJECT_ENDPOINT,
35
+ o as VERSION,
36
+ pe as abortedError,
37
+ me as aippy,
38
+ de as aippyChatConfig,
39
+ ue as aippyCompletionConfig,
40
+ fe as aippyObjectBaseConfig,
41
+ Ce as aippyObjectConfig,
24
42
  l as aippyRuntime,
25
- q as aippyTweaks,
26
- B as aippyTweaksRuntime,
43
+ H as aippyTweaks,
44
+ j as aippyTweaksRuntime,
45
+ Ie as autoRequestCredentials,
27
46
  P as camera,
28
- A as createError,
29
- L as createHiddenMediaElement,
30
- W as createHiddenVideoElement,
31
- I as fileSystem,
32
- g as geolocation,
33
- i as getConfigFromEnv,
34
- s as getVersionInfo,
35
- y as hasNativeBridge,
36
- j as isIOSDevice,
47
+ Ne as clearProfileCache,
48
+ u as createError,
49
+ Q as createHiddenMediaElement,
50
+ V as createHiddenVideoElement,
51
+ Le as fetchUserProfile,
52
+ y as fileSystem,
53
+ h as geolocation,
54
+ Ue as getAuthToken,
55
+ Se as getAuthTokenAsync,
56
+ Te as getCachedCredentials,
57
+ t as getConfigFromEnv,
58
+ Be as getCurrentUserId,
59
+ Pe as getCurrentUserIdAsync,
60
+ ye as getUserSdkConfig,
61
+ i as getVersionInfo,
62
+ he as hasCredentials,
63
+ Ve as hasNativeBridge,
64
+ _e as initUserBridge,
65
+ Oe as initUserSdk,
66
+ J as isIOSDevice,
67
+ De as isInIframe,
37
68
  z as isMediaStreamAudioSupported,
38
- O as isMotionSupported,
39
- b as isOrientationSupported,
69
+ _ as isMotionSupported,
70
+ O as isOrientationSupported,
40
71
  n as mergeConfig,
41
- J as patchAudioContext,
42
- k as performanceMonitor,
43
- G as platform,
44
- S as processMotionData,
45
- H as pwa,
46
- Y as reportScore,
47
- v as requestMotionPermission,
72
+ ce as missingTokenError,
73
+ Ee as networkError,
74
+ le as normalizeError,
75
+ Ae as parseError,
76
+ K as patchAudioContext,
77
+ B as performanceMonitor,
78
+ v as platform,
79
+ A as processMotionData,
80
+ w as pwa,
81
+ X as reportScore,
82
+ xe as requestCredentialsFromParent,
83
+ Re as requestCredentialsFromiOS,
84
+ D as requestMotionPermission,
48
85
  Z as sendEvent,
49
- D as sensors,
86
+ x as sensors,
87
+ ke as setAuthToken,
88
+ Me as setCurrentUserId,
89
+ be as tryGetCredentialsFromParentStorage,
50
90
  $ as updateScore,
51
- Q as useAudioContext,
52
- h as vibrate,
53
- w as watchMotion,
54
- F as watchOrientation
91
+ W as useAudioContext,
92
+ ve as useAuthToken,
93
+ we as useCurrentUserId,
94
+ Ge as useGetCurrentUserProfileQuery,
95
+ He as useGetJoinedUserProfilesQuery,
96
+ je as useGetUserProfileByIdQuery,
97
+ qe as userSessionInfo,
98
+ R as vibrate,
99
+ k as watchMotion,
100
+ M as watchOrientation
55
101
  };
package/dist/index.d.ts CHANGED
@@ -4,3 +4,5 @@ export * from './utils';
4
4
  export * from './tweaks';
5
5
  export * from './audio';
6
6
  export * from './leaderboard';
7
+ export * from './ai';
8
+ export * from './user';
@@ -1,46 +1,42 @@
1
1
  function r(e, o) {
2
2
  try {
3
3
  if (window.parent && window.parent !== window) {
4
- const a = {
4
+ const n = {
5
5
  __aippyGame: !0,
6
6
  payload: e
7
7
  };
8
- window.parent.postMessage(a, "*");
8
+ window.parent.postMessage(n, "*");
9
9
  }
10
- const n = window.webkit?.messageHandlers?.aippyListener;
11
- n && n.postMessage({
10
+ const a = window.webkit?.messageHandlers?.aippyListener;
11
+ a && a.postMessage({
12
12
  command: o,
13
13
  parameters: JSON.stringify(e)
14
14
  });
15
- } catch (n) {
16
- console.warn("[Aippy Leaderboard] Failed to send game event:", n);
15
+ } catch (a) {
16
+ console.warn("[Aippy Leaderboard] Failed to send game event:", a);
17
17
  }
18
18
  }
19
19
  function t(e) {
20
- const o = {
20
+ r({
21
21
  type: "score",
22
- score: e,
23
- url: window.location.href
24
- };
25
- r(o, "leaderboard.reportScore"), console.log(`[Aippy Leaderboard] Score reported: ${e}, URL: ${window.location.href}`);
22
+ score: e
23
+ }, "leaderboard.reportScore"), console.log(`[Aippy Leaderboard] Score reported: ${e}`);
26
24
  }
27
- function d(e) {
28
- const o = {
25
+ function p(e) {
26
+ r({
29
27
  type: "score",
30
- score: e,
31
- url: window.location.href
32
- };
33
- r(o, "leaderboard.updateScore"), console.log(`[Aippy Leaderboard] Score updated: ${e}, URL: ${window.location.href}`);
28
+ score: e
29
+ }, "leaderboard.updateScore"), console.log(`[Aippy Leaderboard] Score updated: ${e}`);
34
30
  }
35
- function i(e, o) {
36
- const n = {
31
+ function d(e, o) {
32
+ const a = {
37
33
  type: e,
38
34
  ...o
39
35
  };
40
- r(n, "leaderboard.event"), console.log(`[Aippy Leaderboard] Event sent: ${e}`, o);
36
+ r(a, "leaderboard.event"), console.log(`[Aippy Leaderboard] Event sent: ${e}`, o);
41
37
  }
42
38
  export {
43
39
  t as reportScore,
44
- i as sendEvent,
45
- d as updateScore
40
+ d as sendEvent,
41
+ p as updateScore
46
42
  };
@@ -9,8 +9,6 @@ export interface ScorePayload {
9
9
  type: 'score';
10
10
  /** The score value */
11
11
  score: number;
12
- /** The URL of the current H5 application */
13
- url?: string;
14
12
  /** Score unit (e.g., 'points', 'coins') */
15
13
  unit?: string;
16
14
  /** Whether bigger score is better for leaderboard ranking */
@@ -0,0 +1,6 @@
1
+ function a() {
2
+ return typeof window < "u" && !!window.webkit && !!window.webkit?.messageHandlers && !!window.webkit?.messageHandlers?.aippyListener;
3
+ }
4
+ export {
5
+ a as h
6
+ };
@@ -1,24 +1,6 @@
1
1
  var u = Object.defineProperty;
2
- var m = (o, e, n) => e in o ? u(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
3
- var r = (o, e, n) => m(o, typeof e != "symbol" ? e + "" : e, n);
4
- class d extends Error {
5
- constructor(n, i = "AIPPY_ERROR", t) {
6
- super(n);
7
- r(this, "code");
8
- r(this, "context");
9
- this.name = "AippyRuntimeError", this.code = i, this.context = t;
10
- }
11
- }
12
- const R = {
13
- NOT_SUPPORTED: "NOT_SUPPORTED",
14
- PERMISSION_DENIED: "PERMISSION_DENIED",
15
- INVALID_CONFIG: "INVALID_CONFIG",
16
- NETWORK_ERROR: "NETWORK_ERROR",
17
- UNKNOWN_ERROR: "UNKNOWN_ERROR"
18
- };
19
- function g(o, e = "UNKNOWN_ERROR", n) {
20
- return new d(o, R[e], n);
21
- }
2
+ var m = (o, e, t) => e in o ? u(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var r = (o, e, t) => m(o, typeof e != "symbol" ? e + "" : e, t);
22
4
  class a {
23
5
  constructor(e) {
24
6
  r(this, "cancelled", !1);
@@ -31,28 +13,28 @@ class a {
31
13
  return this.cancelled;
32
14
  }
33
15
  }
34
- class f {
16
+ class d {
35
17
  constructor() {
36
18
  r(this, "listeners", /* @__PURE__ */ new Map());
37
19
  }
38
- addEventListener(e, n) {
39
- this.listeners.has(e) || this.listeners.set(e, []), this.listeners.get(e).push(n);
20
+ addEventListener(e, t) {
21
+ this.listeners.has(e) || this.listeners.set(e, []), this.listeners.get(e).push(t);
40
22
  }
41
- removeEventListener(e, n) {
23
+ removeEventListener(e, t) {
42
24
  const i = this.listeners.get(e);
43
25
  if (i) {
44
- const t = i.indexOf(n);
45
- t > -1 && i.splice(t, 1);
26
+ const n = i.indexOf(t);
27
+ n > -1 && i.splice(n, 1);
46
28
  }
47
29
  }
48
- emit(e, n) {
30
+ emit(e, t) {
49
31
  const i = this.listeners.get(e);
50
- i && i.forEach((t) => t(n));
32
+ i && i.forEach((n) => n(t));
51
33
  }
52
34
  }
53
- class y {
35
+ class f {
54
36
  constructor() {
55
- r(this, "emitter", new f());
37
+ r(this, "emitter", new d());
56
38
  }
57
39
  /**
58
40
  * Emit a message to subscribers
@@ -63,9 +45,9 @@ class y {
63
45
  /**
64
46
  * Subscribe to messages on a specific endpoint
65
47
  */
66
- subscribe(e, n) {
67
- const i = (t) => {
68
- n(t);
48
+ subscribe(e, t) {
49
+ const i = (n) => {
50
+ t(n);
69
51
  };
70
52
  return this.emitter.addEventListener(e, i), new a(() => {
71
53
  this.emitter.removeEventListener(e, i);
@@ -74,16 +56,16 @@ class y {
74
56
  /**
75
57
  * Subscribe to a single message (auto-unsubscribe after first message)
76
58
  */
77
- once(e, n) {
78
- const i = this.subscribe(e, (t) => {
79
- i.cancel(), n(t);
59
+ once(e, t) {
60
+ const i = this.subscribe(e, (n) => {
61
+ i.cancel(), t(n);
80
62
  });
81
63
  return i;
82
64
  }
83
65
  }
84
- class h {
66
+ class y {
85
67
  constructor() {
86
- r(this, "receiveChannel", new y());
68
+ r(this, "receiveChannel", new f());
87
69
  r(this, "seq", 0);
88
70
  r(this, "motionListeners", []);
89
71
  r(this, "noListenersWarned", !1);
@@ -116,9 +98,9 @@ class h {
116
98
  isTweaksMessage(e) {
117
99
  if (typeof e != "object" || e === null || "endpoint" in e || "payload" in e)
118
100
  return !1;
119
- const n = Object.keys(e);
120
- return n.length === 0 ? !1 : n.some((t) => {
121
- const c = e[t];
101
+ const t = Object.keys(e);
102
+ return t.length === 0 ? !1 : t.some((n) => {
103
+ const c = e[n];
122
104
  return typeof c == "object" && c !== null && "value" in c;
123
105
  });
124
106
  }
@@ -129,18 +111,18 @@ class h {
129
111
  * @param callback - Callback to handle received data
130
112
  * @returns Cancellable subscription
131
113
  */
132
- createSubscription(e, n, i) {
133
- const t = (this.seq++).toString(), c = {
134
- command: n.command,
114
+ createSubscription(e, t, i) {
115
+ const n = (this.seq++).toString(), c = {
116
+ command: t.command,
135
117
  parameters: {
136
- type: n.type,
118
+ type: t.type,
137
119
  action: "subscribe",
138
- endpoint: t
120
+ endpoint: n
139
121
  }
140
122
  };
141
123
  console.log("๐Ÿ“จ [Aippy Runtime] Creating subscription with message:", JSON.stringify(c, null, 2));
142
- const l = this.receiveChannel.subscribe(t, (s) => {
143
- if (console.log(`๐Ÿ“ฌ [Aippy Runtime] Received data on endpoint ${t}:`, s), s.error !== void 0) {
124
+ const p = this.receiveChannel.subscribe(n, (s) => {
125
+ if (console.log(`๐Ÿ“ฌ [Aippy Runtime] Received data on endpoint ${n}:`, s), s.error !== void 0) {
144
126
  console.warn("โš ๏ธ [Aippy Runtime] Received error, skipping:", s.error);
145
127
  return;
146
128
  }
@@ -152,14 +134,14 @@ class h {
152
134
  console.error("โŒ [Aippy Runtime] Failed to send postMessage:", s);
153
135
  }
154
136
  return new a(() => {
155
- console.log(`๐Ÿ”Œ [Aippy Runtime] Unsubscribing from endpoint ${t}`), l.cancel();
137
+ console.log(`๐Ÿ”Œ [Aippy Runtime] Unsubscribing from endpoint ${n}`), p.cancel();
156
138
  try {
157
139
  const s = {
158
- command: n.command,
140
+ command: t.command,
159
141
  parameters: {
160
- type: n.type,
142
+ type: t.type,
161
143
  action: "unsubscribe",
162
- endpoint: t
144
+ endpoint: n
163
145
  }
164
146
  };
165
147
  e.postMessage(s), console.log("โœ… [Aippy Runtime] Unsubscribe message sent:", s);
@@ -175,27 +157,27 @@ class h {
175
157
  */
176
158
  addMotionListener(e) {
177
159
  console.log("๐ŸŽฌ [Aippy Runtime] addMotionListener called"), this.motionListeners.push(e), console.log(`๐Ÿ“ [Aippy Runtime] Total motion listeners: ${this.motionListeners.length}`);
178
- const n = window.webkit?.messageHandlers?.aippyListener;
179
- if (!n)
160
+ const t = window.webkit?.messageHandlers?.aippyListener;
161
+ if (!t)
180
162
  return console.warn("โš ๏ธ [Aippy Runtime] No webkit message handler found, using fallback mode"), () => {
181
- const t = this.motionListeners.indexOf(e);
182
- t > -1 && this.motionListeners.splice(t, 1);
163
+ const n = this.motionListeners.indexOf(e);
164
+ n > -1 && this.motionListeners.splice(n, 1);
183
165
  };
184
166
  console.log("โœ… [Aippy Runtime] Webkit handler found, creating subscription");
185
167
  const i = this.createSubscription(
186
- n,
168
+ t,
187
169
  {
188
170
  command: "navigator.motion",
189
171
  type: "motion"
190
172
  },
191
- (t) => {
192
- console.log("๐Ÿ“ฅ [Aippy Runtime] Received motion data from native:", t), t.motion && e(t.motion);
173
+ (n) => {
174
+ console.log("๐Ÿ“ฅ [Aippy Runtime] Received motion data from native:", n), n.motion && e(n.motion);
193
175
  }
194
176
  );
195
177
  return () => {
196
178
  console.log("๐Ÿงน [Aippy Runtime] Cleaning up motion listener"), i.cancel();
197
- const t = this.motionListeners.indexOf(e);
198
- t > -1 && this.motionListeners.splice(t, 1);
179
+ const n = this.motionListeners.indexOf(e);
180
+ n > -1 && this.motionListeners.splice(n, 1);
199
181
  };
200
182
  }
201
183
  /**
@@ -208,17 +190,17 @@ class h {
208
190
  this.noListenersWarned || (console.warn("โš ๏ธ [Aippy Runtime] No motion listeners to broadcast to"), this.noListenersWarned = !0);
209
191
  return;
210
192
  }
211
- const n = e.motion || e;
193
+ const t = e.motion || e;
212
194
  this.motionListeners.forEach((i) => {
213
195
  try {
214
- i(n);
215
- } catch (t) {
216
- console.error("โš ๏ธ [Aippy Runtime] Error in motion listener:", t);
196
+ i(t);
197
+ } catch (n) {
198
+ console.error("โš ๏ธ [Aippy Runtime] Error in motion listener:", n);
217
199
  }
218
200
  });
219
201
  }
220
202
  }
221
- function w(o) {
203
+ function h(o) {
222
204
  if (!o || typeof o != "object") {
223
205
  console.warn("โš ๏ธ [Aippy Runtime] Invalid motion data type:", typeof o);
224
206
  return;
@@ -227,17 +209,14 @@ function w(o) {
227
209
  console.warn("โš ๏ธ [Aippy Runtime] Motion data missing valid motion field");
228
210
  return;
229
211
  }
230
- p.broadcastMotionData(o);
212
+ l.broadcastMotionData(o);
231
213
  }
232
- const p = new h();
233
- typeof window < "u" && (window.aippyRuntime = p, window.processMotionData = w);
214
+ const l = new y();
215
+ typeof window < "u" && (window.aippyRuntime = l, window.processMotionData = h);
234
216
  export {
235
- d as A,
217
+ y as A,
236
218
  a as C,
237
- R as E,
238
- y as R,
239
- h as a,
240
- p as b,
241
- g as c,
242
- w as p
219
+ f as R,
220
+ l as a,
221
+ h as p
243
222
  };
@@ -0,0 +1,9 @@
1
+ import { UserProfile } from './types';
2
+ /**
3
+ * Fetch user profile by ID from API
4
+ */
5
+ export declare function fetchUserProfile(userId: string): Promise<UserProfile | null>;
6
+ /**
7
+ * Clear profile cache
8
+ */
9
+ export declare function clearProfileCache(userId?: string): void;