@buoy-gg/zustand 7.0.22 → 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.
@@ -23,8 +23,6 @@ var _jsxRuntime = require("react/jsx-runtime");
23
23
  * - Events tab: Live state change monitoring with diffs
24
24
  */
25
25
 
26
- /** Free tier limit for change history */
27
- const FREE_TIER_CHANGE_LIMIT = 25;
28
26
  function EventsEmptyState({
29
27
  isEnabled
30
28
  }) {
@@ -57,6 +55,7 @@ function ZustandModal({
57
55
  onStoreExpand
58
56
  }) {
59
57
  const isPro = (0, _license.useIsPro)();
58
+ const changeLimit = (0, _sharedUi.useLimit)("zustand.changes");
60
59
  const [showProModal, setShowProModal] = (0, _react.useState)(false);
61
60
  const [activeTab, setActiveTab] = (0, _react.useState)(initialTab);
62
61
  const [selectedHistoryStore, setSelectedHistoryStore] = (0, _react.useState)(null);
@@ -85,15 +84,10 @@ function ZustandModal({
85
84
  return stores.filter(s => !Array.from(ignoredPatterns).some(p => s.name.toLowerCase().includes(p.toLowerCase())));
86
85
  }, [stores, ignoredPatterns]);
87
86
 
88
- // For free users, limit visible changes
89
- const visibleChanges = (0, _react.useMemo)(() => {
90
- if (isPro) return displayedChanges;
91
- return displayedChanges.slice(0, FREE_TIER_CHANGE_LIMIT);
92
- }, [displayedChanges, isPro]);
93
- const lockedChangeCount = (0, _react.useMemo)(() => {
94
- if (isPro) return 0;
95
- return Math.max(0, displayedChanges.length - FREE_TIER_CHANGE_LIMIT);
96
- }, [displayedChanges.length, isPro]);
87
+ // Pro is Infinity here, so slice() returns everything and the locked count
88
+ // floors at 0 — no tier branching needed at the call site.
89
+ const visibleChanges = (0, _react.useMemo)(() => displayedChanges.slice(0, changeLimit), [displayedChanges, changeLimit]);
90
+ const lockedChangeCount = (0, _react.useMemo)(() => Math.max(0, displayedChanges.length - changeLimit), [displayedChanges.length, changeLimit]);
97
91
  const hasLockedChanges = lockedChangeCount > 0;
98
92
 
99
93
  // When viewing a single store's history, scope the change list to that store
@@ -10,7 +10,7 @@
10
10
 
11
11
  import { useState, useMemo, useRef, useCallback, useEffect } from "react";
12
12
  import { View, Text, StyleSheet, FlatList, TextInput, TouchableOpacity } from "react-native";
13
- import { JsModal, ModalHeader, TabSelector, macOSColors, buoyColors, Search, Filter, Power, X, Lock, Box, devToolsStorageKeys, ProUpgradeModal, PowerToggleButton, ToolbarCopyButton, ToolbarClearButton, truncatePayload, TickProvider } from "@buoy-gg/shared-ui";
13
+ import { JsModal, ModalHeader, TabSelector, macOSColors, buoyColors, Search, Filter, Power, X, Lock, Box, devToolsStorageKeys, ProUpgradeModal, PowerToggleButton, ToolbarCopyButton, ToolbarClearButton, truncatePayload, TickProvider, useLimit } from "@buoy-gg/shared-ui";
14
14
  import { useIsPro } from "@buoy-gg/license";
15
15
  import { useZustandStateChanges } from "../hooks/useZustandStateChanges";
16
16
  import { ZustandStateChangeItem } from "./ZustandStateChangeItem";
@@ -18,8 +18,6 @@ import { ZustandStateDetailContent, ZustandStateDetailFooter } from "./ZustandSt
18
18
  import { ZustandStoreBrowser } from "./ZustandStoreBrowser";
19
19
  import { ZustandEventFilterView } from "./ZustandEventFilterView";
20
20
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
21
- /** Free tier limit for change history */
22
- const FREE_TIER_CHANGE_LIMIT = 25;
23
21
  function EventsEmptyState({
24
22
  isEnabled
25
23
  }) {
@@ -52,6 +50,7 @@ export function ZustandModal({
52
50
  onStoreExpand
53
51
  }) {
54
52
  const isPro = useIsPro();
53
+ const changeLimit = useLimit("zustand.changes");
55
54
  const [showProModal, setShowProModal] = useState(false);
56
55
  const [activeTab, setActiveTab] = useState(initialTab);
57
56
  const [selectedHistoryStore, setSelectedHistoryStore] = useState(null);
@@ -80,15 +79,10 @@ export function ZustandModal({
80
79
  return stores.filter(s => !Array.from(ignoredPatterns).some(p => s.name.toLowerCase().includes(p.toLowerCase())));
81
80
  }, [stores, ignoredPatterns]);
82
81
 
83
- // For free users, limit visible changes
84
- const visibleChanges = useMemo(() => {
85
- if (isPro) return displayedChanges;
86
- return displayedChanges.slice(0, FREE_TIER_CHANGE_LIMIT);
87
- }, [displayedChanges, isPro]);
88
- const lockedChangeCount = useMemo(() => {
89
- if (isPro) return 0;
90
- return Math.max(0, displayedChanges.length - FREE_TIER_CHANGE_LIMIT);
91
- }, [displayedChanges.length, isPro]);
82
+ // Pro is Infinity here, so slice() returns everything and the locked count
83
+ // floors at 0 — no tier branching needed at the call site.
84
+ const visibleChanges = useMemo(() => displayedChanges.slice(0, changeLimit), [displayedChanges, changeLimit]);
85
+ const lockedChangeCount = useMemo(() => Math.max(0, displayedChanges.length - changeLimit), [displayedChanges.length, changeLimit]);
92
86
  const hasLockedChanges = lockedChangeCount > 0;
93
87
 
94
88
  // When viewing a single store's history, scope the change list to that store
@@ -1 +1 @@
1
- {"version":3,"file":"ZustandModal.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandModal.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA2CH,OAAO,KAAK,EAAE,iBAAiB,EAAsB,MAAM,UAAU,CAAC;AAqBtE,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,OAAO,EACP,MAAM,EACN,UAAU,EACV,2BAAmC,EACnC,MAAc,EACd,aAAqB,EACrB,UAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,EAAE,iBAAiB,sCAklBnB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,GAAE,IAAI,CAAC,iBAAiB,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAM,+BAGtE"}
1
+ {"version":3,"file":"ZustandModal.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandModal.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA4CH,OAAO,KAAK,EAAE,iBAAiB,EAAsB,MAAM,UAAU,CAAC;AAkBtE,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,OAAO,EACP,MAAM,EACN,UAAU,EACV,2BAAmC,EACnC,MAAc,EACd,aAAqB,EACrB,UAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,EAAE,iBAAiB,sCAolBnB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,GAAE,IAAI,CAAC,iBAAiB,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAM,+BAGtE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/zustand",
3
- "version": "7.0.22",
3
+ "version": "7.0.23",
4
4
  "description": "Zustand devtools inside your React Native app — state diffs, jump-to-state & one-tap store reset, no middleware. Part of Buoy devtools.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -29,8 +29,8 @@
29
29
  "**/snapshotProvider.ts"
30
30
  ],
31
31
  "dependencies": {
32
- "@buoy-gg/license": "^7.0.22",
33
- "@buoy-gg/shared-ui": "^7.0.22"
32
+ "@buoy-gg/shared-ui": "^7.0.23",
33
+ "@buoy-gg/license": "^7.0.23"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "*",
@@ -75,7 +75,7 @@
75
75
  "bugs": {
76
76
  "url": "https://github.com/LovesWorking/react-native-buoy/issues"
77
77
  },
78
- "homepage": "https://buoy.gg/tools/zustand",
78
+ "homepage": "https://buoy.gg/buoy/latest/docs/tools/zustand",
79
79
  "publishConfig": {
80
80
  "access": "public",
81
81
  "tag": "latest"