@idosgames/core 0.8.0 → 0.10.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 +112 -0
- package/dist/chunk-MEUEUF7D.js +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +455 -23
- package/dist/index.d.ts +455 -23
- package/dist/index.js +2 -2
- package/dist/platform/index.cjs +1 -1
- package/dist/platform/index.d.cts +9 -0
- package/dist/platform/index.d.ts +9 -0
- package/dist/platform/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-QJVWT32O.js +0 -1
package/dist/platform/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var n=class{getString(e){if(typeof localStorage>"u")return null;try{return localStorage.getItem(e)}catch{return null}}setString(e,t){if(!(typeof localStorage>"u"))try{localStorage.setItem(e,t);}catch{}}remove(e){if(!(typeof localStorage>"u"))try{localStorage.removeItem(e);}catch{}}},o=class{map=new Map;getString(e){return this.map.get(e)??null}setString(e,t){this.map.set(e,t);}remove(e){this.map.delete(e);}};function r(){return globalThis.Telegram?.WebApp??null}function l(){return crypto.randomUUID()}var s="idos_device_id",i=class{storage;constructor(e=new n){this.storage=e;}getPlatform(){return r()?.platform??"Web"}getFullURL(){return typeof location<"u"?location.href:""}getStartParameter(){let e=r()?.initDataUnsafe?.start_param;return typeof e=="string"?e:null}getTelegramInitDataRaw(){let e=r()?.initData;return e&&e.length>0?e:null}getDeviceID(){let e=this.storage.getString(s);return e||(e=l(),this.storage.setString(s,e)),e}getDeviceModel(){return typeof navigator<"u"&&navigator.userAgent?navigator.userAgent:"Web"}shareLink(e){let t=r();if(t?.openTelegramLink){t.openTelegramLink(e);return}typeof window<"u"&&window.open(e,"_blank");}openInvoice(e){let t=r();if(t?.openInvoice){t.openInvoice(e);return}typeof window<"u"&&window.open(e,"_blank");}async showAd(e){let t=globalThis;typeof t.showAd=="function"&&await t.showAd(e);}async copyToClipboard(e){typeof navigator<"u"&&navigator.clipboard&&await navigator.clipboard.writeText(e);}};var p="idos_device_id",g=class{storage;constructor(e=new o){this.storage=e;}getPlatform(){return "Web"}getFullURL(){return ""}getStartParameter(){return null}getTelegramInitDataRaw(){return null}getDeviceID(){let e=this.storage.getString(p);return e||(e="noop-device",this.storage.setString(p,e)),e}getDeviceModel(){return "Noop"}shareLink(){}openInvoice(){}async showAd(){}async copyToClipboard(){}};exports.BrowserPlatformAdapter=i;exports.BrowserStorage=n;exports.MemoryStorage=o;exports.NoopPlatformAdapter=g;exports.getTelegramWebApp=r;
|
|
1
|
+
'use strict';var n=class{getString(e){if(typeof localStorage>"u")return null;try{return localStorage.getItem(e)}catch{return null}}setString(e,t){if(!(typeof localStorage>"u"))try{localStorage.setItem(e,t);}catch{}}remove(e){if(!(typeof localStorage>"u"))try{localStorage.removeItem(e);}catch{}}},o=class{map=new Map;getString(e){return this.map.get(e)??null}setString(e,t){this.map.set(e,t);}remove(e){this.map.delete(e);}};function r(){return globalThis.Telegram?.WebApp??null}function l(){return crypto.randomUUID()}var s="idos_device_id",i=class{storage;constructor(e=new n){this.storage=e;}getPlatform(){return r()?.platform??"Web"}getFullURL(){return typeof location<"u"?location.href:""}getStartParameter(){let e=r()?.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=r()?.initData;return e&&e.length>0?e:null}getDeviceID(){let e=this.storage.getString(s);return e||(e=l(),this.storage.setString(s,e)),e}getDeviceModel(){return typeof navigator<"u"&&navigator.userAgent?navigator.userAgent:"Web"}shareLink(e){let t=r();if(t?.openTelegramLink){t.openTelegramLink(e);return}typeof window<"u"&&window.open(e,"_blank");}openInvoice(e){let t=r();if(t?.openInvoice){t.openInvoice(e);return}typeof window<"u"&&window.open(e,"_blank");}async showAd(e){let t=globalThis;typeof t.showAd=="function"&&await t.showAd(e);}async copyToClipboard(e){typeof navigator<"u"&&navigator.clipboard&&await navigator.clipboard.writeText(e);}};var p="idos_device_id",g=class{storage;constructor(e=new o){this.storage=e;}getPlatform(){return "Web"}getFullURL(){return ""}getStartParameter(){return null}getTelegramInitDataRaw(){return null}getDeviceID(){let e=this.storage.getString(p);return e||(e="noop-device",this.storage.setString(p,e)),e}getDeviceModel(){return "Noop"}shareLink(){}openInvoice(){}async showAd(){}async copyToClipboard(){}};exports.BrowserPlatformAdapter=i;exports.BrowserStorage=n;exports.MemoryStorage=o;exports.NoopPlatformAdapter=g;exports.getTelegramWebApp=r;
|
|
@@ -17,6 +17,14 @@ interface PlatformAdapter {
|
|
|
17
17
|
getDeviceID(): string;
|
|
18
18
|
/** Device/user-agent string — replaces SystemInfo.deviceModel. */
|
|
19
19
|
getDeviceModel(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Referring page (`document.referrer`), when the host has one.
|
|
22
|
+
*
|
|
23
|
+
* Optional on purpose: adding a required member here would break every adapter written outside
|
|
24
|
+
* this repo, and an acquisition signal is not worth that. Absent referrer simply means one less
|
|
25
|
+
* field in the signal.
|
|
26
|
+
*/
|
|
27
|
+
getReferrer?(): string | null;
|
|
20
28
|
shareLink(url: string): void;
|
|
21
29
|
openInvoice(url: string): void;
|
|
22
30
|
showAd(blockId: string): Promise<void>;
|
|
@@ -44,6 +52,7 @@ declare class BrowserPlatformAdapter implements PlatformAdapter {
|
|
|
44
52
|
getPlatform(): string;
|
|
45
53
|
getFullURL(): string;
|
|
46
54
|
getStartParameter(): string | null;
|
|
55
|
+
getReferrer(): string | null;
|
|
47
56
|
getTelegramInitDataRaw(): string | null;
|
|
48
57
|
getDeviceID(): string;
|
|
49
58
|
getDeviceModel(): string;
|
package/dist/platform/index.d.ts
CHANGED
|
@@ -17,6 +17,14 @@ interface PlatformAdapter {
|
|
|
17
17
|
getDeviceID(): string;
|
|
18
18
|
/** Device/user-agent string — replaces SystemInfo.deviceModel. */
|
|
19
19
|
getDeviceModel(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Referring page (`document.referrer`), when the host has one.
|
|
22
|
+
*
|
|
23
|
+
* Optional on purpose: adding a required member here would break every adapter written outside
|
|
24
|
+
* this repo, and an acquisition signal is not worth that. Absent referrer simply means one less
|
|
25
|
+
* field in the signal.
|
|
26
|
+
*/
|
|
27
|
+
getReferrer?(): string | null;
|
|
20
28
|
shareLink(url: string): void;
|
|
21
29
|
openInvoice(url: string): void;
|
|
22
30
|
showAd(blockId: string): Promise<void>;
|
|
@@ -44,6 +52,7 @@ declare class BrowserPlatformAdapter implements PlatformAdapter {
|
|
|
44
52
|
getPlatform(): string;
|
|
45
53
|
getFullURL(): string;
|
|
46
54
|
getStartParameter(): string | null;
|
|
55
|
+
getReferrer(): string | null;
|
|
47
56
|
getTelegramInitDataRaw(): string | null;
|
|
48
57
|
getDeviceID(): string;
|
|
49
58
|
getDeviceModel(): string;
|
package/dist/platform/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{e as BrowserPlatformAdapter,a as BrowserStorage,b as MemoryStorage,f as NoopPlatformAdapter,c as getTelegramWebApp}from'../chunk-
|
|
1
|
+
export{e as BrowserPlatformAdapter,a as BrowserStorage,b as MemoryStorage,f as NoopPlatformAdapter,c as getTelegramWebApp}from'../chunk-MEUEUF7D.js';
|
package/package.json
CHANGED
package/dist/chunk-QJVWT32O.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=class{getString(e){if(typeof localStorage>"u")return null;try{return localStorage.getItem(e)}catch{return null}}setString(e,t){if(!(typeof localStorage>"u"))try{localStorage.setItem(e,t);}catch{}}remove(e){if(!(typeof localStorage>"u"))try{localStorage.removeItem(e);}catch{}}},o=class{map=new Map;getString(e){return this.map.get(e)??null}setString(e,t){this.map.set(e,t);}remove(e){this.map.delete(e);}};function r(){return globalThis.Telegram?.WebApp??null}function l(){return crypto.randomUUID()}var s="idos_device_id",i=class{storage;constructor(e=new n){this.storage=e;}getPlatform(){return r()?.platform??"Web"}getFullURL(){return typeof location<"u"?location.href:""}getStartParameter(){let e=r()?.initDataUnsafe?.start_param;return typeof e=="string"?e:null}getTelegramInitDataRaw(){let e=r()?.initData;return e&&e.length>0?e:null}getDeviceID(){let e=this.storage.getString(s);return e||(e=l(),this.storage.setString(s,e)),e}getDeviceModel(){return typeof navigator<"u"&&navigator.userAgent?navigator.userAgent:"Web"}shareLink(e){let t=r();if(t?.openTelegramLink){t.openTelegramLink(e);return}typeof window<"u"&&window.open(e,"_blank");}openInvoice(e){let t=r();if(t?.openInvoice){t.openInvoice(e);return}typeof window<"u"&&window.open(e,"_blank");}async showAd(e){let t=globalThis;typeof t.showAd=="function"&&await t.showAd(e);}async copyToClipboard(e){typeof navigator<"u"&&navigator.clipboard&&await navigator.clipboard.writeText(e);}};var p="idos_device_id",g=class{storage;constructor(e=new o){this.storage=e;}getPlatform(){return "Web"}getFullURL(){return ""}getStartParameter(){return null}getTelegramInitDataRaw(){return null}getDeviceID(){let e=this.storage.getString(p);return e||(e="noop-device",this.storage.setString(p,e)),e}getDeviceModel(){return "Noop"}shareLink(){}openInvoice(){}async showAd(){}async copyToClipboard(){}};export{n as a,o as b,r as c,l as d,i as e,g as f};
|