@buoy-gg/shared-ui 7.0.21 → 7.0.23

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 (178) hide show
  1. package/lib/commonjs/JsModal.js +39 -16
  2. package/lib/commonjs/dataViewer/JsonStringNotice.js +59 -0
  3. package/lib/commonjs/dataViewer/ThemedSplitView.js +20 -1
  4. package/lib/commonjs/dataViewer/TimestampDeltaBar.js +96 -0
  5. package/lib/commonjs/dataViewer/index.js +52 -0
  6. package/lib/commonjs/dataViewer/jsonStringValue.js +94 -0
  7. package/lib/commonjs/dataViewer/timestampDiff.js +146 -0
  8. package/lib/commonjs/hooks/safe-area-impl.js +1 -1
  9. package/lib/commonjs/index.js +64 -1
  10. package/lib/commonjs/license/FeatureGate.js +43 -10
  11. package/lib/commonjs/license/FreeAccountPrompt.js +181 -0
  12. package/lib/commonjs/license/index.js +57 -42
  13. package/lib/commonjs/license/licenseModule.js +99 -0
  14. package/lib/commonjs/license/tierLimits.js +165 -0
  15. package/lib/commonjs/ui/backgrounds/BackgroundSwitcher.js +180 -0
  16. package/lib/commonjs/ui/backgrounds/README.md +115 -0
  17. package/lib/commonjs/ui/backgrounds/ToolBackground.js +74 -0
  18. package/lib/commonjs/ui/backgrounds/backgroundStore.js +116 -0
  19. package/lib/commonjs/ui/backgrounds/index.js +70 -0
  20. package/lib/commonjs/ui/backgrounds/primitives.js +333 -0
  21. package/lib/commonjs/ui/backgrounds/registry.js +112 -0
  22. package/lib/commonjs/ui/backgrounds/rng.js +72 -0
  23. package/lib/commonjs/ui/backgrounds/types.js +1 -0
  24. package/lib/commonjs/ui/backgrounds/variants/deepField.js +351 -0
  25. package/lib/commonjs/ui/backgrounds/variants/lattice.js +579 -0
  26. package/lib/commonjs/ui/backgrounds/variants/starfield.js +210 -0
  27. package/lib/commonjs/ui/index.js +15 -3
  28. package/lib/commonjs/utils/devServer.js +62 -0
  29. package/lib/commonjs/utils/index.js +13 -0
  30. package/lib/commonjs/utils/renderCaptureRegistry.js +32 -3
  31. package/lib/commonjs/utils/safeExpoRouter.js +27 -2
  32. package/lib/module/JsModal.js +39 -16
  33. package/lib/module/dataViewer/JsonStringNotice.js +54 -0
  34. package/lib/module/dataViewer/ThemedSplitView.js +20 -1
  35. package/lib/module/dataViewer/TimestampDeltaBar.js +91 -0
  36. package/lib/module/dataViewer/index.js +4 -0
  37. package/lib/module/dataViewer/jsonStringValue.js +89 -0
  38. package/lib/module/dataViewer/timestampDiff.js +139 -0
  39. package/lib/module/hooks/safe-area-impl.js +1 -1
  40. package/lib/module/index.js +5 -3
  41. package/lib/module/license/FeatureGate.js +43 -10
  42. package/lib/module/license/FreeAccountPrompt.js +176 -0
  43. package/lib/module/license/index.js +5 -40
  44. package/lib/module/license/licenseModule.js +92 -0
  45. package/lib/module/license/tierLimits.js +158 -0
  46. package/lib/module/ui/backgrounds/BackgroundSwitcher.js +176 -0
  47. package/lib/module/ui/backgrounds/README.md +115 -0
  48. package/lib/module/ui/backgrounds/ToolBackground.js +70 -0
  49. package/lib/module/ui/backgrounds/backgroundStore.js +111 -0
  50. package/lib/module/ui/backgrounds/index.js +9 -0
  51. package/lib/module/ui/backgrounds/primitives.js +328 -0
  52. package/lib/module/ui/backgrounds/registry.js +105 -0
  53. package/lib/module/ui/backgrounds/rng.js +65 -0
  54. package/lib/module/ui/backgrounds/types.js +1 -0
  55. package/lib/module/ui/backgrounds/variants/deepField.js +347 -0
  56. package/lib/module/ui/backgrounds/variants/lattice.js +575 -0
  57. package/lib/module/ui/backgrounds/variants/starfield.js +206 -0
  58. package/lib/module/ui/index.js +3 -0
  59. package/lib/module/utils/devServer.js +58 -0
  60. package/lib/module/utils/index.js +2 -1
  61. package/lib/module/utils/renderCaptureRegistry.js +32 -3
  62. package/lib/module/utils/safeExpoRouter.js +26 -2
  63. package/lib/typescript/commonjs/JsModal.d.ts.map +1 -1
  64. package/lib/typescript/commonjs/dataViewer/JsonStringNotice.d.ts +6 -0
  65. package/lib/typescript/commonjs/dataViewer/JsonStringNotice.d.ts.map +1 -0
  66. package/lib/typescript/commonjs/dataViewer/ThemedSplitView.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/dataViewer/TimestampDeltaBar.d.ts +7 -0
  68. package/lib/typescript/commonjs/dataViewer/TimestampDeltaBar.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/dataViewer/index.d.ts +6 -0
  70. package/lib/typescript/commonjs/dataViewer/index.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/dataViewer/jsonStringValue.d.ts +25 -0
  72. package/lib/typescript/commonjs/dataViewer/jsonStringValue.d.ts.map +1 -0
  73. package/lib/typescript/commonjs/dataViewer/timestampDiff.d.ts +55 -0
  74. package/lib/typescript/commonjs/dataViewer/timestampDiff.d.ts.map +1 -0
  75. package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
  76. package/lib/typescript/commonjs/index.d.ts +4 -3
  77. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  78. package/lib/typescript/commonjs/license/FeatureGate.d.ts +19 -3
  79. package/lib/typescript/commonjs/license/FeatureGate.d.ts.map +1 -1
  80. package/lib/typescript/commonjs/license/FreeAccountPrompt.d.ts +23 -0
  81. package/lib/typescript/commonjs/license/FreeAccountPrompt.d.ts.map +1 -0
  82. package/lib/typescript/commonjs/license/index.d.ts +6 -15
  83. package/lib/typescript/commonjs/license/index.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/license/licenseModule.d.ts +55 -0
  85. package/lib/typescript/commonjs/license/licenseModule.d.ts.map +1 -0
  86. package/lib/typescript/commonjs/license/tierLimits.d.ts +143 -0
  87. package/lib/typescript/commonjs/license/tierLimits.d.ts.map +1 -0
  88. package/lib/typescript/commonjs/ui/backgrounds/BackgroundSwitcher.d.ts +13 -0
  89. package/lib/typescript/commonjs/ui/backgrounds/BackgroundSwitcher.d.ts.map +1 -0
  90. package/lib/typescript/commonjs/ui/backgrounds/ToolBackground.d.ts +30 -0
  91. package/lib/typescript/commonjs/ui/backgrounds/ToolBackground.d.ts.map +1 -0
  92. package/lib/typescript/commonjs/ui/backgrounds/backgroundStore.d.ts +43 -0
  93. package/lib/typescript/commonjs/ui/backgrounds/backgroundStore.d.ts.map +1 -0
  94. package/lib/typescript/commonjs/ui/backgrounds/index.d.ts +7 -0
  95. package/lib/typescript/commonjs/ui/backgrounds/index.d.ts.map +1 -0
  96. package/lib/typescript/commonjs/ui/backgrounds/primitives.d.ts +106 -0
  97. package/lib/typescript/commonjs/ui/backgrounds/primitives.d.ts.map +1 -0
  98. package/lib/typescript/commonjs/ui/backgrounds/registry.d.ts +28 -0
  99. package/lib/typescript/commonjs/ui/backgrounds/registry.d.ts.map +1 -0
  100. package/lib/typescript/commonjs/ui/backgrounds/rng.d.ts +27 -0
  101. package/lib/typescript/commonjs/ui/backgrounds/rng.d.ts.map +1 -0
  102. package/lib/typescript/commonjs/ui/backgrounds/types.d.ts +14 -0
  103. package/lib/typescript/commonjs/ui/backgrounds/types.d.ts.map +1 -0
  104. package/lib/typescript/commonjs/ui/backgrounds/variants/deepField.d.ts +65 -0
  105. package/lib/typescript/commonjs/ui/backgrounds/variants/deepField.d.ts.map +1 -0
  106. package/lib/typescript/commonjs/ui/backgrounds/variants/lattice.d.ts +33 -0
  107. package/lib/typescript/commonjs/ui/backgrounds/variants/lattice.d.ts.map +1 -0
  108. package/lib/typescript/commonjs/ui/backgrounds/variants/starfield.d.ts +12 -0
  109. package/lib/typescript/commonjs/ui/backgrounds/variants/starfield.d.ts.map +1 -0
  110. package/lib/typescript/commonjs/ui/index.d.ts +1 -0
  111. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  112. package/lib/typescript/commonjs/utils/devServer.d.ts +24 -0
  113. package/lib/typescript/commonjs/utils/devServer.d.ts.map +1 -0
  114. package/lib/typescript/commonjs/utils/index.d.ts +3 -2
  115. package/lib/typescript/commonjs/utils/index.d.ts.map +1 -1
  116. package/lib/typescript/commonjs/utils/renderCaptureRegistry.d.ts +52 -2
  117. package/lib/typescript/commonjs/utils/renderCaptureRegistry.d.ts.map +1 -1
  118. package/lib/typescript/commonjs/utils/safeExpoRouter.d.ts +23 -0
  119. package/lib/typescript/commonjs/utils/safeExpoRouter.d.ts.map +1 -1
  120. package/lib/typescript/module/JsModal.d.ts.map +1 -1
  121. package/lib/typescript/module/dataViewer/JsonStringNotice.d.ts +6 -0
  122. package/lib/typescript/module/dataViewer/JsonStringNotice.d.ts.map +1 -0
  123. package/lib/typescript/module/dataViewer/ThemedSplitView.d.ts.map +1 -1
  124. package/lib/typescript/module/dataViewer/TimestampDeltaBar.d.ts +7 -0
  125. package/lib/typescript/module/dataViewer/TimestampDeltaBar.d.ts.map +1 -0
  126. package/lib/typescript/module/dataViewer/index.d.ts +6 -0
  127. package/lib/typescript/module/dataViewer/index.d.ts.map +1 -1
  128. package/lib/typescript/module/dataViewer/jsonStringValue.d.ts +25 -0
  129. package/lib/typescript/module/dataViewer/jsonStringValue.d.ts.map +1 -0
  130. package/lib/typescript/module/dataViewer/timestampDiff.d.ts +55 -0
  131. package/lib/typescript/module/dataViewer/timestampDiff.d.ts.map +1 -0
  132. package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
  133. package/lib/typescript/module/index.d.ts +4 -3
  134. package/lib/typescript/module/index.d.ts.map +1 -1
  135. package/lib/typescript/module/license/FeatureGate.d.ts +19 -3
  136. package/lib/typescript/module/license/FeatureGate.d.ts.map +1 -1
  137. package/lib/typescript/module/license/FreeAccountPrompt.d.ts +23 -0
  138. package/lib/typescript/module/license/FreeAccountPrompt.d.ts.map +1 -0
  139. package/lib/typescript/module/license/index.d.ts +6 -15
  140. package/lib/typescript/module/license/index.d.ts.map +1 -1
  141. package/lib/typescript/module/license/licenseModule.d.ts +55 -0
  142. package/lib/typescript/module/license/licenseModule.d.ts.map +1 -0
  143. package/lib/typescript/module/license/tierLimits.d.ts +143 -0
  144. package/lib/typescript/module/license/tierLimits.d.ts.map +1 -0
  145. package/lib/typescript/module/ui/backgrounds/BackgroundSwitcher.d.ts +13 -0
  146. package/lib/typescript/module/ui/backgrounds/BackgroundSwitcher.d.ts.map +1 -0
  147. package/lib/typescript/module/ui/backgrounds/ToolBackground.d.ts +30 -0
  148. package/lib/typescript/module/ui/backgrounds/ToolBackground.d.ts.map +1 -0
  149. package/lib/typescript/module/ui/backgrounds/backgroundStore.d.ts +43 -0
  150. package/lib/typescript/module/ui/backgrounds/backgroundStore.d.ts.map +1 -0
  151. package/lib/typescript/module/ui/backgrounds/index.d.ts +7 -0
  152. package/lib/typescript/module/ui/backgrounds/index.d.ts.map +1 -0
  153. package/lib/typescript/module/ui/backgrounds/primitives.d.ts +106 -0
  154. package/lib/typescript/module/ui/backgrounds/primitives.d.ts.map +1 -0
  155. package/lib/typescript/module/ui/backgrounds/registry.d.ts +28 -0
  156. package/lib/typescript/module/ui/backgrounds/registry.d.ts.map +1 -0
  157. package/lib/typescript/module/ui/backgrounds/rng.d.ts +27 -0
  158. package/lib/typescript/module/ui/backgrounds/rng.d.ts.map +1 -0
  159. package/lib/typescript/module/ui/backgrounds/types.d.ts +14 -0
  160. package/lib/typescript/module/ui/backgrounds/types.d.ts.map +1 -0
  161. package/lib/typescript/module/ui/backgrounds/variants/deepField.d.ts +65 -0
  162. package/lib/typescript/module/ui/backgrounds/variants/deepField.d.ts.map +1 -0
  163. package/lib/typescript/module/ui/backgrounds/variants/lattice.d.ts +33 -0
  164. package/lib/typescript/module/ui/backgrounds/variants/lattice.d.ts.map +1 -0
  165. package/lib/typescript/module/ui/backgrounds/variants/starfield.d.ts +12 -0
  166. package/lib/typescript/module/ui/backgrounds/variants/starfield.d.ts.map +1 -0
  167. package/lib/typescript/module/ui/index.d.ts +1 -0
  168. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  169. package/lib/typescript/module/utils/devServer.d.ts +24 -0
  170. package/lib/typescript/module/utils/devServer.d.ts.map +1 -0
  171. package/lib/typescript/module/utils/index.d.ts +3 -2
  172. package/lib/typescript/module/utils/index.d.ts.map +1 -1
  173. package/lib/typescript/module/utils/renderCaptureRegistry.d.ts +52 -2
  174. package/lib/typescript/module/utils/renderCaptureRegistry.d.ts.map +1 -1
  175. package/lib/typescript/module/utils/safeExpoRouter.d.ts +23 -0
  176. package/lib/typescript/module/utils/safeExpoRouter.d.ts.map +1 -1
  177. package/package.json +4 -4
  178. package/scripts/detect-safe-area.js +1 -0
@@ -39,6 +39,7 @@ var _exportNames = {
39
39
  scheduleReloadApp: true,
40
40
  resolveReloadStrategy: true,
41
41
  REMOTE_RELOAD_DELAY_MS: true,
42
+ getDevServerOrigin: true,
42
43
  Subscribable: true,
43
44
  subscriberCountNotifier: true,
44
45
  subscribeToSubscriberCountChanges: true,
@@ -49,6 +50,7 @@ var _exportNames = {
49
50
  useSafeGlobalSearchParams: true,
50
51
  getSafeRouter: true,
51
52
  getSafeCurrentPathname: true,
53
+ getSafeCurrentRoute: true,
52
54
  isExpoRouterAvailable: true,
53
55
  isPlainObjectUtil: true,
54
56
  useSafeAreaInsets: true,
@@ -78,8 +80,15 @@ var _exportNames = {
78
80
  LicenseEntryModal: true,
79
81
  ProBadge: true,
80
82
  ProUpgradeModal: true,
83
+ FreeAccountPrompt: true,
84
+ LOGIN_COMMAND: true,
81
85
  getUseIsPro: true,
82
- getUseLicense: true
86
+ getUseLicense: true,
87
+ getUseTier: true,
88
+ TIER_LIMITS: true,
89
+ useLimit: true,
90
+ resolveEffectiveTier: true,
91
+ freeKeyRaises: true
83
92
  };
84
93
  Object.defineProperty(exports, "EnvironmentIndicator", {
85
94
  enumerable: true,
@@ -105,6 +114,12 @@ Object.defineProperty(exports, "FeatureGate", {
105
114
  return _index12.FeatureGate;
106
115
  }
107
116
  });
117
+ Object.defineProperty(exports, "FreeAccountPrompt", {
118
+ enumerable: true,
119
+ get: function () {
120
+ return _index12.FreeAccountPrompt;
121
+ }
122
+ });
108
123
  Object.defineProperty(exports, "HintsProvider", {
109
124
  enumerable: true,
110
125
  get: function () {
@@ -117,6 +132,12 @@ Object.defineProperty(exports, "JsModal", {
117
132
  return _JsModal.JsModal;
118
133
  }
119
134
  });
135
+ Object.defineProperty(exports, "LOGIN_COMMAND", {
136
+ enumerable: true,
137
+ get: function () {
138
+ return _index12.LOGIN_COMMAND;
139
+ }
140
+ });
120
141
  Object.defineProperty(exports, "LicenseEntryModal", {
121
142
  enumerable: true,
122
143
  get: function () {
@@ -153,6 +174,12 @@ Object.defineProperty(exports, "Subscribable", {
153
174
  return _index3.Subscribable;
154
175
  }
155
176
  });
177
+ Object.defineProperty(exports, "TIER_LIMITS", {
178
+ enumerable: true,
179
+ get: function () {
180
+ return _index12.TIER_LIMITS;
181
+ }
182
+ });
156
183
  Object.defineProperty(exports, "UpgradeModal", {
157
184
  enumerable: true,
158
185
  get: function () {
@@ -207,6 +234,12 @@ Object.defineProperty(exports, "formatValue", {
207
234
  return _index3.formatValue;
208
235
  }
209
236
  });
237
+ Object.defineProperty(exports, "freeKeyRaises", {
238
+ enumerable: true,
239
+ get: function () {
240
+ return _index12.freeKeyRaises;
241
+ }
242
+ });
210
243
  Object.defineProperty(exports, "gameUIColors", {
211
244
  enumerable: true,
212
245
  get: function () {
@@ -225,6 +258,12 @@ Object.defineProperty(exports, "getConstructorName", {
225
258
  return _index3.getConstructorName;
226
259
  }
227
260
  });
261
+ Object.defineProperty(exports, "getDevServerOrigin", {
262
+ enumerable: true,
263
+ get: function () {
264
+ return _index3.getDevServerOrigin;
265
+ }
266
+ });
228
267
  Object.defineProperty(exports, "getDeviceInfo", {
229
268
  enumerable: true,
230
269
  get: function () {
@@ -249,6 +288,12 @@ Object.defineProperty(exports, "getSafeCurrentPathname", {
249
288
  return _index3.getSafeCurrentPathname;
250
289
  }
251
290
  });
291
+ Object.defineProperty(exports, "getSafeCurrentRoute", {
292
+ enumerable: true,
293
+ get: function () {
294
+ return _index3.getSafeCurrentRoute;
295
+ }
296
+ });
252
297
  Object.defineProperty(exports, "getSafeRouter", {
253
298
  enumerable: true,
254
299
  get: function () {
@@ -291,6 +336,12 @@ Object.defineProperty(exports, "getUseLicense", {
291
336
  return _index12.getUseLicense;
292
337
  }
293
338
  });
339
+ Object.defineProperty(exports, "getUseTier", {
340
+ enumerable: true,
341
+ get: function () {
342
+ return _index12.getUseTier;
343
+ }
344
+ });
294
345
  Object.defineProperty(exports, "getValueSize", {
295
346
  enumerable: true,
296
347
  get: function () {
@@ -411,6 +462,12 @@ Object.defineProperty(exports, "reloadApp", {
411
462
  return _index3.reloadApp;
412
463
  }
413
464
  });
465
+ Object.defineProperty(exports, "resolveEffectiveTier", {
466
+ enumerable: true,
467
+ get: function () {
468
+ return _index12.resolveEffectiveTier;
469
+ }
470
+ });
414
471
  Object.defineProperty(exports, "resolveReloadStrategy", {
415
472
  enumerable: true,
416
473
  get: function () {
@@ -501,6 +558,12 @@ Object.defineProperty(exports, "useHintsDisabled", {
501
558
  return _index10.useHintsDisabled;
502
559
  }
503
560
  });
561
+ Object.defineProperty(exports, "useLimit", {
562
+ enumerable: true,
563
+ get: function () {
564
+ return _index12.useLimit;
565
+ }
566
+ });
504
567
  Object.defineProperty(exports, "usePersistedState", {
505
568
  enumerable: true,
506
569
  get: function () {
@@ -11,6 +11,9 @@ var _gameUIColors = require("../ui/gameUI/constants/gameUIColors.js");
11
11
  var _lucideIcons = require("../icons/lucide-icons.js");
12
12
  var _LicenseEntryModal = require("./LicenseEntryModal.js");
13
13
  var _openPricing = require("./openPricing.js");
14
+ var _FreeAccountPrompt = require("./FreeAccountPrompt.js");
15
+ var _licenseModule = require("./licenseModule.js");
16
+ var _tierLimits = require("./tierLimits.js");
14
17
  var _license = require("@buoy-gg/license");
15
18
  var _jsxRuntime = require("react/jsx-runtime");
16
19
  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,14 +58,19 @@ exports.ProBadge = ProBadge;
55
58
  const ProUpgradeModal = ({
56
59
  visible,
57
60
  onClose,
58
- featureName = "This feature"
61
+ featureName = "This feature",
62
+ limitKey
59
63
  }) => {
60
64
  // Simple wrapper around UpgradeModal with minimal description and no benefits
61
65
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(UpgradeModal, {
62
66
  visible: visible,
63
67
  onClose: onClose,
64
- featureName: featureName,
65
- description: `${featureName} requires a Pro subscription.`
68
+ featureName: featureName
69
+ // Only meaningful when this upsell is about a LIMIT; without it the
70
+ // description below (which promises Pro) is the accurate message.
71
+ ,
72
+ limitKey: limitKey,
73
+ description: limitKey ? undefined : `${featureName} requires a Pro subscription.`
66
74
  });
67
75
  };
68
76
  exports.ProUpgradeModal = ProUpgradeModal;
@@ -73,9 +81,13 @@ exports.ProUpgradeModal = ProUpgradeModal;
73
81
  const UpgradePrompt = ({
74
82
  featureName,
75
83
  onUpgradePress,
76
- compact = false
84
+ compact = false,
85
+ limitKey
77
86
  }) => {
78
87
  const [showLicenseModal, setShowLicenseModal] = (0, _react.useState)(false);
88
+ // Only offer the free key when it would actually raise this limit — see
89
+ // UpgradeModalProps.limitKey.
90
+ const isAnonymous = (0, _licenseModule.getUseTier)()() === "anonymous" && limitKey != null && (0, _tierLimits.freeKeyRaises)(limitKey);
79
91
  const handlePress = (0, _react.useCallback)(() => {
80
92
  if (onUpgradePress) {
81
93
  onUpgradePress();
@@ -103,7 +115,11 @@ const UpgradePrompt = ({
103
115
  style: styles.compactText,
104
116
  children: "PRO"
105
117
  })]
106
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LicenseEntryModal.LicenseEntryModal, {
118
+ }), isAnonymous ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FreeAccountPrompt.FreeAccountPrompt, {
119
+ visible: showLicenseModal,
120
+ onClose: handleCloseModal,
121
+ featureName: featureName
122
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_LicenseEntryModal.LicenseEntryModal, {
107
123
  visible: showLicenseModal,
108
124
  onClose: handleCloseModal
109
125
  })]
@@ -120,23 +136,27 @@ const UpgradePrompt = ({
120
136
  })
121
137
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
122
138
  style: styles.title,
123
- children: "Pro Feature"
139
+ children: isAnonymous ? "Get a free key" : "Pro Feature"
124
140
  }), featureName && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
125
141
  style: styles.featureName,
126
142
  children: featureName
127
143
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
128
144
  style: styles.description,
129
- children: "Upgrade to React Buoy Pro to unlock this feature and more."
145
+ children: isAnonymous ? "Buoy works without an account, with a small slice of each tool. A free key opens it up." : "Upgrade to React Buoy Pro to unlock this feature and more."
130
146
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
131
147
  style: styles.upgradeButton,
132
148
  onPress: handlePress,
133
149
  activeOpacity: 0.8,
134
150
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
135
151
  style: styles.upgradeButtonText,
136
- children: "Upgrade to Pro"
152
+ children: isAnonymous ? "Get a free key" : "Upgrade to Pro"
137
153
  })
138
154
  })]
139
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LicenseEntryModal.LicenseEntryModal, {
155
+ }), isAnonymous ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FreeAccountPrompt.FreeAccountPrompt, {
156
+ visible: showLicenseModal,
157
+ onClose: handleCloseModal,
158
+ featureName: featureName
159
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_LicenseEntryModal.LicenseEntryModal, {
140
160
  visible: showLicenseModal,
141
161
  onClose: handleCloseModal
142
162
  })]
@@ -317,8 +337,14 @@ const UpgradeModal = ({
317
337
  onClose,
318
338
  featureName = "This Feature",
319
339
  description,
320
- benefits
340
+ benefits,
341
+ limitKey
321
342
  }) => {
343
+ // Anonymous users get a different ask — but ONLY when a free key would
344
+ // actually fix what they just hit. Everything else here is Pro-exclusive,
345
+ // where a free key changes nothing and offering one would be dishonest.
346
+ const tier = (0, _licenseModule.getUseTier)()();
347
+ const offerFreeKey = tier === "anonymous" && limitKey != null && (0, _tierLimits.freeKeyRaises)(limitKey);
322
348
  const hasBenefits = benefits && benefits.length > 0;
323
349
  const [showLicenseModal, setShowLicenseModal] = (0, _react.useState)(false);
324
350
  const license = (0, _license.useLicense)();
@@ -341,6 +367,13 @@ const UpgradeModal = ({
341
367
  onClose();
342
368
  }, [onClose]);
343
369
  if (!visible) return null;
370
+ if (offerFreeKey) {
371
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FreeAccountPrompt.FreeAccountPrompt, {
372
+ visible: visible,
373
+ onClose: onClose,
374
+ featureName: featureName === "This Feature" ? undefined : featureName
375
+ });
376
+ }
344
377
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
345
378
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
346
379
  visible: visible && !showLicenseModal,
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LOGIN_COMMAND = exports.FreeAccountPrompt = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _gameUIColors = require("../ui/gameUI/constants/gameUIColors.js");
10
+ var _lucideIcons = require("../icons/lucide-icons.js");
11
+ var _index = require("../clipboard/index.js");
12
+ var _openPricing = require("./openPricing.js");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ 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); }
15
+ /**
16
+ * The upsell an ANONYMOUS user sees — someone with no key at all.
17
+ *
18
+ * Deliberately not the Pro modal. Their next step is free and takes about
19
+ * thirty seconds, so asking them for money would be asking the wrong question
20
+ * at the wrong moment, and would suppress exactly the signup this exists to
21
+ * produce. Pro is still offered, as a secondary action.
22
+ *
23
+ * The command is shown inline and copyable rather than linked, because there is
24
+ * no grace period: someone who just watched their limits shrink needs the fix
25
+ * in front of them, not a link to a page that has a link to a command.
26
+ */
27
+
28
+ /** The one thing a reader has to be able to act on. */
29
+ const LOGIN_COMMAND = exports.LOGIN_COMMAND = "npx buoy login";
30
+ const FreeAccountPrompt = ({
31
+ visible,
32
+ onClose,
33
+ featureName
34
+ }) => {
35
+ const [copied, setCopied] = (0, _react.useState)(false);
36
+ const resetTimer = (0, _react.useRef)(null);
37
+ (0, _react.useEffect)(() => () => {
38
+ if (resetTimer.current) clearTimeout(resetTimer.current);
39
+ }, []);
40
+ const handleCopy = (0, _react.useCallback)(() => {
41
+ void (0, _index.copyToClipboard)(LOGIN_COMMAND).then(ok => {
42
+ if (!ok) return;
43
+ setCopied(true);
44
+ if (resetTimer.current) clearTimeout(resetTimer.current);
45
+ resetTimer.current = setTimeout(() => setCopied(false), 1500);
46
+ });
47
+ }, []);
48
+ if (!visible) return null;
49
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
50
+ visible: visible,
51
+ transparent: true,
52
+ animationType: "fade",
53
+ onRequestClose: onClose,
54
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
55
+ style: styles.overlay,
56
+ onPress: onClose,
57
+ activeOpacity: 1,
58
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
59
+ style: styles.card,
60
+ activeOpacity: 1,
61
+ onPress: () => {},
62
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
63
+ style: styles.close,
64
+ onPress: onClose,
65
+ activeOpacity: 0.7,
66
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideIcons.X, {
67
+ size: 18,
68
+ color: _gameUIColors.buoyColors.textMuted
69
+ })
70
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
71
+ style: styles.title,
72
+ children: featureName ? `More ${featureName}` : "See more"
73
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
74
+ style: styles.subtitle,
75
+ children: "Buoy runs without an account \u2014 you just get a small slice of each tool. A free key opens it up."
76
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
77
+ style: styles.command,
78
+ onPress: handleCopy,
79
+ activeOpacity: 0.7,
80
+ accessibilityLabel: `Copy ${LOGIN_COMMAND}`,
81
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
82
+ style: styles.commandText,
83
+ children: LOGIN_COMMAND
84
+ }), copied ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideIcons.Check, {
85
+ size: 14,
86
+ color: _gameUIColors.buoyColors.success
87
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideIcons.Copy, {
88
+ size: 14,
89
+ color: _gameUIColors.buoyColors.textMuted
90
+ })]
91
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
92
+ style: styles.reassure,
93
+ children: "Free forever. No card. About thirty seconds."
94
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
95
+ style: styles.secondary,
96
+ onPress: () => (0, _openPricing.openPricing)(),
97
+ activeOpacity: 0.8,
98
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
99
+ style: styles.secondaryText,
100
+ children: "Or see Pro"
101
+ })
102
+ })]
103
+ })
104
+ })
105
+ });
106
+ };
107
+ exports.FreeAccountPrompt = FreeAccountPrompt;
108
+ const styles = _reactNative.StyleSheet.create({
109
+ overlay: {
110
+ flex: 1,
111
+ backgroundColor: "rgba(0, 0, 0, 0.75)",
112
+ alignItems: "center",
113
+ justifyContent: "center",
114
+ padding: 20
115
+ },
116
+ card: {
117
+ backgroundColor: _gameUIColors.buoyColors.card,
118
+ borderRadius: 16,
119
+ borderWidth: 1,
120
+ borderColor: _gameUIColors.buoyColors.primary + "60",
121
+ padding: 24,
122
+ maxWidth: 340,
123
+ width: "100%",
124
+ position: "relative"
125
+ },
126
+ close: {
127
+ position: "absolute",
128
+ top: 12,
129
+ right: 12,
130
+ padding: 6,
131
+ zIndex: 1
132
+ },
133
+ title: {
134
+ fontSize: 20,
135
+ fontWeight: "700",
136
+ color: _gameUIColors.buoyColors.text,
137
+ textAlign: "center",
138
+ marginBottom: 8
139
+ },
140
+ subtitle: {
141
+ fontSize: 13,
142
+ lineHeight: 19,
143
+ color: _gameUIColors.buoyColors.textMuted,
144
+ textAlign: "center",
145
+ marginBottom: 20
146
+ },
147
+ command: {
148
+ flexDirection: "row",
149
+ alignItems: "center",
150
+ justifyContent: "space-between",
151
+ backgroundColor: _gameUIColors.buoyColors.base,
152
+ borderRadius: 8,
153
+ borderWidth: 1,
154
+ borderColor: _gameUIColors.buoyColors.border,
155
+ paddingHorizontal: 14,
156
+ paddingVertical: 12,
157
+ gap: 10
158
+ },
159
+ commandText: {
160
+ fontSize: 14,
161
+ fontWeight: "600",
162
+ color: _gameUIColors.buoyColors.text,
163
+ fontFamily: "monospace"
164
+ },
165
+ reassure: {
166
+ fontSize: 12,
167
+ color: _gameUIColors.buoyColors.textMuted,
168
+ textAlign: "center",
169
+ marginTop: 10
170
+ },
171
+ secondary: {
172
+ marginTop: 18,
173
+ paddingVertical: 10,
174
+ alignItems: "center"
175
+ },
176
+ secondaryText: {
177
+ fontSize: 13,
178
+ fontWeight: "600",
179
+ color: _gameUIColors.buoyColors.textMuted
180
+ }
181
+ });
@@ -9,6 +9,18 @@ Object.defineProperty(exports, "FeatureGate", {
9
9
  return _FeatureGate.FeatureGate;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "FreeAccountPrompt", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _FreeAccountPrompt.FreeAccountPrompt;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "LOGIN_COMMAND", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _FreeAccountPrompt.LOGIN_COMMAND;
22
+ }
23
+ });
12
24
  Object.defineProperty(exports, "LicenseEntryModal", {
13
25
  enumerable: true,
14
26
  get: function () {
@@ -33,6 +45,12 @@ Object.defineProperty(exports, "ProUpgradeModal", {
33
45
  return _FeatureGate.ProUpgradeModal;
34
46
  }
35
47
  });
48
+ Object.defineProperty(exports, "TIER_LIMITS", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _tierLimits.TIER_LIMITS;
52
+ }
53
+ });
36
54
  Object.defineProperty(exports, "UpgradeModal", {
37
55
  enumerable: true,
38
56
  get: function () {
@@ -45,53 +63,50 @@ Object.defineProperty(exports, "UpgradePrompt", {
45
63
  return _FeatureGate.UpgradePrompt;
46
64
  }
47
65
  });
48
- exports.getUseIsPro = getUseIsPro;
49
- exports.getUseLicense = getUseLicense;
66
+ Object.defineProperty(exports, "freeKeyRaises", {
67
+ enumerable: true,
68
+ get: function () {
69
+ return _tierLimits.freeKeyRaises;
70
+ }
71
+ });
72
+ Object.defineProperty(exports, "getUseIsPro", {
73
+ enumerable: true,
74
+ get: function () {
75
+ return _licenseModule.getUseIsPro;
76
+ }
77
+ });
78
+ Object.defineProperty(exports, "getUseLicense", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _licenseModule.getUseLicense;
82
+ }
83
+ });
84
+ Object.defineProperty(exports, "getUseTier", {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _licenseModule.getUseTier;
88
+ }
89
+ });
90
+ Object.defineProperty(exports, "resolveEffectiveTier", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _tierLimits.resolveEffectiveTier;
94
+ }
95
+ });
50
96
  Object.defineProperty(exports, "useFeatureGate", {
51
97
  enumerable: true,
52
98
  get: function () {
53
99
  return _FeatureGate.useFeatureGate;
54
100
  }
55
101
  });
102
+ Object.defineProperty(exports, "useLimit", {
103
+ enumerable: true,
104
+ get: function () {
105
+ return _tierLimits.useLimit;
106
+ }
107
+ });
56
108
  var _FeatureGate = require("./FeatureGate.js");
57
109
  var _LicenseEntryModal = require("./LicenseEntryModal.js");
58
- // Centralized lazy loading for license hooks to avoid duplication across packages
59
- // This is the SINGLE source of truth - all packages should import from here
60
- let _useIsPro = null;
61
- let _useLicense = null;
62
- let _licenseLoadAttempted = false;
63
- function loadLicenseModuleCentral() {
64
- if (_licenseLoadAttempted) return;
65
- _licenseLoadAttempted = true;
66
- try {
67
- const mod = require("@buoy-gg/license");
68
- if (mod) {
69
- _useIsPro = mod.useIsPro ?? null;
70
- _useLicense = mod.useLicense ?? null;
71
- }
72
- } catch {
73
- // License package not available - will use fallback
74
- }
75
- }
76
-
77
- /**
78
- * Get the useIsPro hook from @buoy-gg/license
79
- * Falls back to () => false if license package is not available
80
- *
81
- * IMPORTANT: Use this instead of doing your own lazy loading in other packages
82
- */
83
- function getUseIsPro() {
84
- loadLicenseModuleCentral();
85
- return _useIsPro ?? (() => false);
86
- }
87
-
88
- /**
89
- * Get the useLicense hook from @buoy-gg/license
90
- * Returns null if license package is not available
91
- *
92
- * IMPORTANT: Use this instead of doing your own lazy loading in other packages
93
- */
94
- function getUseLicense() {
95
- loadLicenseModuleCentral();
96
- return _useLicense;
97
- }
110
+ var _FreeAccountPrompt = require("./FreeAccountPrompt.js");
111
+ var _licenseModule = require("./licenseModule.js");
112
+ var _tierLimits = require("./tierLimits.js");
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getUseIsPro = getUseIsPro;
7
+ exports.getUseLicense = getUseLicense;
8
+ exports.getUseTier = getUseTier;
9
+ exports.isAnonymousTierEnabled = isAnonymousTierEnabled;
10
+ /**
11
+ * Centralized lazy loading of `@buoy-gg/license`.
12
+ *
13
+ * This is the SINGLE place any package resolves license hooks — tools must not
14
+ * `require("@buoy-gg/license")` themselves. Lives in its own module (rather
15
+ * than `./index`) so `tierLimits` can consume it without an import cycle.
16
+ */
17
+
18
+ /** Access tier. Mirrors BuoyTier in @buoy-gg/license. */
19
+
20
+ let _useIsPro = null;
21
+ let _useLicense = null;
22
+ let _useTier = null;
23
+ let _anonymousTierEnabled = null;
24
+ let _licenseLoadAttempted = false;
25
+ function loadLicenseModuleCentral() {
26
+ if (_licenseLoadAttempted) return;
27
+ _licenseLoadAttempted = true;
28
+ try {
29
+ const mod = require("@buoy-gg/license");
30
+ if (mod) {
31
+ _useIsPro = mod.useIsPro ?? null;
32
+ _useLicense = mod.useLicense ?? null;
33
+ _useTier = mod.useTier ?? null;
34
+ _anonymousTierEnabled = typeof mod.ANONYMOUS_TIER_ENABLED === "boolean" ? mod.ANONYMOUS_TIER_ENABLED : null;
35
+ }
36
+ } catch {
37
+ // License package not available - will use fallback
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Get the useIsPro hook from @buoy-gg/license.
43
+ * Falls back to () => false if the license package is not available.
44
+ *
45
+ * IMPORTANT: Use this instead of doing your own lazy loading in other packages
46
+ */
47
+ function getUseIsPro() {
48
+ loadLicenseModuleCentral();
49
+ return _useIsPro ?? (() => false);
50
+ }
51
+
52
+ /**
53
+ * Get the useLicense hook from @buoy-gg/license.
54
+ * Returns null if the license package is not available.
55
+ *
56
+ * IMPORTANT: Use this instead of doing your own lazy loading in other packages
57
+ */
58
+ function getUseLicense() {
59
+ loadLicenseModuleCentral();
60
+ return _useLicense;
61
+ }
62
+
63
+ /**
64
+ * Get the useTier hook from @buoy-gg/license.
65
+ *
66
+ * Falls back to `"free"` — NOT `"anonymous"` — when the license package can't
67
+ * be resolved. That deliberately matches the existing `getUseIsPro()` fallback,
68
+ * which yields free-tier behavior today, and it picks the safer failure:
69
+ *
70
+ * - falling back to "anonymous" would let one bundler quirk silently cut every
71
+ * legitimate user's limits by ~80%;
72
+ * - falling back to "free" costs no revenue, because Pro still requires a key
73
+ * that a live license server validated — this path can never grant Pro.
74
+ *
75
+ * Reaching it at all requires `@buoy-gg/license` to be missing, and it is a
76
+ * hard dependency of `@buoy-gg/core`.
77
+ */
78
+ function getUseTier() {
79
+ loadLicenseModuleCentral();
80
+ return _useTier ?? (() => "free");
81
+ }
82
+
83
+ /**
84
+ * Whether the anonymous tier is switched on.
85
+ *
86
+ * The switch itself lives in @buoy-gg/license (see its config.ts) because the
87
+ * Weekend Pass change has to flip at the same moment as the reduced limits, and
88
+ * those live in different packages. Read through the same lazy loader as the
89
+ * hooks so a missing license package degrades gracefully rather than throwing
90
+ * at module load.
91
+ *
92
+ * Falls back to `false` — the anonymous tier off, everyone on free limits —
93
+ * which matches the `getUseTier()` fallback of "free". A build that cannot
94
+ * resolve the license package must never take limits AWAY from someone.
95
+ */
96
+ function isAnonymousTierEnabled() {
97
+ loadLicenseModuleCentral();
98
+ return _anonymousTierEnabled ?? false;
99
+ }