@idosgames/core 0.22.0 → 0.23.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.
@@ -1,2 +1,2 @@
1
- 'use strict';var i=class{getString(e){if(typeof localStorage>"u")return null;try{return localStorage.getItem(e)}catch{return null}}setString(e,r){if(!(typeof localStorage>"u"))try{localStorage.setItem(e,r);}catch{}}remove(e){if(!(typeof localStorage>"u"))try{localStorage.removeItem(e);}catch{}}},s=class{map=new Map;getString(e){return this.map.get(e)??null}setString(e,r){this.map.set(e,r);}remove(e){this.map.delete(e);}};function n(){return globalThis.Telegram?.WebApp??null}function I(){return crypto.randomUUID()}var S="idos_device_id",m=class{storage;constructor(e=new i){this.storage=e;}getPlatform(){return n()?.platform??"Web"}getFullURL(){return typeof location<"u"?location.href:""}getStartParameter(){let e=n()?.initDataUnsafe?.start_param;return typeof e=="string"?e:null}getReferrer(){if(typeof document>"u")return null;let e=document.referrer;return e&&e.length>0?e:null}getTelegramInitDataRaw(){let e=n()?.initData;return e&&e.length>0?e:null}getDeviceID(){let e=this.storage.getString(S);return e||(e=I(),this.storage.setString(S,e)),e}getDeviceModel(){return typeof navigator<"u"&&navigator.userAgent?navigator.userAgent:"Web"}shareLink(e){let r=n();if(r?.openTelegramLink){r.openTelegramLink(e);return}typeof window<"u"&&window.open(e,"_blank");}openInvoice(e){let r=n();if(r?.openInvoice){r.openInvoice(e);return}typeof window<"u"&&window.open(e,"_blank");}async showAd(e){let r=globalThis;typeof r.showAd=="function"&&await r.showAd(e);}async copyToClipboard(e){typeof navigator<"u"&&navigator.clipboard&&await navigator.clipboard.writeText(e);}};var _="idos_device_id",d=class{storage;constructor(e=new s){this.storage=e;}getPlatform(){return "Web"}getFullURL(){return ""}getStartParameter(){return null}getTelegramInitDataRaw(){return null}getDeviceID(){let e=this.storage.getString(_);return e||(e="noop-device",this.storage.setString(_,e)),e}getDeviceModel(){return "Noop"}shareLink(){}openInvoice(){}async showAd(){}async copyToClipboard(){}};var g=["https://idosgames.com","https://www.idosgames.com"];function v(t){return t==="localhost"||t==="127.0.0.1"||t==="[::1]"||t.endsWith(".localhost")}function p(t){if(g.includes(t))return true;if(typeof window>"u"||!v(window.location.hostname))return false;try{return v(new URL(t).hostname)}catch{return false}}var R="IDOS_PLATFORM_WALLET_ACK",U="PLATFORM_WALLET_UNAVAILABLE",h=5e3,E=18e4;function M(){let t=[...g],e=window.location.ancestorOrigins?.[0];return e&&!t.includes(e)&&p(e)&&t.push(e),t}function x(){return `wallet-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function c(t,e,r,D={}){let u={ok:false,error:U,data:{}};if(typeof window>"u"||window.self===window.top)return Promise.resolve(u);let P=window.parent;if(!P)return Promise.resolve(u);let T=x(),L=D.answerTimeoutMs??E;return new Promise(O=>{let A=false,l,f=a=>{A||(A=true,window.removeEventListener("message",y),clearTimeout(l),O(a));},y=a=>{if(!p(a.origin))return;let o=a.data;if(!(!o||o.requestId!==T)){if(o.type===R){clearTimeout(l),l=setTimeout(()=>f({ok:false,error:"TIMEOUT",data:{}}),L);return}o.type===e&&f({ok:o.ok===true,error:typeof o.error=="string"?o.error:void 0,data:o});}};l=setTimeout(()=>f(u),h),window.addEventListener("message",y);for(let a of M())try{P.postMessage({type:t,requestId:T,...r},a);}catch{}})}var w={request:"IDOS_PLATFORM_TOPUP_REQUEST",response:"IDOS_PLATFORM_TOPUP_RESPONSE"},k=15*6e4,b=/^[a-z0-9]{8}-preview\.idos\.games$/;function W(){if(typeof window>"u")return false;try{if(window.self===window.top||window.parent!==window.top)return !1}catch{return false}return !b.test(window.location.hostname.toLowerCase())}async function F(t){let e=await c(w.request,w.response,{titleID:t.titleID,userID:t.userID,currencyID:t.currencyID,amount:t.amount},{answerTimeoutMs:k});return e.ok?{ok:true}:{ok:false,error:e.error}}
2
- exports.BrowserPlatformAdapter=m;exports.BrowserStorage=i;exports.MemoryStorage=s;exports.NoopPlatformAdapter=d;exports.PLATFORM_BRIDGE_ACK=R;exports.PLATFORM_ORIGINS=g;exports.PLATFORM_PAGE_UNAVAILABLE=U;exports.PLATFORM_TOPUP_MESSAGES=w;exports.askPlatformPage=c;exports.canUsePlatformTopUp=W;exports.getTelegramWebApp=n;exports.isPlatformParentOrigin=p;exports.requestPlatformTopUp=F;
1
+ 'use strict';var s=class{getString(e){if(typeof localStorage>"u")return null;try{return localStorage.getItem(e)}catch{return null}}setString(e,r){if(!(typeof localStorage>"u"))try{localStorage.setItem(e,r);}catch{}}remove(e){if(!(typeof localStorage>"u"))try{localStorage.removeItem(e);}catch{}}},l=class{map=new Map;getString(e){return this.map.get(e)??null}setString(e,r){this.map.set(e,r);}remove(e){this.map.delete(e);}};function o(){return globalThis.Telegram?.WebApp??null}function y(){return crypto.randomUUID()}var R="idos_device_id",c=class{storage;constructor(e=new s){this.storage=e;}getPlatform(){return o()?.platform??"Web"}getFullURL(){return typeof location<"u"?location.href:""}getStartParameter(){let e=o()?.initDataUnsafe?.start_param;return typeof e=="string"?e:null}getReferrer(){if(typeof document>"u")return null;let e=document.referrer;return e&&e.length>0?e:null}getTelegramInitDataRaw(){let e=o()?.initData;return e&&e.length>0?e:null}getDeviceID(){let e=this.storage.getString(R);return e||(e=y(),this.storage.setString(R,e)),e}getDeviceModel(){return typeof navigator<"u"&&navigator.userAgent?navigator.userAgent:"Web"}shareLink(e){let r=o();if(r?.openTelegramLink){r.openTelegramLink(e);return}typeof window<"u"&&window.open(e,"_blank");}openInvoice(e){let r=o();if(r?.openInvoice){r.openInvoice(e);return}typeof window<"u"&&window.open(e,"_blank");}async showAd(e){let r=globalThis;typeof r.showAd=="function"&&await r.showAd(e);}async copyToClipboard(e){typeof navigator<"u"&&navigator.clipboard&&await navigator.clipboard.writeText(e);}};var E="idos_device_id",d=class{storage;constructor(e=new l){this.storage=e;}getPlatform(){return "Web"}getFullURL(){return ""}getStartParameter(){return null}getTelegramInitDataRaw(){return null}getDeviceID(){let e=this.storage.getString(E);return e||(e="noop-device",this.storage.setString(E,e)),e}getDeviceModel(){return "Noop"}shareLink(){}openInvoice(){}async showAd(){}async copyToClipboard(){}};var i=["https://idosgames.com","https://www.idosgames.com"];function v(t){return t==="localhost"||t==="127.0.0.1"||t==="[::1]"||t.endsWith(".localhost")}function p(t){if(i.includes(t))return true;if(typeof window>"u"||!v(window.location.hostname))return false;try{return v(new URL(t).hostname)}catch{return false}}var O="IDOS_PLATFORM_WALLET_ACK",D="PLATFORM_WALLET_UNAVAILABLE",M=5e3,x=18e4;function k(){let t=[...i],e=window.location.ancestorOrigins?.[0];return e&&!t.includes(e)&&p(e)&&t.push(e),t}function b(){return `wallet-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function g(t,e,r,U={}){let u={ok:false,error:D,data:{}};if(typeof window>"u"||window.self===window.top)return Promise.resolve(u);let S=window.parent;if(!S)return Promise.resolve(u);let I=b(),h=U.answerTimeoutMs??x;return new Promise(L=>{let A=false,f,m=a=>{A||(A=true,window.removeEventListener("message",_),clearTimeout(f),L(a));},_=a=>{if(!p(a.origin))return;let n=a.data;if(!(!n||n.requestId!==I)){if(n.type===O){clearTimeout(f),f=setTimeout(()=>m({ok:false,error:"TIMEOUT",data:{}}),h);return}n.type===e&&m({ok:n.ok===true,error:typeof n.error=="string"?n.error:void 0,data:n});}};f=setTimeout(()=>m(u),M),window.addEventListener("message",_);for(let a of k())try{S.postMessage({type:t,requestId:I,...r},a);}catch{}})}var w={request:"IDOS_PLATFORM_TOPUP_REQUEST",response:"IDOS_PLATFORM_TOPUP_RESPONSE"},F=15*6e4,N=/^[a-z0-9]{8}-preview\.idos\.games$/;function W(){if(typeof window>"u")return false;try{if(window.self===window.top||window.parent!==window.top)return !1}catch{return false}return !N.test(window.location.hostname.toLowerCase())}async function K(t){let e=await g(w.request,w.response,{titleID:t.titleID,userID:t.userID,currencyID:t.currencyID,amount:t.amount},{answerTimeoutMs:F});return e.ok?{ok:true}:{ok:false,error:e.error}}var P={request:"IDOS_PLATFORM_AUTH_REQUEST",response:"IDOS_PLATFORM_AUTH_RESPONSE"},V=30*6e4,G=/^[a-z0-9]{8}-preview\.idos\.games$/,T="idos:platformSignIn:declined:";function q(){if(typeof window>"u")return false;try{if(window.self===window.top||window.parent!==window.top)return !1}catch{return false}if(G.test(window.location.hostname.toLowerCase()))return false;let t=window.location.ancestorOrigins?.[0];if(t&&!i.includes(t))try{let e=new URL(t).hostname;if(e!=="localhost"&&e!=="127.0.0.1")return !1}catch{return false}return true}async function C(t){let e=await g(P.request,P.response,{titleID:t},{answerTimeoutMs:V}),r=e.data.code;return e.ok&&typeof r=="string"&&r.length>0?{code:r}:{error:e.error??"no_code"}}function B(t){try{window.localStorage.setItem(T+t,"1");}catch{}}function H(t){try{window.localStorage.removeItem(T+t);}catch{}}function $(t){try{return window.localStorage.getItem(T+t)==="1"}catch{return false}}
2
+ exports.BrowserPlatformAdapter=c;exports.BrowserStorage=s;exports.MemoryStorage=l;exports.NoopPlatformAdapter=d;exports.PLATFORM_BRIDGE_ACK=O;exports.PLATFORM_ORIGINS=i;exports.PLATFORM_PAGE_UNAVAILABLE=D;exports.PLATFORM_SIGN_IN_MESSAGES=P;exports.PLATFORM_TOPUP_MESSAGES=w;exports.askPlatformPage=g;exports.canUsePlatformSignIn=q;exports.canUsePlatformTopUp=W;exports.clearPlatformSignInDeclined=H;exports.getTelegramWebApp=o;exports.isPlatformParentOrigin=p;exports.isPlatformSignInDeclined=$;exports.markPlatformSignInDeclined=B;exports.requestPlatformSignIn=C;exports.requestPlatformTopUp=K;
@@ -130,4 +130,32 @@ declare function canUsePlatformTopUp(): boolean;
130
130
  /** Asks the idosgames.com page around the game to top the player's balance up. Never rejects. */
131
131
  declare function requestPlatformTopUp(request: PlatformTopUpRequest): Promise<PlatformTopUpResult>;
132
132
 
133
- export { BrowserPlatformAdapter, BrowserStorage, KeyValueStorage, MemoryStorage, NoopPlatformAdapter, PLATFORM_BRIDGE_ACK, PLATFORM_ORIGINS, PLATFORM_PAGE_UNAVAILABLE, PLATFORM_TOPUP_MESSAGES, PlatformAdapter, type PlatformPageAnswer, type PlatformTopUpRequest, type PlatformTopUpResult, type TelegramInitDataUnsafe, type TelegramWebApp, askPlatformPage, canUsePlatformTopUp, getTelegramWebApp, isPlatformParentOrigin, requestPlatformTopUp };
133
+ /** Message names. Shared with the website's `PlatformWebGLAuthBridge` — keep both in step. */
134
+ declare const PLATFORM_SIGN_IN_MESSAGES: {
135
+ readonly request: "IDOS_PLATFORM_AUTH_REQUEST";
136
+ readonly response: "IDOS_PLATFORM_AUTH_RESPONSE";
137
+ };
138
+ /**
139
+ * Whether the page around this game is the platform's own `/app/{id}` page: a frame exactly one level
140
+ * deep (on a foreign site the game sits two frames deep, behind our `/embed` page), not the AI Coder
141
+ * preview, and — where the browser names it — a parent on a platform origin. The site's ACK is still
142
+ * what really decides; this only spares a 5-second wait where an answer cannot come.
143
+ */
144
+ declare function canUsePlatformSignIn(): boolean;
145
+ interface PlatformSignInAnswer {
146
+ /** The one-time SSO code — exchange it with `client.auth.loginWithSsoCode`. */
147
+ code?: string;
148
+ /** Why not: `no_session`, `wrong_title`, `no_title`, `issue_failed`, `TIMEOUT`, `PLATFORM_WALLET_UNAVAILABLE` (no answer). */
149
+ error?: string;
150
+ }
151
+ /** Asks the idosgames.com page around the game for a sign-in code. Never rejects. */
152
+ declare function requestPlatformSignIn(titleID: string): Promise<PlatformSignInAnswer>;
153
+ /**
154
+ * The player signed out of this game themselves: the site must not sign them straight back in on the
155
+ * next visit. Cleared by the next sign-in of any kind (`clearPlatformSignInDeclined`).
156
+ */
157
+ declare function markPlatformSignInDeclined(titleID: string): void;
158
+ declare function clearPlatformSignInDeclined(titleID: string): void;
159
+ declare function isPlatformSignInDeclined(titleID: string): boolean;
160
+
161
+ export { BrowserPlatformAdapter, BrowserStorage, KeyValueStorage, MemoryStorage, NoopPlatformAdapter, PLATFORM_BRIDGE_ACK, PLATFORM_ORIGINS, PLATFORM_PAGE_UNAVAILABLE, PLATFORM_SIGN_IN_MESSAGES, PLATFORM_TOPUP_MESSAGES, PlatformAdapter, type PlatformPageAnswer, type PlatformSignInAnswer, type PlatformTopUpRequest, type PlatformTopUpResult, type TelegramInitDataUnsafe, type TelegramWebApp, askPlatformPage, canUsePlatformSignIn, canUsePlatformTopUp, clearPlatformSignInDeclined, getTelegramWebApp, isPlatformParentOrigin, isPlatformSignInDeclined, markPlatformSignInDeclined, requestPlatformSignIn, requestPlatformTopUp };
@@ -130,4 +130,32 @@ declare function canUsePlatformTopUp(): boolean;
130
130
  /** Asks the idosgames.com page around the game to top the player's balance up. Never rejects. */
131
131
  declare function requestPlatformTopUp(request: PlatformTopUpRequest): Promise<PlatformTopUpResult>;
132
132
 
133
- export { BrowserPlatformAdapter, BrowserStorage, KeyValueStorage, MemoryStorage, NoopPlatformAdapter, PLATFORM_BRIDGE_ACK, PLATFORM_ORIGINS, PLATFORM_PAGE_UNAVAILABLE, PLATFORM_TOPUP_MESSAGES, PlatformAdapter, type PlatformPageAnswer, type PlatformTopUpRequest, type PlatformTopUpResult, type TelegramInitDataUnsafe, type TelegramWebApp, askPlatformPage, canUsePlatformTopUp, getTelegramWebApp, isPlatformParentOrigin, requestPlatformTopUp };
133
+ /** Message names. Shared with the website's `PlatformWebGLAuthBridge` — keep both in step. */
134
+ declare const PLATFORM_SIGN_IN_MESSAGES: {
135
+ readonly request: "IDOS_PLATFORM_AUTH_REQUEST";
136
+ readonly response: "IDOS_PLATFORM_AUTH_RESPONSE";
137
+ };
138
+ /**
139
+ * Whether the page around this game is the platform's own `/app/{id}` page: a frame exactly one level
140
+ * deep (on a foreign site the game sits two frames deep, behind our `/embed` page), not the AI Coder
141
+ * preview, and — where the browser names it — a parent on a platform origin. The site's ACK is still
142
+ * what really decides; this only spares a 5-second wait where an answer cannot come.
143
+ */
144
+ declare function canUsePlatformSignIn(): boolean;
145
+ interface PlatformSignInAnswer {
146
+ /** The one-time SSO code — exchange it with `client.auth.loginWithSsoCode`. */
147
+ code?: string;
148
+ /** Why not: `no_session`, `wrong_title`, `no_title`, `issue_failed`, `TIMEOUT`, `PLATFORM_WALLET_UNAVAILABLE` (no answer). */
149
+ error?: string;
150
+ }
151
+ /** Asks the idosgames.com page around the game for a sign-in code. Never rejects. */
152
+ declare function requestPlatformSignIn(titleID: string): Promise<PlatformSignInAnswer>;
153
+ /**
154
+ * The player signed out of this game themselves: the site must not sign them straight back in on the
155
+ * next visit. Cleared by the next sign-in of any kind (`clearPlatformSignInDeclined`).
156
+ */
157
+ declare function markPlatformSignInDeclined(titleID: string): void;
158
+ declare function clearPlatformSignInDeclined(titleID: string): void;
159
+ declare function isPlatformSignInDeclined(titleID: string): boolean;
160
+
161
+ export { BrowserPlatformAdapter, BrowserStorage, KeyValueStorage, MemoryStorage, NoopPlatformAdapter, PLATFORM_BRIDGE_ACK, PLATFORM_ORIGINS, PLATFORM_PAGE_UNAVAILABLE, PLATFORM_SIGN_IN_MESSAGES, PLATFORM_TOPUP_MESSAGES, PlatformAdapter, type PlatformPageAnswer, type PlatformSignInAnswer, type PlatformTopUpRequest, type PlatformTopUpResult, type TelegramInitDataUnsafe, type TelegramWebApp, askPlatformPage, canUsePlatformSignIn, canUsePlatformTopUp, clearPlatformSignInDeclined, getTelegramWebApp, isPlatformParentOrigin, isPlatformSignInDeclined, markPlatformSignInDeclined, requestPlatformSignIn, requestPlatformTopUp };
@@ -1 +1 @@
1
- export{e as BrowserPlatformAdapter,a as BrowserStorage,b as MemoryStorage,n as NoopPlatformAdapter,h as PLATFORM_BRIDGE_ACK,f as PLATFORM_ORIGINS,i as PLATFORM_PAGE_UNAVAILABLE,k as PLATFORM_TOPUP_MESSAGES,j as askPlatformPage,l as canUsePlatformTopUp,c as getTelegramWebApp,g as isPlatformParentOrigin,m as requestPlatformTopUp}from'../chunk-YEBYHDZG.js';
1
+ export{e as BrowserPlatformAdapter,a as BrowserStorage,b as MemoryStorage,n as NoopPlatformAdapter,h as PLATFORM_BRIDGE_ACK,f as PLATFORM_ORIGINS,i as PLATFORM_PAGE_UNAVAILABLE,o as PLATFORM_SIGN_IN_MESSAGES,k as PLATFORM_TOPUP_MESSAGES,j as askPlatformPage,p as canUsePlatformSignIn,l as canUsePlatformTopUp,s as clearPlatformSignInDeclined,c as getTelegramWebApp,g as isPlatformParentOrigin,t as isPlatformSignInDeclined,r as markPlatformSignInDeclined,q as requestPlatformSignIn,m as requestPlatformTopUp}from'../chunk-ZR2KDXJV.js';
@@ -1,5 +1,5 @@
1
- import { I as IceServer } from '../VoiceController-C6b08lqX.cjs';
2
- export { C as ChannelName, M as MemberLeftKind, a as MicMode, R as RealtimeClient, b as RealtimeSession, c as RealtimeSessionEvents, d as RealtimeSessionOptions, V as VoiceController, e as VoiceControllerEvents, f as VoiceControllerOptions } from '../VoiceController-C6b08lqX.cjs';
1
+ import { I as IceServer } from '../VoiceController-BOiBH9Jd.cjs';
2
+ export { C as ChannelName, M as MemberLeftKind, a as MicMode, R as RealtimeClient, b as RealtimeSession, c as RealtimeSessionEvents, d as RealtimeSessionOptions, V as VoiceController, e as VoiceControllerEvents, f as VoiceControllerOptions } from '../VoiceController-BOiBH9Jd.cjs';
3
3
  import 'zod';
4
4
  import '../PlatformAdapter-DU_8HalI.cjs';
5
5
  import 'decimal.js';
@@ -1,5 +1,5 @@
1
- import { I as IceServer } from '../VoiceController-DeqV4QI0.js';
2
- export { C as ChannelName, M as MemberLeftKind, a as MicMode, R as RealtimeClient, b as RealtimeSession, c as RealtimeSessionEvents, d as RealtimeSessionOptions, V as VoiceController, e as VoiceControllerEvents, f as VoiceControllerOptions } from '../VoiceController-DeqV4QI0.js';
1
+ import { I as IceServer } from '../VoiceController-Cx6eziQG.js';
2
+ export { C as ChannelName, M as MemberLeftKind, a as MicMode, R as RealtimeClient, b as RealtimeSession, c as RealtimeSessionEvents, d as RealtimeSessionOptions, V as VoiceController, e as VoiceControllerEvents, f as VoiceControllerOptions } from '../VoiceController-Cx6eziQG.js';
3
3
  import 'zod';
4
4
  import '../PlatformAdapter-DU_8HalI.js';
5
5
  import 'decimal.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idosgames/core",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "Engine-agnostic core of the IDosGames SDK (transport, auth, cache, services, events).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,2 +0,0 @@
1
- var i=class{getString(e){if(typeof localStorage>"u")return null;try{return localStorage.getItem(e)}catch{return null}}setString(e,r){if(!(typeof localStorage>"u"))try{localStorage.setItem(e,r);}catch{}}remove(e){if(!(typeof localStorage>"u"))try{localStorage.removeItem(e);}catch{}}},s=class{map=new Map;getString(e){return this.map.get(e)??null}setString(e,r){this.map.set(e,r);}remove(e){this.map.delete(e);}};function n(){return globalThis.Telegram?.WebApp??null}function I(){return crypto.randomUUID()}var S="idos_device_id",m=class{storage;constructor(e=new i){this.storage=e;}getPlatform(){return n()?.platform??"Web"}getFullURL(){return typeof location<"u"?location.href:""}getStartParameter(){let e=n()?.initDataUnsafe?.start_param;return typeof e=="string"?e:null}getReferrer(){if(typeof document>"u")return null;let e=document.referrer;return e&&e.length>0?e:null}getTelegramInitDataRaw(){let e=n()?.initData;return e&&e.length>0?e:null}getDeviceID(){let e=this.storage.getString(S);return e||(e=I(),this.storage.setString(S,e)),e}getDeviceModel(){return typeof navigator<"u"&&navigator.userAgent?navigator.userAgent:"Web"}shareLink(e){let r=n();if(r?.openTelegramLink){r.openTelegramLink(e);return}typeof window<"u"&&window.open(e,"_blank");}openInvoice(e){let r=n();if(r?.openInvoice){r.openInvoice(e);return}typeof window<"u"&&window.open(e,"_blank");}async showAd(e){let r=globalThis;typeof r.showAd=="function"&&await r.showAd(e);}async copyToClipboard(e){typeof navigator<"u"&&navigator.clipboard&&await navigator.clipboard.writeText(e);}};var _="idos_device_id",d=class{storage;constructor(e=new s){this.storage=e;}getPlatform(){return "Web"}getFullURL(){return ""}getStartParameter(){return null}getTelegramInitDataRaw(){return null}getDeviceID(){let e=this.storage.getString(_);return e||(e="noop-device",this.storage.setString(_,e)),e}getDeviceModel(){return "Noop"}shareLink(){}openInvoice(){}async showAd(){}async copyToClipboard(){}};var g=["https://idosgames.com","https://www.idosgames.com"];function v(t){return t==="localhost"||t==="127.0.0.1"||t==="[::1]"||t.endsWith(".localhost")}function p(t){if(g.includes(t))return true;if(typeof window>"u"||!v(window.location.hostname))return false;try{return v(new URL(t).hostname)}catch{return false}}var R="IDOS_PLATFORM_WALLET_ACK",U="PLATFORM_WALLET_UNAVAILABLE",h=5e3,E=18e4;function M(){let t=[...g],e=window.location.ancestorOrigins?.[0];return e&&!t.includes(e)&&p(e)&&t.push(e),t}function x(){return `wallet-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function c(t,e,r,D={}){let u={ok:false,error:U,data:{}};if(typeof window>"u"||window.self===window.top)return Promise.resolve(u);let P=window.parent;if(!P)return Promise.resolve(u);let T=x(),L=D.answerTimeoutMs??E;return new Promise(O=>{let A=false,l,f=a=>{A||(A=true,window.removeEventListener("message",y),clearTimeout(l),O(a));},y=a=>{if(!p(a.origin))return;let o=a.data;if(!(!o||o.requestId!==T)){if(o.type===R){clearTimeout(l),l=setTimeout(()=>f({ok:false,error:"TIMEOUT",data:{}}),L);return}o.type===e&&f({ok:o.ok===true,error:typeof o.error=="string"?o.error:void 0,data:o});}};l=setTimeout(()=>f(u),h),window.addEventListener("message",y);for(let a of M())try{P.postMessage({type:t,requestId:T,...r},a);}catch{}})}var w={request:"IDOS_PLATFORM_TOPUP_REQUEST",response:"IDOS_PLATFORM_TOPUP_RESPONSE"},k=15*6e4,b=/^[a-z0-9]{8}-preview\.idos\.games$/;function W(){if(typeof window>"u")return false;try{if(window.self===window.top||window.parent!==window.top)return !1}catch{return false}return !b.test(window.location.hostname.toLowerCase())}async function F(t){let e=await c(w.request,w.response,{titleID:t.titleID,userID:t.userID,currencyID:t.currencyID,amount:t.amount},{answerTimeoutMs:k});return e.ok?{ok:true}:{ok:false,error:e.error}}
2
- export{i as a,s as b,n as c,I as d,m as e,g as f,p as g,R as h,U as i,c as j,w as k,W as l,F as m,d as n};