@aippy/runtime 0.4.2-dev.2 → 0.4.2-dev.4

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 (38) hide show
  1. package/README.md +15 -3
  2. package/dist/ai/errors.d.ts +1 -1
  3. package/dist/ai/index.d.ts +0 -1
  4. package/dist/ai/index.js +18 -21
  5. package/dist/bridge-D_-7nPNC.js +311 -0
  6. package/dist/container-message-DmIChz4h.js +56 -0
  7. package/dist/core/env.d.ts +2 -0
  8. package/dist/core/index.js +2 -2
  9. package/dist/core/parent-message.d.ts +5 -0
  10. package/dist/core/wallet-recharge.d.ts +16 -0
  11. package/dist/helper-BWszI06u.js +346 -0
  12. package/dist/{hooks-D5lkty5r.js → hooks-Ct9qEjM6.js} +1 -1
  13. package/dist/index/index.js +43 -42
  14. package/dist/index.d.ts +1 -0
  15. package/dist/ministore/app-authorization.d.ts +9 -0
  16. package/dist/ministore/authorization.d.ts +6 -0
  17. package/dist/ministore/consume.d.ts +3 -0
  18. package/dist/ministore/errors.d.ts +18 -0
  19. package/dist/ministore/index.d.ts +19 -0
  20. package/dist/ministore/index.js +915 -0
  21. package/dist/ministore/order.d.ts +1 -0
  22. package/dist/ministore/purchase.d.ts +5 -0
  23. package/dist/ministore/queries.d.ts +13 -0
  24. package/dist/ministore/recharge.d.ts +12 -0
  25. package/dist/ministore/transport.d.ts +14 -0
  26. package/dist/ministore/types.d.ts +166 -0
  27. package/dist/ministore/update-item.d.ts +3 -0
  28. package/dist/ministore/validation.d.ts +19 -0
  29. package/dist/ministore.d.ts +2 -0
  30. package/dist/user/bridge.d.ts +3 -8
  31. package/dist/user/config.d.ts +2 -0
  32. package/dist/user/index.js +2 -2
  33. package/dist/wallet-recharge-BqOljLWn.js +140 -0
  34. package/package.json +5 -1
  35. package/dist/ai/credits.d.ts +0 -12
  36. package/dist/bridge-CtB9L5kL.js +0 -259
  37. package/dist/container-message-ChLaG4Ke.js +0 -56
  38. package/dist/helper-CCuf-R6I.js +0 -405
@@ -0,0 +1,346 @@
1
+ import { createOpenAICompatible as C } from "@ai-sdk/openai-compatible";
2
+ import { j as O } from "./url-c26cuIpu.js";
3
+ import { AISDKError as p, DefaultChatTransport as E } from "ai";
4
+ import { E as f, b as m, a as g } from "./errors-B3bDbQbD.js";
5
+ import { r as l } from "./bridge-D_-7nPNC.js";
6
+ import { s as b, a as _ } from "./container-message-DmIChz4h.js";
7
+ import { s as v } from "./wallet-recharge-BqOljLWn.js";
8
+ const T = `${l()}/aisdk/v1/`, ne = `${l()}/aisdk/v1/ui/`, S = "gpt-5-nano", U = "";
9
+ function M(t = {}) {
10
+ return {
11
+ baseUrl: t.baseUrl ?? `${l()}/aisdk/v1/`
12
+ };
13
+ }
14
+ function N(t = {}) {
15
+ return {
16
+ baseUrl: t.baseUrl ?? `${l()}/aisdk/v1/ui/`
17
+ };
18
+ }
19
+ const D = 100003, $ = "insufficient_quota";
20
+ function F(t, e) {
21
+ const n = t.status;
22
+ if (e && typeof e == "object" && "error" in e) {
23
+ const r = e, s = r.error.code, o = s != null ? `AippyAIError_${s}` : `AippyAIError_${n}`, a = e;
24
+ return "appMessage" in a && a.appMessage !== void 0 && b(a.appMessage), R(r.error) && v(), new p({
25
+ name: o,
26
+ message: `${f.RUNTIME} ${r.error.message}`,
27
+ cause: {
28
+ type: r.error.type ?? void 0,
29
+ param: r.error.param ?? void 0,
30
+ status: n
31
+ }
32
+ });
33
+ }
34
+ if (e && typeof e == "object" && e !== null) {
35
+ const r = e;
36
+ "appMessage" in r && r.appMessage !== void 0 && b(r.appMessage);
37
+ }
38
+ return new p({
39
+ name: `AippyAIError_${n}`,
40
+ message: `${f.RUNTIME} Request failed with status ${n}`,
41
+ cause: { status: n }
42
+ });
43
+ }
44
+ function R(t) {
45
+ return t.code === D || t.type === $;
46
+ }
47
+ function y() {
48
+ return async (t, e) => {
49
+ const n = await _(e?.headers), r = await globalThis.fetch(t, { ...e, headers: n });
50
+ if (!r.ok) {
51
+ const s = await r.text().catch(() => null);
52
+ let o = null;
53
+ if (s)
54
+ try {
55
+ o = JSON.parse(s);
56
+ } catch {
57
+ o = { message: s };
58
+ }
59
+ throw F(r, o);
60
+ }
61
+ return r;
62
+ };
63
+ }
64
+ const L = [
65
+ "gpt-image-1",
66
+ "gpt-image-1-mini",
67
+ "gpt-image-1.5"
68
+ ];
69
+ function j(t) {
70
+ try {
71
+ const e = JSON.parse(t);
72
+ if (e.model && L.some((n) => e.model.startsWith(n))) {
73
+ const { response_format: n, ...r } = e;
74
+ return JSON.stringify(r);
75
+ }
76
+ } catch {
77
+ }
78
+ return t;
79
+ }
80
+ function oe(t = {}) {
81
+ const { baseUrl: e } = M(t), n = y();
82
+ return C({
83
+ name: "aippy",
84
+ baseURL: e,
85
+ fetch: async (s, o) => s.toString().includes("/images/generations") && o?.method?.toUpperCase() === "POST" && o?.body ? n(s, {
86
+ ...o,
87
+ body: j(o.body)
88
+ }) : n(s, o),
89
+ // Enable structured outputs support (json_schema response format)
90
+ // This is required for Output.object() and Output.array() to work properly
91
+ supportsStructuredOutputs: !0
92
+ });
93
+ }
94
+ const x = "/chat";
95
+ function se(t = {}) {
96
+ const { baseUrl: e } = N(t), n = t.model ?? S, r = t.system ?? U, s = t.api ?? O(e, x), o = { model: n, system: r }, a = y();
97
+ return {
98
+ transport: new E({
99
+ api: s,
100
+ body: o,
101
+ // Ensure token is fetched fresh for every request
102
+ fetch: a
103
+ })
104
+ };
105
+ }
106
+ function h(t) {
107
+ return [...t].length;
108
+ }
109
+ const B = 3e3, P = 5e3, J = 300 * 1e3, H = 360 * 1e3;
110
+ async function ae(t) {
111
+ const e = t.prompt?.trim() ?? "", n = t.imageUrl?.trim() ?? "", r = t.image;
112
+ h(e) > 1e3 && c("generateCharacter3D prompt must be at most 1000 characters"), r != null && !(r instanceof Blob) && c("generateCharacter3D image must be a file"), r instanceof Blob && r.size === 0 && c("generateCharacter3D image is empty");
113
+ const s = t;
114
+ return I(
115
+ "viggle/characters",
116
+ r instanceof Blob ? V(r, e) : k(n, e),
117
+ s.pollIntervalMs ?? B,
118
+ s.timeoutMs ?? J,
119
+ t.signal
120
+ );
121
+ }
122
+ function V(t, e) {
123
+ const n = new FormData(), r = t instanceof File && t.name ? t.name : "image.png";
124
+ return n.append("image", t, r), e && n.append("prompt", e), { body: n };
125
+ }
126
+ function k(t, e) {
127
+ !e && !t && c(
128
+ "generateCharacter3D requires an image, an https imageUrl, or a prompt"
129
+ ), t && !t.startsWith("https://") && c("generateCharacter3D imageUrl must be an https URL");
130
+ const n = {};
131
+ return t && (n.imageUrl = t), e && (n.prompt = e), {
132
+ headers: { "Content-Type": "application/json" },
133
+ body: JSON.stringify(n)
134
+ };
135
+ }
136
+ async function ie(t) {
137
+ const e = t.text?.trim() ?? "";
138
+ (h(e) < 1 || h(e) > 400) && c("generateMotion text must be 1 to 400 characters"), t.durationSeconds != null && (!Number.isInteger(t.durationSeconds) || t.durationSeconds < 3 || t.durationSeconds > 60) && c("generateMotion durationSeconds must be an integer from 3 to 60");
139
+ const n = { text: e };
140
+ t.durationSeconds != null && (n.durationSeconds = t.durationSeconds);
141
+ const r = t;
142
+ return I(
143
+ "viggle/motions",
144
+ {
145
+ headers: { "Content-Type": "application/json" },
146
+ body: JSON.stringify(n)
147
+ },
148
+ r.pollIntervalMs ?? P,
149
+ r.timeoutMs ?? H,
150
+ t.signal
151
+ );
152
+ }
153
+ async function I(t, e, n, r, s) {
154
+ const o = y(), a = Date.now();
155
+ let i = await A(o, t, {
156
+ method: "POST",
157
+ ...e,
158
+ signal: s
159
+ });
160
+ for (; i.status !== "ready"; )
161
+ i.status === "failed" && d(i.error || "Viggle generation failed"), Date.now() - a > r && d("Viggle generation timed out"), await q(n, s), i = await A(o, `${t}/${i.id}`, {
162
+ method: "GET",
163
+ signal: s
164
+ });
165
+ return i.url || d("Viggle generation finished without a file URL"), { url: i.url, thumbnailUrl: i.thumbnailUrl };
166
+ }
167
+ async function A(t, e, n) {
168
+ return await (await t(G(T, e), {
169
+ ...n,
170
+ cache: "no-store"
171
+ })).json();
172
+ }
173
+ function G(t, e) {
174
+ return `${t.replace(/\/$/, "")}/${e.replace(/^\//, "")}`;
175
+ }
176
+ function q(t, e) {
177
+ if (e?.aborted)
178
+ throw e.reason ?? new DOMException("The operation was aborted", "AbortError");
179
+ return new Promise((n, r) => {
180
+ const s = setTimeout(n, t);
181
+ e?.addEventListener(
182
+ "abort",
183
+ () => {
184
+ clearTimeout(s), r(
185
+ e.reason ?? new DOMException("The operation was aborted", "AbortError")
186
+ );
187
+ },
188
+ { once: !0 }
189
+ );
190
+ });
191
+ }
192
+ function c(t) {
193
+ throw new p({
194
+ name: "AippyAIError_viggle_input",
195
+ message: `${f.CODE} ${t}`
196
+ });
197
+ }
198
+ function d(t) {
199
+ throw new p({
200
+ name: "AippyAIError_viggle",
201
+ message: `${f.RUNTIME} ${t}`
202
+ });
203
+ }
204
+ function w(t) {
205
+ const e = [];
206
+ if (!t || typeof t != "object")
207
+ throw m("AIConfig must be an object", g.INVALID_CONFIG);
208
+ const n = t;
209
+ for (const [r, s] of Object.entries(n)) {
210
+ if (!s || typeof s != "object") {
211
+ e.push({ key: r, message: "Item must be an object" });
212
+ continue;
213
+ }
214
+ const o = s;
215
+ typeof o.index != "number" && e.push({ key: r, message: "index must be a number" }), typeof o.name != "string" && e.push({ key: r, message: "name must be a string" }), typeof o.description != "string" && e.push({ key: r, message: "description must be a string" });
216
+ const a = o.type;
217
+ if (!["number", "boolean", "text", "enum"].includes(a)) {
218
+ e.push({
219
+ key: r,
220
+ message: `type must be one of: number, boolean, text, enum (got: ${a})`
221
+ });
222
+ continue;
223
+ }
224
+ if (a === "number")
225
+ typeof o.value != "number" && e.push({ key: r, message: 'value must be a number for type "number"' }), o.min !== void 0 && typeof o.min != "number" && e.push({ key: r, message: "min must be a number" }), o.max !== void 0 && typeof o.max != "number" && e.push({ key: r, message: "max must be a number" }), o.step !== void 0 && typeof o.step != "number" && e.push({ key: r, message: "step must be a number" });
226
+ else if (a === "boolean")
227
+ typeof o.value != "boolean" && e.push({ key: r, message: 'value must be a boolean for type "boolean"' });
228
+ else if (a === "text")
229
+ typeof o.value != "string" && e.push({ key: r, message: 'value must be a string for type "text"' });
230
+ else if (a === "enum") {
231
+ if (!Array.isArray(o.options))
232
+ e.push({ key: r, message: 'options must be an array for type "enum"' });
233
+ else if (o.options.length === 0)
234
+ e.push({ key: r, message: 'options array cannot be empty for type "enum"' });
235
+ else
236
+ for (let u = 0; u < o.options.length; u++)
237
+ typeof o.options[u] != "string" && e.push({
238
+ key: r,
239
+ message: `options[${u}] must be a string`
240
+ });
241
+ typeof o.value != "string" ? e.push({ key: r, message: 'value must be a string for type "enum"' }) : Array.isArray(o.options) && !o.options.includes(o.value) && e.push({
242
+ key: r,
243
+ message: `value "${o.value}" is not in options: [${o.options.join(", ")}]`
244
+ });
245
+ }
246
+ o.group !== void 0 && typeof o.group != "string" && e.push({ key: r, message: "group must be a string" });
247
+ }
248
+ if (e.length > 0)
249
+ throw m(
250
+ `AIConfig validation failed with ${e.length} error(s)`,
251
+ g.INVALID_CONFIG,
252
+ { errors: e }
253
+ );
254
+ }
255
+ function ce(t) {
256
+ let e;
257
+ try {
258
+ e = JSON.parse(t);
259
+ } catch (n) {
260
+ throw m(
261
+ `Invalid JSON: ${n instanceof Error ? n.message : String(n)}`,
262
+ g.INVALID_CONFIG
263
+ );
264
+ }
265
+ return w(e), e;
266
+ }
267
+ function z(t) {
268
+ return w(t), t;
269
+ }
270
+ function Q(t, e) {
271
+ const n = t[e];
272
+ if (!n)
273
+ throw m(
274
+ `AIConfig key "${e}" not found`,
275
+ g.INVALID_CONFIG,
276
+ { key: e }
277
+ );
278
+ return n.value;
279
+ }
280
+ function W(t) {
281
+ if (!(typeof window > "u"))
282
+ try {
283
+ const e = window.webkit?.messageHandlers?.aippyListener;
284
+ if (e)
285
+ try {
286
+ const n = {
287
+ command: "ai.initialize",
288
+ parameters: JSON.stringify(t)
289
+ };
290
+ e.postMessage(n);
291
+ } catch (n) {
292
+ console.warn("❌ [Aippy AI Config] Failed to send config to iOS app:", n);
293
+ }
294
+ if (window.parent && window.parent !== window)
295
+ try {
296
+ const n = {
297
+ type: "ai.initialize",
298
+ config: JSON.stringify(t)
299
+ };
300
+ window.parent.postMessage(n, "*");
301
+ } catch (n) {
302
+ console.warn("❌ [Aippy AI Config] Failed to send config to parent window:", n);
303
+ }
304
+ } catch (e) {
305
+ console.warn("⚠️ [Aippy AI Config] Failed to send config:", e);
306
+ }
307
+ }
308
+ function ue(t) {
309
+ const e = z(t);
310
+ return W(e), new Proxy({}, {
311
+ get(n, r) {
312
+ if (typeof r == "string")
313
+ try {
314
+ return Q(e, r);
315
+ } catch {
316
+ return;
317
+ }
318
+ },
319
+ has(n, r) {
320
+ return typeof r != "string" ? !1 : r in e;
321
+ },
322
+ ownKeys(n) {
323
+ return Object.keys(e);
324
+ }
325
+ });
326
+ }
327
+ export {
328
+ T as D,
329
+ x as U,
330
+ oe as a,
331
+ se as b,
332
+ ne as c,
333
+ S as d,
334
+ U as e,
335
+ N as f,
336
+ ae as g,
337
+ ie as h,
338
+ Q as i,
339
+ ue as j,
340
+ z as l,
341
+ F as n,
342
+ ce as p,
343
+ M as r,
344
+ W as s,
345
+ w as v
346
+ };
@@ -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-CtB9L5kL.js").then((r) => r.b), { hasNativeBridge: f } = await import("./native-bridge-BnvipFJc.js"), i = f(), l = t();
18
+ const { getUserInfoAsync: o, getUserInfoFromParent: c, isInIframe: t } = await import("./bridge-D_-7nPNC.js").then((r) => r.d), { 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,101 +1,102 @@
1
1
  import { D as r, g as s, m as o } from "../config-B0A7gHQM.js";
2
- import { _ as i, g as n, r as p } from "../bridge-CtB9L5kL.js";
3
- import { A as m, a as c, E as f, b as C, c as g } from "../errors-B3bDbQbD.js";
4
- import { S as d, V as l, c as I, a as E, g as S, s as x } from "../container-message-ChLaG4Ke.js";
5
- import { A as U, C as _, R as D, a as T, p as h } from "../runtime-CmoG3v2m.js";
6
- import { CameraAPI as y, FileSystemAPI as F, GeolocationAPI as M, SensorsAPI as P, camera as O, fileSystem as b, geolocation as L, isMotionSupported as w, isOrientationSupported as H, requestMotionPermission as N, sensors as V, vibrate as k, watchMotion as B, watchOrientation as j } from "../device/index.js";
2
+ import { _ as i, g as n, r as p } from "../bridge-D_-7nPNC.js";
3
+ import { A as m, a as f, E as c, b as C, c as g } from "../errors-B3bDbQbD.js";
4
+ import { S as l, V as E, c as I, a as d, g as S, s as x } from "../container-message-DmIChz4h.js";
5
+ import { A as U, C as _, R as D, a as T, p as M } from "../runtime-CmoG3v2m.js";
6
+ import { CameraAPI as v, FileSystemAPI as y, GeolocationAPI as F, SensorsAPI as P, camera as O, fileSystem as b, geolocation as L, isMotionSupported as w, isOrientationSupported as H, requestMotionPermission as N, sensors as V, vibrate as B, watchMotion as k, watchOrientation as j } from "../device/index.js";
7
7
  import { P as G, a as z, c as K, b as W, g as X, i as Y, p as J, r as Q, s as Z } from "../app-version-checker-Bz7FrEZz.js";
8
8
  import { a as ee, P as ae, p as re, b as se } from "../pwa-C5nXU0DN.js";
9
9
  import { j as te } from "../url-c26cuIpu.js";
10
10
  import { a as ne, b as pe } from "../useTweaks-C7BEMpV3.js";
11
- import { c as me, b as ce, i as fe, p as Ce, u as ge, a as ue } from "../useSound-z_eIn0KH.js";
12
- import { reportScore as le, sendEvent as Ie, updateScore as Ee } from "../leaderboard/index.js";
13
- import { D as xe, d as Re, e as Ue, c as _e, U as De, a as Te, b as he, m as ve, h as ye, i as Fe, j as Me, k as Pe, g as Oe, l as be, n as Le, p as we, r as He, f as Ne, s as Ve, v as ke } from "../helper-CCuf-R6I.js";
14
- import { c as je, u as qe } from "../hooks-D5lkty5r.js";
15
- import { hasNativeBridge as ze } from "../native-bridge-BnvipFJc.js";
11
+ import { c as me, b as fe, i as ce, p as Ce, u as ge, a as ue } from "../useSound-z_eIn0KH.js";
12
+ import { reportScore as Ee, sendEvent as Ie, updateScore as de } from "../leaderboard/index.js";
13
+ import { D as xe, d as Re, e as Ue, c as _e, U as De, a as Te, b as Me, j as he, g as ve, h as ye, i as Fe, l as Pe, n as Oe, p as be, r as Le, f as we, s as He, v as Ne } from "../helper-BWszI06u.js";
14
+ import { MinistoreError as Be, ministore as ke } from "../ministore/index.js";
15
+ import { c as qe, u as Ge } from "../hooks-Ct9qEjM6.js";
16
+ import { hasNativeBridge as Ke } from "../native-bridge-BnvipFJc.js";
16
17
  export {
17
18
  U as AippyRuntime,
18
19
  m as AippyRuntimeError,
19
- y as CameraAPI,
20
+ v as CameraAPI,
20
21
  _ as Cancellable,
21
22
  xe as DEFAULT_BASE_URL,
22
23
  Re as DEFAULT_CHAT_MODEL,
23
24
  Ue as DEFAULT_CHAT_SYSTEM,
24
25
  r as DEFAULT_CONFIG,
25
26
  _e as DEFAULT_UI_BASE_URL,
26
- c as ERROR_CODES,
27
- f as ERROR_PREFIX,
28
- F as FileSystemAPI,
29
- M as GeolocationAPI,
27
+ f as ERROR_CODES,
28
+ c as ERROR_PREFIX,
29
+ y as FileSystemAPI,
30
+ F as GeolocationAPI,
31
+ Be as MinistoreError,
30
32
  ee as PWAUtils,
31
33
  ae as PerformanceMonitor,
32
34
  G as PlatformDetector,
33
35
  D as ReceiveChannel,
34
- d as SDK_NAME,
36
+ l as SDK_NAME,
35
37
  P as SensorsAPI,
36
38
  De as UI_CHAT_ENDPOINT,
37
- l as VERSION,
39
+ E as VERSION,
38
40
  i as _resetCachedApiBaseUrl,
39
41
  Te as aippyAIProvider,
40
- he as aippyChatConfig,
42
+ Me as aippyChatConfig,
41
43
  T as aippyRuntime,
42
44
  ne as aippyTweaks,
43
45
  pe as aippyTweaksRuntime,
44
46
  O as camera,
45
47
  z as checkFeatureSupport,
46
- je as clearUserInfoCache,
48
+ qe as clearUserInfoCache,
47
49
  K as compareVersions,
48
- ve as createAIConfig,
50
+ he as createAIConfig,
49
51
  I as createAippyHeaders,
50
- E as createAippyHeadersAsync,
52
+ d as createAippyHeadersAsync,
51
53
  C as createCodeError,
52
54
  g as createError,
53
55
  me as createHiddenMediaElement,
54
- ye as deductCredits,
55
56
  b as fileSystem,
56
- Fe as generateCharacter3D,
57
- Me as generateMotion,
57
+ ve as generateCharacter3D,
58
+ ye as generateMotion,
58
59
  L as geolocation,
59
- Pe as getAIConfigValue,
60
+ Fe as getAIConfigValue,
60
61
  n as getAuthTokenAsync,
61
62
  W as getAvailableFeatures,
62
63
  s as getConfigFromEnv,
63
- Oe as getCredits,
64
64
  X as getFeatureVersionRequirements,
65
65
  S as getVersionInfo,
66
- ze as hasNativeBridge,
67
- ce as isIOSDevice,
66
+ Ke as hasNativeBridge,
67
+ fe as isIOSDevice,
68
68
  Y as isInIframe,
69
- fe as isMediaStreamAudioSupported,
69
+ ce as isMediaStreamAudioSupported,
70
70
  w as isMotionSupported,
71
71
  H as isOrientationSupported,
72
72
  te as joinUrl,
73
- be as loadAIConfig,
73
+ Pe as loadAIConfig,
74
74
  o as mergeConfig,
75
- Le as normalizeError,
76
- we as parseAIConfig,
75
+ ke as ministore,
76
+ Oe as normalizeError,
77
+ be as parseAIConfig,
77
78
  Ce as patchAudioContext,
78
79
  re as performanceMonitor,
79
80
  J as platform,
80
- h as processMotionData,
81
+ M as processMotionData,
81
82
  se as pwa,
82
- le as reportScore,
83
+ Ee as reportScore,
83
84
  N as requestMotionPermission,
84
85
  Q as requireFeatureSupport,
85
86
  p as resolveApiBaseUrl,
86
- He as resolveOpenAIConfig,
87
- Ne as resolveUIConfig,
88
- Ve as sendAIConfigToContainer,
87
+ Le as resolveOpenAIConfig,
88
+ we as resolveUIConfig,
89
+ He as sendAIConfigToContainer,
89
90
  Ie as sendEvent,
90
91
  x as sendMessageToContainer,
91
92
  V as sensors,
92
93
  Z as showAlert,
93
- Ee as updateScore,
94
+ de as updateScore,
94
95
  ge as useAudioContext,
95
96
  ue as useSound,
96
- qe as useUserInfo,
97
- ke as validateAIConfig,
98
- k as vibrate,
99
- B as watchMotion,
97
+ Ge as useUserInfo,
98
+ Ne as validateAIConfig,
99
+ B as vibrate,
100
+ k as watchMotion,
100
101
  j as watchOrientation
101
102
  };
package/dist/index.d.ts CHANGED
@@ -5,4 +5,5 @@ export * from './tweaks';
5
5
  export * from './audio';
6
6
  export * from './leaderboard';
7
7
  export * from './ai';
8
+ export * from './ministore';
8
9
  export * from './user';
@@ -0,0 +1,9 @@
1
+ import { MinistoreAuthorization, MinistoreAuthorizationInput, MinistoreResult } from './types';
2
+ export declare function usableAuthorization(data: MinistoreAuthorization, input: MinistoreAuthorizationInput): boolean;
3
+ /** Shared runtime-auth version floor plus native bridge, not wallet capability. */
4
+ export declare function isAuthorizationSupported(): boolean;
5
+ /**
6
+ * Native records authorization only. No App login token, project ID or HTTP
7
+ * authorization writer is exposed to H5. Every bridge attempt gets its own ID.
8
+ */
9
+ export declare function confirmInApp(input: MinistoreAuthorizationInput, signal?: AbortSignal): Promise<MinistoreResult<MinistoreAuthorization>>;
@@ -0,0 +1,6 @@
1
+ import { MinistoreAuthorization, MinistoreAuthorizationInput, MinistoreRequestOptions, MinistoreResult } from './types';
2
+ /**
3
+ * Ask the App to record authorization through wallet.authorize, then verify mall.
4
+ * Confirmation never purchases or consumes an entitlement.
5
+ */
6
+ export declare function requestAuthorization(input: MinistoreAuthorizationInput, options?: MinistoreRequestOptions): Promise<MinistoreResult<MinistoreAuthorization>>;
@@ -0,0 +1,3 @@
1
+ import { MinistoreConsumeInput, MinistoreRequestOptions, MinistoreResult, MinistoreSettlement } from './types';
2
+ /** Consume the requested inventory/items; mall validates any automatic deficit purchase. */
3
+ export declare function consume(input: MinistoreConsumeInput, options?: MinistoreRequestOptions): Promise<MinistoreResult<MinistoreSettlement>>;
@@ -0,0 +1,18 @@
1
+ import { MinistoreErrorDetails, MinistoreErrorKind, MinistoreReason } from './types';
2
+ export declare class MinistoreError extends Error {
3
+ readonly kind: MinistoreErrorKind;
4
+ readonly httpStatus?: number;
5
+ readonly code?: number | string;
6
+ readonly type?: string;
7
+ readonly reason?: MinistoreReason;
8
+ readonly appMessage?: string;
9
+ readonly traceId?: string;
10
+ readonly retryAfterMs?: number;
11
+ readonly bizOrderNo?: string;
12
+ readonly settlementUnknown: boolean;
13
+ readonly authorizationUnknown: boolean;
14
+ readonly cause?: unknown;
15
+ constructor(kind: MinistoreErrorKind, message: string, details?: MinistoreErrorDetails);
16
+ }
17
+ export declare function invalidInput(message: string): never;
18
+ export declare function invalidResponse(): never;
@@ -0,0 +1,19 @@
1
+ import { requestAuthorization } from './authorization';
2
+ import { consume } from './consume';
3
+ import { isPurchaseSupported, purchase } from './purchase';
4
+ import { updateItem } from './update-item';
5
+ import { getAuthorization, getGemBalance, listBenefits, listCatalog, listRecords } from './queries';
6
+ export { MinistoreError } from './errors';
7
+ export type { BenefitHolding, BenefitItem, BenefitRecord, BenefitState, CatalogDisplay, CatalogItem, MinistoreAuthMode, MinistoreAuthorization, MinistoreAuthorizationInput, MinistoreAuthorizationQuery, MinistoreBenefits, MinistoreCatalog, MinistoreConsumeInput, MinistoreErrorDetails, MinistoreErrorKind, MinistorePurchaseInput, MinistoreReason, MinistoreRecordsPage, MinistoreRecordsQuery, MinistoreRequestOptions, MinistoreResult, MinistoreSettlement, MinistoreUpdateItem, MinistoreUpdateItemInput, } from './types';
8
+ export declare const ministore: {
9
+ getGemBalance: typeof getGemBalance;
10
+ getAuthorization: typeof getAuthorization;
11
+ requestAuthorization: typeof requestAuthorization;
12
+ listCatalog: typeof listCatalog;
13
+ listBenefits: typeof listBenefits;
14
+ isPurchaseSupported: typeof isPurchaseSupported;
15
+ purchase: typeof purchase;
16
+ consume: typeof consume;
17
+ updateItem: typeof updateItem;
18
+ listRecords: typeof listRecords;
19
+ };