@buoy-gg/license 7.0.22 → 7.0.24

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 (68) hide show
  1. package/LICENSE +46 -0
  2. package/lib/commonjs/DeviceRegistrationModal.js +1 -189
  3. package/lib/commonjs/LicenseManager.js +14 -610
  4. package/lib/commonjs/api.js +1 -172
  5. package/lib/commonjs/cacheSignature.js +15 -0
  6. package/lib/commonjs/config.js +16 -28
  7. package/lib/commonjs/device-info.js +1 -93
  8. package/lib/commonjs/device-info.web.js +1 -227
  9. package/lib/commonjs/fingerprint.js +1 -30
  10. package/lib/commonjs/fingerprint.web.js +1 -30
  11. package/lib/commonjs/hooks.js +13 -120
  12. package/lib/commonjs/index.js +17 -106
  13. package/lib/commonjs/index.web.js +17 -98
  14. package/lib/commonjs/tier.js +16 -0
  15. package/lib/commonjs/types.js +1 -1
  16. package/lib/commonjs/weekendPro.js +15 -41
  17. package/lib/module/DeviceRegistrationModal.js +1 -185
  18. package/lib/module/LicenseManager.js +14 -607
  19. package/lib/module/api.js +1 -165
  20. package/lib/module/cacheSignature.js +15 -0
  21. package/lib/module/config.js +16 -24
  22. package/lib/module/device-info.js +1 -87
  23. package/lib/module/device-info.web.js +1 -220
  24. package/lib/module/fingerprint.js +1 -10
  25. package/lib/module/fingerprint.web.js +1 -10
  26. package/lib/module/hooks.js +13 -114
  27. package/lib/module/index.js +15 -54
  28. package/lib/module/index.web.js +15 -52
  29. package/lib/module/tier.js +16 -0
  30. package/lib/module/types.js +1 -1
  31. package/lib/module/weekendPro.js +15 -37
  32. package/lib/typescript/commonjs/LicenseManager.d.ts +31 -6
  33. package/lib/typescript/commonjs/LicenseManager.d.ts.map +1 -1
  34. package/lib/typescript/commonjs/cacheSignature.d.ts +42 -0
  35. package/lib/typescript/commonjs/cacheSignature.d.ts.map +1 -0
  36. package/lib/typescript/commonjs/config.d.ts +62 -1
  37. package/lib/typescript/commonjs/config.d.ts.map +1 -1
  38. package/lib/typescript/commonjs/hooks.d.ts +27 -5
  39. package/lib/typescript/commonjs/hooks.d.ts.map +1 -1
  40. package/lib/typescript/commonjs/index.d.ts +20 -2
  41. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  42. package/lib/typescript/commonjs/index.web.d.ts +20 -2
  43. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  44. package/lib/typescript/commonjs/tier.d.ts +55 -0
  45. package/lib/typescript/commonjs/tier.d.ts.map +1 -0
  46. package/lib/typescript/commonjs/types.d.ts +44 -0
  47. package/lib/typescript/commonjs/types.d.ts.map +1 -1
  48. package/lib/typescript/commonjs/weekendPro.d.ts +30 -7
  49. package/lib/typescript/commonjs/weekendPro.d.ts.map +1 -1
  50. package/lib/typescript/module/LicenseManager.d.ts +31 -6
  51. package/lib/typescript/module/LicenseManager.d.ts.map +1 -1
  52. package/lib/typescript/module/cacheSignature.d.ts +42 -0
  53. package/lib/typescript/module/cacheSignature.d.ts.map +1 -0
  54. package/lib/typescript/module/config.d.ts +62 -1
  55. package/lib/typescript/module/config.d.ts.map +1 -1
  56. package/lib/typescript/module/hooks.d.ts +27 -5
  57. package/lib/typescript/module/hooks.d.ts.map +1 -1
  58. package/lib/typescript/module/index.d.ts +20 -2
  59. package/lib/typescript/module/index.d.ts.map +1 -1
  60. package/lib/typescript/module/index.web.d.ts +20 -2
  61. package/lib/typescript/module/index.web.d.ts.map +1 -1
  62. package/lib/typescript/module/tier.d.ts +55 -0
  63. package/lib/typescript/module/tier.d.ts.map +1 -0
  64. package/lib/typescript/module/types.d.ts +44 -0
  65. package/lib/typescript/module/types.d.ts.map +1 -1
  66. package/lib/typescript/module/weekendPro.d.ts +30 -7
  67. package/lib/typescript/module/weekendPro.d.ts.map +1 -1
  68. package/package.json +7 -4
@@ -1,123 +1,16 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useFeatureAccess = useFeatureAccess;
7
- exports.useIsPro = useIsPro;
8
- exports.useLicense = useLicense;
9
- exports.useProAccess = useProAccess;
10
- var _react = require("react");
11
- var _LicenseManager = require("./LicenseManager.js");
12
- var _weekendPro = require("./weekendPro.js");
13
- /**
14
- * React hooks for license management
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.useFeatureAccess=useFeatureAccess;exports.useIsPro=useIsPro;exports.useLicense=useLicense;exports.useProAccess=useProAccess;exports.useTier=useTier;var _react=require("react");var _LicenseManager=require("./LicenseManager.js");var _weekendPro=require("./weekendPro.js");/*!
2
+ * PROPRIETARY — Buoy Pro license enforcement. NOT open source.
15
3
  *
16
- * Simplified model: Just validate license, no device/session management.
17
- * We trust our customers.
18
- */
19
-
20
- /**
21
- * Why the user currently has Pro access:
22
- * - "licensed" → a real, validated license key
23
- * - "weekend" → the free Weekend Pass (no license)
24
- * - null → no access
25
- */
26
-
27
- /**
28
- * Hook to access the current license state
4
+ * Copyright (c) Buoy. All rights reserved. Licensed under the Buoy EULA
5
+ * (https://buoy.gg/terms), not an OSS license.
29
6
  *
30
- * @example
31
- * ```tsx
32
- * function MyComponent() {
33
- * const { isPro, isValidating, error } = useLicense();
7
+ * This file is the technological measure that controls access to paid Buoy Pro
8
+ * features: `useIsPro()` here is the single gate every Buoy tool consults.
9
+ * Modifying, patching, aliasing, stubbing, or otherwise altering it so that Pro
10
+ * features unlock without a valid license is a breach of the EULA and, in the
11
+ * United States, circumvention of an access control under 17 U.S.C. § 1201 —
12
+ * which applies whether or not any code is copied.
34
13
  *
35
- * if (isValidating) return <Loading />;
36
- * if (isPro) return <ProFeature />;
37
- * return <UpgradePrompt />;
38
- * }
39
- * ```
40
- */
41
- function useLicense() {
42
- const [state, setState] = (0, _react.useState)(_LicenseManager.LicenseManager.getState());
43
- (0, _react.useEffect)(() => {
44
- // Subscribe to license changes first so we don't miss any events
45
- const unsubscribe = _LicenseManager.LicenseManager.subscribe(event => {
46
- setState(_LicenseManager.LicenseManager.getState());
47
- });
48
-
49
- // Initialize and update state when ready
50
- _LicenseManager.LicenseManager.initialize().then(() => {
51
- setState(_LicenseManager.LicenseManager.getState());
52
- });
53
- return unsubscribe;
54
- }, []);
55
- const setLicenseKey = (0, _react.useCallback)(async key => {
56
- const result = await _LicenseManager.LicenseManager.setLicenseKey(key);
57
- setState(_LicenseManager.LicenseManager.getState());
58
- return result;
59
- }, []);
60
- const clearLicense = (0, _react.useCallback)(async () => {
61
- await _LicenseManager.LicenseManager.clearLicense();
62
- setState(_LicenseManager.LicenseManager.getState());
63
- }, []);
64
- return {
65
- ...state,
66
- setLicenseKey,
67
- clearLicense
68
- };
69
- }
70
-
71
- /**
72
- * Hook to check if a feature is available based on license
73
- */
74
- function useFeatureAccess(featureCode) {
75
- const {
76
- isPro,
77
- isInitialized,
78
- isValidating
79
- } = useLicense();
80
- const hasAccess = isPro;
81
- const isLoading = !isInitialized || isValidating;
82
- return {
83
- hasAccess,
84
- isPro,
85
- isLoading
86
- };
87
- }
88
-
89
- /**
90
- * Hook that returns true when the user has Pro access — either a validated
91
- * license OR the free Weekend Pass (Pro is free for everyone on weekends).
92
- */
93
- function useIsPro() {
94
- const {
95
- isPro,
96
- isInitialized
97
- } = useLicense();
98
- const weekendFree = (0, _weekendPro.useWeekendFreePro)();
99
- return isInitialized && isPro || weekendFree;
100
- }
101
-
102
- /**
103
- * Like {@link useIsPro} but also reports WHY access is granted, so badges can
104
- * show "PRO" for a real license vs the "Weekend Pass" badge for the free
105
- * weekend unlock.
106
- */
107
- function useProAccess() {
108
- const {
109
- isPro,
110
- isInitialized
111
- } = useLicense();
112
- const isLicensed = isInitialized && isPro;
113
- // A real license outranks the Weekend Pass — a licensed user should never see
114
- // the "WEEKEND" badge just because it happens to be Saturday.
115
- const isWeekendFree = (0, _weekendPro.useWeekendFreePro)() && !isLicensed;
116
- const reason = isLicensed ? "licensed" : isWeekendFree ? "weekend" : null;
117
- return {
118
- isPro: isLicensed || isWeekendFree,
119
- isLicensed,
120
- isWeekendFree,
121
- reason
122
- };
123
- }
14
+ * Pro is $9/mo, and is free for everyone every weekend. Buy a key at
15
+ * https://buoy.gg or use it free on Saturday and Sunday.
16
+ */function useLicense(){const[t,e]=(0,_react.useState)(_LicenseManager.LicenseManager.getState());(0,_react.useEffect)(()=>{const n=_LicenseManager.LicenseManager.subscribe(i=>{e(_LicenseManager.LicenseManager.getState())});_LicenseManager.LicenseManager.initialize().then(()=>{e(_LicenseManager.LicenseManager.getState())});return n},[]);const r=(0,_react.useCallback)(async n=>{const i=await _LicenseManager.LicenseManager.setLicenseKey(n);e(_LicenseManager.LicenseManager.getState());return i},[]);const s=(0,_react.useCallback)(async()=>{await _LicenseManager.LicenseManager.clearLicense();e(_LicenseManager.LicenseManager.getState())},[]);return{...t,setLicenseKey:r,clearLicense:s}}function useTier(){const{tier:t,isInitialized:e}=useLicense();return e?t:"anonymous"}function useFeatureAccess(t){const{isPro:e,isInitialized:r,isValidating:s}=useLicense();const n=e;const i=!r||s;return{hasAccess:n,isPro:e,isLoading:i}}function useIsPro(){const{isPro:t,isInitialized:e,tier:r}=useLicense();const s=(0,_weekendPro.weekendPassAppliesTo)(r,(0,_weekendPro.useWeekendFreePro)());return e&&t||s}function useProAccess(){const{isPro:t,isInitialized:e,tier:r}=useLicense();const s=e&&t;const n=(0,_weekendPro.weekendPassAppliesTo)(r,(0,_weekendPro.useWeekendFreePro)())&&!s;const i=s?"licensed":n?"weekend":null;return{isPro:s||n,isLicensed:s,isWeekendFree:n,reason:i}}
@@ -1,106 +1,17 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "DeviceRegistrationModal", {
7
- enumerable: true,
8
- get: function () {
9
- return _DeviceRegistrationModal.DeviceRegistrationModal;
10
- }
11
- });
12
- Object.defineProperty(exports, "LicenseManager", {
13
- enumerable: true,
14
- get: function () {
15
- return _LicenseManager.LicenseManager;
16
- }
17
- });
18
- exports.hasEntitlement = hasEntitlement;
19
- exports.isPro = isPro;
20
- Object.defineProperty(exports, "isWeekendFreePro", {
21
- enumerable: true,
22
- get: function () {
23
- return _weekendPro.isWeekendFreePro;
24
- }
25
- });
26
- exports.setLicenseKey = setLicenseKey;
27
- Object.defineProperty(exports, "useFeatureAccess", {
28
- enumerable: true,
29
- get: function () {
30
- return _hooks.useFeatureAccess;
31
- }
32
- });
33
- Object.defineProperty(exports, "useIsPro", {
34
- enumerable: true,
35
- get: function () {
36
- return _hooks.useIsPro;
37
- }
38
- });
39
- Object.defineProperty(exports, "useLicense", {
40
- enumerable: true,
41
- get: function () {
42
- return _hooks.useLicense;
43
- }
44
- });
45
- Object.defineProperty(exports, "useProAccess", {
46
- enumerable: true,
47
- get: function () {
48
- return _hooks.useProAccess;
49
- }
50
- });
51
- Object.defineProperty(exports, "useWeekendFreePro", {
52
- enumerable: true,
53
- get: function () {
54
- return _weekendPro.useWeekendFreePro;
55
- }
56
- });
57
- var _LicenseManager = require("./LicenseManager.js");
58
- var _DeviceRegistrationModal = require("./DeviceRegistrationModal.js");
59
- var _hooks = require("./hooks.js");
60
- var _weekendPro = require("./weekendPro.js");
61
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } /**
62
- * @buoy-gg/license
63
- *
64
- * License validation for React Buoy Pro features
65
- *
66
- * Simplified model: Validate license key, cache locally.
67
- * Device registration for visibility (no limits enforced).
68
- * Keygen tracks validation calls for usage analytics.
69
- */ // Main manager
70
- // Device registration UI
71
- // React hooks
72
- // Weekend Pass — Pro is free for everyone on weekends
73
- // Types
74
-
75
- // Convenience function for setting license key
76
- async function setLicenseKey(key) {
77
- const {
78
- LicenseManager: LM
79
- } = await Promise.resolve().then(() => _interopRequireWildcard(require("./LicenseManager")));
80
- await LM.initialize();
81
- return LM.setLicenseKey(key);
82
- }
83
-
84
- // Convenience function for checking Pro status (honors the free Weekend Pass)
85
- function isPro() {
86
- const {
87
- isWeekendFreePro: isWeekend
88
- } = require("./weekendPro");
89
- if (isWeekend()) return true;
90
- const {
91
- LicenseManager: LM
92
- } = require("./LicenseManager");
93
- return LM.isPro();
94
- }
95
-
96
- // Convenience function for checking entitlement (honors the free Weekend Pass)
97
- function hasEntitlement(code) {
98
- const {
99
- isWeekendFreePro: isWeekend
100
- } = require("./weekendPro");
101
- if (isWeekend()) return true;
102
- const {
103
- LicenseManager: LM
104
- } = require("./LicenseManager");
105
- return LM.hasEntitlement(code);
106
- }
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)}/*!
2
+ * PROPRIETARY — Buoy Pro license enforcement. NOT open source.
3
+ *
4
+ * Copyright (c) Buoy. All rights reserved. Licensed under the Buoy EULA
5
+ * (https://buoy.gg/terms), not an OSS license.
6
+ *
7
+ * This package is the technological measure that controls access to paid Buoy
8
+ * Pro features. Modifying, patching, aliasing, stubbing, or otherwise altering
9
+ * it — including replacing this module via a bundler alias, package override,
10
+ * or postinstall patch — so that Pro features unlock without a valid license is
11
+ * a breach of the EULA and, in the United States, circumvention of an access
12
+ * control under 17 U.S.C. § 1201, which applies whether or not any code is
13
+ * copied.
14
+ *
15
+ * Pro is $9/mo, and is free for everyone every weekend. Buy a key at
16
+ * https://buoy.gg or use it free on Saturday and Sunday.
17
+ */async function setLicenseKey(r){const{LicenseManager:t}=await Promise.resolve().then(()=>_interopRequireWildcard(require("./LicenseManager")));await t.initialize();return t.setLicenseKey(r)}function weekendPassActive(){const{isWeekendFreePro:r,weekendPassAppliesTo:t}=require("./weekendPro");const{LicenseManager:u}=require("./LicenseManager");return t(u.getTier(),r())}function isPro(){const{LicenseManager:r}=require("./LicenseManager");if(r.isPro())return true;return weekendPassActive()}function hasEntitlement(r){const{LicenseManager:t}=require("./LicenseManager");if(t.hasEntitlement(r))return true;return weekendPassActive()}
@@ -1,98 +1,17 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "LicenseManager", {
7
- enumerable: true,
8
- get: function () {
9
- return _LicenseManager.LicenseManager;
10
- }
11
- });
12
- exports.hasEntitlement = hasEntitlement;
13
- exports.isPro = isPro;
14
- Object.defineProperty(exports, "isWeekendFreePro", {
15
- enumerable: true,
16
- get: function () {
17
- return _weekendPro.isWeekendFreePro;
18
- }
19
- });
20
- exports.setLicenseKey = setLicenseKey;
21
- Object.defineProperty(exports, "useFeatureAccess", {
22
- enumerable: true,
23
- get: function () {
24
- return _hooks.useFeatureAccess;
25
- }
26
- });
27
- Object.defineProperty(exports, "useIsPro", {
28
- enumerable: true,
29
- get: function () {
30
- return _hooks.useIsPro;
31
- }
32
- });
33
- Object.defineProperty(exports, "useLicense", {
34
- enumerable: true,
35
- get: function () {
36
- return _hooks.useLicense;
37
- }
38
- });
39
- Object.defineProperty(exports, "useProAccess", {
40
- enumerable: true,
41
- get: function () {
42
- return _hooks.useProAccess;
43
- }
44
- });
45
- Object.defineProperty(exports, "useWeekendFreePro", {
46
- enumerable: true,
47
- get: function () {
48
- return _weekendPro.useWeekendFreePro;
49
- }
50
- });
51
- var _LicenseManager = require("./LicenseManager.js");
52
- var _hooks = require("./hooks.js");
53
- var _weekendPro = require("./weekendPro.js");
54
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } /**
55
- * @buoy-gg/license (Web/Electron)
56
- *
57
- * License validation for React Buoy Pro features
58
- *
59
- * Simplified model: Validate license key, cache locally.
60
- * No device registration or limits - we trust our customers.
61
- * Keygen tracks validation calls for usage analytics.
62
- */ // Main manager
63
- // React hooks
64
- // Weekend Pass — Pro is free for everyone on weekends
65
- // Types
66
-
67
- // Convenience function for setting license key
68
- async function setLicenseKey(key) {
69
- const {
70
- LicenseManager: LM
71
- } = await Promise.resolve().then(() => _interopRequireWildcard(require("./LicenseManager")));
72
- await LM.initialize();
73
- return LM.setLicenseKey(key);
74
- }
75
-
76
- // Convenience function for checking Pro status (honors the free Weekend Pass)
77
- function isPro() {
78
- const {
79
- isWeekendFreePro: isWeekend
80
- } = require("./weekendPro");
81
- if (isWeekend()) return true;
82
- const {
83
- LicenseManager: LM
84
- } = require("./LicenseManager");
85
- return LM.isPro();
86
- }
87
-
88
- // Convenience function for checking entitlement (honors the free Weekend Pass)
89
- function hasEntitlement(code) {
90
- const {
91
- isWeekendFreePro: isWeekend
92
- } = require("./weekendPro");
93
- if (isWeekend()) return true;
94
- const {
95
- LicenseManager: LM
96
- } = require("./LicenseManager");
97
- return LM.hasEntitlement(code);
98
- }
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)}/*!
2
+ * PROPRIETARY — Buoy Pro license enforcement. NOT open source.
3
+ *
4
+ * Copyright (c) Buoy. All rights reserved. Licensed under the Buoy EULA
5
+ * (https://buoy.gg/terms), not an OSS license.
6
+ *
7
+ * This package is the technological measure that controls access to paid Buoy
8
+ * Pro features. Modifying, patching, aliasing, stubbing, or otherwise altering
9
+ * it — including replacing this module via a bundler alias, package override,
10
+ * or postinstall patch — so that Pro features unlock without a valid license is
11
+ * a breach of the EULA and, in the United States, circumvention of an access
12
+ * control under 17 U.S.C. § 1201, which applies whether or not any code is
13
+ * copied.
14
+ *
15
+ * Pro is $9/mo, and is free for everyone every weekend. Buy a key at
16
+ * https://buoy.gg or use it free on Saturday and Sunday.
17
+ */async function setLicenseKey(r){const{LicenseManager:n}=await Promise.resolve().then(()=>_interopRequireWildcard(require("./LicenseManager")));await n.initialize();return n.setLicenseKey(r)}function weekendPassActive(){const{isWeekendFreePro:r,weekendPassAppliesTo:n}=require("./weekendPro");const{LicenseManager:o}=require("./LicenseManager");return n(o.getTier(),r())}function isPro(){const{LicenseManager:r}=require("./LicenseManager");if(r.isPro())return true;return weekendPassActive()}function hasEntitlement(r){const{LicenseManager:n}=require("./LicenseManager");if(n.hasEntitlement(r))return true;return weekendPassActive()}
@@ -0,0 +1,16 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.resolveTier=resolveTier;exports.tierAfterFatalError=tierAfterFatalError;var _config=require("./config.js");/*!
2
+ * PROPRIETARY — Buoy Pro license enforcement. NOT open source.
3
+ *
4
+ * Copyright (c) Buoy. All rights reserved. Licensed under the Buoy EULA
5
+ * (https://buoy.gg/terms), not an OSS license.
6
+ *
7
+ * This file is part of the technological measure that controls access to paid
8
+ * Buoy Pro features: it decides which tier a validated key grants. Modifying,
9
+ * patching, aliasing, stubbing, or otherwise altering it so that Pro features
10
+ * unlock without a valid license is a breach of the EULA and, in the United
11
+ * States, circumvention of an access control under 17 U.S.C. § 1201 — which
12
+ * applies whether or not any code is copied.
13
+ *
14
+ * Pro is $9/mo, and is free for everyone every weekend. Buy a key at
15
+ * https://buoy.gg or use it free on Saturday and Sunday.
16
+ */function resolveTier(r){const e=r.relationships?.policy?.data?.id;if(e===_config.KEYGEN_POLICIES.free)return"free";if(e===_config.KEYGEN_POLICIES.solo||e===_config.KEYGEN_POLICIES.business){return"pro"}const t=r.attributes?.metadata?.plan;if(t==="free")return"free";return"pro"}function tierAfterFatalError(r){return r==="EXPIRED"?"free":"anonymous"}
@@ -1 +1 @@
1
- "use strict";
1
+ "use strict";
@@ -1,43 +1,17 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isWeekendFreePro = isWeekendFreePro;
7
- exports.useWeekendFreePro = useWeekendFreePro;
8
- var _react = require("react");
9
- /**
10
- * Weekend Pass — Pro is free for everyone on weekends.
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isWeekendFreePro=isWeekendFreePro;exports.useWeekendFreePro=useWeekendFreePro;exports.weekendPassAppliesTo=weekendPassAppliesTo;var _config=require("./config.js");var _react=require("react");/*!
2
+ * PROPRIETARY — Buoy Pro license enforcement. NOT open source.
11
3
  *
12
- * A no-strings way to let people try Pro on their personal projects (most
13
- * folks don't work weekends, so it's great for side projects but not the
14
- * Mon–Fri day job). Evaluated in LOCAL time: active all of Saturday & Sunday.
4
+ * Copyright (c) Buoy. All rights reserved. Licensed under the Buoy EULA
5
+ * (https://buoy.gg/terms), not an OSS license.
15
6
  *
16
- * This is intentionally tiny and dependency-free so it can be shared by every
17
- * `useIsPro()` gate without pulling in extra packages.
18
- */
19
-
20
- /** Whether the Weekend Pass is active right now (local Saturday or Sunday). */
21
- function isWeekendFreePro(now = new Date()) {
22
- const day = now.getDay(); // 0 = Sunday … 6 = Saturday
23
- return day === 0 || day === 6;
24
- }
25
-
26
- /**
27
- * Reactive Weekend Pass flag — re-renders the moment the weekend window opens
28
- * or closes (re-checks every minute) so a long-running session flips at
29
- * midnight without a reload.
30
- */
31
- function useWeekendFreePro() {
32
- const [active, setActive] = (0, _react.useState)(() => isWeekendFreePro());
33
- (0, _react.useEffect)(() => {
34
- const id = setInterval(() => {
35
- const next = isWeekendFreePro();
36
- // Functional update returns the same reference when unchanged, so React
37
- // bails out of the re-render — the interval is effectively free.
38
- setActive(prev => prev === next ? prev : next);
39
- }, 60 * 1000);
40
- return () => clearInterval(id);
41
- }, []);
42
- return active;
43
- }
7
+ * Despite its small size, this file is a technological measure that controls
8
+ * access to paid Buoy Pro features: every `useIsPro()` gate in every Buoy tool
9
+ * unlocks when `isWeekendFreePro()` returns true. Modifying, patching,
10
+ * aliasing, stubbing, or otherwise altering it so that Pro features unlock
11
+ * without a valid license is a breach of the EULA and, in the United States,
12
+ * circumvention of an access control under 17 U.S.C. § 1201 — which applies
13
+ * whether or not any code is copied.
14
+ *
15
+ * Pro is $9/mo, and is free for everyone every weekend. Buy a key at
16
+ * https://buoy.gg or use it free on Saturday and Sunday.
17
+ */function isWeekendFreePro(r=new Date){const e=r.getDay();return e===0||e===6}function useWeekendFreePro(){const[r,e]=(0,_react.useState)(()=>isWeekendFreePro());(0,_react.useEffect)(()=>{const s=setInterval(()=>{const t=isWeekendFreePro();e(n=>n===t?n:t)},60*1e3);return()=>clearInterval(s)},[]);return r}function weekendPassAppliesTo(r,e){if(!e)return false;if(!_config.ANONYMOUS_TIER_ENABLED)return true;return r!=="anonymous"}
@@ -1,185 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * DeviceRegistrationModal - Prompts user to name their device during first registration
5
- *
6
- * Styled to match the Buoy brand design system.
7
- */
8
-
9
- import React, { useState, useEffect, useCallback } from "react";
10
- import { Modal, View, Text, TextInput, TouchableOpacity, StyleSheet, KeyboardAvoidingView, Platform } from "react-native";
11
- import { LicenseManager } from "./LicenseManager.js";
12
-
13
- // Buoy brand colors - matches shared/src/ui/gameUI/constants/gameUIColors.ts
14
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
- const buoyColors = {
16
- base: "#121212",
17
- card: "#1A1A1A",
18
- hover: "#242424",
19
- input: "#2A2A2A",
20
- border: "#333333",
21
- borderStrong: "#444444",
22
- text: "#E0E0E0",
23
- textSecondary: "#A0A0A0",
24
- textMuted: "#888888",
25
- primary: "#20C997",
26
- // Buoy teal
27
- success: "#20C997",
28
- warning: "#FFA94D",
29
- error: "#EF4444",
30
- info: "#00B8E6"
31
- };
32
- export function DeviceRegistrationModal({
33
- title = "Name Your Device",
34
- description = "Give this device a name to help you identify it later.",
35
- buttonText = "Continue",
36
- onComplete
37
- }) {
38
- const [visible, setVisible] = useState(false);
39
- const [deviceName, setDeviceName] = useState("");
40
- const [defaultName, setDefaultName] = useState("");
41
- const [isRegistering, setIsRegistering] = useState(false);
42
- useEffect(() => {
43
- // Subscribe to device registration requests
44
- const unsubscribe = LicenseManager.onDeviceRegistrationNeeded(info => {
45
- setDefaultName(info.defaultName);
46
- setDeviceName(info.defaultName);
47
- setVisible(true);
48
- });
49
- return unsubscribe;
50
- }, []);
51
- const handleSubmit = useCallback(async () => {
52
- const name = deviceName.trim() || defaultName;
53
- setIsRegistering(true);
54
- try {
55
- await LicenseManager.completeDeviceRegistration(name);
56
- setVisible(false);
57
- onComplete?.(name);
58
- } catch (error) {
59
- console.warn("[Buoy] Device registration failed:", error);
60
- // Still close the modal - registration failure shouldn't block the user
61
- setVisible(false);
62
- } finally {
63
- setIsRegistering(false);
64
- }
65
- }, [deviceName, defaultName, onComplete]);
66
- if (!visible) return null;
67
- return /*#__PURE__*/_jsx(Modal, {
68
- visible: visible,
69
- transparent: true,
70
- animationType: "fade",
71
- onRequestClose: () => {
72
- // Allow closing without naming - use default
73
- handleSubmit();
74
- },
75
- children: /*#__PURE__*/_jsx(KeyboardAvoidingView, {
76
- behavior: Platform.OS === "ios" ? "padding" : "height",
77
- style: styles.overlay,
78
- children: /*#__PURE__*/_jsxs(View, {
79
- style: styles.container,
80
- children: [/*#__PURE__*/_jsx(View, {
81
- style: styles.accentBar
82
- }), /*#__PURE__*/_jsxs(View, {
83
- style: styles.content,
84
- children: [/*#__PURE__*/_jsx(Text, {
85
- style: styles.title,
86
- children: title
87
- }), /*#__PURE__*/_jsx(Text, {
88
- style: styles.description,
89
- children: description
90
- }), /*#__PURE__*/_jsx(TextInput, {
91
- style: styles.input,
92
- value: deviceName,
93
- onChangeText: setDeviceName,
94
- placeholder: defaultName,
95
- placeholderTextColor: buoyColors.textMuted,
96
- autoFocus: true,
97
- returnKeyType: "done",
98
- onSubmitEditing: handleSubmit,
99
- editable: !isRegistering,
100
- selectionColor: buoyColors.primary
101
- }), /*#__PURE__*/_jsx(TouchableOpacity, {
102
- style: [styles.button, isRegistering && styles.buttonDisabled],
103
- onPress: handleSubmit,
104
- disabled: isRegistering,
105
- activeOpacity: 0.8,
106
- children: /*#__PURE__*/_jsx(Text, {
107
- style: styles.buttonText,
108
- children: isRegistering ? "Registering..." : buttonText
109
- })
110
- })]
111
- })]
112
- })
113
- })
114
- });
115
- }
116
- const styles = StyleSheet.create({
117
- overlay: {
118
- flex: 1,
119
- backgroundColor: "rgba(0, 0, 0, 0.75)",
120
- justifyContent: "center",
121
- alignItems: "center"
122
- },
123
- container: {
124
- backgroundColor: buoyColors.card,
125
- borderRadius: 12,
126
- width: "85%",
127
- maxWidth: 400,
128
- borderWidth: 1,
129
- borderColor: buoyColors.border,
130
- shadowColor: buoyColors.primary,
131
- shadowOffset: {
132
- width: 0,
133
- height: 0
134
- },
135
- shadowOpacity: 0.2,
136
- shadowRadius: 20,
137
- elevation: 20,
138
- overflow: "hidden"
139
- },
140
- accentBar: {
141
- height: 3,
142
- backgroundColor: buoyColors.primary
143
- },
144
- content: {
145
- padding: 24
146
- },
147
- title: {
148
- fontSize: 20,
149
- fontWeight: "600",
150
- color: buoyColors.text,
151
- marginBottom: 8,
152
- textAlign: "center"
153
- },
154
- description: {
155
- fontSize: 14,
156
- color: buoyColors.textSecondary,
157
- marginBottom: 24,
158
- textAlign: "center",
159
- lineHeight: 20
160
- },
161
- input: {
162
- borderWidth: 1,
163
- borderColor: buoyColors.border,
164
- borderRadius: 8,
165
- padding: 14,
166
- fontSize: 16,
167
- color: buoyColors.text,
168
- backgroundColor: buoyColors.input,
169
- marginBottom: 20
170
- },
171
- button: {
172
- backgroundColor: buoyColors.primary,
173
- borderRadius: 8,
174
- padding: 14,
175
- alignItems: "center"
176
- },
177
- buttonDisabled: {
178
- backgroundColor: buoyColors.textMuted
179
- },
180
- buttonText: {
181
- color: buoyColors.base,
182
- fontSize: 16,
183
- fontWeight: "600"
184
- }
185
- });
1
+ "use strict";import M,{useState as a,useEffect as S,useCallback as w}from"react";import{Modal as R,View as u,Text as b,TextInput as D,TouchableOpacity as T,StyleSheet as N,KeyboardAvoidingView as k,Platform as B}from"react-native";import{LicenseManager as f}from"./LicenseManager.js";import{jsx as o,jsxs as p}from"react/jsx-runtime";const e={base:"#121212",card:"#1A1A1A",hover:"#242424",input:"#2A2A2A",border:"#333333",borderStrong:"#444444",text:"#E0E0E0",textSecondary:"#A0A0A0",textMuted:"#888888",primary:"#20C997",success:"#20C997",warning:"#FFA94D",error:"#EF4444",info:"#00B8E6"};export function DeviceRegistrationModal({title:x="Name Your Device",description:v="Give this device a name to help you identify it later.",buttonText:C="Continue",onComplete:g}){const[h,s]=a(false);const[l,m]=a("");const[d,A]=a("");const[r,y]=a(false);S(()=>{const i=f.onDeviceRegistrationNeeded(n=>{A(n.defaultName);m(n.defaultName);s(true)});return i},[]);const c=w(async()=>{const i=l.trim()||d;y(true);try{await f.completeDeviceRegistration(i);s(false);g?.(i)}catch(n){console.warn("[Buoy] Device registration failed:",n);s(false)}finally{y(false)}},[l,d,g]);if(!h)return null;return o(R,{visible:h,transparent:true,animationType:"fade",onRequestClose:()=>{c()},children:o(k,{behavior:B.OS==="ios"?"padding":"height",style:t.overlay,children:p(u,{style:t.container,children:[o(u,{style:t.accentBar}),p(u,{style:t.content,children:[o(b,{style:t.title,children:x}),o(b,{style:t.description,children:v}),o(D,{style:t.input,value:l,onChangeText:m,placeholder:d,placeholderTextColor:e.textMuted,autoFocus:true,returnKeyType:"done",onSubmitEditing:c,editable:!r,selectionColor:e.primary}),o(T,{style:[t.button,r&&t.buttonDisabled],onPress:c,disabled:r,activeOpacity:.8,children:o(b,{style:t.buttonText,children:r?"Registering...":C})})]})]})})})}const t=N.create({overlay:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.75)",justifyContent:"center",alignItems:"center"},container:{backgroundColor:e.card,borderRadius:12,width:"85%",maxWidth:400,borderWidth:1,borderColor:e.border,shadowColor:e.primary,shadowOffset:{width:0,height:0},shadowOpacity:.2,shadowRadius:20,elevation:20,overflow:"hidden"},accentBar:{height:3,backgroundColor:e.primary},content:{padding:24},title:{fontSize:20,fontWeight:"600",color:e.text,marginBottom:8,textAlign:"center"},description:{fontSize:14,color:e.textSecondary,marginBottom:24,textAlign:"center",lineHeight:20},input:{borderWidth:1,borderColor:e.border,borderRadius:8,padding:14,fontSize:16,color:e.text,backgroundColor:e.input,marginBottom:20},button:{backgroundColor:e.primary,borderRadius:8,padding:14,alignItems:"center"},buttonDisabled:{backgroundColor:e.textMuted},buttonText:{color:e.base,fontSize:16,fontWeight:"600"}});