feat: bulk XML upload, period selector, and session persistence
- Add bulk XML CFDI upload support (up to 300MB) - Add period selector component for month/year navigation - Fix session persistence on page refresh (Zustand hydration) - Fix income/expense classification based on tenant RFC - Fix IVA calculation from XML (correct Impuestos element) - Add error handling to reportes page - Support multiple CORS origins - Update reportes service with proper Decimal/BigInt handling - Add RFC to tenant view store for proper CFDI classification - Update README with changelog and new features Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,9 +5,11 @@ import type { UserInfo } from '@horux/shared';
|
||||
interface AuthState {
|
||||
user: UserInfo | null;
|
||||
isAuthenticated: boolean;
|
||||
_hasHydrated: boolean;
|
||||
setUser: (user: UserInfo | null) => void;
|
||||
setTokens: (accessToken: string, refreshToken: string) => void;
|
||||
logout: () => void;
|
||||
setHasHydrated: (state: boolean) => void;
|
||||
}
|
||||
|
||||
export const useAuthStore = create<AuthState>()(
|
||||
@@ -15,6 +17,7 @@ export const useAuthStore = create<AuthState>()(
|
||||
(set) => ({
|
||||
user: null,
|
||||
isAuthenticated: false,
|
||||
_hasHydrated: false,
|
||||
setUser: (user) => set({ user, isAuthenticated: !!user }),
|
||||
setTokens: (accessToken, refreshToken) => {
|
||||
localStorage.setItem('accessToken', accessToken);
|
||||
@@ -25,10 +28,14 @@ export const useAuthStore = create<AuthState>()(
|
||||
localStorage.removeItem('refreshToken');
|
||||
set({ user: null, isAuthenticated: false });
|
||||
},
|
||||
setHasHydrated: (state) => set({ _hasHydrated: state }),
|
||||
}),
|
||||
{
|
||||
name: 'horux-auth',
|
||||
partialize: (state) => ({ user: state.user, isAuthenticated: state.isAuthenticated }),
|
||||
onRehydrateStorage: () => (state) => {
|
||||
state?.setHasHydrated(true);
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
@@ -4,7 +4,8 @@ import { persist } from 'zustand/middleware';
|
||||
interface TenantViewState {
|
||||
viewingTenantId: string | null;
|
||||
viewingTenantName: string | null;
|
||||
setViewingTenant: (id: string | null, name: string | null) => void;
|
||||
viewingTenantRfc: string | null;
|
||||
setViewingTenant: (id: string | null, name: string | null, rfc?: string | null) => void;
|
||||
clearViewingTenant: () => void;
|
||||
}
|
||||
|
||||
@@ -13,8 +14,9 @@ export const useTenantViewStore = create<TenantViewState>()(
|
||||
(set) => ({
|
||||
viewingTenantId: null,
|
||||
viewingTenantName: null,
|
||||
setViewingTenant: (id, name) => set({ viewingTenantId: id, viewingTenantName: name }),
|
||||
clearViewingTenant: () => set({ viewingTenantId: null, viewingTenantName: null }),
|
||||
viewingTenantRfc: null,
|
||||
setViewingTenant: (id, name, rfc = null) => set({ viewingTenantId: id, viewingTenantName: name, viewingTenantRfc: rfc }),
|
||||
clearViewingTenant: () => set({ viewingTenantId: null, viewingTenantName: null, viewingTenantRfc: null }),
|
||||
}),
|
||||
{
|
||||
name: 'horux-tenant-view',
|
||||
|
||||
Reference in New Issue
Block a user