@idosgames/core 0.26.1 → 0.26.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.
- package/dist/{VoiceController-BD33ZRHg.d.ts → VoiceController-0Lyo_Tcb.d.ts} +43 -2
- package/dist/{VoiceController-DpMCYqPG.d.cts → VoiceController-C_GJOxvz.d.cts} +43 -2
- package/dist/{chunk-YSPGQWAB.js → chunk-4VTWZXB4.js} +2 -2
- package/dist/{index-DMmtsWR2.d.cts → index-BCY6F_tf.d.cts} +10 -1
- package/dist/{index-BKjfSSxG.d.ts → index-YNXpT5ol.d.ts} +10 -1
- 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 +1 -1
- package/dist/platform/index.d.ts +1 -1
- 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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var f=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{}}},g=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
|
|
2
|
-
export{f as a,g as b,n as c,
|
|
1
|
+
var f=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{}}},g=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 v(){return crypto.randomUUID()}var h="idos_device_id",w=class{storage;constructor(e=new f){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(h);return e||(e=v(),this.storage.setString(h,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 U="idos_device_id",P=class{storage;constructor(e=new g){this.storage=e;}getPlatform(){return "Web"}getFullURL(){return ""}getStartParameter(){return null}getTelegramInitDataRaw(){return null}getDeviceID(){let e=this.storage.getString(U);return e||(e="noop-device",this.storage.setString(U,e)),e}getDeviceModel(){return "Noop"}shareLink(){}openInvoice(){}async showAd(){}async copyToClipboard(){}};var s=["https://idosgames.com","https://www.idosgames.com"],u="https://platform.idosgames.com",x=/^[a-z0-9]{8}-preview\.idos\.games$/;function I(t){return t==="localhost"||t==="127.0.0.1"||t==="[::1]"||t.endsWith(".localhost")}function S(){if(typeof window>"u")return false;let t=window.location.hostname.toLowerCase();return x.test(t)?true:I(t)&&globalThis.__IDOS_PREVIEW__!=null}function p(t){if(typeof window<"u"&&x.test(window.location.hostname.toLowerCase()))return t===u;if(s.includes(t))return true;if(typeof window>"u"||!I(window.location.hostname))return false;try{return I(new URL(t).hostname)}catch{return false}}var L="IDOS_PLATFORM_WALLET_ACK",C="PLATFORM_WALLET_UNAVAILABLE",N=5e3,F=18e4;function W(){if(p(u))return [u];let t=[...s],e=window.location.ancestorOrigins?.[0];return e&&!t.includes(e)&&p(e)&&t.push(e),t}function G(){return `wallet-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function i(t,e,r,l={}){let c={ok:false,error:C,data:{}};if(typeof window>"u"||window.self===window.top)return Promise.resolve(c);let E=window.parent;if(!E)return Promise.resolve(c);let D=G(),k=l.answerTimeoutMs??F;return new Promise(b=>{let O=false,m,d=a=>{O||(O=true,window.removeEventListener("message",M),clearTimeout(m),b(a));},M=a=>{if(!p(a.origin))return;let o=a.data;if(!(!o||o.requestId!==D)){if(o.type===L){clearTimeout(m),m=setTimeout(()=>d({ok:false,error:"TIMEOUT",data:{}}),k);return}o.type===e&&d({ok:o.ok===true,error:typeof o.error=="string"?o.error:void 0,data:o});}};m=setTimeout(()=>d(c),N),window.addEventListener("message",M);for(let a of W())try{E.postMessage({type:t,requestId:D,...r},a);}catch{}})}var T={request:"IDOS_PLATFORM_TOPUP_REQUEST",response:"IDOS_PLATFORM_TOPUP_RESPONSE"},V=15*6e4,K=/^[a-z0-9]{8}-preview\.idos\.games$/;function _(){if(typeof window>"u")return false;try{if(window.self===window.top||window.parent!==window.top)return !1}catch{return false}return !K.test(window.location.hostname.toLowerCase())}async function q(t){let e=await i(T.request,T.response,{titleID:t.titleID,userID:t.userID,currencyID:t.currencyID,amount:t.amount},{answerTimeoutMs:V});return e.ok?{ok:true}:{ok:false,error:e.error}}var A={request:"IDOS_PLATFORM_AUTH_REQUEST",response:"IDOS_PLATFORM_AUTH_RESPONSE"},B=30*6e4,R="idos:platformSignIn:declined:";function H(){if(typeof window>"u")return false;try{if(window.self===window.top||window.parent!==window.top)return !1}catch{return false}if(S())return false;let t=window.location.ancestorOrigins?.[0];if(t&&!s.includes(t))try{let e=new URL(t).hostname;if(e!=="localhost"&&e!=="127.0.0.1")return !1}catch{return false}return true}function we(){if(typeof window>"u"||!S())return false;try{return window.self!==window.top&&window.parent===window.top}catch{return false}}async function $(t){let e=await i(A.request,A.response,{titleID:t,supports:["pgs"]},{answerTimeoutMs:B}),r=e.data.ticket;if(e.ok&&typeof r=="string"&&r.length>0)return {ticket:r};let l=e.data.code;return e.ok&&typeof l=="string"&&l.length>0?{code:l}:{error:e.error??"no_code"}}function Q(t){try{window.localStorage.setItem(R+t,"1");}catch{}}function Y(t){try{window.localStorage.removeItem(R+t);}catch{}}function z(t){try{return window.localStorage.getItem(R+t)==="1"}catch{return false}}var y={request:"IDOS_PLATFORM_CREDITS_CONFIRM_REQUEST",response:"IDOS_PLATFORM_CREDITS_CONFIRM_RESPONSE"},X=10*6e4;function j(){let t=globalThis.navigator?.userAgent??"";if(!/\biDosGamesApp\/(?:player|studio)\//.test(t))return true;let e=/\biDosGamesPlatform\/(ios|android)\b/.exec(t);return (e?e[1]:/\bAndroid\b/.test(t)?"android":"ios")!=="ios"}function J(){return _()}async function Z(t){let e=await i(y.request,y.response,{titleID:t.titleID,confirmationID:t.confirmationID},{answerTimeoutMs:X});return e.ok?{ok:true}:{ok:false,error:e.error}}
|
|
2
|
+
export{f as a,g as b,n as c,v as d,w as e,s as f,p as g,L as h,C as i,i as j,A as k,H as l,we as m,$ as n,Q as o,Y as p,z as q,T as r,_ as s,q as t,y as u,j as v,J as w,Z as x,P as y};
|
|
@@ -174,6 +174,15 @@ interface PlatformCreditsConfirmResult {
|
|
|
174
174
|
ok: boolean;
|
|
175
175
|
error?: string;
|
|
176
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Whether the player can pay in Credits here at all. Not inside the iOS app of iDos Games: it sells no Credits through
|
|
179
|
+
* Apple In-App Purchase, App Store 3.1.1 allows digital purchases only through it, and the site refuses such a
|
|
180
|
+
* confirmation there for good (`DECLINED`). A game hides its Credits prices there instead of a button that can only
|
|
181
|
+
* fail. The app marks its WebView, the games inside it included, in the User-Agent:
|
|
182
|
+
* `iDosGamesApp/{player|studio}/{version} iDosGamesPlatform/{ios|android}`; builds without the platform mark are told
|
|
183
|
+
* apart by the WebView itself. Copy of the site's rule (`nativePlatform()` in iDosGames_com/utils/nativePlatform.ts).
|
|
184
|
+
*/
|
|
185
|
+
declare function canPayWithPlatformCredits(): boolean;
|
|
177
186
|
/**
|
|
178
187
|
* Whether the page around the game can be asked at all: one frame deep (the site's `/app/{id}`; behind `/embed`
|
|
179
188
|
* the game is two frames deep and a foreign page could cover our window) and not the AI Coder preview.
|
|
@@ -185,4 +194,4 @@ declare function requestPlatformCreditsConfirm(request: {
|
|
|
185
194
|
confirmationID: string;
|
|
186
195
|
}): Promise<PlatformCreditsConfirmResult>;
|
|
187
196
|
|
|
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,
|
|
197
|
+
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, canPayWithPlatformCredits as n, canUsePlatformCreditsConfirm as o, canUsePlatformSignIn as p, canUsePlatformTopUp as q, canUsePreviewSignIn as r, clearPlatformSignInDeclined as s, isPlatformParentOrigin as t, isPlatformSignInDeclined as u, markPlatformSignInDeclined as v, requestPlatformCreditsConfirm as w, requestPlatformSignIn as x, requestPlatformTopUp as y, getTelegramWebApp as z };
|
|
@@ -174,6 +174,15 @@ interface PlatformCreditsConfirmResult {
|
|
|
174
174
|
ok: boolean;
|
|
175
175
|
error?: string;
|
|
176
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Whether the player can pay in Credits here at all. Not inside the iOS app of iDos Games: it sells no Credits through
|
|
179
|
+
* Apple In-App Purchase, App Store 3.1.1 allows digital purchases only through it, and the site refuses such a
|
|
180
|
+
* confirmation there for good (`DECLINED`). A game hides its Credits prices there instead of a button that can only
|
|
181
|
+
* fail. The app marks its WebView, the games inside it included, in the User-Agent:
|
|
182
|
+
* `iDosGamesApp/{player|studio}/{version} iDosGamesPlatform/{ios|android}`; builds without the platform mark are told
|
|
183
|
+
* apart by the WebView itself. Copy of the site's rule (`nativePlatform()` in iDosGames_com/utils/nativePlatform.ts).
|
|
184
|
+
*/
|
|
185
|
+
declare function canPayWithPlatformCredits(): boolean;
|
|
177
186
|
/**
|
|
178
187
|
* Whether the page around the game can be asked at all: one frame deep (the site's `/app/{id}`; behind `/embed`
|
|
179
188
|
* the game is two frames deep and a foreign page could cover our window) and not the AI Coder preview.
|
|
@@ -185,4 +194,4 @@ declare function requestPlatformCreditsConfirm(request: {
|
|
|
185
194
|
confirmationID: string;
|
|
186
195
|
}): Promise<PlatformCreditsConfirmResult>;
|
|
187
196
|
|
|
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,
|
|
197
|
+
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, canPayWithPlatformCredits as n, canUsePlatformCreditsConfirm as o, canUsePlatformSignIn as p, canUsePlatformTopUp as q, canUsePreviewSignIn as r, clearPlatformSignInDeclined as s, isPlatformParentOrigin as t, isPlatformSignInDeclined as u, markPlatformSignInDeclined as v, requestPlatformCreditsConfirm as w, requestPlatformSignIn as x, requestPlatformTopUp as y, getTelegramWebApp as z };
|