@buoy-gg/license 3.0.1 → 4.0.1

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.
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useFeatureAccess = useFeatureAccess;
7
7
  exports.useIsPro = useIsPro;
8
8
  exports.useLicense = useLicense;
9
+ exports.useProAccess = useProAccess;
9
10
  var _react = require("react");
10
11
  var _LicenseManager = require("./LicenseManager.js");
12
+ var _weekendPro = require("./weekendPro.js");
11
13
  /**
12
14
  * React hooks for license management
13
15
  *
@@ -15,6 +17,13 @@ var _LicenseManager = require("./LicenseManager.js");
15
17
  * We trust our customers.
16
18
  */
17
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
+
18
27
  /**
19
28
  * Hook to access the current license state
20
29
  *
@@ -78,12 +87,35 @@ function useFeatureAccess(featureCode) {
78
87
  }
79
88
 
80
89
  /**
81
- * Hook that returns true only when Pro and not loading
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).
82
92
  */
83
93
  function useIsPro() {
84
94
  const {
85
95
  isPro,
86
96
  isInitialized
87
97
  } = useLicense();
88
- return isInitialized && isPro;
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
+ const isWeekendFree = (0, _weekendPro.useWeekendFreePro)();
114
+ const reason = isLicensed ? "licensed" : isWeekendFree ? "weekend" : null;
115
+ return {
116
+ isPro: isLicensed || isWeekendFree,
117
+ isLicensed,
118
+ isWeekendFree,
119
+ reason
120
+ };
89
121
  }
@@ -17,6 +17,12 @@ Object.defineProperty(exports, "LicenseManager", {
17
17
  });
18
18
  exports.hasEntitlement = hasEntitlement;
19
19
  exports.isPro = isPro;
20
+ Object.defineProperty(exports, "isWeekendFreePro", {
21
+ enumerable: true,
22
+ get: function () {
23
+ return _weekendPro.isWeekendFreePro;
24
+ }
25
+ });
20
26
  exports.setLicenseKey = setLicenseKey;
21
27
  Object.defineProperty(exports, "useFeatureAccess", {
22
28
  enumerable: true,
@@ -36,9 +42,22 @@ Object.defineProperty(exports, "useLicense", {
36
42
  return _hooks.useLicense;
37
43
  }
38
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
+ });
39
57
  var _LicenseManager = require("./LicenseManager.js");
40
58
  var _DeviceRegistrationModal = require("./DeviceRegistrationModal.js");
41
59
  var _hooks = require("./hooks.js");
60
+ var _weekendPro = require("./weekendPro.js");
42
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); } /**
43
62
  * @buoy-gg/license
44
63
  *
@@ -50,6 +69,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
50
69
  */ // Main manager
51
70
  // Device registration UI
52
71
  // React hooks
72
+ // Weekend Pass — Pro is free for everyone on weekends
53
73
  // Types
54
74
 
55
75
  // Convenience function for setting license key
@@ -61,16 +81,24 @@ async function setLicenseKey(key) {
61
81
  return LM.setLicenseKey(key);
62
82
  }
63
83
 
64
- // Convenience function for checking Pro status
84
+ // Convenience function for checking Pro status (honors the free Weekend Pass)
65
85
  function isPro() {
86
+ const {
87
+ isWeekendFreePro: isWeekend
88
+ } = require("./weekendPro");
89
+ if (isWeekend()) return true;
66
90
  const {
67
91
  LicenseManager: LM
68
92
  } = require("./LicenseManager");
69
93
  return LM.isPro();
70
94
  }
71
95
 
72
- // Convenience function for checking entitlement
96
+ // Convenience function for checking entitlement (honors the free Weekend Pass)
73
97
  function hasEntitlement(code) {
98
+ const {
99
+ isWeekendFreePro: isWeekend
100
+ } = require("./weekendPro");
101
+ if (isWeekend()) return true;
74
102
  const {
75
103
  LicenseManager: LM
76
104
  } = require("./LicenseManager");
@@ -11,6 +11,12 @@ Object.defineProperty(exports, "LicenseManager", {
11
11
  });
12
12
  exports.hasEntitlement = hasEntitlement;
13
13
  exports.isPro = isPro;
14
+ Object.defineProperty(exports, "isWeekendFreePro", {
15
+ enumerable: true,
16
+ get: function () {
17
+ return _weekendPro.isWeekendFreePro;
18
+ }
19
+ });
14
20
  exports.setLicenseKey = setLicenseKey;
15
21
  Object.defineProperty(exports, "useFeatureAccess", {
16
22
  enumerable: true,
@@ -30,8 +36,21 @@ Object.defineProperty(exports, "useLicense", {
30
36
  return _hooks.useLicense;
31
37
  }
32
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
+ });
33
51
  var _LicenseManager = require("./LicenseManager.js");
34
52
  var _hooks = require("./hooks.js");
53
+ var _weekendPro = require("./weekendPro.js");
35
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); } /**
36
55
  * @buoy-gg/license (Web/Electron)
37
56
  *
@@ -42,6 +61,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
42
61
  * Keygen tracks validation calls for usage analytics.
43
62
  */ // Main manager
44
63
  // React hooks
64
+ // Weekend Pass — Pro is free for everyone on weekends
45
65
  // Types
46
66
 
47
67
  // Convenience function for setting license key
@@ -53,16 +73,24 @@ async function setLicenseKey(key) {
53
73
  return LM.setLicenseKey(key);
54
74
  }
55
75
 
56
- // Convenience function for checking Pro status
76
+ // Convenience function for checking Pro status (honors the free Weekend Pass)
57
77
  function isPro() {
78
+ const {
79
+ isWeekendFreePro: isWeekend
80
+ } = require("./weekendPro");
81
+ if (isWeekend()) return true;
58
82
  const {
59
83
  LicenseManager: LM
60
84
  } = require("./LicenseManager");
61
85
  return LM.isPro();
62
86
  }
63
87
 
64
- // Convenience function for checking entitlement
88
+ // Convenience function for checking entitlement (honors the free Weekend Pass)
65
89
  function hasEntitlement(code) {
90
+ const {
91
+ isWeekendFreePro: isWeekend
92
+ } = require("./weekendPro");
93
+ if (isWeekend()) return true;
66
94
  const {
67
95
  LicenseManager: LM
68
96
  } = require("./LicenseManager");
@@ -0,0 +1,43 @@
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.
11
+ *
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.
15
+ *
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
+ }
@@ -9,6 +9,15 @@
9
9
 
10
10
  import { useState, useEffect, useCallback } from "react";
11
11
  import { LicenseManager } from "./LicenseManager.js";
12
+ import { useWeekendFreePro } from "./weekendPro.js";
13
+
14
+ /**
15
+ * Why the user currently has Pro access:
16
+ * - "licensed" → a real, validated license key
17
+ * - "weekend" → the free Weekend Pass (no license)
18
+ * - null → no access
19
+ */
20
+
12
21
  /**
13
22
  * Hook to access the current license state
14
23
  *
@@ -72,12 +81,35 @@ export function useFeatureAccess(featureCode) {
72
81
  }
73
82
 
74
83
  /**
75
- * Hook that returns true only when Pro and not loading
84
+ * Hook that returns true when the user has Pro access either a validated
85
+ * license OR the free Weekend Pass (Pro is free for everyone on weekends).
76
86
  */
77
87
  export function useIsPro() {
78
88
  const {
79
89
  isPro,
80
90
  isInitialized
81
91
  } = useLicense();
82
- return isInitialized && isPro;
92
+ const weekendFree = useWeekendFreePro();
93
+ return isInitialized && isPro || weekendFree;
94
+ }
95
+
96
+ /**
97
+ * Like {@link useIsPro} but also reports WHY access is granted, so badges can
98
+ * show "PRO" for a real license vs the "Weekend Pass" badge for the free
99
+ * weekend unlock.
100
+ */
101
+ export function useProAccess() {
102
+ const {
103
+ isPro,
104
+ isInitialized
105
+ } = useLicense();
106
+ const isLicensed = isInitialized && isPro;
107
+ const isWeekendFree = useWeekendFreePro();
108
+ const reason = isLicensed ? "licensed" : isWeekendFree ? "weekend" : null;
109
+ return {
110
+ isPro: isLicensed || isWeekendFree,
111
+ isLicensed,
112
+ isWeekendFree,
113
+ reason
114
+ };
83
115
  }
@@ -16,7 +16,9 @@ export { LicenseManager } from "./LicenseManager.js";
16
16
  export { DeviceRegistrationModal } from "./DeviceRegistrationModal.js";
17
17
 
18
18
  // React hooks
19
- export { useLicense, useFeatureAccess, useIsPro } from "./hooks.js";
19
+ export { useLicense, useFeatureAccess, useIsPro, useProAccess } from "./hooks.js";
20
+ // Weekend Pass — Pro is free for everyone on weekends
21
+ export { isWeekendFreePro, useWeekendFreePro } from "./weekendPro.js";
20
22
 
21
23
  // Types
22
24
 
@@ -29,16 +31,24 @@ export async function setLicenseKey(key) {
29
31
  return LM.setLicenseKey(key);
30
32
  }
31
33
 
32
- // Convenience function for checking Pro status
34
+ // Convenience function for checking Pro status (honors the free Weekend Pass)
33
35
  export function isPro() {
36
+ const {
37
+ isWeekendFreePro: isWeekend
38
+ } = require("./weekendPro");
39
+ if (isWeekend()) return true;
34
40
  const {
35
41
  LicenseManager: LM
36
42
  } = require("./LicenseManager");
37
43
  return LM.isPro();
38
44
  }
39
45
 
40
- // Convenience function for checking entitlement
46
+ // Convenience function for checking entitlement (honors the free Weekend Pass)
41
47
  export function hasEntitlement(code) {
48
+ const {
49
+ isWeekendFreePro: isWeekend
50
+ } = require("./weekendPro");
51
+ if (isWeekend()) return true;
42
52
  const {
43
53
  LicenseManager: LM
44
54
  } = require("./LicenseManager");
@@ -14,7 +14,9 @@
14
14
  export { LicenseManager } from "./LicenseManager.js";
15
15
 
16
16
  // React hooks
17
- export { useLicense, useFeatureAccess, useIsPro } from "./hooks.js";
17
+ export { useLicense, useFeatureAccess, useIsPro, useProAccess } from "./hooks.js";
18
+ // Weekend Pass — Pro is free for everyone on weekends
19
+ export { isWeekendFreePro, useWeekendFreePro } from "./weekendPro.js";
18
20
 
19
21
  // Types
20
22
 
@@ -27,16 +29,24 @@ export async function setLicenseKey(key) {
27
29
  return LM.setLicenseKey(key);
28
30
  }
29
31
 
30
- // Convenience function for checking Pro status
32
+ // Convenience function for checking Pro status (honors the free Weekend Pass)
31
33
  export function isPro() {
34
+ const {
35
+ isWeekendFreePro: isWeekend
36
+ } = require("./weekendPro");
37
+ if (isWeekend()) return true;
32
38
  const {
33
39
  LicenseManager: LM
34
40
  } = require("./LicenseManager");
35
41
  return LM.isPro();
36
42
  }
37
43
 
38
- // Convenience function for checking entitlement
44
+ // Convenience function for checking entitlement (honors the free Weekend Pass)
39
45
  export function hasEntitlement(code) {
46
+ const {
47
+ isWeekendFreePro: isWeekend
48
+ } = require("./weekendPro");
49
+ if (isWeekend()) return true;
40
50
  const {
41
51
  LicenseManager: LM
42
52
  } = require("./LicenseManager");
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Weekend Pass — Pro is free for everyone on weekends.
5
+ *
6
+ * A no-strings way to let people try Pro on their personal projects (most
7
+ * folks don't work weekends, so it's great for side projects but not the
8
+ * Mon–Fri day job). Evaluated in LOCAL time: active all of Saturday & Sunday.
9
+ *
10
+ * This is intentionally tiny and dependency-free so it can be shared by every
11
+ * `useIsPro()` gate without pulling in extra packages.
12
+ */
13
+
14
+ import { useEffect, useState } from "react";
15
+
16
+ /** Whether the Weekend Pass is active right now (local Saturday or Sunday). */
17
+ export function isWeekendFreePro(now = new Date()) {
18
+ const day = now.getDay(); // 0 = Sunday … 6 = Saturday
19
+ return day === 0 || day === 6;
20
+ }
21
+
22
+ /**
23
+ * Reactive Weekend Pass flag — re-renders the moment the weekend window opens
24
+ * or closes (re-checks every minute) so a long-running session flips at
25
+ * midnight without a reload.
26
+ */
27
+ export function useWeekendFreePro() {
28
+ const [active, setActive] = useState(() => isWeekendFreePro());
29
+ useEffect(() => {
30
+ const id = setInterval(() => {
31
+ const next = isWeekendFreePro();
32
+ // Functional update returns the same reference when unchanged, so React
33
+ // bails out of the re-render — the interval is effectively free.
34
+ setActive(prev => prev === next ? prev : next);
35
+ }, 60 * 1000);
36
+ return () => clearInterval(id);
37
+ }, []);
38
+ return active;
39
+ }
@@ -5,6 +5,13 @@
5
5
  * We trust our customers.
6
6
  */
7
7
  import type { LicenseState } from "./types";
8
+ /**
9
+ * Why the user currently has Pro access:
10
+ * - "licensed" → a real, validated license key
11
+ * - "weekend" → the free Weekend Pass (no license)
12
+ * - null → no access
13
+ */
14
+ export type ProAccessReason = "licensed" | "weekend" | null;
8
15
  /**
9
16
  * Hook to access the current license state
10
17
  *
@@ -34,7 +41,22 @@ export declare function useFeatureAccess(featureCode?: string): {
34
41
  isLoading: boolean;
35
42
  };
36
43
  /**
37
- * Hook that returns true only when Pro and not loading
44
+ * Hook that returns true when the user has Pro access either a validated
45
+ * license OR the free Weekend Pass (Pro is free for everyone on weekends).
38
46
  */
39
47
  export declare function useIsPro(): boolean;
48
+ /**
49
+ * Like {@link useIsPro} but also reports WHY access is granted, so badges can
50
+ * show "PRO" for a real license vs the "Weekend Pass" badge for the free
51
+ * weekend unlock.
52
+ */
53
+ export declare function useProAccess(): {
54
+ /** True if the user has Pro access for any reason. */
55
+ isPro: boolean;
56
+ /** True only for a real, validated license. */
57
+ isLicensed: boolean;
58
+ /** True only for the free Weekend Pass. */
59
+ isWeekendFree: boolean;
60
+ reason: ProAccessReason;
61
+ };
40
62
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,SAAS,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,IAAI,YAAY,GAAG;IAC3C,qCAAqC;IACrC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,gCAAgC;IAChC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC,CAiCA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG;IACtD,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB,CAWA;AAED;;GAEG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAGlC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,SAAS,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC;AAE5D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,IAAI,YAAY,GAAG;IAC3C,qCAAqC;IACrC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,gCAAgC;IAChC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC,CAiCA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG;IACtD,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB,CAWA;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAIlC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI;IAC9B,sDAAsD;IACtD,KAAK,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,UAAU,EAAE,OAAO,CAAC;IACpB,2CAA2C;IAC3C,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;CACzB,CAUA"}
@@ -10,7 +10,9 @@
10
10
  export { LicenseManager } from "./LicenseManager";
11
11
  export type { DeviceRegistrationInfo, DeviceRegistrationCallback, } from "./LicenseManager";
12
12
  export { DeviceRegistrationModal } from "./DeviceRegistrationModal";
13
- export { useLicense, useFeatureAccess, useIsPro } from "./hooks";
13
+ export { useLicense, useFeatureAccess, useIsPro, useProAccess } from "./hooks";
14
+ export type { ProAccessReason } from "./hooks";
15
+ export { isWeekendFreePro, useWeekendFreePro } from "./weekendPro";
14
16
  export type { LicenseState, LicenseEvent, LicenseListener, LicenseValidationResult, CachedLicense, } from "./types";
15
17
  export declare function setLicenseKey(key: string): Promise<boolean>;
16
18
  export declare function isPro(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;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,MAAM,SAAS,CAAC;AAGjE,YAAY,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;AAGD,wBAAgB,KAAK,IAAI,OAAO,CAG/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;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,MAAM,SAAS,CAAC;AAC/E,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGnE,YAAY,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;AAGD,wBAAgB,KAAK,IAAI,OAAO,CAK/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKpD"}
@@ -8,7 +8,9 @@
8
8
  * Keygen tracks validation calls for usage analytics.
9
9
  */
10
10
  export { LicenseManager } from "./LicenseManager";
11
- export { useLicense, useFeatureAccess, useIsPro } from "./hooks";
11
+ export { useLicense, useFeatureAccess, useIsPro, useProAccess } from "./hooks";
12
+ export type { ProAccessReason } from "./hooks";
13
+ export { isWeekendFreePro, useWeekendFreePro } from "./weekendPro";
12
14
  export type { LicenseState, LicenseEvent, LicenseListener, LicenseValidationResult, CachedLicense, } from "./types";
13
15
  export declare function setLicenseKey(key: string): Promise<boolean>;
14
16
  export declare function isPro(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGjE,YAAY,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;AAGD,wBAAgB,KAAK,IAAI,OAAO,CAG/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
1
+ {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/E,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGnE,YAAY,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;AAGD,wBAAgB,KAAK,IAAI,OAAO,CAK/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKpD"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Weekend Pass — Pro is free for everyone on weekends.
3
+ *
4
+ * A no-strings way to let people try Pro on their personal projects (most
5
+ * folks don't work weekends, so it's great for side projects but not the
6
+ * Mon–Fri day job). Evaluated in LOCAL time: active all of Saturday & Sunday.
7
+ *
8
+ * This is intentionally tiny and dependency-free so it can be shared by every
9
+ * `useIsPro()` gate without pulling in extra packages.
10
+ */
11
+ /** Whether the Weekend Pass is active right now (local Saturday or Sunday). */
12
+ export declare function isWeekendFreePro(now?: Date): boolean;
13
+ /**
14
+ * Reactive Weekend Pass flag — re-renders the moment the weekend window opens
15
+ * or closes (re-checks every minute) so a long-running session flips at
16
+ * midnight without a reload.
17
+ */
18
+ export declare function useWeekendFreePro(): boolean;
19
+ //# sourceMappingURL=weekendPro.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weekendPro.d.ts","sourceRoot":"","sources":["../../../src/weekendPro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,IAAiB,GAAG,OAAO,CAGhE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAY3C"}
@@ -5,6 +5,13 @@
5
5
  * We trust our customers.
6
6
  */
7
7
  import type { LicenseState } from "./types";
8
+ /**
9
+ * Why the user currently has Pro access:
10
+ * - "licensed" → a real, validated license key
11
+ * - "weekend" → the free Weekend Pass (no license)
12
+ * - null → no access
13
+ */
14
+ export type ProAccessReason = "licensed" | "weekend" | null;
8
15
  /**
9
16
  * Hook to access the current license state
10
17
  *
@@ -34,7 +41,22 @@ export declare function useFeatureAccess(featureCode?: string): {
34
41
  isLoading: boolean;
35
42
  };
36
43
  /**
37
- * Hook that returns true only when Pro and not loading
44
+ * Hook that returns true when the user has Pro access either a validated
45
+ * license OR the free Weekend Pass (Pro is free for everyone on weekends).
38
46
  */
39
47
  export declare function useIsPro(): boolean;
48
+ /**
49
+ * Like {@link useIsPro} but also reports WHY access is granted, so badges can
50
+ * show "PRO" for a real license vs the "Weekend Pass" badge for the free
51
+ * weekend unlock.
52
+ */
53
+ export declare function useProAccess(): {
54
+ /** True if the user has Pro access for any reason. */
55
+ isPro: boolean;
56
+ /** True only for a real, validated license. */
57
+ isLicensed: boolean;
58
+ /** True only for the free Weekend Pass. */
59
+ isWeekendFree: boolean;
60
+ reason: ProAccessReason;
61
+ };
40
62
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,SAAS,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,IAAI,YAAY,GAAG;IAC3C,qCAAqC;IACrC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,gCAAgC;IAChC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC,CAiCA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG;IACtD,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB,CAWA;AAED;;GAEG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAGlC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,SAAS,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC;AAE5D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,IAAI,YAAY,GAAG;IAC3C,qCAAqC;IACrC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,gCAAgC;IAChC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC,CAiCA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG;IACtD,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB,CAWA;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAIlC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI;IAC9B,sDAAsD;IACtD,KAAK,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,UAAU,EAAE,OAAO,CAAC;IACpB,2CAA2C;IAC3C,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;CACzB,CAUA"}
@@ -10,7 +10,9 @@
10
10
  export { LicenseManager } from "./LicenseManager";
11
11
  export type { DeviceRegistrationInfo, DeviceRegistrationCallback, } from "./LicenseManager";
12
12
  export { DeviceRegistrationModal } from "./DeviceRegistrationModal";
13
- export { useLicense, useFeatureAccess, useIsPro } from "./hooks";
13
+ export { useLicense, useFeatureAccess, useIsPro, useProAccess } from "./hooks";
14
+ export type { ProAccessReason } from "./hooks";
15
+ export { isWeekendFreePro, useWeekendFreePro } from "./weekendPro";
14
16
  export type { LicenseState, LicenseEvent, LicenseListener, LicenseValidationResult, CachedLicense, } from "./types";
15
17
  export declare function setLicenseKey(key: string): Promise<boolean>;
16
18
  export declare function isPro(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;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,MAAM,SAAS,CAAC;AAGjE,YAAY,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;AAGD,wBAAgB,KAAK,IAAI,OAAO,CAG/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;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,MAAM,SAAS,CAAC;AAC/E,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGnE,YAAY,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;AAGD,wBAAgB,KAAK,IAAI,OAAO,CAK/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKpD"}
@@ -8,7 +8,9 @@
8
8
  * Keygen tracks validation calls for usage analytics.
9
9
  */
10
10
  export { LicenseManager } from "./LicenseManager";
11
- export { useLicense, useFeatureAccess, useIsPro } from "./hooks";
11
+ export { useLicense, useFeatureAccess, useIsPro, useProAccess } from "./hooks";
12
+ export type { ProAccessReason } from "./hooks";
13
+ export { isWeekendFreePro, useWeekendFreePro } from "./weekendPro";
12
14
  export type { LicenseState, LicenseEvent, LicenseListener, LicenseValidationResult, CachedLicense, } from "./types";
13
15
  export declare function setLicenseKey(key: string): Promise<boolean>;
14
16
  export declare function isPro(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGjE,YAAY,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;AAGD,wBAAgB,KAAK,IAAI,OAAO,CAG/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
1
+ {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/E,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGnE,YAAY,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;AAGD,wBAAgB,KAAK,IAAI,OAAO,CAK/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKpD"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Weekend Pass — Pro is free for everyone on weekends.
3
+ *
4
+ * A no-strings way to let people try Pro on their personal projects (most
5
+ * folks don't work weekends, so it's great for side projects but not the
6
+ * Mon–Fri day job). Evaluated in LOCAL time: active all of Saturday & Sunday.
7
+ *
8
+ * This is intentionally tiny and dependency-free so it can be shared by every
9
+ * `useIsPro()` gate without pulling in extra packages.
10
+ */
11
+ /** Whether the Weekend Pass is active right now (local Saturday or Sunday). */
12
+ export declare function isWeekendFreePro(now?: Date): boolean;
13
+ /**
14
+ * Reactive Weekend Pass flag — re-renders the moment the weekend window opens
15
+ * or closes (re-checks every minute) so a long-running session flips at
16
+ * midnight without a reload.
17
+ */
18
+ export declare function useWeekendFreePro(): boolean;
19
+ //# sourceMappingURL=weekendPro.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weekendPro.d.ts","sourceRoot":"","sources":["../../../src/weekendPro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,IAAiB,GAAG,OAAO,CAGhE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAY3C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/license",
3
- "version": "3.0.1",
3
+ "version": "4.0.1",
4
4
  "description": "License validation for React Buoy Pro features",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",