forlogic-core 2.1.4 → 2.2.0

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 (248) hide show
  1. package/.note/memory/features/import/attachment-idempotency-registry.md +8 -8
  2. package/.note/memory/features/import/attachment-strategy.md +30 -30
  3. package/.note/memory/patterns/admin-i18n-policy.md +20 -20
  4. package/.note/memory/patterns/alias-url-resolution.md +69 -69
  5. package/.note/memory/patterns/doc-sync-rule.md +35 -35
  6. package/.note/memory/patterns/documentation-standard.md +17 -17
  7. package/.note/memory/patterns/dynamic-supabase-config.md +4 -4
  8. package/.note/memory/patterns/environment-detection-logic.md +35 -35
  9. package/.note/memory/patterns/i18n-architecture.md +3 -3
  10. package/README.md +120 -68
  11. package/dist/action-plans/components/ActionPlanAttachmentsTab.d.ts +3 -0
  12. package/dist/action-plans/components/ActionPlanCommentsTab.d.ts +3 -0
  13. package/dist/action-plans/components/ActionPlanCostTab.d.ts +5 -0
  14. package/dist/action-plans/components/ActionPlanGeneralTab.d.ts +3 -0
  15. package/dist/action-plans/components/ActionPlanHistoryTab.d.ts +3 -0
  16. package/dist/action-plans/components/ActionPlanPredecessorsTab.d.ts +5 -0
  17. package/dist/action-plans/components/ActionPlanProgressDialog.d.ts +3 -0
  18. package/dist/action-plans/components/ActionPlanProgressTab.d.ts +5 -0
  19. package/dist/action-plans/components/ActionPlanStatusBadge.d.ts +9 -2
  20. package/dist/action-plans/constants.d.ts +24 -0
  21. package/dist/action-plans/hooks/useActionPlan.d.ts +5 -0
  22. package/dist/action-plans/hooks/useActionPlanProgress.d.ts +5 -0
  23. package/dist/action-plans/types.d.ts +60 -0
  24. package/dist/action-plans/utils/formatTime.d.ts +9 -0
  25. package/dist/audit-trail/components/AuditTrailDetails.d.ts +10 -0
  26. package/dist/audit-trail/components/AuditTrailFilter.d.ts +10 -0
  27. package/dist/audit-trail/components/AuditTrailPage.d.ts +10 -0
  28. package/dist/audit-trail/types.d.ts +58 -0
  29. package/dist/audit-trail/utils.d.ts +18 -2
  30. package/dist/auth/components/EditProfileDialog.d.ts +1 -0
  31. package/dist/auth/components/ProtectedRoute.d.ts +5 -0
  32. package/dist/auth/contexts/AuthContext.d.ts +5 -0
  33. package/dist/auth/pages/CallbackPage.d.ts +5 -0
  34. package/dist/auth/services/AuthService.d.ts +5 -0
  35. package/dist/auth/services/TokenManager.d.ts +5 -0
  36. package/dist/auth/services/TokenService.d.ts +10 -0
  37. package/dist/auth/utils/ErrorInterceptor.d.ts +5 -0
  38. package/dist/components/dashboards/dashboard-form.d.ts +15 -0
  39. package/dist/components/dashboards/dashboard-general-view.d.ts +15 -0
  40. package/dist/components/dashboards/dashboard-grid.d.ts +25 -0
  41. package/dist/components/dashboards/dashboard-list.d.ts +10 -0
  42. package/dist/components/dashboards/dashboard-panel-renderer.d.ts +10 -0
  43. package/dist/components/dashboards/dashboard-view.d.ts +10 -0
  44. package/dist/components/dashboards/helpers.d.ts +44 -5
  45. package/dist/components/dashboards/panels/burndown-panel.d.ts +15 -0
  46. package/dist/components/dashboards/panels/cartesian-panel.d.ts +20 -0
  47. package/dist/components/dashboards/panels/list-panel.d.ts +15 -0
  48. package/dist/components/dashboards/panels/matrix-risk-panel.d.ts +25 -0
  49. package/dist/components/dashboards/panels/numeric-panel.d.ts +10 -0
  50. package/dist/components/dashboards/panels/panel-error.d.ts +10 -0
  51. package/dist/components/dashboards/panels/panel-header.d.ts +10 -0
  52. package/dist/components/dashboards/panels/panel-loader.d.ts +10 -0
  53. package/dist/components/dashboards/panels/panel-no-data.d.ts +10 -0
  54. package/dist/components/dashboards/panels/panel-unavailable.d.ts +10 -0
  55. package/dist/components/dashboards/panels/pareto-panel.d.ts +10 -0
  56. package/dist/components/dashboards/panels/performance-panel.d.ts +15 -0
  57. package/dist/components/dashboards/panels/pie-panel.d.ts +10 -0
  58. package/dist/components/dashboards/panels/text-panel.d.ts +10 -0
  59. package/dist/components/dashboards/types.d.ts +230 -0
  60. package/dist/components/modules/AccessDeniedDialog.d.ts +3 -1
  61. package/dist/components/modules/ModuleAccessGuard.d.ts +3 -1
  62. package/dist/components/modules/ModulesContent.d.ts +3 -1
  63. package/dist/components/modules/ModulesDialog.d.ts +1 -1
  64. package/dist/components/modules/ModulesFooterCards.d.ts +3 -1
  65. package/dist/components/modules/types.d.ts +2 -0
  66. package/dist/components/ui/accordion.d.ts +35 -0
  67. package/dist/components/ui/action-button.d.ts +5 -0
  68. package/dist/components/ui/alert-dialog.d.ts +82 -0
  69. package/dist/components/ui/alert.d.ts +32 -0
  70. package/dist/components/ui/avatar.d.ts +30 -0
  71. package/dist/components/ui/badge.d.ts +32 -0
  72. package/dist/components/ui/breadcrumb.d.ts +54 -0
  73. package/dist/components/ui/button-group.d.ts +15 -0
  74. package/dist/components/ui/button.d.ts +55 -0
  75. package/dist/components/ui/calendar.d.ts +16 -0
  76. package/dist/components/ui/card.d.ts +49 -0
  77. package/dist/components/ui/chart.d.ts +35 -0
  78. package/dist/components/ui/checkbox.d.ts +11 -0
  79. package/dist/components/ui/collapsible.d.ts +15 -0
  80. package/dist/components/ui/color-picker.d.ts +5 -0
  81. package/dist/components/ui/combo-tree.d.ts +23 -0
  82. package/dist/components/ui/combobox.d.ts +28 -0
  83. package/dist/components/ui/command.d.ts +66 -0
  84. package/dist/components/ui/context-menu.d.ts +95 -0
  85. package/dist/components/ui/date-picker.d.ts +10 -0
  86. package/dist/components/ui/dialog-wizard.d.ts +22 -4
  87. package/dist/components/ui/dialog.d.ts +181 -0
  88. package/dist/components/ui/drawer.d.ts +72 -0
  89. package/dist/components/ui/dropdown-menu.d.ts +153 -0
  90. package/dist/components/ui/electronic-signature-dialog.d.ts +10 -0
  91. package/dist/components/ui/export-dialog.d.ts +20 -0
  92. package/dist/components/ui/form.d.ts +96 -0
  93. package/dist/components/ui/hover-card.d.ts +15 -0
  94. package/dist/components/ui/icon-picker.d.ts +5 -0
  95. package/dist/components/ui/iframe-dialog.d.ts +10 -0
  96. package/dist/components/ui/input-group.d.ts +16 -0
  97. package/dist/components/ui/input.d.ts +5 -0
  98. package/dist/components/ui/menubar.d.ts +80 -0
  99. package/dist/components/ui/multiselect-permissions.d.ts +25 -0
  100. package/dist/components/ui/navigation-menu.d.ts +45 -0
  101. package/dist/components/ui/onboarding-dialog.d.ts +15 -0
  102. package/dist/components/ui/online-editor-dialog.d.ts +10 -0
  103. package/dist/components/ui/pagination.d.ts +53 -0
  104. package/dist/components/ui/popover.d.ts +8 -0
  105. package/dist/components/ui/radio-group.d.ts +3 -0
  106. package/dist/components/ui/report-request-list.d.ts +20 -0
  107. package/dist/components/ui/resizable.d.ts +15 -0
  108. package/dist/components/ui/rich-text-editor.d.ts +13 -0
  109. package/dist/components/ui/scroll-area.d.ts +3 -0
  110. package/dist/components/ui/select.d.ts +71 -0
  111. package/dist/components/ui/separator.d.ts +13 -0
  112. package/dist/components/ui/sheet.d.ts +76 -0
  113. package/dist/components/ui/sidebar.d.ts +203 -0
  114. package/dist/components/ui/skeleton-variants.d.ts +25 -0
  115. package/dist/components/ui/skeleton.d.ts +12 -0
  116. package/dist/components/ui/slider.d.ts +5 -0
  117. package/dist/components/ui/sonner.d.ts +5 -0
  118. package/dist/components/ui/spinner.d.ts +5 -0
  119. package/dist/components/ui/split-button.d.ts +6 -0
  120. package/dist/components/ui/stack.d.ts +5 -0
  121. package/dist/components/ui/status-badge.d.ts +52 -0
  122. package/dist/components/ui/step-selector.d.ts +5 -0
  123. package/dist/components/ui/stimulsoft-viewer.d.ts +8 -0
  124. package/dist/components/ui/switch.d.ts +21 -0
  125. package/dist/components/ui/tab-page-layout.d.ts +33 -0
  126. package/dist/components/ui/table-resize-handle.d.ts +10 -3
  127. package/dist/components/ui/table.d.ts +102 -0
  128. package/dist/components/ui/tabs.d.ts +59 -0
  129. package/dist/components/ui/terms-of-use-dialog.d.ts +50 -4
  130. package/dist/components/ui/textarea.d.ts +27 -0
  131. package/dist/components/ui/timepicker.d.ts +23 -0
  132. package/dist/components/ui/toggle-group.d.ts +25 -0
  133. package/dist/components/ui/toggle.d.ts +21 -0
  134. package/dist/components/ui/tooltip.d.ts +48 -0
  135. package/dist/components/ui/truncated-cell.d.ts +13 -0
  136. package/dist/components/ui/typography.d.ts +119 -0
  137. package/dist/components/ui/updates-notification.d.ts +33 -0
  138. package/dist/components/ui/users-groups-selector.d.ts +43 -0
  139. package/dist/components/ui/viewer-dialog.d.ts +107 -0
  140. package/dist/crud/components/ActionMenuItems.d.ts +5 -0
  141. package/dist/crud/components/BaseForm.d.ts +46 -0
  142. package/dist/crud/components/ColumnSettingsPopover.d.ts +10 -0
  143. package/dist/crud/components/CrudActionBar.d.ts +20 -0
  144. package/dist/crud/components/CrudGrid.d.ts +10 -0
  145. package/dist/crud/components/CrudPagination.d.ts +5 -0
  146. package/dist/crud/components/CrudTable.d.ts +5 -0
  147. package/dist/crud/components/TableRowActions.d.ts +5 -0
  148. package/dist/crud/createCrudPage.d.ts +41 -8
  149. package/dist/crud/generateCrudConfig.d.ts +13 -8
  150. package/dist/crud/hooks/useBaseForm.d.ts +39 -0
  151. package/dist/crud/hooks/useColumnManager.d.ts +25 -0
  152. package/dist/crud/hooks/useCrud.d.ts +35 -0
  153. package/dist/crud/primitives/ActionMenu.d.ts +41 -0
  154. package/dist/crud/primitives/FilterBar.d.ts +45 -0
  155. package/dist/crud/primitives/Pagination.d.ts +5 -0
  156. package/dist/crud/primitives/Table.d.ts +6 -1
  157. package/dist/crud/primitives/TreeTable.d.ts +5 -0
  158. package/dist/crud/primitives/types.d.ts +63 -0
  159. package/dist/crud/utils/routingHelpers.d.ts +11 -0
  160. package/dist/custom-form-fields/components/CustomFormFields.d.ts +3 -0
  161. package/dist/custom-form-fields/fields/FormDateField.d.ts +3 -0
  162. package/dist/custom-form-fields/fields/FormMultiSelectionField.d.ts +3 -0
  163. package/dist/custom-form-fields/fields/FormNumericField.d.ts +3 -0
  164. package/dist/custom-form-fields/fields/FormQuestionsField.d.ts +3 -0
  165. package/dist/custom-form-fields/fields/FormSingleSelectionField.d.ts +3 -0
  166. package/dist/custom-form-fields/fields/FormTextField.d.ts +3 -0
  167. package/dist/custom-form-fields/fields/FormTimeField.d.ts +3 -0
  168. package/dist/custom-form-fields/fields/FormUrlField.d.ts +3 -0
  169. package/dist/custom-form-fields/fields/ReadOnlyTextField.d.ts +3 -0
  170. package/dist/custom-form-fields/types.d.ts +84 -21
  171. package/dist/exports/crud.d.ts +5 -0
  172. package/dist/exports/integrations.d.ts +1 -0
  173. package/dist/exports/ui.d.ts +1 -0
  174. package/dist/file-upload/components/SingleFileUpload.d.ts +59 -0
  175. package/dist/file-upload/types.d.ts +15 -0
  176. package/dist/file-upload/utils/formatBytes.d.ts +5 -0
  177. package/dist/file-upload/utils/getFileExtension.d.ts +5 -0
  178. package/dist/hooks/useColumnResize.d.ts +24 -0
  179. package/dist/hooks/useRowResize.d.ts +18 -0
  180. package/dist/hooks/useSidebarResize.d.ts +18 -0
  181. package/dist/hooks/useUpdatesNotification.d.ts +16 -0
  182. package/dist/index.css +1 -1
  183. package/dist/index.css.map +1 -1
  184. package/dist/index.esm.js +1 -1
  185. package/dist/index.js +1 -1
  186. package/dist/integrations/clarity/clarityTracking.d.ts +31 -0
  187. package/dist/integrations/clarity/index.d.ts +3 -0
  188. package/dist/integrations/clarity/types.d.ts +46 -0
  189. package/dist/integrations/clarity/useClarity.d.ts +34 -0
  190. package/dist/integrations/index.d.ts +5 -0
  191. package/dist/providers/CoreProviders.d.ts +16 -1
  192. package/dist/qualiex/components/QualiexUserField.d.ts +8 -0
  193. package/dist/qualiex/hooks/useQualiexUsers.d.ts +16 -26
  194. package/dist/qualiex/services/qualiexApi.d.ts +38 -2
  195. package/dist/qualiex/utils/QualiexErrorInterceptor.d.ts +5 -0
  196. package/dist/supabase/SupabaseSingleton.d.ts +34 -0
  197. package/dist/types.d.ts +51 -2
  198. package/dist/utils/color.d.ts +26 -0
  199. package/dist/utils/index.d.ts +1 -0
  200. package/dist/vite/index.esm.js +4 -1
  201. package/dist/vite/index.js +4 -1
  202. package/docs/PUBLISH.md +168 -0
  203. package/docs/STORAGE_BUCKETS.md +384 -0
  204. package/docs/WORKSPACE_KNOWLEDGE.md +120 -119
  205. package/docs/design-system/README.md +1 -1
  206. package/docs/design-system/buttons-actions.md +130 -130
  207. package/docs/design-system/charts-dashboards.md +340 -301
  208. package/docs/design-system/crud.md +174 -114
  209. package/docs/design-system/data-display.md +108 -103
  210. package/docs/design-system/dialogs.md +212 -212
  211. package/docs/design-system/domain.md +317 -317
  212. package/docs/design-system/examples.md +275 -275
  213. package/docs/design-system/foundation.md +1 -1
  214. package/docs/design-system/inputs.md +131 -131
  215. package/docs/design-system/layout.md +202 -154
  216. package/docs/design-system/navigation.md +271 -325
  217. package/docs/design-system/notifications-feedback.md +34 -34
  218. package/docs/design-system/patterns/README.md +53 -53
  219. package/docs/design-system/patterns/action-button.md +22 -22
  220. package/docs/design-system/patterns/alertdialog-deletion.md +46 -46
  221. package/docs/design-system/patterns/baseform-custom-fields.md +59 -59
  222. package/docs/design-system/patterns/baseform-usage.md +42 -42
  223. package/docs/design-system/patterns/body-content-scroll.md +56 -56
  224. package/docs/design-system/patterns/combo-tree.md +23 -23
  225. package/docs/design-system/patterns/components-registry.md +17 -17
  226. package/docs/design-system/patterns/core-providers.md +41 -39
  227. package/docs/design-system/patterns/crud-bulk-actions.md +12 -12
  228. package/docs/design-system/patterns/crud-config-props.md +16 -16
  229. package/docs/design-system/patterns/crud-defaults.md +17 -17
  230. package/docs/design-system/patterns/crud-toolbar.md +28 -28
  231. package/docs/design-system/patterns/delete-confirmation.md +40 -40
  232. package/docs/design-system/patterns/dialog-body-scroll.md +26 -26
  233. package/docs/design-system/patterns/dialog-structure.md +32 -32
  234. package/docs/design-system/patterns/dialog-variants.md +41 -41
  235. package/docs/design-system/patterns/feature-flags.md +24 -20
  236. package/docs/design-system/patterns/header-metadata.md +57 -57
  237. package/docs/design-system/patterns/i18n-setup.md +117 -117
  238. package/docs/design-system/patterns/pagination.md +27 -27
  239. package/docs/design-system/patterns/single-scroll.md +39 -39
  240. package/docs/design-system/patterns/vite-tailwind-setup.md +48 -48
  241. package/docs/design-system/platform.md +18 -18
  242. package/docs/design-system/selectors.md +240 -236
  243. package/docs/design-system/tables-grids.md +95 -38
  244. package/package.json +150 -144
  245. package/dist/README.md +0 -1079
  246. package/dist/bin/bootstrap.js +0 -40
  247. package/dist/bin/pull-docs.js +0 -186
  248. package/dist/docs/KNOWLEDGE.md +0 -109
@@ -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") */
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Gera uma cor de fundo pastel a partir de uma cor hex semântica.
3
+ * Útil para StatusBadge e outros componentes que precisam de fundo suave.
4
+ *
5
+ * @param hex - Cor em formato hex (ex: '#2E7D5B')
6
+ * @param opacity - Opacidade do fundo (0-1, default 0.1)
7
+ * @returns String rgba (ex: 'rgba(46, 125, 91, 0.1)')
8
+ */
9
+ export declare function generatePastelBg(hex: string, opacity?: number): string;
10
+ /**
11
+ * Calcula a luminância relativa de uma cor hex (WCAG 2.0).
12
+ * Retorna um valor entre 0 (preto) e 1 (branco).
13
+ *
14
+ * @param hex - Cor em formato hex (ex: '#2E7D5B')
15
+ * @returns Luminância relativa (0-1)
16
+ */
17
+ export declare function getLuminance(hex: string): number;
18
+ /**
19
+ * Calcula a razão de contraste entre duas cores (WCAG 2.0).
20
+ * Razão >= 4.5 atende AA para texto normal; >= 7 atende AAA.
21
+ *
22
+ * @param hex1 - Primeira cor hex
23
+ * @param hex2 - Segunda cor hex
24
+ * @returns Razão de contraste (1-21)
25
+ */
26
+ export declare function getContrastRatio(hex1: string, hex2: string): number;
@@ -5,4 +5,5 @@ export { formatDatetime, formatDate } from './formatters/dateFormatters';
5
5
  export { formatCurrency } from './formatters/currencyFormatters';
6
6
  export declare const debounce: <T extends (...args: any[]) => any>(func: T, wait: number) => ((...args: Parameters<T>) => void);
7
7
  export declare const slugify: (text: string) => string;
8
+ export { generatePastelBg, getLuminance, getContrastRatio } from './color';
8
9
  export { handleExternalLink, buildModuleUrl } from './linkHelpers';
@@ -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",
@@ -0,0 +1,168 @@
1
+ # 📦 Como Publicar a Biblioteca forlogic-core
2
+
3
+ > **Nota:** Para documentação de uso e instalação da biblioteca, consulte [README.md](../README.md)
4
+
5
+ ## Configuração Inicial
6
+
7
+ A biblioteca está configurada para ser publicada no NPM como `forlogic-core`.
8
+
9
+ ### Arquivos de Configuração
10
+
11
+ - `package.json` - Configuração principal com campos de biblioteca
12
+ - `rollup.config.js` - Configuração de build
13
+ - `tsconfig.json` - Configuração TypeScript unificada
14
+ - `.npmignore` - Arquivos excluídos da publicação (inclui `docs/` - não publicada no NPM)
15
+ - `README.md` - Documentação principal (copiada para dist/)
16
+
17
+ ## Comandos Disponíveis
18
+
19
+ ### 1. Build da Biblioteca
20
+
21
+ ```bash
22
+ npm run build:lib
23
+ ```
24
+
25
+ ### 2. Teste de Publicação (Dry Run)
26
+
27
+ ```bash
28
+ npm publish --dry-run
29
+ ```
30
+
31
+ ### 3. Release Automatizado (Recomendado)
32
+
33
+ **Script JavaScript**
34
+
35
+ ```bash
36
+ # Release patch (1.0.0 → 1.0.1)
37
+ node scripts/publish.js patch
38
+
39
+ # Release minor (1.0.0 → 1.1.0)
40
+ node scripts/publish.js minor
41
+
42
+ # Release major (1.0.0 → 2.0.0)
43
+ node scripts/publish.js major
44
+ ```
45
+
46
+ ### 4. Publicação Manual (Legado)
47
+
48
+ ```bash
49
+ # Incrementar versão e publicar manualmente
50
+ npm version patch # 1.0.0 → 1.0.1
51
+ npm version minor # 1.0.0 → 1.1.0
52
+ npm version major # 1.0.0 → 2.0.0
53
+
54
+ # Publicar versão atual
55
+ npm publish
56
+ ```
57
+
58
+ ## Processo de Release Automatizado
59
+
60
+ ### Scripts Automatizados
61
+
62
+ Os scripts `scripts/publish/release.js` e `scripts/publish/release.sh` executam automaticamente:
63
+
64
+ 1. **Verificação**: Confere se não há mudanças pendentes no Git
65
+ 2. **Build**: Executa `npm run build:lib` com Rollup
66
+ 3. **Versão**: Incrementa versão no `package.json`
67
+ 4. **Publicação**: Publica no NPM
68
+ 5. **Tags**: Envia tags para o GitHub
69
+
70
+ ### Processo Manual (Legado)
71
+
72
+ 1. **Build**: Executa `npm run build:lib` com Rollup
73
+ 2. **Geração**: Cria arquivos CJS, ESM e declarações TypeScript
74
+ 3. **Publicação**: Usa `npm publish` diretamente
75
+
76
+ ## Estrutura da Publicação
77
+
78
+ ```
79
+ dist/
80
+ ├── index.js # CommonJS
81
+ ├── index.esm.js # ES Modules
82
+ ├── index.d.ts # TypeScript declarations
83
+ ├── index.css # CSS da biblioteca
84
+ ├── package.json # Configuração da lib
85
+ └── README.md # Documentação
86
+ ```
87
+
88
+ ## Documentação para Usuários
89
+
90
+ A documentação completa está **consolidada no README.md** e disponível publicamente no repositório GitHub:
91
+
92
+ - **[📖 README.md](../README.md)** - Guia completo (~350 linhas)
93
+ - ✅ Regras críticas e checklist
94
+ - ✅ Quick start CRUD
95
+ - ✅ Migrations e RLS
96
+ - ✅ Troubleshooting
97
+ - ✅ Referência rápida
98
+
99
+ ### ⚙️ Documentação no Pacote NPM
100
+
101
+ O `README.md` é incluído no pacote NPM publicado (`dist/README.md`) e contém toda a documentação necessária em um único arquivo otimizado para leitura por IA e desenvolvedores.
102
+
103
+ #### Documentações Modulares
104
+
105
+ Algumas features possuem documentação detalhada em arquivos específicos para desenvolvimento local:
106
+
107
+ - `lib/crud/components/CUSTOM_FIELDS.md` - Campos customizados do BaseForm
108
+ - `lib/qualiex/places/README.md` - Sistema de gestores de locais
109
+
110
+ **Importante:** Essas documentações **não são publicadas no NPM**. O conteúdo consolidado está no `README.md` principal que é copiado para `dist/README.md`.
111
+
112
+ ## Verificação antes da Publicação
113
+
114
+ 1. ✅ Build bem-sucedido (`npm run build:lib`)
115
+ 2. ✅ Dry-run sem erros (`npm publish --dry-run`)
116
+ 3. ✅ Versão correta no `package.json`
117
+ 4. ✅ README atualizado
118
+ 5. ✅ Changelog documentado (se aplicável)
119
+
120
+ ## Troubleshooting
121
+
122
+ ### Erro de Permissão NPM
123
+
124
+ ```bash
125
+ npm login
126
+ ```
127
+
128
+ ### Build Falha
129
+
130
+ Verifique se todas as dependências estão instaladas:
131
+
132
+ ```bash
133
+ npm install
134
+ ```
135
+
136
+ ### Rollup Errors
137
+
138
+ Confirme que o `rollup.config.js` está correto e que o `lib/index.ts` existe e exporta tudo necessário.
139
+
140
+ ### CSS Import Issues
141
+
142
+ Se houver erro ao importar CSS, use:
143
+
144
+ ```tsx
145
+ import 'forlogic-core/index.css';
146
+ ```
147
+
148
+ O CSS é extraído para `index.css` durante o build da biblioteca.
149
+
150
+ # Comandos Disponíveis
151
+
152
+ ## Instalar a última versão do forlogic-core
153
+
154
+ ```bash
155
+ npm i forlogic-core@latest
156
+ ```
157
+
158
+ ## Build do projeto
159
+
160
+ ```bash
161
+ npm run build
162
+ ```
163
+
164
+ ## Limpar cache do NPM
165
+
166
+ ```bash
167
+ npm cache clean --force
168
+ ```