forlogic-core 1.15.2 → 1.15.4
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.
- package/dist/assets/index.d.ts +6 -0
- package/dist/auth/components/ProtectedRoute.d.ts +6 -0
- package/dist/auth/components/UserInfo.d.ts +10 -0
- package/dist/auth/contexts/AuthContext.d.ts +84 -0
- package/dist/auth/pages/CallbackPage.d.ts +1 -0
- package/dist/auth/pages/LoginPage.d.ts +2 -0
- package/dist/auth/services/AuthService.d.ts +40 -0
- package/dist/auth/services/SupabaseTokenService.d.ts +3 -0
- package/dist/auth/services/TokenManager.d.ts +51 -0
- package/dist/auth/services/TokenRegenerationService.d.ts +12 -0
- package/dist/auth/services/TokenService.d.ts +42 -0
- package/dist/auth/utils/AuthUtils.d.ts +4 -0
- package/dist/auth/utils/ErrorInterceptor.d.ts +15 -0
- package/dist/components/ErrorBoundary.d.ts +19 -0
- package/dist/components/layout/AppHeader.d.ts +63 -0
- package/dist/components/layout/AppLayout.d.ts +10 -0
- package/dist/components/layout/AppSidebar.d.ts +10 -0
- package/dist/components/layout/BodyContent.d.ts +60 -0
- package/dist/components/layout/SidebarActionTrigger.d.ts +34 -0
- package/dist/components/layout/SidebarHeader.d.ts +5 -0
- package/dist/components/layout/sidebar-utils.d.ts +12 -0
- package/dist/components/modules/ModuleGrid.d.ts +9 -0
- package/dist/components/modules/ModulesDialog.d.ts +3 -0
- package/dist/components/modules/icons/ModulesCardIcons.d.ts +19 -0
- package/dist/components/modules/index.d.ts +4 -0
- package/dist/components/modules/modulesData.d.ts +6 -0
- package/dist/components/modules/types.d.ts +35 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/action-button.d.ts +43 -0
- package/dist/components/ui/alert-dialog.d.ts +20 -0
- package/dist/components/ui/alert.d.ts +12 -0
- package/dist/components/ui/avatar.d.ts +6 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/breadcrumb.d.ts +19 -0
- package/dist/components/ui/button-group.d.ts +9 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/calendar.d.ts +8 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/components/ui/chart.d.ts +62 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/color-picker.d.ts +8 -0
- package/dist/components/ui/combobox.d.ts +33 -0
- package/dist/components/ui/command.d.ts +23 -0
- package/dist/components/ui/context-menu.d.ts +27 -0
- package/dist/components/ui/data-list.d.ts +86 -0
- package/dist/components/ui/date-picker.d.ts +9 -0
- package/dist/components/ui/dialog.d.ts +36 -0
- package/dist/components/ui/disabled-menu-item.d.ts +25 -0
- package/dist/components/ui/drawer.d.ts +22 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/empty-state.d.ts +79 -0
- package/dist/components/ui/form.d.ts +23 -0
- package/dist/components/ui/grid.d.ts +53 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/icon-picker.d.ts +8 -0
- package/dist/components/ui/input-group.d.ts +97 -0
- package/dist/components/ui/input.d.ts +37 -0
- package/dist/components/ui/label.d.ts +23 -0
- package/dist/components/ui/loading-state.d.ts +52 -0
- package/dist/components/ui/menubar.d.ts +33 -0
- package/dist/components/ui/navigation-menu.d.ts +12 -0
- package/dist/components/ui/onboarding-dialog.d.ts +43 -0
- package/dist/components/ui/page-breadcrumb.d.ts +77 -0
- package/dist/components/ui/pagination.d.ts +28 -0
- package/dist/components/ui/popover.d.ts +49 -0
- package/dist/components/ui/progress.d.ts +22 -0
- package/dist/components/ui/radio-group.d.ts +63 -0
- package/dist/components/ui/resizable.d.ts +23 -0
- package/dist/components/ui/rich-text-editor.d.ts +45 -0
- package/dist/components/ui/scroll-area.d.ts +37 -0
- package/dist/components/ui/select.d.ts +16 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/sheet.d.ts +32 -0
- package/dist/components/ui/sidebar.d.ts +66 -0
- package/dist/components/ui/skeleton-variants.d.ts +16 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/sonner.d.ts +3 -0
- package/dist/components/ui/spinner.d.ts +6 -0
- package/dist/components/ui/split-button.d.ts +70 -0
- package/dist/components/ui/stack.d.ts +12 -0
- package/dist/components/ui/step-selector.d.ts +39 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/tab-page-layout.d.ts +19 -0
- package/dist/components/ui/table-resize-handle.d.ts +15 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/textarea.d.ts +5 -0
- package/dist/components/ui/toggle-group.d.ts +12 -0
- package/dist/components/ui/toggle.d.ts +12 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/truncated-cell.d.ts +7 -0
- package/dist/components/ui/typography.d.ts +16 -0
- package/dist/config/index.d.ts +53 -0
- package/dist/contexts/LocaleContext.d.ts +15 -0
- package/dist/contexts/ModalStateContext.d.ts +57 -0
- package/dist/contexts/NavigationContext.d.ts +13 -0
- package/dist/contexts/PageMetadataContext.d.ts +43 -0
- package/dist/crud/components/ActionMenuItems.d.ts +17 -0
- package/dist/crud/components/BaseForm.d.ts +6 -0
- package/dist/crud/components/ContextMenu.d.ts +21 -0
- package/dist/crud/components/CrudActionBar.d.ts +38 -0
- package/dist/crud/components/CrudGrid.d.ts +43 -0
- package/dist/crud/components/CrudPagination.d.ts +12 -0
- package/dist/crud/components/CrudTable.d.ts +41 -0
- package/dist/crud/components/FilterBar.d.ts +136 -0
- package/dist/crud/components/TableFooter.d.ts +14 -0
- package/dist/crud/components/TableRowActions.d.ts +14 -0
- package/dist/crud/createCrudPage.d.ts +99 -0
- package/dist/crud/createSimpleService.d.ts +85 -0
- package/dist/crud/generateCrudConfig.d.ts +73 -0
- package/dist/crud/hooks/useBaseForm.d.ts +8 -0
- package/dist/crud/hooks/useCrud.d.ts +117 -0
- package/dist/crud/primitives/ActionMenu.d.ts +28 -0
- package/dist/crud/primitives/FilterBar.d.ts +24 -0
- package/dist/crud/primitives/Pagination.d.ts +24 -0
- package/dist/crud/primitives/Table.d.ts +26 -0
- package/dist/crud/primitives/index.d.ts +11 -0
- package/dist/crud/primitives/types.d.ts +76 -0
- package/dist/crud/utils/routingHelpers.d.ts +30 -0
- package/dist/exports/crud.d.ts +21 -0
- package/dist/exports/integrations.d.ts +13 -0
- package/dist/exports/ui.d.ts +73 -0
- package/dist/hooks/useActiveModules.d.ts +45 -0
- package/dist/hooks/useColumnResize.d.ts +21 -0
- package/dist/hooks/useDebounce.d.ts +56 -0
- package/dist/hooks/useI18nFormatters.d.ts +40 -0
- package/dist/hooks/usePageTitle.d.ts +4 -0
- package/dist/hooks/usePermissionQuery.d.ts +49 -0
- package/dist/hooks/useRowResize.d.ts +19 -0
- package/dist/hooks/useSidebarResize.d.ts +19 -0
- package/dist/hooks/useWizard.d.ts +40 -0
- package/dist/i18n/DatabaseBackend.d.ts +9 -0
- package/dist/i18n/components/TranslationLoader.d.ts +10 -0
- package/dist/i18n/config.d.ts +2 -0
- package/dist/i18n/constants.d.ts +126 -0
- package/dist/i18n/index.d.ts +21 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/leadership/components/LeaderRow.d.ts +9 -0
- package/dist/leadership/components/LeadershipDialog.d.ts +10 -0
- package/dist/leadership/components/LeadershipForm.d.ts +8 -0
- package/dist/leadership/components/LeadershipPage.d.ts +1 -0
- package/dist/leadership/hooks/useLeadershipApi.d.ts +2 -0
- package/dist/leadership/hooks/useLeadershipMutations.d.ts +30 -0
- package/dist/leadership/index.d.ts +14 -0
- package/dist/leadership/types.d.ts +17 -0
- package/dist/leadership/utils/leadershipUtils.d.ts +8 -0
- package/dist/media/components/ImageEditor.d.ts +22 -0
- package/dist/media/components/ImageRenderer.d.ts +23 -0
- package/dist/media/components/VideoEditor.d.ts +22 -0
- package/dist/media/components/VideoRenderer.d.ts +8 -0
- package/dist/media/hooks/useMediaUpload.d.ts +20 -0
- package/dist/media/index.d.ts +49 -0
- package/dist/media/types.d.ts +66 -0
- package/dist/media/utils/imageHelpers.d.ts +28 -0
- package/dist/media/utils/videoHelpers.d.ts +35 -0
- package/dist/places/components/ManageAccessModal.d.ts +11 -0
- package/dist/places/components/PlaceCard.d.ts +12 -0
- package/dist/places/components/PlacesList.d.ts +12 -0
- package/dist/places/index.d.ts +8 -0
- package/dist/places/services/PlaceService.d.ts +9 -0
- package/dist/places/types.d.ts +10 -0
- package/dist/providers/CoreProviders.d.ts +66 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/qualiex/components/QualiexUserField.d.ts +125 -0
- package/dist/qualiex/hooks/useQualiexUsers.d.ts +51 -0
- package/dist/qualiex/services/qualiexApi.d.ts +21 -0
- package/dist/qualiex/utils/QualiexErrorInterceptor.d.ts +15 -0
- package/dist/qualiex/utils/userPlaceUtils.d.ts +16 -0
- package/dist/services/BaseService.d.ts +51 -0
- package/dist/services/EmailService.d.ts +110 -0
- package/dist/services/ErrorService.d.ts +19 -0
- package/dist/services/QualiexEnrichmentService.d.ts +65 -0
- package/dist/services/QualiexFieldHelpers.d.ts +17 -0
- package/dist/services/TranslationService.d.ts +20 -0
- package/dist/setup.d.ts +14 -0
- package/dist/sign/components/D4SignWidget.d.ts +2 -0
- package/dist/sign/components/DocumentSigner.d.ts +2 -0
- package/dist/sign/components/SignConfigForm.d.ts +2 -0
- package/dist/sign/components/SignWidget.d.ts +21 -0
- package/dist/sign/hooks/useSignConfig.d.ts +6 -0
- package/dist/sign/index.d.ts +7 -0
- package/dist/sign/services/signService.d.ts +23 -0
- package/dist/sign/types.d.ts +53 -0
- package/dist/supabase/SupabaseSingleton.d.ts +3 -0
- package/dist/supabase/client.d.ts +2 -0
- package/dist/supabase/publicClient.d.ts +2 -0
- package/dist/supabase/types.d.ts +377 -0
- package/dist/types/sidebar.d.ts +49 -0
- package/dist/types.d.ts +499 -0
- package/dist/utils/formatters/currencyFormatters.d.ts +1 -0
- package/dist/utils/formatters/dateFormatters.d.ts +52 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/linkHelpers.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Company } from '../../types';
|
|
3
|
+
interface UserInfoProps {
|
|
4
|
+
variant?: 'card' | 'dropdown';
|
|
5
|
+
className?: string;
|
|
6
|
+
selectedUnit?: Company | null;
|
|
7
|
+
onUnitChange?: (unit: Company) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const UserInfo: React.FC<UserInfoProps>;
|
|
10
|
+
export default UserInfo;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AuthState, Company } from '../../types';
|
|
3
|
+
interface AuthContextType extends AuthState {
|
|
4
|
+
logout: () => void;
|
|
5
|
+
processCallback: () => Promise<boolean>;
|
|
6
|
+
switchUnit: (company: Company) => Promise<void>;
|
|
7
|
+
availableUnits: Company[];
|
|
8
|
+
isSearchVisible: boolean;
|
|
9
|
+
setSearchVisible: (visible: boolean) => void;
|
|
10
|
+
clearSearch: () => void;
|
|
11
|
+
refreshData: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const AuthProvider: React.FC<{
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Hook para acessar informações de autenticação e gerenciar sessão
|
|
18
|
+
*
|
|
19
|
+
* Fornece dados do usuário autenticado, empresa/unidade selecionada,
|
|
20
|
+
* e funções para logout e troca de unidade.
|
|
21
|
+
*
|
|
22
|
+
* **DEVE SER USADO DENTRO DE `<AuthProvider>`**
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { useAuth } from 'forlogic-core';
|
|
27
|
+
*
|
|
28
|
+
* function MyComponent() {
|
|
29
|
+
* const {
|
|
30
|
+
* user, // Dados do usuário logado
|
|
31
|
+
* alias, // Alias da empresa/unidade ativa
|
|
32
|
+
* companies, // Lista de empresas disponíveis
|
|
33
|
+
* isAuthenticated, // true se está logado
|
|
34
|
+
* isLoading, // true durante inicialização
|
|
35
|
+
* logout, // Função para fazer logout
|
|
36
|
+
* switchUnit // Função para trocar de unidade
|
|
37
|
+
* } = useAuth();
|
|
38
|
+
*
|
|
39
|
+
* if (isLoading) return <div>Carregando...</div>;
|
|
40
|
+
* if (!isAuthenticated) return <div>Não autenticado</div>;
|
|
41
|
+
*
|
|
42
|
+
* return (
|
|
43
|
+
* <div>
|
|
44
|
+
* <p>Olá, {user?.name}</p>
|
|
45
|
+
* <p>Empresa: {alias}</p>
|
|
46
|
+
* <button onClick={logout}>Sair</button>
|
|
47
|
+
* </div>
|
|
48
|
+
* );
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* // Trocar de unidade/empresa
|
|
55
|
+
* function UnitSelector() {
|
|
56
|
+
* const { companies, alias, switchUnit } = useAuth();
|
|
57
|
+
*
|
|
58
|
+
* const handleSwitch = async (company: Company) => {
|
|
59
|
+
* await switchUnit(company);
|
|
60
|
+
* // Cache será limpo automaticamente
|
|
61
|
+
* // Todas as queries serão recarregadas com novo alias
|
|
62
|
+
* };
|
|
63
|
+
*
|
|
64
|
+
* return (
|
|
65
|
+
* <select value={alias} onChange={(e) => {
|
|
66
|
+
* const company = companies.find(c => c.alias === e.target.value);
|
|
67
|
+
* if (company) handleSwitch(company);
|
|
68
|
+
* }}>
|
|
69
|
+
* {companies.map(c => (
|
|
70
|
+
* <option key={c.id} value={c.alias}>{c.name}</option>
|
|
71
|
+
* ))}
|
|
72
|
+
* </select>
|
|
73
|
+
* );
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @returns Contexto de autenticação completo com user, companies, alias, etc
|
|
78
|
+
*
|
|
79
|
+
* @throws {Error} Se usado fora do AuthProvider
|
|
80
|
+
*
|
|
81
|
+
* @see {@link AuthProvider} - Provider que deve envolver a aplicação
|
|
82
|
+
*/
|
|
83
|
+
export declare const useAuth: () => AuthContextType;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CallbackPage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AuthState } from '../../types';
|
|
2
|
+
export declare class AuthService {
|
|
3
|
+
/**
|
|
4
|
+
* Inicializa o estado de autenticação verificando apenas tokens armazenados
|
|
5
|
+
* Tokens da URL devem ser processados exclusivamente na CallbackPage
|
|
6
|
+
*/
|
|
7
|
+
static initialize(): Promise<AuthState>;
|
|
8
|
+
/**
|
|
9
|
+
* Login para ambiente de desenvolvimento - redireciona para callback com tokens
|
|
10
|
+
*/
|
|
11
|
+
static loginDev(): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* Login para ambiente de produção (OAuth)
|
|
14
|
+
*/
|
|
15
|
+
static loginProd(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Processa o callback do OAuth (simplificado)
|
|
18
|
+
*/
|
|
19
|
+
static processCallback(): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Logout do usuário
|
|
22
|
+
*/
|
|
23
|
+
static logout(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Decodifica um token JWT usando TokenService robusto
|
|
26
|
+
*/
|
|
27
|
+
private static decodeToken;
|
|
28
|
+
/**
|
|
29
|
+
* Extrai informações do usuário do ID token
|
|
30
|
+
*/
|
|
31
|
+
private static extractUserFromIdToken;
|
|
32
|
+
/**
|
|
33
|
+
* Extrai empresas do ID token com companyId incluído
|
|
34
|
+
*/
|
|
35
|
+
private static extractCompaniesFromIdToken;
|
|
36
|
+
/**
|
|
37
|
+
* Extrai alias do access token (campo default)
|
|
38
|
+
*/
|
|
39
|
+
private static extractAliasFromAccessToken;
|
|
40
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare const TokenManager: {
|
|
2
|
+
setAccessToken: (token: string) => void;
|
|
3
|
+
getAccessToken: () => string;
|
|
4
|
+
setIdToken: (token: string) => void;
|
|
5
|
+
getIdToken: () => string;
|
|
6
|
+
getSupabaseToken: () => string;
|
|
7
|
+
setOAuthState: (state: string) => void;
|
|
8
|
+
getOAuthState: () => string;
|
|
9
|
+
clearOAuthState: () => void;
|
|
10
|
+
setOAuthNonce: (nonce: string) => void;
|
|
11
|
+
getOAuthNonce: () => string;
|
|
12
|
+
clearOAuthNonce: () => void;
|
|
13
|
+
setSelectedAlias: (alias: string) => void;
|
|
14
|
+
getSelectedAlias: () => string;
|
|
15
|
+
clearSelectedAlias: () => void;
|
|
16
|
+
generateOAuthState: () => string;
|
|
17
|
+
generateOAuthNonce: () => string;
|
|
18
|
+
hasAllTokens: () => boolean;
|
|
19
|
+
setSupabaseToken: (token: string) => void;
|
|
20
|
+
areAllTokensValid: () => boolean;
|
|
21
|
+
clearExpiredTokens: () => boolean;
|
|
22
|
+
clearAll: () => void;
|
|
23
|
+
setManualLogout: () => void;
|
|
24
|
+
isManualLogout: () => boolean;
|
|
25
|
+
clearManualLogout: () => void;
|
|
26
|
+
isTokenExpired: (token: string) => boolean;
|
|
27
|
+
_validationCache: {
|
|
28
|
+
isValid: boolean;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
cacheValidityMs: number;
|
|
31
|
+
};
|
|
32
|
+
_clearValidationCache: () => void;
|
|
33
|
+
isSupabaseTokenValid: () => boolean;
|
|
34
|
+
getValidSupabaseToken: () => string | null;
|
|
35
|
+
_handleExpiredToken: () => void;
|
|
36
|
+
extractTokenData: () => {
|
|
37
|
+
alias: any;
|
|
38
|
+
companyId: any;
|
|
39
|
+
placeId: any;
|
|
40
|
+
placeName: any;
|
|
41
|
+
payload: import("./TokenService").JwtPayload;
|
|
42
|
+
};
|
|
43
|
+
getCompanyId: (alias?: string) => string | null;
|
|
44
|
+
getCurrentCompanyId: () => string | null;
|
|
45
|
+
getAllCompaniesData: () => {
|
|
46
|
+
id: string;
|
|
47
|
+
alias: string;
|
|
48
|
+
name: string;
|
|
49
|
+
payload: any;
|
|
50
|
+
}[];
|
|
51
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class TokenRegenerationService {
|
|
2
|
+
private static isRegenerating;
|
|
3
|
+
private static onLogoutCallback;
|
|
4
|
+
/**
|
|
5
|
+
* Registra callback para ser chamado em caso de falha de autenticação
|
|
6
|
+
*/
|
|
7
|
+
static setLogoutCallback(callback: () => void): void;
|
|
8
|
+
/**
|
|
9
|
+
* Tenta regenerar o token Supabase se os tokens Qualiex são válidos
|
|
10
|
+
*/
|
|
11
|
+
static attemptRegeneration(): Promise<string | null>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface JwtPayload {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
exp?: number;
|
|
4
|
+
iat?: number;
|
|
5
|
+
sub?: string;
|
|
6
|
+
iss?: string;
|
|
7
|
+
}
|
|
8
|
+
interface TokenValidationResult {
|
|
9
|
+
isValid: boolean;
|
|
10
|
+
idTokenValid: boolean;
|
|
11
|
+
accessTokenValid: boolean;
|
|
12
|
+
warnings: string[];
|
|
13
|
+
errors: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare class TokenService {
|
|
16
|
+
private static readonly LARGE_PAYLOAD_THRESHOLD;
|
|
17
|
+
/**
|
|
18
|
+
* Converte base64url para base64 padrão
|
|
19
|
+
* Resolve problema com tokens JWT que usam base64url encoding
|
|
20
|
+
*/
|
|
21
|
+
private static normalizeBase64Url;
|
|
22
|
+
/**
|
|
23
|
+
* Parse JWT payload com suporte completo a base64url e múltiplas estratégias
|
|
24
|
+
* Implementa 3 estratégias de fallback para tokens grandes/problemáticos
|
|
25
|
+
*/
|
|
26
|
+
static parseJwtPayload(token: string): JwtPayload | null;
|
|
27
|
+
/**
|
|
28
|
+
* Validação de tokens com diferenciação ID vs Access
|
|
29
|
+
* ID token é CRÍTICO - deve ser válido ou bloqueia login
|
|
30
|
+
* Access token é OPCIONAL - apenas warning se falhar
|
|
31
|
+
*/
|
|
32
|
+
static validateTokens(accessToken: string, idToken: string): TokenValidationResult;
|
|
33
|
+
/**
|
|
34
|
+
* Verifica se um token está expirado usando validação robusta
|
|
35
|
+
*/
|
|
36
|
+
static isTokenExpired(token: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Extrai dados do token de forma segura
|
|
39
|
+
*/
|
|
40
|
+
static extractTokenData(token: string): JwtPayload | null;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class AuthErrorInterceptor {
|
|
2
|
+
/**
|
|
3
|
+
* Intercepts and handles authentication-related errors
|
|
4
|
+
* Returns true if error was handled and should not bubble up
|
|
5
|
+
*/
|
|
6
|
+
static handleError(error: any): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Determines if an error is authentication-related
|
|
9
|
+
*/
|
|
10
|
+
private static isAuthenticationError;
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a promise to automatically handle authentication errors
|
|
13
|
+
*/
|
|
14
|
+
static wrapAsync<T>(promise: Promise<T>): Promise<T>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { Component, ReactNode } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
fallback?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
interface State {
|
|
7
|
+
hasError: boolean;
|
|
8
|
+
error?: Error;
|
|
9
|
+
errorInfo?: React.ErrorInfo;
|
|
10
|
+
showDetails: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class ErrorBoundary extends Component<Props, State> {
|
|
13
|
+
constructor(props: Props);
|
|
14
|
+
static getDerivedStateFromError(error: Error): Partial<State>;
|
|
15
|
+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
16
|
+
copyErrorDetails: () => void;
|
|
17
|
+
render(): string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
export default ErrorBoundary;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* AppHeader Component
|
|
4
|
+
*
|
|
5
|
+
* Header principal da aplicação com:
|
|
6
|
+
* - Título e subtítulo da página
|
|
7
|
+
* - Busca global integrada ao CRUD
|
|
8
|
+
* - Botão de refresh
|
|
9
|
+
* - Informações do usuário e seleção de unidade
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <AppHeader actions={<Button>Nova Ação</Button>} />
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* ## 🔍 Busca Global
|
|
17
|
+
*
|
|
18
|
+
* A busca é exibida automaticamente quando `isSearchVisible = true` no AuthContext.
|
|
19
|
+
*
|
|
20
|
+
* **Características:**
|
|
21
|
+
* - ⏱️ Debounce de 500ms (configurável via SEARCH_CONFIG.debounceDelay)
|
|
22
|
+
* - 🔗 Sincroniza com URL (?search=termo)
|
|
23
|
+
* - ♻️ Reset automático para página 1 ao buscar
|
|
24
|
+
* - 🎯 Integração automática com useCrud
|
|
25
|
+
*
|
|
26
|
+
* **Configurar campos pesquisáveis:**
|
|
27
|
+
* ```typescript
|
|
28
|
+
* // No service
|
|
29
|
+
* createSimpleService({
|
|
30
|
+
* tableName: 'items',
|
|
31
|
+
* searchFields: ['name', 'description', 'code'], // 🔍 Campos de busca
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* **Customizar placeholder:**
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Opção 1: Modificar diretamente no AppHeader (linha ~102)
|
|
38
|
+
* <Input placeholder="Buscar artigos..." />
|
|
39
|
+
*
|
|
40
|
+
* // Opção 2: Por rota (já implementado)
|
|
41
|
+
* location.pathname === '/wiki' ? "Buscar artigos..." : "Buscar..."
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* **Controle programático:**
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const [searchParams, setSearchParams] = useSearchParams();
|
|
47
|
+
*
|
|
48
|
+
* // Definir busca
|
|
49
|
+
* const newParams = new URLSearchParams(searchParams);
|
|
50
|
+
* newParams.set('search', 'termo');
|
|
51
|
+
* newParams.set('page', '1');
|
|
52
|
+
* setSearchParams(newParams);
|
|
53
|
+
*
|
|
54
|
+
* // Limpar busca
|
|
55
|
+
* newParams.delete('search');
|
|
56
|
+
* setSearchParams(newParams);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
interface AppHeaderProps {
|
|
60
|
+
actions?: React.ReactNode;
|
|
61
|
+
}
|
|
62
|
+
declare const AppHeader: React.NamedExoticComponent<AppHeaderProps>;
|
|
63
|
+
export default AppHeader;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SidebarConfig } from '../../types/sidebar';
|
|
3
|
+
interface AppLayoutProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
sidebar?: ReactNode;
|
|
6
|
+
sidebarConfig?: SidebarConfig;
|
|
7
|
+
showHeader?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const AppLayout: import("react").NamedExoticComponent<AppLayoutProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SidebarConfig } from '../../types/sidebar';
|
|
2
|
+
interface AppSidebarProps {
|
|
3
|
+
config?: SidebarConfig;
|
|
4
|
+
customContent?: React.ReactNode;
|
|
5
|
+
resizable?: boolean;
|
|
6
|
+
minWidth?: number;
|
|
7
|
+
maxWidth?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function AppSidebar({ config, customContent, resizable, minWidth, maxWidth }?: AppSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default AppSidebar;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface BreadcrumbItemConfig {
|
|
3
|
+
/** Texto do item */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Link de navegação (não incluir para página atual) */
|
|
6
|
+
href?: string;
|
|
7
|
+
/** Componente customizado para o link (ex: Link do React Router) */
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
/** Elemento filho quando asChild é true */
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export interface BodyContentProps {
|
|
13
|
+
/** Itens do breadcrumb */
|
|
14
|
+
breadcrumbs?: BreadcrumbItemConfig[];
|
|
15
|
+
/** Conteúdo principal */
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
/** Classes CSS adicionais para o container externo */
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ContentContainerProps {
|
|
21
|
+
/** Título do container (opcional) */
|
|
22
|
+
title?: string;
|
|
23
|
+
/** Subtítulo do container (opcional) */
|
|
24
|
+
subtitle?: string;
|
|
25
|
+
/** Conteúdo do container */
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
/** Classes CSS adicionais */
|
|
28
|
+
className?: string;
|
|
29
|
+
/** Se o container tem header com título/subtítulo separado do conteúdo */
|
|
30
|
+
hasHeader?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Container de conteúdo branco com título e subtítulo opcionais.
|
|
34
|
+
* Pode ser usado múltiplas vezes dentro do BodyContent.
|
|
35
|
+
*/
|
|
36
|
+
export declare function ContentContainer({ title, subtitle, children, className, hasHeader, }: ContentContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* BodyContent - Container principal de página
|
|
39
|
+
*
|
|
40
|
+
* Componente de layout que encapsula o conteúdo da página com:
|
|
41
|
+
* - Background na cor Escala Neutra 100 (#F5F5F5)
|
|
42
|
+
* - Breadcrumb no topo
|
|
43
|
+
* - Suporte a múltiplos ContentContainers
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <BodyContent
|
|
48
|
+
* breadcrumbs={[
|
|
49
|
+
* { label: 'Módulo', href: '/modulo' },
|
|
50
|
+
* { label: 'Seção 1', href: '/modulo/secao1' },
|
|
51
|
+
* { label: 'Seção 2' }, // Página atual (sem href)
|
|
52
|
+
* ]}
|
|
53
|
+
* >
|
|
54
|
+
* <ContentContainer title="Título" subtitle="Subtítulo">
|
|
55
|
+
* Conteúdo aqui
|
|
56
|
+
* </ContentContainer>
|
|
57
|
+
* </BodyContent>
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function BodyContent({ breadcrumbs, children, className, }: BodyContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SidebarActionsConfig } from '../../types/sidebar';
|
|
2
|
+
export interface SidebarActionTriggerProps {
|
|
3
|
+
/** Configuração das ações do módulo */
|
|
4
|
+
config: SidebarActionsConfig;
|
|
5
|
+
/** Se a sidebar está colapsada (modo ícone) */
|
|
6
|
+
isCollapsed?: boolean;
|
|
7
|
+
/** Desabilita o gatilho (ex: quando há modais abertos) */
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
/** Classes adicionais */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* SidebarActionTrigger - Gatilho de ações principais do módulo
|
|
14
|
+
*
|
|
15
|
+
* Exibe um botão de ação destacado no topo do sidebar.
|
|
16
|
+
* - Uma ação: executa diretamente ao clicar
|
|
17
|
+
* - Múltiplas ações: exibe dropdown com opções
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <SidebarActionTrigger
|
|
22
|
+
* config={{
|
|
23
|
+
* triggerLabel: 'Criar',
|
|
24
|
+
* actions: [
|
|
25
|
+
* { id: 'new-item', label: 'Novo Item', onClick: () => openDialog() }
|
|
26
|
+
* ]
|
|
27
|
+
* }}
|
|
28
|
+
* isCollapsed={!open}
|
|
29
|
+
* isDisabled={hasOpenModal}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function SidebarActionTrigger({ config, isCollapsed, isDisabled, className, }: SidebarActionTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export default SidebarActionTrigger;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const SIDEBAR_PINNED_KEY = "forlogic-sidebar-pinned";
|
|
2
|
+
export declare const getSidebarPinnedPreference: () => boolean;
|
|
3
|
+
export declare const setSidebarPinnedPreference: (isPinned: boolean) => void;
|
|
4
|
+
export declare const getColorVariant: (index: number) => string;
|
|
5
|
+
interface Module {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
status: 'active' | 'inactive';
|
|
10
|
+
}
|
|
11
|
+
export declare const handleModuleClick: (modules: Module[] | undefined, moduleUrl: string) => void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Module } from "./types";
|
|
2
|
+
interface ModuleGridProps {
|
|
3
|
+
modules: Module[];
|
|
4
|
+
onModuleClick?: (module: Module) => void;
|
|
5
|
+
contractedModules?: string[];
|
|
6
|
+
onModuleInterest?: (module: Module) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ModuleGrid({ modules, onModuleClick, contractedModules, onModuleInterest, }: ModuleGridProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ModulesDialogProps } from "./types";
|
|
2
|
+
export declare function ModulesDialog({ open, onOpenChange, onModuleClick, contractedModules, onModuleInterest, educaUrl, saberGestaoUrl, wikiUrl, }: ModulesDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default ModulesDialog;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface IconProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Ícone outline do Qualiex para marca d'água
|
|
6
|
+
* Usado no card "Aprenda a usar o Qualiex"
|
|
7
|
+
*/
|
|
8
|
+
export declare function QualiexOutlineIcon({ className }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
/**
|
|
10
|
+
* Ícone outline do Saber Gestão para marca d'água
|
|
11
|
+
* Usado no card "Conheça o Saber Gestão"
|
|
12
|
+
*/
|
|
13
|
+
export declare function SaberGestaoOutlineIcon({ className }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* Ícone de livro/wiki para marca d'água
|
|
16
|
+
* Usado no card "Dúvidas sobre os módulos?"
|
|
17
|
+
*/
|
|
18
|
+
export declare function WikiOutlineIcon({ className }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OnboardingStep } from "../ui/onboarding-dialog";
|
|
3
|
+
export interface Module {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
color: string;
|
|
7
|
+
icon?: React.ComponentType<{
|
|
8
|
+
className?: string;
|
|
9
|
+
}>;
|
|
10
|
+
url?: string;
|
|
11
|
+
/** Steps do onboarding para módulos não contratados */
|
|
12
|
+
onboardingSteps?: OnboardingStep[];
|
|
13
|
+
}
|
|
14
|
+
export interface ModuleGroup {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
modules: Module[];
|
|
18
|
+
}
|
|
19
|
+
export interface ModulesDialogProps {
|
|
20
|
+
open: boolean;
|
|
21
|
+
onOpenChange: (open: boolean) => void;
|
|
22
|
+
onModuleClick?: (module: Module) => void;
|
|
23
|
+
/** Lista de nomes de módulos contratados. Se não fornecido, todos aparecem como contratados. */
|
|
24
|
+
contractedModules?: string[];
|
|
25
|
+
/** Callback quando usuário mostra interesse em módulo não contratado (após onboarding) */
|
|
26
|
+
onModuleInterest?: (module: Module) => void;
|
|
27
|
+
/** URL do Forlogic Educa */
|
|
28
|
+
educaUrl?: string;
|
|
29
|
+
/** URL do Saber Gestão */
|
|
30
|
+
saberGestaoUrl?: string;
|
|
31
|
+
/** @deprecated Use educaUrl. URL da wiki (mantido para compatibilidade) */
|
|
32
|
+
wikiUrl?: string;
|
|
33
|
+
/** @deprecated Não mais utilizado no novo layout */
|
|
34
|
+
allModulesUrl?: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
3
|
+
declare const Accordion: React.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ButtonProps } from './button';
|
|
3
|
+
interface ActionButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
variant?: ButtonProps['variant'];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Botão estilizado para ações em tabelas e menus
|
|
9
|
+
*
|
|
10
|
+
* Botão pequeno otimizado para actions em linhas de tabela, com estilo
|
|
11
|
+
* consistente usando cores do tema (primary).
|
|
12
|
+
*
|
|
13
|
+
* **Características:**
|
|
14
|
+
* - Tamanho compacto (height: 28px, padding: 8px)
|
|
15
|
+
* - Ícone padrão: três pontos verticais (EllipsisVertical)
|
|
16
|
+
* - Estilo padrão: fundo azul claro (bg-primary/10), hover com primary/20
|
|
17
|
+
* - Variante action-secondary disponível para contextos secundários
|
|
18
|
+
* - Perfeito para menus de ação em linhas de tabela
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { ActionButton } from 'forlogic-core';
|
|
23
|
+
*
|
|
24
|
+
* // Botão de ações com ícone padrão (três pontos)
|
|
25
|
+
* <ActionButton onClick={() => setMenuOpen(true)} />
|
|
26
|
+
*
|
|
27
|
+
* // Botão customizado com ícone próprio
|
|
28
|
+
* <ActionButton>
|
|
29
|
+
* <Edit size={12} />
|
|
30
|
+
* </ActionButton>
|
|
31
|
+
*
|
|
32
|
+
* // Variante secundária
|
|
33
|
+
* <ActionButton variant="action-secondary">
|
|
34
|
+
* <LayoutGrid size={12} />
|
|
35
|
+
* </ActionButton>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @param props.children Conteúdo customizado (default: ícone de três pontos)
|
|
39
|
+
* @param props.variant Variante do botão (default: "action")
|
|
40
|
+
* @param props.className Classes CSS adicionais
|
|
41
|
+
*/
|
|
42
|
+
export declare const ActionButton: React.ForwardRefExoticComponent<ActionButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
43
|
+
export {};
|