@buoy-gg/shared-ui 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 (154) 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 +50 -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/module/JsModal.js +39 -16
  29. package/lib/module/dataViewer/JsonStringNotice.js +54 -0
  30. package/lib/module/dataViewer/ThemedSplitView.js +20 -1
  31. package/lib/module/dataViewer/TimestampDeltaBar.js +91 -0
  32. package/lib/module/dataViewer/index.js +4 -0
  33. package/lib/module/dataViewer/jsonStringValue.js +89 -0
  34. package/lib/module/dataViewer/timestampDiff.js +139 -0
  35. package/lib/module/hooks/safe-area-impl.js +1 -1
  36. package/lib/module/index.js +1 -1
  37. package/lib/module/license/FeatureGate.js +43 -10
  38. package/lib/module/license/FreeAccountPrompt.js +176 -0
  39. package/lib/module/license/index.js +5 -40
  40. package/lib/module/license/licenseModule.js +92 -0
  41. package/lib/module/license/tierLimits.js +158 -0
  42. package/lib/module/ui/backgrounds/BackgroundSwitcher.js +176 -0
  43. package/lib/module/ui/backgrounds/README.md +115 -0
  44. package/lib/module/ui/backgrounds/ToolBackground.js +70 -0
  45. package/lib/module/ui/backgrounds/backgroundStore.js +111 -0
  46. package/lib/module/ui/backgrounds/index.js +9 -0
  47. package/lib/module/ui/backgrounds/primitives.js +328 -0
  48. package/lib/module/ui/backgrounds/registry.js +105 -0
  49. package/lib/module/ui/backgrounds/rng.js +65 -0
  50. package/lib/module/ui/backgrounds/types.js +1 -0
  51. package/lib/module/ui/backgrounds/variants/deepField.js +347 -0
  52. package/lib/module/ui/backgrounds/variants/lattice.js +575 -0
  53. package/lib/module/ui/backgrounds/variants/starfield.js +206 -0
  54. package/lib/module/ui/index.js +3 -0
  55. package/lib/typescript/commonjs/JsModal.d.ts.map +1 -1
  56. package/lib/typescript/commonjs/dataViewer/JsonStringNotice.d.ts +6 -0
  57. package/lib/typescript/commonjs/dataViewer/JsonStringNotice.d.ts.map +1 -0
  58. package/lib/typescript/commonjs/dataViewer/ThemedSplitView.d.ts.map +1 -1
  59. package/lib/typescript/commonjs/dataViewer/TimestampDeltaBar.d.ts +7 -0
  60. package/lib/typescript/commonjs/dataViewer/TimestampDeltaBar.d.ts.map +1 -0
  61. package/lib/typescript/commonjs/dataViewer/index.d.ts +6 -0
  62. package/lib/typescript/commonjs/dataViewer/index.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/dataViewer/jsonStringValue.d.ts +25 -0
  64. package/lib/typescript/commonjs/dataViewer/jsonStringValue.d.ts.map +1 -0
  65. package/lib/typescript/commonjs/dataViewer/timestampDiff.d.ts +55 -0
  66. package/lib/typescript/commonjs/dataViewer/timestampDiff.d.ts.map +1 -0
  67. package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
  68. package/lib/typescript/commonjs/index.d.ts +2 -2
  69. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  70. package/lib/typescript/commonjs/license/FeatureGate.d.ts +19 -3
  71. package/lib/typescript/commonjs/license/FeatureGate.d.ts.map +1 -1
  72. package/lib/typescript/commonjs/license/FreeAccountPrompt.d.ts +23 -0
  73. package/lib/typescript/commonjs/license/FreeAccountPrompt.d.ts.map +1 -0
  74. package/lib/typescript/commonjs/license/index.d.ts +6 -15
  75. package/lib/typescript/commonjs/license/index.d.ts.map +1 -1
  76. package/lib/typescript/commonjs/license/licenseModule.d.ts +55 -0
  77. package/lib/typescript/commonjs/license/licenseModule.d.ts.map +1 -0
  78. package/lib/typescript/commonjs/license/tierLimits.d.ts +143 -0
  79. package/lib/typescript/commonjs/license/tierLimits.d.ts.map +1 -0
  80. package/lib/typescript/commonjs/ui/backgrounds/BackgroundSwitcher.d.ts +13 -0
  81. package/lib/typescript/commonjs/ui/backgrounds/BackgroundSwitcher.d.ts.map +1 -0
  82. package/lib/typescript/commonjs/ui/backgrounds/ToolBackground.d.ts +30 -0
  83. package/lib/typescript/commonjs/ui/backgrounds/ToolBackground.d.ts.map +1 -0
  84. package/lib/typescript/commonjs/ui/backgrounds/backgroundStore.d.ts +43 -0
  85. package/lib/typescript/commonjs/ui/backgrounds/backgroundStore.d.ts.map +1 -0
  86. package/lib/typescript/commonjs/ui/backgrounds/index.d.ts +7 -0
  87. package/lib/typescript/commonjs/ui/backgrounds/index.d.ts.map +1 -0
  88. package/lib/typescript/commonjs/ui/backgrounds/primitives.d.ts +106 -0
  89. package/lib/typescript/commonjs/ui/backgrounds/primitives.d.ts.map +1 -0
  90. package/lib/typescript/commonjs/ui/backgrounds/registry.d.ts +28 -0
  91. package/lib/typescript/commonjs/ui/backgrounds/registry.d.ts.map +1 -0
  92. package/lib/typescript/commonjs/ui/backgrounds/rng.d.ts +27 -0
  93. package/lib/typescript/commonjs/ui/backgrounds/rng.d.ts.map +1 -0
  94. package/lib/typescript/commonjs/ui/backgrounds/types.d.ts +14 -0
  95. package/lib/typescript/commonjs/ui/backgrounds/types.d.ts.map +1 -0
  96. package/lib/typescript/commonjs/ui/backgrounds/variants/deepField.d.ts +65 -0
  97. package/lib/typescript/commonjs/ui/backgrounds/variants/deepField.d.ts.map +1 -0
  98. package/lib/typescript/commonjs/ui/backgrounds/variants/lattice.d.ts +33 -0
  99. package/lib/typescript/commonjs/ui/backgrounds/variants/lattice.d.ts.map +1 -0
  100. package/lib/typescript/commonjs/ui/backgrounds/variants/starfield.d.ts +12 -0
  101. package/lib/typescript/commonjs/ui/backgrounds/variants/starfield.d.ts.map +1 -0
  102. package/lib/typescript/commonjs/ui/index.d.ts +1 -0
  103. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  104. package/lib/typescript/module/JsModal.d.ts.map +1 -1
  105. package/lib/typescript/module/dataViewer/JsonStringNotice.d.ts +6 -0
  106. package/lib/typescript/module/dataViewer/JsonStringNotice.d.ts.map +1 -0
  107. package/lib/typescript/module/dataViewer/ThemedSplitView.d.ts.map +1 -1
  108. package/lib/typescript/module/dataViewer/TimestampDeltaBar.d.ts +7 -0
  109. package/lib/typescript/module/dataViewer/TimestampDeltaBar.d.ts.map +1 -0
  110. package/lib/typescript/module/dataViewer/index.d.ts +6 -0
  111. package/lib/typescript/module/dataViewer/index.d.ts.map +1 -1
  112. package/lib/typescript/module/dataViewer/jsonStringValue.d.ts +25 -0
  113. package/lib/typescript/module/dataViewer/jsonStringValue.d.ts.map +1 -0
  114. package/lib/typescript/module/dataViewer/timestampDiff.d.ts +55 -0
  115. package/lib/typescript/module/dataViewer/timestampDiff.d.ts.map +1 -0
  116. package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
  117. package/lib/typescript/module/index.d.ts +2 -2
  118. package/lib/typescript/module/index.d.ts.map +1 -1
  119. package/lib/typescript/module/license/FeatureGate.d.ts +19 -3
  120. package/lib/typescript/module/license/FeatureGate.d.ts.map +1 -1
  121. package/lib/typescript/module/license/FreeAccountPrompt.d.ts +23 -0
  122. package/lib/typescript/module/license/FreeAccountPrompt.d.ts.map +1 -0
  123. package/lib/typescript/module/license/index.d.ts +6 -15
  124. package/lib/typescript/module/license/index.d.ts.map +1 -1
  125. package/lib/typescript/module/license/licenseModule.d.ts +55 -0
  126. package/lib/typescript/module/license/licenseModule.d.ts.map +1 -0
  127. package/lib/typescript/module/license/tierLimits.d.ts +143 -0
  128. package/lib/typescript/module/license/tierLimits.d.ts.map +1 -0
  129. package/lib/typescript/module/ui/backgrounds/BackgroundSwitcher.d.ts +13 -0
  130. package/lib/typescript/module/ui/backgrounds/BackgroundSwitcher.d.ts.map +1 -0
  131. package/lib/typescript/module/ui/backgrounds/ToolBackground.d.ts +30 -0
  132. package/lib/typescript/module/ui/backgrounds/ToolBackground.d.ts.map +1 -0
  133. package/lib/typescript/module/ui/backgrounds/backgroundStore.d.ts +43 -0
  134. package/lib/typescript/module/ui/backgrounds/backgroundStore.d.ts.map +1 -0
  135. package/lib/typescript/module/ui/backgrounds/index.d.ts +7 -0
  136. package/lib/typescript/module/ui/backgrounds/index.d.ts.map +1 -0
  137. package/lib/typescript/module/ui/backgrounds/primitives.d.ts +106 -0
  138. package/lib/typescript/module/ui/backgrounds/primitives.d.ts.map +1 -0
  139. package/lib/typescript/module/ui/backgrounds/registry.d.ts +28 -0
  140. package/lib/typescript/module/ui/backgrounds/registry.d.ts.map +1 -0
  141. package/lib/typescript/module/ui/backgrounds/rng.d.ts +27 -0
  142. package/lib/typescript/module/ui/backgrounds/rng.d.ts.map +1 -0
  143. package/lib/typescript/module/ui/backgrounds/types.d.ts +14 -0
  144. package/lib/typescript/module/ui/backgrounds/types.d.ts.map +1 -0
  145. package/lib/typescript/module/ui/backgrounds/variants/deepField.d.ts +65 -0
  146. package/lib/typescript/module/ui/backgrounds/variants/deepField.d.ts.map +1 -0
  147. package/lib/typescript/module/ui/backgrounds/variants/lattice.d.ts +33 -0
  148. package/lib/typescript/module/ui/backgrounds/variants/lattice.d.ts.map +1 -0
  149. package/lib/typescript/module/ui/backgrounds/variants/starfield.d.ts +12 -0
  150. package/lib/typescript/module/ui/backgrounds/variants/starfield.d.ts.map +1 -0
  151. package/lib/typescript/module/ui/index.d.ts +1 -0
  152. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  153. package/package.json +4 -4
  154. package/scripts/detect-safe-area.js +0 -20
@@ -80,8 +80,15 @@ var _exportNames = {
80
80
  LicenseEntryModal: true,
81
81
  ProBadge: true,
82
82
  ProUpgradeModal: true,
83
+ FreeAccountPrompt: true,
84
+ LOGIN_COMMAND: true,
83
85
  getUseIsPro: true,
84
- getUseLicense: true
86
+ getUseLicense: true,
87
+ getUseTier: true,
88
+ TIER_LIMITS: true,
89
+ useLimit: true,
90
+ resolveEffectiveTier: true,
91
+ freeKeyRaises: true
85
92
  };
86
93
  Object.defineProperty(exports, "EnvironmentIndicator", {
87
94
  enumerable: true,
@@ -107,6 +114,12 @@ Object.defineProperty(exports, "FeatureGate", {
107
114
  return _index12.FeatureGate;
108
115
  }
109
116
  });
117
+ Object.defineProperty(exports, "FreeAccountPrompt", {
118
+ enumerable: true,
119
+ get: function () {
120
+ return _index12.FreeAccountPrompt;
121
+ }
122
+ });
110
123
  Object.defineProperty(exports, "HintsProvider", {
111
124
  enumerable: true,
112
125
  get: function () {
@@ -119,6 +132,12 @@ Object.defineProperty(exports, "JsModal", {
119
132
  return _JsModal.JsModal;
120
133
  }
121
134
  });
135
+ Object.defineProperty(exports, "LOGIN_COMMAND", {
136
+ enumerable: true,
137
+ get: function () {
138
+ return _index12.LOGIN_COMMAND;
139
+ }
140
+ });
122
141
  Object.defineProperty(exports, "LicenseEntryModal", {
123
142
  enumerable: true,
124
143
  get: function () {
@@ -155,6 +174,12 @@ Object.defineProperty(exports, "Subscribable", {
155
174
  return _index3.Subscribable;
156
175
  }
157
176
  });
177
+ Object.defineProperty(exports, "TIER_LIMITS", {
178
+ enumerable: true,
179
+ get: function () {
180
+ return _index12.TIER_LIMITS;
181
+ }
182
+ });
158
183
  Object.defineProperty(exports, "UpgradeModal", {
159
184
  enumerable: true,
160
185
  get: function () {
@@ -209,6 +234,12 @@ Object.defineProperty(exports, "formatValue", {
209
234
  return _index3.formatValue;
210
235
  }
211
236
  });
237
+ Object.defineProperty(exports, "freeKeyRaises", {
238
+ enumerable: true,
239
+ get: function () {
240
+ return _index12.freeKeyRaises;
241
+ }
242
+ });
212
243
  Object.defineProperty(exports, "gameUIColors", {
213
244
  enumerable: true,
214
245
  get: function () {
@@ -305,6 +336,12 @@ Object.defineProperty(exports, "getUseLicense", {
305
336
  return _index12.getUseLicense;
306
337
  }
307
338
  });
339
+ Object.defineProperty(exports, "getUseTier", {
340
+ enumerable: true,
341
+ get: function () {
342
+ return _index12.getUseTier;
343
+ }
344
+ });
308
345
  Object.defineProperty(exports, "getValueSize", {
309
346
  enumerable: true,
310
347
  get: function () {
@@ -425,6 +462,12 @@ Object.defineProperty(exports, "reloadApp", {
425
462
  return _index3.reloadApp;
426
463
  }
427
464
  });
465
+ Object.defineProperty(exports, "resolveEffectiveTier", {
466
+ enumerable: true,
467
+ get: function () {
468
+ return _index12.resolveEffectiveTier;
469
+ }
470
+ });
428
471
  Object.defineProperty(exports, "resolveReloadStrategy", {
429
472
  enumerable: true,
430
473
  get: function () {
@@ -515,6 +558,12 @@ Object.defineProperty(exports, "useHintsDisabled", {
515
558
  return _index10.useHintsDisabled;
516
559
  }
517
560
  });
561
+ Object.defineProperty(exports, "useLimit", {
562
+ enumerable: true,
563
+ get: function () {
564
+ return _index12.useLimit;
565
+ }
566
+ });
518
567
  Object.defineProperty(exports, "usePersistedState", {
519
568
  enumerable: true,
520
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
+ }