forlogic-core 2.1.5 → 2.2.1

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.
Files changed (196) hide show
  1. package/README.md +53 -1
  2. package/dist/action-plans/components/ActionPlanAttachmentsTab.d.ts +3 -0
  3. package/dist/action-plans/components/ActionPlanCommentsTab.d.ts +3 -0
  4. package/dist/action-plans/components/ActionPlanCostTab.d.ts +5 -0
  5. package/dist/action-plans/components/ActionPlanGeneralTab.d.ts +3 -0
  6. package/dist/action-plans/components/ActionPlanHistoryTab.d.ts +3 -0
  7. package/dist/action-plans/components/ActionPlanPredecessorsTab.d.ts +5 -0
  8. package/dist/action-plans/components/ActionPlanProgressDialog.d.ts +3 -0
  9. package/dist/action-plans/components/ActionPlanProgressTab.d.ts +5 -0
  10. package/dist/action-plans/components/ActionPlanStatusBadge.d.ts +3 -0
  11. package/dist/action-plans/constants.d.ts +24 -0
  12. package/dist/action-plans/hooks/useActionPlan.d.ts +5 -0
  13. package/dist/action-plans/hooks/useActionPlanProgress.d.ts +5 -0
  14. package/dist/action-plans/types.d.ts +60 -0
  15. package/dist/action-plans/utils/formatTime.d.ts +9 -0
  16. package/dist/audit-trail/components/AuditTrailDetails.d.ts +10 -0
  17. package/dist/audit-trail/components/AuditTrailFilter.d.ts +10 -0
  18. package/dist/audit-trail/components/AuditTrailPage.d.ts +10 -0
  19. package/dist/audit-trail/types.d.ts +58 -0
  20. package/dist/audit-trail/utils.d.ts +18 -2
  21. package/dist/auth/components/EditProfileDialog.d.ts +1 -0
  22. package/dist/auth/components/ProtectedRoute.d.ts +5 -0
  23. package/dist/auth/contexts/AuthContext.d.ts +5 -0
  24. package/dist/auth/pages/CallbackPage.d.ts +5 -0
  25. package/dist/auth/services/AuthService.d.ts +5 -0
  26. package/dist/auth/services/TokenManager.d.ts +5 -0
  27. package/dist/auth/services/TokenService.d.ts +10 -0
  28. package/dist/auth/utils/ErrorInterceptor.d.ts +5 -0
  29. package/dist/components/dashboards/dashboard-form.d.ts +15 -0
  30. package/dist/components/dashboards/dashboard-general-view.d.ts +15 -0
  31. package/dist/components/dashboards/dashboard-grid.d.ts +25 -0
  32. package/dist/components/dashboards/dashboard-list.d.ts +10 -0
  33. package/dist/components/dashboards/dashboard-panel-renderer.d.ts +10 -0
  34. package/dist/components/dashboards/dashboard-view.d.ts +10 -0
  35. package/dist/components/dashboards/helpers.d.ts +44 -5
  36. package/dist/components/dashboards/panels/burndown-panel.d.ts +15 -0
  37. package/dist/components/dashboards/panels/cartesian-panel.d.ts +20 -0
  38. package/dist/components/dashboards/panels/list-panel.d.ts +15 -0
  39. package/dist/components/dashboards/panels/matrix-risk-panel.d.ts +25 -0
  40. package/dist/components/dashboards/panels/numeric-panel.d.ts +10 -0
  41. package/dist/components/dashboards/panels/panel-error.d.ts +10 -0
  42. package/dist/components/dashboards/panels/panel-header.d.ts +10 -0
  43. package/dist/components/dashboards/panels/panel-loader.d.ts +10 -0
  44. package/dist/components/dashboards/panels/panel-no-data.d.ts +10 -0
  45. package/dist/components/dashboards/panels/panel-unavailable.d.ts +10 -0
  46. package/dist/components/dashboards/panels/pareto-panel.d.ts +10 -0
  47. package/dist/components/dashboards/panels/performance-panel.d.ts +15 -0
  48. package/dist/components/dashboards/panels/pie-panel.d.ts +10 -0
  49. package/dist/components/dashboards/panels/text-panel.d.ts +10 -0
  50. package/dist/components/dashboards/types.d.ts +230 -0
  51. package/dist/components/modules/AccessDeniedDialog.d.ts +3 -1
  52. package/dist/components/modules/ModuleAccessGuard.d.ts +3 -1
  53. package/dist/components/modules/ModulesContent.d.ts +3 -1
  54. package/dist/components/modules/ModulesDialog.d.ts +1 -1
  55. package/dist/components/modules/ModulesFooterCards.d.ts +3 -1
  56. package/dist/components/modules/types.d.ts +2 -0
  57. package/dist/components/ui/accordion.d.ts +35 -0
  58. package/dist/components/ui/action-button.d.ts +5 -0
  59. package/dist/components/ui/alert-dialog.d.ts +82 -0
  60. package/dist/components/ui/alert.d.ts +32 -0
  61. package/dist/components/ui/avatar.d.ts +30 -0
  62. package/dist/components/ui/badge.d.ts +32 -0
  63. package/dist/components/ui/breadcrumb.d.ts +54 -0
  64. package/dist/components/ui/button-group.d.ts +15 -0
  65. package/dist/components/ui/button.d.ts +55 -0
  66. package/dist/components/ui/calendar.d.ts +16 -0
  67. package/dist/components/ui/card.d.ts +49 -0
  68. package/dist/components/ui/chart.d.ts +35 -0
  69. package/dist/components/ui/checkbox.d.ts +11 -0
  70. package/dist/components/ui/collapsible.d.ts +15 -0
  71. package/dist/components/ui/color-picker.d.ts +5 -0
  72. package/dist/components/ui/combo-tree.d.ts +23 -0
  73. package/dist/components/ui/combobox.d.ts +28 -0
  74. package/dist/components/ui/command.d.ts +66 -0
  75. package/dist/components/ui/context-menu.d.ts +95 -0
  76. package/dist/components/ui/date-picker.d.ts +10 -0
  77. package/dist/components/ui/dialog-wizard.d.ts +22 -4
  78. package/dist/components/ui/dialog.d.ts +181 -0
  79. package/dist/components/ui/drawer.d.ts +72 -0
  80. package/dist/components/ui/dropdown-menu.d.ts +153 -0
  81. package/dist/components/ui/electronic-signature-dialog.d.ts +10 -0
  82. package/dist/components/ui/export-dialog.d.ts +20 -0
  83. package/dist/components/ui/form.d.ts +96 -0
  84. package/dist/components/ui/hover-card.d.ts +15 -0
  85. package/dist/components/ui/icon-picker.d.ts +5 -0
  86. package/dist/components/ui/iframe-dialog.d.ts +10 -0
  87. package/dist/components/ui/input-group.d.ts +16 -0
  88. package/dist/components/ui/input.d.ts +5 -0
  89. package/dist/components/ui/menubar.d.ts +80 -0
  90. package/dist/components/ui/multiselect-permissions.d.ts +25 -0
  91. package/dist/components/ui/navigation-menu.d.ts +45 -0
  92. package/dist/components/ui/onboarding-dialog.d.ts +15 -0
  93. package/dist/components/ui/online-editor-dialog.d.ts +10 -0
  94. package/dist/components/ui/pagination.d.ts +53 -0
  95. package/dist/components/ui/popover.d.ts +8 -0
  96. package/dist/components/ui/radio-group.d.ts +3 -0
  97. package/dist/components/ui/report-request-list.d.ts +20 -0
  98. package/dist/components/ui/resizable.d.ts +15 -0
  99. package/dist/components/ui/rich-text-editor.d.ts +13 -0
  100. package/dist/components/ui/scroll-area.d.ts +3 -0
  101. package/dist/components/ui/select.d.ts +71 -0
  102. package/dist/components/ui/separator.d.ts +13 -0
  103. package/dist/components/ui/sheet.d.ts +76 -0
  104. package/dist/components/ui/sidebar.d.ts +203 -0
  105. package/dist/components/ui/skeleton-variants.d.ts +25 -0
  106. package/dist/components/ui/skeleton.d.ts +12 -0
  107. package/dist/components/ui/slider.d.ts +5 -0
  108. package/dist/components/ui/sonner.d.ts +5 -0
  109. package/dist/components/ui/spinner.d.ts +5 -0
  110. package/dist/components/ui/split-button.d.ts +6 -0
  111. package/dist/components/ui/stack.d.ts +5 -0
  112. package/dist/components/ui/status-badge.d.ts +3 -0
  113. package/dist/components/ui/step-selector.d.ts +5 -0
  114. package/dist/components/ui/stimulsoft-viewer.d.ts +8 -0
  115. package/dist/components/ui/switch.d.ts +21 -0
  116. package/dist/components/ui/tab-page-layout.d.ts +33 -0
  117. package/dist/components/ui/table-resize-handle.d.ts +10 -3
  118. package/dist/components/ui/table.d.ts +102 -0
  119. package/dist/components/ui/tabs.d.ts +59 -0
  120. package/dist/components/ui/terms-of-use-dialog.d.ts +50 -4
  121. package/dist/components/ui/textarea.d.ts +27 -0
  122. package/dist/components/ui/timepicker.d.ts +23 -0
  123. package/dist/components/ui/toggle-group.d.ts +25 -0
  124. package/dist/components/ui/toggle.d.ts +21 -0
  125. package/dist/components/ui/tooltip.d.ts +55 -1
  126. package/dist/components/ui/truncated-cell.d.ts +13 -0
  127. package/dist/components/ui/typography.d.ts +119 -0
  128. package/dist/components/ui/updates-notification.d.ts +33 -0
  129. package/dist/components/ui/users-groups-selector.d.ts +43 -0
  130. package/dist/components/ui/viewer-dialog.d.ts +107 -0
  131. package/dist/crud/components/ActionMenuItems.d.ts +5 -0
  132. package/dist/crud/components/BaseForm.d.ts +46 -0
  133. package/dist/crud/components/ColumnSettingsPopover.d.ts +10 -0
  134. package/dist/crud/components/CrudActionBar.d.ts +20 -0
  135. package/dist/crud/components/CrudGrid.d.ts +10 -0
  136. package/dist/crud/components/CrudPagination.d.ts +5 -0
  137. package/dist/crud/components/CrudTable.d.ts +5 -0
  138. package/dist/crud/components/TableRowActions.d.ts +5 -0
  139. package/dist/crud/createCrudPage.d.ts +41 -8
  140. package/dist/crud/generateCrudConfig.d.ts +13 -8
  141. package/dist/crud/hooks/useBaseForm.d.ts +39 -0
  142. package/dist/crud/hooks/useColumnManager.d.ts +25 -0
  143. package/dist/crud/hooks/useCrud.d.ts +35 -0
  144. package/dist/crud/primitives/ActionMenu.d.ts +41 -0
  145. package/dist/crud/primitives/FilterBar.d.ts +45 -0
  146. package/dist/crud/primitives/Pagination.d.ts +5 -0
  147. package/dist/crud/primitives/Table.d.ts +5 -0
  148. package/dist/crud/primitives/TreeTable.d.ts +5 -0
  149. package/dist/crud/primitives/types.d.ts +57 -0
  150. package/dist/crud/utils/routingHelpers.d.ts +11 -0
  151. package/dist/custom-form-fields/components/CustomFormFields.d.ts +3 -0
  152. package/dist/custom-form-fields/fields/FormDateField.d.ts +3 -0
  153. package/dist/custom-form-fields/fields/FormMultiSelectionField.d.ts +3 -0
  154. package/dist/custom-form-fields/fields/FormNumericField.d.ts +3 -0
  155. package/dist/custom-form-fields/fields/FormQuestionsField.d.ts +3 -0
  156. package/dist/custom-form-fields/fields/FormSingleSelectionField.d.ts +3 -0
  157. package/dist/custom-form-fields/fields/FormTextField.d.ts +3 -0
  158. package/dist/custom-form-fields/fields/FormTimeField.d.ts +3 -0
  159. package/dist/custom-form-fields/fields/FormUrlField.d.ts +3 -0
  160. package/dist/custom-form-fields/fields/ReadOnlyTextField.d.ts +3 -0
  161. package/dist/custom-form-fields/types.d.ts +84 -21
  162. package/dist/exports/integrations.d.ts +1 -0
  163. package/dist/file-upload/components/SingleFileUpload.d.ts +59 -0
  164. package/dist/file-upload/types.d.ts +15 -0
  165. package/dist/file-upload/utils/formatBytes.d.ts +5 -0
  166. package/dist/file-upload/utils/getFileExtension.d.ts +5 -0
  167. package/dist/hooks/useColumnResize.d.ts +24 -0
  168. package/dist/hooks/useRowResize.d.ts +18 -0
  169. package/dist/hooks/useSidebarResize.d.ts +18 -0
  170. package/dist/hooks/useUpdatesNotification.d.ts +16 -0
  171. package/dist/index.css +1 -1
  172. package/dist/index.css.map +1 -1
  173. package/dist/index.esm.js +1 -1
  174. package/dist/index.js +1 -1
  175. package/dist/integrations/clarity/clarityTracking.d.ts +31 -0
  176. package/dist/integrations/clarity/index.d.ts +3 -0
  177. package/dist/integrations/clarity/types.d.ts +46 -0
  178. package/dist/integrations/clarity/useClarity.d.ts +34 -0
  179. package/dist/integrations/index.d.ts +5 -0
  180. package/dist/providers/CoreProviders.d.ts +16 -1
  181. package/dist/qualiex/components/QualiexUserField.d.ts +8 -0
  182. package/dist/qualiex/hooks/useQualiexUsers.d.ts +16 -26
  183. package/dist/qualiex/services/qualiexApi.d.ts +38 -2
  184. package/dist/qualiex/utils/QualiexErrorInterceptor.d.ts +5 -0
  185. package/dist/supabase/SupabaseSingleton.d.ts +34 -0
  186. package/dist/types.d.ts +51 -2
  187. package/dist/vite/index.esm.js +4 -1
  188. package/dist/vite/index.js +4 -1
  189. package/docs/STORAGE_BUCKETS.md +384 -0
  190. package/docs/WORKSPACE_KNOWLEDGE.md +1 -0
  191. package/docs/design-system/README.md +1 -1
  192. package/docs/design-system/dialogs.md +2 -0
  193. package/docs/design-system/patterns/core-providers.md +2 -0
  194. package/docs/design-system/selectors.md +4 -0
  195. package/package.json +7 -1
  196. package/dist/components/ui/__tests__/status-badge.test.d.ts +0 -1
@@ -0,0 +1,31 @@
1
+ import type { Module } from '../../components/modules/types';
2
+ interface ModuleClickContext {
3
+ module: Module;
4
+ isContracted: boolean;
5
+ sourceModule?: string;
6
+ alias?: string;
7
+ }
8
+ /**
9
+ * Função utilitária `trackModuleClick`.
10
+ * @example
11
+ * trackModuleClick();
12
+ */
13
+ export declare function trackModuleClick({ module, isContracted, sourceModule, alias }: ModuleClickContext): void;
14
+ /**
15
+ * Função utilitária `trackInterestClick`.
16
+ * @example
17
+ * trackInterestClick();
18
+ */
19
+ export declare function trackInterestClick({ module, sourceModule, alias }: Omit<ModuleClickContext, 'isContracted'>): void;
20
+ interface FooterClickContext {
21
+ resource: 'educa' | 'saber-gestao' | 'wiki';
22
+ sourceModule?: string;
23
+ alias?: string;
24
+ }
25
+ /**
26
+ * Função utilitária `trackFooterClick`.
27
+ * @example
28
+ * trackFooterClick();
29
+ */
30
+ export declare function trackFooterClick({ resource, sourceModule, alias }: FooterClickContext): void;
31
+ export {};
@@ -0,0 +1,3 @@
1
+ export { useClarity } from './useClarity';
2
+ export { trackModuleClick, trackInterestClick, trackFooterClick } from './clarityTracking';
3
+ export type { ClarityMode, ClarityRuntimeMode, ModuleClickEventTags, FooterClickEventTags } from './types';
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Modos de operação do Clarity na forlogic-core.
3
+ * - `auto` (padrão): inicializa o Clarity Forlogic se nenhum outro estiver presente; caso contrário, "pega carona" no existente, prefixando eventos com `forlogic_*`.
4
+ * - `disabled`: nunca inicializa nem dispara eventos.
5
+ *
6
+ * @example
7
+ * const value: ClarityMode = {} as ClarityMode;
8
+ */
9
+ export type ClarityMode = 'auto' | 'disabled';
10
+ /** Estado interno de operação após detecção/inicialização *
11
+ * @example
12
+ * const value: ClarityRuntimeMode = {} as ClarityRuntimeMode;
13
+ */
14
+ export type ClarityRuntimeMode = 'owned' | 'piggyback' | 'inactive';
15
+ /**
16
+ * Tipo `ModuleClickEventTags` exportado pela lib.
17
+ * @example
18
+ * const value: ModuleClickEventTags = {} as ModuleClickEventTags;
19
+ */
20
+ export interface ModuleClickEventTags {
21
+ clicked_module: string;
22
+ clicked_module_id?: string;
23
+ is_contracted: string;
24
+ source_module?: string;
25
+ alias?: string;
26
+ }
27
+ /**
28
+ * Tipo `FooterClickEventTags` exportado pela lib.
29
+ * @example
30
+ * const value: FooterClickEventTags = {} as FooterClickEventTags;
31
+ */
32
+ export interface FooterClickEventTags {
33
+ footer_resource: 'educa' | 'saber-gestao' | 'wiki';
34
+ source_module?: string;
35
+ alias?: string;
36
+ }
37
+ declare global {
38
+ interface Window {
39
+ /** Função global instanciada pelo snippet do Clarity (qualquer projeto) */
40
+ clarity?: ((...args: unknown[]) => void) & Record<string, unknown>;
41
+ /** Sinaliza que a forlogic-core foi quem inicializou o Clarity */
42
+ __forlogicClarityOwned?: boolean;
43
+ /** Modo de operação detectado pela forlogic-core */
44
+ __forlogicClarityMode?: ClarityRuntimeMode;
45
+ }
46
+ }
@@ -0,0 +1,34 @@
1
+ import type { ClarityMode } from './types';
2
+ interface UseClarityOptions {
3
+ projectId?: string;
4
+ mode?: ClarityMode;
5
+ }
6
+ /**
7
+ * Hook que inicializa o Microsoft Clarity de forma idempotente e identifica o usuário autenticado.
8
+ *
9
+ * Comportamento:
10
+ * - Se `mode === 'disabled'`, não faz nada.
11
+ * - Em preview/local (shouldUseDevTokens), desabilitado.
12
+ * - Se já existir uma instância Clarity de outro projeto consumidor, entra em modo `piggyback`
13
+ * (não reinicializa, mas eventos disparados pela lib serão prefixados com `forlogic_*`).
14
+ * - Caso contrário, inicializa com o `projectId` informado (modo `owned`).
15
+ *
16
+ * Chame **uma única vez** no topo da árvore (App.tsx ou layout raiz) — internamente
17
+ * sincroniza com o `AuthContext` e re-identifica o usuário em cada login.
18
+ *
19
+ * @example
20
+ * // App.tsx — habilitado apenas em produção
21
+ * function App() {
22
+ * useClarity({
23
+ * projectId: import.meta.env.VITE_CLARITY_PROJECT_ID,
24
+ * mode: import.meta.env.PROD ? 'auto' : 'disabled',
25
+ * });
26
+ * return <CoreProviders>...</CoreProviders>;
27
+ * }
28
+ *
29
+ * @example
30
+ * // Desabilitar explicitamente (ex: ambiente sandbox de cliente)
31
+ * useClarity({ mode: 'disabled' });
32
+ */
33
+ export declare function useClarity({ projectId, mode }: UseClarityOptions): void;
34
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module integrations
3
+ * Integrações externas opcionais. Ver `./README.md`.
4
+ */
5
+ export * from './clarity';
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { QueryClient } from '@tanstack/react-query';
3
3
  import { ModuleAccessGuardProps } from '../components/modules';
4
+ import type { ClarityMode } from '../integrations/clarity/types';
4
5
  /**
5
6
  * Mapa de traduções por idioma para o namespace 'app' do projeto consumidor.
6
7
  *
@@ -54,6 +55,20 @@ export interface CoreProvidersProps {
54
55
  * ```
55
56
  */
56
57
  appTranslations?: AppTranslationsMap;
58
+ /**
59
+ * Project ID do Microsoft Clarity para instrumentação centralizada do menu de módulos.
60
+ * Quando informado, a lib inicializa o Clarity (modo `owned`) ou, se já existir uma
61
+ * instância no consumidor, entra em modo `piggyback` (eventos com prefixo `forlogic_*`).
62
+ *
63
+ * @example "wcqt61e4em"
64
+ */
65
+ clarityProjectId?: string;
66
+ /**
67
+ * Modo de operação do Clarity.
68
+ * - `auto` (padrão): comportamento descrito em `clarityProjectId`.
69
+ * - `disabled`: nunca inicializa nem dispara eventos.
70
+ */
71
+ clarityMode?: ClarityMode;
57
72
  }
58
73
  /**
59
74
  * CoreProviders - Encapsulates all essential providers for forlogic-core applications
@@ -76,4 +91,4 @@ export interface CoreProvidersProps {
76
91
  * }
77
92
  * ```
78
93
  */
79
- export declare function CoreProviders({ children, queryClient, moduleAlias, moduleAccessGuardProps, appTranslations }: CoreProvidersProps): import("react/jsx-runtime").JSX.Element;
94
+ export declare function CoreProviders({ children, queryClient, moduleAlias, moduleAccessGuardProps, appTranslations, clarityProjectId, clarityMode, }: CoreProvidersProps): import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,9 @@ import React from 'react';
2
2
  import { QualiexUser } from '../../types';
3
3
  /**
4
4
  * Formato de exibição do usuário no campo
5
+ *
6
+ * @example
7
+ * const value: QualiexUserDisplayFormat = {} as QualiexUserDisplayFormat;
5
8
  */
6
9
  export type QualiexUserDisplayFormat = 'name' | 'name-email' | 'name-role' | 'custom';
7
10
  /**
@@ -121,5 +124,10 @@ interface QualiexUserFieldProps {
121
124
  /** Callback ao fechar o popover */
122
125
  onClose?: () => void;
123
126
  }
127
+ /**
128
+ * Componente `QualiexUserField` da lib.
129
+ * @example
130
+ * <QualiexUserField />
131
+ */
124
132
  export declare const QualiexUserField: React.FC<QualiexUserFieldProps>;
125
133
  export {};
@@ -8,44 +8,34 @@ interface UseQualiexUsersOptions {
8
8
  * - `true`: Busca imediata e automática (padrão)
9
9
  * - `false`: Não busca (use com `refetch()` para lazy loading)
10
10
  * - Condicional: `enabled: isModalOpen` (busca só quando aberto)
11
- *
12
- * @example
13
- * // ✅ Uso padrão (busca automática)
14
- * useQualiexUsers()
15
- *
16
- * @example
17
- * // ✅ Modal condicional
18
- * useQualiexUsers({ enabled: isModalOpen })
19
- *
20
- * @example
21
- * // ✅ Lazy loading
22
- * const { refetch } = useQualiexUsers({ enabled: false });
23
- * await refetch(); // Chama quando necessário
24
11
  */
25
12
  enabled?: boolean;
13
+ /**
14
+ * Filtro de status:
15
+ * - `'active'` (default): Retorna apenas usuários ativos. Use para selectors/comboboxes.
16
+ * - `'all'`: Retorna ativos + inativos. Use para enrichment de IDs históricos.
17
+ *
18
+ * Cada status tem cache independente (queryKey separado).
19
+ */
20
+ status?: 'active' | 'all';
26
21
  }
27
22
  /**
28
23
  * Hook para buscar usuários da API Qualiex.
29
24
  *
30
- * Por padrão, a query executa automaticamente quando o hook é montado.
31
- *
32
- * @param options - Opções de configuração
33
- * @param options.enabled - Controla se a query executa (padrão: `true`)
34
- *
35
- * @returns Objeto com dados, loading, error e refetch
25
+ * Por padrão, a query executa automaticamente quando o hook é montado e retorna
26
+ * apenas usuários **ativos**. Para enrichment de registros históricos, use `status: 'all'`.
36
27
  *
37
28
  * @example
38
- * // ✅ Uso padrão - Busca automática
39
- * const { data: users, isLoading } = useQualiexUsers();
29
+ * // ✅ Selector ativos (padrão)
30
+ * const { data: users } = useQualiexUsers();
40
31
  *
41
32
  * @example
42
- * // ✅ Busca condicional (modal)
43
- * const { data: users } = useQualiexUsers({ enabled: isModalOpen });
33
+ * // ✅ Enrichment inclui inativos
34
+ * const { data: users } = useQualiexUsers({ status: 'all' });
44
35
  *
45
36
  * @example
46
- * // ✅ Lazy loading com controle manual
47
- * const { data: users, refetch } = useQualiexUsers({ enabled: false });
48
- * await refetch(); // Chamar quando necessário
37
+ * // ✅ Modal condicional
38
+ * const { data: users } = useQualiexUsers({ enabled: isModalOpen });
49
39
  */
50
40
  export declare const useQualiexUsers: (options?: UseQualiexUsersOptions) => import("@tanstack/react-query").UseQueryResult<QualiexUser[], Error>;
51
41
  export {};
@@ -13,10 +13,21 @@ declare class QualiexApiService {
13
13
  * Retorna null se o formato for inválido.
14
14
  */
15
15
  private parseUsersResponse;
16
- fetchUsers(alias: string, companyId: string): Promise<QualiexUser[]>;
16
+ /**
17
+ * Busca usuários do Qualiex.
18
+ *
19
+ * @param status - `'active'` (default) retorna apenas usuários ativos.
20
+ * `'all'` retorna ativos e inativos — use para enrichment de IDs históricos.
21
+ */
22
+ fetchUsers(alias: string, companyId: string, status?: 'active' | 'all'): Promise<QualiexUser[]>;
17
23
  fetchUserById(userId: string, alias: string, companyId: string): Promise<QualiexUser | null>;
18
24
  fetchActiveUsersMap(alias: string, companyId: string): Promise<Map<string, QualiexUser>>;
19
- getUsers(alias: string): Promise<QualiexUser[]>;
25
+ /**
26
+ * Mesma estrutura de `fetchActiveUsersMap`, mas inclui também usuários inativos.
27
+ * Usado pelo enrichment para resolver IDs históricos.
28
+ */
29
+ fetchAllUsersMap(alias: string, companyId: string): Promise<Map<string, QualiexUser>>;
30
+ getUsers(alias: string, status?: 'active' | 'all'): Promise<QualiexUser[]>;
20
31
  /**
21
32
  * Busca a lista de todos os módulos/softwares disponíveis na plataforma.
22
33
  * GET /api/common/v1/softwares
@@ -35,5 +46,30 @@ declare class QualiexApiService {
35
46
  */
36
47
  fetchUserAssociations(userId: string, alias: string): Promise<UserAssociation[]>;
37
48
  }
49
+ /**
50
+ * Singleton do serviço Qualiex (API common-v4) — usuários, grupos e unidades organizacionais.
51
+ *
52
+ * Resolve `un-alias` automaticamente do token corrente (TokenManager). Para componentes React,
53
+ * prefira o hook `useQualiexUsers`, que adiciona cache via React Query.
54
+ *
55
+ * @example
56
+ * // Buscar usuários por nome/email/login
57
+ * const users = await qualiexApi.searchUsers('joao.silva', alias);
58
+ * // → QualiexUser[] com { userName, name, email, ... }
59
+ *
60
+ * @example
61
+ * // Resolver lote de userNames (ex: enriquecimento de tabela)
62
+ * const usernames = ['ana.lima', 'bruno.costa'];
63
+ * const enriched = await qualiexApi.getUsersByUserNames(usernames, alias);
64
+ *
65
+ * @example
66
+ * // Listar softwares contratados pela unidade (Module Access)
67
+ * const softwares = await qualiexApi.getContractedSoftwares(alias);
68
+ *
69
+ * @example
70
+ * // Em componentes React, prefira o hook
71
+ * import { useQualiexUsers } from 'forlogic-core';
72
+ * const { data: users, isLoading } = useQualiexUsers({ search, alias });
73
+ */
38
74
  export declare const qualiexApi: QualiexApiService;
39
75
  export {};
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Componente `QualiexErrorInterceptor` da lib.
3
+ * @example
4
+ * <QualiexErrorInterceptor />
5
+ */
1
6
  export declare class QualiexErrorInterceptor {
2
7
  private static isRetrying;
3
8
  /**
@@ -1,3 +1,37 @@
1
1
  import { SupabaseClient } from '@supabase/supabase-js';
2
2
  import type { Database } from './types';
3
+ /**
4
+ * Retorna a instância singleton do client Supabase já configurada (URL, anon key e schema padrão).
5
+ *
6
+ * **Sempre** use esta função — nunca invoque `createClient` manualmente. Toda query exige
7
+ * `.schema('<schema>')` explícito (multi-tenant). Ver `mem://patterns/supabase-client-guards`.
8
+ *
9
+ * @example
10
+ * // Query em schema específico (obrigatório)
11
+ * const supabase = getSupabaseClient();
12
+ * const { data, error } = await supabase
13
+ * .schema('central')
14
+ * .from('action_plans')
15
+ * .select('id, title, status')
16
+ * .eq('alias', currentAlias)
17
+ * .is('deleted_at', null)
18
+ * .order('created_at', { ascending: false });
19
+ *
20
+ * @example
21
+ * // Insert com retorno
22
+ * const { data } = await supabase
23
+ * .schema('central')
24
+ * .from('matrices')
25
+ * .insert({ alias, title: 'Nova Matriz', id_user: userId })
26
+ * .select()
27
+ * .single();
28
+ *
29
+ * @example
30
+ * // Soft delete (nunca DELETE físico)
31
+ * await supabase
32
+ * .schema('central')
33
+ * .from('requirements')
34
+ * .update({ deleted_at: new Date().toISOString() })
35
+ * .eq('id', requirementId);
36
+ */
3
37
  export declare function getSupabaseClient(): SupabaseClient<Database>;
package/dist/types.d.ts CHANGED
@@ -4,8 +4,25 @@ export type ViewMode = 'table';
4
4
  export type SortDirection = 'asc' | 'desc';
5
5
  export type ActionType = 'create' | 'update' | 'delete' | 'fetch' | 'export';
6
6
  /**
7
- * BaseEntity - Interface mínima para todas as entidades
8
- * Contém apenas campos essenciais presentes em todas as tabelas
7
+ * Interface mínima que **toda** entidade da plataforma deve estender.
8
+ *
9
+ * Reflete os campos obrigatórios de qualquer tabela multi-tenant: `id`, `alias` (tenant),
10
+ * timestamps e flags de soft delete (`is_removed`) e ativação (`is_actived`).
11
+ *
12
+ * @example
13
+ * // Estendendo para uma entidade de domínio
14
+ * interface ActionPlan extends BaseEntity {
15
+ * title: string;
16
+ * description: string | null;
17
+ * status: 'pending' | 'in_progress' | 'completed';
18
+ * id_user: string;
19
+ * }
20
+ *
21
+ * @example
22
+ * // Uso genérico em hooks/serviços CRUD
23
+ * function useEntities<T extends BaseEntity>(table: string) {
24
+ * return useQuery<T[]>(['entities', table], () => fetchAll(table));
25
+ * }
9
26
  */
10
27
  export interface BaseEntity {
11
28
  id: string;
@@ -69,6 +86,36 @@ export interface CrudManager<T extends BaseEntity> {
69
86
  }
70
87
  export interface CrudEntity extends BaseEntity {
71
88
  }
89
+ /**
90
+ * Definição de coluna usada por {@link CrudTable} e `createCrudPage`.
91
+ *
92
+ * Suporta tipagem semântica (`type`), ordenação (default `true`), filtros, busca textual,
93
+ * renderização customizada e larguras controladas.
94
+ *
95
+ * @example
96
+ * const columns: CrudColumn<ActionPlan>[] = [
97
+ * { key: 'title', header: 'Título', type: 'text', searchable: true, weight: 3 },
98
+ * {
99
+ * key: 'status',
100
+ * header: 'Status',
101
+ * type: 'select',
102
+ * options: [
103
+ * { label: 'Pendente', value: 'pending' },
104
+ * { label: 'Concluído', value: 'completed' },
105
+ * ],
106
+ * filterable: true,
107
+ * render: (row) => <StatusBadge status={row.status} />,
108
+ * },
109
+ * {
110
+ * key: 'created_at',
111
+ * header: 'Criado em',
112
+ * type: 'date',
113
+ * sortable: true,
114
+ * render: (row) => formatDatetime(row.created_at),
115
+ * },
116
+ * { key: 'id_user', header: 'Responsável', minWidth: 180 },
117
+ * ];
118
+ */
72
119
  export interface CrudColumn<T = any> {
73
120
  key: keyof T;
74
121
  header: string;
@@ -460,6 +507,8 @@ export interface QualiexUser {
460
507
  roleName?: string;
461
508
  companyId?: string;
462
509
  companyName?: string;
510
+ /** Indica se o usuário está ativo no Qualiex. Default `true` quando ausente. */
511
+ isActive?: boolean;
463
512
  }
464
513
  export interface QualiexUserFieldMapping {
465
514
  /** Nome do campo de ID de usuário na entidade (ex: "target_user_id") */
@@ -103,7 +103,10 @@ function generateCSPPolicy(isDev, options = {}) {
103
103
 
104
104
  const DEFAULT_TRUSTED_ORIGINS = [
105
105
  "https://lovableproject.com",
106
- "https://lovable.dev"
106
+ "https://*.lovableproject.com",
107
+ "https://lovable.dev",
108
+ "https://*.lovable.dev",
109
+ "https://*.lovable.app"
107
110
  ];
108
111
  const DEV_TRUSTED_ORIGINS = [
109
112
  "http://localhost:8080",
@@ -105,7 +105,10 @@ function generateCSPPolicy(isDev, options = {}) {
105
105
 
106
106
  const DEFAULT_TRUSTED_ORIGINS = [
107
107
  "https://lovableproject.com",
108
- "https://lovable.dev"
108
+ "https://*.lovableproject.com",
109
+ "https://lovable.dev",
110
+ "https://*.lovable.dev",
111
+ "https://*.lovable.app"
109
112
  ];
110
113
  const DEV_TRUSTED_ORIGINS = [
111
114
  "http://localhost:8080",