feat(manager): license banners for offline licensing (KI-006)
Expiry reminders from 14 days (was 5) with a 'connect the server to the internet to renew' hint while offline; banners for a clock set back and for a not-yet-verified license; a quiet note after 7+ days without cloud contact stating the system keeps working until the license date. Grace period banner respects grace_over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,11 +15,18 @@ import client from '../api/client'
|
||||
* grace_expires_at string | null (ISO)
|
||||
* grace_days_remaining number | null
|
||||
* sync_failed bool
|
||||
* offline_days number | null days since the last successful cloud contact
|
||||
* license_problem "clock" | "unverified" | "expired" | "inactive" | null
|
||||
* grace_over bool
|
||||
*
|
||||
* The site enforces its signed license offline (KI-006): it keeps running
|
||||
* until expiry however long it has no internet — offline_days is informational.
|
||||
*
|
||||
* Derived helpers:
|
||||
* showExpiryWarning bool — true when 0 < days_until_expiry <= 5
|
||||
* showExpiryWarning bool — true when 0 <= days_until_expiry <= 14
|
||||
* inGracePeriod bool — true when expired but grace not yet over
|
||||
* isBlocked bool — locked=true OR (unlicensed AND grace over)
|
||||
* isBlocked bool — locked=true OR unlicensed
|
||||
* longOffline bool — no cloud contact for 7+ days (renewal needs it)
|
||||
*/
|
||||
export default function useLicenseStatus() {
|
||||
const { data } = useQuery({
|
||||
@@ -41,9 +48,13 @@ export default function useLicenseStatus() {
|
||||
grace_expires_at: null,
|
||||
grace_days_remaining: null,
|
||||
sync_failed: false,
|
||||
offline_days: null,
|
||||
license_problem: null,
|
||||
grace_over: false,
|
||||
showExpiryWarning: false,
|
||||
inGracePeriod: false,
|
||||
isBlocked: false,
|
||||
longOffline: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,16 +68,21 @@ export default function useLicenseStatus() {
|
||||
grace_expires_at = null,
|
||||
grace_days_remaining = null,
|
||||
sync_failed = false,
|
||||
offline_days = null,
|
||||
license_problem = null,
|
||||
grace_over = false,
|
||||
} = data
|
||||
|
||||
const showExpiryWarning =
|
||||
days_until_expiry != null && days_until_expiry >= 0 && days_until_expiry <= 5
|
||||
days_until_expiry != null && days_until_expiry >= 0 && days_until_expiry <= 14
|
||||
|
||||
const inGracePeriod =
|
||||
days_until_expiry != null && days_until_expiry < 0 && licensed
|
||||
days_until_expiry != null && days_until_expiry < 0 && licensed && !grace_over
|
||||
|
||||
const isBlocked = locked || !licensed
|
||||
|
||||
const longOffline = offline_days != null && offline_days >= 7
|
||||
|
||||
return {
|
||||
licensed,
|
||||
locked,
|
||||
@@ -77,8 +93,12 @@ export default function useLicenseStatus() {
|
||||
grace_expires_at,
|
||||
grace_days_remaining,
|
||||
sync_failed,
|
||||
offline_days,
|
||||
license_problem,
|
||||
grace_over,
|
||||
showExpiryWarning,
|
||||
inGracePeriod,
|
||||
isBlocked,
|
||||
longOffline,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user