@idosgames/core 0.9.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.
@@ -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;
@@ -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;
@@ -1 +1 @@
1
- export{e as BrowserPlatformAdapter,a as BrowserStorage,b as MemoryStorage,f as NoopPlatformAdapter,c as getTelegramWebApp}from'../chunk-QJVWT32O.js';
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idosgames/core",
3
- "version": "0.9.0",
3
+ "version": "0.10.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 +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};