@idosgames/core 0.26.4 → 0.26.6
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/GameHost-xACJW0x5.d.cts +406 -0
- package/dist/GameHost-xACJW0x5.d.ts +406 -0
- package/dist/{VoiceController-BBp83r66.d.cts → VoiceController-BMXi4MNo.d.ts} +91 -113
- package/dist/{VoiceController-ClaEESTz.d.ts → VoiceController-BWb8NTp2.d.cts} +91 -113
- package/dist/chunk-YZ32MQXQ.js +2 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +11 -29
- package/dist/index.d.ts +11 -29
- package/dist/index.js +2 -2
- package/dist/platform/index.cjs +2 -2
- package/dist/platform/index.d.cts +449 -2
- package/dist/platform/index.d.ts +449 -2
- package/dist/platform/index.js +1 -1
- package/dist/realtime/index.d.cts +3 -3
- package/dist/realtime/index.d.ts +3 -3
- package/package.json +1 -1
- package/dist/PlatformAdapter-DU_8HalI.d.cts +0 -34
- package/dist/PlatformAdapter-DU_8HalI.d.ts +0 -34
- package/dist/chunk-4VTWZXB4.js +0 -2
- package/dist/index-BCY6F_tf.d.cts +0 -197
- package/dist/index-YNXpT5ol.d.ts +0 -197
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const CurrencyType: {
|
|
4
|
+
readonly Virtual: "Virtual";
|
|
5
|
+
readonly Crypto: "Crypto";
|
|
6
|
+
};
|
|
7
|
+
type CurrencyType = (typeof CurrencyType)[keyof typeof CurrencyType];
|
|
8
|
+
declare const ResourceEntryType: {
|
|
9
|
+
readonly Item: "Item";
|
|
10
|
+
readonly VirtualCurrency: "VirtualCurrency";
|
|
11
|
+
readonly CryptoCurrency: "CryptoCurrency";
|
|
12
|
+
/** Rewarded-video credit: one verified ad view, spendable in ad-gated actions. */
|
|
13
|
+
readonly RewardedVideoCredit: "RewardedVideoCredit";
|
|
14
|
+
/**
|
|
15
|
+
* Real-money payment in a store. Only `ProductID` is populated — the amount and currency come
|
|
16
|
+
* from the SKU price tier, not from us. Never a stored resource: the money is paid outside,
|
|
17
|
+
* and the server settles the receipt before the resource operation runs.
|
|
18
|
+
*/
|
|
19
|
+
readonly Purchase: "Purchase";
|
|
20
|
+
/**
|
|
21
|
+
* Payment in Credits — the PLATFORM currency on the player's iDos Games account. Only `Amount` is set (the price in
|
|
22
|
+
* whole Credits). Not a game resource: the player confirms each purchase on idosgames.com, then the server charges the
|
|
23
|
+
* Credits and credits 70% to the game's author. Accepted by every sale of the game's author (store, lootboxes, packs,
|
|
24
|
+
* craft, deals, boosts, VIP, upgrades, skins, coop spins, special mode, Workshop fee, InApp AI) — see `client.credits.pay`.
|
|
25
|
+
* Not in player-to-player prices (marketplace, PvP) and never a reward.
|
|
26
|
+
*/
|
|
27
|
+
readonly PlatformCredits: "PlatformCredits";
|
|
28
|
+
};
|
|
29
|
+
type ResourceEntryType = (typeof ResourceEntryType)[keyof typeof ResourceEntryType];
|
|
30
|
+
/**
|
|
31
|
+
* Platform the client runs on. Sent with every request (header `X-IG-Platform`) because the set
|
|
32
|
+
* of available payment options depends on it: an App Store build must not offer payment outside
|
|
33
|
+
* IAP. `Unknown` is a value of its own, not a synonym for `Web` — a client that does not report
|
|
34
|
+
* its platform only gets options that are safe everywhere.
|
|
35
|
+
*/
|
|
36
|
+
declare const ClientPlatform: {
|
|
37
|
+
readonly Unknown: "Unknown";
|
|
38
|
+
readonly Web: "Web";
|
|
39
|
+
readonly Android: "Android";
|
|
40
|
+
readonly Ios: "Ios";
|
|
41
|
+
};
|
|
42
|
+
type ClientPlatform = (typeof ClientPlatform)[keyof typeof ClientPlatform];
|
|
43
|
+
/** Store that issued a receipt. Must match a key in the title's `Purchase.Stores`. */
|
|
44
|
+
declare const IapStore: {
|
|
45
|
+
readonly GooglePlay: "GooglePlay";
|
|
46
|
+
readonly AppleAppStore: "AppleAppStore";
|
|
47
|
+
};
|
|
48
|
+
type IapStore = (typeof IapStore)[keyof typeof IapStore];
|
|
49
|
+
declare const zIapStore: z.ZodCatch<z.ZodEnum<{
|
|
50
|
+
GooglePlay: "GooglePlay";
|
|
51
|
+
AppleAppStore: "AppleAppStore";
|
|
52
|
+
TelegramStars: "TelegramStars";
|
|
53
|
+
}>>;
|
|
54
|
+
declare const EventTokenType: {
|
|
55
|
+
readonly TimedEvent: "TimedEvent";
|
|
56
|
+
readonly Quest: "Quest";
|
|
57
|
+
readonly Leaderboard: "Leaderboard";
|
|
58
|
+
readonly CoopEvent: "CoopEvent";
|
|
59
|
+
readonly Season: "Season";
|
|
60
|
+
};
|
|
61
|
+
type EventTokenType = (typeof EventTokenType)[keyof typeof EventTokenType];
|
|
62
|
+
declare const ScheduleMode: {
|
|
63
|
+
readonly AlwaysOn: "AlwaysOn";
|
|
64
|
+
readonly Scheduled: "Scheduled";
|
|
65
|
+
readonly Chained: "Chained";
|
|
66
|
+
readonly Triggered: "Triggered";
|
|
67
|
+
readonly Cyclic: "Cyclic";
|
|
68
|
+
readonly Relative: "Relative";
|
|
69
|
+
};
|
|
70
|
+
type ScheduleMode = (typeof ScheduleMode)[keyof typeof ScheduleMode];
|
|
71
|
+
declare const AuthType: {
|
|
72
|
+
readonly None: "None";
|
|
73
|
+
readonly Device: "Device";
|
|
74
|
+
readonly Email: "Email";
|
|
75
|
+
readonly iDosGames: "iDosGames";
|
|
76
|
+
readonly Facebook: "Facebook";
|
|
77
|
+
readonly Google: "Google";
|
|
78
|
+
readonly Apple: "Apple";
|
|
79
|
+
readonly GooglePlay: "GooglePlay";
|
|
80
|
+
readonly Telegram: "Telegram";
|
|
81
|
+
readonly Wallet: "Wallet";
|
|
82
|
+
};
|
|
83
|
+
type AuthType = (typeof AuthType)[keyof typeof AuthType];
|
|
84
|
+
|
|
85
|
+
/** Key/value storage of the host (replaces Unity PlayerPrefs). Synchronous, fails soft. */
|
|
86
|
+
interface KeyValueStorage {
|
|
87
|
+
getString(key: string): string | null;
|
|
88
|
+
setString(key: string, value: string): void;
|
|
89
|
+
remove(key: string): void;
|
|
90
|
+
}
|
|
91
|
+
/** Called to stop listening. */
|
|
92
|
+
type HostUnsubscribe = () => void;
|
|
93
|
+
/**
|
|
94
|
+
* What this host can do. A game decides by these, never by the platform's name: a button that can only
|
|
95
|
+
* fail here is hidden, not shown.
|
|
96
|
+
*/
|
|
97
|
+
interface HostCapabilities {
|
|
98
|
+
/**
|
|
99
|
+
* The host signs the player in with their platform account by itself, without the game's sign-in screen
|
|
100
|
+
* (the site's game page, the iDos Games app). The game asks right after start (`signIn`).
|
|
101
|
+
*/
|
|
102
|
+
readonly autoSignIn: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* "Continue with iDos Games" can be answered by the host itself (`signIn` on the button press): every case
|
|
105
|
+
* of `autoSignIn` plus the AI Coder's preview, where the dashboard signs the publisher in.
|
|
106
|
+
*/
|
|
107
|
+
readonly signIn: boolean;
|
|
108
|
+
/** Rewarded video ads (`showRewardedAd`). */
|
|
109
|
+
readonly rewardedAds: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* The host shows the TITLE's own ad network (`showRewardedAd` with `provider`): a creator's native app with the
|
|
112
|
+
* creator's mediation account. Without it only the platform's ads of the iDos Games app are shown.
|
|
113
|
+
*/
|
|
114
|
+
readonly titleAds: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* The store's own purchase window for the title's products (`buyProduct`): Google Play in a creator's native
|
|
117
|
+
* app, with the creator's Play account. The server verifies the receipt and grants (`client.purchase.buy`).
|
|
118
|
+
*/
|
|
119
|
+
readonly storePurchases: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Prices in Credits (Aspis) may be offered at all. `false` where the store forbids digital purchases outside
|
|
122
|
+
* its own billing (the iOS app: App Store 3.1.1): the game hides its Credits prices there.
|
|
123
|
+
*/
|
|
124
|
+
readonly creditsPayments: boolean;
|
|
125
|
+
/** The host shows its own window to confirm a Credits spend (`confirmCredits`); otherwise a link. */
|
|
126
|
+
readonly creditsConfirm: boolean;
|
|
127
|
+
/** The host opens its crypto top-up window when a crypto price is short (`topUp`). */
|
|
128
|
+
readonly cryptoTopUp: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* The host asks the game for still frames and recordings of its scene (the site's "share a shot" and
|
|
131
|
+
* "best moments"); the app shell answers those requests. A native host captures by itself: `false`.
|
|
132
|
+
*/
|
|
133
|
+
readonly sceneCaptureRequests: boolean;
|
|
134
|
+
/** The system share sheet (`share` resolves `"shared"`); without it `share` copies the link. */
|
|
135
|
+
readonly share: boolean;
|
|
136
|
+
/** Vibration (`vibrate` does something). */
|
|
137
|
+
readonly vibration: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Memory shared between the game and its workers: `SharedArrayBuffer`, `Atomics`, threads of WebAssembly
|
|
140
|
+
* (physics, an engine compiled from C++/Rust). Needs a host that serves the game "cross-origin isolated"
|
|
141
|
+
* (a native app does; a page framed by the site does not). Without it the game still uses every core
|
|
142
|
+
* through workers (`createWorker`), passing data by messages and transferred buffers.
|
|
143
|
+
*/
|
|
144
|
+
readonly sharedMemory: boolean;
|
|
145
|
+
/** The player can choose files from the device (`pickFiles`): a save to load, pictures. */
|
|
146
|
+
readonly filePicker: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Device notifications by the host itself (`requestPushToken`): a creator's native app with the creator's own
|
|
149
|
+
* Firebase. `client.push` then subscribes the device token instead of a browser's Web Push.
|
|
150
|
+
*/
|
|
151
|
+
readonly pushNotifications: boolean;
|
|
152
|
+
}
|
|
153
|
+
/** `requestPushToken` request. */
|
|
154
|
+
interface HostPushTokenRequest {
|
|
155
|
+
/** `true` (only from a tap): ask the player for permission; `false`: only check what is already allowed. */
|
|
156
|
+
prompt: boolean;
|
|
157
|
+
}
|
|
158
|
+
/** `requestPushToken` answer: a `token` or an `error`. */
|
|
159
|
+
interface HostPushToken {
|
|
160
|
+
/** The device token of the push service. */
|
|
161
|
+
token?: string;
|
|
162
|
+
/** Which service it belongs to: the server's `PushTransport`. */
|
|
163
|
+
transport?: "Fcm" | "Apns";
|
|
164
|
+
/** `NOT_GRANTED` (not asked yet), `BLOCKED` (the player said no), `UNAVAILABLE`, … */
|
|
165
|
+
error?: string;
|
|
166
|
+
}
|
|
167
|
+
/** `pickFiles` request. */
|
|
168
|
+
interface HostPickFilesRequest {
|
|
169
|
+
/** Media types or extensions (`image/png`, `image/*`, `.json`); empty: any file. */
|
|
170
|
+
accept?: readonly string[];
|
|
171
|
+
/** More than one file at once. */
|
|
172
|
+
multiple?: boolean;
|
|
173
|
+
}
|
|
174
|
+
/** What `files.list` tells about a stored file, without reading it. */
|
|
175
|
+
interface HostStoredFileInfo {
|
|
176
|
+
key: string;
|
|
177
|
+
/** Bytes. */
|
|
178
|
+
size: number;
|
|
179
|
+
/** When it was last written, ms since 1970. */
|
|
180
|
+
updatedAt: number;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The game's own files on this device (`host.files`): worlds, saves, things the player made. Bigger than
|
|
184
|
+
* `storage` (which is for small settings), asynchronous, by key (`worlds/abc.json`: a `/` is just part of the
|
|
185
|
+
* key, used for `list`). Every call fails soft: `read` gives `null`, `write` gives `false`.
|
|
186
|
+
*/
|
|
187
|
+
interface HostFileStore {
|
|
188
|
+
read(key: string): Promise<Uint8Array | null>;
|
|
189
|
+
/** `false`: not kept (no room, storage refused). */
|
|
190
|
+
write(key: string, bytes: Uint8Array): Promise<boolean>;
|
|
191
|
+
remove(key: string): Promise<void>;
|
|
192
|
+
/** Files whose key starts with `prefix`, newest first. */
|
|
193
|
+
list(prefix?: string): Promise<HostStoredFileInfo[]>;
|
|
194
|
+
}
|
|
195
|
+
/** `createWorker` options. A worker is always a module worker. */
|
|
196
|
+
interface HostWorkerOptions {
|
|
197
|
+
/** Name in the developer tools. */
|
|
198
|
+
name?: string;
|
|
199
|
+
}
|
|
200
|
+
/** `signIn` answer. Exactly one of `code` / `ticket` on success. */
|
|
201
|
+
interface HostSignInAnswer {
|
|
202
|
+
/** One-time SSO code: `client.auth.loginWithSsoCode`. */
|
|
203
|
+
code?: string;
|
|
204
|
+
/** Ticket of the platform's shared game session: `client.auth.loginWithPlatformGameTicket`. */
|
|
205
|
+
ticket?: string;
|
|
206
|
+
/** Why not: `no_session`, `wrong_title`, `no_title`, `issue_failed`, `TIMEOUT`, `UNAVAILABLE`, … */
|
|
207
|
+
error?: string;
|
|
208
|
+
}
|
|
209
|
+
interface HostAdRequest {
|
|
210
|
+
titleID: string;
|
|
211
|
+
userID: string;
|
|
212
|
+
/** The server's permit for this view. The reward is granted by the server, never by the host. */
|
|
213
|
+
requestID: string;
|
|
214
|
+
placementID: string;
|
|
215
|
+
adUnitID?: string | null;
|
|
216
|
+
/**
|
|
217
|
+
* The title's own ad network (`supports.titleAds`), absent for the platform's ads of the iDos Games app. The
|
|
218
|
+
* host shows the video with it and passes `requestID` to the network's server-side callback, which closes the
|
|
219
|
+
* permit on the title's callback address.
|
|
220
|
+
*/
|
|
221
|
+
provider?: HostAdProvider | null;
|
|
222
|
+
}
|
|
223
|
+
/** The title's own ad network for `showRewardedAd` (`supports.titleAds`): from the title's `Advertising.Providers`. */
|
|
224
|
+
interface HostAdProvider {
|
|
225
|
+
/** `ProviderID` of the title's config. */
|
|
226
|
+
id: string;
|
|
227
|
+
/** Mediation vendor (`LevelPlay`, `AppLovinMax`): the host shows only the kinds it has. */
|
|
228
|
+
kind: string;
|
|
229
|
+
/** The vendor's app key for this platform (LevelPlay: App Key). */
|
|
230
|
+
appKey: string;
|
|
231
|
+
}
|
|
232
|
+
/** Store of a receipt; the same names as the server's `IapStore`. */
|
|
233
|
+
type HostStore = "GooglePlay" | "AppleAppStore";
|
|
234
|
+
/** `buyProduct` request (`supports.storePurchases`). */
|
|
235
|
+
interface HostStorePurchaseRequest {
|
|
236
|
+
/** The product's id IN THE STORE (`StoreProductIDs[store]` of the title's product). */
|
|
237
|
+
storeProductID: string;
|
|
238
|
+
/** `Consumable`, `NonConsumable` or `Subscription`. */
|
|
239
|
+
type: string;
|
|
240
|
+
/** Who buys: the store binds the purchase to it (Google `obfuscatedAccountId`), the server can check it. */
|
|
241
|
+
accountID?: string;
|
|
242
|
+
}
|
|
243
|
+
/** A store receipt as the server's `ValidatePurchase` takes it. */
|
|
244
|
+
interface HostStoreReceipt {
|
|
245
|
+
store: HostStore;
|
|
246
|
+
/** Google: `INAPP_PURCHASE_DATA` (the purchase's original JSON); Apple: the signed transaction. */
|
|
247
|
+
receipt: string;
|
|
248
|
+
/** Google: the purchase's signature. */
|
|
249
|
+
signature?: string;
|
|
250
|
+
/** The product's id in the store. */
|
|
251
|
+
storeProductID?: string;
|
|
252
|
+
}
|
|
253
|
+
/** `buyProduct` answer. */
|
|
254
|
+
interface HostStorePurchaseResult {
|
|
255
|
+
ok: boolean;
|
|
256
|
+
receipt?: HostStoreReceipt;
|
|
257
|
+
/** `CANCELLED` (the player closed the window), `PENDING` (paid later: cash, bank), `ALREADY_OWNED`, `UNAVAILABLE`, … */
|
|
258
|
+
error?: string;
|
|
259
|
+
}
|
|
260
|
+
interface HostAdResult {
|
|
261
|
+
ok: boolean;
|
|
262
|
+
/** How the permit was closed: a watched video or a spent ad unit of the platform. */
|
|
263
|
+
via?: "ad" | "unit";
|
|
264
|
+
/** `CANCELLED`, `DECLINED`, `CLOSED` (the player said no), `NO_FILL`, `BUSY`, `UNAVAILABLE`, … */
|
|
265
|
+
error?: string;
|
|
266
|
+
}
|
|
267
|
+
interface HostCreditsConfirmRequest {
|
|
268
|
+
titleID: string;
|
|
269
|
+
confirmationID: string;
|
|
270
|
+
}
|
|
271
|
+
/** `ok`: the player confirmed. `DECLINED` / `NOT_ENOUGH_CREDITS` are final; anything else: use the link. */
|
|
272
|
+
interface HostResult {
|
|
273
|
+
ok: boolean;
|
|
274
|
+
error?: string;
|
|
275
|
+
}
|
|
276
|
+
interface HostTopUpRequest {
|
|
277
|
+
titleID: string;
|
|
278
|
+
/** The game's player; the host refuses when its own account is another one. */
|
|
279
|
+
userID: string;
|
|
280
|
+
currencyID: string;
|
|
281
|
+
/** Tokens to deposit, as an exact decimal string ("12.5"). */
|
|
282
|
+
amount: string;
|
|
283
|
+
}
|
|
284
|
+
/** What to share: a link, a text, or both (at least one). */
|
|
285
|
+
interface HostShareRequest {
|
|
286
|
+
url?: string;
|
|
287
|
+
title?: string;
|
|
288
|
+
text?: string;
|
|
289
|
+
}
|
|
290
|
+
/** The text a host copies when it has no share sheet: the text, then the link. */
|
|
291
|
+
declare function shareFallbackText(request: HostShareRequest): string;
|
|
292
|
+
/** A file the game hands to the player (a rendered video, a picture). Bytes, not a DOM `Blob`. */
|
|
293
|
+
interface HostFile {
|
|
294
|
+
bytes: Uint8Array;
|
|
295
|
+
/** File name with its extension (`clip.mp4`). */
|
|
296
|
+
name: string;
|
|
297
|
+
/** Media type (`video/mp4`). */
|
|
298
|
+
mime: string;
|
|
299
|
+
}
|
|
300
|
+
/** `shared`: the share sheet took the file; `saved`: downloaded / saved to the device; `cancelled`; `unavailable`. */
|
|
301
|
+
type HostFileOutcome = "shared" | "saved" | "cancelled" | "unavailable";
|
|
302
|
+
/** `shared`: the share sheet took it; `copied`: text and link are on the clipboard; `cancelled`; `unavailable`. */
|
|
303
|
+
type HostShareOutcome = "shared" | "copied" | "cancelled" | "unavailable";
|
|
304
|
+
/** The contract. See the header of this file. */
|
|
305
|
+
interface GameHost {
|
|
306
|
+
/**
|
|
307
|
+
* Which implementation this is (`web`, `site`, `preview`, `telegram`, `native:android`, `native:ios`,
|
|
308
|
+
* `memory`, …): for analytics and diagnostics ONLY. Never branch game logic on it: ask `supports`.
|
|
309
|
+
*/
|
|
310
|
+
readonly id: string;
|
|
311
|
+
readonly supports: HostCapabilities;
|
|
312
|
+
/** Small settings, synchronous (replaces PlayerPrefs). */
|
|
313
|
+
readonly storage: KeyValueStorage;
|
|
314
|
+
/** The game's files on this device (saves, worlds); in memory where the host cannot keep them. */
|
|
315
|
+
readonly files: HostFileStore;
|
|
316
|
+
/** Platform string sent to the server at sign-in (`Web`, Telegram's `android`/`tdesktop`, `Android`, `iOS`). */
|
|
317
|
+
getPlatform(): string;
|
|
318
|
+
/** Platform the server filters payment options by (`X-IG-Platform`). */
|
|
319
|
+
getClientPlatform(): ClientPlatform;
|
|
320
|
+
/** The launch link (attribution, `WebAppLink`). */
|
|
321
|
+
getFullURL(): string;
|
|
322
|
+
/** Referral / deep-link parameter of the launch (Telegram `start_param`, the app's link). */
|
|
323
|
+
getStartParameter(): string | null;
|
|
324
|
+
/** Referring page, when the host has one. */
|
|
325
|
+
getReferrer(): string | null;
|
|
326
|
+
/** Raw Telegram `initData` for server-side sign-in (validated only on the server). */
|
|
327
|
+
getTelegramInitDataRaw(): string | null;
|
|
328
|
+
/** Stable id of this installation. */
|
|
329
|
+
getDeviceID(): string;
|
|
330
|
+
/** Device description (user agent or device model). */
|
|
331
|
+
getDeviceModel(): string;
|
|
332
|
+
/** The person's language as a BCP 47 tag (`en`, `ru-RU`); "": unknown (the server then uses the title's). */
|
|
333
|
+
getLanguage(): string;
|
|
334
|
+
/** Sign-in with the platform account by the host (`supports.signIn`). Never rejects. */
|
|
335
|
+
signIn(titleID: string): Promise<HostSignInAnswer>;
|
|
336
|
+
/**
|
|
337
|
+
* The player signed out of this game themselves: the host must not sign them straight back in on the
|
|
338
|
+
* next start. Cleared by the next sign-in of any kind (`false`).
|
|
339
|
+
*/
|
|
340
|
+
setSignInDeclined(titleID: string, declined: boolean): void;
|
|
341
|
+
isSignInDeclined(titleID: string): boolean;
|
|
342
|
+
/** Shows a rewarded video for the server's permit (`supports.rewardedAds`). Never rejects. */
|
|
343
|
+
showRewardedAd(request: HostAdRequest): Promise<HostAdResult>;
|
|
344
|
+
/** The host's own window confirming a Credits spend (`supports.creditsConfirm`). Never rejects. */
|
|
345
|
+
confirmCredits(request: HostCreditsConfirmRequest): Promise<HostResult>;
|
|
346
|
+
/** The host's crypto top-up window (`supports.cryptoTopUp`); `ok` once the deposit is CREDITED. */
|
|
347
|
+
topUp(request: HostTopUpRequest): Promise<HostResult>;
|
|
348
|
+
/** Opens a payment invoice link (Telegram Stars; a browser tab elsewhere). */
|
|
349
|
+
openInvoice(url: string): void;
|
|
350
|
+
/**
|
|
351
|
+
* The store's purchase window for one product (`supports.storePurchases`). Resolves with the receipt; nothing
|
|
352
|
+
* is granted yet: the caller hands it to the server (`client.purchase.buy` does all of it). Never rejects.
|
|
353
|
+
*/
|
|
354
|
+
buyProduct(request: HostStorePurchaseRequest): Promise<HostStorePurchaseResult>;
|
|
355
|
+
/**
|
|
356
|
+
* Closes a purchase in the store AFTER the server granted it: a consumable is consumed (can be bought again), the
|
|
357
|
+
* rest acknowledged. ⚠ Never before the server's answer: a purchase closed and not granted is money lost.
|
|
358
|
+
*/
|
|
359
|
+
finishPurchase(receipt: HostStoreReceipt, consumable: boolean): Promise<boolean>;
|
|
360
|
+
/** Purchases the store holds paid but not closed (the app died between payment and grant). */
|
|
361
|
+
pendingPurchases(): Promise<HostStoreReceipt[]>;
|
|
362
|
+
/** Opens a link outside the game (system browser / new tab). */
|
|
363
|
+
openUrl(url: string): void;
|
|
364
|
+
/** The share sheet, or the clipboard (`shareFallbackText`) when there is none or it refused. Never rejects. */
|
|
365
|
+
share(request: HostShareRequest): Promise<HostShareOutcome>;
|
|
366
|
+
/** Hands a file to the player: the share sheet where there is one (TikTok, the gallery), else a download. */
|
|
367
|
+
shareFile(file: HostFile): Promise<HostFileOutcome>;
|
|
368
|
+
/**
|
|
369
|
+
* The device's file picker (`supports.filePicker`). Resolves with the chosen files, `[]` when the player closed it
|
|
370
|
+
* or the host has none. ⚠ Call it right from a tap or click: a picker opens only during a user gesture. Never
|
|
371
|
+
* rejects.
|
|
372
|
+
*/
|
|
373
|
+
pickFiles(request?: HostPickFilesRequest): Promise<HostFile[]>;
|
|
374
|
+
/** Puts text on the clipboard. `false`: the host could not. Never rejects. */
|
|
375
|
+
copyText(text: string): Promise<boolean>;
|
|
376
|
+
/**
|
|
377
|
+
* The device's push token (`supports.pushNotifications`), asking for permission when `prompt` (from a tap only).
|
|
378
|
+
* `client.push` calls it; a game uses `client.push`. Never rejects.
|
|
379
|
+
*/
|
|
380
|
+
requestPushToken(request: HostPushTokenRequest): Promise<HostPushToken>;
|
|
381
|
+
/** Vibration pattern in ms (`supports.vibration`); a no-op elsewhere. */
|
|
382
|
+
vibrate(pattern: number | readonly number[]): void;
|
|
383
|
+
/**
|
|
384
|
+
* Starts a worker: a thread of its own on another processor core, for heavy work that must not stall the
|
|
385
|
+
* game's frame (world generation, meshing, physics, path finding, bots). `url` is the bundled worker file:
|
|
386
|
+
* `import workerUrl from "./myWorker.ts?worker&url"` (the AI Coder's build, its preview and `vite dev` all
|
|
387
|
+
* understand it). The host makes it start wherever the game's files are served from (the game's files on
|
|
388
|
+
* the asset host, a native app's local files). `null`: no workers here: do the work on the main thread.
|
|
389
|
+
* Never `new Worker(...)` in a game: it fails silently where the files live on another address.
|
|
390
|
+
*/
|
|
391
|
+
createWorker(url: string, options?: HostWorkerOptions): Worker | null;
|
|
392
|
+
/**
|
|
393
|
+
* The game is on screen. `false`: the tab is hidden, the app went to the background, the feed scrolled
|
|
394
|
+
* away from this game: stop the loop, the sound and the timers (the host shell does it for scenes).
|
|
395
|
+
*/
|
|
396
|
+
isVisible(): boolean;
|
|
397
|
+
/** Called with the new value whenever `isVisible()` changes. */
|
|
398
|
+
onVisibilityChange(listener: (visible: boolean) => void): HostUnsubscribe;
|
|
399
|
+
/**
|
|
400
|
+
* A link opened the game while it runs (the browser: the address's `#…` changed; a native app: an app link or
|
|
401
|
+
* a notification). The launch link itself is `getFullURL()`.
|
|
402
|
+
*/
|
|
403
|
+
onLinkOpened(listener: (url: string) => void): HostUnsubscribe;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export { AuthType as A, ClientPlatform as C, EventTokenType as E, type GameHost as G, type HostAdProvider as H, IapStore as I, type KeyValueStorage as K, ResourceEntryType as R, ScheduleMode as S, CurrencyType as a, type HostAdRequest as b, type HostAdResult as c, type HostCapabilities as d, type HostCreditsConfirmRequest as e, type HostFile as f, type HostFileOutcome as g, type HostFileStore as h, type HostPickFilesRequest as i, type HostPushToken as j, type HostPushTokenRequest as k, type HostResult as l, type HostShareOutcome as m, type HostShareRequest as n, type HostSignInAnswer as o, type HostStore as p, type HostStorePurchaseRequest as q, type HostStorePurchaseResult as r, type HostStoreReceipt as s, type HostStoredFileInfo as t, type HostTopUpRequest as u, type HostUnsubscribe as v, type HostWorkerOptions as w, shareFallbackText as x, zIapStore as z };
|