@buoy-gg/license 7.0.27 → 7.0.28

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.
Files changed (35) hide show
  1. package/lib/commonjs/LicenseManager.js +1 -1
  2. package/lib/commonjs/api.js +1 -1
  3. package/lib/commonjs/config.js +2 -2
  4. package/lib/commonjs/index.js +1 -1
  5. package/lib/commonjs/index.web.js +1 -1
  6. package/lib/module/LicenseManager.js +1 -1
  7. package/lib/module/api.js +1 -1
  8. package/lib/module/config.js +1 -1
  9. package/lib/module/index.js +1 -1
  10. package/lib/module/index.web.js +1 -1
  11. package/lib/typescript/commonjs/LicenseManager.d.ts +24 -2
  12. package/lib/typescript/commonjs/LicenseManager.d.ts.map +1 -1
  13. package/lib/typescript/commonjs/api.d.ts +30 -0
  14. package/lib/typescript/commonjs/api.d.ts.map +1 -1
  15. package/lib/typescript/commonjs/config.d.ts +16 -0
  16. package/lib/typescript/commonjs/config.d.ts.map +1 -1
  17. package/lib/typescript/commonjs/index.d.ts +1 -0
  18. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  19. package/lib/typescript/commonjs/index.web.d.ts +1 -0
  20. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  21. package/lib/typescript/commonjs/types.d.ts +13 -0
  22. package/lib/typescript/commonjs/types.d.ts.map +1 -1
  23. package/lib/typescript/module/LicenseManager.d.ts +24 -2
  24. package/lib/typescript/module/LicenseManager.d.ts.map +1 -1
  25. package/lib/typescript/module/api.d.ts +30 -0
  26. package/lib/typescript/module/api.d.ts.map +1 -1
  27. package/lib/typescript/module/config.d.ts +16 -0
  28. package/lib/typescript/module/config.d.ts.map +1 -1
  29. package/lib/typescript/module/index.d.ts +1 -0
  30. package/lib/typescript/module/index.d.ts.map +1 -1
  31. package/lib/typescript/module/index.web.d.ts +1 -0
  32. package/lib/typescript/module/index.web.d.ts.map +1 -1
  33. package/lib/typescript/module/types.d.ts +13 -0
  34. package/lib/typescript/module/types.d.ts.map +1 -1
  35. package/package.json +1 -1
@@ -13,4 +13,4 @@
13
13
  * Pro is $9/mo, and is free every weekend for anyone holding a key —
14
14
  * including a free one (`npx buoy login`). Buy a key at
15
15
  * https://buoy.gg or use it free on Saturday and Sunday.
16
- */const LICENSE_STORAGE_DIR="buoy-license";let _FileSystem=null;let _licenseStorage=null;const _memoryStore=new Map;function loadFileSystem(){if(_FileSystem)return _FileSystem;try{const s=require("expo-file-system/legacy");_FileSystem=s?.default||s;if(_FileSystem?.documentDirectory){return _FileSystem}_FileSystem=null}catch{}try{const s=require("expo-file-system");_FileSystem=s?.default||s;if(_FileSystem?.documentDirectory){return _FileSystem}_FileSystem=null}catch{}return null}function getLicenseStorageDir(){const s=loadFileSystem();if(!s?.documentDirectory)return null;return`${s.documentDirectory}${LICENSE_STORAGE_DIR}/`}function getLicenseFilePath(s){const e=getLicenseStorageDir();if(!e)return null;return`${e}${encodeURIComponent(s)}.json`}function loadAsyncStorage(){try{const s=require("@react-native-async-storage/async-storage");const e=s?.default||s;if(typeof e?.getItem==="function"&&typeof e.setItem==="function"&&typeof e.removeItem==="function"){return e}}catch{}return null}function hasLocalStorage(){try{return typeof localStorage!=="undefined"&&!!localStorage}catch{return false}}async function getLicenseStorage(){if(_licenseStorage)return _licenseStorage;const s=loadFileSystem();let e=null;if(s?.documentDirectory){_licenseStorage={async getItem(t){const i=getLicenseFilePath(t);if(!i)return null;try{const a=await s.getInfoAsync(i);if(!a.exists)return null;return await s.readAsStringAsync(i)}catch{return null}},async setItem(t,i){const a=getLicenseStorageDir();const n=getLicenseFilePath(t);if(!a||!n)return;try{const r=await s.getInfoAsync(a);if(!r.exists){await s.makeDirectoryAsync(a,{intermediates:true})}await s.writeAsStringAsync(n,i)}catch(r){console.warn("[Buoy] License storage write failed:",r)}},async removeItem(t){const i=getLicenseFilePath(t);if(!i)return;try{await s.deleteAsync(i,{idempotent:true})}catch{}}}}else if(e=loadAsyncStorage()){const t=e;_licenseStorage={async getItem(i){try{return await t.getItem(i)}catch{return null}},async setItem(i,a){try{await t.setItem(i,a)}catch(n){console.warn("[Buoy] License storage write failed:",n)}},async removeItem(i){try{await t.removeItem(i)}catch{}}}}else if(hasLocalStorage()){_licenseStorage={async getItem(t){try{return localStorage.getItem(t)}catch{return null}},async setItem(t,i){try{localStorage.setItem(t,i)}catch{}},async removeItem(t){try{localStorage.removeItem(t)}catch{}}}}else{_licenseStorage={async getItem(t){return _memoryStore.get(t)??null},async setItem(t,i){_memoryStore.set(t,i)},async removeItem(t){_memoryStore.delete(t)}}}return _licenseStorage}function tierOfCache(s){if(s.tier)return s.tier;return s.isPro?"pro":"anonymous"}class LicenseManagerImpl{state={isInitialized:false,isValidating:false,isPro:false,tier:"anonymous",tierSource:"none",licenseKey:null,error:null,expiresAt:null};listeners=new Set;revalidationTimer=null;cachedLicense=null;fingerprintPromise=null;initPromise=null;generation=0;deviceRegistrationCallback=null;pendingRegistration=null;async initialize(){if(this.initPromise)return this.initPromise;if(this.state.isInitialized)return;this.initPromise=this._doInitialize();return this.initPromise}async _doInitialize(){if(this.state.isInitialized)return;try{const e=await this.loadCachedLicense();if(e){const t=(0,_cacheSignature.verifyCacheSignature)(e);this.cachedLicense=e;this.state.licenseKey=e.licenseKey;this.applyTier(t&&this.isCacheValid(e)?tierOfCache(e):"anonymous");this.state.expiresAt=e.expiresAt?new Date(e.expiresAt):null;if(e.licenseKey&&!(t&&this.isCacheValid(e)&&this.isCacheFresh(e))){this.validateInBackground(e.licenseKey)}}this.state.isInitialized=true;this.emit({type:"initialized",isPro:this.state.isPro});this.startRevalidationTimer()}catch(e){console.warn("[React Buoy] License initialization failed:",e);this.state.isInitialized=true;this.emit({type:"initialized",isPro:false})}}async setLicenseKey(e,t){if(!e||e.trim().length===0){this.state.error="License key is required";return false}const i=e.trim().toUpperCase();const a=this.cachedLicense;if(!t?.force&&a&&a.valid&&a.licenseKey===i&&a.fingerprint&&(0,_cacheSignature.verifyCacheSignature)(a)&&this.isCacheValid(a)&&this.isCacheFresh(a)){this.applyTier(tierOfCache(a));this.state.licenseKey=i;this.state.isValidating=false;this.state.error=null;this.state.expiresAt=a.expiresAt?new Date(a.expiresAt):null;this.emit({type:"validated",isPro:this.state.isPro});return true}this.generation+=1;const n=this.generation;this.state.licenseKey=i;this.state.isValidating=true;this.state.error=null;this.emit({type:"validating",isPro:this.state.isPro});try{const r=await(0,_api.validateLicense)(i);if(n!==this.generation)return false;const c=(0,_api.parseValidationResult)(r);if((0,_api.isFatalLicenseError)(c.code)){this.applyTier((0,_tier.tierAfterFatalError)(c.code));this.state.isValidating=false;this.state.error=c.detail;await this.clearCachedLicense();this.emit({type:"error",isPro:false,error:c.detail});return false}if(!r.data){this.state.isValidating=false;this.state.error=c.detail||"License not found";await this.clearCachedLicense();this.emit({type:"error",isPro:false,error:this.state.error});return false}const o=(0,_tier.resolveTier)(r.data);this.applyTier(o);this.state.isValidating=false;this.state.expiresAt=r.data.attributes.expiry?new Date(r.data.attributes.expiry):null;const d=r.data.id;const f=Date.now();let l=this.cachedLicense?.fingerprint;let h=this.cachedLicense?.deviceName;let g=false;if(!l){l=await this.getOrCreateDeviceFingerprint();h=(0,_fingerprint.getDefaultDeviceName)();g=true}let u=false;if(g){if(this.deviceRegistrationCallback){this.pendingRegistration={licenseId:d,licenseKey:i,fingerprint:l};this.deviceRegistrationCallback({fingerprint:l,defaultName:h});u=true}else{this.registerDeviceAsync(d,i,l,h)}}const y={licenseKey:i,licenseId:d,valid:true,isPro:o==="pro",tier:o,expiresAt:r.data.attributes.expiry??null,cachedAt:f,lastValidatedAt:f,fingerprint:u?void 0:l,deviceName:u?void 0:h};this.cachedLicense=await this.persistCache(y);this.emit({type:"validated",isPro:this.state.isPro});return true}catch(r){const c=r instanceof Error?r.message:"Validation failed";if(n!==this.generation)return false;if(this.isNetworkError(r)&&this.cachedLicense&&this.isCacheValid(this.cachedLicense)){this.applyTier(tierOfCache(this.cachedLicense));this.state.isValidating=false;this.emit({type:"validated",isPro:this.state.isPro});return true}this.state.isValidating=false;this.state.error=c;this.emit({type:"error",isPro:false,error:c});return false}}isNetworkError(e){if(e instanceof TypeError){return true}if(e instanceof Error){const t=e.message.toLowerCase();return t.includes("network")||t.includes("fetch")||t.includes("timeout")||t.includes("connection")||t.includes("offline")||t.includes("failed to fetch")}return false}async clearLicense(){this.generation+=1;this.state.licenseKey=null;this.applyTier("anonymous");this.state.expiresAt=null;this.state.error=null;this.cachedLicense=null;await this.clearCachedLicense();this.emit({type:"deactivated",isPro:false})}applyTier(e){this.state.tier=e;this.state.tierSource=e==="anonymous"?"none":"key";this.state.isPro=e==="pro"}getTier(){return this.state.tier}isPro(){return this.state.tier==="pro"}hasEntitlement(e){if(e==="PRO"){return this.state.isPro}return this.state.isPro}getState(){return{...this.state}}subscribe(e){this.listeners.add(e);return()=>this.listeners.delete(e)}onDeviceRegistrationNeeded(e){this.deviceRegistrationCallback=e;return()=>{this.deviceRegistrationCallback=null}}async completeDeviceRegistration(e){if(!this.pendingRegistration){console.warn("[Buoy] No pending device registration");return}const{licenseId:t,licenseKey:i,fingerprint:a}=this.pendingRegistration;const n=e.trim()||(0,_fingerprint.getDefaultDeviceName)();const r=(0,_fingerprint.getDeviceMetadata)();try{await(0,_api.activateMachine)(t,i,a,n,r)}catch(c){const o=c instanceof Error?c.message:String(c);if(o==="FINGERPRINT_TAKEN"||o==="MACHINE_LIMIT_EXCEEDED"){}else{console.warn("[Buoy] Device registration failed:",o);throw c}}if(this.cachedLicense){this.cachedLicense.fingerprint=a;this.cachedLicense.deviceName=n;this.cachedLicense=await this.persistCache(this.cachedLicense)}this.pendingRegistration=null}emit(e){const t=[...this.listeners];t.forEach(i=>{try{i(e)}catch(a){console.warn("[React Buoy] License listener error:",a)}})}isCacheValid(e){const t=Date.now();const i=t-e.cachedAt;if(i>_config.LICENSE_CACHE_DURATION){return false}if(e.expiresAt){const a=new Date(e.expiresAt).getTime();if(t>a){return false}}return true}isCacheFresh(e){return Date.now()-(e.lastValidatedAt??0)<_config.LICENSE_LAUNCH_VALIDATION_TTL}async persistCache(e){const t=(0,_cacheSignature.signCache)(e);const i=await getLicenseStorage();await i.setItem(_config.LICENSE_STORAGE_KEY,JSON.stringify(t));return t}async loadCachedLicense(){try{const e=await getLicenseStorage();const t=await e.getItem(_config.LICENSE_STORAGE_KEY);if(!t)return null;const i=JSON.parse(t);return i}catch(e){console.warn("[Buoy] Error loading cached license:",e);return null}}getOrCreateDeviceFingerprint(){if(!this.fingerprintPromise){this.fingerprintPromise=(async()=>{const e=await getLicenseStorage();const t=await e.getItem(_config.DEVICE_FINGERPRINT_STORAGE_KEY);if(t)return t;const i=this.cachedLicense?.fingerprint||(0,_fingerprint.generateUUID)();await e.setItem(_config.DEVICE_FINGERPRINT_STORAGE_KEY,i);return i})()}return this.fingerprintPromise}async clearCachedLicense(){this.cachedLicense=null;try{const e=await getLicenseStorage();await e.removeItem(_config.LICENSE_STORAGE_KEY)}catch{}}registerDeviceAsync(e,t,i,a){const n=(0,_fingerprint.getDeviceMetadata)();(0,_api.activateMachine)(e,t,i,a,n).catch(r=>{if(r.message!=="FINGERPRINT_TAKEN"&&r.message!=="MACHINE_LIMIT_EXCEEDED"){console.warn("[Buoy] Device registration failed (non-blocking):",r.message)}})}validateInBackground(e){const t=this.generation;(0,_api.validateLicense)(e).then(async i=>{if(t!==this.generation)return;const a=(0,_api.parseValidationResult)(i);if(a.valid&&i.data){const n=(0,_tier.resolveTier)(i.data);this.applyTier(n);const r=Date.now();this.cachedLicense=await this.persistCache({...this.cachedLicense??{},licenseKey:e,licenseId:i.data.id,valid:true,isPro:n==="pro",tier:n,expiresAt:i.data.attributes.expiry??null,cachedAt:r,lastValidatedAt:r});this.state.expiresAt=i.data.attributes.expiry?new Date(i.data.attributes.expiry):null;this.emit({type:"validated",isPro:this.state.isPro})}else if((0,_api.isFatalLicenseError)(a.code)){console.warn("[React Buoy] Background validation: license is invalid -",a.code);this.applyTier((0,_tier.tierAfterFatalError)(a.code));await this.clearCachedLicense();this.emit({type:"deactivated",isPro:false})}}).catch(i=>{console.warn("[React Buoy] Background validation failed:",i)})}startRevalidationTimer(){if(this.revalidationTimer){clearInterval(this.revalidationTimer)}this.revalidationTimer=setInterval(()=>{if(this.state.licenseKey&&!this.state.isValidating){this.validateInBackground(this.state.licenseKey)}},_config.LICENSE_REVALIDATION_INTERVAL);if(__DEV__){global.__LICENSE_MANAGER_TIMER__=this.revalidationTimer}}stopRevalidationTimer(){if(this.revalidationTimer){clearInterval(this.revalidationTimer);this.revalidationTimer=null}}async forceReregister(){if(this.cachedLicense){this.cachedLicense.fingerprint=void 0;this.cachedLicense.deviceName=void 0}this.fingerprintPromise=null;await this.clearCachedLicense();try{const e=await getLicenseStorage();await e.removeItem(_config.DEVICE_FINGERPRINT_STORAGE_KEY)}catch{}}}const LicenseManager=exports.LicenseManager=new LicenseManagerImpl;if(__DEV__){if(global.__LICENSE_MANAGER_TIMER__){clearInterval(global.__LICENSE_MANAGER_TIMER__)}}
16
+ */const LICENSE_STORAGE_DIR="buoy-license";let _FileSystem=null;let _licenseStorage=null;const _memoryStore=new Map;function loadFileSystem(){if(_FileSystem)return _FileSystem;try{const s=require("expo-file-system/legacy");_FileSystem=s?.default||s;if(_FileSystem?.documentDirectory){return _FileSystem}_FileSystem=null}catch{}try{const s=require("expo-file-system");_FileSystem=s?.default||s;if(_FileSystem?.documentDirectory){return _FileSystem}_FileSystem=null}catch{}return null}function getLicenseStorageDir(){const s=loadFileSystem();if(!s?.documentDirectory)return null;return`${s.documentDirectory}${LICENSE_STORAGE_DIR}/`}function getLicenseFilePath(s){const e=getLicenseStorageDir();if(!e)return null;return`${e}${encodeURIComponent(s)}.json`}function loadAsyncStorage(){try{const s=require("@react-native-async-storage/async-storage");const e=s?.default||s;if(typeof e?.getItem==="function"&&typeof e.setItem==="function"&&typeof e.removeItem==="function"){return e}}catch{}return null}function hasLocalStorage(){try{return typeof localStorage!=="undefined"&&!!localStorage}catch{return false}}async function getLicenseStorage(){if(_licenseStorage)return _licenseStorage;const s=loadFileSystem();let e=null;if(s?.documentDirectory){_licenseStorage={async getItem(i){const t=getLicenseFilePath(i);if(!t)return null;try{const r=await s.getInfoAsync(t);if(!r.exists)return null;return await s.readAsStringAsync(t)}catch{return null}},async setItem(i,t){const r=getLicenseStorageDir();const n=getLicenseFilePath(i);if(!r||!n)return;try{const a=await s.getInfoAsync(r);if(!a.exists){await s.makeDirectoryAsync(r,{intermediates:true})}await s.writeAsStringAsync(n,t)}catch(a){console.warn("[Buoy] License storage write failed:",a)}},async removeItem(i){const t=getLicenseFilePath(i);if(!t)return;try{await s.deleteAsync(t,{idempotent:true})}catch{}}}}else if(e=loadAsyncStorage()){const i=e;_licenseStorage={async getItem(t){try{return await i.getItem(t)}catch{return null}},async setItem(t,r){try{await i.setItem(t,r)}catch(n){console.warn("[Buoy] License storage write failed:",n)}},async removeItem(t){try{await i.removeItem(t)}catch{}}}}else if(hasLocalStorage()){_licenseStorage={async getItem(i){try{return localStorage.getItem(i)}catch{return null}},async setItem(i,t){try{localStorage.setItem(i,t)}catch{}},async removeItem(i){try{localStorage.removeItem(i)}catch{}}}}else{_licenseStorage={async getItem(i){return _memoryStore.get(i)??null},async setItem(i,t){_memoryStore.set(i,t)},async removeItem(i){_memoryStore.delete(i)}}}return _licenseStorage}function tierOfCache(s){if(s.tier)return s.tier;return s.isPro?"pro":"anonymous"}class LicenseManagerImpl{state={isInitialized:false,isValidating:false,isPro:false,tier:"anonymous",tierSource:"none",licenseKey:null,error:null,errorKind:null,expiresAt:null};listeners=new Set;revalidationTimer=null;cachedLicense=null;fingerprintPromise=null;initPromise=null;generation=0;retryTimer=null;retryAttempt=0;deviceRegistrationCallback=null;pendingRegistration=null;async initialize(){if(this.initPromise)return this.initPromise;if(this.state.isInitialized)return;this.initPromise=this._doInitialize();return this.initPromise}async _doInitialize(){if(this.state.isInitialized)return;try{const e=await this.loadCachedLicense();if(e){const i=(0,_cacheSignature.verifyCacheSignature)(e);this.cachedLicense=e;this.state.licenseKey=e.licenseKey;this.applyTier(i&&this.isCacheValid(e)?tierOfCache(e):"anonymous");this.state.expiresAt=e.expiresAt?new Date(e.expiresAt):null;if(e.licenseKey&&!(i&&this.isCacheValid(e)&&this.isCacheFresh(e))){this.validateInBackground(e.licenseKey)}}this.state.isInitialized=true;this.emit({type:"initialized",isPro:this.state.isPro});this.startRevalidationTimer()}catch(e){console.warn("[React Buoy] License initialization failed:",e);this.state.isInitialized=true;this.emit({type:"initialized",isPro:false})}}async setLicenseKey(e,i){if(!e||e.trim().length===0){this.state.error="License key is required";this.state.errorKind="verdict";return false}const t=e.trim().toUpperCase();const r=this.cachedLicense;if(!i?.force&&r&&r.valid&&r.licenseKey===t&&r.fingerprint&&(0,_cacheSignature.verifyCacheSignature)(r)&&this.isCacheValid(r)&&this.isCacheFresh(r)){this.applyTier(tierOfCache(r));this.state.licenseKey=t;this.state.isValidating=false;this.state.error=null;this.state.errorKind=null;this.state.expiresAt=r.expiresAt?new Date(r.expiresAt):null;this.emit({type:"validated",isPro:this.state.isPro});return true}this.generation+=1;this.cancelRetry();if(i?.force&&!i.isRetry)this.retryAttempt=0;const n=this.generation;this.state.licenseKey=t;this.state.isValidating=true;this.state.error=null;this.state.errorKind=null;this.emit({type:"validating",isPro:this.state.isPro});let a;try{a=await(0,_api.validateLicense)(t)}catch(c){const o=c instanceof Error?c.message:"Validation failed";if(n!==this.generation)return false;if((0,_api.isTransientLicenseError)(c)){this.state.isValidating=false;if(this.cachedLicense&&this.cachedLicense.licenseKey===t&&(0,_cacheSignature.verifyCacheSignature)(this.cachedLicense)&&this.isCacheValid(this.cachedLicense)){this.applyTier(tierOfCache(this.cachedLicense));this.state.error=null;this.state.errorKind=null;this.state.expiresAt=this.cachedLicense.expiresAt?new Date(this.cachedLicense.expiresAt):null;this.emit({type:"validated",isPro:this.state.isPro});return true}this.state.error=o;this.state.errorKind="transport";this.scheduleRetry(t);this.emit({type:"error",isPro:this.state.isPro,error:o});return false}this.state.isValidating=false;this.state.error=o;this.state.errorKind="verdict";this.emit({type:"error",isPro:false,error:o});return false}try{if(n!==this.generation)return false;const c=(0,_api.parseValidationResult)(a);if((0,_api.isFatalLicenseError)(c.code)){this.applyTier((0,_tier.tierAfterFatalError)(c.code));this.state.isValidating=false;this.state.error=c.detail;this.state.errorKind="verdict";await this.clearCachedLicense();this.emit({type:"error",isPro:false,error:c.detail});return false}if(!a.data){this.state.isValidating=false;this.state.error=c.detail||"License not found";this.state.errorKind="verdict";await this.clearCachedLicense();this.emit({type:"error",isPro:false,error:this.state.error});return false}const o=(0,_tier.resolveTier)(a.data);this.applyTier(o);this.state.isValidating=false;this.state.expiresAt=a.data.attributes.expiry?new Date(a.data.attributes.expiry):null;const d=a.data.id;const f=Date.now();let l=this.cachedLicense?.fingerprint;let h=this.cachedLicense?.deviceName;let y=false;if(!l){l=await this.getOrCreateDeviceFingerprint();h=(0,_fingerprint.getDefaultDeviceName)();y=true}let u=false;if(y){if(this.deviceRegistrationCallback){this.pendingRegistration={licenseId:d,licenseKey:t,fingerprint:l};this.deviceRegistrationCallback({fingerprint:l,defaultName:h});u=true}else{this.registerDeviceAsync(d,t,l,h)}}const g={licenseKey:t,licenseId:d,valid:true,isPro:o==="pro",tier:o,expiresAt:a.data.attributes.expiry??null,cachedAt:f,lastValidatedAt:f,fingerprint:u?void 0:l,deviceName:u?void 0:h};this.cachedLicense=await this.persistCache(g);this.retryAttempt=0;this.emit({type:"validated",isPro:this.state.isPro});return true}catch(c){const o=c instanceof Error?c.message:"Validation failed";if(n!==this.generation)return false;this.state.isValidating=false;this.state.error=o;this.state.errorKind="verdict";this.emit({type:"error",isPro:false,error:o});return false}}scheduleRetry(e){this.cancelRetry();const i=_config.LICENSE_TRANSIENT_RETRY_DELAYS[this.retryAttempt];if(i===void 0)return;this.retryAttempt+=1;const t=this.generation;this.retryTimer=setTimeout(()=>{this.retryTimer=null;if(t!==this.generation)return;if(this.state.isValidating)return;void this.setLicenseKey(e,{force:true,isRetry:true})},i);if(__DEV__){global.__LICENSE_MANAGER_RETRY_TIMER__=this.retryTimer}}cancelRetry(){if(this.retryTimer){clearTimeout(this.retryTimer);this.retryTimer=null}}async clearLicense(){this.generation+=1;this.cancelRetry();this.retryAttempt=0;this.state.licenseKey=null;this.applyTier("anonymous");this.state.expiresAt=null;this.state.error=null;this.state.errorKind=null;this.cachedLicense=null;await this.clearCachedLicense();this.emit({type:"deactivated",isPro:false})}applyTier(e){this.state.tier=e;this.state.tierSource=e==="anonymous"?"none":"key";this.state.isPro=e==="pro"}getTier(){return this.state.tier}isPro(){return this.state.tier==="pro"}hasEntitlement(e){if(e==="PRO"){return this.state.isPro}return this.state.isPro}getState(){return{...this.state}}subscribe(e){this.listeners.add(e);return()=>this.listeners.delete(e)}onDeviceRegistrationNeeded(e){this.deviceRegistrationCallback=e;return()=>{this.deviceRegistrationCallback=null}}async completeDeviceRegistration(e){if(!this.pendingRegistration){console.warn("[Buoy] No pending device registration");return}const{licenseId:i,licenseKey:t,fingerprint:r}=this.pendingRegistration;const n=e.trim()||(0,_fingerprint.getDefaultDeviceName)();const a=(0,_fingerprint.getDeviceMetadata)();try{await(0,_api.activateMachine)(i,t,r,n,a)}catch(c){const o=c instanceof Error?c.message:String(c);if(o==="FINGERPRINT_TAKEN"||o==="MACHINE_LIMIT_EXCEEDED"){}else{console.warn("[Buoy] Device registration failed:",o);throw c}}if(this.cachedLicense){this.cachedLicense.fingerprint=r;this.cachedLicense.deviceName=n;this.cachedLicense=await this.persistCache(this.cachedLicense)}this.pendingRegistration=null}emit(e){const i=[...this.listeners];i.forEach(t=>{try{t(e)}catch(r){console.warn("[React Buoy] License listener error:",r)}})}isCacheValid(e){const i=Date.now();const t=i-e.cachedAt;if(t>_config.LICENSE_CACHE_DURATION){return false}if(e.expiresAt){const r=new Date(e.expiresAt).getTime();if(i>r){return false}}return true}isCacheFresh(e){return Date.now()-(e.lastValidatedAt??0)<_config.LICENSE_LAUNCH_VALIDATION_TTL}async persistCache(e){const i=(0,_cacheSignature.signCache)(e);const t=await getLicenseStorage();await t.setItem(_config.LICENSE_STORAGE_KEY,JSON.stringify(i));return i}async loadCachedLicense(){try{const e=await getLicenseStorage();const i=await e.getItem(_config.LICENSE_STORAGE_KEY);if(!i)return null;const t=JSON.parse(i);return t}catch(e){console.warn("[Buoy] Error loading cached license:",e);return null}}getOrCreateDeviceFingerprint(){if(!this.fingerprintPromise){this.fingerprintPromise=(async()=>{const e=await getLicenseStorage();const i=await e.getItem(_config.DEVICE_FINGERPRINT_STORAGE_KEY);if(i)return i;const t=this.cachedLicense?.fingerprint||(0,_fingerprint.generateUUID)();await e.setItem(_config.DEVICE_FINGERPRINT_STORAGE_KEY,t);return t})()}return this.fingerprintPromise}async clearCachedLicense(){this.cachedLicense=null;try{const e=await getLicenseStorage();await e.removeItem(_config.LICENSE_STORAGE_KEY)}catch{}}registerDeviceAsync(e,i,t,r){const n=(0,_fingerprint.getDeviceMetadata)();(0,_api.activateMachine)(e,i,t,r,n).catch(a=>{if(a.message!=="FINGERPRINT_TAKEN"&&a.message!=="MACHINE_LIMIT_EXCEEDED"){console.warn("[Buoy] Device registration failed (non-blocking):",a.message)}})}validateInBackground(e){const i=this.generation;(0,_api.validateLicense)(e).then(async t=>{if(i!==this.generation)return;const r=(0,_api.parseValidationResult)(t);if(r.valid&&t.data){const n=(0,_tier.resolveTier)(t.data);this.applyTier(n);const a=Date.now();this.cachedLicense=await this.persistCache({...this.cachedLicense??{},licenseKey:e,licenseId:t.data.id,valid:true,isPro:n==="pro",tier:n,expiresAt:t.data.attributes.expiry??null,cachedAt:a,lastValidatedAt:a});this.state.expiresAt=t.data.attributes.expiry?new Date(t.data.attributes.expiry):null;this.emit({type:"validated",isPro:this.state.isPro})}else if((0,_api.isFatalLicenseError)(r.code)){console.warn("[React Buoy] Background validation: license is invalid -",r.code);this.applyTier((0,_tier.tierAfterFatalError)(r.code));await this.clearCachedLicense();this.emit({type:"deactivated",isPro:false})}}).catch(t=>{console.warn("[React Buoy] Background validation failed:",t);if((0,_api.isTransientLicenseError)(t)&&i===this.generation&&!this.state.isPro){this.scheduleRetry(e)}})}startRevalidationTimer(){if(this.revalidationTimer){clearInterval(this.revalidationTimer)}this.revalidationTimer=setInterval(()=>{if(this.state.licenseKey&&!this.state.isValidating){this.validateInBackground(this.state.licenseKey)}},_config.LICENSE_REVALIDATION_INTERVAL);if(__DEV__){global.__LICENSE_MANAGER_TIMER__=this.revalidationTimer}}stopRevalidationTimer(){if(this.revalidationTimer){clearInterval(this.revalidationTimer);this.revalidationTimer=null}this.cancelRetry()}async forceReregister(){if(this.cachedLicense){this.cachedLicense.fingerprint=void 0;this.cachedLicense.deviceName=void 0}this.fingerprintPromise=null;await this.clearCachedLicense();try{const e=await getLicenseStorage();await e.removeItem(_config.DEVICE_FINGERPRINT_STORAGE_KEY)}catch{}}}const LicenseManager=exports.LicenseManager=new LicenseManagerImpl;if(__DEV__){if(global.__LICENSE_MANAGER_TIMER__){clearInterval(global.__LICENSE_MANAGER_TIMER__)}if(global.__LICENSE_MANAGER_RETRY_TIMER__){clearTimeout(global.__LICENSE_MANAGER_RETRY_TIMER__);global.__LICENSE_MANAGER_RETRY_TIMER__=void 0}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.activateMachine=activateMachine;exports.isFatalLicenseError=isFatalLicenseError;exports.parseValidationResult=parseValidationResult;exports.validateLicense=validateLicense;var _config=require("./config.js");const{accountId,productToken,apiUrl}=_config.KEYGEN_CONFIG;function getBaseHeaders(){return{"Content-Type":"application/vnd.api+json",Accept:"application/vnd.api+json"}}function getLicenseAuthHeaders(e){return{...getBaseHeaders(),Authorization:`License ${e}`}}function getProductTokenHeaders(){return{...getBaseHeaders(),Authorization:`Bearer ${productToken}`}}async function validateLicense(e){const t=`${apiUrl}/${accountId}/licenses/actions/validate-key`;const a={meta:{key:e}};const o=await fetch(t,{method:"POST",headers:getBaseHeaders(),body:JSON.stringify(a)});if(!o.ok){const d=await o.json();const i=d.errors?.[0]?.detail||`HTTP ${o.status}`;throw new Error(i)}return await o.json()}async function activateMachine(e,t,a,o,d){const i=`${apiUrl}/${accountId}/machines`;const E={data:{type:"machines",attributes:{fingerprint:a,name:o,metadata:d||{}},relationships:{license:{data:{type:"licenses",id:e}}}}};let r=await fetch(i,{method:"POST",headers:getLicenseAuthHeaders(t),body:JSON.stringify(E)});if(!r.ok){const n=await r.json();const s=n.errors?.[0]?.detail||"";const c=n.errors?.[0]?.code;if(s.toLowerCase().includes("authentication is not allowed by policy")){r=await fetch(i,{method:"POST",headers:getProductTokenHeaders(),body:JSON.stringify(E)})}else if(c==="FINGERPRINT_TAKEN"){throw new Error("FINGERPRINT_TAKEN")}else if(c==="MACHINE_LIMIT_EXCEEDED"){throw new Error("MACHINE_LIMIT_EXCEEDED")}else{throw new Error(s)}}if(!r.ok){const n=await r.json();const s=n.errors?.[0]?.code;if(s==="FINGERPRINT_TAKEN"){throw new Error("FINGERPRINT_TAKEN")}if(s==="MACHINE_LIMIT_EXCEEDED"){throw new Error("MACHINE_LIMIT_EXCEEDED")}const c=n.errors?.[0]?.detail||`HTTP ${r.status}`;throw new Error(c)}return r.json()}function parseValidationResult(e){const{meta:t,data:a}=e;return{valid:t.valid,code:t.code,detail:t.detail,metadata:a?.attributes?.metadata}}function isFatalLicenseError(e){return["NOT_FOUND","SUSPENDED","EXPIRED","BANNED","PRODUCT_SCOPE_MISMATCH"].includes(e)}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.LicenseTransportError=void 0;exports.activateMachine=activateMachine;exports.isFatalLicenseError=isFatalLicenseError;exports.isTransientLicenseError=isTransientLicenseError;exports.parseValidationResult=parseValidationResult;exports.validateLicense=validateLicense;var _config=require("./config.js");const{accountId,productToken,apiUrl}=_config.KEYGEN_CONFIG;class LicenseTransportError extends Error{isTransient=true;constructor(r,n){super(r);this.name="LicenseTransportError";this.status=n}}exports.LicenseTransportError=LicenseTransportError;function isTransientLicenseError(e){if(e instanceof LicenseTransportError)return true;if(e instanceof TypeError)return true;return typeof e==="object"&&e!==null&&e.isTransient===true}async function describeFailure(e){try{const r=await e.json();return r.errors?.[0]?.detail||`HTTP ${e.status}`}catch{return`HTTP ${e.status}`}}function getBaseHeaders(){return{"Content-Type":"application/vnd.api+json",Accept:"application/vnd.api+json"}}function getLicenseAuthHeaders(e){return{...getBaseHeaders(),Authorization:`License ${e}`}}function getProductTokenHeaders(){return{...getBaseHeaders(),Authorization:`Bearer ${productToken}`}}async function validateLicense(e){const r=`${apiUrl}/${accountId}/licenses/actions/validate-key`;const n={meta:{key:e}};let t;try{t=await fetch(r,{method:"POST",headers:getBaseHeaders(),body:JSON.stringify(n)})}catch(i){throw new LicenseTransportError(i instanceof Error?i.message:"Network request failed",null)}if(!t.ok){throw new LicenseTransportError(await describeFailure(t),t.status)}try{return await t.json()}catch{throw new LicenseTransportError("License server returned an unreadable response",t.status)}}async function activateMachine(e,r,n,t,i){const u=`${apiUrl}/${accountId}/machines`;const d={data:{type:"machines",attributes:{fingerprint:n,name:t,metadata:i||{}},relationships:{license:{data:{type:"licenses",id:e}}}}};let s=await fetch(u,{method:"POST",headers:getLicenseAuthHeaders(r),body:JSON.stringify(d)});if(!s.ok){const a=await s.json();const o=a.errors?.[0]?.detail||"";const c=a.errors?.[0]?.code;if(o.toLowerCase().includes("authentication is not allowed by policy")){s=await fetch(u,{method:"POST",headers:getProductTokenHeaders(),body:JSON.stringify(d)})}else if(c==="FINGERPRINT_TAKEN"){throw new Error("FINGERPRINT_TAKEN")}else if(c==="MACHINE_LIMIT_EXCEEDED"){throw new Error("MACHINE_LIMIT_EXCEEDED")}else{throw new Error(o)}}if(!s.ok){const a=await s.json();const o=a.errors?.[0]?.code;if(o==="FINGERPRINT_TAKEN"){throw new Error("FINGERPRINT_TAKEN")}if(o==="MACHINE_LIMIT_EXCEEDED"){throw new Error("MACHINE_LIMIT_EXCEEDED")}const c=a.errors?.[0]?.detail||`HTTP ${s.status}`;throw new Error(c)}return s.json()}function parseValidationResult(e){const{meta:r,data:n}=e;return{valid:r.valid,code:r.code,detail:r.detail,metadata:n?.attributes?.metadata}}function isFatalLicenseError(e){return["NOT_FOUND","SUSPENDED","EXPIRED","BANNED","PRODUCT_SCOPE_MISMATCH"].includes(e)}
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.LICENSE_STORAGE_KEY=exports.LICENSE_REVALIDATION_INTERVAL=exports.LICENSE_LAUNCH_VALIDATION_TTL=exports.LICENSE_CACHE_DURATION=exports.KEYGEN_POLICIES=exports.KEYGEN_CONFIG=exports.DEVICE_FINGERPRINT_STORAGE_KEY=exports.ANONYMOUS_TIER_ENABLED=void 0;/*!
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.LICENSE_TRANSIENT_RETRY_DELAYS=exports.LICENSE_STORAGE_KEY=exports.LICENSE_REVALIDATION_INTERVAL=exports.LICENSE_LAUNCH_VALIDATION_TTL=exports.LICENSE_CACHE_DURATION=exports.KEYGEN_POLICIES=exports.KEYGEN_CONFIG=exports.DEVICE_FINGERPRINT_STORAGE_KEY=exports.ANONYMOUS_TIER_ENABLED=void 0;/*!
2
2
  * PROPRIETARY — Buoy Pro license enforcement. NOT open source.
3
3
  *
4
4
  * Copyright (c) Buoy. All rights reserved. Licensed under the Buoy EULA
@@ -14,4 +14,4 @@
14
14
  * Pro is $9/mo, and is free every weekend for anyone holding a key —
15
15
  * including a free one (`npx buoy login`). Buy a key at
16
16
  * https://buoy.gg or use it free on Saturday and Sunday.
17
- */const KEYGEN_CONFIG=exports.KEYGEN_CONFIG={accountId:"b0eba0e8-e904-4906-b644-38f9aab57bed",productId:"bf67cb43-eeef-40ca-b308-e6e1b22c0eaa",productToken:"prod-4467c14b75b715e91884945cd3e69705846ccbce7dd5e380236a1ab3bc03139fv3",apiUrl:"https://api.keygen.sh/v1/accounts"};const KEYGEN_POLICIES=exports.KEYGEN_POLICIES={free:"394e3351-1249-4f73-807a-703408604c0e",solo:"fa5d3c8f-5379-40f1-b63e-ab8a974b2f28",business:"690c2212-8e54-426f-b4b4-002ee1c0ae2b"};const LICENSE_CACHE_DURATION=exports.LICENSE_CACHE_DURATION=30*24*60*60*1e3;const LICENSE_REVALIDATION_INTERVAL=exports.LICENSE_REVALIDATION_INTERVAL=24*60*60*1e3;const LICENSE_STORAGE_KEY=exports.LICENSE_STORAGE_KEY="buoy-gg-license";const DEVICE_FINGERPRINT_STORAGE_KEY=exports.DEVICE_FINGERPRINT_STORAGE_KEY="buoy-gg-device-fingerprint";const LICENSE_LAUNCH_VALIDATION_TTL=exports.LICENSE_LAUNCH_VALIDATION_TTL=60*60*1e3;const ANONYMOUS_TIER_ENABLED=exports.ANONYMOUS_TIER_ENABLED=true;
17
+ */const KEYGEN_CONFIG=exports.KEYGEN_CONFIG={accountId:"b0eba0e8-e904-4906-b644-38f9aab57bed",productId:"bf67cb43-eeef-40ca-b308-e6e1b22c0eaa",productToken:"prod-4467c14b75b715e91884945cd3e69705846ccbce7dd5e380236a1ab3bc03139fv3",apiUrl:"https://api.keygen.sh/v1/accounts"};const KEYGEN_POLICIES=exports.KEYGEN_POLICIES={free:"394e3351-1249-4f73-807a-703408604c0e",solo:"fa5d3c8f-5379-40f1-b63e-ab8a974b2f28",business:"690c2212-8e54-426f-b4b4-002ee1c0ae2b"};const LICENSE_CACHE_DURATION=exports.LICENSE_CACHE_DURATION=30*24*60*60*1e3;const LICENSE_REVALIDATION_INTERVAL=exports.LICENSE_REVALIDATION_INTERVAL=24*60*60*1e3;const LICENSE_STORAGE_KEY=exports.LICENSE_STORAGE_KEY="buoy-gg-license";const DEVICE_FINGERPRINT_STORAGE_KEY=exports.DEVICE_FINGERPRINT_STORAGE_KEY="buoy-gg-device-fingerprint";const LICENSE_LAUNCH_VALIDATION_TTL=exports.LICENSE_LAUNCH_VALIDATION_TTL=60*60*1e3;const LICENSE_TRANSIENT_RETRY_DELAYS=exports.LICENSE_TRANSIENT_RETRY_DELAYS=[5*1e3,20*1e3,60*1e3,5*60*1e3,15*60*1e3];const ANONYMOUS_TIER_ENABLED=exports.ANONYMOUS_TIER_ENABLED=true;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"ANONYMOUS_TIER_ENABLED",{enumerable:true,get:function(){return _config.ANONYMOUS_TIER_ENABLED}});Object.defineProperty(exports,"DeviceRegistrationModal",{enumerable:true,get:function(){return _DeviceRegistrationModal.DeviceRegistrationModal}});Object.defineProperty(exports,"LicenseManager",{enumerable:true,get:function(){return _LicenseManager.LicenseManager}});exports.hasEntitlement=hasEntitlement;exports.isPro=isPro;Object.defineProperty(exports,"isWeekendFreePro",{enumerable:true,get:function(){return _weekendPro.isWeekendFreePro}});exports.setLicenseKey=setLicenseKey;Object.defineProperty(exports,"useFeatureAccess",{enumerable:true,get:function(){return _hooks.useFeatureAccess}});Object.defineProperty(exports,"useIsPro",{enumerable:true,get:function(){return _hooks.useIsPro}});Object.defineProperty(exports,"useLicense",{enumerable:true,get:function(){return _hooks.useLicense}});Object.defineProperty(exports,"useProAccess",{enumerable:true,get:function(){return _hooks.useProAccess}});Object.defineProperty(exports,"useTier",{enumerable:true,get:function(){return _hooks.useTier}});Object.defineProperty(exports,"useWeekendFreePro",{enumerable:true,get:function(){return _weekendPro.useWeekendFreePro}});var _LicenseManager=require("./LicenseManager.js");var _DeviceRegistrationModal=require("./DeviceRegistrationModal.js");var _hooks=require("./hooks.js");var _config=require("./config.js");var _weekendPro=require("./weekendPro.js");function _interopRequireWildcard(r,t){if("function"==typeof WeakMap)var u=new WeakMap,c=new WeakMap;return(_interopRequireWildcard=function(e,a){if(!a&&e&&e.__esModule)return e;var n,o,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(n=a?c:u){if(n.has(e))return n.get(e);n.set(e,s)}for(const i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((o=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,i))&&(o.get||o.set)?n(s,i,o):s[i]=e[i]);return s})(r,t)}/*!
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"ANONYMOUS_TIER_ENABLED",{enumerable:true,get:function(){return _config.ANONYMOUS_TIER_ENABLED}});Object.defineProperty(exports,"DeviceRegistrationModal",{enumerable:true,get:function(){return _DeviceRegistrationModal.DeviceRegistrationModal}});Object.defineProperty(exports,"LicenseManager",{enumerable:true,get:function(){return _LicenseManager.LicenseManager}});Object.defineProperty(exports,"LicenseTransportError",{enumerable:true,get:function(){return _api.LicenseTransportError}});exports.hasEntitlement=hasEntitlement;exports.isPro=isPro;Object.defineProperty(exports,"isTransientLicenseError",{enumerable:true,get:function(){return _api.isTransientLicenseError}});Object.defineProperty(exports,"isWeekendFreePro",{enumerable:true,get:function(){return _weekendPro.isWeekendFreePro}});exports.setLicenseKey=setLicenseKey;Object.defineProperty(exports,"useFeatureAccess",{enumerable:true,get:function(){return _hooks.useFeatureAccess}});Object.defineProperty(exports,"useIsPro",{enumerable:true,get:function(){return _hooks.useIsPro}});Object.defineProperty(exports,"useLicense",{enumerable:true,get:function(){return _hooks.useLicense}});Object.defineProperty(exports,"useProAccess",{enumerable:true,get:function(){return _hooks.useProAccess}});Object.defineProperty(exports,"useTier",{enumerable:true,get:function(){return _hooks.useTier}});Object.defineProperty(exports,"useWeekendFreePro",{enumerable:true,get:function(){return _weekendPro.useWeekendFreePro}});var _LicenseManager=require("./LicenseManager.js");var _DeviceRegistrationModal=require("./DeviceRegistrationModal.js");var _hooks=require("./hooks.js");var _config=require("./config.js");var _api=require("./api.js");var _weekendPro=require("./weekendPro.js");function _interopRequireWildcard(r,t){if("function"==typeof WeakMap)var u=new WeakMap,c=new WeakMap;return(_interopRequireWildcard=function(e,a){if(!a&&e&&e.__esModule)return e;var n,o,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(n=a?c:u){if(n.has(e))return n.get(e);n.set(e,s)}for(const i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((o=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,i))&&(o.get||o.set)?n(s,i,o):s[i]=e[i]);return s})(r,t)}/*!
2
2
  * PROPRIETARY — Buoy Pro license enforcement. NOT open source.
3
3
  *
4
4
  * Copyright (c) Buoy. All rights reserved. Licensed under the Buoy EULA
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"ANONYMOUS_TIER_ENABLED",{enumerable:true,get:function(){return _config.ANONYMOUS_TIER_ENABLED}});Object.defineProperty(exports,"LicenseManager",{enumerable:true,get:function(){return _LicenseManager.LicenseManager}});exports.hasEntitlement=hasEntitlement;exports.isPro=isPro;Object.defineProperty(exports,"isWeekendFreePro",{enumerable:true,get:function(){return _weekendPro.isWeekendFreePro}});exports.setLicenseKey=setLicenseKey;Object.defineProperty(exports,"useFeatureAccess",{enumerable:true,get:function(){return _hooks.useFeatureAccess}});Object.defineProperty(exports,"useIsPro",{enumerable:true,get:function(){return _hooks.useIsPro}});Object.defineProperty(exports,"useLicense",{enumerable:true,get:function(){return _hooks.useLicense}});Object.defineProperty(exports,"useProAccess",{enumerable:true,get:function(){return _hooks.useProAccess}});Object.defineProperty(exports,"useTier",{enumerable:true,get:function(){return _hooks.useTier}});Object.defineProperty(exports,"useWeekendFreePro",{enumerable:true,get:function(){return _weekendPro.useWeekendFreePro}});var _LicenseManager=require("./LicenseManager.js");var _hooks=require("./hooks.js");var _config=require("./config.js");var _weekendPro=require("./weekendPro.js");function _interopRequireWildcard(r,n){if("function"==typeof WeakMap)var o=new WeakMap,a=new WeakMap;return(_interopRequireWildcard=function(e,c){if(!c&&e&&e.__esModule)return e;var t,u,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(t=c?a:o){if(t.has(e))return t.get(e);t.set(e,i)}for(const s in e)"default"!==s&&{}.hasOwnProperty.call(e,s)&&((u=(t=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,s))&&(u.get||u.set)?t(i,s,u):i[s]=e[s]);return i})(r,n)}/*!
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"ANONYMOUS_TIER_ENABLED",{enumerable:true,get:function(){return _config.ANONYMOUS_TIER_ENABLED}});Object.defineProperty(exports,"LicenseManager",{enumerable:true,get:function(){return _LicenseManager.LicenseManager}});Object.defineProperty(exports,"LicenseTransportError",{enumerable:true,get:function(){return _api.LicenseTransportError}});exports.hasEntitlement=hasEntitlement;exports.isPro=isPro;Object.defineProperty(exports,"isTransientLicenseError",{enumerable:true,get:function(){return _api.isTransientLicenseError}});Object.defineProperty(exports,"isWeekendFreePro",{enumerable:true,get:function(){return _weekendPro.isWeekendFreePro}});exports.setLicenseKey=setLicenseKey;Object.defineProperty(exports,"useFeatureAccess",{enumerable:true,get:function(){return _hooks.useFeatureAccess}});Object.defineProperty(exports,"useIsPro",{enumerable:true,get:function(){return _hooks.useIsPro}});Object.defineProperty(exports,"useLicense",{enumerable:true,get:function(){return _hooks.useLicense}});Object.defineProperty(exports,"useProAccess",{enumerable:true,get:function(){return _hooks.useProAccess}});Object.defineProperty(exports,"useTier",{enumerable:true,get:function(){return _hooks.useTier}});Object.defineProperty(exports,"useWeekendFreePro",{enumerable:true,get:function(){return _weekendPro.useWeekendFreePro}});var _LicenseManager=require("./LicenseManager.js");var _hooks=require("./hooks.js");var _config=require("./config.js");var _api=require("./api.js");var _weekendPro=require("./weekendPro.js");function _interopRequireWildcard(r,n){if("function"==typeof WeakMap)var o=new WeakMap,a=new WeakMap;return(_interopRequireWildcard=function(e,c){if(!c&&e&&e.__esModule)return e;var t,u,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(t=c?a:o){if(t.has(e))return t.get(e);t.set(e,s)}for(const i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((u=(t=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,i))&&(u.get||u.set)?t(s,i,u):s[i]=e[i]);return s})(r,n)}/*!
2
2
  * PROPRIETARY — Buoy Pro license enforcement. NOT open source.
3
3
  *
4
4
  * Copyright (c) Buoy. All rights reserved. Licensed under the Buoy EULA
@@ -13,4 +13,4 @@
13
13
  * Pro is $9/mo, and is free every weekend for anyone holding a key —
14
14
  * including a free one (`npx buoy login`). Buy a key at
15
15
  * https://buoy.gg or use it free on Saturday and Sunday.
16
- */const k="buoy-license";let o=null;let h=null;const m=new Map;function A(){if(o)return o;try{const a=require("expo-file-system/legacy");o=a?.default||a;if(o?.documentDirectory){return o}o=null}catch{}try{const a=require("expo-file-system");o=a?.default||a;if(o?.documentDirectory){return o}o=null}catch{}return null}function _(){const a=A();if(!a?.documentDirectory)return null;return`${a.documentDirectory}${k}/`}function p(a){const e=_();if(!e)return null;return`${e}${encodeURIComponent(a)}.json`}function K(){try{const a=require("@react-native-async-storage/async-storage");const e=a?.default||a;if(typeof e?.getItem==="function"&&typeof e.setItem==="function"&&typeof e.removeItem==="function"){return e}}catch{}return null}function M(){try{return typeof localStorage!=="undefined"&&!!localStorage}catch{return false}}async function u(){if(h)return h;const a=A();let e=null;if(a?.documentDirectory){h={async getItem(t){const i=p(t);if(!i)return null;try{const s=await a.getInfoAsync(i);if(!s.exists)return null;return await a.readAsStringAsync(i)}catch{return null}},async setItem(t,i){const s=_();const n=p(t);if(!s||!n)return;try{const r=await a.getInfoAsync(s);if(!r.exists){await a.makeDirectoryAsync(s,{intermediates:true})}await a.writeAsStringAsync(n,i)}catch(r){console.warn("[Buoy] License storage write failed:",r)}},async removeItem(t){const i=p(t);if(!i)return;try{await a.deleteAsync(i,{idempotent:true})}catch{}}}}else if(e=K()){const t=e;h={async getItem(i){try{return await t.getItem(i)}catch{return null}},async setItem(i,s){try{await t.setItem(i,s)}catch(n){console.warn("[Buoy] License storage write failed:",n)}},async removeItem(i){try{await t.removeItem(i)}catch{}}}}else if(M()){h={async getItem(t){try{return localStorage.getItem(t)}catch{return null}},async setItem(t,i){try{localStorage.setItem(t,i)}catch{}},async removeItem(t){try{localStorage.removeItem(t)}catch{}}}}else{h={async getItem(t){return m.get(t)??null},async setItem(t,i){m.set(t,i)},async removeItem(t){m.delete(t)}}}return h}import{LICENSE_STORAGE_KEY as I,LICENSE_CACHE_DURATION as B,LICENSE_REVALIDATION_INTERVAL as F,LICENSE_LAUNCH_VALIDATION_TTL as z,DEVICE_FINGERPRINT_STORAGE_KEY as v}from"./config.js";import{validateLicense as C,activateMachine as P,parseValidationResult as R,isFatalLicenseError as T}from"./api.js";import{generateUUID as O,getDeviceMetadata as D,getDefaultDeviceName as N}from"./fingerprint";import{signCache as G,verifyCacheSignature as S}from"./cacheSignature.js";import{resolveTier as x,tierAfterFatalError as V}from"./tier.js";function w(a){if(a.tier)return a.tier;return a.isPro?"pro":"anonymous"}class U{state={isInitialized:false,isValidating:false,isPro:false,tier:"anonymous",tierSource:"none",licenseKey:null,error:null,expiresAt:null};listeners=new Set;revalidationTimer=null;cachedLicense=null;fingerprintPromise=null;initPromise=null;generation=0;deviceRegistrationCallback=null;pendingRegistration=null;async initialize(){if(this.initPromise)return this.initPromise;if(this.state.isInitialized)return;this.initPromise=this._doInitialize();return this.initPromise}async _doInitialize(){if(this.state.isInitialized)return;try{const e=await this.loadCachedLicense();if(e){const t=S(e);this.cachedLicense=e;this.state.licenseKey=e.licenseKey;this.applyTier(t&&this.isCacheValid(e)?w(e):"anonymous");this.state.expiresAt=e.expiresAt?new Date(e.expiresAt):null;if(e.licenseKey&&!(t&&this.isCacheValid(e)&&this.isCacheFresh(e))){this.validateInBackground(e.licenseKey)}}this.state.isInitialized=true;this.emit({type:"initialized",isPro:this.state.isPro});this.startRevalidationTimer()}catch(e){console.warn("[React Buoy] License initialization failed:",e);this.state.isInitialized=true;this.emit({type:"initialized",isPro:false})}}async setLicenseKey(e,t){if(!e||e.trim().length===0){this.state.error="License key is required";return false}const i=e.trim().toUpperCase();const s=this.cachedLicense;if(!t?.force&&s&&s.valid&&s.licenseKey===i&&s.fingerprint&&S(s)&&this.isCacheValid(s)&&this.isCacheFresh(s)){this.applyTier(w(s));this.state.licenseKey=i;this.state.isValidating=false;this.state.error=null;this.state.expiresAt=s.expiresAt?new Date(s.expiresAt):null;this.emit({type:"validated",isPro:this.state.isPro});return true}this.generation+=1;const n=this.generation;this.state.licenseKey=i;this.state.isValidating=true;this.state.error=null;this.emit({type:"validating",isPro:this.state.isPro});try{const r=await C(i);if(n!==this.generation)return false;const c=R(r);if(T(c.code)){this.applyTier(V(c.code));this.state.isValidating=false;this.state.error=c.detail;await this.clearCachedLicense();this.emit({type:"error",isPro:false,error:c.detail});return false}if(!r.data){this.state.isValidating=false;this.state.error=c.detail||"License not found";await this.clearCachedLicense();this.emit({type:"error",isPro:false,error:this.state.error});return false}const l=x(r.data);this.applyTier(l);this.state.isValidating=false;this.state.expiresAt=r.data.attributes.expiry?new Date(r.data.attributes.expiry):null;const g=r.data.id;const L=Date.now();let d=this.cachedLicense?.fingerprint;let f=this.cachedLicense?.deviceName;let E=false;if(!d){d=await this.getOrCreateDeviceFingerprint();f=N();E=true}let y=false;if(E){if(this.deviceRegistrationCallback){this.pendingRegistration={licenseId:g,licenseKey:i,fingerprint:d};this.deviceRegistrationCallback({fingerprint:d,defaultName:f});y=true}else{this.registerDeviceAsync(g,i,d,f)}}const b={licenseKey:i,licenseId:g,valid:true,isPro:l==="pro",tier:l,expiresAt:r.data.attributes.expiry??null,cachedAt:L,lastValidatedAt:L,fingerprint:y?void 0:d,deviceName:y?void 0:f};this.cachedLicense=await this.persistCache(b);this.emit({type:"validated",isPro:this.state.isPro});return true}catch(r){const c=r instanceof Error?r.message:"Validation failed";if(n!==this.generation)return false;if(this.isNetworkError(r)&&this.cachedLicense&&this.isCacheValid(this.cachedLicense)){this.applyTier(w(this.cachedLicense));this.state.isValidating=false;this.emit({type:"validated",isPro:this.state.isPro});return true}this.state.isValidating=false;this.state.error=c;this.emit({type:"error",isPro:false,error:c});return false}}isNetworkError(e){if(e instanceof TypeError){return true}if(e instanceof Error){const t=e.message.toLowerCase();return t.includes("network")||t.includes("fetch")||t.includes("timeout")||t.includes("connection")||t.includes("offline")||t.includes("failed to fetch")}return false}async clearLicense(){this.generation+=1;this.state.licenseKey=null;this.applyTier("anonymous");this.state.expiresAt=null;this.state.error=null;this.cachedLicense=null;await this.clearCachedLicense();this.emit({type:"deactivated",isPro:false})}applyTier(e){this.state.tier=e;this.state.tierSource=e==="anonymous"?"none":"key";this.state.isPro=e==="pro"}getTier(){return this.state.tier}isPro(){return this.state.tier==="pro"}hasEntitlement(e){if(e==="PRO"){return this.state.isPro}return this.state.isPro}getState(){return{...this.state}}subscribe(e){this.listeners.add(e);return()=>this.listeners.delete(e)}onDeviceRegistrationNeeded(e){this.deviceRegistrationCallback=e;return()=>{this.deviceRegistrationCallback=null}}async completeDeviceRegistration(e){if(!this.pendingRegistration){console.warn("[Buoy] No pending device registration");return}const{licenseId:t,licenseKey:i,fingerprint:s}=this.pendingRegistration;const n=e.trim()||N();const r=D();try{await P(t,i,s,n,r)}catch(c){const l=c instanceof Error?c.message:String(c);if(l==="FINGERPRINT_TAKEN"||l==="MACHINE_LIMIT_EXCEEDED"){}else{console.warn("[Buoy] Device registration failed:",l);throw c}}if(this.cachedLicense){this.cachedLicense.fingerprint=s;this.cachedLicense.deviceName=n;this.cachedLicense=await this.persistCache(this.cachedLicense)}this.pendingRegistration=null}emit(e){const t=[...this.listeners];t.forEach(i=>{try{i(e)}catch(s){console.warn("[React Buoy] License listener error:",s)}})}isCacheValid(e){const t=Date.now();const i=t-e.cachedAt;if(i>B){return false}if(e.expiresAt){const s=new Date(e.expiresAt).getTime();if(t>s){return false}}return true}isCacheFresh(e){return Date.now()-(e.lastValidatedAt??0)<z}async persistCache(e){const t=G(e);const i=await u();await i.setItem(I,JSON.stringify(t));return t}async loadCachedLicense(){try{const e=await u();const t=await e.getItem(I);if(!t)return null;const i=JSON.parse(t);return i}catch(e){console.warn("[Buoy] Error loading cached license:",e);return null}}getOrCreateDeviceFingerprint(){if(!this.fingerprintPromise){this.fingerprintPromise=(async()=>{const e=await u();const t=await e.getItem(v);if(t)return t;const i=this.cachedLicense?.fingerprint||O();await e.setItem(v,i);return i})()}return this.fingerprintPromise}async clearCachedLicense(){this.cachedLicense=null;try{const e=await u();await e.removeItem(I)}catch{}}registerDeviceAsync(e,t,i,s){const n=D();P(e,t,i,s,n).catch(r=>{if(r.message!=="FINGERPRINT_TAKEN"&&r.message!=="MACHINE_LIMIT_EXCEEDED"){console.warn("[Buoy] Device registration failed (non-blocking):",r.message)}})}validateInBackground(e){const t=this.generation;C(e).then(async i=>{if(t!==this.generation)return;const s=R(i);if(s.valid&&i.data){const n=x(i.data);this.applyTier(n);const r=Date.now();this.cachedLicense=await this.persistCache({...this.cachedLicense??{},licenseKey:e,licenseId:i.data.id,valid:true,isPro:n==="pro",tier:n,expiresAt:i.data.attributes.expiry??null,cachedAt:r,lastValidatedAt:r});this.state.expiresAt=i.data.attributes.expiry?new Date(i.data.attributes.expiry):null;this.emit({type:"validated",isPro:this.state.isPro})}else if(T(s.code)){console.warn("[React Buoy] Background validation: license is invalid -",s.code);this.applyTier(V(s.code));await this.clearCachedLicense();this.emit({type:"deactivated",isPro:false})}}).catch(i=>{console.warn("[React Buoy] Background validation failed:",i)})}startRevalidationTimer(){if(this.revalidationTimer){clearInterval(this.revalidationTimer)}this.revalidationTimer=setInterval(()=>{if(this.state.licenseKey&&!this.state.isValidating){this.validateInBackground(this.state.licenseKey)}},F);if(__DEV__){global.__LICENSE_MANAGER_TIMER__=this.revalidationTimer}}stopRevalidationTimer(){if(this.revalidationTimer){clearInterval(this.revalidationTimer);this.revalidationTimer=null}}async forceReregister(){if(this.cachedLicense){this.cachedLicense.fingerprint=void 0;this.cachedLicense.deviceName=void 0}this.fingerprintPromise=null;await this.clearCachedLicense();try{const e=await u();await e.removeItem(v)}catch{}}}export const LicenseManager=new U;if(__DEV__){if(global.__LICENSE_MANAGER_TIMER__){clearInterval(global.__LICENSE_MANAGER_TIMER__)}}
16
+ */const b="buoy-license";let l=null;let h=null;const m=new Map;function R(){if(l)return l;try{const s=require("expo-file-system/legacy");l=s?.default||s;if(l?.documentDirectory){return l}l=null}catch{}try{const s=require("expo-file-system");l=s?.default||s;if(l?.documentDirectory){return l}l=null}catch{}return null}function T(){const s=R();if(!s?.documentDirectory)return null;return`${s.documentDirectory}${b}/`}function p(s){const e=T();if(!e)return null;return`${e}${encodeURIComponent(s)}.json`}function B(){try{const s=require("@react-native-async-storage/async-storage");const e=s?.default||s;if(typeof e?.getItem==="function"&&typeof e.setItem==="function"&&typeof e.removeItem==="function"){return e}}catch{}return null}function k(){try{return typeof localStorage!=="undefined"&&!!localStorage}catch{return false}}async function u(){if(h)return h;const s=R();let e=null;if(s?.documentDirectory){h={async getItem(i){const t=p(i);if(!t)return null;try{const r=await s.getInfoAsync(t);if(!r.exists)return null;return await s.readAsStringAsync(t)}catch{return null}},async setItem(i,t){const r=T();const n=p(i);if(!r||!n)return;try{const a=await s.getInfoAsync(r);if(!a.exists){await s.makeDirectoryAsync(r,{intermediates:true})}await s.writeAsStringAsync(n,t)}catch(a){console.warn("[Buoy] License storage write failed:",a)}},async removeItem(i){const t=p(i);if(!t)return;try{await s.deleteAsync(t,{idempotent:true})}catch{}}}}else if(e=B()){const i=e;h={async getItem(t){try{return await i.getItem(t)}catch{return null}},async setItem(t,r){try{await i.setItem(t,r)}catch(n){console.warn("[Buoy] License storage write failed:",n)}},async removeItem(t){try{await i.removeItem(t)}catch{}}}}else if(k()){h={async getItem(i){try{return localStorage.getItem(i)}catch{return null}},async setItem(i,t){try{localStorage.setItem(i,t)}catch{}},async removeItem(i){try{localStorage.removeItem(i)}catch{}}}}else{h={async getItem(i){return m.get(i)??null},async setItem(i,t){m.set(i,t)},async removeItem(i){m.delete(i)}}}return h}import{LICENSE_STORAGE_KEY as I,LICENSE_CACHE_DURATION as F,LICENSE_REVALIDATION_INTERVAL as G,LICENSE_LAUNCH_VALIDATION_TTL as z,LICENSE_TRANSIENT_RETRY_DELAYS as O,DEVICE_FINGERPRINT_STORAGE_KEY as _}from"./config.js";import{validateLicense as w,activateMachine as C,parseValidationResult as N,isFatalLicenseError as P,isTransientLicenseError as D}from"./api.js";import{generateUUID as Y,getDeviceMetadata as S,getDefaultDeviceName as x}from"./fingerprint";import{signCache as U,verifyCacheSignature as E}from"./cacheSignature.js";import{resolveTier as K,tierAfterFatalError as V}from"./tier.js";function A(s){if(s.tier)return s.tier;return s.isPro?"pro":"anonymous"}class q{state={isInitialized:false,isValidating:false,isPro:false,tier:"anonymous",tierSource:"none",licenseKey:null,error:null,errorKind:null,expiresAt:null};listeners=new Set;revalidationTimer=null;cachedLicense=null;fingerprintPromise=null;initPromise=null;generation=0;retryTimer=null;retryAttempt=0;deviceRegistrationCallback=null;pendingRegistration=null;async initialize(){if(this.initPromise)return this.initPromise;if(this.state.isInitialized)return;this.initPromise=this._doInitialize();return this.initPromise}async _doInitialize(){if(this.state.isInitialized)return;try{const e=await this.loadCachedLicense();if(e){const i=E(e);this.cachedLicense=e;this.state.licenseKey=e.licenseKey;this.applyTier(i&&this.isCacheValid(e)?A(e):"anonymous");this.state.expiresAt=e.expiresAt?new Date(e.expiresAt):null;if(e.licenseKey&&!(i&&this.isCacheValid(e)&&this.isCacheFresh(e))){this.validateInBackground(e.licenseKey)}}this.state.isInitialized=true;this.emit({type:"initialized",isPro:this.state.isPro});this.startRevalidationTimer()}catch(e){console.warn("[React Buoy] License initialization failed:",e);this.state.isInitialized=true;this.emit({type:"initialized",isPro:false})}}async setLicenseKey(e,i){if(!e||e.trim().length===0){this.state.error="License key is required";this.state.errorKind="verdict";return false}const t=e.trim().toUpperCase();const r=this.cachedLicense;if(!i?.force&&r&&r.valid&&r.licenseKey===t&&r.fingerprint&&E(r)&&this.isCacheValid(r)&&this.isCacheFresh(r)){this.applyTier(A(r));this.state.licenseKey=t;this.state.isValidating=false;this.state.error=null;this.state.errorKind=null;this.state.expiresAt=r.expiresAt?new Date(r.expiresAt):null;this.emit({type:"validated",isPro:this.state.isPro});return true}this.generation+=1;this.cancelRetry();if(i?.force&&!i.isRetry)this.retryAttempt=0;const n=this.generation;this.state.licenseKey=t;this.state.isValidating=true;this.state.error=null;this.state.errorKind=null;this.emit({type:"validating",isPro:this.state.isPro});let a;try{a=await w(t)}catch(c){const o=c instanceof Error?c.message:"Validation failed";if(n!==this.generation)return false;if(D(c)){this.state.isValidating=false;if(this.cachedLicense&&this.cachedLicense.licenseKey===t&&E(this.cachedLicense)&&this.isCacheValid(this.cachedLicense)){this.applyTier(A(this.cachedLicense));this.state.error=null;this.state.errorKind=null;this.state.expiresAt=this.cachedLicense.expiresAt?new Date(this.cachedLicense.expiresAt):null;this.emit({type:"validated",isPro:this.state.isPro});return true}this.state.error=o;this.state.errorKind="transport";this.scheduleRetry(t);this.emit({type:"error",isPro:this.state.isPro,error:o});return false}this.state.isValidating=false;this.state.error=o;this.state.errorKind="verdict";this.emit({type:"error",isPro:false,error:o});return false}try{if(n!==this.generation)return false;const c=N(a);if(P(c.code)){this.applyTier(V(c.code));this.state.isValidating=false;this.state.error=c.detail;this.state.errorKind="verdict";await this.clearCachedLicense();this.emit({type:"error",isPro:false,error:c.detail});return false}if(!a.data){this.state.isValidating=false;this.state.error=c.detail||"License not found";this.state.errorKind="verdict";await this.clearCachedLicense();this.emit({type:"error",isPro:false,error:this.state.error});return false}const o=K(a.data);this.applyTier(o);this.state.isValidating=false;this.state.expiresAt=a.data.attributes.expiry?new Date(a.data.attributes.expiry):null;const y=a.data.id;const v=Date.now();let d=this.cachedLicense?.fingerprint;let f=this.cachedLicense?.deviceName;let L=false;if(!d){d=await this.getOrCreateDeviceFingerprint();f=x();L=true}let g=false;if(L){if(this.deviceRegistrationCallback){this.pendingRegistration={licenseId:y,licenseKey:t,fingerprint:d};this.deviceRegistrationCallback({fingerprint:d,defaultName:f});g=true}else{this.registerDeviceAsync(y,t,d,f)}}const M={licenseKey:t,licenseId:y,valid:true,isPro:o==="pro",tier:o,expiresAt:a.data.attributes.expiry??null,cachedAt:v,lastValidatedAt:v,fingerprint:g?void 0:d,deviceName:g?void 0:f};this.cachedLicense=await this.persistCache(M);this.retryAttempt=0;this.emit({type:"validated",isPro:this.state.isPro});return true}catch(c){const o=c instanceof Error?c.message:"Validation failed";if(n!==this.generation)return false;this.state.isValidating=false;this.state.error=o;this.state.errorKind="verdict";this.emit({type:"error",isPro:false,error:o});return false}}scheduleRetry(e){this.cancelRetry();const i=O[this.retryAttempt];if(i===void 0)return;this.retryAttempt+=1;const t=this.generation;this.retryTimer=setTimeout(()=>{this.retryTimer=null;if(t!==this.generation)return;if(this.state.isValidating)return;void this.setLicenseKey(e,{force:true,isRetry:true})},i);if(__DEV__){global.__LICENSE_MANAGER_RETRY_TIMER__=this.retryTimer}}cancelRetry(){if(this.retryTimer){clearTimeout(this.retryTimer);this.retryTimer=null}}async clearLicense(){this.generation+=1;this.cancelRetry();this.retryAttempt=0;this.state.licenseKey=null;this.applyTier("anonymous");this.state.expiresAt=null;this.state.error=null;this.state.errorKind=null;this.cachedLicense=null;await this.clearCachedLicense();this.emit({type:"deactivated",isPro:false})}applyTier(e){this.state.tier=e;this.state.tierSource=e==="anonymous"?"none":"key";this.state.isPro=e==="pro"}getTier(){return this.state.tier}isPro(){return this.state.tier==="pro"}hasEntitlement(e){if(e==="PRO"){return this.state.isPro}return this.state.isPro}getState(){return{...this.state}}subscribe(e){this.listeners.add(e);return()=>this.listeners.delete(e)}onDeviceRegistrationNeeded(e){this.deviceRegistrationCallback=e;return()=>{this.deviceRegistrationCallback=null}}async completeDeviceRegistration(e){if(!this.pendingRegistration){console.warn("[Buoy] No pending device registration");return}const{licenseId:i,licenseKey:t,fingerprint:r}=this.pendingRegistration;const n=e.trim()||x();const a=S();try{await C(i,t,r,n,a)}catch(c){const o=c instanceof Error?c.message:String(c);if(o==="FINGERPRINT_TAKEN"||o==="MACHINE_LIMIT_EXCEEDED"){}else{console.warn("[Buoy] Device registration failed:",o);throw c}}if(this.cachedLicense){this.cachedLicense.fingerprint=r;this.cachedLicense.deviceName=n;this.cachedLicense=await this.persistCache(this.cachedLicense)}this.pendingRegistration=null}emit(e){const i=[...this.listeners];i.forEach(t=>{try{t(e)}catch(r){console.warn("[React Buoy] License listener error:",r)}})}isCacheValid(e){const i=Date.now();const t=i-e.cachedAt;if(t>F){return false}if(e.expiresAt){const r=new Date(e.expiresAt).getTime();if(i>r){return false}}return true}isCacheFresh(e){return Date.now()-(e.lastValidatedAt??0)<z}async persistCache(e){const i=U(e);const t=await u();await t.setItem(I,JSON.stringify(i));return i}async loadCachedLicense(){try{const e=await u();const i=await e.getItem(I);if(!i)return null;const t=JSON.parse(i);return t}catch(e){console.warn("[Buoy] Error loading cached license:",e);return null}}getOrCreateDeviceFingerprint(){if(!this.fingerprintPromise){this.fingerprintPromise=(async()=>{const e=await u();const i=await e.getItem(_);if(i)return i;const t=this.cachedLicense?.fingerprint||Y();await e.setItem(_,t);return t})()}return this.fingerprintPromise}async clearCachedLicense(){this.cachedLicense=null;try{const e=await u();await e.removeItem(I)}catch{}}registerDeviceAsync(e,i,t,r){const n=S();C(e,i,t,r,n).catch(a=>{if(a.message!=="FINGERPRINT_TAKEN"&&a.message!=="MACHINE_LIMIT_EXCEEDED"){console.warn("[Buoy] Device registration failed (non-blocking):",a.message)}})}validateInBackground(e){const i=this.generation;w(e).then(async t=>{if(i!==this.generation)return;const r=N(t);if(r.valid&&t.data){const n=K(t.data);this.applyTier(n);const a=Date.now();this.cachedLicense=await this.persistCache({...this.cachedLicense??{},licenseKey:e,licenseId:t.data.id,valid:true,isPro:n==="pro",tier:n,expiresAt:t.data.attributes.expiry??null,cachedAt:a,lastValidatedAt:a});this.state.expiresAt=t.data.attributes.expiry?new Date(t.data.attributes.expiry):null;this.emit({type:"validated",isPro:this.state.isPro})}else if(P(r.code)){console.warn("[React Buoy] Background validation: license is invalid -",r.code);this.applyTier(V(r.code));await this.clearCachedLicense();this.emit({type:"deactivated",isPro:false})}}).catch(t=>{console.warn("[React Buoy] Background validation failed:",t);if(D(t)&&i===this.generation&&!this.state.isPro){this.scheduleRetry(e)}})}startRevalidationTimer(){if(this.revalidationTimer){clearInterval(this.revalidationTimer)}this.revalidationTimer=setInterval(()=>{if(this.state.licenseKey&&!this.state.isValidating){this.validateInBackground(this.state.licenseKey)}},G);if(__DEV__){global.__LICENSE_MANAGER_TIMER__=this.revalidationTimer}}stopRevalidationTimer(){if(this.revalidationTimer){clearInterval(this.revalidationTimer);this.revalidationTimer=null}this.cancelRetry()}async forceReregister(){if(this.cachedLicense){this.cachedLicense.fingerprint=void 0;this.cachedLicense.deviceName=void 0}this.fingerprintPromise=null;await this.clearCachedLicense();try{const e=await u();await e.removeItem(_)}catch{}}}export const LicenseManager=new q;if(__DEV__){if(global.__LICENSE_MANAGER_TIMER__){clearInterval(global.__LICENSE_MANAGER_TIMER__)}if(global.__LICENSE_MANAGER_RETRY_TIMER__){clearTimeout(global.__LICENSE_MANAGER_RETRY_TIMER__);global.__LICENSE_MANAGER_RETRY_TIMER__=void 0}}
package/lib/module/api.js CHANGED
@@ -1 +1 @@
1
- "use strict";import{KEYGEN_CONFIG as T}from"./config.js";const{accountId:l,productToken:h,apiUrl:N}=T;function E(){return{"Content-Type":"application/vnd.api+json",Accept:"application/vnd.api+json"}}function I(e){return{...E(),Authorization:`License ${e}`}}function w(){return{...E(),Authorization:`Bearer ${h}`}}export async function validateLicense(e){const t=`${N}/${l}/licenses/actions/validate-key`;const a={meta:{key:e}};const o=await fetch(t,{method:"POST",headers:E(),body:JSON.stringify(a)});if(!o.ok){const d=await o.json();const i=d.errors?.[0]?.detail||`HTTP ${o.status}`;throw new Error(i)}return await o.json()}export async function activateMachine(e,t,a,o,d){const i=`${N}/${l}/machines`;const u={data:{type:"machines",attributes:{fingerprint:a,name:o,metadata:d||{}},relationships:{license:{data:{type:"licenses",id:e}}}}};let r=await fetch(i,{method:"POST",headers:I(t),body:JSON.stringify(u)});if(!r.ok){const n=await r.json();const s=n.errors?.[0]?.detail||"";const c=n.errors?.[0]?.code;if(s.toLowerCase().includes("authentication is not allowed by policy")){r=await fetch(i,{method:"POST",headers:w(),body:JSON.stringify(u)})}else if(c==="FINGERPRINT_TAKEN"){throw new Error("FINGERPRINT_TAKEN")}else if(c==="MACHINE_LIMIT_EXCEEDED"){throw new Error("MACHINE_LIMIT_EXCEEDED")}else{throw new Error(s)}}if(!r.ok){const n=await r.json();const s=n.errors?.[0]?.code;if(s==="FINGERPRINT_TAKEN"){throw new Error("FINGERPRINT_TAKEN")}if(s==="MACHINE_LIMIT_EXCEEDED"){throw new Error("MACHINE_LIMIT_EXCEEDED")}const c=n.errors?.[0]?.detail||`HTTP ${r.status}`;throw new Error(c)}return r.json()}export function parseValidationResult(e){const{meta:t,data:a}=e;return{valid:t.valid,code:t.code,detail:t.detail,metadata:a?.attributes?.metadata}}export function isFatalLicenseError(e){return["NOT_FOUND","SUSPENDED","EXPIRED","BANNED","PRODUCT_SCOPE_MISMATCH"].includes(e)}
1
+ "use strict";import{KEYGEN_CONFIG as f}from"./config.js";const{accountId:l,productToken:h,apiUrl:T}=f;export class LicenseTransportError extends Error{isTransient=true;constructor(t,n){super(t);this.name="LicenseTransportError";this.status=n}}export function isTransientLicenseError(e){if(e instanceof LicenseTransportError)return true;if(e instanceof TypeError)return true;return typeof e==="object"&&e!==null&&e.isTransient===true}async function w(e){try{const t=await e.json();return t.errors?.[0]?.detail||`HTTP ${e.status}`}catch{return`HTTP ${e.status}`}}function u(){return{"Content-Type":"application/vnd.api+json",Accept:"application/vnd.api+json"}}function p(e){return{...u(),Authorization:`License ${e}`}}function N(){return{...u(),Authorization:`Bearer ${h}`}}export async function validateLicense(e){const t=`${T}/${l}/licenses/actions/validate-key`;const n={meta:{key:e}};let r;try{r=await fetch(t,{method:"POST",headers:u(),body:JSON.stringify(n)})}catch(i){throw new LicenseTransportError(i instanceof Error?i.message:"Network request failed",null)}if(!r.ok){throw new LicenseTransportError(await w(r),r.status)}try{return await r.json()}catch{throw new LicenseTransportError("License server returned an unreadable response",r.status)}}export async function activateMachine(e,t,n,r,i){const d=`${T}/${l}/machines`;const E={data:{type:"machines",attributes:{fingerprint:n,name:r,metadata:i||{}},relationships:{license:{data:{type:"licenses",id:e}}}}};let o=await fetch(d,{method:"POST",headers:p(t),body:JSON.stringify(E)});if(!o.ok){const a=await o.json();const s=a.errors?.[0]?.detail||"";const c=a.errors?.[0]?.code;if(s.toLowerCase().includes("authentication is not allowed by policy")){o=await fetch(d,{method:"POST",headers:N(),body:JSON.stringify(E)})}else if(c==="FINGERPRINT_TAKEN"){throw new Error("FINGERPRINT_TAKEN")}else if(c==="MACHINE_LIMIT_EXCEEDED"){throw new Error("MACHINE_LIMIT_EXCEEDED")}else{throw new Error(s)}}if(!o.ok){const a=await o.json();const s=a.errors?.[0]?.code;if(s==="FINGERPRINT_TAKEN"){throw new Error("FINGERPRINT_TAKEN")}if(s==="MACHINE_LIMIT_EXCEEDED"){throw new Error("MACHINE_LIMIT_EXCEEDED")}const c=a.errors?.[0]?.detail||`HTTP ${o.status}`;throw new Error(c)}return o.json()}export function parseValidationResult(e){const{meta:t,data:n}=e;return{valid:t.valid,code:t.code,detail:t.detail,metadata:n?.attributes?.metadata}}export function isFatalLicenseError(e){return["NOT_FOUND","SUSPENDED","EXPIRED","BANNED","PRODUCT_SCOPE_MISMATCH"].includes(e)}
@@ -14,4 +14,4 @@
14
14
  * Pro is $9/mo, and is free every weekend for anyone holding a key —
15
15
  * including a free one (`npx buoy login`). Buy a key at
16
16
  * https://buoy.gg or use it free on Saturday and Sunday.
17
- */export const KEYGEN_CONFIG={accountId:"b0eba0e8-e904-4906-b644-38f9aab57bed",productId:"bf67cb43-eeef-40ca-b308-e6e1b22c0eaa",productToken:"prod-4467c14b75b715e91884945cd3e69705846ccbce7dd5e380236a1ab3bc03139fv3",apiUrl:"https://api.keygen.sh/v1/accounts"};export const KEYGEN_POLICIES={free:"394e3351-1249-4f73-807a-703408604c0e",solo:"fa5d3c8f-5379-40f1-b63e-ab8a974b2f28",business:"690c2212-8e54-426f-b4b4-002ee1c0ae2b"};export const LICENSE_CACHE_DURATION=30*24*60*60*1e3;export const LICENSE_REVALIDATION_INTERVAL=24*60*60*1e3;export const LICENSE_STORAGE_KEY="buoy-gg-license";export const DEVICE_FINGERPRINT_STORAGE_KEY="buoy-gg-device-fingerprint";export const LICENSE_LAUNCH_VALIDATION_TTL=60*60*1e3;export const ANONYMOUS_TIER_ENABLED=true;
17
+ */export const KEYGEN_CONFIG={accountId:"b0eba0e8-e904-4906-b644-38f9aab57bed",productId:"bf67cb43-eeef-40ca-b308-e6e1b22c0eaa",productToken:"prod-4467c14b75b715e91884945cd3e69705846ccbce7dd5e380236a1ab3bc03139fv3",apiUrl:"https://api.keygen.sh/v1/accounts"};export const KEYGEN_POLICIES={free:"394e3351-1249-4f73-807a-703408604c0e",solo:"fa5d3c8f-5379-40f1-b63e-ab8a974b2f28",business:"690c2212-8e54-426f-b4b4-002ee1c0ae2b"};export const LICENSE_CACHE_DURATION=30*24*60*60*1e3;export const LICENSE_REVALIDATION_INTERVAL=24*60*60*1e3;export const LICENSE_STORAGE_KEY="buoy-gg-license";export const DEVICE_FINGERPRINT_STORAGE_KEY="buoy-gg-device-fingerprint";export const LICENSE_LAUNCH_VALIDATION_TTL=60*60*1e3;export const LICENSE_TRANSIENT_RETRY_DELAYS=[5*1e3,20*1e3,60*1e3,5*60*1e3,15*60*1e3];export const ANONYMOUS_TIER_ENABLED=true;
@@ -15,4 +15,4 @@
15
15
  * Pro is $9/mo, and is free every weekend for anyone holding a key —
16
16
  * including a free one (`npx buoy login`). Buy a key at
17
17
  * https://buoy.gg or use it free on Saturday and Sunday.
18
- */export{LicenseManager}from"./LicenseManager.js";export{DeviceRegistrationModal}from"./DeviceRegistrationModal.js";export{useLicense,useFeatureAccess,useIsPro,useProAccess,useTier}from"./hooks.js";export{ANONYMOUS_TIER_ENABLED}from"./config.js";export{isWeekendFreePro,useWeekendFreePro}from"./weekendPro.js";export async function setLicenseKey(e){const{LicenseManager:r}=await import("./LicenseManager");await r.initialize();return r.setLicenseKey(e)}function n(){const{isWeekendFreePro:e,weekendPassAppliesTo:r}=require("./weekendPro");const{LicenseManager:s}=require("./LicenseManager");return r(s.getTier(),e())}export function isPro(){const{LicenseManager:e}=require("./LicenseManager");if(e.isPro())return true;return n()}export function hasEntitlement(e){const{LicenseManager:r}=require("./LicenseManager");if(r.hasEntitlement(e))return true;return n()}
18
+ */export{LicenseManager}from"./LicenseManager.js";export{DeviceRegistrationModal}from"./DeviceRegistrationModal.js";export{useLicense,useFeatureAccess,useIsPro,useProAccess,useTier}from"./hooks.js";export{ANONYMOUS_TIER_ENABLED}from"./config.js";export{LicenseTransportError,isTransientLicenseError}from"./api.js";export{isWeekendFreePro,useWeekendFreePro}from"./weekendPro.js";export async function setLicenseKey(e){const{LicenseManager:r}=await import("./LicenseManager");await r.initialize();return r.setLicenseKey(e)}function n(){const{isWeekendFreePro:e,weekendPassAppliesTo:r}=require("./weekendPro");const{LicenseManager:s}=require("./LicenseManager");return r(s.getTier(),e())}export function isPro(){const{LicenseManager:e}=require("./LicenseManager");if(e.isPro())return true;return n()}export function hasEntitlement(e){const{LicenseManager:r}=require("./LicenseManager");if(r.hasEntitlement(e))return true;return n()}
@@ -15,4 +15,4 @@
15
15
  * Pro is $9/mo, and is free every weekend for anyone holding a key —
16
16
  * including a free one (`npx buoy login`). Buy a key at
17
17
  * https://buoy.gg or use it free on Saturday and Sunday.
18
- */export{LicenseManager}from"./LicenseManager.js";export{useLicense,useFeatureAccess,useIsPro,useProAccess,useTier}from"./hooks.js";export{ANONYMOUS_TIER_ENABLED}from"./config.js";export{isWeekendFreePro,useWeekendFreePro}from"./weekendPro.js";export async function setLicenseKey(e){const{LicenseManager:r}=await import("./LicenseManager");await r.initialize();return r.setLicenseKey(e)}function n(){const{isWeekendFreePro:e,weekendPassAppliesTo:r}=require("./weekendPro");const{LicenseManager:s}=require("./LicenseManager");return r(s.getTier(),e())}export function isPro(){const{LicenseManager:e}=require("./LicenseManager");if(e.isPro())return true;return n()}export function hasEntitlement(e){const{LicenseManager:r}=require("./LicenseManager");if(r.hasEntitlement(e))return true;return n()}
18
+ */export{LicenseManager}from"./LicenseManager.js";export{useLicense,useFeatureAccess,useIsPro,useProAccess,useTier}from"./hooks.js";export{ANONYMOUS_TIER_ENABLED}from"./config.js";export{LicenseTransportError,isTransientLicenseError}from"./api.js";export{isWeekendFreePro,useWeekendFreePro}from"./weekendPro.js";export async function setLicenseKey(e){const{LicenseManager:r}=await import("./LicenseManager");await r.initialize();return r.setLicenseKey(e)}function n(){const{isWeekendFreePro:e,weekendPassAppliesTo:r}=require("./weekendPro");const{LicenseManager:s}=require("./LicenseManager");return r(s.getTier(),e())}export function isPro(){const{LicenseManager:e}=require("./LicenseManager");if(e.isPro())return true;return n()}export function hasEntitlement(e){const{LicenseManager:r}=require("./LicenseManager");if(r.hasEntitlement(e))return true;return n()}
@@ -42,6 +42,13 @@ declare class LicenseManagerImpl {
42
42
  * it no longer matches.
43
43
  */
44
44
  private generation;
45
+ /**
46
+ * Pending backoff retry after a transient failure (see
47
+ * LICENSE_TRANSIENT_RETRY_DELAYS). At most one is ever outstanding, and it
48
+ * is cancelled by any deliberate credential change or by a success.
49
+ */
50
+ private retryTimer;
51
+ private retryAttempt;
45
52
  private deviceRegistrationCallback;
46
53
  private pendingRegistration;
47
54
  /**
@@ -61,11 +68,26 @@ declare class LicenseManagerImpl {
61
68
  */
62
69
  setLicenseKey(licenseKey: string, opts?: {
63
70
  force?: boolean;
71
+ /**
72
+ * Set only by {@link scheduleRetry}. A retry has to `force` (its whole
73
+ * job is to get past the freshness cache), but it must NOT be mistaken
74
+ * for a fresh user attempt — refilling the backoff budget on every retry
75
+ * turns the schedule into an infinite loop.
76
+ *
77
+ * @internal
78
+ */
79
+ isRetry?: boolean;
64
80
  }): Promise<boolean>;
65
81
  /**
66
- * Check if an error is a network error (not an API validation error)
82
+ * Retry a transiently-failed validation on a short, finite backoff.
83
+ *
84
+ * Only ever scheduled when there was nothing cached to fall back on, which
85
+ * is the one case that leaves a real customer stuck: the key comes in as a
86
+ * prop, so without this the next attempt is the daily revalidation timer.
67
87
  */
68
- private isNetworkError;
88
+ private scheduleRetry;
89
+ /** Drop any pending retry — a newer decision has replaced it. */
90
+ private cancelRetry;
69
91
  /**
70
92
  * Clear the current license
71
93
  */
@@ -1 +1 @@
1
- {"version":3,"file":"LicenseManager.d.ts","sourceRoot":"","sources":["../../../src/LicenseManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA0QH,OAAO,KAAK,EACV,QAAQ,EAER,YAAY,EAEZ,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,kDAAkD;AAClD,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,mDAAmD;AACnD,MAAM,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE,sBAAsB,KAAK,IAAI,CAAC;AAsBhF,cAAM,kBAAkB;IACtB,OAAO,CAAC,KAAK,CASX;IAEF,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,iBAAiB,CAA+C;IACxE,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,kBAAkB,CAAgC;IAG1D,OAAO,CAAC,WAAW,CAA8B;IAEjD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,UAAU,CAAK;IAGvB,OAAO,CAAC,0BAA0B,CAA2C;IAC7E,OAAO,CAAC,mBAAmB,CAAoC;IAE/D;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAUjC;;OAEG;YACW,aAAa;IAiD3B;;;;;;OAMG;IACG,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GACzB,OAAO,CAAC,OAAO,CAAC;IAwKnB;;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H,SAAS,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,IAAI;IAKhD;;;;;OAKG;IACH,0BAA0B,CAAC,QAAQ,EAAE,0BAA0B,GAAG,MAAM,IAAI;IAO5E;;;OAGG;IACG,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCnE,OAAO,CAAC,IAAI;IAYZ,OAAO,CAAC,YAAY;IAkBpB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;OAIG;YACW,YAAY;YAOZ,iBAAiB;IAc/B;;;;;;OAMG;IACH,OAAO,CAAC,4BAA4B;YAetB,kBAAkB;IAWhC;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,oBAAoB;IA6D5B,OAAO,CAAC,sBAAsB;IAmB9B;;OAEG;IACH,qBAAqB,IAAI,IAAI;IAU7B;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAevC;AAGD,eAAO,MAAM,cAAc,oBAA2B,CAAC"}
@@ -5,6 +5,36 @@
5
5
  * No limits enforced - we trust our customers.
6
6
  */
7
7
  import type { KeygenValidationResponse, KeygenMachineResponse, LicenseValidationResult } from "./types";
8
+ /**
9
+ * The license server did not give us a verdict about the key.
10
+ *
11
+ * Keygen answers every *licensing* outcome with HTTP 200 and a `meta.code`
12
+ * (VALID, EXPIRED, SUSPENDED, NOT_FOUND, ...). So a non-2xx is never a
13
+ * statement about this key — it means we failed to ask. The ways that happens
14
+ * in the wild are all temporary and none of them are the user's fault: a 429
15
+ * once the account's daily request quota is spent, a 5xx, or a captive portal
16
+ * or corporate proxy answering with HTML instead of JSON.
17
+ *
18
+ * Callers MUST treat this like an offline device: keep whatever the cache
19
+ * already proved and try again later. Downgrading here is how a paying
20
+ * customer ends up staring at a silent "Free" badge because someone else
21
+ * burned the quota.
22
+ */
23
+ export declare class LicenseTransportError extends Error {
24
+ /** Discriminator that survives bundling, subclassing and realm boundaries. */
25
+ readonly isTransient: true;
26
+ /** HTTP status, or null when the request never got an answer at all. */
27
+ readonly status: number | null;
28
+ constructor(message: string, status: number | null);
29
+ }
30
+ /**
31
+ * True for anything that means "we could not ask", from any realm.
32
+ *
33
+ * `instanceof` alone is not enough: Metro can end up with two copies of this
34
+ * module (a package importing the CJS build while the app gets the ESM one),
35
+ * and then the class identity differs from the one the thrower used.
36
+ */
37
+ export declare function isTransientLicenseError(error: unknown): boolean;
8
38
  /**
9
39
  * Validate a license key with Keygen
10
40
  */
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EAErB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAkCjB;;GAEG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,wBAAwB,CAAC,CAyBnC;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,qBAAqB,CAAC,CAsEhC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,wBAAwB,GACjC,uBAAuB,CAUzB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQzD"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EAErB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAIjB;;;;;;;;;;;;;;GAcG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,EAAG,IAAI,CAAU;IACrC,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEnB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAKnD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAS/D;AA+CD;;GAEG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,wBAAwB,CAAC,CA0CnC;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,qBAAqB,CAAC,CAsEhC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,wBAAwB,GACjC,uBAAuB,CAUzB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQzD"}
@@ -55,6 +55,22 @@ export declare const LICENSE_REVALIDATION_INTERVAL: number;
55
55
  export declare const LICENSE_STORAGE_KEY = "buoy-gg-license";
56
56
  export declare const DEVICE_FINGERPRINT_STORAGE_KEY = "buoy-gg-device-fingerprint";
57
57
  export declare const LICENSE_LAUNCH_VALIDATION_TTL: number;
58
+ /**
59
+ * Backoff for retrying a validation that failed in transit (quota, 5xx, proxy).
60
+ *
61
+ * Without this a transient failure at launch is a 24-HOUR outage for the user:
62
+ * `setLicenseKey()` is called once from the `licenseKey` prop, and the only
63
+ * thing that would try again is LICENSE_REVALIDATION_INTERVAL. Someone whose
64
+ * first launch lands during a blip would sit on "Free" for a day, with no
65
+ * cache to fall back on and nothing on screen explaining why.
66
+ *
67
+ * The schedule is short and finite on purpose — it is there to survive a blip,
68
+ * not to hammer a server that is already refusing us. Once it runs out, the
69
+ * daily timer and the next launch take over. The 15-minute tail is what lets
70
+ * "turn the VPN off and keep working" heal without a reload — the earlier
71
+ * steps are all spent before anyone has finished toggling anything.
72
+ */
73
+ export declare const LICENSE_TRANSIENT_RETRY_DELAYS: readonly [number, number, number, number, number];
58
74
  /**
59
75
  * Master switch for the ANONYMOUS tier.
60
76
  *
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AAEH,eAAO,MAAM,aAAa;;IAExB;;;;;;;;OAQG;;;;CAMK,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;IAC1B,iEAAiE;;IAEjE,qEAAqE;;IAErE,oDAAoD;;CAE5C,CAAC;AAGX,eAAO,MAAM,sBAAsB,QAA2B,CAAC;AAI/D,eAAO,MAAM,6BAA6B,QAAsB,CAAC;AAIjE,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAMrD,eAAO,MAAM,8BAA8B,+BAA+B,CAAC;AAM3E,eAAO,MAAM,6BAA6B,QAAiB,CAAC;AAE5D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AAEH,eAAO,MAAM,aAAa;;IAExB;;;;;;;;OAQG;;;;CAMK,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;IAC1B,iEAAiE;;IAEjE,qEAAqE;;IAErE,oDAAoD;;CAE5C,CAAC;AAGX,eAAO,MAAM,sBAAsB,QAA2B,CAAC;AAI/D,eAAO,MAAM,6BAA6B,QAAsB,CAAC;AAIjE,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAMrD,eAAO,MAAM,8BAA8B,+BAA+B,CAAC;AAM3E,eAAO,MAAM,6BAA6B,QAAiB,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B,mDAMjC,CAAC;AAEX;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC"}
@@ -31,6 +31,7 @@ export { DeviceRegistrationModal } from "./DeviceRegistrationModal";
31
31
  export { useLicense, useFeatureAccess, useIsPro, useProAccess, useTier } from "./hooks";
32
32
  export type { ProAccessReason } from "./hooks";
33
33
  export { ANONYMOUS_TIER_ENABLED } from "./config";
34
+ export { LicenseTransportError, isTransientLicenseError } from "./api";
34
35
  export { isWeekendFreePro, useWeekendFreePro } from "./weekendPro";
35
36
  export type { BuoyTier, TierSource, LicenseState, LicenseEvent, LicenseListener, LicenseValidationResult, CachedLicense, } from "./types";
36
37
  export declare function setLicenseKey(key: string): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EACV,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxF,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGnE,YAAY,EACV,QAAQ,EACR,UAAU,EACV,YA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LicenseManager";
29
29
  export { useLicense, useFeatureAccess, useIsPro, useProAccess, useTier } from "./hooks";
30
30
  export type { ProAccessReason } from "./hooks";
31
31
  export { ANONYMOUS_TIER_ENABLED } from "./config";
32
+ export { LicenseTransportError, isTransientLicenseError } from "./api";
32
33
  export { isWeekendFreePro, useWeekendFreePro } from "./weekendPro";
33
34
  export type { BuoyTier, TierSource, LicenseState, LicenseEvent, LicenseListener, LicenseValidationResult, CachedLicense, } from "./types";
34
35
  export declare function setLicenseKey(key: string): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxF,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGnE,YAAY,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIjE;AAaD,wBAAgB,KAAK,IAAI,OAAO,CAI/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpD"}
1
+ {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxF,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAIlD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGnE,YAAY,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIjE;AAaD,wBAAgB,KAAK,IAAI,OAAO,CAI/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpD"}
@@ -190,6 +190,19 @@ export interface LicenseState {
190
190
  tierSource: TierSource;
191
191
  licenseKey: string | null;
192
192
  error: string | null;
193
+ /**
194
+ * What kind of failure `error` describes, so UIs can give the right advice:
195
+ *
196
+ * - "transport" — we could not ASK the license server (offline, VPN/proxy
197
+ * interception, quota 429, 5xx). The key was never judged; suggesting the
198
+ * user check their connection is right, blaming the key is not.
199
+ * - "verdict" — the server answered and the answer was bad (suspended,
200
+ * expired, not found), or validation failed client-side after the server
201
+ * answered. Anything that must NOT be presented as a connectivity problem.
202
+ *
203
+ * Always null when `error` is null.
204
+ */
205
+ errorKind: "transport" | "verdict" | null;
193
206
  expiresAt: Date | null;
194
207
  }
195
208
  export type LicenseEventType = "initialized" | "validating" | "validated" | "error" | "deactivated";
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":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AAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC"}
@@ -42,6 +42,13 @@ declare class LicenseManagerImpl {
42
42
  * it no longer matches.
43
43
  */
44
44
  private generation;
45
+ /**
46
+ * Pending backoff retry after a transient failure (see
47
+ * LICENSE_TRANSIENT_RETRY_DELAYS). At most one is ever outstanding, and it
48
+ * is cancelled by any deliberate credential change or by a success.
49
+ */
50
+ private retryTimer;
51
+ private retryAttempt;
45
52
  private deviceRegistrationCallback;
46
53
  private pendingRegistration;
47
54
  /**
@@ -61,11 +68,26 @@ declare class LicenseManagerImpl {
61
68
  */
62
69
  setLicenseKey(licenseKey: string, opts?: {
63
70
  force?: boolean;
71
+ /**
72
+ * Set only by {@link scheduleRetry}. A retry has to `force` (its whole
73
+ * job is to get past the freshness cache), but it must NOT be mistaken
74
+ * for a fresh user attempt — refilling the backoff budget on every retry
75
+ * turns the schedule into an infinite loop.
76
+ *
77
+ * @internal
78
+ */
79
+ isRetry?: boolean;
64
80
  }): Promise<boolean>;
65
81
  /**
66
- * Check if an error is a network error (not an API validation error)
82
+ * Retry a transiently-failed validation on a short, finite backoff.
83
+ *
84
+ * Only ever scheduled when there was nothing cached to fall back on, which
85
+ * is the one case that leaves a real customer stuck: the key comes in as a
86
+ * prop, so without this the next attempt is the daily revalidation timer.
67
87
  */
68
- private isNetworkError;
88
+ private scheduleRetry;
89
+ /** Drop any pending retry — a newer decision has replaced it. */
90
+ private cancelRetry;
69
91
  /**
70
92
  * Clear the current license
71
93
  */
@@ -1 +1 @@
1
- {"version":3,"file":"LicenseManager.d.ts","sourceRoot":"","sources":["../../../src/LicenseManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA0QH,OAAO,KAAK,EACV,QAAQ,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IAWhC;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,oBAAoB;IA6D5B,OAAO,CAAC,sBAAsB;IAmB9B;;OAEG;IACH,qBAAqB,IAAI,IAAI;IAU7B;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAevC;AAGD,eAAO,MAAM,cAAc,oBAA2B,CAAC"}
@@ -5,6 +5,36 @@
5
5
  * No limits enforced - we trust our customers.
6
6
  */
7
7
  import type { KeygenValidationResponse, KeygenMachineResponse, LicenseValidationResult } from "./types";
8
+ /**
9
+ * The license server did not give us a verdict about the key.
10
+ *
11
+ * Keygen answers every *licensing* outcome with HTTP 200 and a `meta.code`
12
+ * (VALID, EXPIRED, SUSPENDED, NOT_FOUND, ...). So a non-2xx is never a
13
+ * statement about this key — it means we failed to ask. The ways that happens
14
+ * in the wild are all temporary and none of them are the user's fault: a 429
15
+ * once the account's daily request quota is spent, a 5xx, or a captive portal
16
+ * or corporate proxy answering with HTML instead of JSON.
17
+ *
18
+ * Callers MUST treat this like an offline device: keep whatever the cache
19
+ * already proved and try again later. Downgrading here is how a paying
20
+ * customer ends up staring at a silent "Free" badge because someone else
21
+ * burned the quota.
22
+ */
23
+ export declare class LicenseTransportError extends Error {
24
+ /** Discriminator that survives bundling, subclassing and realm boundaries. */
25
+ readonly isTransient: true;
26
+ /** HTTP status, or null when the request never got an answer at all. */
27
+ readonly status: number | null;
28
+ constructor(message: string, status: number | null);
29
+ }
30
+ /**
31
+ * True for anything that means "we could not ask", from any realm.
32
+ *
33
+ * `instanceof` alone is not enough: Metro can end up with two copies of this
34
+ * module (a package importing the CJS build while the app gets the ESM one),
35
+ * and then the class identity differs from the one the thrower used.
36
+ */
37
+ export declare function isTransientLicenseError(error: unknown): boolean;
8
38
  /**
9
39
  * Validate a license key with Keygen
10
40
  */
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api.ts"],"names":[],"mappings":"AAAA;;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nC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,qBAAqB,CAAC,CAsEhC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,wBAAwB,GACjC,uBAAuB,CAUzB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQzD"}
@@ -55,6 +55,22 @@ export declare const LICENSE_REVALIDATION_INTERVAL: number;
55
55
  export declare const LICENSE_STORAGE_KEY = "buoy-gg-license";
56
56
  export declare const DEVICE_FINGERPRINT_STORAGE_KEY = "buoy-gg-device-fingerprint";
57
57
  export declare const LICENSE_LAUNCH_VALIDATION_TTL: number;
58
+ /**
59
+ * Backoff for retrying a validation that failed in transit (quota, 5xx, proxy).
60
+ *
61
+ * Without this a transient failure at launch is a 24-HOUR outage for the user:
62
+ * `setLicenseKey()` is called once from the `licenseKey` prop, and the only
63
+ * thing that would try again is LICENSE_REVALIDATION_INTERVAL. Someone whose
64
+ * first launch lands during a blip would sit on "Free" for a day, with no
65
+ * cache to fall back on and nothing on screen explaining why.
66
+ *
67
+ * The schedule is short and finite on purpose — it is there to survive a blip,
68
+ * not to hammer a server that is already refusing us. Once it runs out, the
69
+ * daily timer and the next launch take over. The 15-minute tail is what lets
70
+ * "turn the VPN off and keep working" heal without a reload — the earlier
71
+ * steps are all spent before anyone has finished toggling anything.
72
+ */
73
+ export declare const LICENSE_TRANSIENT_RETRY_DELAYS: readonly [number, number, number, number, number];
58
74
  /**
59
75
  * Master switch for the ANONYMOUS tier.
60
76
  *
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AAEH,eAAO,MAAM,aAAa;;IAExB;;;;;;;;OAQG;;;;CAMK,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;IAC1B,iEAAiE;;IAEjE,qEAAqE;;IAErE,oDAAoD;;CAE5C,CAAC;AAGX,eAAO,MAAM,sBAAsB,QAA2B,CAAC;AAI/D,eAAO,MAAM,6BAA6B,QAAsB,CAAC;AAIjE,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAMrD,eAAO,MAAM,8BAA8B,+BAA+B,CAAC;AAM3E,eAAO,MAAM,6BAA6B,QAAiB,CAAC;AAE5D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AAEH,eAAO,MAAM,aAAa;;IAExB;;;;;;;;OAQG;;;;CAMK,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;IAC1B,iEAAiE;;IAEjE,qEAAqE;;IAErE,oDAAoD;;CAE5C,CAAC;AAGX,eAAO,MAAM,sBAAsB,QAA2B,CAAC;AAI/D,eAAO,MAAM,6BAA6B,QAAsB,CAAC;AAIjE,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAMrD,eAAO,MAAM,8BAA8B,+BAA+B,CAAC;AAM3E,eAAO,MAAM,6BAA6B,QAAiB,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B,mDAMjC,CAAC;AAEX;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC"}
@@ -31,6 +31,7 @@ export { DeviceRegistrationModal } from "./DeviceRegistrationModal";
31
31
  export { useLicense, useFeatureAccess, useIsPro, useProAccess, useTier } from "./hooks";
32
32
  export type { ProAccessReason } from "./hooks";
33
33
  export { ANONYMOUS_TIER_ENABLED } from "./config";
34
+ export { LicenseTransportError, isTransientLicenseError } from "./api";
34
35
  export { isWeekendFreePro, useWeekendFreePro } from "./weekendPro";
35
36
  export type { BuoyTier, TierSource, LicenseState, LicenseEvent, LicenseListener, LicenseValidationResult, CachedLicense, } from "./types";
36
37
  export declare function setLicenseKey(key: string): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EACV,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxF,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGnE,YAAY,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIjE;AAaD,wBAAgB,KAAK,IAAI,OAAO,CAI/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EACV,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxF,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAIlD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGnE,YAAY,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIjE;AAaD,wBAAgB,KAAK,IAAI,OAAO,CAI/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpD"}
@@ -29,6 +29,7 @@ export { LicenseManager } from "./LicenseManager";
29
29
  export { useLicense, useFeatureAccess, useIsPro, useProAccess, useTier } from "./hooks";
30
30
  export type { ProAccessReason } from "./hooks";
31
31
  export { ANONYMOUS_TIER_ENABLED } from "./config";
32
+ export { LicenseTransportError, isTransientLicenseError } from "./api";
32
33
  export { isWeekendFreePro, useWeekendFreePro } from "./weekendPro";
33
34
  export type { BuoyTier, TierSource, LicenseState, LicenseEvent, LicenseListener, LicenseValidationResult, CachedLicense, } from "./types";
34
35
  export declare function setLicenseKey(key: string): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[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EACV,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIjE;AAaD,wBAAgB,KAAK,IAAI,OAAO,CAI/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpD"}
@@ -190,6 +190,19 @@ export interface LicenseState {
190
190
  tierSource: TierSource;
191
191
  licenseKey: string | null;
192
192
  error: string | null;
193
+ /**
194
+ * What kind of failure `error` describes, so UIs can give the right advice:
195
+ *
196
+ * - "transport" — we could not ASK the license server (offline, VPN/proxy
197
+ * interception, quota 429, 5xx). The key was never judged; suggesting the
198
+ * user check their connection is right, blaming the key is not.
199
+ * - "verdict" — the server answered and the answer was bad (suspended,
200
+ * expired, not found), or validation failed client-side after the server
201
+ * answered. Anything that must NOT be presented as a connectivity problem.
202
+ *
203
+ * Always null when `error` is null.
204
+ */
205
+ errorKind: "transport" | "verdict" | null;
193
206
  expiresAt: Date | null;
194
207
  }
195
208
  export type LicenseEventType = "initialized" | "validating" | "validated" | "error" | "deactivated";
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;AAEpD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EACA,OAAO,GACP,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS,GACT,YAAY,GACZ,aAAa,GACb,mBAAmB,GACnB,gBAAgB,GAChB,oBAAoB,GACpB,4BAA4B,GAC5B,uBA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G;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,6EAA6E;IAC7E,KAAK,EAAE,OAAO,CAAC;IACf,qEAAqE;IACrE,IAAI,EAAE,QAAQ,CAAC;IACf,2BAA2B;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;;;;;;;;;;OAWG;IACH,SAAS,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1C,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,YAAY,GACZ,WAAW,GACX,OAAO,GACP,aAAa,CAAC;AAElB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/license",
3
- "version": "7.0.27",
3
+ "version": "7.0.28",
4
4
  "description": "License validation for React Buoy Pro features",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "main": "lib/commonjs/index.js",