@orbit-software/sdk 1.86.0 → 1.87.2

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,4 @@
1
+ import { ShowPromiseResult } from '../../types/sdk';
2
+ export declare function showAdsgramAdWithTimeout<T extends boolean>(adsgramAdController: {
3
+ show(): Promise<ShowPromiseResult>;
4
+ } | null): Promise<T>;
@@ -0,0 +1,2 @@
1
+ export declare function initGigapubAds(scriptHtml: string): Promise<void>;
2
+ export declare function showGigapubAd<T extends boolean>(fallback?: () => Promise<boolean>): Promise<T>;
@@ -0,0 +1,3 @@
1
+ export declare function initMonetagAds(monetagHtml: string): Promise<string | null>;
2
+ export declare function createMonetagFallbackFunction(monetagShowAdFnName: string | null): () => Promise<boolean>;
3
+ export declare function showMonetagAdWithTimeout<T extends boolean>(monetagShowAdFnName: string | null, ymid: string): Promise<T>;
@@ -0,0 +1,16 @@
1
+ export declare class APIRequestError extends Error {
2
+ status: number;
3
+ responseText: string | undefined;
4
+ constructor({ message, status, responseText, }: {
5
+ message: string;
6
+ status: number;
7
+ responseText: string | undefined;
8
+ });
9
+ }
10
+ export interface MakeRequestConfig {
11
+ baseUrl: string;
12
+ getAuthData: () => string | null;
13
+ getBotId: () => string | null;
14
+ getInitData: () => string;
15
+ }
16
+ export declare function createMakeRequest(config: MakeRequestConfig): <T>(path: string, method: "POST" | "GET" | "PUT" | "DELETE", body?: unknown) => Promise<T>;
@@ -0,0 +1 @@
1
+ export declare function initSentry(): void;
package/dist/esm/sdk.d.ts CHANGED
@@ -1,272 +1,7 @@
1
- import { InventoryItem, ServiceInvoiceCreatedResponse } from './types/api';
2
- interface CloudStorageValueValidationResult {
3
- isValid: boolean;
4
- error?: string;
5
- byteSize?: number;
6
- characterCount?: number;
7
- }
8
- /**
9
- * Валидирует значение для Telegram CloudStorage
10
- * Проверяет:
11
- * - Максимальный размер в байтах: 4096 байт (не символов!)
12
- * - Корректная UTF-8 кодировка
13
- * - Отсутствие нулевых байтов и проблемных управляющих символов
14
- */
15
- export declare function validateCloudStorageValue(value: string): CloudStorageValueValidationResult;
1
+ import { AdsgramController, AdsgramInitOptions, CryptoSteamSDK as CryptoSteamSDKType, TMANetworkInterstitialResponse } from './types/sdk';
16
2
  export declare const BASE_URL = "https://app.portalapp.games/sdk";
17
- interface LaunchResponse {
18
- tma_ads_key: string;
19
- ads?: {
20
- type: 'tma' | 'monetag' | 'adsgram';
21
- tmaAdsKey?: string;
22
- monetag?: string;
23
- adsgram?: string;
24
- };
25
- ads_last_showed: string | Date;
26
- is_ad_cooldown: boolean;
27
- launched: number;
28
- total_launches: number;
29
- }
30
- export declare class APIRequestError extends Error {
31
- status: number;
32
- responseText: string | undefined;
33
- constructor({ message, status, responseText, }: {
34
- message: string;
35
- status: number;
36
- responseText: string | undefined;
37
- });
38
- }
39
- export declare function makeRequest<T>(path: string, method: 'POST' | 'GET' | 'PUT' | 'DELETE', body?: any): Promise<T>;
40
- export interface CryptoSteamSDKConfig {
41
- supported_screen_formats: ('landscape' | 'portrait' | 'fullscreen')[];
42
- supported_devices: string[];
43
- title: string;
44
- app_url: string;
45
- }
46
- export type Audience = 'start_page_default' | 'start_page_few_ads' | 'start_page_no_ads' | 'start_page_games' | 'banner_test';
47
- export interface ProfileBalances {
48
- coins: number;
49
- gems: number;
50
- ny2026_tickets: number;
51
- usdt: number;
52
- }
53
- export interface CryptoSteamSDKProfile {
54
- id: number;
55
- avatar_ug: string;
56
- user_name: string;
57
- first_name: string;
58
- last_name: string;
59
- language: string;
60
- email: string;
61
- email_confirmed: boolean;
62
- phone_number: string;
63
- location: string;
64
- background_color: string;
65
- override_ads: boolean;
66
- ton_address: string;
67
- audiences: Audience[];
68
- is_premium: boolean;
69
- allows_write_to_pm: boolean;
70
- ads_disabled_until?: string;
71
- created: string;
72
- updated: string;
73
- avatar: string;
74
- birth_date: string;
75
- balance_gems: number;
76
- balance_coins: number;
77
- experience: number;
78
- balance_usdt: number;
79
- minimum_usdt_withdraw: number;
80
- level: number;
81
- level_up_exp: number;
82
- invited: number;
83
- invited_full: number;
84
- games_count: number;
85
- ads_free: boolean;
86
- is_admin: boolean;
87
- inventory: InventoryItem[];
88
- game_id?: number | string;
89
- onboarding: boolean;
90
- review_stats: {
91
- total: number;
92
- with_comments: number;
93
- };
94
- balances: ProfileBalances;
95
- }
96
- export interface CryptoSteamSDKShopItem {
97
- id: number;
98
- name: string;
99
- description: string;
100
- price: number;
101
- created: string;
102
- updated: string;
103
- }
104
- export declare enum CryptoSteamSDKAdMediaType {
105
- Image = "image",
106
- Gif = "gif",
107
- Video = "video"
108
- }
109
- export interface CryptoSteamSDKAd {
110
- is_available: boolean;
111
- url?: string;
112
- mediaType?: CryptoSteamSDKAdMediaType;
113
- durationS?: number;
114
- }
115
- export interface CryptoSteamSDKWage {
116
- active_wages: {
117
- current_value: number;
118
- id: number;
119
- max_value: number;
120
- price: number;
121
- started_at: string;
122
- time_limit: string;
123
- title: string;
124
- type_id: number;
125
- }[];
126
- available_wages: {
127
- current_value: number;
128
- id: number;
129
- max_value: number;
130
- price: number;
131
- started_at: string;
132
- time_limit: string;
133
- title: string;
134
- type_id: number;
135
- }[];
136
- claimable_wages: {
137
- current_value: number;
138
- id: number;
139
- max_value: number;
140
- price: number;
141
- started_at: string;
142
- time_limit: string;
143
- title: string;
144
- type_id: number;
145
- }[];
146
- }
147
- export interface OverlayConfig {
148
- onOverlayOpen?: () => void;
149
- onOverlayClose?: () => void;
150
- variant?: 'light' | 'dark' | 'translucent';
151
- initialPosition?: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
152
- botId?: string;
153
- authData?: string;
154
- }
155
- export interface CryptoSteamSDKTask {
156
- id: number;
157
- title: string;
158
- description: string;
159
- reward: number;
160
- group?: string;
161
- group_position?: number;
162
- sub_title?: string;
163
- is_claimable: boolean;
164
- is_done: boolean;
165
- }
166
- interface PurchaseConfirmResponse {
167
- status: 'success' | 'error';
168
- }
169
- interface TelegramCloudStorage {
170
- getValue: (key: string) => Promise<string | null>;
171
- setValue: (key: string, value: string) => Promise<boolean | null>;
172
- removeValue: (key: string) => Promise<boolean | null>;
173
- }
174
- interface TMANetworkInterstitialResponse {
175
- id: string;
176
- reward: boolean;
177
- }
178
- interface ShowPromiseResult {
179
- done: boolean;
180
- description: string;
181
- state: 'load' | 'render' | 'playing' | 'destroy';
182
- error: boolean;
183
- }
184
- interface AdsgramController {
185
- show(): Promise<ShowPromiseResult>;
186
- }
187
- interface AdsgramInitOptions {
188
- blockId: string;
189
- }
190
- interface BalanceResponse {
191
- balance: number;
192
- balance_gems: number;
193
- balance_coins: number;
194
- }
195
- export type AdType = 'REWARD' | 'INTERSTITIAL';
196
- export interface RequestAdOptions {
197
- onStart?: () => void;
198
- }
199
- interface RequestWageValueParams {
200
- wageId: number;
201
- value: number;
202
- }
203
- export interface InitializeOptions {
204
- mode: 'portal';
205
- authData?: string;
206
- disable_startup_ads?: boolean;
207
- }
208
- export interface StartupConfig {
209
- /**
210
- * @deprecated This field is no longer supported. Fullscreen configuration is now done through Portal.
211
- */
212
- isFullscreen: boolean;
213
- overlayPosition: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
214
- }
3
+ export declare const makeRequest: <T>(path: string, method: "POST" | "GET" | "PUT" | "DELETE", body?: unknown) => Promise<T>;
215
4
  export declare function startGameTimeTrack(): void;
216
- export interface CryptoSteamSDK {
217
- version: string;
218
- onAdStart: (() => void) | null;
219
- onAdEnd: ((result: boolean) => void) | null;
220
- initialize: (botId?: string, options?: InitializeOptions) => Promise<void>;
221
- getConfig: () => Promise<CryptoSteamSDKConfig>;
222
- isAdEnabled: () => Promise<boolean>;
223
- requestAd: (options?: RequestAdOptions) => Promise<boolean>;
224
- requestRewardAd: (options?: RequestAdOptions) => Promise<boolean>;
225
- getProfile: () => Promise<CryptoSteamSDKProfile>;
226
- getBalance: () => Promise<BalanceResponse>;
227
- getWages: () => Promise<CryptoSteamSDKWage>;
228
- claimWage: (id: number) => Promise<void>;
229
- startWage: (id: number) => Promise<void>;
230
- setValueWage: (params: RequestWageValueParams) => Promise<void>;
231
- trackGameTimeTick: () => void;
232
- getVersion: () => string;
233
- initializeOverlay: (config?: OverlayConfig) => void;
234
- getShopItems: () => Promise<CryptoSteamSDKShopItem[]>;
235
- getPurchasedShopItem: (itemId: number) => Promise<CryptoSteamSDKShopItem>;
236
- getPurchasedShopItems: () => Promise<CryptoSteamSDKShopItem[]>;
237
- buyShopItem: (itemId: number) => Promise<void>;
238
- openPurchaseConfirmModal: (shopItem: CryptoSteamSDKShopItem, rect?: {
239
- x: number;
240
- y: number;
241
- width: number;
242
- height: number;
243
- }) => Promise<PurchaseConfirmResponse>;
244
- createInvoice: (title: string, description: string, to_user_id: number, amount: number) => Promise<ServiceInvoiceCreatedResponse>;
245
- getValue: (key: string) => Promise<string>;
246
- setValue: (key: string, value: string) => Promise<void>;
247
- /**
248
- * @deprecated
249
- * @param key
250
- */
251
- getData: (key: string) => Promise<string>;
252
- /**
253
- * @deprecated
254
- * @param key
255
- * @param value
256
- */
257
- setData: (key: string, value: string) => Promise<void>;
258
- removeValue: (key: string) => Promise<void>;
259
- getAllKeyValues: () => Promise<Record<string, string>>;
260
- getLocale: () => string;
261
- showSharing: (url: string, text?: string) => void;
262
- telegramCloudStorage: TelegramCloudStorage;
263
- gameReady: () => void;
264
- getAdsgramController: () => AdsgramController | null;
265
- getLaunchResponse: () => LaunchResponse | null;
266
- isLaunchedFromPortal: () => boolean;
267
- setBottomBanner: () => void;
268
- clearBottomBanner: () => void;
269
- }
270
5
  declare global {
271
6
  interface Window {
272
7
  [key: string]: any;
@@ -280,6 +15,7 @@ declare global {
280
15
  Adsgram: {
281
16
  init: (options: AdsgramInitOptions) => AdsgramController;
282
17
  };
18
+ showGiga: () => Promise<void>;
283
19
  }
284
20
  }
285
21
  declare global {
@@ -290,17 +26,8 @@ declare global {
290
26
  }
291
27
  }
292
28
  }
293
- declare const CryptoSteamSDK: CryptoSteamSDK;
29
+ declare const CryptoSteamSDK: CryptoSteamSDKType;
294
30
  export default CryptoSteamSDK;
295
31
  export { CryptoSteamSDK as PortalSDK };
296
32
  export declare const TelegramWebApp: import('@twa-dev/types').WebApp;
297
- export type { ShowPromiseResult };
298
- export interface PortalEmuSDK {
299
- isAdRunning: () => boolean;
300
- getValueSync: (key: string) => string;
301
- setValueSync: (key: string, value: string) => void;
302
- removeValueSync: (key: string) => Promise<void>;
303
- reloadAd: () => void;
304
- getStartParam: () => string;
305
- requestAd: () => Promise<void>;
306
- }
33
+ export type { AdType, Audience, CryptoSteamSDK, CryptoSteamSDKAd, CryptoSteamSDKAdMediaType, CryptoSteamSDKConfig, CryptoSteamSDKProfile, CryptoSteamSDKShopItem, CryptoSteamSDKTask, CryptoSteamSDKWage, InitializeOptions, OverlayConfig, PortalEmuSDK, ProfileBalances, RequestAdOptions, ShowPromiseResult, StartupConfig, } from './types/sdk';