()
| 75 | } |
| 76 | |
| 77 | export function useSubscriptionState() { |
| 78 | const subscription = useAppStore((state) => state.subscription); |
| 79 | const loadSubscription = useAppStore((state) => state.loadSubscription); |
| 80 | const uploadLicense = useAppStore((state) => state.uploadLicense); |
| 81 | const currentPlan = useAppStore((state) => state.currentPlan()); |
| 82 | const isFreePlan = useAppStore((state) => state.isFreePlan()); |
| 83 | const isTrialing = useAppStore((state) => state.isTrialing()); |
| 84 | const isExpired = useAppStore((state) => state.isExpired()); |
| 85 | const daysBeforeExpire = useAppStore((state) => state.daysBeforeExpire()); |
| 86 | const trialingDays = useAppStore((state) => state.trialingDays()); |
| 87 | const showTrial = useAppStore((state) => state.showTrial()); |
| 88 | const expireAt = useAppStore((state) => state.expireAt()); |
| 89 | const instanceCountLimit = useAppStore((state) => state.instanceCountLimit()); |
| 90 | const userCountLimit = useAppStore((state) => state.userCountLimit()); |
| 91 | const instanceLicenseCount = useAppStore((state) => |
| 92 | state.instanceLicenseCount() |
| 93 | ); |
| 94 | const hasUnifiedInstanceLicense = useAppStore((state) => |
| 95 | state.hasUnifiedInstanceLicense() |
| 96 | ); |
| 97 | useEffect(() => { |
| 98 | void loadSubscription(); |
| 99 | }, [loadSubscription]); |
| 100 | return { |
| 101 | subscription, |
| 102 | uploadLicense, |
| 103 | currentPlan, |
| 104 | isFreePlan, |
| 105 | isTrialing, |
| 106 | isExpired, |
| 107 | daysBeforeExpire, |
| 108 | trialingDays, |
| 109 | showTrial, |
| 110 | expireAt, |
| 111 | instanceCountLimit, |
| 112 | userCountLimit, |
| 113 | instanceLicenseCount, |
| 114 | hasUnifiedInstanceLicense, |
| 115 | }; |
| 116 | } |
| 117 | |
| 118 | export function useServerInfo() { |
| 119 | const serverInfo = useAppStore((state) => state.serverInfo); |
no test coverage detected