@jmruthers/pace-core 0.2.7 → 0.5.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 (541) hide show
  1. package/dist/{DataTable-EEUDXPE5.js → DataTable-GX3XERFJ.js} +8 -4
  2. package/dist/{DataTable-C1AEm9Cx.d.ts → DataTable-ltTFXHS3.d.ts} +3 -1
  3. package/dist/{chunk-VYG4AXYW.js → chunk-5EL3KHOQ.js} +2 -2
  4. package/dist/{chunk-ETEJVKYK.js → chunk-6CR3MRZN.js} +1426 -62
  5. package/dist/chunk-6CR3MRZN.js.map +1 -0
  6. package/dist/chunk-AUE24LVR.js +268 -0
  7. package/dist/chunk-AUE24LVR.js.map +1 -0
  8. package/dist/chunk-COBPIXXQ.js +379 -0
  9. package/dist/chunk-COBPIXXQ.js.map +1 -0
  10. package/dist/{chunk-EWKPTNPO.js → chunk-GSNM5D6H.js} +388 -86
  11. package/dist/chunk-GSNM5D6H.js.map +1 -0
  12. package/dist/{chunk-2V3Y6YBC.js → chunk-OEGRKULD.js} +1 -42
  13. package/dist/chunk-OEGRKULD.js.map +1 -0
  14. package/dist/chunk-OYRY44Q2.js +62 -0
  15. package/dist/chunk-OYRY44Q2.js.map +1 -0
  16. package/dist/{chunk-RRUYHORU.js → chunk-T3XIA4AJ.js} +297 -433
  17. package/dist/chunk-T3XIA4AJ.js.map +1 -0
  18. package/dist/{chunk-HEMJ4SUJ.js → chunk-TGDCLPP2.js} +11 -7
  19. package/dist/{chunk-HEMJ4SUJ.js.map → chunk-TGDCLPP2.js.map} +1 -1
  20. package/dist/{chunk-HNDFPXUU.js → chunk-U6JDHVC2.js} +6 -4
  21. package/dist/{chunk-HNDFPXUU.js.map → chunk-U6JDHVC2.js.map} +1 -1
  22. package/dist/{chunk-TIVL4UQ7.js → chunk-XJK2J4N6.js} +6 -4
  23. package/dist/{chunk-TIVL4UQ7.js.map → chunk-XJK2J4N6.js.map} +1 -1
  24. package/dist/components.d.ts +2 -2
  25. package/dist/components.js +21 -20
  26. package/dist/components.js.map +1 -1
  27. package/dist/hooks.d.ts +1 -1
  28. package/dist/hooks.js +7 -7
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.js +26 -25
  31. package/dist/index.js.map +1 -1
  32. package/dist/providers.js +8 -7
  33. package/dist/rbac/index.d.ts +806 -806
  34. package/dist/rbac/index.js +937 -1179
  35. package/dist/rbac/index.js.map +1 -1
  36. package/dist/{types-DiRQsGJs.d.ts → types-BRDU7N6w.d.ts} +12 -1
  37. package/dist/utils.d.ts +2 -2
  38. package/dist/utils.js +6 -6
  39. package/docs/api/classes/ErrorBoundary.md +1 -1
  40. package/docs/api/classes/PublicErrorBoundary.md +1 -1
  41. package/docs/api/interfaces/AggregateConfig.md +4 -4
  42. package/docs/api/interfaces/ButtonProps.md +1 -1
  43. package/docs/api/interfaces/CardProps.md +1 -1
  44. package/docs/api/interfaces/ColorPalette.md +1 -1
  45. package/docs/api/interfaces/ColorShade.md +1 -1
  46. package/docs/api/interfaces/DataTableAction.md +21 -8
  47. package/docs/api/interfaces/DataTableColumn.md +1 -1
  48. package/docs/api/interfaces/DataTableProps.md +46 -33
  49. package/docs/api/interfaces/DataTableToolbarButton.md +7 -7
  50. package/docs/api/interfaces/EmptyStateConfig.md +5 -5
  51. package/docs/api/interfaces/EventContextType.md +1 -1
  52. package/docs/api/interfaces/EventLogoProps.md +1 -1
  53. package/docs/api/interfaces/EventProviderProps.md +1 -1
  54. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  55. package/docs/api/interfaces/FileUploadProps.md +1 -1
  56. package/docs/api/interfaces/FooterProps.md +1 -1
  57. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  58. package/docs/api/interfaces/InputProps.md +1 -1
  59. package/docs/api/interfaces/LabelProps.md +1 -1
  60. package/docs/api/interfaces/LoginFormProps.md +1 -1
  61. package/docs/api/interfaces/NavigationItem.md +1 -1
  62. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  63. package/docs/api/interfaces/Organisation.md +1 -1
  64. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  65. package/docs/api/interfaces/OrganisationMembership.md +2 -2
  66. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  67. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  68. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  69. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  70. package/docs/api/interfaces/PaletteData.md +1 -1
  71. package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
  72. package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
  73. package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
  74. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  75. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  76. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  77. package/docs/api/interfaces/StorageConfig.md +1 -1
  78. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  79. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  80. package/docs/api/interfaces/StorageListOptions.md +1 -1
  81. package/docs/api/interfaces/StorageListResult.md +1 -1
  82. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  83. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  84. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  85. package/docs/api/interfaces/StyleImport.md +1 -1
  86. package/docs/api/interfaces/ToastActionElement.md +1 -1
  87. package/docs/api/interfaces/ToastProps.md +1 -1
  88. package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
  89. package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
  90. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  91. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  92. package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
  93. package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
  94. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  95. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  96. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  97. package/docs/api/interfaces/UserEventAccess.md +1 -1
  98. package/docs/api/interfaces/UserMenuProps.md +1 -1
  99. package/docs/api/interfaces/UserProfile.md +1 -1
  100. package/docs/api/modules.md +3 -3
  101. package/package.json +5 -2
  102. package/src/__tests__/REBUILD_PLAN.md +223 -0
  103. package/src/__tests__/TESTING_GUIDELINES.md +341 -0
  104. package/src/__tests__/fixtures/mocks.ts +93 -0
  105. package/src/__tests__/helpers/component-test-utils.tsx +145 -0
  106. package/src/__tests__/helpers/test-utils.tsx +117 -0
  107. package/src/__tests__/integration/UserProfile.test.tsx +128 -0
  108. package/src/__tests__/setup.ts +37 -225
  109. package/src/__tests__/templates/component.test.template.tsx +97 -75
  110. package/src/__tests__/templates/hook.test.template.ts +173 -0
  111. package/src/__tests__/types/test.types.ts +106 -0
  112. package/src/components/Alert/Alert.test.tsx +496 -0
  113. package/src/components/Avatar/Avatar.test.tsx +484 -0
  114. package/src/components/Button/Button.test.tsx +662 -0
  115. package/src/components/Card/Card.test.tsx +593 -0
  116. package/src/components/Checkbox/Checkbox.test.tsx +461 -0
  117. package/src/components/DataTable/DataTable.tsx +9 -1
  118. package/src/components/DataTable/components/AccessDeniedPage.tsx +168 -0
  119. package/src/components/DataTable/components/ActionButtons.tsx +18 -1
  120. package/src/components/DataTable/components/DataTableCore.tsx +97 -11
  121. package/src/components/DataTable/components/DataTableToolbar.tsx +22 -10
  122. package/src/components/DataTable/components/UnifiedTableBody.tsx +33 -4
  123. package/src/components/DataTable/examples/HierarchicalActionsExample.tsx +1 -0
  124. package/src/components/DataTable/examples/HierarchicalExample.tsx +3 -0
  125. package/src/components/DataTable/examples/InitialPageSizeExample.tsx +3 -0
  126. package/src/components/DataTable/examples/PerformanceExample.tsx +3 -0
  127. package/src/components/DataTable/types.ts +39 -1
  128. package/src/components/Dialog/Dialog.test.tsx +1139 -0
  129. package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +752 -0
  130. package/src/components/FileUpload/FileUpload.test.tsx +665 -0
  131. package/src/hooks/useCounter.test.ts +135 -0
  132. package/src/rbac/index.ts +3 -3
  133. package/dist/chunk-2V3Y6YBC.js.map +0 -1
  134. package/dist/chunk-BEZRLNK3.js +0 -1744
  135. package/dist/chunk-BEZRLNK3.js.map +0 -1
  136. package/dist/chunk-ETEJVKYK.js.map +0 -1
  137. package/dist/chunk-EWKPTNPO.js.map +0 -1
  138. package/dist/chunk-OHXGNT3K.js +0 -21
  139. package/dist/chunk-OHXGNT3K.js.map +0 -1
  140. package/dist/chunk-RRUYHORU.js.map +0 -1
  141. package/src/__tests__/README.md +0 -404
  142. package/src/__tests__/debug-provider.unit.test.tsx +0 -67
  143. package/src/__tests__/e2e/workflows.test.tsx +0 -373
  144. package/src/__tests__/hybridPermissions.unit.test.tsx +0 -474
  145. package/src/__tests__/index.integration.test.ts +0 -491
  146. package/src/__tests__/mocks/MockAuthProvider-standalone.tsx +0 -47
  147. package/src/__tests__/mocks/MockAuthProvider.tsx +0 -63
  148. package/src/__tests__/mocks/enhancedSupabaseMock.ts +0 -252
  149. package/src/__tests__/mocks/index.test.ts +0 -23
  150. package/src/__tests__/mocks/index.ts +0 -16
  151. package/src/__tests__/mocks/mockAuth.ts +0 -155
  152. package/src/__tests__/mocks/mockSupabase.ts +0 -83
  153. package/src/__tests__/mocks/mockSupabaseClient.ts +0 -63
  154. package/src/__tests__/mocks/providers.tsx +0 -22
  155. package/src/__tests__/patterns/__tests__/testPatterns.test.ts +0 -394
  156. package/src/__tests__/patterns/testPatterns.ts +0 -124
  157. package/src/__tests__/performance/componentPerformance.performance.test.ts +0 -27
  158. package/src/__tests__/performance/index.ts +0 -24
  159. package/src/__tests__/performance/performanceValidation.performance.test.ts +0 -15
  160. package/src/__tests__/security/security.unit.test.tsx +0 -7
  161. package/src/__tests__/security/securityValidation.security.test.tsx +0 -153
  162. package/src/__tests__/setupTests.d.ts +0 -1
  163. package/src/__tests__/shared/componentTestUtils.tsx +0 -475
  164. package/src/__tests__/shared/errorHandlingTestUtils.ts +0 -107
  165. package/src/__tests__/shared/index.ts +0 -81
  166. package/src/__tests__/shared/integrationTestUtils.tsx +0 -375
  167. package/src/__tests__/shared/performanceTestUtils.tsx +0 -476
  168. package/src/__tests__/shared/testUtils.optimized.tsx +0 -685
  169. package/src/__tests__/simple.test.tsx +0 -20
  170. package/src/__tests__/test-utils/dataFactories.ts +0 -60
  171. package/src/__tests__/test-utils/index.ts +0 -6
  172. package/src/__tests__/typeSafety.unit.test.ts +0 -65
  173. package/src/__tests__/unifiedAuth.unit.test.tsx +0 -151
  174. package/src/__tests__/utils/accessibilityHelpers.ts +0 -254
  175. package/src/__tests__/utils/assertions.ts +0 -50
  176. package/src/__tests__/utils/deterministicHelpers.ts +0 -31
  177. package/src/__tests__/utils/edgeCaseConfig.test.ts +0 -75
  178. package/src/__tests__/utils/edgeCaseConfig.ts +0 -98
  179. package/src/__tests__/utils/mockHelpers.ts +0 -149
  180. package/src/__tests__/utils/mockLoader.ts +0 -101
  181. package/src/__tests__/utils/performanceHelpers.ts +0 -55
  182. package/src/__tests__/utils/performanceTestHelpers.ts +0 -68
  183. package/src/__tests__/utils/testDataFactories.ts +0 -28
  184. package/src/__tests__/utils/testIsolation.ts +0 -67
  185. package/src/__tests__/utils/visualTestHelpers.ts +0 -20
  186. package/src/__tests__/visual/__snapshots__/componentSnapshots.visual.test.tsx.snap +0 -68
  187. package/src/__tests__/visual/__snapshots__/componentVisuals.visual.test.tsx.snap +0 -14
  188. package/src/__tests__/visual/__snapshots__/visualRegression.test.tsx.snap +0 -217
  189. package/src/__tests__/visual/__snapshots__/visualRegression.visual.test.tsx.snap +0 -24
  190. package/src/__tests__/visual/componentSnapshots.visual.test.tsx +0 -33
  191. package/src/__tests__/visual/componentVisuals.visual.test.tsx +0 -12
  192. package/src/__tests__/visual/visualRegression.visual.test.tsx +0 -20
  193. package/src/components/Alert/__tests__/Alert.unit.test.tsx +0 -381
  194. package/src/components/Avatar/__tests__/Avatar.unit.test.tsx +0 -232
  195. package/src/components/Button/__tests__/Button.accessibility.test.tsx +0 -131
  196. package/src/components/Button/__tests__/Button.comprehensive.test.tsx +0 -721
  197. package/src/components/Button/__tests__/Button.unit.test.tsx +0 -189
  198. package/src/components/Button/__tests__/EventSelector.integration.test.tsx +0 -285
  199. package/src/components/Card/__tests__/Card.accessibility.test.tsx +0 -394
  200. package/src/components/Card/__tests__/Card.comprehensive.test.tsx +0 -599
  201. package/src/components/Card/__tests__/Card.integration.test.tsx +0 -673
  202. package/src/components/Card/__tests__/Card.performance.test.tsx +0 -546
  203. package/src/components/Card/__tests__/Card.unit.test.tsx +0 -330
  204. package/src/components/Card/__tests__/Card.visual.test.tsx +0 -599
  205. package/src/components/Card/__tests__/README.md +0 -211
  206. package/src/components/Checkbox/__tests__/Checkbox.unit.test.tsx +0 -520
  207. package/src/components/DataTable/__tests__/DataTable.errorHandling.test.tsx +0 -251
  208. package/src/components/DataTable/__tests__/DataTable.hierarchical.test.tsx +0 -680
  209. package/src/components/DataTable/__tests__/DataTable.infinite-loop.test.tsx +0 -323
  210. package/src/components/DataTable/__tests__/DataTable.integration.test.tsx +0 -716
  211. package/src/components/DataTable/__tests__/DataTable.performance.test.tsx +0 -589
  212. package/src/components/DataTable/__tests__/DataTable.permissions.test.tsx +0 -316
  213. package/src/components/DataTable/__tests__/DataTable.regressionFixes.test.tsx +0 -546
  214. package/src/components/DataTable/__tests__/DataTable.selection.controlled.test.tsx +0 -386
  215. package/src/components/DataTable/__tests__/DataTable.selection.test.tsx +0 -338
  216. package/src/components/DataTable/__tests__/DataTable.sorting.test.tsx +0 -321
  217. package/src/components/DataTable/__tests__/DataTable.userWorkflows.test.tsx +0 -320
  218. package/src/components/DataTable/__tests__/DataTable.workflowValidation.test.tsx +0 -583
  219. package/src/components/DataTable/__tests__/DataTable.workflows.test.tsx +0 -711
  220. package/src/components/DataTable/__tests__/performance-regression.test.tsx +0 -777
  221. package/src/components/DataTable/__tests__/performance.test.tsx +0 -365
  222. package/src/components/DataTable/components/__tests__/ActionButtons.unit.test.tsx +0 -150
  223. package/src/components/DataTable/components/__tests__/BulkOperationsDropdown.test.tsx +0 -224
  224. package/src/components/DataTable/components/__tests__/ColumnVisibilityDropdown.unit.test.tsx +0 -244
  225. package/src/components/DataTable/components/__tests__/DataTable.accessibility.test.tsx +0 -629
  226. package/src/components/DataTable/components/__tests__/DataTable.integration.test.tsx +0 -470
  227. package/src/components/DataTable/components/__tests__/DataTable.performance.test.tsx +0 -160
  228. package/src/components/DataTable/components/__tests__/DataTable.real.test.tsx +0 -251
  229. package/src/components/DataTable/components/__tests__/DataTable.security.test.tsx +0 -171
  230. package/src/components/DataTable/components/__tests__/DataTable.unit.test.tsx +0 -290
  231. package/src/components/DataTable/components/__tests__/DataTableBody.unit.test.tsx +0 -147
  232. package/src/components/DataTable/components/__tests__/DataTableErrorBoundary.unit.test.tsx +0 -182
  233. package/src/components/DataTable/components/__tests__/DataTableModals.unit.test.tsx +0 -123
  234. package/src/components/DataTable/components/__tests__/EditableRow.unit.test.tsx +0 -660
  235. package/src/components/DataTable/components/__tests__/EmptyState.unit.test.tsx +0 -256
  236. package/src/components/DataTable/components/__tests__/ExpandButton.test.tsx +0 -498
  237. package/src/components/DataTable/components/__tests__/FilterRow.unit.test.tsx +0 -112
  238. package/src/components/DataTable/components/__tests__/FilteringToggle.unit.test.tsx +0 -133
  239. package/src/components/DataTable/components/__tests__/GroupHeader.unit.test.tsx +0 -172
  240. package/src/components/DataTable/components/__tests__/GroupingDropdown.unit.test.tsx +0 -222
  241. package/src/components/DataTable/components/__tests__/ImportModal.unit.test.tsx +0 -780
  242. package/src/components/DataTable/components/__tests__/LoadingState.unit.test.tsx +0 -65
  243. package/src/components/DataTable/components/__tests__/PaginationControls.unit.test.tsx +0 -634
  244. package/src/components/DataTable/components/__tests__/StateComponents.unit.test.tsx +0 -48
  245. package/src/components/DataTable/components/__tests__/UnifiedTableBody.hierarchical.test.tsx +0 -541
  246. package/src/components/DataTable/components/__tests__/ViewRowModal.unit.test.tsx +0 -228
  247. package/src/components/DataTable/components/__tests__/VirtualizedDataTable.unit.test.tsx +0 -568
  248. package/src/components/DataTable/core/__tests__/ActionManager.unit.test.ts +0 -405
  249. package/src/components/DataTable/core/__tests__/ArchitectureIntegration.unit.test.tsx +0 -445
  250. package/src/components/DataTable/core/__tests__/ColumnFactory.unit.test.ts +0 -288
  251. package/src/components/DataTable/core/__tests__/ColumnManager.unit.test.ts +0 -623
  252. package/src/components/DataTable/core/__tests__/DataManager.unit.test.ts +0 -431
  253. package/src/components/DataTable/core/__tests__/DataTableContext.unit.test.tsx +0 -433
  254. package/src/components/DataTable/core/__tests__/LocalDataAdapter.unit.test.ts +0 -422
  255. package/src/components/DataTable/core/__tests__/PluginRegistry.unit.test.tsx +0 -207
  256. package/src/components/DataTable/core/__tests__/StateManager.unit.test.ts +0 -278
  257. package/src/components/DataTable/examples/__tests__/PerformanceExample.unit.test.tsx +0 -281
  258. package/src/components/DataTable/hooks/__tests__/useColumnOrderPersistence.unit.test.ts +0 -407
  259. package/src/components/DataTable/hooks/__tests__/useColumnReordering.unit.test.ts +0 -679
  260. package/src/components/DataTable/utils/__tests__/debugTools.unit.test.ts +0 -267
  261. package/src/components/DataTable/utils/__tests__/errorHandling.unit.test.ts +0 -467
  262. package/src/components/DataTable/utils/__tests__/exportUtils.unit.test.ts +0 -380
  263. package/src/components/DataTable/utils/__tests__/flexibleImport.unit.test.ts +0 -233
  264. package/src/components/DataTable/utils/__tests__/performanceUtils.unit.test.ts +0 -414
  265. package/src/components/Dialog/__tests__/Dialog.accessibility.test.tsx +0 -521
  266. package/src/components/Dialog/__tests__/Dialog.auto-size.example.tsx +0 -157
  267. package/src/components/Dialog/__tests__/Dialog.enhanced.test.tsx +0 -538
  268. package/src/components/Dialog/__tests__/Dialog.unit.test.tsx +0 -1373
  269. package/src/components/Dialog/examples/__tests__/SmartDialogExample.unit.test.tsx +0 -151
  270. package/src/components/Dialog/utils/__tests__/safeHtml.unit.test.ts +0 -611
  271. package/src/components/ErrorBoundary/__tests__/ErrorBoundary.accessibility.test.tsx +0 -517
  272. package/src/components/ErrorBoundary/__tests__/ErrorBoundary.integration.test.tsx +0 -572
  273. package/src/components/ErrorBoundary/__tests__/ErrorBoundary.unit.test.tsx +0 -579
  274. package/src/components/EventSelector/__tests__/EventSelector.test.tsx +0 -528
  275. package/src/components/FileUpload/__tests__/FileUpload.integration.test.tsx +0 -992
  276. package/src/components/FileUpload/__tests__/FileUpload.real.test.tsx +0 -927
  277. package/src/components/FileUpload/__tests__/FileUpload.test.tsx +0 -855
  278. package/src/components/FileUpload/__tests__/FileUpload.unit.test.tsx +0 -1311
  279. package/src/components/FileUpload/__tests__/FileUpload.unmocked.test.tsx +0 -937
  280. package/src/components/Footer/__tests__/Footer.accessibility.test.tsx +0 -359
  281. package/src/components/Footer/__tests__/Footer.integration.test.tsx +0 -353
  282. package/src/components/Footer/__tests__/Footer.performance.test.tsx +0 -309
  283. package/src/components/Footer/__tests__/Footer.unit.test.tsx +0 -309
  284. package/src/components/Footer/__tests__/Footer.visual.test.tsx +0 -335
  285. package/src/components/Form/__tests__/Form.accessibility.test.tsx +0 -820
  286. package/src/components/Form/__tests__/Form.unit.test.tsx +0 -305
  287. package/src/components/Form/__tests__/FormErrorSummary.unit.test.tsx +0 -285
  288. package/src/components/Form/__tests__/FormFieldset.unit.test.tsx +0 -241
  289. package/src/components/Header/__tests__/Header.accessibility.test.tsx +0 -382
  290. package/src/components/Header/__tests__/Header.comprehensive.test.tsx +0 -509
  291. package/src/components/Header/__tests__/Header.unit.test.tsx +0 -335
  292. package/src/components/InactivityWarningModal/InactivityWarningModal.test.tsx +0 -196
  293. package/src/components/InactivityWarningModal/__tests__/InactivityWarningModal.unit.test.tsx +0 -224
  294. package/src/components/Input/__tests__/Input.accessibility.test.tsx +0 -632
  295. package/src/components/Input/__tests__/Input.unit.test.tsx +0 -1121
  296. package/src/components/Label/__tests__/Label.accessibility.test.tsx +0 -239
  297. package/src/components/Label/__tests__/Label.unit.test.tsx +0 -331
  298. package/src/components/LoadingSpinner/__tests__/LoadingSpinner.accessibility.test.tsx +0 -116
  299. package/src/components/LoadingSpinner/__tests__/LoadingSpinner.unit.test.tsx +0 -144
  300. package/src/components/LoginForm/__tests__/LoginForm.accessibility.test.tsx +0 -201
  301. package/src/components/LoginForm/__tests__/LoginForm.unit.test.tsx +0 -119
  302. package/src/components/NavigationMenu/__tests__/NavigationMenu.accessibility.test.tsx +0 -378
  303. package/src/components/NavigationMenu/__tests__/NavigationMenu.enhanced.test.tsx +0 -768
  304. package/src/components/NavigationMenu/__tests__/NavigationMenu.integration.test.tsx +0 -576
  305. package/src/components/NavigationMenu/__tests__/NavigationMenu.performance.test.tsx +0 -585
  306. package/src/components/NavigationMenu/__tests__/NavigationMenu.real.component.test.tsx +0 -783
  307. package/src/components/NavigationMenu/__tests__/NavigationMenu.security.enhanced.test.tsx +0 -810
  308. package/src/components/NavigationMenu/__tests__/NavigationMenu.security.test.tsx +0 -494
  309. package/src/components/NavigationMenu/__tests__/NavigationMenu.unit.test.tsx +0 -331
  310. package/src/components/NavigationMenu/__tests__/NavigationMenu.userWorkflows.test.tsx +0 -347
  311. package/src/components/NavigationMenu/__tests__/NavigationMenu.workflows.test.tsx +0 -584
  312. package/src/components/OrganisationSelector/__tests__/OrganisationSelector.unit.test.tsx +0 -664
  313. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.accessibility.test.tsx +0 -288
  314. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +0 -893
  315. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +0 -629
  316. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.security.test.tsx +0 -782
  317. package/src/components/PaceAppLayout/__tests__/PaceAppLayout.unit.test.tsx +0 -904
  318. package/src/components/PaceLoginPage/__tests__/PaceLoginPage.accessibility.test.tsx +0 -463
  319. package/src/components/PaceLoginPage/__tests__/PaceLoginPage.integration.test.tsx +0 -586
  320. package/src/components/PaceLoginPage/__tests__/PaceLoginPage.unit.test.tsx +0 -533
  321. package/src/components/PasswordReset/__tests__/PasswordChangeForm.accessibility.test.tsx +0 -408
  322. package/src/components/PasswordReset/__tests__/PasswordChangeForm.unit.test.tsx +0 -561
  323. package/src/components/PasswordReset/__tests__/PasswordReset.integration.test.tsx +0 -304
  324. package/src/components/PasswordReset/__tests__/PasswordResetForm.accessibility.test.tsx +0 -20
  325. package/src/components/PasswordReset/__tests__/PasswordResetForm.unit.test.tsx +0 -523
  326. package/src/components/PasswordReset/__tests__/__mocks__/UnifiedAuthProvider.ts +0 -29
  327. package/src/components/Print/__tests__/Print.comprehensive.test.tsx +0 -331
  328. package/src/components/PrintButton/__tests__/PrintButton.unit.test.tsx +0 -429
  329. package/src/components/PrintButton/__tests__/PrintButtonGroup.unit.test.tsx +0 -277
  330. package/src/components/PrintButton/__tests__/PrintToolbar.unit.test.tsx +0 -264
  331. package/src/components/PrintCard/__tests__/PrintCard.unit.test.tsx +0 -233
  332. package/src/components/PrintCard/__tests__/PrintCardContent.test.tsx +0 -284
  333. package/src/components/PrintCard/__tests__/PrintCardGrid.unit.test.tsx +0 -214
  334. package/src/components/PrintCard/__tests__/PrintCardImage.unit.test.tsx +0 -264
  335. package/src/components/PrintDataTable/__tests__/PrintDataTable.unit.test.tsx +0 -361
  336. package/src/components/PrintDataTable/__tests__/PrintTableGroup.unit.test.tsx +0 -314
  337. package/src/components/PrintDataTable/__tests__/PrintTableRow.unit.test.tsx +0 -362
  338. package/src/components/PrintFooter/__tests__/PrintFooter.unit.test.tsx +0 -500
  339. package/src/components/PrintFooter/__tests__/PrintFooterContent.unit.test.tsx +0 -321
  340. package/src/components/PrintFooter/__tests__/PrintFooterInfo.unit.test.tsx +0 -335
  341. package/src/components/PrintFooter/__tests__/PrintPageNumber.unit.test.tsx +0 -340
  342. package/src/components/PrintGrid/__tests__/PrintGrid.unit.test.tsx +0 -340
  343. package/src/components/PrintGrid/__tests__/PrintGridBreakpoint.unit.test.tsx +0 -261
  344. package/src/components/PrintGrid/__tests__/PrintGridContainer.unit.test.tsx +0 -338
  345. package/src/components/PrintGrid/__tests__/PrintGridItem.unit.test.tsx +0 -338
  346. package/src/components/PrintHeader/__tests__/PrintCoverHeader.unit.test.tsx +0 -309
  347. package/src/components/PrintHeader/__tests__/PrintHeader.unit.test.tsx +0 -202
  348. package/src/components/PrintLayout/__tests__/PrintLayout.unit.test.tsx +0 -238
  349. package/src/components/PrintPageBreak/__tests__/PrintPageBreak.unit.test.tsx +0 -263
  350. package/src/components/PrintPageBreak/__tests__/PrintPageBreakGroup.unit.test.tsx +0 -239
  351. package/src/components/PrintPageBreak/__tests__/PrintPageBreakIndicator.unit.test.tsx +0 -235
  352. package/src/components/PrintSection/__tests__/PrintColumn.unit.test.tsx +0 -385
  353. package/src/components/PrintSection/__tests__/PrintDivider.unit.test.tsx +0 -373
  354. package/src/components/PrintSection/__tests__/PrintSection.unit.test.tsx +0 -390
  355. package/src/components/PrintSection/__tests__/PrintSectionContent.unit.test.tsx +0 -321
  356. package/src/components/PrintSection/__tests__/PrintSectionHeader.unit.test.tsx +0 -334
  357. package/src/components/PrintText/__tests__/PrintText.unit.test.tsx +0 -351
  358. package/src/components/Progress/__tests__/Progress.accessibility.test.tsx +0 -240
  359. package/src/components/Progress/__tests__/Progress.unit.test.tsx +0 -242
  360. package/src/components/PublicLayout/__tests__/EventLogo.test.tsx +0 -761
  361. package/src/components/PublicLayout/__tests__/PublicErrorBoundary.simplified.test.tsx +0 -228
  362. package/src/components/PublicLayout/__tests__/PublicErrorBoundary.test.tsx +0 -228
  363. package/src/components/PublicLayout/__tests__/PublicLoadingSpinner.test.tsx +0 -459
  364. package/src/components/PublicLayout/__tests__/PublicPageFooter.test.tsx +0 -362
  365. package/src/components/PublicLayout/__tests__/PublicPageHeader.test.tsx +0 -522
  366. package/src/components/PublicLayout/__tests__/PublicPageLayout.test.tsx +0 -599
  367. package/src/components/PublicLayout/__tests__/PublicPageProvider.test.tsx +0 -513
  368. package/src/components/RBAC/__tests__/PagePermissionGuard.unit.test.tsx +0 -683
  369. package/src/components/RBAC/__tests__/RBAC.integration.test.tsx +0 -573
  370. package/src/components/RBAC/__tests__/RBACGuard.unit.test.tsx +0 -467
  371. package/src/components/RBAC/__tests__/RBACProvider.accessibility.test.tsx +0 -475
  372. package/src/components/RBAC/__tests__/RBACProvider.advanced.test.tsx +0 -569
  373. package/src/components/RBAC/__tests__/RBACProvider.integration.test.tsx +0 -352
  374. package/src/components/RBAC/__tests__/RBACProvider.unit.test.tsx +0 -128
  375. package/src/components/RBAC/__tests__/RoleBasedContent.unit.test.tsx +0 -657
  376. package/src/components/Select/__tests__/SearchableSelect.unit.test.tsx +0 -437
  377. package/src/components/Select/__tests__/Select.accessibility.test.tsx +0 -1202
  378. package/src/components/Select/__tests__/Select.actual.test.tsx +0 -774
  379. package/src/components/Select/__tests__/Select.comprehensive.test.tsx +0 -837
  380. package/src/components/Select/__tests__/Select.enhanced.test.tsx +0 -1101
  381. package/src/components/Select/__tests__/Select.integration.test.tsx +0 -772
  382. package/src/components/Select/__tests__/Select.performance.test.tsx +0 -695
  383. package/src/components/Select/__tests__/Select.real-world.test.tsx +0 -1046
  384. package/src/components/Select/__tests__/Select.search-algorithms.test.tsx +0 -968
  385. package/src/components/Select/__tests__/Select.unit.test.tsx +0 -647
  386. package/src/components/Select/__tests__/Select.utils.test.tsx +0 -890
  387. package/src/components/Table/__tests__/Table.accessibility.test.tsx +0 -233
  388. package/src/components/Table/__tests__/Table.unit.test.tsx +0 -235
  389. package/src/components/Toast/__tests__/Toast.accessibility.test.tsx +0 -238
  390. package/src/components/Toast/__tests__/Toast.integration.test.tsx +0 -699
  391. package/src/components/Toast/__tests__/Toast.unit.test.tsx +0 -750
  392. package/src/components/Tooltip/__tests__/Tooltip.accessibility.test.tsx +0 -121
  393. package/src/components/Tooltip/__tests__/Tooltip.unit.test.tsx +0 -185
  394. package/src/components/UserMenu/__tests__/UserMenu.accessibility.test.tsx +0 -139
  395. package/src/components/UserMenu/__tests__/UserMenu.integration.test.tsx +0 -188
  396. package/src/components/UserMenu/__tests__/UserMenu.unit.test.tsx +0 -458
  397. package/src/components/__tests__/EdgeCaseTesting.enhanced.test.tsx +0 -524
  398. package/src/components/__tests__/ErrorTesting.enhanced.test.tsx +0 -455
  399. package/src/components/__tests__/SuperAdminGuard.test.tsx +0 -456
  400. package/src/components/__tests__/SuperAdminGuard.unit.test.tsx +0 -456
  401. package/src/components/examples/__tests__/PermissionExample.unit.test.tsx +0 -360
  402. package/src/hooks/__tests__/hooks.integration.test.tsx +0 -575
  403. package/src/hooks/__tests__/useApiFetch.unit.test.ts +0 -115
  404. package/src/hooks/__tests__/useComponentPerformance.unit.test.tsx +0 -133
  405. package/src/hooks/__tests__/useDebounce.unit.test.ts +0 -82
  406. package/src/hooks/__tests__/useFocusTrap.unit.test.tsx +0 -293
  407. package/src/hooks/__tests__/useInactivityTracker.unit.test.ts +0 -385
  408. package/src/hooks/__tests__/useOrganisationPermissions.unit.test.tsx +0 -286
  409. package/src/hooks/__tests__/useOrganisationSecurity.unit.test.tsx +0 -838
  410. package/src/hooks/__tests__/usePermissionCache.unit.test.ts +0 -627
  411. package/src/hooks/__tests__/useRBAC.unit.test.ts +0 -911
  412. package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +0 -537
  413. package/src/hooks/__tests__/useToast.unit.test.tsx +0 -62
  414. package/src/hooks/__tests__/useZodForm.unit.test.tsx +0 -37
  415. package/src/hooks/public/__tests__/usePublicEvent.test.tsx +0 -397
  416. package/src/hooks/public/__tests__/usePublicEventLogo.test.tsx +0 -690
  417. package/src/hooks/public/__tests__/usePublicRouteParams.test.tsx +0 -449
  418. package/src/providers/__tests__/EventProvider.unit.test.tsx +0 -768
  419. package/src/providers/__tests__/OrganisationProvider.basic.test.tsx +0 -116
  420. package/src/providers/__tests__/OrganisationProvider.unit.test.tsx +0 -1312
  421. package/src/providers/__tests__/UnifiedAuthProvider.inactivity.test.tsx +0 -601
  422. package/src/providers/__tests__/UnifiedAuthProvider.unit.test.tsx +0 -683
  423. package/src/providers/__tests__/index.unit.test.ts +0 -78
  424. package/src/rbac/__tests__/PagePermissionGuard.test.tsx +0 -673
  425. package/src/rbac/__tests__/README.md +0 -170
  426. package/src/rbac/__tests__/RoleBasedRouter.test.tsx +0 -709
  427. package/src/rbac/__tests__/TestContext.tsx +0 -72
  428. package/src/rbac/__tests__/__mocks__/cache.ts +0 -144
  429. package/src/rbac/__tests__/__mocks__/supabase.ts +0 -152
  430. package/src/rbac/__tests__/adapters-hooks-comprehensive.test.tsx +0 -782
  431. package/src/rbac/__tests__/adapters-hooks.test.tsx +0 -561
  432. package/src/rbac/__tests__/adapters.comprehensive.test.tsx +0 -963
  433. package/src/rbac/__tests__/adapters.test.tsx +0 -444
  434. package/src/rbac/__tests__/api.test.ts +0 -620
  435. package/src/rbac/__tests__/audit-observability-comprehensive.test.ts +0 -792
  436. package/src/rbac/__tests__/audit-observability.test.ts +0 -549
  437. package/src/rbac/__tests__/audit.test.ts +0 -616
  438. package/src/rbac/__tests__/build-contract-compliance-simple.test.ts +0 -230
  439. package/src/rbac/__tests__/cache-invalidation-comprehensive.test.ts +0 -889
  440. package/src/rbac/__tests__/cache-invalidation.test.ts +0 -457
  441. package/src/rbac/__tests__/cache.test.ts +0 -458
  442. package/src/rbac/__tests__/components-navigation-guard.enhanced.test.tsx +0 -859
  443. package/src/rbac/__tests__/components-navigation-guard.test.tsx +0 -895
  444. package/src/rbac/__tests__/components-navigation-provider.test.tsx +0 -692
  445. package/src/rbac/__tests__/components-page-permission-guard.test.tsx +0 -673
  446. package/src/rbac/__tests__/components-page-permission-provider.test.tsx +0 -614
  447. package/src/rbac/__tests__/components-permission-enforcer.enhanced.fixed.test.tsx +0 -836
  448. package/src/rbac/__tests__/components-permission-enforcer.enhanced.test.tsx +0 -837
  449. package/src/rbac/__tests__/components-permission-enforcer.test.tsx +0 -825
  450. package/src/rbac/__tests__/components-role-based-router.test.tsx +0 -709
  451. package/src/rbac/__tests__/components-secure-data-provider.test.tsx +0 -607
  452. package/src/rbac/__tests__/config.test.ts +0 -583
  453. package/src/rbac/__tests__/core-logic-unit.test.ts +0 -190
  454. package/src/rbac/__tests__/core-permission-logic-comprehensive.test.ts +0 -1467
  455. package/src/rbac/__tests__/core-permission-logic-fixed.test.ts +0 -151
  456. package/src/rbac/__tests__/core-permission-logic-simple.test.ts +0 -968
  457. package/src/rbac/__tests__/core-permission-logic.test.ts +0 -966
  458. package/src/rbac/__tests__/edge-cases-comprehensive.test.ts +0 -988
  459. package/src/rbac/__tests__/edge-cases.test.ts +0 -654
  460. package/src/rbac/__tests__/engine.test.ts +0 -361
  461. package/src/rbac/__tests__/engine.unit.test.ts +0 -361
  462. package/src/rbac/__tests__/hooks.enhanced.test.tsx +0 -979
  463. package/src/rbac/__tests__/hooks.fixed.test.tsx +0 -475
  464. package/src/rbac/__tests__/hooks.test.tsx +0 -385
  465. package/src/rbac/__tests__/index.test.ts +0 -269
  466. package/src/rbac/__tests__/integration.enhanced.test.tsx +0 -824
  467. package/src/rbac/__tests__/page-permission-guard-super-admin.test.tsx +0 -261
  468. package/src/rbac/__tests__/performance.enhanced.test.tsx +0 -724
  469. package/src/rbac/__tests__/permissions.test.ts +0 -383
  470. package/src/rbac/__tests__/requires-event.test.ts +0 -330
  471. package/src/rbac/__tests__/scope-isolation-comprehensive.test.ts +0 -1349
  472. package/src/rbac/__tests__/scope-isolation.test.ts +0 -755
  473. package/src/rbac/__tests__/secure-client-rls-comprehensive.test.ts +0 -592
  474. package/src/rbac/__tests__/secure-client-rls.test.ts +0 -377
  475. package/src/rbac/__tests__/security.test.ts +0 -296
  476. package/src/rbac/__tests__/setup.ts +0 -228
  477. package/src/rbac/__tests__/test-utils-enhanced.tsx +0 -400
  478. package/src/rbac/__tests__/types.test.ts +0 -685
  479. package/src/rbac/components/__tests__/EnhancedNavigationMenu.test.tsx +0 -631
  480. package/src/rbac/components/__tests__/NavigationProvider.test.tsx +0 -667
  481. package/src/rbac/components/__tests__/PagePermissionProvider.test.tsx +0 -647
  482. package/src/rbac/components/__tests__/SecureDataProvider.test.tsx +0 -496
  483. package/src/rbac/testing/__tests__/index.test.tsx +0 -342
  484. package/src/rbac/utils/__tests__/eventContext.test.ts +0 -428
  485. package/src/rbac/utils/__tests__/eventContext.unit.test.ts +0 -428
  486. package/src/styles/__tests__/styles.unit.test.ts +0 -164
  487. package/src/test-dom-cleanup.test.tsx +0 -38
  488. package/src/theming/__tests__/README.md +0 -335
  489. package/src/theming/__tests__/runtime.accessibility.test.ts +0 -474
  490. package/src/theming/__tests__/runtime.error.test.ts +0 -616
  491. package/src/theming/__tests__/runtime.integration.test.ts +0 -376
  492. package/src/theming/__tests__/runtime.performance.test.ts +0 -411
  493. package/src/theming/__tests__/runtime.unit.test.ts +0 -470
  494. package/src/types/__tests__/database.unit.test.ts +0 -489
  495. package/src/types/__tests__/guards.unit.test.ts +0 -146
  496. package/src/types/__tests__/index.unit.test.ts +0 -77
  497. package/src/types/__tests__/organisation.unit.test.ts +0 -713
  498. package/src/types/__tests__/rbac.unit.test.ts +0 -621
  499. package/src/types/__tests__/security.unit.test.ts +0 -347
  500. package/src/types/__tests__/supabase.unit.test.ts +0 -658
  501. package/src/types/__tests__/theme.unit.test.ts +0 -218
  502. package/src/types/__tests__/unified.unit.test.ts +0 -537
  503. package/src/types/__tests__/validation.unit.test.ts +0 -616
  504. package/src/utils/__tests__/appConfig.unit.test.ts +0 -55
  505. package/src/utils/__tests__/appNameResolver.unit.test.ts +0 -137
  506. package/src/utils/__tests__/audit.unit.test.ts +0 -69
  507. package/src/utils/__tests__/auth-utils.unit.test.ts +0 -70
  508. package/src/utils/__tests__/bundleAnalysis.unit.test.ts +0 -317
  509. package/src/utils/__tests__/cn.unit.test.ts +0 -34
  510. package/src/utils/__tests__/deviceFingerprint.unit.test.ts +0 -480
  511. package/src/utils/__tests__/dynamicUtils.unit.test.ts +0 -322
  512. package/src/utils/__tests__/formatDate.unit.test.ts +0 -109
  513. package/src/utils/__tests__/formatting.unit.test.ts +0 -66
  514. package/src/utils/__tests__/index.unit.test.ts +0 -251
  515. package/src/utils/__tests__/lazyLoad.unit.test.tsx +0 -304
  516. package/src/utils/__tests__/organisationContext.unit.test.ts +0 -192
  517. package/src/utils/__tests__/performanceBudgets.unit.test.ts +0 -259
  518. package/src/utils/__tests__/permissionTypes.unit.test.ts +0 -250
  519. package/src/utils/__tests__/permissionUtils.unit.test.ts +0 -362
  520. package/src/utils/__tests__/sanitization.unit.test.ts +0 -346
  521. package/src/utils/__tests__/schemaUtils.unit.test.ts +0 -441
  522. package/src/utils/__tests__/secureDataAccess.unit.test.ts +0 -334
  523. package/src/utils/__tests__/secureErrors.unit.test.ts +0 -377
  524. package/src/utils/__tests__/secureStorage.unit.test.ts +0 -293
  525. package/src/utils/__tests__/security.unit.test.ts +0 -127
  526. package/src/utils/__tests__/securityMonitor.unit.test.ts +0 -280
  527. package/src/utils/__tests__/sessionTracking.unit.test.ts +0 -370
  528. package/src/utils/__tests__/validation.unit.test.ts +0 -84
  529. package/src/utils/__tests__/validationUtils.unit.test.ts +0 -571
  530. package/src/utils/print/__tests__/PrintDataProcessor.unit.test.ts +0 -219
  531. package/src/utils/print/__tests__/usePrintOptimization.unit.test.tsx +0 -353
  532. package/src/utils/storage/__tests__/config.unit.test.ts +0 -206
  533. package/src/utils/storage/__tests__/helpers.unit.test.ts +0 -648
  534. package/src/utils/storage/__tests__/index.unit.test.ts +0 -167
  535. package/src/utils/storage/__tests__/types.unit.test.ts +0 -441
  536. package/src/validation/__tests__/common.unit.test.ts +0 -101
  537. package/src/validation/__tests__/csrf.unit.test.ts +0 -302
  538. package/src/validation/__tests__/passwordSchema.unit.test.ts +0 -98
  539. package/src/validation/__tests__/sqlInjectionProtection.unit.test.ts +0 -466
  540. /package/dist/{DataTable-EEUDXPE5.js.map → DataTable-GX3XERFJ.js.map} +0 -0
  541. /package/dist/{chunk-VYG4AXYW.js.map → chunk-5EL3KHOQ.js.map} +0 -0
@@ -1,13 +1,985 @@
1
1
  import {
2
+ AccessLevel,
3
+ init_unified
4
+ } from "./chunk-YDJW5XTN.js";
5
+ import {
6
+ DebugLogger,
2
7
  cn,
3
- init_cn
4
- } from "./chunk-OHXGNT3K.js";
8
+ init_cn,
9
+ init_debugLogger
10
+ } from "./chunk-OYRY44Q2.js";
5
11
  import {
6
12
  __commonJS,
7
13
  __esm,
14
+ __export,
8
15
  __toESM
9
16
  } from "./chunk-PLDDJCW6.js";
10
17
 
18
+ // src/providers/AuthProvider.tsx
19
+ import { createContext, useContext, useState, useEffect, useCallback, useMemo } from "react";
20
+ import { AuthError } from "@supabase/supabase-js";
21
+ import { jsx } from "react/jsx-runtime";
22
+ function AuthProvider({ children, supabaseClient }) {
23
+ const [user, setUser] = useState(null);
24
+ const [session, setSession] = useState(null);
25
+ const [authLoading, setAuthLoading] = useState(true);
26
+ const [authError, setAuthError] = useState(null);
27
+ useEffect(() => {
28
+ const handleError = (event) => {
29
+ if (event.error?.message?.includes("AuthSessionMissingError") || event.error?.message?.includes("Auth session missing")) {
30
+ console.warn("[AuthProvider] Suppressing AuthSessionMissingError during logout");
31
+ event.preventDefault();
32
+ return false;
33
+ }
34
+ };
35
+ const handleUnhandledRejection = (event) => {
36
+ if (event.reason?.message?.includes("AuthSessionMissingError") || event.reason?.message?.includes("Auth session missing")) {
37
+ console.warn("[AuthProvider] Suppressing unhandled AuthSessionMissingError");
38
+ event.preventDefault();
39
+ return false;
40
+ }
41
+ };
42
+ window.addEventListener("error", handleError);
43
+ window.addEventListener("unhandledrejection", handleUnhandledRejection);
44
+ return () => {
45
+ window.removeEventListener("error", handleError);
46
+ window.removeEventListener("unhandledrejection", handleUnhandledRejection);
47
+ };
48
+ }, []);
49
+ useEffect(() => {
50
+ if (!supabaseClient) return;
51
+ const loadInitialUser = async () => {
52
+ try {
53
+ const response = await supabaseClient.auth.getUser();
54
+ const { data: { user: initialUser }, error } = response || { data: { user: null }, error: null };
55
+ if (error) {
56
+ console.warn("Failed to get initial user:", error);
57
+ setAuthLoading(false);
58
+ return;
59
+ }
60
+ if (initialUser) {
61
+ setUser(initialUser);
62
+ }
63
+ setAuthLoading(false);
64
+ } catch (error) {
65
+ console.error("Error loading initial user:", error);
66
+ setAuthLoading(false);
67
+ }
68
+ };
69
+ const timeoutId = setTimeout(() => {
70
+ if (authLoading && !user && !session) {
71
+ loadInitialUser();
72
+ }
73
+ }, 100);
74
+ return () => clearTimeout(timeoutId);
75
+ }, [supabaseClient, authLoading, user, session]);
76
+ useEffect(() => {
77
+ if (!supabaseClient) {
78
+ setAuthLoading(false);
79
+ return;
80
+ }
81
+ const timeoutId = setTimeout(() => {
82
+ if (authLoading) {
83
+ console.warn("AuthProvider: Auth loading timeout reached");
84
+ setAuthLoading(false);
85
+ }
86
+ }, 2e3);
87
+ try {
88
+ DebugLogger.log("AuthProvider", "Setting up auth state change listener...");
89
+ const authStateChange = supabaseClient.auth.onAuthStateChange(
90
+ (event, session2) => {
91
+ try {
92
+ DebugLogger.log("AuthProvider", "Auth state changed:", event, session2?.user?.email);
93
+ clearTimeout(timeoutId);
94
+ if (event === "SIGNED_OUT") {
95
+ DebugLogger.log("AuthProvider", "User signed out, clearing all state");
96
+ setSession(null);
97
+ setUser(null);
98
+ setAuthLoading(false);
99
+ setAuthError(null);
100
+ } else {
101
+ setSession(session2);
102
+ setUser(session2?.user ?? null);
103
+ setAuthLoading(false);
104
+ if (session2) {
105
+ setAuthError(null);
106
+ }
107
+ }
108
+ } catch (error) {
109
+ console.warn("[AuthProvider] Error in auth state change handler:", error);
110
+ setAuthLoading(false);
111
+ }
112
+ }
113
+ );
114
+ const subscription = authStateChange?.data?.subscription || authStateChange;
115
+ return () => {
116
+ clearTimeout(timeoutId);
117
+ if (subscription && typeof subscription.unsubscribe === "function") {
118
+ DebugLogger.log("AuthProvider", "Cleaning up auth state listener");
119
+ subscription.unsubscribe();
120
+ }
121
+ };
122
+ } catch (error) {
123
+ console.error("AuthProvider: Error setting up auth state change listener:", error);
124
+ if (error instanceof Error && !error.message.includes("No API key found") && !error.message.includes("AuthSessionMissingError") && !error.message.includes("Auth session missing")) {
125
+ setAuthError(error);
126
+ }
127
+ setAuthLoading(false);
128
+ clearTimeout(timeoutId);
129
+ return () => {
130
+ };
131
+ }
132
+ }, [supabaseClient]);
133
+ const signIn = useCallback(async (email, password) => {
134
+ if (!supabaseClient) {
135
+ const error = new Error("No Supabase client provided");
136
+ setAuthError(error);
137
+ return { error };
138
+ }
139
+ setAuthLoading(true);
140
+ setAuthError(null);
141
+ try {
142
+ const { error } = await supabaseClient.auth.signInWithPassword({ email, password: password || "" });
143
+ if (error) {
144
+ setAuthError(error);
145
+ }
146
+ return { error };
147
+ } catch (err) {
148
+ const authError2 = err;
149
+ setAuthError(authError2);
150
+ return { error: authError2 };
151
+ } finally {
152
+ setAuthLoading(false);
153
+ }
154
+ }, [supabaseClient]);
155
+ const signUp = useCallback(async (email, password) => {
156
+ if (!supabaseClient) {
157
+ const error = new Error("No Supabase client provided");
158
+ setAuthError(error);
159
+ return { error };
160
+ }
161
+ setAuthError(null);
162
+ try {
163
+ const { error } = await supabaseClient.auth.signUp({ email, password });
164
+ if (error) {
165
+ setAuthError(error);
166
+ }
167
+ return { error };
168
+ } catch (err) {
169
+ const authError2 = err;
170
+ setAuthError(authError2);
171
+ return { error: authError2 };
172
+ }
173
+ }, [supabaseClient]);
174
+ const signOut = useCallback(async () => {
175
+ DebugLogger.log("AuthProvider", "signOut called");
176
+ setAuthLoading(false);
177
+ if (!supabaseClient) {
178
+ DebugLogger.log("AuthProvider", "No supabase client, clearing state manually");
179
+ setUser(null);
180
+ setSession(null);
181
+ setAuthError(null);
182
+ return { error: null };
183
+ }
184
+ DebugLogger.log("AuthProvider", "Pre-clearing state before signOut call");
185
+ setUser(null);
186
+ setSession(null);
187
+ setAuthError(null);
188
+ try {
189
+ DebugLogger.log("AuthProvider", "Calling supabase signOut");
190
+ const signOutPromise = supabaseClient.auth.signOut();
191
+ const timeoutPromise = new Promise(
192
+ (_, reject) => setTimeout(() => reject(new Error("SignOut timeout")), 3e3)
193
+ );
194
+ const { error } = await Promise.race([signOutPromise, timeoutPromise]);
195
+ if (error && !error.message?.includes("SignOut timeout")) {
196
+ console.error("[AuthProvider] signOut error:", error);
197
+ }
198
+ DebugLogger.log("AuthProvider", "signOut process completed");
199
+ return { error: null };
200
+ } catch (err) {
201
+ console.warn("[AuthProvider] signOut exception (ignored):", err);
202
+ return { error: null };
203
+ }
204
+ }, [supabaseClient]);
205
+ const resetPassword = useCallback(async (email) => {
206
+ if (!supabaseClient) {
207
+ const error = new Error("No Supabase client provided");
208
+ setAuthError(error);
209
+ return { error };
210
+ }
211
+ setAuthError(null);
212
+ try {
213
+ const { error } = await supabaseClient.auth.resetPasswordForEmail(email);
214
+ if (error) {
215
+ setAuthError(error);
216
+ }
217
+ return { error };
218
+ } catch (err) {
219
+ const authError2 = err;
220
+ setAuthError(authError2);
221
+ return { error: authError2 };
222
+ }
223
+ }, [supabaseClient]);
224
+ const updatePassword = useCallback(async (password) => {
225
+ if (!supabaseClient) return { error: new AuthError("Supabase client not available.", 500) };
226
+ const { error } = await supabaseClient.auth.updateUser({ password });
227
+ if (error) {
228
+ setAuthError(error);
229
+ }
230
+ return { error };
231
+ }, [supabaseClient]);
232
+ const refreshSession = useCallback(async () => {
233
+ if (!supabaseClient) {
234
+ const error = new Error("No Supabase client provided");
235
+ setAuthError(error);
236
+ return { error };
237
+ }
238
+ setAuthError(null);
239
+ try {
240
+ const { error } = await supabaseClient.auth.refreshSession();
241
+ if (error) {
242
+ setAuthError(error);
243
+ }
244
+ return { error };
245
+ } catch (err) {
246
+ const authError2 = err;
247
+ setAuthError(authError2);
248
+ return { error: authError2 };
249
+ }
250
+ }, [supabaseClient]);
251
+ const isAuthenticated = !!user;
252
+ const contextValue = useMemo(() => ({
253
+ user,
254
+ session,
255
+ isAuthenticated,
256
+ authLoading,
257
+ authError,
258
+ error: authError,
259
+ // Alias for backward compatibility
260
+ supabase: supabaseClient || null,
261
+ signIn,
262
+ signUp,
263
+ signOut,
264
+ resetPassword,
265
+ updatePassword,
266
+ refreshSession
267
+ }), [
268
+ user,
269
+ session,
270
+ isAuthenticated,
271
+ authLoading,
272
+ authError,
273
+ supabaseClient,
274
+ signIn,
275
+ signUp,
276
+ signOut,
277
+ resetPassword,
278
+ updatePassword,
279
+ refreshSession
280
+ ]);
281
+ return /* @__PURE__ */ jsx(AuthContext.Provider, { value: contextValue, children });
282
+ }
283
+ var AuthContext, useAuth;
284
+ var init_AuthProvider = __esm({
285
+ "src/providers/AuthProvider.tsx"() {
286
+ "use strict";
287
+ init_debugLogger();
288
+ AuthContext = createContext(void 0);
289
+ useAuth = () => {
290
+ const context = useContext(AuthContext);
291
+ if (!context) {
292
+ throw new Error("useAuth must be used within an AuthProvider");
293
+ }
294
+ return context;
295
+ };
296
+ }
297
+ });
298
+
299
+ // src/providers/RBACProvider.tsx
300
+ import { createContext as createContext2, useContext as useContext2, useState as useState2, useEffect as useEffect2, useCallback as useCallback2, useMemo as useMemo2 } from "react";
301
+ import { jsx as jsx2 } from "react/jsx-runtime";
302
+ function RBACProvider({
303
+ children,
304
+ supabaseClient,
305
+ user,
306
+ session,
307
+ appName,
308
+ enableRBAC = false,
309
+ persistState = true,
310
+ enablePersistence,
311
+ requireOrganisationContext: _requireOrganisationContext = true
312
+ }) {
313
+ const shouldPersist = enablePersistence !== void 0 ? enablePersistence : persistState;
314
+ const [permissions, setPermissions] = useState2({});
315
+ const [roles, setRoles] = useState2([]);
316
+ const [accessLevel, setAccessLevel] = useState2("viewer" /* VIEWER */);
317
+ const [rbacLoading, setRbacLoading] = useState2(false);
318
+ const [rbacError, setRbacError] = useState2(null);
319
+ const [selectedEventId, setSelectedEventId] = useState2(null);
320
+ const [appConfig, setAppConfig] = useState2(null);
321
+ const [userEventAccess, setUserEventAccess] = useState2([]);
322
+ const [eventAccessLoading, setEventAccessLoading] = useState2(false);
323
+ const [selectedOrganisationId, _setSelectedOrganisationId] = useState2(null);
324
+ useEffect2(() => {
325
+ if (!supabaseClient) return;
326
+ const loadAppConfig = async () => {
327
+ try {
328
+ const { getCurrentAppName } = await import("./appNameResolver-7GHF5ED2.js");
329
+ const resolvedAppName = getCurrentAppName() || appName;
330
+ const { data: appData, error: appError } = await supabaseClient.from("rbac_apps").select("id").eq("name", resolvedAppName).eq("is_active", true).single();
331
+ if (appError || !appData) {
332
+ console.warn("App not found or inactive:", resolvedAppName);
333
+ setAppConfig({
334
+ supports_direct_access: false,
335
+ requires_event: true
336
+ });
337
+ return;
338
+ }
339
+ const response = await supabaseClient.rpc("get_app_config", {
340
+ p_app_id: appData.id
341
+ });
342
+ const { data } = response || {};
343
+ if (data && data.length > 0) {
344
+ setAppConfig({
345
+ supports_direct_access: data[0].supports_direct_access,
346
+ requires_event: data[0].requires_event
347
+ });
348
+ } else {
349
+ setAppConfig({
350
+ supports_direct_access: false,
351
+ requires_event: true
352
+ });
353
+ }
354
+ } catch (error) {
355
+ console.warn("Clearing corrupted localStorage data");
356
+ if (typeof localStorage !== "undefined") {
357
+ localStorage.removeItem(STORAGE_KEYS.SELECTED_EVENT);
358
+ }
359
+ console.warn("Failed to load app configuration:", error);
360
+ setAppConfig({
361
+ supports_direct_access: false,
362
+ requires_event: true
363
+ });
364
+ }
365
+ };
366
+ loadAppConfig();
367
+ }, [supabaseClient, appName]);
368
+ useEffect2(() => {
369
+ const isSuperAdmin = user?.user_metadata?.globalRole === "super_admin";
370
+ if (isSuperAdmin) {
371
+ setRoles(["super_admin"]);
372
+ } else {
373
+ setRoles([]);
374
+ }
375
+ }, [user]);
376
+ useEffect2(() => {
377
+ if (!shouldPersist) return;
378
+ try {
379
+ const persistedEvent = localStorage.getItem(STORAGE_KEYS.SELECTED_EVENT);
380
+ if (persistedEvent) {
381
+ setSelectedEventId(JSON.parse(persistedEvent));
382
+ }
383
+ } catch (error) {
384
+ console.warn("Clearing corrupted localStorage data");
385
+ localStorage.removeItem(STORAGE_KEYS.SELECTED_EVENT);
386
+ }
387
+ }, [shouldPersist]);
388
+ useEffect2(() => {
389
+ if (!shouldPersist) return;
390
+ try {
391
+ if (selectedEventId) {
392
+ localStorage.setItem(
393
+ STORAGE_KEYS.SELECTED_EVENT,
394
+ JSON.stringify(selectedEventId)
395
+ );
396
+ } else {
397
+ localStorage.removeItem(STORAGE_KEYS.SELECTED_EVENT);
398
+ }
399
+ } catch (error) {
400
+ console.warn("Clearing corrupted localStorage data");
401
+ localStorage.removeItem(STORAGE_KEYS.SELECTED_EVENT);
402
+ console.warn("Failed to persist auth state:", error);
403
+ }
404
+ }, [selectedEventId, shouldPersist]);
405
+ const refreshPermissions = useCallback2(async (eventId) => {
406
+ if (!supabaseClient || !user || !appConfig || !session) {
407
+ DebugLogger.log("RBACProvider", "refreshPermissions: Missing required dependencies, clearing permissions");
408
+ setPermissions({});
409
+ setRoles([]);
410
+ setAccessLevel("viewer" /* VIEWER */);
411
+ return;
412
+ }
413
+ const isSuperAdmin = user?.user_metadata?.globalRole === "super_admin";
414
+ if (isSuperAdmin) {
415
+ setPermissions({
416
+ "admin:create": true,
417
+ "admin:read": true,
418
+ "admin:update": true,
419
+ "admin:delete": true,
420
+ "users:create": true,
421
+ "users:read": true,
422
+ "users:update": true,
423
+ "users:delete": true,
424
+ "events:create": true,
425
+ "events:read": true,
426
+ "events:update": true,
427
+ "events:delete": true
428
+ });
429
+ setRoles(["super_admin"]);
430
+ setAccessLevel("admin" /* ADMIN */);
431
+ return;
432
+ }
433
+ const shouldLoadDirectPermissions = !eventId && !appConfig.requires_event;
434
+ const shouldLoadEventPermissions = eventId;
435
+ const shouldClearPermissions = !eventId && appConfig.requires_event;
436
+ if (shouldClearPermissions) {
437
+ setPermissions({});
438
+ setRoles([]);
439
+ setAccessLevel("viewer" /* VIEWER */);
440
+ return;
441
+ }
442
+ if (!shouldLoadDirectPermissions && !shouldLoadEventPermissions) {
443
+ return;
444
+ }
445
+ setRbacLoading(true);
446
+ setRbacError(null);
447
+ try {
448
+ const { getCurrentAppName } = await import("./appNameResolver-7GHF5ED2.js");
449
+ const resolvedAppName = getCurrentAppName() || appName;
450
+ const { data: appData, error: appError } = await supabaseClient.from("rbac_apps").select("id").eq("name", resolvedAppName).eq("is_active", true).single();
451
+ if (appError || !appData) {
452
+ console.warn("App not found or inactive:", resolvedAppName);
453
+ setRbacLoading(false);
454
+ return;
455
+ }
456
+ const { data, error } = await supabaseClient.rpc("get_rbac_permissions", {
457
+ p_user_id: user.id,
458
+ p_app_id: appData.id,
459
+ p_event_id: eventId || null,
460
+ p_organisation_id: selectedOrganisationId || null
461
+ });
462
+ if (error) {
463
+ throw error;
464
+ }
465
+ const { permissions: permissions2, roles: roles2, access_level } = transformRBACPermissions(data, appName);
466
+ setPermissions(permissions2);
467
+ setRoles(roles2);
468
+ setAccessLevel(access_level);
469
+ } catch (err) {
470
+ setRbacError(err);
471
+ } finally {
472
+ setRbacLoading(false);
473
+ }
474
+ }, [supabaseClient, user, session, appName, appConfig, selectedOrganisationId]);
475
+ const loadUserEventAccess = useCallback2(async () => {
476
+ if (!supabaseClient || !user || !session) {
477
+ DebugLogger.log("RBACProvider", "loadUserEventAccess: Missing required dependencies, clearing event access");
478
+ setUserEventAccess([]);
479
+ return;
480
+ }
481
+ setEventAccessLoading(true);
482
+ try {
483
+ const { getCurrentAppName } = await import("./appNameResolver-7GHF5ED2.js");
484
+ const resolvedAppName = getCurrentAppName() || appName;
485
+ const { data: appData, error: appError } = await supabaseClient.from("rbac_apps").select("id").eq("name", resolvedAppName).eq("is_active", true).single();
486
+ if (appError || !appData) {
487
+ console.warn("App not found or inactive:", resolvedAppName);
488
+ setEventAccessLoading(false);
489
+ return;
490
+ }
491
+ const { data, error } = await supabaseClient.from("rbac_event_app_roles").select(`
492
+ event_id,
493
+ role,
494
+ granted_at
495
+ `).eq("user_id", user.id).eq("app_id", appData.id);
496
+ if (error) {
497
+ console.error("Failed to load user event access:", error);
498
+ setUserEventAccess([]);
499
+ return;
500
+ }
501
+ const eventAccess = data?.map((item) => ({
502
+ event_id: item.event_id,
503
+ event_name: "Unknown Event",
504
+ // Event details not available in this query
505
+ event_description: null,
506
+ // Not available in this schema
507
+ start_date: "",
508
+ // Event date not available in this query
509
+ end_date: "",
510
+ // Event date not available in this query
511
+ event_status: "unknown",
512
+ // Not available in this schema
513
+ app_id: appData.id,
514
+ access_level: item.role,
515
+ // Map role to access_level
516
+ granted_at: item.granted_at,
517
+ organisation_id: ""
518
+ // Will be populated from event's organisation_id if needed
519
+ })) || [];
520
+ setUserEventAccess(eventAccess);
521
+ } catch (error) {
522
+ console.warn("Clearing corrupted localStorage data");
523
+ localStorage.removeItem(STORAGE_KEYS.SELECTED_EVENT);
524
+ console.error("Error loading user event access:", error);
525
+ setUserEventAccess([]);
526
+ } finally {
527
+ setEventAccessLoading(false);
528
+ }
529
+ }, [supabaseClient, user, session, appName]);
530
+ const getUserEventAccess = useCallback2((eventId) => {
531
+ return userEventAccess.find((access) => access.event_id === eventId);
532
+ }, [userEventAccess]);
533
+ useEffect2(() => {
534
+ if (!user || !appConfig || !session) {
535
+ DebugLogger.log("RBACProvider", "Skipping permission refresh - no user, session, or app config");
536
+ return;
537
+ }
538
+ const isSuperAdmin = user?.user_metadata?.globalRole === "super_admin";
539
+ if (isSuperAdmin) {
540
+ setPermissions({
541
+ "admin:create": true,
542
+ "admin:read": true,
543
+ "admin:update": true,
544
+ "admin:delete": true,
545
+ "users:create": true,
546
+ "users:read": true,
547
+ "users:update": true,
548
+ "users:delete": true,
549
+ "events:create": true,
550
+ "events:read": true,
551
+ "events:update": true,
552
+ "events:delete": true
553
+ });
554
+ setRoles(["super_admin"]);
555
+ setAccessLevel("admin" /* ADMIN */);
556
+ return;
557
+ }
558
+ if (selectedEventId) {
559
+ refreshPermissions(selectedEventId);
560
+ } else if (!appConfig.requires_event) {
561
+ refreshPermissions();
562
+ } else {
563
+ setPermissions({});
564
+ setRoles([]);
565
+ setAccessLevel("viewer" /* VIEWER */);
566
+ }
567
+ }, [selectedEventId, user, session, appConfig, refreshPermissions]);
568
+ useEffect2(() => {
569
+ let isMounted = true;
570
+ if (user && session) {
571
+ DebugLogger.log("RBACProvider", "Loading user event access for authenticated user");
572
+ loadUserEventAccess().catch((error) => {
573
+ if (isMounted) {
574
+ console.error("Error loading user event access:", error);
575
+ }
576
+ });
577
+ } else {
578
+ DebugLogger.log("RBACProvider", "Clearing user event access - no user or session");
579
+ if (isMounted) {
580
+ setUserEventAccess([]);
581
+ }
582
+ }
583
+ return () => {
584
+ isMounted = false;
585
+ };
586
+ }, [user, session, loadUserEventAccess]);
587
+ const hasPermission = useCallback2((permission) => {
588
+ const hasPerm = !!permissions[permission];
589
+ return hasPerm;
590
+ }, [permissions]);
591
+ const hasAnyPermission = useCallback2((perms) => perms.some((p) => !!permissions[p]), [permissions]);
592
+ const hasAllPermissions = useCallback2((perms) => perms.every((p) => !!permissions[p]), [permissions]);
593
+ const hasRole = useCallback2((role) => {
594
+ const isSuperAdmin = user?.user_metadata?.globalRole === "super_admin";
595
+ if (role.toLowerCase() === "super_admin") {
596
+ return isSuperAdmin;
597
+ }
598
+ return roles.includes(role);
599
+ }, [roles, user]);
600
+ const hasAccessLevel = useCallback2((level) => {
601
+ const levels = Object.values(AccessLevel);
602
+ return levels.indexOf(accessLevel) >= levels.indexOf(level);
603
+ }, [accessLevel]);
604
+ const canAccess = useCallback2((resource, action) => {
605
+ const permission = `${resource}:${action}`;
606
+ const hasAccess = hasPermission(permission);
607
+ return hasAccess;
608
+ }, [hasPermission]);
609
+ const validatePermission = useCallback2(async (permission) => hasPermission(permission), [hasPermission]);
610
+ const validateAccess = useCallback2(async (resource, action) => {
611
+ return Promise.resolve(canAccess(resource, action));
612
+ }, [canAccess]);
613
+ const contextValue = useMemo2(() => ({
614
+ permissions,
615
+ roles,
616
+ accessLevel,
617
+ rbacLoading,
618
+ rbacError,
619
+ selectedEventId,
620
+ appConfig,
621
+ userEventAccess,
622
+ eventAccessLoading,
623
+ // Organisation context
624
+ selectedOrganisationId,
625
+ requireOrganisationContext: () => {
626
+ if (!selectedOrganisationId) {
627
+ throw new Error("Organisation context is required but not available");
628
+ }
629
+ return selectedOrganisationId;
630
+ },
631
+ hasPermission,
632
+ hasAnyPermission,
633
+ hasAllPermissions,
634
+ hasRole,
635
+ hasAccessLevel,
636
+ canAccess,
637
+ validatePermission,
638
+ validateAccess,
639
+ refreshPermissions,
640
+ setSelectedEventId,
641
+ // New RBAC system support
642
+ rbacEnabled: enableRBAC,
643
+ rbacContext: void 0,
644
+ // Will be populated by useRBAC hook when enabled
645
+ loadUserEventAccess,
646
+ getUserEventAccess
647
+ }), [
648
+ permissions,
649
+ roles,
650
+ accessLevel,
651
+ rbacLoading,
652
+ rbacError,
653
+ selectedEventId,
654
+ appConfig,
655
+ userEventAccess,
656
+ eventAccessLoading,
657
+ selectedOrganisationId,
658
+ hasPermission,
659
+ hasAnyPermission,
660
+ hasAllPermissions,
661
+ hasRole,
662
+ hasAccessLevel,
663
+ canAccess,
664
+ validatePermission,
665
+ validateAccess,
666
+ refreshPermissions,
667
+ setSelectedEventId,
668
+ enableRBAC,
669
+ loadUserEventAccess,
670
+ getUserEventAccess
671
+ ]);
672
+ return /* @__PURE__ */ jsx2(RBACContext.Provider, { value: contextValue, children });
673
+ }
674
+ var RBACContext, useRBAC, STORAGE_KEYS, transformRBACPermissions;
675
+ var init_RBACProvider = __esm({
676
+ "src/providers/RBACProvider.tsx"() {
677
+ "use strict";
678
+ init_unified();
679
+ init_debugLogger();
680
+ RBACContext = createContext2(void 0);
681
+ useRBAC = () => {
682
+ const context = useContext2(RBACContext);
683
+ if (!context) {
684
+ throw new Error("useRBAC must be used within an RBACProvider");
685
+ }
686
+ return context;
687
+ };
688
+ STORAGE_KEYS = {
689
+ SELECTED_EVENT: "pace-core-selected-event"
690
+ };
691
+ transformRBACPermissions = (rbacData, _appName) => {
692
+ const permissions = {};
693
+ let roles = [];
694
+ let access_level = "viewer" /* VIEWER */;
695
+ if (!rbacData || !Array.isArray(rbacData)) {
696
+ return { permissions: {}, roles: ["viewer"], access_level: "viewer" /* VIEWER */ };
697
+ }
698
+ const superAdminPerm = rbacData.find((p) => p.permission_type === "all_permissions");
699
+ if (superAdminPerm) {
700
+ return {
701
+ permissions: { "all:all": true },
702
+ roles: ["super"],
703
+ access_level: "super" /* SUPER */
704
+ };
705
+ }
706
+ const eventAppPerms = rbacData.filter((p) => p.permission_type === "event_app_access");
707
+ if (eventAppPerms.length > 0) {
708
+ const role = eventAppPerms[0].role_name;
709
+ switch (role) {
710
+ case "event_admin":
711
+ access_level = "admin" /* ADMIN */;
712
+ roles = ["admin"];
713
+ break;
714
+ case "planner":
715
+ access_level = "planner" /* PLANNER */;
716
+ roles = ["planner"];
717
+ break;
718
+ case "participant":
719
+ access_level = "participant" /* PARTICIPANT */;
720
+ roles = ["participant"];
721
+ break;
722
+ case "editor":
723
+ access_level = "editor" /* EDITOR */;
724
+ roles = ["editor"];
725
+ break;
726
+ case "viewer":
727
+ default:
728
+ access_level = "viewer" /* VIEWER */;
729
+ roles = ["viewer"];
730
+ break;
731
+ }
732
+ const basePermissions = ["read"];
733
+ if (["event_admin", "planner"].includes(role)) {
734
+ basePermissions.push("create", "update");
735
+ }
736
+ if (role === "event_admin") {
737
+ basePermissions.push("delete");
738
+ }
739
+ basePermissions.forEach((operation) => {
740
+ permissions[`default:${operation}`] = true;
741
+ });
742
+ }
743
+ const orgPerms = rbacData.filter((p) => p.permission_type === "organisation_access");
744
+ if (orgPerms.length > 0) {
745
+ const role = orgPerms[0].role_name;
746
+ if (role === "org_admin") {
747
+ access_level = "admin" /* ADMIN */;
748
+ roles = ["admin"];
749
+ ["create", "read", "update", "delete"].forEach((operation) => {
750
+ permissions[`default:${operation}`] = true;
751
+ });
752
+ }
753
+ }
754
+ return { permissions, roles, access_level };
755
+ };
756
+ }
757
+ });
758
+
759
+ // src/hooks/useInactivityTracker.ts
760
+ import { useState as useState3, useEffect as useEffect3, useCallback as useCallback3, useRef } from "react";
761
+ function throttle(func, limit) {
762
+ let inThrottle;
763
+ return function(...args) {
764
+ if (!inThrottle) {
765
+ func.apply(this, args);
766
+ inThrottle = true;
767
+ setTimeout(() => inThrottle = false, limit);
768
+ }
769
+ };
770
+ }
771
+ function useInactivityTracker({
772
+ idleTimeoutMs = 30 * 60 * 1e3,
773
+ // 30 minutes
774
+ warnBeforeMs = 60 * 1e3,
775
+ // 1 minute
776
+ onIdle,
777
+ onWarning,
778
+ onActivity,
779
+ enabled = true,
780
+ storageKey = "pace-core-inactivity",
781
+ channelName = "pace-core-inactivity"
782
+ } = {}) {
783
+ const [isIdle, setIsIdle] = useState3(false);
784
+ const [timeRemaining, setTimeRemaining] = useState3(idleTimeoutMs);
785
+ const [showWarning, setShowWarning] = useState3(false);
786
+ const [isTracking, setIsTracking] = useState3(false);
787
+ useEffect3(() => {
788
+ if (!enabled) {
789
+ setIsTracking(false);
790
+ setIsIdle(false);
791
+ setShowWarning(false);
792
+ setTimeRemaining(idleTimeoutMs);
793
+ }
794
+ }, [enabled, idleTimeoutMs]);
795
+ const timeoutRef = useRef(null);
796
+ const warningTimeoutRef = useRef(null);
797
+ const countdownIntervalRef = useRef(null);
798
+ const lastActivityRef = useRef(Date.now());
799
+ const channelRef = useRef(null);
800
+ const clearTimers = useCallback3(() => {
801
+ if (timeoutRef.current) {
802
+ clearTimeout(timeoutRef.current);
803
+ timeoutRef.current = null;
804
+ }
805
+ if (warningTimeoutRef.current) {
806
+ clearTimeout(warningTimeoutRef.current);
807
+ warningTimeoutRef.current = null;
808
+ }
809
+ if (countdownIntervalRef.current) {
810
+ clearInterval(countdownIntervalRef.current);
811
+ countdownIntervalRef.current = null;
812
+ }
813
+ }, []);
814
+ const resetActivity = useCallback3((skipActivityCallback = false) => {
815
+ if (!enabled) return;
816
+ const now = Date.now();
817
+ lastActivityRef.current = now;
818
+ clearTimers();
819
+ setIsIdle(false);
820
+ setShowWarning(false);
821
+ setTimeRemaining(idleTimeoutMs);
822
+ if (!skipActivityCallback) {
823
+ onActivity?.();
824
+ }
825
+ const warningTime = idleTimeoutMs - warnBeforeMs;
826
+ if (warningTime > 0) {
827
+ warningTimeoutRef.current = setTimeout(() => {
828
+ setShowWarning(true);
829
+ onWarning?.();
830
+ }, warningTime);
831
+ }
832
+ timeoutRef.current = setTimeout(() => {
833
+ setIsIdle(true);
834
+ onIdle?.();
835
+ }, idleTimeoutMs);
836
+ countdownIntervalRef.current = setInterval(() => {
837
+ const elapsed = Date.now() - lastActivityRef.current;
838
+ const remaining = Math.max(0, idleTimeoutMs - elapsed);
839
+ setTimeRemaining(remaining);
840
+ if (remaining === 0) {
841
+ clearTimers();
842
+ }
843
+ }, 1e3);
844
+ try {
845
+ localStorage.setItem(storageKey, now.toString());
846
+ } catch (error) {
847
+ console.warn("[useInactivityTracker] Failed to persist activity time:", error);
848
+ }
849
+ try {
850
+ if (channelRef.current) {
851
+ channelRef.current.postMessage({ type: "activity", timestamp: now });
852
+ }
853
+ } catch (error) {
854
+ console.warn("[useInactivityTracker] Failed to broadcast activity:", error);
855
+ }
856
+ }, [enabled, idleTimeoutMs, warnBeforeMs, onIdle, onWarning, onActivity, storageKey, clearTimers]);
857
+ const startTracking = useCallback3(() => {
858
+ if (!enabled) return;
859
+ setIsTracking(false);
860
+ setIsIdle(false);
861
+ setShowWarning(false);
862
+ setTimeRemaining(idleTimeoutMs);
863
+ clearTimers();
864
+ setIsTracking(true);
865
+ try {
866
+ if (typeof BroadcastChannel !== "undefined") {
867
+ channelRef.current = new BroadcastChannel(channelName);
868
+ channelRef.current.onmessage = (event) => {
869
+ if (event.data.type === "activity") {
870
+ lastActivityRef.current = event.data.timestamp;
871
+ resetActivity();
872
+ }
873
+ };
874
+ }
875
+ } catch (error) {
876
+ console.warn("[useInactivityTracker] Failed to set up cross-tab communication:", error);
877
+ }
878
+ try {
879
+ const persistedTime = localStorage.getItem(storageKey);
880
+ if (persistedTime) {
881
+ const persistedTimestamp = parseInt(persistedTime, 10);
882
+ const elapsed = Date.now() - persistedTimestamp;
883
+ if (elapsed < idleTimeoutMs) {
884
+ lastActivityRef.current = persistedTimestamp;
885
+ const remaining = idleTimeoutMs - elapsed;
886
+ setTimeRemaining(remaining);
887
+ if (remaining <= warnBeforeMs) {
888
+ setShowWarning(true);
889
+ onWarning?.();
890
+ }
891
+ if (remaining <= 0) {
892
+ setIsIdle(true);
893
+ onIdle?.();
894
+ return;
895
+ }
896
+ }
897
+ }
898
+ } catch (error) {
899
+ console.warn("[useInactivityTracker] Failed to check persisted activity time:", error);
900
+ }
901
+ const throttledResetActivity = throttle((event) => {
902
+ resetActivity();
903
+ }, 100);
904
+ const addEventListeners = () => {
905
+ ACTIVITY_EVENTS.forEach((event) => {
906
+ document.addEventListener(event, throttledResetActivity, { passive: true });
907
+ });
908
+ };
909
+ const removeEventListeners = () => {
910
+ ACTIVITY_EVENTS.forEach((event) => {
911
+ document.removeEventListener(event, throttledResetActivity);
912
+ });
913
+ };
914
+ addEventListeners();
915
+ resetActivity(true);
916
+ return () => {
917
+ removeEventListeners();
918
+ clearTimers();
919
+ if (channelRef.current) {
920
+ channelRef.current.close();
921
+ channelRef.current = null;
922
+ }
923
+ };
924
+ }, [enabled, isTracking, channelName, storageKey, idleTimeoutMs, warnBeforeMs, onIdle, onWarning]);
925
+ const stopTracking = useCallback3(() => {
926
+ setIsTracking(false);
927
+ clearTimers();
928
+ if (channelRef.current) {
929
+ channelRef.current.close();
930
+ channelRef.current = null;
931
+ }
932
+ }, [clearTimers]);
933
+ useEffect3(() => {
934
+ if (enabled) {
935
+ const cleanup = startTracking();
936
+ return cleanup;
937
+ } else {
938
+ stopTracking();
939
+ }
940
+ }, [enabled, idleTimeoutMs, warnBeforeMs]);
941
+ useEffect3(() => {
942
+ return () => {
943
+ clearTimers();
944
+ if (channelRef.current) {
945
+ channelRef.current.close();
946
+ }
947
+ };
948
+ }, [clearTimers]);
949
+ return {
950
+ isIdle,
951
+ timeRemaining,
952
+ showWarning,
953
+ resetActivity,
954
+ startTracking,
955
+ stopTracking,
956
+ isTracking
957
+ };
958
+ }
959
+ var ACTIVITY_EVENTS;
960
+ var init_useInactivityTracker = __esm({
961
+ "src/hooks/useInactivityTracker.ts"() {
962
+ "use strict";
963
+ ACTIVITY_EVENTS = [
964
+ "mousedown",
965
+ "mousemove",
966
+ "mouseup",
967
+ "click",
968
+ "scroll",
969
+ "wheel",
970
+ "touchstart",
971
+ "touchmove",
972
+ "touchend",
973
+ "keydown",
974
+ "keyup",
975
+ "keypress",
976
+ "focus",
977
+ "blur",
978
+ "visibilitychange"
979
+ ];
980
+ }
981
+ });
982
+
11
983
  // src/components/Dialog/utils/safeHtml.ts
12
984
  function sanitizeHtml(html) {
13
985
  if (!html || typeof html !== "string") {
@@ -761,7 +1733,7 @@ var require_lodash = __commonJS({
761
1733
  }
762
1734
  var runInContext = (function runInContext2(context) {
763
1735
  context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
764
- var Array2 = context.Array, Date = context.Date, Error = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String = context.String, TypeError = context.TypeError;
1736
+ var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String = context.String, TypeError = context.TypeError;
765
1737
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
766
1738
  var coreJsData = context["__core-js_shared__"];
767
1739
  var funcToString = funcProto.toString;
@@ -786,8 +1758,8 @@ var require_lodash = __commonJS({
786
1758
  } catch (e) {
787
1759
  }
788
1760
  })();
789
- var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date && Date.now !== root.Date.now && Date.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
790
- var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
1761
+ var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
1762
+ var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
791
1763
  var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
792
1764
  var metaMap = WeakMap && new WeakMap();
793
1765
  var realNames = {};
@@ -1286,7 +2258,7 @@ var require_lodash = __commonJS({
1286
2258
  if (typeof func != "function") {
1287
2259
  throw new TypeError(FUNC_ERROR_TEXT);
1288
2260
  }
1289
- return setTimeout(function() {
2261
+ return setTimeout2(function() {
1290
2262
  func.apply(undefined2, args);
1291
2263
  }, wait);
1292
2264
  }
@@ -2066,7 +3038,7 @@ var require_lodash = __commonJS({
2066
3038
  end = end === undefined2 ? length : end;
2067
3039
  return !start && end >= length ? array : baseSlice(array, start, end);
2068
3040
  }
2069
- var clearTimeout = ctxClearTimeout || function(id) {
3041
+ var clearTimeout2 = ctxClearTimeout || function(id) {
2070
3042
  return root.clearTimeout(id);
2071
3043
  };
2072
3044
  function cloneBuffer(buffer, isDeep) {
@@ -3117,7 +4089,7 @@ var require_lodash = __commonJS({
3117
4089
  return object[key];
3118
4090
  }
3119
4091
  var setData = shortOut(baseSetData);
3120
- var setTimeout = ctxSetTimeout || function(func, wait) {
4092
+ var setTimeout2 = ctxSetTimeout || function(func, wait) {
3121
4093
  return root.setTimeout(func, wait);
3122
4094
  };
3123
4095
  var setToString = shortOut(baseSetToString);
@@ -3909,7 +4881,7 @@ var require_lodash = __commonJS({
3909
4881
  }
3910
4882
  function leadingEdge(time) {
3911
4883
  lastInvokeTime = time;
3912
- timerId = setTimeout(timerExpired, wait);
4884
+ timerId = setTimeout2(timerExpired, wait);
3913
4885
  return leading ? invokeFunc(time) : result2;
3914
4886
  }
3915
4887
  function remainingWait(time) {
@@ -3925,7 +4897,7 @@ var require_lodash = __commonJS({
3925
4897
  if (shouldInvoke(time)) {
3926
4898
  return trailingEdge(time);
3927
4899
  }
3928
- timerId = setTimeout(timerExpired, remainingWait(time));
4900
+ timerId = setTimeout2(timerExpired, remainingWait(time));
3929
4901
  }
3930
4902
  function trailingEdge(time) {
3931
4903
  timerId = undefined2;
@@ -3937,7 +4909,7 @@ var require_lodash = __commonJS({
3937
4909
  }
3938
4910
  function cancel() {
3939
4911
  if (timerId !== undefined2) {
3940
- clearTimeout(timerId);
4912
+ clearTimeout2(timerId);
3941
4913
  }
3942
4914
  lastInvokeTime = 0;
3943
4915
  lastArgs = lastCallTime = lastThis = timerId = undefined2;
@@ -3955,13 +4927,13 @@ var require_lodash = __commonJS({
3955
4927
  return leadingEdge(lastCallTime);
3956
4928
  }
3957
4929
  if (maxing) {
3958
- clearTimeout(timerId);
3959
- timerId = setTimeout(timerExpired, wait);
4930
+ clearTimeout2(timerId);
4931
+ timerId = setTimeout2(timerExpired, wait);
3960
4932
  return invokeFunc(lastCallTime);
3961
4933
  }
3962
4934
  }
3963
4935
  if (timerId === undefined2) {
3964
- timerId = setTimeout(timerExpired, wait);
4936
+ timerId = setTimeout2(timerExpired, wait);
3965
4937
  }
3966
4938
  return result2;
3967
4939
  }
@@ -4059,7 +5031,7 @@ var require_lodash = __commonJS({
4059
5031
  return apply(func, this, otherArgs);
4060
5032
  });
4061
5033
  }
4062
- function throttle(func, wait, options) {
5034
+ function throttle2(func, wait, options) {
4063
5035
  var leading = true, trailing = true;
4064
5036
  if (typeof func != "function") {
4065
5037
  throw new TypeError(FUNC_ERROR_TEXT);
@@ -4204,7 +5176,7 @@ var require_lodash = __commonJS({
4204
5176
  }
4205
5177
  function isNative(value) {
4206
5178
  if (isMaskable(value)) {
4207
- throw new Error(CORE_ERROR_TEXT);
5179
+ throw new Error2(CORE_ERROR_TEXT);
4208
5180
  }
4209
5181
  return baseIsNative(value);
4210
5182
  }
@@ -4745,7 +5717,7 @@ var require_lodash = __commonJS({
4745
5717
  if (!variable) {
4746
5718
  source = "with (obj) {\n" + source + "\n}\n";
4747
5719
  } else if (reForbiddenIdentifierChars.test(variable)) {
4748
- throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
5720
+ throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
4749
5721
  }
4750
5722
  source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
4751
5723
  source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
@@ -4864,7 +5836,7 @@ var require_lodash = __commonJS({
4864
5836
  try {
4865
5837
  return apply(func, undefined2, args);
4866
5838
  } catch (e) {
4867
- return isError(e) ? e : new Error(e);
5839
+ return isError(e) ? e : new Error2(e);
4868
5840
  }
4869
5841
  });
4870
5842
  var bindAll = flatRest(function(object, methodNames) {
@@ -5176,7 +6148,7 @@ var require_lodash = __commonJS({
5176
6148
  lodash.takeRightWhile = takeRightWhile;
5177
6149
  lodash.takeWhile = takeWhile;
5178
6150
  lodash.tap = tap;
5179
- lodash.throttle = throttle;
6151
+ lodash.throttle = throttle2;
5180
6152
  lodash.thru = thru;
5181
6153
  lodash.toArray = toArray;
5182
6154
  lodash.toPairs = toPairs;
@@ -5551,11 +6523,11 @@ var require_lodash = __commonJS({
5551
6523
  });
5552
6524
 
5553
6525
  // src/components/Dialog/Dialog.tsx
5554
- import * as React from "react";
6526
+ import * as React3 from "react";
5555
6527
  import * as DialogPrimitive from "@radix-ui/react-dialog";
5556
6528
  import { X } from "lucide-react";
5557
- import { useState, useEffect } from "react";
5558
- import { jsx, jsxs } from "react/jsx-runtime";
6529
+ import { useState as useState4, useEffect as useEffect4 } from "react";
6530
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
5559
6531
  var import_lodash, sizeClasses, Dialog, DialogTrigger, DialogPortal, DialogClose, DialogOverlay, useSmartDimensions, DialogContent, DialogHeader, DialogBody, DialogFooter, DialogTitle, DialogDescription;
5560
6532
  var init_Dialog = __esm({
5561
6533
  "src/components/Dialog/Dialog.tsx"() {
@@ -5575,7 +6547,7 @@ var init_Dialog = __esm({
5575
6547
  DialogTrigger = DialogPrimitive.Trigger;
5576
6548
  DialogPortal = DialogPrimitive.Portal;
5577
6549
  DialogClose = DialogPrimitive.Close;
5578
- DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
6550
+ DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
5579
6551
  DialogPrimitive.Overlay,
5580
6552
  {
5581
6553
  ref,
@@ -5596,8 +6568,8 @@ var init_Dialog = __esm({
5596
6568
  minWidth,
5597
6569
  enableScrolling = false
5598
6570
  }) => {
5599
- const [dimensions, setDimensions] = useState({});
5600
- useEffect(() => {
6571
+ const [dimensions, setDimensions] = useState4({});
6572
+ useEffect4(() => {
5601
6573
  if (!maxHeightPercent && !maxWidthPercent && !maxHeight && !maxWidth && !minHeight && !minWidth) {
5602
6574
  return;
5603
6575
  }
@@ -5652,7 +6624,7 @@ var init_Dialog = __esm({
5652
6624
  }
5653
6625
  return result;
5654
6626
  };
5655
- DialogContent = React.forwardRef(({
6627
+ DialogContent = React3.forwardRef(({
5656
6628
  className,
5657
6629
  children,
5658
6630
  size = "md",
@@ -5679,17 +6651,17 @@ var init_Dialog = __esm({
5679
6651
  minWidth,
5680
6652
  enableScrolling
5681
6653
  });
5682
- const handleEscapeKeyDown = React.useCallback((event) => {
6654
+ const handleEscapeKeyDown = React3.useCallback((event) => {
5683
6655
  if (preventCloseOnEscape) {
5684
6656
  event.preventDefault();
5685
6657
  }
5686
6658
  }, [preventCloseOnEscape]);
5687
- const handlePointerDownOutside = React.useCallback((event) => {
6659
+ const handlePointerDownOutside = React3.useCallback((event) => {
5688
6660
  if (preventCloseOnOutsideClick) {
5689
6661
  event.preventDefault();
5690
6662
  }
5691
6663
  }, [preventCloseOnOutsideClick]);
5692
- const mergedStyle = React.useMemo(() => {
6664
+ const mergedStyle = React3.useMemo(() => {
5693
6665
  if (Object.keys(smartDimensions).length === 0) {
5694
6666
  return style;
5695
6667
  }
@@ -5701,7 +6673,7 @@ var init_Dialog = __esm({
5701
6673
  return finalStyle;
5702
6674
  }, [smartDimensions, style, maxWidth, maxWidthPercent]);
5703
6675
  return /* @__PURE__ */ jsxs(DialogPortal, { children: [
5704
- /* @__PURE__ */ jsx(DialogOverlay, { className: overlayClassName }),
6676
+ /* @__PURE__ */ jsx3(DialogOverlay, { className: overlayClassName }),
5705
6677
  /* @__PURE__ */ jsxs(
5706
6678
  DialogPrimitive.Content,
5707
6679
  {
@@ -5731,8 +6703,8 @@ var init_Dialog = __esm({
5731
6703
  children: [
5732
6704
  children,
5733
6705
  showCloseButton && /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 z-10 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
5734
- /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
5735
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
6706
+ /* @__PURE__ */ jsx3(X, { className: "h-4 w-4" }),
6707
+ /* @__PURE__ */ jsx3("span", { className: "sr-only", children: "Close" })
5736
6708
  ] })
5737
6709
  ]
5738
6710
  }
@@ -5744,7 +6716,7 @@ var init_Dialog = __esm({
5744
6716
  className,
5745
6717
  sticky = false,
5746
6718
  ...props
5747
- }) => /* @__PURE__ */ jsx(
6719
+ }) => /* @__PURE__ */ jsx3(
5748
6720
  "header",
5749
6721
  {
5750
6722
  className: cn(
@@ -5767,13 +6739,13 @@ var init_Dialog = __esm({
5767
6739
  children,
5768
6740
  ...props
5769
6741
  }) => {
5770
- const mergedStyle = React.useMemo(() => {
6742
+ const mergedStyle = React3.useMemo(() => {
5771
6743
  return {
5772
6744
  ...maxHeight && { maxHeight },
5773
6745
  ...style
5774
6746
  };
5775
6747
  }, [maxHeight, style]);
5776
- const processedHtmlContent = React.useMemo(() => {
6748
+ const processedHtmlContent = React3.useMemo(() => {
5777
6749
  if (!htmlContent || !allowHtml) {
5778
6750
  return null;
5779
6751
  }
@@ -5794,7 +6766,7 @@ var init_Dialog = __esm({
5794
6766
  });
5795
6767
  return result.html;
5796
6768
  }, [htmlContent, allowHtml, strictSanitization, logWarnings]);
5797
- return /* @__PURE__ */ jsx(
6769
+ return /* @__PURE__ */ jsx3(
5798
6770
  "main",
5799
6771
  {
5800
6772
  className: cn(
@@ -5805,14 +6777,14 @@ var init_Dialog = __esm({
5805
6777
  "aria-label": "Dialog main content",
5806
6778
  tabIndex: -1,
5807
6779
  ...props,
5808
- children: processedHtmlContent ? /* @__PURE__ */ jsx(
6780
+ children: processedHtmlContent ? /* @__PURE__ */ jsx3(
5809
6781
  "div",
5810
6782
  {
5811
6783
  dangerouslySetInnerHTML: { __html: processedHtmlContent },
5812
6784
  className: "prose prose-sm max-w-none"
5813
6785
  }
5814
6786
  ) : /* @__PURE__ */ jsxs("div", { children: [
5815
- /* @__PURE__ */ jsx("div", { className: "text-red-500 mb-2", children: "No HTML content processed. Showing children instead." }),
6787
+ /* @__PURE__ */ jsx3("div", { className: "text-red-500 mb-2", children: "No HTML content processed. Showing children instead." }),
5816
6788
  children
5817
6789
  ] })
5818
6790
  }
@@ -5823,7 +6795,7 @@ var init_Dialog = __esm({
5823
6795
  className,
5824
6796
  sticky = false,
5825
6797
  ...props
5826
- }) => /* @__PURE__ */ jsx(
6798
+ }) => /* @__PURE__ */ jsx3(
5827
6799
  "footer",
5828
6800
  {
5829
6801
  className: cn(
@@ -5835,8 +6807,8 @@ var init_Dialog = __esm({
5835
6807
  }
5836
6808
  );
5837
6809
  DialogFooter.displayName = "DialogFooter";
5838
- DialogTitle = React.forwardRef(({ className, htmlContent, allowHtml = true, children, ...props }, ref) => {
5839
- const processedHtmlContent = React.useMemo(() => {
6810
+ DialogTitle = React3.forwardRef(({ className, htmlContent, allowHtml = true, children, ...props }, ref) => {
6811
+ const processedHtmlContent = React3.useMemo(() => {
5840
6812
  if (!htmlContent || !allowHtml) {
5841
6813
  return null;
5842
6814
  }
@@ -5846,7 +6818,7 @@ var init_Dialog = __esm({
5846
6818
  });
5847
6819
  return result.html;
5848
6820
  }, [htmlContent, allowHtml]);
5849
- return /* @__PURE__ */ jsx(
6821
+ return /* @__PURE__ */ jsx3(
5850
6822
  DialogPrimitive.Title,
5851
6823
  {
5852
6824
  ref,
@@ -5855,13 +6827,13 @@ var init_Dialog = __esm({
5855
6827
  className
5856
6828
  ),
5857
6829
  ...props,
5858
- children: processedHtmlContent ? /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: processedHtmlContent } }) : children
6830
+ children: processedHtmlContent ? /* @__PURE__ */ jsx3("span", { dangerouslySetInnerHTML: { __html: processedHtmlContent } }) : children
5859
6831
  }
5860
6832
  );
5861
6833
  });
5862
6834
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
5863
- DialogDescription = React.forwardRef(({ className, htmlContent, allowHtml = true, children, ...props }, ref) => {
5864
- const processedHtmlContent = React.useMemo(() => {
6835
+ DialogDescription = React3.forwardRef(({ className, htmlContent, allowHtml = true, children, ...props }, ref) => {
6836
+ const processedHtmlContent = React3.useMemo(() => {
5865
6837
  if (!htmlContent || !allowHtml) {
5866
6838
  return null;
5867
6839
  }
@@ -5871,13 +6843,13 @@ var init_Dialog = __esm({
5871
6843
  });
5872
6844
  return result.html;
5873
6845
  }, [htmlContent, allowHtml]);
5874
- return /* @__PURE__ */ jsx(
6846
+ return /* @__PURE__ */ jsx3(
5875
6847
  DialogPrimitive.Description,
5876
6848
  {
5877
6849
  ref,
5878
6850
  className: cn("text-sm text-muted-foreground", className),
5879
6851
  ...props,
5880
- children: processedHtmlContent ? /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: processedHtmlContent } }) : children
6852
+ children: processedHtmlContent ? /* @__PURE__ */ jsx3("span", { dangerouslySetInnerHTML: { __html: processedHtmlContent } }) : children
5881
6853
  }
5882
6854
  );
5883
6855
  });
@@ -5886,9 +6858,9 @@ var init_Dialog = __esm({
5886
6858
  });
5887
6859
 
5888
6860
  // src/components/Tooltip/Tooltip.tsx
5889
- import * as React2 from "react";
6861
+ import * as React4 from "react";
5890
6862
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
5891
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
6863
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
5892
6864
  var TooltipProvider, TooltipRoot, TooltipTrigger, TooltipContent, Tooltip;
5893
6865
  var init_Tooltip = __esm({
5894
6866
  "src/components/Tooltip/Tooltip.tsx"() {
@@ -5897,7 +6869,7 @@ var init_Tooltip = __esm({
5897
6869
  TooltipProvider = TooltipPrimitive.Provider;
5898
6870
  TooltipRoot = TooltipPrimitive.Root;
5899
6871
  TooltipTrigger = TooltipPrimitive.Trigger;
5900
- TooltipContent = React2.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx2(
6872
+ TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx4(
5901
6873
  TooltipPrimitive.Content,
5902
6874
  {
5903
6875
  ref,
@@ -5910,9 +6882,9 @@ var init_Tooltip = __esm({
5910
6882
  }
5911
6883
  ));
5912
6884
  TooltipContent.displayName = TooltipPrimitive.Content.displayName;
5913
- Tooltip = React2.forwardRef(({ children, content, delayDuration = 200 }, ref) => /* @__PURE__ */ jsx2(TooltipProvider, { children: /* @__PURE__ */ jsxs2(TooltipRoot, { delayDuration, children: [
5914
- /* @__PURE__ */ jsx2(TooltipTrigger, { ref, asChild: true, children: /* @__PURE__ */ jsx2("span", { children }) }),
5915
- /* @__PURE__ */ jsx2(TooltipContent, { children: content })
6885
+ Tooltip = React4.forwardRef(({ children, content, delayDuration = 200 }, ref) => /* @__PURE__ */ jsx4(TooltipProvider, { children: /* @__PURE__ */ jsxs2(TooltipRoot, { delayDuration, children: [
6886
+ /* @__PURE__ */ jsx4(TooltipTrigger, { ref, asChild: true, children: /* @__PURE__ */ jsx4("span", { children }) }),
6887
+ /* @__PURE__ */ jsx4(TooltipContent, { children: content })
5916
6888
  ] }) }));
5917
6889
  Tooltip.displayName = "Tooltip";
5918
6890
  }
@@ -5927,9 +6899,9 @@ var init_Tooltip2 = __esm({
5927
6899
  });
5928
6900
 
5929
6901
  // src/components/Button/Button.tsx
5930
- import * as React3 from "react";
6902
+ import * as React5 from "react";
5931
6903
  import { Slot } from "@radix-ui/react-slot";
5932
- import { jsx as jsx3 } from "react/jsx-runtime";
6904
+ import { jsx as jsx5 } from "react/jsx-runtime";
5933
6905
  function getButtonClasses(variant = "default", size = "default") {
5934
6906
  const baseClasses = "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50";
5935
6907
  const variantClasses = {
@@ -5954,10 +6926,10 @@ var init_Button = __esm({
5954
6926
  "use strict";
5955
6927
  init_cn();
5956
6928
  init_Tooltip2();
5957
- Button = React3.forwardRef(
6929
+ Button = React5.forwardRef(
5958
6930
  ({ className, variant, size, asChild = false, type = "button", disabled, ...props }, ref) => {
5959
6931
  const Comp = asChild ? Slot : "button";
5960
- return /* @__PURE__ */ jsx3(
6932
+ return /* @__PURE__ */ jsx5(
5961
6933
  Comp,
5962
6934
  {
5963
6935
  className: cn(getButtonClasses(variant, size), className),
@@ -5971,9 +6943,9 @@ var init_Button = __esm({
5971
6943
  }
5972
6944
  );
5973
6945
  Button.displayName = "Button";
5974
- IconButton = React3.forwardRef(
6946
+ IconButton = React5.forwardRef(
5975
6947
  ({ icon, className, size = "icon", "aria-label": ariaLabel, tooltip, ...props }, ref) => {
5976
- const button = /* @__PURE__ */ jsx3(
6948
+ const button = /* @__PURE__ */ jsx5(
5977
6949
  Button,
5978
6950
  {
5979
6951
  ref,
@@ -5985,7 +6957,7 @@ var init_Button = __esm({
5985
6957
  }
5986
6958
  );
5987
6959
  if (tooltip) {
5988
- return /* @__PURE__ */ jsx3(Tooltip, { content: tooltip, children: button });
6960
+ return /* @__PURE__ */ jsx5(Tooltip, { content: tooltip, children: button });
5989
6961
  }
5990
6962
  return button;
5991
6963
  }
@@ -5994,7 +6966,390 @@ var init_Button = __esm({
5994
6966
  }
5995
6967
  });
5996
6968
 
6969
+ // src/components/InactivityWarningModal/InactivityWarningModal.tsx
6970
+ import { useEffect as useEffect5, useState as useState5, useCallback as useCallback5 } from "react";
6971
+ import { Clock, AlertTriangle } from "lucide-react";
6972
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
6973
+ function InactivityWarningModal({
6974
+ isOpen,
6975
+ timeRemaining,
6976
+ onStaySignedIn,
6977
+ onSignOutNow,
6978
+ title = "Session Timeout Warning",
6979
+ description = "You've been inactive for a while. Your session will expire soon for security reasons.",
6980
+ className
6981
+ }) {
6982
+ const [displayTime, setDisplayTime] = useState5(timeRemaining);
6983
+ useEffect5(() => {
6984
+ setDisplayTime(timeRemaining);
6985
+ }, [timeRemaining]);
6986
+ const formatTime = useCallback5((seconds) => {
6987
+ const mins = Math.floor(seconds / 60);
6988
+ const secs = seconds % 60;
6989
+ return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
6990
+ }, []);
6991
+ return /* @__PURE__ */ jsx6(Dialog, { open: isOpen, onOpenChange: (open) => !open && onStaySignedIn(), children: /* @__PURE__ */ jsxs3(
6992
+ DialogContent,
6993
+ {
6994
+ className: `sm:max-w-md ${className || ""}`,
6995
+ preventCloseOnEscape: false,
6996
+ preventCloseOnOutsideClick: true,
6997
+ "data-testid": "inactivity-warning-modal",
6998
+ children: [
6999
+ /* @__PURE__ */ jsxs3(DialogHeader, { children: [
7000
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
7001
+ /* @__PURE__ */ jsx6("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx6(AlertTriangle, { className: "h-6 w-6 text-acc-600" }) }),
7002
+ /* @__PURE__ */ jsx6("div", { children: /* @__PURE__ */ jsx6(DialogTitle, { className: "text-lg font-semibold text-main-900", children: title }) })
7003
+ ] }),
7004
+ /* @__PURE__ */ jsx6(DialogDescription, { className: "text-main-700 mt-2", children: description })
7005
+ ] }),
7006
+ /* @__PURE__ */ jsxs3("div", { className: "space-y-6", children: [
7007
+ /* @__PURE__ */ jsxs3("div", { className: "text-center", children: [
7008
+ /* @__PURE__ */ jsxs3("div", { className: "inline-flex items-center gap-2 px-4 py-3 bg-acc-50 border border-acc-200 rounded-lg", children: [
7009
+ /* @__PURE__ */ jsx6(Clock, { className: "h-5 w-5 text-acc-600" }),
7010
+ /* @__PURE__ */ jsx6("span", { className: "text-2xl font-mono font-bold text-acc-700", children: formatTime(displayTime) })
7011
+ ] }),
7012
+ /* @__PURE__ */ jsx6("p", { className: "text-sm text-main-600 mt-2", children: "Time remaining before automatic logout" })
7013
+ ] }),
7014
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col sm:flex-row gap-3", children: [
7015
+ /* @__PURE__ */ jsx6(
7016
+ Button,
7017
+ {
7018
+ onClick: onStaySignedIn,
7019
+ className: "flex-1 bg-main-600 hover:bg-main-700 text-main-50",
7020
+ size: "lg",
7021
+ children: "Stay Signed In"
7022
+ }
7023
+ ),
7024
+ /* @__PURE__ */ jsx6(
7025
+ Button,
7026
+ {
7027
+ onClick: onSignOutNow,
7028
+ variant: "outline",
7029
+ className: "flex-1 border-acc-300 text-acc-700 hover:bg-acc-50",
7030
+ size: "lg",
7031
+ children: "Sign Out Now"
7032
+ }
7033
+ )
7034
+ ] }),
7035
+ /* @__PURE__ */ jsx6("div", { className: "text-xs text-main-500 text-center", children: /* @__PURE__ */ jsx6("p", { children: "For security reasons, you'll be automatically signed out after 30 minutes of inactivity." }) })
7036
+ ] })
7037
+ ]
7038
+ }
7039
+ ) });
7040
+ }
7041
+ var init_InactivityWarningModal = __esm({
7042
+ "src/components/InactivityWarningModal/InactivityWarningModal.tsx"() {
7043
+ "use strict";
7044
+ init_Dialog();
7045
+ init_Button();
7046
+ }
7047
+ });
7048
+
7049
+ // src/providers/InactivityProvider.tsx
7050
+ import { createContext as createContext3, useContext as useContext3, useState as useState6, useEffect as useEffect6, useCallback as useCallback6, useMemo as useMemo4 } from "react";
7051
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
7052
+ function InactivityProvider({
7053
+ children,
7054
+ user,
7055
+ session,
7056
+ supabaseClient,
7057
+ idleTimeoutMs = 30 * 60 * 1e3,
7058
+ // 30 minutes
7059
+ warnBeforeMs = 60 * 1e3,
7060
+ // 60 seconds
7061
+ onIdleLogout,
7062
+ renderInactivityWarning,
7063
+ dangerouslyDisableInactivity = false
7064
+ }) {
7065
+ const [showInactivityWarning, setShowInactivityWarning] = useState6(false);
7066
+ const [inactivityTimeRemaining, setInactivityTimeRemaining] = useState6(0);
7067
+ useEffect6(() => {
7068
+ if (typeof window !== "undefined") {
7069
+ const isProduction = true;
7070
+ if (isProduction && dangerouslyDisableInactivity) {
7071
+ console.error("[InactivityProvider] CRITICAL: dangerouslyDisableInactivity is not allowed in production! Auto-enabling inactivity feature.");
7072
+ }
7073
+ if (!isProduction && dangerouslyDisableInactivity) {
7074
+ console.warn("[InactivityProvider] Inactivity feature disabled for development. This will NOT work in production.");
7075
+ }
7076
+ }
7077
+ }, [dangerouslyDisableInactivity]);
7078
+ const isInactivityEnabled = typeof window !== "undefined" && (false ? !dangerouslyDisableInactivity : true);
7079
+ const {
7080
+ isIdle,
7081
+ timeRemaining,
7082
+ showWarning,
7083
+ resetActivity,
7084
+ startTracking,
7085
+ stopTracking,
7086
+ isTracking
7087
+ } = useInactivityTracker({
7088
+ idleTimeoutMs,
7089
+ warnBeforeMs,
7090
+ enabled: isInactivityEnabled && !!user && !!session,
7091
+ onIdle: useCallback6(() => {
7092
+ setShowInactivityWarning(false);
7093
+ setInactivityTimeRemaining(0);
7094
+ if (supabaseClient) {
7095
+ supabaseClient.auth.signOut().catch((error) => {
7096
+ console.error("[InactivityProvider] Error during idle logout:", error);
7097
+ });
7098
+ }
7099
+ onIdleLogout?.("inactivity");
7100
+ }, [supabaseClient, onIdleLogout]),
7101
+ onWarning: useCallback6(() => {
7102
+ setShowInactivityWarning(true);
7103
+ setInactivityTimeRemaining(warnBeforeMs);
7104
+ }, [warnBeforeMs]),
7105
+ onActivity: useCallback6(() => {
7106
+ setShowInactivityWarning(false);
7107
+ setInactivityTimeRemaining(0);
7108
+ }, [])
7109
+ });
7110
+ const handleIdleLogout = useCallback6(async () => {
7111
+ setShowInactivityWarning(false);
7112
+ setInactivityTimeRemaining(0);
7113
+ stopTracking();
7114
+ try {
7115
+ if (supabaseClient) {
7116
+ await supabaseClient.auth.signOut();
7117
+ }
7118
+ } catch (error) {
7119
+ console.error("[InactivityProvider] Error during idle logout:", error);
7120
+ }
7121
+ onIdleLogout?.("inactivity");
7122
+ }, [supabaseClient, onIdleLogout, stopTracking]);
7123
+ const handleStaySignedIn = useCallback6(() => {
7124
+ setShowInactivityWarning(false);
7125
+ setInactivityTimeRemaining(0);
7126
+ resetActivity();
7127
+ }, [resetActivity]);
7128
+ const handleSignOutNow = useCallback6(async () => {
7129
+ setShowInactivityWarning(false);
7130
+ setInactivityTimeRemaining(0);
7131
+ stopTracking();
7132
+ try {
7133
+ if (supabaseClient) {
7134
+ await supabaseClient.auth.signOut();
7135
+ }
7136
+ } catch (error) {
7137
+ console.error("[InactivityProvider] Error during manual sign out:", error);
7138
+ }
7139
+ onIdleLogout?.("inactivity");
7140
+ }, [supabaseClient, onIdleLogout, stopTracking]);
7141
+ useEffect6(() => {
7142
+ if (showWarning && timeRemaining > 0) {
7143
+ setInactivityTimeRemaining(Math.ceil(timeRemaining / 1e3));
7144
+ }
7145
+ }, [showWarning, timeRemaining]);
7146
+ const contextValue = useMemo4(() => ({
7147
+ showInactivityWarning,
7148
+ inactivityTimeRemaining,
7149
+ isIdle,
7150
+ timeRemaining,
7151
+ showWarning,
7152
+ isTracking,
7153
+ resetActivity,
7154
+ startTracking,
7155
+ stopTracking,
7156
+ handleIdleLogout,
7157
+ handleStaySignedIn,
7158
+ handleSignOutNow
7159
+ }), [
7160
+ showInactivityWarning,
7161
+ inactivityTimeRemaining,
7162
+ isIdle,
7163
+ timeRemaining,
7164
+ showWarning,
7165
+ isTracking,
7166
+ resetActivity,
7167
+ startTracking,
7168
+ stopTracking,
7169
+ handleIdleLogout,
7170
+ handleStaySignedIn,
7171
+ handleSignOutNow
7172
+ ]);
7173
+ return /* @__PURE__ */ jsxs4(InactivityContext.Provider, { value: contextValue, children: [
7174
+ children,
7175
+ showInactivityWarning && (renderInactivityWarning ? renderInactivityWarning({
7176
+ timeRemaining: inactivityTimeRemaining,
7177
+ onStaySignedIn: handleStaySignedIn,
7178
+ onSignOutNow: handleSignOutNow
7179
+ }) : /* @__PURE__ */ jsx7(
7180
+ InactivityWarningModal,
7181
+ {
7182
+ isOpen: showInactivityWarning,
7183
+ timeRemaining: inactivityTimeRemaining,
7184
+ onStaySignedIn: handleStaySignedIn,
7185
+ onSignOutNow: handleSignOutNow
7186
+ }
7187
+ ))
7188
+ ] });
7189
+ }
7190
+ var InactivityContext, useInactivity;
7191
+ var init_InactivityProvider = __esm({
7192
+ "src/providers/InactivityProvider.tsx"() {
7193
+ "use strict";
7194
+ init_useInactivityTracker();
7195
+ init_InactivityWarningModal();
7196
+ InactivityContext = createContext3(void 0);
7197
+ useInactivity = () => {
7198
+ const context = useContext3(InactivityContext);
7199
+ if (!context) {
7200
+ throw new Error("useInactivity must be used within an InactivityProvider");
7201
+ }
7202
+ return context;
7203
+ };
7204
+ }
7205
+ });
7206
+
7207
+ // src/providers/UnifiedAuthProvider.tsx
7208
+ var UnifiedAuthProvider_exports = {};
7209
+ __export(UnifiedAuthProvider_exports, {
7210
+ UnifiedAuthProvider: () => UnifiedAuthProvider,
7211
+ useUnifiedAuth: () => useUnifiedAuth
7212
+ });
7213
+ import { createContext as createContext4, useContext as useContext4, useMemo as useMemo5 } from "react";
7214
+ import { jsx as jsx8 } from "react/jsx-runtime";
7215
+ function UnifiedAuthContextProvider({
7216
+ children,
7217
+ appName,
7218
+ ...props
7219
+ }) {
7220
+ const auth = useAuth();
7221
+ const rbac = useRBAC();
7222
+ const inactivity = useInactivity();
7223
+ const contextValue = useMemo5(() => ({
7224
+ ...auth,
7225
+ ...rbac,
7226
+ ...inactivity,
7227
+ appName,
7228
+ isLoading: auth.authLoading || rbac.rbacLoading,
7229
+ hasErrors: !!auth.authError || !!rbac.rbacError
7230
+ }), [auth, rbac, inactivity, appName]);
7231
+ return /* @__PURE__ */ jsx8(UnifiedAuthContext.Provider, { value: contextValue, children });
7232
+ }
7233
+ function AuthAwareProviders({
7234
+ children,
7235
+ supabaseClient,
7236
+ appName,
7237
+ persistState,
7238
+ enablePersistence,
7239
+ requireOrganisationContext,
7240
+ enableRBAC,
7241
+ idleTimeoutMs,
7242
+ warnBeforeMs,
7243
+ onIdleLogout,
7244
+ renderInactivityWarning,
7245
+ dangerouslyDisableInactivity
7246
+ }) {
7247
+ const auth = useAuth();
7248
+ return /* @__PURE__ */ jsx8(
7249
+ RBACProvider,
7250
+ {
7251
+ supabaseClient,
7252
+ user: auth.user,
7253
+ session: auth.session,
7254
+ appName,
7255
+ enableRBAC,
7256
+ persistState,
7257
+ enablePersistence,
7258
+ requireOrganisationContext,
7259
+ children: /* @__PURE__ */ jsx8(
7260
+ InactivityProvider,
7261
+ {
7262
+ user: auth.user,
7263
+ session: auth.session,
7264
+ supabaseClient,
7265
+ idleTimeoutMs,
7266
+ warnBeforeMs,
7267
+ onIdleLogout,
7268
+ renderInactivityWarning,
7269
+ dangerouslyDisableInactivity,
7270
+ children: /* @__PURE__ */ jsx8(
7271
+ UnifiedAuthContextProvider,
7272
+ {
7273
+ appName,
7274
+ supabaseClient,
7275
+ persistState,
7276
+ enablePersistence,
7277
+ requireOrganisationContext,
7278
+ enableRBAC,
7279
+ idleTimeoutMs,
7280
+ warnBeforeMs,
7281
+ onIdleLogout,
7282
+ renderInactivityWarning,
7283
+ dangerouslyDisableInactivity,
7284
+ children
7285
+ }
7286
+ )
7287
+ }
7288
+ )
7289
+ }
7290
+ );
7291
+ }
7292
+ function UnifiedAuthProvider({
7293
+ children,
7294
+ supabaseClient,
7295
+ appName,
7296
+ persistState = true,
7297
+ enablePersistence,
7298
+ requireOrganisationContext = true,
7299
+ enableRBAC = false,
7300
+ idleTimeoutMs = 30 * 60 * 1e3,
7301
+ // 30 minutes
7302
+ warnBeforeMs = 60 * 1e3,
7303
+ // 60 seconds
7304
+ onIdleLogout,
7305
+ renderInactivityWarning,
7306
+ dangerouslyDisableInactivity = false
7307
+ }) {
7308
+ return /* @__PURE__ */ jsx8(AuthProvider, { supabaseClient, children: /* @__PURE__ */ jsx8(
7309
+ AuthAwareProviders,
7310
+ {
7311
+ supabaseClient,
7312
+ appName,
7313
+ persistState,
7314
+ enablePersistence,
7315
+ requireOrganisationContext,
7316
+ enableRBAC,
7317
+ idleTimeoutMs,
7318
+ warnBeforeMs,
7319
+ onIdleLogout,
7320
+ renderInactivityWarning,
7321
+ dangerouslyDisableInactivity,
7322
+ children
7323
+ }
7324
+ ) });
7325
+ }
7326
+ var UnifiedAuthContext, useUnifiedAuth;
7327
+ var init_UnifiedAuthProvider = __esm({
7328
+ "src/providers/UnifiedAuthProvider.tsx"() {
7329
+ "use strict";
7330
+ init_AuthProvider();
7331
+ init_RBACProvider();
7332
+ init_InactivityProvider();
7333
+ UnifiedAuthContext = createContext4(void 0);
7334
+ useUnifiedAuth = () => {
7335
+ const context = useContext4(UnifiedAuthContext);
7336
+ if (!context) {
7337
+ throw new Error("useUnifiedAuth must be used within a UnifiedAuthProvider");
7338
+ }
7339
+ return context;
7340
+ };
7341
+ }
7342
+ });
7343
+
5997
7344
  export {
7345
+ useAuth,
7346
+ AuthProvider,
7347
+ init_AuthProvider,
7348
+ useRBAC,
7349
+ RBACProvider,
7350
+ init_RBACProvider,
7351
+ useInactivityTracker,
7352
+ init_useInactivityTracker,
5998
7353
  Dialog,
5999
7354
  DialogTrigger,
6000
7355
  DialogPortal,
@@ -6015,7 +7370,16 @@ export {
6015
7370
  init_Tooltip,
6016
7371
  init_Tooltip2,
6017
7372
  Button,
6018
- init_Button
7373
+ init_Button,
7374
+ InactivityWarningModal,
7375
+ init_InactivityWarningModal,
7376
+ useInactivity,
7377
+ InactivityProvider,
7378
+ init_InactivityProvider,
7379
+ useUnifiedAuth,
7380
+ UnifiedAuthProvider,
7381
+ UnifiedAuthProvider_exports,
7382
+ init_UnifiedAuthProvider
6019
7383
  };
6020
7384
  /*! Bundled license information:
6021
7385
 
@@ -6029,4 +7393,4 @@ lodash/lodash.js:
6029
7393
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
6030
7394
  *)
6031
7395
  */
6032
- //# sourceMappingURL=chunk-ETEJVKYK.js.map
7396
+ //# sourceMappingURL=chunk-6CR3MRZN.js.map