@idosgames/core 0.24.2 → 0.25.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/CHANGELOG.md +10 -0
- package/dist/{VoiceController-7H1grlKL.d.cts → VoiceController-CAqhPZ15.d.cts} +36 -7
- package/dist/{VoiceController-B2m4oYGx.d.ts → VoiceController-CNq9Lm0f.d.ts} +36 -7
- package/dist/chunk-YSPGQWAB.js +2 -0
- package/dist/index-BKjfSSxG.d.ts +188 -0
- package/dist/index-DMmtsWR2.d.cts +188 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/platform/index.cjs +2 -2
- package/dist/platform/index.d.cts +2 -184
- package/dist/platform/index.d.ts +2 -184
- package/dist/platform/index.js +1 -1
- package/dist/realtime/index.d.cts +2 -2
- package/dist/realtime/index.d.ts +2 -2
- package/package.json +1 -1
- package/dist/chunk-J3S34XCF.js +0 -2
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { K as KeyValueStorage, P as PlatformAdapter } from './PlatformAdapter-DU_8HalI.js';
|
|
2
|
+
|
|
3
|
+
/** localStorage-backed key/value store (replaces Unity PlayerPrefs). Fails soft. */
|
|
4
|
+
declare class BrowserStorage implements KeyValueStorage {
|
|
5
|
+
getString(key: string): string | null;
|
|
6
|
+
setString(key: string, value: string): void;
|
|
7
|
+
remove(key: string): void;
|
|
8
|
+
}
|
|
9
|
+
/** In-memory store for tests / SSR. */
|
|
10
|
+
declare class MemoryStorage implements KeyValueStorage {
|
|
11
|
+
private readonly map;
|
|
12
|
+
getString(key: string): string | null;
|
|
13
|
+
setString(key: string, value: string): void;
|
|
14
|
+
remove(key: string): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Browser/Telegram platform adapter. Auto-detects Telegram WebApp when present. */
|
|
18
|
+
declare class BrowserPlatformAdapter implements PlatformAdapter {
|
|
19
|
+
readonly storage: KeyValueStorage;
|
|
20
|
+
constructor(storage?: KeyValueStorage);
|
|
21
|
+
getPlatform(): string;
|
|
22
|
+
getFullURL(): string;
|
|
23
|
+
getStartParameter(): string | null;
|
|
24
|
+
getReferrer(): string | null;
|
|
25
|
+
getTelegramInitDataRaw(): string | null;
|
|
26
|
+
getDeviceID(): string;
|
|
27
|
+
getDeviceModel(): string;
|
|
28
|
+
shareLink(url: string): void;
|
|
29
|
+
openInvoice(url: string): void;
|
|
30
|
+
showAd(blockId: string): Promise<void>;
|
|
31
|
+
copyToClipboard(text: string): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** No-op adapter for tests and non-browser (SSR) contexts. In-memory storage, no Telegram. */
|
|
35
|
+
declare class NoopPlatformAdapter implements PlatformAdapter {
|
|
36
|
+
readonly storage: KeyValueStorage;
|
|
37
|
+
constructor(storage?: KeyValueStorage);
|
|
38
|
+
getPlatform(): string;
|
|
39
|
+
getFullURL(): string;
|
|
40
|
+
getStartParameter(): string | null;
|
|
41
|
+
getTelegramInitDataRaw(): string | null;
|
|
42
|
+
getDeviceID(): string;
|
|
43
|
+
getDeviceModel(): string;
|
|
44
|
+
shareLink(): void;
|
|
45
|
+
openInvoice(): void;
|
|
46
|
+
showAd(): Promise<void>;
|
|
47
|
+
copyToClipboard(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface TelegramInitDataUnsafe {
|
|
51
|
+
start_param?: string;
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
}
|
|
54
|
+
interface TelegramWebApp {
|
|
55
|
+
platform?: string;
|
|
56
|
+
initData?: string;
|
|
57
|
+
initDataUnsafe?: TelegramInitDataUnsafe;
|
|
58
|
+
openTelegramLink?: (url: string) => void;
|
|
59
|
+
openInvoice?: (url: string, callback?: (status: string) => void) => void;
|
|
60
|
+
}
|
|
61
|
+
declare function getTelegramWebApp(): TelegramWebApp | null;
|
|
62
|
+
|
|
63
|
+
declare const PLATFORM_ORIGINS: readonly string[];
|
|
64
|
+
/**
|
|
65
|
+
* Is `origin` the platform page that framed us — including the local stand?
|
|
66
|
+
*
|
|
67
|
+
* The local allowance is deliberately symmetric: a localhost parent is accepted ONLY while this
|
|
68
|
+
* game is itself served from localhost. A shipped build lives on `{id}.idos.games`, so it answers
|
|
69
|
+
* nothing but the real site — a page on the player's own machine cannot ask it for anything.
|
|
70
|
+
* That is what makes the allowance safe enough to ship, instead of a build-time flag that has to
|
|
71
|
+
* survive four bundlers.
|
|
72
|
+
*
|
|
73
|
+
* On the AI Coder's preview host the parent is the dashboard, and only the dashboard.
|
|
74
|
+
*
|
|
75
|
+
* Use this for bridges a game exposes to its parent. A bridge that must NOT widen its existing
|
|
76
|
+
* behaviour (the wallet's) keeps checking {@link PLATFORM_ORIGINS} directly.
|
|
77
|
+
*/
|
|
78
|
+
declare function isPlatformParentOrigin(origin: string): boolean;
|
|
79
|
+
|
|
80
|
+
/** Sent by the site the moment it receives any bridge request. Shared with the site — keep in step. */
|
|
81
|
+
declare const PLATFORM_BRIDGE_ACK = "IDOS_PLATFORM_WALLET_ACK";
|
|
82
|
+
/**
|
|
83
|
+
* The page around the game did not answer at all — an old site build without the bridge, or a
|
|
84
|
+
* parent that is not the platform. The value is the wallet bridge's historical one, kept as is.
|
|
85
|
+
*/
|
|
86
|
+
declare const PLATFORM_PAGE_UNAVAILABLE = "PLATFORM_WALLET_UNAVAILABLE";
|
|
87
|
+
interface PlatformPageAnswer {
|
|
88
|
+
ok: boolean;
|
|
89
|
+
error?: string;
|
|
90
|
+
/** The answer message as the site sent it — the caller reads its own fields from here. */
|
|
91
|
+
data: Record<string, unknown>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Posts `type` with `payload` to the parent page and resolves with its `responseType` answer.
|
|
95
|
+
* Never rejects: silence, a foreign origin and a refusal all resolve to `{ ok: false }` with a reason.
|
|
96
|
+
*/
|
|
97
|
+
declare function askPlatformPage(type: string, responseType: string, payload: Record<string, unknown>, options?: {
|
|
98
|
+
answerTimeoutMs?: number;
|
|
99
|
+
}): Promise<PlatformPageAnswer>;
|
|
100
|
+
|
|
101
|
+
/** Message names. Shared with the website's `GameWalletLoginBridge` — keep both in step. */
|
|
102
|
+
declare const PLATFORM_TOPUP_MESSAGES: {
|
|
103
|
+
readonly request: "IDOS_PLATFORM_TOPUP_REQUEST";
|
|
104
|
+
readonly response: "IDOS_PLATFORM_TOPUP_RESPONSE";
|
|
105
|
+
};
|
|
106
|
+
interface PlatformTopUpRequest {
|
|
107
|
+
titleID: string;
|
|
108
|
+
/** The game's player. The site refuses when its own session is another account. */
|
|
109
|
+
userID: string;
|
|
110
|
+
currencyID: string;
|
|
111
|
+
/** Tokens to deposit, as an exact decimal string ("12.5"). */
|
|
112
|
+
amount: string;
|
|
113
|
+
}
|
|
114
|
+
interface PlatformTopUpResult {
|
|
115
|
+
/** The deposit is credited to the player's in-game balance. */
|
|
116
|
+
ok: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Why not: `CANCELLED`, `PENDING` (sent, the engine has not credited it yet), `ACCOUNT_MISMATCH`,
|
|
119
|
+
* `NOT_DEPOSITABLE`, `NO_WALLET`, `TIMEOUT`, `PLATFORM_WALLET_UNAVAILABLE`, `BUSY` (a top-up window is already
|
|
120
|
+
* open), `COOLDOWN` (the previous top-up failed less than 30 s ago — the site pauses repeat requests), …
|
|
121
|
+
*/
|
|
122
|
+
error?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Whether this page can ask the site for a top-up at all: it sits in a frame exactly one level deep
|
|
126
|
+
* (the platform's own `/app/{id}` page; on a foreign site the game is two frames deep, behind our
|
|
127
|
+
* `/embed` page) and is not the AI Coder preview. When the browser names the parent's origin, it must
|
|
128
|
+
* be the platform's. The site's ACK is still what really decides — this only spares a 5-second wait
|
|
129
|
+
* where an answer cannot come.
|
|
130
|
+
*/
|
|
131
|
+
declare function canUsePlatformTopUp(): boolean;
|
|
132
|
+
/** Asks the idosgames.com page around the game to top the player's balance up. Never rejects. */
|
|
133
|
+
declare function requestPlatformTopUp(request: PlatformTopUpRequest): Promise<PlatformTopUpResult>;
|
|
134
|
+
|
|
135
|
+
/** Message names. Shared with the website's `PlatformWebGLAuthBridge` — keep both in step. */
|
|
136
|
+
declare const PLATFORM_SIGN_IN_MESSAGES: {
|
|
137
|
+
readonly request: "IDOS_PLATFORM_AUTH_REQUEST";
|
|
138
|
+
readonly response: "IDOS_PLATFORM_AUTH_RESPONSE";
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Whether the page around this game is the platform's own `/app/{id}` page: a frame exactly one level
|
|
142
|
+
* deep (on a foreign site the game sits two frames deep, behind our `/embed` page), not the AI Coder
|
|
143
|
+
* preview, and — where the browser names it — a parent on a platform origin. The site's ACK is still
|
|
144
|
+
* what really decides; this only spares a 5-second wait where an answer cannot come.
|
|
145
|
+
*/
|
|
146
|
+
declare function canUsePlatformSignIn(): boolean;
|
|
147
|
+
/** The page is the AI Coder's live preview inside the dashboard, which can sign the publisher in. */
|
|
148
|
+
declare function canUsePreviewSignIn(): boolean;
|
|
149
|
+
interface PlatformSignInAnswer {
|
|
150
|
+
/** The one-time SSO code — exchange it with `client.auth.loginWithSsoCode`. */
|
|
151
|
+
code?: string;
|
|
152
|
+
/** A game ticket of the app's shared game session — enter with `client.auth.loginWithPlatformGameTicket`. */
|
|
153
|
+
ticket?: string;
|
|
154
|
+
/** Why not: `no_session`, `wrong_title`, `no_title`, `issue_failed`, `TIMEOUT`, `PLATFORM_WALLET_UNAVAILABLE` (no answer). */
|
|
155
|
+
error?: string;
|
|
156
|
+
}
|
|
157
|
+
/** Asks the idosgames.com page around the game for a sign-in code. Never rejects. */
|
|
158
|
+
declare function requestPlatformSignIn(titleID: string): Promise<PlatformSignInAnswer>;
|
|
159
|
+
/**
|
|
160
|
+
* The player signed out of this game themselves: the site must not sign them straight back in on the
|
|
161
|
+
* next visit. Cleared by the next sign-in of any kind (`clearPlatformSignInDeclined`).
|
|
162
|
+
*/
|
|
163
|
+
declare function markPlatformSignInDeclined(titleID: string): void;
|
|
164
|
+
declare function clearPlatformSignInDeclined(titleID: string): void;
|
|
165
|
+
declare function isPlatformSignInDeclined(titleID: string): boolean;
|
|
166
|
+
|
|
167
|
+
/** Message names. Shared with the website's `GameCreditsConfirmBridge` — keep both in step. */
|
|
168
|
+
declare const PLATFORM_CREDITS_CONFIRM_MESSAGES: {
|
|
169
|
+
readonly request: "IDOS_PLATFORM_CREDITS_CONFIRM_REQUEST";
|
|
170
|
+
readonly response: "IDOS_PLATFORM_CREDITS_CONFIRM_RESPONSE";
|
|
171
|
+
};
|
|
172
|
+
interface PlatformCreditsConfirmResult {
|
|
173
|
+
/** The player confirmed the request in the site's window. */
|
|
174
|
+
ok: boolean;
|
|
175
|
+
error?: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Whether the page around the game can be asked at all: one frame deep (the site's `/app/{id}`; behind `/embed`
|
|
179
|
+
* the game is two frames deep and a foreign page could cover our window) and not the AI Coder preview.
|
|
180
|
+
*/
|
|
181
|
+
declare function canUsePlatformCreditsConfirm(): boolean;
|
|
182
|
+
/** Asks the idosgames.com page around the game to confirm the Credits purchase request. Never rejects. */
|
|
183
|
+
declare function requestPlatformCreditsConfirm(request: {
|
|
184
|
+
titleID: string;
|
|
185
|
+
confirmationID: string;
|
|
186
|
+
}): Promise<PlatformCreditsConfirmResult>;
|
|
187
|
+
|
|
188
|
+
export { BrowserPlatformAdapter as B, MemoryStorage as M, NoopPlatformAdapter as N, PLATFORM_BRIDGE_ACK as P, type TelegramInitDataUnsafe as T, BrowserStorage as a, PLATFORM_CREDITS_CONFIRM_MESSAGES as b, PLATFORM_ORIGINS as c, PLATFORM_PAGE_UNAVAILABLE as d, PLATFORM_SIGN_IN_MESSAGES as e, PLATFORM_TOPUP_MESSAGES as f, type PlatformCreditsConfirmResult as g, type PlatformPageAnswer as h, type PlatformSignInAnswer as i, type PlatformTopUpRequest as j, type PlatformTopUpResult as k, type TelegramWebApp as l, askPlatformPage as m, canUsePlatformCreditsConfirm as n, canUsePlatformSignIn as o, canUsePlatformTopUp as p, canUsePreviewSignIn as q, clearPlatformSignInDeclined as r, isPlatformParentOrigin as s, isPlatformSignInDeclined as t, markPlatformSignInDeclined as u, requestPlatformCreditsConfirm as v, requestPlatformSignIn as w, requestPlatformTopUp as x, getTelegramWebApp as y };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { K as KeyValueStorage, P as PlatformAdapter } from './PlatformAdapter-DU_8HalI.cjs';
|
|
2
|
+
|
|
3
|
+
/** localStorage-backed key/value store (replaces Unity PlayerPrefs). Fails soft. */
|
|
4
|
+
declare class BrowserStorage implements KeyValueStorage {
|
|
5
|
+
getString(key: string): string | null;
|
|
6
|
+
setString(key: string, value: string): void;
|
|
7
|
+
remove(key: string): void;
|
|
8
|
+
}
|
|
9
|
+
/** In-memory store for tests / SSR. */
|
|
10
|
+
declare class MemoryStorage implements KeyValueStorage {
|
|
11
|
+
private readonly map;
|
|
12
|
+
getString(key: string): string | null;
|
|
13
|
+
setString(key: string, value: string): void;
|
|
14
|
+
remove(key: string): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Browser/Telegram platform adapter. Auto-detects Telegram WebApp when present. */
|
|
18
|
+
declare class BrowserPlatformAdapter implements PlatformAdapter {
|
|
19
|
+
readonly storage: KeyValueStorage;
|
|
20
|
+
constructor(storage?: KeyValueStorage);
|
|
21
|
+
getPlatform(): string;
|
|
22
|
+
getFullURL(): string;
|
|
23
|
+
getStartParameter(): string | null;
|
|
24
|
+
getReferrer(): string | null;
|
|
25
|
+
getTelegramInitDataRaw(): string | null;
|
|
26
|
+
getDeviceID(): string;
|
|
27
|
+
getDeviceModel(): string;
|
|
28
|
+
shareLink(url: string): void;
|
|
29
|
+
openInvoice(url: string): void;
|
|
30
|
+
showAd(blockId: string): Promise<void>;
|
|
31
|
+
copyToClipboard(text: string): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** No-op adapter for tests and non-browser (SSR) contexts. In-memory storage, no Telegram. */
|
|
35
|
+
declare class NoopPlatformAdapter implements PlatformAdapter {
|
|
36
|
+
readonly storage: KeyValueStorage;
|
|
37
|
+
constructor(storage?: KeyValueStorage);
|
|
38
|
+
getPlatform(): string;
|
|
39
|
+
getFullURL(): string;
|
|
40
|
+
getStartParameter(): string | null;
|
|
41
|
+
getTelegramInitDataRaw(): string | null;
|
|
42
|
+
getDeviceID(): string;
|
|
43
|
+
getDeviceModel(): string;
|
|
44
|
+
shareLink(): void;
|
|
45
|
+
openInvoice(): void;
|
|
46
|
+
showAd(): Promise<void>;
|
|
47
|
+
copyToClipboard(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface TelegramInitDataUnsafe {
|
|
51
|
+
start_param?: string;
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
}
|
|
54
|
+
interface TelegramWebApp {
|
|
55
|
+
platform?: string;
|
|
56
|
+
initData?: string;
|
|
57
|
+
initDataUnsafe?: TelegramInitDataUnsafe;
|
|
58
|
+
openTelegramLink?: (url: string) => void;
|
|
59
|
+
openInvoice?: (url: string, callback?: (status: string) => void) => void;
|
|
60
|
+
}
|
|
61
|
+
declare function getTelegramWebApp(): TelegramWebApp | null;
|
|
62
|
+
|
|
63
|
+
declare const PLATFORM_ORIGINS: readonly string[];
|
|
64
|
+
/**
|
|
65
|
+
* Is `origin` the platform page that framed us — including the local stand?
|
|
66
|
+
*
|
|
67
|
+
* The local allowance is deliberately symmetric: a localhost parent is accepted ONLY while this
|
|
68
|
+
* game is itself served from localhost. A shipped build lives on `{id}.idos.games`, so it answers
|
|
69
|
+
* nothing but the real site — a page on the player's own machine cannot ask it for anything.
|
|
70
|
+
* That is what makes the allowance safe enough to ship, instead of a build-time flag that has to
|
|
71
|
+
* survive four bundlers.
|
|
72
|
+
*
|
|
73
|
+
* On the AI Coder's preview host the parent is the dashboard, and only the dashboard.
|
|
74
|
+
*
|
|
75
|
+
* Use this for bridges a game exposes to its parent. A bridge that must NOT widen its existing
|
|
76
|
+
* behaviour (the wallet's) keeps checking {@link PLATFORM_ORIGINS} directly.
|
|
77
|
+
*/
|
|
78
|
+
declare function isPlatformParentOrigin(origin: string): boolean;
|
|
79
|
+
|
|
80
|
+
/** Sent by the site the moment it receives any bridge request. Shared with the site — keep in step. */
|
|
81
|
+
declare const PLATFORM_BRIDGE_ACK = "IDOS_PLATFORM_WALLET_ACK";
|
|
82
|
+
/**
|
|
83
|
+
* The page around the game did not answer at all — an old site build without the bridge, or a
|
|
84
|
+
* parent that is not the platform. The value is the wallet bridge's historical one, kept as is.
|
|
85
|
+
*/
|
|
86
|
+
declare const PLATFORM_PAGE_UNAVAILABLE = "PLATFORM_WALLET_UNAVAILABLE";
|
|
87
|
+
interface PlatformPageAnswer {
|
|
88
|
+
ok: boolean;
|
|
89
|
+
error?: string;
|
|
90
|
+
/** The answer message as the site sent it — the caller reads its own fields from here. */
|
|
91
|
+
data: Record<string, unknown>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Posts `type` with `payload` to the parent page and resolves with its `responseType` answer.
|
|
95
|
+
* Never rejects: silence, a foreign origin and a refusal all resolve to `{ ok: false }` with a reason.
|
|
96
|
+
*/
|
|
97
|
+
declare function askPlatformPage(type: string, responseType: string, payload: Record<string, unknown>, options?: {
|
|
98
|
+
answerTimeoutMs?: number;
|
|
99
|
+
}): Promise<PlatformPageAnswer>;
|
|
100
|
+
|
|
101
|
+
/** Message names. Shared with the website's `GameWalletLoginBridge` — keep both in step. */
|
|
102
|
+
declare const PLATFORM_TOPUP_MESSAGES: {
|
|
103
|
+
readonly request: "IDOS_PLATFORM_TOPUP_REQUEST";
|
|
104
|
+
readonly response: "IDOS_PLATFORM_TOPUP_RESPONSE";
|
|
105
|
+
};
|
|
106
|
+
interface PlatformTopUpRequest {
|
|
107
|
+
titleID: string;
|
|
108
|
+
/** The game's player. The site refuses when its own session is another account. */
|
|
109
|
+
userID: string;
|
|
110
|
+
currencyID: string;
|
|
111
|
+
/** Tokens to deposit, as an exact decimal string ("12.5"). */
|
|
112
|
+
amount: string;
|
|
113
|
+
}
|
|
114
|
+
interface PlatformTopUpResult {
|
|
115
|
+
/** The deposit is credited to the player's in-game balance. */
|
|
116
|
+
ok: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Why not: `CANCELLED`, `PENDING` (sent, the engine has not credited it yet), `ACCOUNT_MISMATCH`,
|
|
119
|
+
* `NOT_DEPOSITABLE`, `NO_WALLET`, `TIMEOUT`, `PLATFORM_WALLET_UNAVAILABLE`, `BUSY` (a top-up window is already
|
|
120
|
+
* open), `COOLDOWN` (the previous top-up failed less than 30 s ago — the site pauses repeat requests), …
|
|
121
|
+
*/
|
|
122
|
+
error?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Whether this page can ask the site for a top-up at all: it sits in a frame exactly one level deep
|
|
126
|
+
* (the platform's own `/app/{id}` page; on a foreign site the game is two frames deep, behind our
|
|
127
|
+
* `/embed` page) and is not the AI Coder preview. When the browser names the parent's origin, it must
|
|
128
|
+
* be the platform's. The site's ACK is still what really decides — this only spares a 5-second wait
|
|
129
|
+
* where an answer cannot come.
|
|
130
|
+
*/
|
|
131
|
+
declare function canUsePlatformTopUp(): boolean;
|
|
132
|
+
/** Asks the idosgames.com page around the game to top the player's balance up. Never rejects. */
|
|
133
|
+
declare function requestPlatformTopUp(request: PlatformTopUpRequest): Promise<PlatformTopUpResult>;
|
|
134
|
+
|
|
135
|
+
/** Message names. Shared with the website's `PlatformWebGLAuthBridge` — keep both in step. */
|
|
136
|
+
declare const PLATFORM_SIGN_IN_MESSAGES: {
|
|
137
|
+
readonly request: "IDOS_PLATFORM_AUTH_REQUEST";
|
|
138
|
+
readonly response: "IDOS_PLATFORM_AUTH_RESPONSE";
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Whether the page around this game is the platform's own `/app/{id}` page: a frame exactly one level
|
|
142
|
+
* deep (on a foreign site the game sits two frames deep, behind our `/embed` page), not the AI Coder
|
|
143
|
+
* preview, and — where the browser names it — a parent on a platform origin. The site's ACK is still
|
|
144
|
+
* what really decides; this only spares a 5-second wait where an answer cannot come.
|
|
145
|
+
*/
|
|
146
|
+
declare function canUsePlatformSignIn(): boolean;
|
|
147
|
+
/** The page is the AI Coder's live preview inside the dashboard, which can sign the publisher in. */
|
|
148
|
+
declare function canUsePreviewSignIn(): boolean;
|
|
149
|
+
interface PlatformSignInAnswer {
|
|
150
|
+
/** The one-time SSO code — exchange it with `client.auth.loginWithSsoCode`. */
|
|
151
|
+
code?: string;
|
|
152
|
+
/** A game ticket of the app's shared game session — enter with `client.auth.loginWithPlatformGameTicket`. */
|
|
153
|
+
ticket?: string;
|
|
154
|
+
/** Why not: `no_session`, `wrong_title`, `no_title`, `issue_failed`, `TIMEOUT`, `PLATFORM_WALLET_UNAVAILABLE` (no answer). */
|
|
155
|
+
error?: string;
|
|
156
|
+
}
|
|
157
|
+
/** Asks the idosgames.com page around the game for a sign-in code. Never rejects. */
|
|
158
|
+
declare function requestPlatformSignIn(titleID: string): Promise<PlatformSignInAnswer>;
|
|
159
|
+
/**
|
|
160
|
+
* The player signed out of this game themselves: the site must not sign them straight back in on the
|
|
161
|
+
* next visit. Cleared by the next sign-in of any kind (`clearPlatformSignInDeclined`).
|
|
162
|
+
*/
|
|
163
|
+
declare function markPlatformSignInDeclined(titleID: string): void;
|
|
164
|
+
declare function clearPlatformSignInDeclined(titleID: string): void;
|
|
165
|
+
declare function isPlatformSignInDeclined(titleID: string): boolean;
|
|
166
|
+
|
|
167
|
+
/** Message names. Shared with the website's `GameCreditsConfirmBridge` — keep both in step. */
|
|
168
|
+
declare const PLATFORM_CREDITS_CONFIRM_MESSAGES: {
|
|
169
|
+
readonly request: "IDOS_PLATFORM_CREDITS_CONFIRM_REQUEST";
|
|
170
|
+
readonly response: "IDOS_PLATFORM_CREDITS_CONFIRM_RESPONSE";
|
|
171
|
+
};
|
|
172
|
+
interface PlatformCreditsConfirmResult {
|
|
173
|
+
/** The player confirmed the request in the site's window. */
|
|
174
|
+
ok: boolean;
|
|
175
|
+
error?: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Whether the page around the game can be asked at all: one frame deep (the site's `/app/{id}`; behind `/embed`
|
|
179
|
+
* the game is two frames deep and a foreign page could cover our window) and not the AI Coder preview.
|
|
180
|
+
*/
|
|
181
|
+
declare function canUsePlatformCreditsConfirm(): boolean;
|
|
182
|
+
/** Asks the idosgames.com page around the game to confirm the Credits purchase request. Never rejects. */
|
|
183
|
+
declare function requestPlatformCreditsConfirm(request: {
|
|
184
|
+
titleID: string;
|
|
185
|
+
confirmationID: string;
|
|
186
|
+
}): Promise<PlatformCreditsConfirmResult>;
|
|
187
|
+
|
|
188
|
+
export { BrowserPlatformAdapter as B, MemoryStorage as M, NoopPlatformAdapter as N, PLATFORM_BRIDGE_ACK as P, type TelegramInitDataUnsafe as T, BrowserStorage as a, PLATFORM_CREDITS_CONFIRM_MESSAGES as b, PLATFORM_ORIGINS as c, PLATFORM_PAGE_UNAVAILABLE as d, PLATFORM_SIGN_IN_MESSAGES as e, PLATFORM_TOPUP_MESSAGES as f, type PlatformCreditsConfirmResult as g, type PlatformPageAnswer as h, type PlatformSignInAnswer as i, type PlatformTopUpRequest as j, type PlatformTopUpResult as k, type TelegramWebApp as l, askPlatformPage as m, canUsePlatformCreditsConfirm as n, canUsePlatformSignIn as o, canUsePlatformTopUp as p, canUsePreviewSignIn as q, clearPlatformSignInDeclined as r, isPlatformParentOrigin as s, isPlatformSignInDeclined as t, markPlatformSignInDeclined as u, requestPlatformCreditsConfirm as v, requestPlatformSignIn as w, requestPlatformTopUp as x, getTelegramWebApp as y };
|