@jmruthers/pace-core 0.6.2 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/cursor-rules/00-pace-core-compliance.mdc +34 -2
  3. package/dist/{AuthService-BPvc3Ka0.d.ts → AuthService-Cb34EQs3.d.ts} +9 -1
  4. package/dist/{DataTable-TPTKCX4D.js → DataTable-E7YQZD7D.js} +9 -8
  5. package/dist/{PublicPageProvider-DC6kCaqf.d.ts → PublicPageProvider-DEMpysFR.d.ts} +45 -67
  6. package/dist/{UnifiedAuthProvider-CVcTjx-d.d.ts → UnifiedAuthProvider-CKvHP1MK.d.ts} +1 -8
  7. package/dist/{UnifiedAuthProvider-CH6Z342H.js → UnifiedAuthProvider-QPXO24B4.js} +5 -4
  8. package/dist/{api-MVVQZLJI.js → api-6LVZTHDS.js} +10 -10
  9. package/dist/{audit-B5P6FFIR.js → audit-V53FV5AG.js} +2 -2
  10. package/dist/chunk-36LVWXB2.js +227 -0
  11. package/dist/chunk-36LVWXB2.js.map +1 -0
  12. package/dist/{chunk-24UVZUZG.js → chunk-3LPHPB62.js} +129 -387
  13. package/dist/chunk-3LPHPB62.js.map +1 -0
  14. package/dist/{chunk-2UOI2FG5.js → chunk-5EC5MEWX.js} +4 -4
  15. package/dist/{chunk-3XC4CPTD.js → chunk-7JPAB3T5.js} +244 -5727
  16. package/dist/chunk-7JPAB3T5.js.map +1 -0
  17. package/dist/{chunk-6J4GEEJR.js → chunk-ATKZM7RX.js} +53 -27
  18. package/dist/chunk-ATKZM7RX.js.map +1 -0
  19. package/dist/{chunk-EHMR7VYL.js → chunk-AVMLPIM7.js} +443 -189
  20. package/dist/chunk-AVMLPIM7.js.map +1 -0
  21. package/dist/chunk-DGUM43GV.js +11 -0
  22. package/dist/{chunk-NECFR5MM.js → chunk-I6DAQMWX.js} +575 -647
  23. package/dist/chunk-I6DAQMWX.js.map +1 -0
  24. package/dist/{chunk-F2IMUDXZ.js → chunk-M7MPQISP.js} +2 -2
  25. package/dist/{chunk-XWQCNGTQ.js → chunk-NN6WWZ5U.js} +173 -79
  26. package/dist/chunk-NN6WWZ5U.js.map +1 -0
  27. package/dist/{chunk-MMZ7JXPU.js → chunk-OEWDTMG7.js} +13 -21
  28. package/dist/{chunk-MMZ7JXPU.js.map → chunk-OEWDTMG7.js.map} +1 -1
  29. package/dist/{chunk-SFZUDBL5.js → chunk-YKRAFF5K.js} +70 -56
  30. package/dist/chunk-YKRAFF5K.js.map +1 -0
  31. package/dist/components.d.ts +2 -2
  32. package/dist/components.js +12 -13
  33. package/dist/contextValidator-OOPCLPZW.js +9 -0
  34. package/dist/contextValidator-OOPCLPZW.js.map +1 -0
  35. package/dist/eslint-rules/pace-core-compliance.cjs +106 -0
  36. package/dist/hooks.d.ts +2 -2
  37. package/dist/hooks.js +7 -6
  38. package/dist/hooks.js.map +1 -1
  39. package/dist/index.d.ts +7 -7
  40. package/dist/index.js +21 -16
  41. package/dist/index.js.map +1 -1
  42. package/dist/providers.d.ts +3 -3
  43. package/dist/providers.js +4 -3
  44. package/dist/rbac/index.d.ts +67 -27
  45. package/dist/rbac/index.js +15 -8
  46. package/dist/styles/index.js +1 -1
  47. package/dist/theming/runtime.js +1 -1
  48. package/dist/types.js +1 -1
  49. package/dist/{usePublicRouteParams-1oMokgLF.d.ts → usePublicRouteParams-i3qtoBgg.d.ts} +7 -16
  50. package/dist/utils.js +5 -7
  51. package/dist/utils.js.map +1 -1
  52. package/docs/api/README.md +14 -16
  53. package/docs/api/modules.md +3796 -2513
  54. package/docs/components/context-selector.md +126 -0
  55. package/docs/migration/RBAC_SCOPE_MIGRATION.md +385 -0
  56. package/docs/pace-mint-fix-auto-selection.md +218 -0
  57. package/docs/pace-mint-rbac-setup.md +391 -0
  58. package/docs/rbac/secure-client-protection.md +330 -0
  59. package/package.json +10 -5
  60. package/scripts/audit/core/checks/compliance.cjs +72 -0
  61. package/scripts/audit/core/checks/dependencies.cjs +568 -28
  62. package/scripts/audit/core/checks/documentation.cjs +68 -3
  63. package/scripts/audit/core/checks/environment.cjs +2 -14
  64. package/scripts/audit/core/checks/error-handling.cjs +47 -6
  65. package/src/components/ContextSelector/ContextSelector.tsx +384 -0
  66. package/src/components/ContextSelector/index.ts +3 -0
  67. package/src/components/DataTable/components/RowComponent.tsx +19 -19
  68. package/src/components/DataTable/components/UnifiedTableBody.tsx +2 -2
  69. package/src/components/DataTable/hooks/useDataTablePermissions.ts +8 -6
  70. package/src/components/Dialog/Dialog.tsx +29 -1
  71. package/src/components/FileDisplay/FileDisplay.tsx +42 -10
  72. package/src/components/Header/Header.test.tsx +43 -73
  73. package/src/components/Header/Header.tsx +44 -45
  74. package/src/components/PaceAppLayout/PaceAppLayout.integration.test.tsx +10 -19
  75. package/src/components/PaceAppLayout/PaceAppLayout.performance.test.tsx +2 -2
  76. package/src/components/PaceAppLayout/PaceAppLayout.security.test.tsx +5 -5
  77. package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +9 -9
  78. package/src/components/PaceAppLayout/PaceAppLayout.tsx +157 -36
  79. package/src/components/PaceAppLayout/README.md +14 -17
  80. package/src/components/PaceAppLayout/test-setup.tsx +2 -2
  81. package/src/components/index.ts +5 -5
  82. package/src/eslint-rules/pace-core-compliance.cjs +106 -0
  83. package/src/hooks/__tests__/useAppConfig.unit.test.ts +4 -98
  84. package/src/hooks/useAppConfig.ts +15 -30
  85. package/src/hooks/useFileDisplay.ts +77 -50
  86. package/src/index.ts +4 -5
  87. package/src/providers/services/AuthServiceProvider.tsx +17 -7
  88. package/src/providers/services/EventServiceProvider.tsx +33 -5
  89. package/src/providers/services/UnifiedAuthProvider.tsx +90 -134
  90. package/src/rbac/__tests__/adapters.comprehensive.test.tsx +1 -1
  91. package/src/rbac/adapters.tsx +2 -2
  92. package/src/rbac/api.test.ts +59 -51
  93. package/src/rbac/api.ts +178 -132
  94. package/src/rbac/components/PagePermissionGuard.tsx +38 -10
  95. package/src/rbac/hooks/__tests__/useSecureSupabase.test.ts +32 -21
  96. package/src/rbac/hooks/permissions/useAccessLevel.ts +1 -1
  97. package/src/rbac/hooks/permissions/useCan.ts +41 -11
  98. package/src/rbac/hooks/permissions/useHasAllPermissions.ts +1 -1
  99. package/src/rbac/hooks/permissions/useHasAnyPermission.ts +1 -1
  100. package/src/rbac/hooks/permissions/useMultiplePermissions.ts +1 -1
  101. package/src/rbac/hooks/useCan.test.ts +0 -9
  102. package/src/rbac/hooks/useRBAC.test.ts +1 -5
  103. package/src/rbac/hooks/useRBAC.ts +36 -37
  104. package/src/rbac/hooks/useResolvedScope.test.ts +120 -35
  105. package/src/rbac/hooks/useResolvedScope.ts +35 -40
  106. package/src/rbac/hooks/useSecureSupabase.ts +7 -7
  107. package/src/rbac/index.ts +7 -0
  108. package/src/rbac/secureClient.test.ts +22 -18
  109. package/src/rbac/secureClient.ts +103 -16
  110. package/src/rbac/security.ts +0 -17
  111. package/src/rbac/types.ts +1 -0
  112. package/src/rbac/utils/__tests__/contextValidator.test.ts +64 -86
  113. package/src/rbac/utils/clientSecurity.ts +93 -0
  114. package/src/rbac/utils/contextValidator.ts +77 -168
  115. package/src/services/AuthService.ts +39 -7
  116. package/src/services/EventService.ts +285 -56
  117. package/src/services/OrganisationService.ts +81 -14
  118. package/src/services/__tests__/EventService.test.ts +1 -2
  119. package/src/services/base/BaseService.ts +3 -0
  120. package/src/utils/dynamic/dynamicUtils.ts +7 -4
  121. package/dist/chunk-24UVZUZG.js.map +0 -1
  122. package/dist/chunk-3XC4CPTD.js.map +0 -1
  123. package/dist/chunk-6J4GEEJR.js.map +0 -1
  124. package/dist/chunk-7D4SUZUM.js +0 -38
  125. package/dist/chunk-EHMR7VYL.js.map +0 -1
  126. package/dist/chunk-NECFR5MM.js.map +0 -1
  127. package/dist/chunk-SFZUDBL5.js.map +0 -1
  128. package/dist/chunk-XWQCNGTQ.js.map +0 -1
  129. package/docs/api/classes/ColumnFactory.md +0 -243
  130. package/docs/api/classes/InvalidScopeError.md +0 -73
  131. package/docs/api/classes/Logger.md +0 -178
  132. package/docs/api/classes/MissingUserContextError.md +0 -66
  133. package/docs/api/classes/OrganisationContextRequiredError.md +0 -66
  134. package/docs/api/classes/PermissionDeniedError.md +0 -73
  135. package/docs/api/classes/RBACAuditManager.md +0 -297
  136. package/docs/api/classes/RBACCache.md +0 -322
  137. package/docs/api/classes/RBACEngine.md +0 -171
  138. package/docs/api/classes/RBACError.md +0 -76
  139. package/docs/api/classes/RBACNotInitializedError.md +0 -66
  140. package/docs/api/classes/SecureSupabaseClient.md +0 -163
  141. package/docs/api/classes/StorageUtils.md +0 -328
  142. package/docs/api/enums/FileCategory.md +0 -184
  143. package/docs/api/enums/LogLevel.md +0 -54
  144. package/docs/api/enums/RBACErrorCode.md +0 -228
  145. package/docs/api/enums/RPCFunction.md +0 -118
  146. package/docs/api/interfaces/AddressFieldProps.md +0 -241
  147. package/docs/api/interfaces/AddressFieldRef.md +0 -94
  148. package/docs/api/interfaces/AggregateConfig.md +0 -43
  149. package/docs/api/interfaces/AutocompleteOptions.md +0 -75
  150. package/docs/api/interfaces/AvatarProps.md +0 -128
  151. package/docs/api/interfaces/BadgeProps.md +0 -34
  152. package/docs/api/interfaces/ButtonProps.md +0 -56
  153. package/docs/api/interfaces/CalendarProps.md +0 -73
  154. package/docs/api/interfaces/CardProps.md +0 -69
  155. package/docs/api/interfaces/ColorPalette.md +0 -7
  156. package/docs/api/interfaces/ColorShade.md +0 -66
  157. package/docs/api/interfaces/ComplianceResult.md +0 -30
  158. package/docs/api/interfaces/DataAccessRecord.md +0 -96
  159. package/docs/api/interfaces/DataRecord.md +0 -11
  160. package/docs/api/interfaces/DataTableAction.md +0 -252
  161. package/docs/api/interfaces/DataTableColumn.md +0 -504
  162. package/docs/api/interfaces/DataTableProps.md +0 -625
  163. package/docs/api/interfaces/DataTableToolbarButton.md +0 -96
  164. package/docs/api/interfaces/DatabaseComplianceResult.md +0 -85
  165. package/docs/api/interfaces/DatabaseIssue.md +0 -41
  166. package/docs/api/interfaces/EmptyStateConfig.md +0 -61
  167. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +0 -235
  168. package/docs/api/interfaces/ErrorBoundaryProps.md +0 -147
  169. package/docs/api/interfaces/ErrorBoundaryProviderProps.md +0 -36
  170. package/docs/api/interfaces/ErrorBoundaryState.md +0 -75
  171. package/docs/api/interfaces/EventAppRoleData.md +0 -71
  172. package/docs/api/interfaces/ExportColumn.md +0 -90
  173. package/docs/api/interfaces/ExportOptions.md +0 -126
  174. package/docs/api/interfaces/FileDisplayProps.md +0 -249
  175. package/docs/api/interfaces/FileMetadata.md +0 -129
  176. package/docs/api/interfaces/FileReference.md +0 -118
  177. package/docs/api/interfaces/FileSizeLimits.md +0 -7
  178. package/docs/api/interfaces/FileUploadOptions.md +0 -139
  179. package/docs/api/interfaces/FileUploadProps.md +0 -296
  180. package/docs/api/interfaces/FooterProps.md +0 -107
  181. package/docs/api/interfaces/FormFieldProps.md +0 -166
  182. package/docs/api/interfaces/FormProps.md +0 -113
  183. package/docs/api/interfaces/GrantEventAppRoleParams.md +0 -122
  184. package/docs/api/interfaces/InactivityWarningModalProps.md +0 -115
  185. package/docs/api/interfaces/InputProps.md +0 -56
  186. package/docs/api/interfaces/LabelProps.md +0 -107
  187. package/docs/api/interfaces/LoggerConfig.md +0 -62
  188. package/docs/api/interfaces/LoginFormProps.md +0 -187
  189. package/docs/api/interfaces/NavigationAccessRecord.md +0 -107
  190. package/docs/api/interfaces/NavigationContextType.md +0 -164
  191. package/docs/api/interfaces/NavigationGuardProps.md +0 -139
  192. package/docs/api/interfaces/NavigationItem.md +0 -120
  193. package/docs/api/interfaces/NavigationMenuProps.md +0 -221
  194. package/docs/api/interfaces/NavigationProviderProps.md +0 -117
  195. package/docs/api/interfaces/Organisation.md +0 -140
  196. package/docs/api/interfaces/OrganisationContextType.md +0 -388
  197. package/docs/api/interfaces/OrganisationMembership.md +0 -140
  198. package/docs/api/interfaces/OrganisationProviderProps.md +0 -76
  199. package/docs/api/interfaces/OrganisationSecurityError.md +0 -62
  200. package/docs/api/interfaces/PaceAppLayoutProps.md +0 -409
  201. package/docs/api/interfaces/PaceLoginPageProps.md +0 -49
  202. package/docs/api/interfaces/PageAccessRecord.md +0 -85
  203. package/docs/api/interfaces/PagePermissionContextType.md +0 -140
  204. package/docs/api/interfaces/PagePermissionGuardProps.md +0 -153
  205. package/docs/api/interfaces/PagePermissionProviderProps.md +0 -119
  206. package/docs/api/interfaces/PaletteData.md +0 -41
  207. package/docs/api/interfaces/ParsedAddress.md +0 -120
  208. package/docs/api/interfaces/PermissionEnforcerProps.md +0 -153
  209. package/docs/api/interfaces/ProgressProps.md +0 -42
  210. package/docs/api/interfaces/ProtectedRouteProps.md +0 -78
  211. package/docs/api/interfaces/PublicPageFooterProps.md +0 -112
  212. package/docs/api/interfaces/PublicPageHeaderProps.md +0 -125
  213. package/docs/api/interfaces/PublicPageLayoutProps.md +0 -185
  214. package/docs/api/interfaces/QuickFix.md +0 -52
  215. package/docs/api/interfaces/RBACAccessValidateParams.md +0 -52
  216. package/docs/api/interfaces/RBACAccessValidateResult.md +0 -41
  217. package/docs/api/interfaces/RBACAuditLogParams.md +0 -85
  218. package/docs/api/interfaces/RBACAuditLogResult.md +0 -52
  219. package/docs/api/interfaces/RBACConfig.md +0 -133
  220. package/docs/api/interfaces/RBACContext.md +0 -52
  221. package/docs/api/interfaces/RBACLogger.md +0 -112
  222. package/docs/api/interfaces/RBACPageAccessCheckParams.md +0 -74
  223. package/docs/api/interfaces/RBACPerformanceMetrics.md +0 -138
  224. package/docs/api/interfaces/RBACPermissionCheckParams.md +0 -74
  225. package/docs/api/interfaces/RBACPermissionCheckResult.md +0 -52
  226. package/docs/api/interfaces/RBACPermissionsGetParams.md +0 -63
  227. package/docs/api/interfaces/RBACPermissionsGetResult.md +0 -63
  228. package/docs/api/interfaces/RBACResult.md +0 -58
  229. package/docs/api/interfaces/RBACRoleGrantParams.md +0 -63
  230. package/docs/api/interfaces/RBACRoleGrantResult.md +0 -52
  231. package/docs/api/interfaces/RBACRoleRevokeParams.md +0 -63
  232. package/docs/api/interfaces/RBACRoleRevokeResult.md +0 -52
  233. package/docs/api/interfaces/RBACRoleValidateParams.md +0 -52
  234. package/docs/api/interfaces/RBACRoleValidateResult.md +0 -63
  235. package/docs/api/interfaces/RBACRolesListParams.md +0 -52
  236. package/docs/api/interfaces/RBACRolesListResult.md +0 -74
  237. package/docs/api/interfaces/RBACSessionTrackParams.md +0 -74
  238. package/docs/api/interfaces/RBACSessionTrackResult.md +0 -52
  239. package/docs/api/interfaces/ResourcePermissions.md +0 -155
  240. package/docs/api/interfaces/RevokeEventAppRoleParams.md +0 -100
  241. package/docs/api/interfaces/RoleBasedRouterContextType.md +0 -151
  242. package/docs/api/interfaces/RoleBasedRouterProps.md +0 -156
  243. package/docs/api/interfaces/RoleManagementResult.md +0 -52
  244. package/docs/api/interfaces/RouteAccessRecord.md +0 -107
  245. package/docs/api/interfaces/RouteConfig.md +0 -134
  246. package/docs/api/interfaces/RuntimeComplianceResult.md +0 -55
  247. package/docs/api/interfaces/SecureDataContextType.md +0 -168
  248. package/docs/api/interfaces/SecureDataProviderProps.md +0 -132
  249. package/docs/api/interfaces/SessionRestorationLoaderProps.md +0 -34
  250. package/docs/api/interfaces/SetupIssue.md +0 -41
  251. package/docs/api/interfaces/StorageConfig.md +0 -41
  252. package/docs/api/interfaces/StorageFileInfo.md +0 -74
  253. package/docs/api/interfaces/StorageFileMetadata.md +0 -151
  254. package/docs/api/interfaces/StorageListOptions.md +0 -99
  255. package/docs/api/interfaces/StorageListResult.md +0 -41
  256. package/docs/api/interfaces/StorageUploadOptions.md +0 -101
  257. package/docs/api/interfaces/StorageUploadResult.md +0 -63
  258. package/docs/api/interfaces/StorageUrlOptions.md +0 -60
  259. package/docs/api/interfaces/StyleImport.md +0 -19
  260. package/docs/api/interfaces/SwitchProps.md +0 -34
  261. package/docs/api/interfaces/TabsContentProps.md +0 -9
  262. package/docs/api/interfaces/TabsListProps.md +0 -9
  263. package/docs/api/interfaces/TabsProps.md +0 -9
  264. package/docs/api/interfaces/TabsTriggerProps.md +0 -50
  265. package/docs/api/interfaces/TextareaProps.md +0 -53
  266. package/docs/api/interfaces/ToastActionElement.md +0 -12
  267. package/docs/api/interfaces/ToastProps.md +0 -9
  268. package/docs/api/interfaces/UnifiedAuthContextType.md +0 -823
  269. package/docs/api/interfaces/UnifiedAuthProviderProps.md +0 -173
  270. package/docs/api/interfaces/UseFormDialogOptions.md +0 -62
  271. package/docs/api/interfaces/UseFormDialogReturn.md +0 -117
  272. package/docs/api/interfaces/UseInactivityTrackerOptions.md +0 -138
  273. package/docs/api/interfaces/UseInactivityTrackerReturn.md +0 -123
  274. package/docs/api/interfaces/UsePublicEventLogoOptions.md +0 -87
  275. package/docs/api/interfaces/UsePublicEventLogoReturn.md +0 -84
  276. package/docs/api/interfaces/UsePublicEventOptions.md +0 -34
  277. package/docs/api/interfaces/UsePublicEventReturn.md +0 -71
  278. package/docs/api/interfaces/UsePublicFileDisplayOptions.md +0 -47
  279. package/docs/api/interfaces/UsePublicFileDisplayReturn.md +0 -123
  280. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +0 -97
  281. package/docs/api/interfaces/UseResolvedScopeOptions.md +0 -47
  282. package/docs/api/interfaces/UseResolvedScopeReturn.md +0 -47
  283. package/docs/api/interfaces/UseResourcePermissionsOptions.md +0 -34
  284. package/docs/api/interfaces/UserEventAccess.md +0 -121
  285. package/docs/api/interfaces/UserMenuProps.md +0 -88
  286. package/docs/api/interfaces/UserProfile.md +0 -63
  287. package/src/components/EventSelector/EventSelector.test.tsx +0 -720
  288. package/src/components/EventSelector/EventSelector.tsx +0 -423
  289. package/src/components/EventSelector/index.ts +0 -3
  290. package/src/components/OrganisationSelector/OrganisationSelector.test.tsx +0 -784
  291. package/src/components/OrganisationSelector/OrganisationSelector.tsx +0 -327
  292. package/src/components/OrganisationSelector/index.ts +0 -9
  293. /package/dist/{DataTable-TPTKCX4D.js.map → DataTable-E7YQZD7D.js.map} +0 -0
  294. /package/dist/{UnifiedAuthProvider-CH6Z342H.js.map → UnifiedAuthProvider-QPXO24B4.js.map} +0 -0
  295. /package/dist/{api-MVVQZLJI.js.map → api-6LVZTHDS.js.map} +0 -0
  296. /package/dist/{audit-B5P6FFIR.js.map → audit-V53FV5AG.js.map} +0 -0
  297. /package/dist/{chunk-2UOI2FG5.js.map → chunk-5EC5MEWX.js.map} +0 -0
  298. /package/dist/{chunk-7D4SUZUM.js.map → chunk-DGUM43GV.js.map} +0 -0
  299. /package/dist/{chunk-F2IMUDXZ.js.map → chunk-M7MPQISP.js.map} +0 -0
@@ -20,18 +20,19 @@ import {
20
20
  Input,
21
21
  Select,
22
22
  SelectContent,
23
+ SelectGroup,
23
24
  SelectItem,
24
25
  SelectLabel,
25
26
  SelectSeparator,
26
27
  SelectTrigger,
27
28
  SelectValue
28
- } from "./chunk-3XC4CPTD.js";
29
+ } from "./chunk-7JPAB3T5.js";
29
30
  import {
30
31
  useCan,
31
32
  usePermissions,
32
33
  useRBAC,
33
34
  useResolvedScope
34
- } from "./chunk-XWQCNGTQ.js";
35
+ } from "./chunk-NN6WWZ5U.js";
35
36
  import {
36
37
  createFileReferenceService,
37
38
  generateFileUrlsBatch,
@@ -43,7 +44,7 @@ import {
43
44
  useFileDisplay,
44
45
  usePreventTabReload,
45
46
  usePublicFileDisplay
46
- } from "./chunk-SFZUDBL5.js";
47
+ } from "./chunk-YKRAFF5K.js";
47
48
  import {
48
49
  useToast
49
50
  } from "./chunk-6SOIHG6Z.js";
@@ -53,16 +54,20 @@ import {
53
54
  useAppConfig,
54
55
  useEvents,
55
56
  useIsPublicPage
56
- } from "./chunk-MMZ7JXPU.js";
57
+ } from "./chunk-OEWDTMG7.js";
57
58
  import {
58
59
  EventServiceContext,
59
60
  useOrganisations,
60
61
  useSessionRestoration,
61
62
  useUnifiedAuth
62
- } from "./chunk-EHMR7VYL.js";
63
+ } from "./chunk-AVMLPIM7.js";
63
64
  import {
64
65
  isSuperAdmin
65
- } from "./chunk-24UVZUZG.js";
66
+ } from "./chunk-3LPHPB62.js";
67
+ import {
68
+ EventContextRequiredError,
69
+ OrganisationContextRequiredError
70
+ } from "./chunk-36LVWXB2.js";
66
71
  import {
67
72
  assertAppId
68
73
  } from "./chunk-QXHPKYJV.js";
@@ -75,7 +80,7 @@ import {
75
80
  } from "./chunk-M43Y4SSO.js";
76
81
  import {
77
82
  getCurrentAppName
78
- } from "./chunk-F2IMUDXZ.js";
83
+ } from "./chunk-M7MPQISP.js";
79
84
  import {
80
85
  clearPalette
81
86
  } from "./chunk-L4OXEN46.js";
@@ -404,7 +409,7 @@ function Textarea({ className, variant = "default", size = "md", error, ref, ...
404
409
  Textarea.displayName = "Textarea";
405
410
 
406
411
  // src/components/FileDisplay/FileDisplay.tsx
407
- import { useState as useState3, useEffect as useEffect3, useRef as useRef3, useContext, useMemo } from "react";
412
+ import React3, { useState as useState3, useEffect as useEffect3, useCallback as useCallback3, useRef as useRef3, useContext, useMemo } from "react";
408
413
  import { FileText, ExternalLink } from "lucide-react";
409
414
 
410
415
  // src/hooks/useFileUrl.ts
@@ -506,7 +511,7 @@ function defaultGenerateFallbackText(fileName) {
506
511
  if (words.length === 0) return "FL";
507
512
  return words.map((word) => word.charAt(0).toUpperCase()).join("").substring(0, 3);
508
513
  }
509
- function FileDisplayContent({
514
+ var FileDisplayContent = React3.memo(function FileDisplayContent2({
510
515
  isLoading,
511
516
  error,
512
517
  fileUrl,
@@ -537,6 +542,22 @@ function FileDisplayContent({
537
542
  const [internalFileUrls, setInternalFileUrls] = useState3(new Map(fileUrls));
538
543
  const [deleteDialogOpen, setDeleteDialogOpen] = useState3(false);
539
544
  const fileReferencesRef = useRef3([]);
545
+ const imgRef = useRef3(null);
546
+ const currentSrcRef = useRef3(null);
547
+ const isImageLoadingRef = useRef3(false);
548
+ const stableFileUrl = useMemo(() => fileUrl, [fileUrl]);
549
+ const handleImageLoadStart = useCallback3(() => {
550
+ isImageLoadingRef.current = true;
551
+ if (stableFileUrl) {
552
+ currentSrcRef.current = stableFileUrl;
553
+ }
554
+ }, [stableFileUrl]);
555
+ const handleImageLoad = useCallback3(() => {
556
+ isImageLoadingRef.current = false;
557
+ if (stableFileUrl) {
558
+ currentSrcRef.current = stableFileUrl;
559
+ }
560
+ }, [stableFileUrl]);
540
561
  const computedFallbackText = useMemo(() => {
541
562
  if (fallbackText) return fallbackText;
542
563
  const sourceText = fallbackSourceText ?? fileReference?.file_metadata?.fileName;
@@ -642,27 +663,32 @@ function FileDisplayContent({
642
663
  if (imageError && showFallback) {
643
664
  return /* @__PURE__ */ jsx4("figure", { className, title: fileReference.file_metadata.fileName || "File", children: /* @__PURE__ */ jsx4("p", { className: fallbackClasses, children: computedFallbackText }) });
644
665
  }
645
- if (!fileUrl) {
666
+ if (!stableFileUrl) {
646
667
  return /* @__PURE__ */ jsx4("figure", { className: className || "max-w-full h-48", title: "Loading", children: /* @__PURE__ */ jsx4("p", { className: fallbackClasses, children: /* @__PURE__ */ jsx4(LoadingSpinner, {}) }) });
647
668
  }
648
669
  return /* @__PURE__ */ jsx4("figure", { className: className || "", children: /* @__PURE__ */ jsx4(
649
670
  "img",
650
671
  {
651
- src: fileUrl,
672
+ ref: imgRef,
673
+ src: stableFileUrl || void 0,
652
674
  alt: fileReference.file_metadata.fileName || "File",
653
675
  className: imgClassName || "object-cover size-full",
654
- onError: handleImageError
655
- }
676
+ onError: handleImageError,
677
+ onLoadStart: handleImageLoadStart,
678
+ onLoad: handleImageLoad,
679
+ loading: "lazy"
680
+ },
681
+ fileReference.id
656
682
  ) });
657
683
  }
658
- if (displayOnly && !isImage && fileUrl && fileReference && !showDelete) {
684
+ if (displayOnly && !isImage && stableFileUrl && fileReference && !showDelete) {
659
685
  const fileName = fileReference.file_metadata?.fileName || "Document";
660
686
  const ariaLabel = `Open ${fileName} in new tab`;
661
687
  return /* @__PURE__ */ jsxs3("figure", { className, children: [
662
688
  /* @__PURE__ */ jsxs3(
663
689
  "a",
664
690
  {
665
- href: fileUrl,
691
+ href: stableFileUrl || void 0,
666
692
  target: "_blank",
667
693
  rel: "noopener noreferrer",
668
694
  "aria-label": ariaLabel,
@@ -684,18 +710,20 @@ function FileDisplayContent({
684
710
  ] })
685
711
  ] });
686
712
  }
687
- if (displayOnly && showFallback && (!fileUrl || imageError || !isImage)) {
713
+ if (displayOnly && showFallback && (!stableFileUrl || imageError || !isImage)) {
688
714
  return /* @__PURE__ */ jsx4("figure", { className, title: fileReference.file_metadata.fileName || "File", children: /* @__PURE__ */ jsx4("p", { className: fallbackClasses, children: computedFallbackText }) });
689
715
  }
690
- return /* @__PURE__ */ jsx4("figure", { className: `relative ${className}`, children: isImage && fileUrl && !imageError ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
716
+ return /* @__PURE__ */ jsx4("figure", { className: `relative ${className}`, children: isImage && stableFileUrl && !imageError ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
691
717
  /* @__PURE__ */ jsx4(
692
718
  "img",
693
719
  {
694
- src: fileUrl,
720
+ src: stableFileUrl,
695
721
  alt: fileReference.file_metadata.fileName || "File",
696
722
  className: imgClassName || "object-cover size-full",
697
- onError: handleImageError
698
- }
723
+ onError: handleImageError,
724
+ loading: "lazy"
725
+ },
726
+ fileReference.id
699
727
  ),
700
728
  showDelete && /* @__PURE__ */ jsxs3(Fragment3, { children: [
701
729
  /* @__PURE__ */ jsx4(
@@ -788,11 +816,13 @@ function FileDisplayContent({
788
816
  isImage && fileUrl2 ? /* @__PURE__ */ jsx4(
789
817
  "img",
790
818
  {
791
- src: fileUrl2,
819
+ src: fileUrl2 || void 0,
792
820
  alt: fileRef.file_metadata.fileName || "File",
793
821
  className: imgClassName || "object-cover size-full",
794
- onError: handleImageError
795
- }
822
+ onError: handleImageError,
823
+ loading: "lazy"
824
+ },
825
+ fileRef.id
796
826
  ) : /* @__PURE__ */ jsx4("span", { className: "text-2xl", children: getFileIcon(fileRef.file_metadata.fileType || "") }),
797
827
  showMetadata && /* @__PURE__ */ jsxs3("figcaption", { className: "flex-1 min-w-0", children: [
798
828
  /* @__PURE__ */ jsx4("p", { className: "font-medium text-sec-900 truncate", children: fileRef.file_metadata.fileName || "Unknown file" }),
@@ -831,7 +861,7 @@ function FileDisplayContent({
831
861
  }),
832
862
  children
833
863
  ] });
834
- }
864
+ });
835
865
  function FileDisplayPublic({
836
866
  table_name,
837
867
  record_id,
@@ -2371,297 +2401,98 @@ var LoginForm = React9.memo(({
2371
2401
  ] }) });
2372
2402
  });
2373
2403
 
2374
- // src/components/EventSelector/EventSelector.tsx
2375
- import { RefreshCw, AlertCircle, Lock, Calendar as Calendar2, Star } from "lucide-react";
2376
- import { useEffect as useEffect6, useMemo as useMemo5, useRef as useRef6 } from "react";
2377
- import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
2378
- function EventSelector({
2379
- placeholder = "Select an event",
2404
+ // src/components/ContextSelector/ContextSelector.tsx
2405
+ import { useMemo as useMemo5 } from "react";
2406
+ import { RefreshCw, AlertCircle, Building2, Calendar as Calendar2 } from "lucide-react";
2407
+ import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
2408
+ function ContextSelector({
2409
+ placeholder = "Select organisation or event",
2380
2410
  className,
2381
- onEventChange,
2382
- showNoEventsMessage = true,
2411
+ onOrganisationSelect,
2412
+ onEventSelect,
2413
+ showNoItemsMessage = true,
2383
2414
  showRetryButton = true,
2384
- showEventDetails = true,
2385
- showNextEventIndicator = true
2415
+ compact = false,
2416
+ disabled = false,
2417
+ showOrganisations = true,
2418
+ showEvents = true
2386
2419
  }) {
2420
+ const {
2421
+ organisations,
2422
+ selectedOrganisation,
2423
+ isLoading: orgLoading,
2424
+ error: orgError,
2425
+ refreshOrganisations
2426
+ } = useOrganisations();
2387
2427
  const {
2388
2428
  events,
2389
2429
  selectedEvent,
2390
- isLoading,
2391
- error,
2392
- setSelectedEvent,
2430
+ isLoading: eventLoading,
2431
+ error: eventError,
2393
2432
  refreshEvents
2394
2433
  } = useEvents();
2395
- const handleValueChange = (eventId) => {
2396
- const event = events.find((e) => (e.event_id || e.id) === eventId);
2397
- if (event) {
2398
- setSelectedEvent(event);
2399
- if (onEventChange) {
2400
- onEventChange(event);
2401
- }
2434
+ const { isSuperAdmin: isSuperAdmin2 } = useRBAC();
2435
+ const isLoading = showOrganisations && orgLoading || showEvents && eventLoading;
2436
+ const hasError = showOrganisations && orgError || showEvents && eventError;
2437
+ const hasItems = showOrganisations && (organisations?.length || 0) > 0 || showEvents && (events?.length || 0) > 0;
2438
+ const currentValue = useMemo5(() => {
2439
+ if (showEvents && selectedEvent) {
2440
+ return `event:${selectedEvent.event_id || selectedEvent.id}`;
2402
2441
  }
2403
- };
2404
- const handleRetry = () => {
2405
- refreshEvents();
2406
- };
2407
- const isNextEvent = (event) => {
2408
- if (!event.event_date) return false;
2409
- const now = /* @__PURE__ */ new Date();
2410
- const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
2411
- const eventDate = new Date(event.event_date);
2412
- return eventDate >= today;
2413
- };
2414
- const formatEventDate = (dateString) => {
2415
- const date = new Date(dateString);
2416
- const today = /* @__PURE__ */ new Date();
2417
- const tomorrow = new Date(today);
2418
- tomorrow.setDate(tomorrow.getDate() + 1);
2419
- const normalizeDate = (d) => {
2420
- const normalized = new Date(d);
2421
- normalized.setHours(0, 0, 0, 0);
2422
- return normalized;
2423
- };
2424
- const normalizedDate = normalizeDate(date);
2425
- const normalizedToday = normalizeDate(today);
2426
- const normalizedTomorrow = normalizeDate(tomorrow);
2427
- if (normalizedDate.getTime() === normalizedToday.getTime()) {
2428
- return "Today";
2429
- } else if (normalizedDate.getTime() === normalizedTomorrow.getTime()) {
2430
- return "Tomorrow";
2431
- } else {
2432
- return date.toLocaleDateString();
2442
+ if (showOrganisations && selectedOrganisation) {
2443
+ return `org:${selectedOrganisation.id}`;
2433
2444
  }
2434
- };
2435
- const sortedEvents = useMemo5(() => {
2436
- const getTime = (e) => e.event_date ? new Date(e.event_date).getTime() : Number.NEGATIVE_INFINITY;
2437
- return [...events].sort((a, b) => getTime(b) - getTime(a));
2438
- }, [events]);
2439
- const prevEventsLengthRef = useRef6(events.length);
2440
- const prevSelectedEventIdRef = useRef6(selectedEvent?.event_id);
2441
- const hasAutoSelectedRef = useRef6(false);
2442
- useEffect6(() => {
2443
- const eventsLengthChanged = events.length !== prevEventsLengthRef.current;
2444
- const selectedEventChanged = selectedEvent?.event_id !== prevSelectedEventIdRef.current;
2445
- if (eventsLengthChanged) {
2446
- prevEventsLengthRef.current = events.length;
2447
- if (events.length > 0) {
2448
- hasAutoSelectedRef.current = false;
2445
+ return "";
2446
+ }, [showOrganisations, showEvents, selectedOrganisation?.id, selectedEvent]);
2447
+ const handleValueChange = (value) => {
2448
+ if (disabled || isLoading) return;
2449
+ if (value.startsWith("org:") && showOrganisations) {
2450
+ const orgId = value.replace("org:", "");
2451
+ const org = organisations?.find((o) => o.id === orgId);
2452
+ if (org && onOrganisationSelect) {
2453
+ onOrganisationSelect(org);
2449
2454
  }
2450
- }
2451
- if (selectedEventChanged) {
2452
- prevSelectedEventIdRef.current = selectedEvent?.event_id;
2453
- if (selectedEvent) {
2454
- hasAutoSelectedRef.current = false;
2455
+ } else if (value.startsWith("event:") && showEvents) {
2456
+ const eventId = value.replace("event:", "");
2457
+ const event = events?.find((e) => (e.event_id || e.id) === eventId);
2458
+ if (event && onEventSelect) {
2459
+ onEventSelect(event);
2455
2460
  }
2456
2461
  }
2457
- if (!selectedEvent && events.length > 0 && !isLoading && eventsLengthChanged && !hasAutoSelectedRef.current) {
2458
- hasAutoSelectedRef.current = true;
2459
- autoSelectEvent();
2460
- }
2461
- function autoSelectEvent() {
2462
- const today = /* @__PURE__ */ new Date();
2463
- const startOfToday = new Date(today.getFullYear(), today.getMonth(), today.getDate()).getTime();
2464
- const next = [...events].filter((e) => e.event_date && new Date(e.event_date).getTime() >= startOfToday).sort((a, b) => new Date(a.event_date).getTime() - new Date(b.event_date).getTime())[0];
2465
- if (next) {
2466
- setSelectedEvent(next);
2467
- if (onEventChange) onEventChange(next);
2468
- } else {
2469
- const mostRecentPast = [...events].filter((e) => {
2470
- if (!e.event_date) return false;
2471
- const eventDate = new Date(e.event_date);
2472
- const startOfEventDate = new Date(eventDate.getFullYear(), eventDate.getMonth(), eventDate.getDate()).getTime();
2473
- return startOfEventDate < startOfToday;
2474
- }).sort((a, b) => new Date(b.event_date).getTime() - new Date(a.event_date).getTime())[0];
2475
- if (mostRecentPast) {
2476
- setSelectedEvent(mostRecentPast);
2477
- if (onEventChange) onEventChange(mostRecentPast);
2478
- }
2462
+ };
2463
+ const handleRetry = async () => {
2464
+ try {
2465
+ if (showOrganisations && orgError) {
2466
+ await refreshOrganisations();
2467
+ }
2468
+ if (showEvents && eventError) {
2469
+ await refreshEvents();
2479
2470
  }
2471
+ } catch (error) {
2472
+ logger.error("ContextSelector", "Failed to refresh:", error);
2480
2473
  }
2481
- }, [events.length, selectedEvent?.event_id, isLoading, setSelectedEvent, onEventChange]);
2482
- if (isLoading) {
2474
+ };
2475
+ if (isLoading && !hasItems) {
2476
+ const loadingText = compact ? "Loading..." : showOrganisations && showEvents ? "Loading organisations and events..." : showOrganisations ? "Loading organisations..." : "Loading events...";
2483
2477
  return /* @__PURE__ */ jsxs8("div", { className: `flex items-center gap-2 ${className}`, children: [
2484
2478
  /* @__PURE__ */ jsx13(LoadingSpinner, { size: "sm" }),
2485
- /* @__PURE__ */ jsx13("span", { className: "text-sm text-muted-foreground", children: "Loading events..." })
2479
+ /* @__PURE__ */ jsx13("span", { className: "text-sm text-muted-foreground", children: loadingText })
2486
2480
  ] });
2487
2481
  }
2488
- if (error) {
2489
- return /* @__PURE__ */ jsx13("div", { className, children: /* @__PURE__ */ jsxs8(Alert, { variant: "destructive", children: [
2490
- /* @__PURE__ */ jsx13(Lock, { className: "size-4" }),
2491
- /* @__PURE__ */ jsxs8(AlertDescription, { className: "flex items-center justify-between", children: [
2492
- /* @__PURE__ */ jsx13("span", { children: error.message }),
2493
- showRetryButton && /* @__PURE__ */ jsxs8(
2494
- Button,
2495
- {
2496
- variant: "outline",
2497
- size: "sm",
2498
- onClick: handleRetry,
2499
- className: "ml-2",
2500
- children: [
2501
- /* @__PURE__ */ jsx13(RefreshCw, { className: "size-3 mr-1" }),
2502
- "Retry"
2503
- ]
2504
- }
2505
- )
2506
- ] })
2507
- ] }) });
2508
- }
2509
- if (events.length === 0) {
2510
- if (showNoEventsMessage) {
2511
- return /* @__PURE__ */ jsx13("div", { className, children: /* @__PURE__ */ jsxs8(Alert, { variant: "inline", children: [
2512
- /* @__PURE__ */ jsx13(AlertCircle, { className: "size-4 text-acc-700" }),
2513
- /* @__PURE__ */ jsxs8(AlertDescription, { className: "flex items-center justify-between", children: [
2514
- /* @__PURE__ */ jsx13("span", { children: "No events available." }),
2515
- showRetryButton && /* @__PURE__ */ jsxs8(
2516
- Button,
2517
- {
2518
- variant: "outline",
2519
- size: "sm",
2520
- onClick: handleRetry,
2521
- className: "ml-2",
2522
- children: [
2523
- /* @__PURE__ */ jsx13(RefreshCw, { className: "size-3 mr-1" }),
2524
- "Refresh"
2525
- ]
2526
- }
2527
- )
2528
- ] })
2529
- ] }) });
2482
+ if (hasError) {
2483
+ const errorMessages = [];
2484
+ if (showOrganisations && orgError) {
2485
+ errorMessages.push(`Failed to load organisations: ${orgError.message}`);
2530
2486
  }
2531
- return null;
2532
- }
2533
- return /* @__PURE__ */ jsxs8(
2534
- Select,
2535
- {
2536
- value: selectedEvent ? selectedEvent.event_id || selectedEvent.id : "",
2537
- onValueChange: handleValueChange,
2538
- className,
2539
- children: [
2540
- /* @__PURE__ */ jsx13(SelectTrigger, { className: "text-left", variant: "outline", children: /* @__PURE__ */ jsx13(SelectValue, { placeholder, children: selectedEvent && /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
2541
- /* @__PURE__ */ jsx13(Calendar2, { className: "size-4 flex-shrink-0" }),
2542
- /* @__PURE__ */ jsx13("span", { className: "truncate", children: selectedEvent.event_name }),
2543
- selectedEvent.event_date && /* @__PURE__ */ jsxs8("span", { className: "text-xs text-muted-foreground flex-shrink-0", children: [
2544
- "(",
2545
- formatEventDate(selectedEvent.event_date),
2546
- ")"
2547
- ] })
2548
- ] }) }) }),
2549
- /* @__PURE__ */ jsx13(SelectContent, { children: sortedEvents.map((event) => {
2550
- const isNext = isNextEvent(event);
2551
- const isSelected = selectedEvent && (selectedEvent.event_id === event.event_id || selectedEvent.id === event.id);
2552
- return /* @__PURE__ */ jsx13(
2553
- SelectItem,
2554
- {
2555
- value: event.event_id || event.id,
2556
- className: "flex items-center justify-between",
2557
- children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2 w-full", children: [
2558
- showNextEventIndicator && isNext && /* @__PURE__ */ jsx13(Star, { className: "size-3 text-acc-500" }),
2559
- /* @__PURE__ */ jsxs8("div", { className: "flex-1", children: [
2560
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
2561
- /* @__PURE__ */ jsx13("span", { className: isSelected ? "font-semibold" : "", children: event.event_name }),
2562
- isSelected && /* @__PURE__ */ jsx13("span", { className: "text-xs bg-primary text-primary-foreground px-1 rounded", children: "Current" })
2563
- ] }),
2564
- showEventDetails && event.event_date && /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
2565
- /* @__PURE__ */ jsx13(Calendar2, { className: "size-3" }),
2566
- /* @__PURE__ */ jsx13("span", { children: formatEventDate(event.event_date) }),
2567
- showNextEventIndicator && isNext && /* @__PURE__ */ jsx13("span", { className: "text-acc-600 font-medium", children: "(Next)" })
2568
- ] }),
2569
- showEventDetails && event.event_venue && /* @__PURE__ */ jsxs8("div", { className: "text-xs text-muted-foreground", children: [
2570
- "\u{1F4CD} ",
2571
- event.event_venue
2572
- ] })
2573
- ] })
2574
- ] })
2575
- },
2576
- event.event_id || event.id
2577
- );
2578
- }) })
2579
- ]
2580
- }
2581
- );
2582
- }
2583
-
2584
- // src/components/OrganisationSelector/OrganisationSelector.tsx
2585
- import { useState as useState8, useCallback as useCallback8, useMemo as useMemo6 } from "react";
2586
- import { RefreshCw as RefreshCw2, AlertCircle as AlertCircle2, Building2, Shield } from "lucide-react";
2587
- import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
2588
- function OrganisationSelector({
2589
- placeholder = "Select organisation",
2590
- className,
2591
- onOrganisationChange,
2592
- showNoOrganisationsMessage = true,
2593
- showRetryButton = true,
2594
- showRole = false,
2595
- compact = false,
2596
- disabled = false
2597
- }) {
2598
- const [isLoading, setIsLoading] = useState8(false);
2599
- const [switchError, setSwitchError] = useState8(null);
2600
- const {
2601
- organisations,
2602
- selectedOrganisation,
2603
- isLoading: orgLoading,
2604
- error: orgError,
2605
- switchOrganisation,
2606
- getUserRole,
2607
- validateOrganisationAccess,
2608
- refreshOrganisations
2609
- } = useOrganisations();
2610
- const handleOrganisationChange = useCallback8(async (orgId) => {
2611
- if (disabled || isLoading) return;
2612
- setSwitchError(null);
2613
- setIsLoading(true);
2614
- try {
2615
- if (!validateOrganisationAccess(orgId)) {
2616
- throw new Error("You do not have access to this organisation");
2617
- }
2618
- await switchOrganisation(orgId);
2619
- const newOrganisation = organisations.find((org) => org.id === orgId);
2620
- if (newOrganisation && onOrganisationChange) {
2621
- onOrganisationChange(newOrganisation);
2622
- }
2623
- } catch (error) {
2624
- logger.error("OrganisationSelector", "Failed to switch organisation:", error);
2625
- setSwitchError(error instanceof Error ? error.message : "Failed to switch organisation");
2626
- } finally {
2627
- setIsLoading(false);
2628
- }
2629
- }, [
2630
- disabled,
2631
- isLoading,
2632
- validateOrganisationAccess,
2633
- switchOrganisation,
2634
- organisations,
2635
- onOrganisationChange
2636
- ]);
2637
- const handleRetry = useCallback8(async () => {
2638
- setIsLoading(true);
2639
- setSwitchError(null);
2640
- try {
2641
- await refreshOrganisations();
2642
- } catch (error) {
2643
- logger.error("OrganisationSelector", "Failed to refresh organisations:", error);
2644
- setSwitchError("Failed to refresh organisations");
2645
- } finally {
2646
- setIsLoading(false);
2487
+ if (showEvents && eventError) {
2488
+ errorMessages.push(`Failed to load events: ${eventError.message}`);
2647
2489
  }
2648
- }, [refreshOrganisations]);
2649
- if (orgLoading) {
2650
- return /* @__PURE__ */ jsxs9("div", { className: `flex items-center gap-2 ${className}`, children: [
2651
- /* @__PURE__ */ jsx14(LoadingSpinner, { size: "sm" }),
2652
- /* @__PURE__ */ jsx14("span", { className: "text-sm text-muted-foreground", children: compact ? "Loading..." : "Loading organisations..." })
2653
- ] });
2654
- }
2655
- if (orgError) {
2656
- return /* @__PURE__ */ jsxs9("div", { className: `space-y-2 ${className}`, children: [
2657
- /* @__PURE__ */ jsxs9(Alert, { variant: "destructive", children: [
2658
- /* @__PURE__ */ jsx14(AlertCircle2, { className: "size-4" }),
2659
- /* @__PURE__ */ jsxs9(AlertDescription, { children: [
2660
- "Failed to load organisations: ",
2661
- orgError.message
2662
- ] })
2490
+ return /* @__PURE__ */ jsxs8("div", { className: `space-y-2 ${className}`, children: [
2491
+ /* @__PURE__ */ jsxs8(Alert, { variant: "destructive", children: [
2492
+ /* @__PURE__ */ jsx13(AlertCircle, { className: "size-4" }),
2493
+ /* @__PURE__ */ jsx13(AlertDescription, { children: errorMessages.join(" ") })
2663
2494
  ] }),
2664
- showRetryButton && /* @__PURE__ */ jsxs9(
2495
+ showRetryButton && /* @__PURE__ */ jsxs8(
2665
2496
  Button,
2666
2497
  {
2667
2498
  variant: "outline",
@@ -2670,21 +2501,22 @@ function OrganisationSelector({
2670
2501
  disabled: isLoading,
2671
2502
  className: "w-full",
2672
2503
  children: [
2673
- /* @__PURE__ */ jsx14(RefreshCw2, { className: `size-4 mr-2 ${isLoading ? "animate-spin" : ""}` }),
2504
+ /* @__PURE__ */ jsx13(RefreshCw, { className: `size-4 mr-2 ${isLoading ? "animate-spin" : ""}` }),
2674
2505
  "Retry"
2675
2506
  ]
2676
2507
  }
2677
2508
  )
2678
2509
  ] });
2679
2510
  }
2680
- if (organisations.length === 0) {
2681
- if (showNoOrganisationsMessage) {
2682
- return /* @__PURE__ */ jsxs9("div", { className: `space-y-2 ${className}`, children: [
2683
- /* @__PURE__ */ jsxs9(Alert, { children: [
2684
- /* @__PURE__ */ jsx14(Building2, { className: "size-4" }),
2685
- /* @__PURE__ */ jsx14(AlertDescription, { children: "No organisations available. Please contact your administrator to be added to an organisation." })
2511
+ if (!hasItems) {
2512
+ if (showNoItemsMessage) {
2513
+ const noItemsText = showOrganisations && showEvents ? "No organisations or events available. Please contact your administrator." : showOrganisations ? "No organisations available. Please contact your administrator." : "No events available. Please contact your administrator.";
2514
+ return /* @__PURE__ */ jsxs8("div", { className: `space-y-2 ${className}`, children: [
2515
+ /* @__PURE__ */ jsxs8(Alert, { children: [
2516
+ /* @__PURE__ */ jsx13(AlertCircle, { className: "size-4" }),
2517
+ /* @__PURE__ */ jsx13(AlertDescription, { children: noItemsText })
2686
2518
  ] }),
2687
- showRetryButton && /* @__PURE__ */ jsxs9(
2519
+ showRetryButton && /* @__PURE__ */ jsxs8(
2688
2520
  Button,
2689
2521
  {
2690
2522
  variant: "outline",
@@ -2693,7 +2525,7 @@ function OrganisationSelector({
2693
2525
  disabled: isLoading,
2694
2526
  className: "w-full",
2695
2527
  children: [
2696
- /* @__PURE__ */ jsx14(RefreshCw2, { className: `size-4 mr-2 ${isLoading ? "animate-spin" : ""}` }),
2528
+ /* @__PURE__ */ jsx13(RefreshCw, { className: `size-4 mr-2 ${isLoading ? "animate-spin" : ""}` }),
2697
2529
  "Check Again"
2698
2530
  ]
2699
2531
  }
@@ -2702,74 +2534,103 @@ function OrganisationSelector({
2702
2534
  }
2703
2535
  return null;
2704
2536
  }
2705
- const switchErrorDisplay = switchError && /* @__PURE__ */ jsxs9(Alert, { variant: "destructive", className: "mt-2", children: [
2706
- /* @__PURE__ */ jsx14(AlertCircle2, { className: "size-4" }),
2707
- /* @__PURE__ */ jsx14(AlertDescription, { children: switchError })
2708
- ] });
2709
- const isSelectDisabled = disabled || isLoading;
2710
- const selectValue = useMemo6(() => {
2711
- return selectedOrganisation?.id || "";
2712
- }, [selectedOrganisation?.id]);
2713
- return /* @__PURE__ */ jsxs9("div", { className, children: [
2714
- /* @__PURE__ */ jsxs9(
2715
- Select,
2716
- {
2717
- value: selectValue,
2718
- onValueChange: handleOrganisationChange,
2719
- disabled: isSelectDisabled,
2720
- children: [
2721
- /* @__PURE__ */ jsx14(
2722
- SelectTrigger,
2723
- {
2724
- className: "text-left",
2725
- variant: "outline",
2726
- children: /* @__PURE__ */ jsx14(SelectValue, { placeholder, children: selectedOrganisation && /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
2727
- isLoading ? /* @__PURE__ */ jsx14(LoadingSpinner, { size: "sm" }) : /* @__PURE__ */ jsx14(Building2, { className: "size-4 flex-shrink-0" }),
2728
- /* @__PURE__ */ jsx14("span", { className: "truncate", children: selectedOrganisation.display_name })
2729
- ] }) })
2730
- }
2731
- ),
2732
- /* @__PURE__ */ jsx14(SelectContent, { children: organisations.map((org) => {
2733
- const userRole = getUserRole(org.id);
2734
- const hasAccess = validateOrganisationAccess(org.id);
2735
- return /* @__PURE__ */ jsx14(
2537
+ const displayValue = useMemo5(() => {
2538
+ if (showEvents && selectedEvent) {
2539
+ return /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
2540
+ /* @__PURE__ */ jsx13(Calendar2, { className: "size-4 flex-shrink-0" }),
2541
+ /* @__PURE__ */ jsx13("span", { className: "truncate", children: selectedEvent.event_name })
2542
+ ] });
2543
+ }
2544
+ if (showOrganisations && selectedOrganisation) {
2545
+ return /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
2546
+ /* @__PURE__ */ jsx13(Building2, { className: "size-4 flex-shrink-0" }),
2547
+ /* @__PURE__ */ jsx13("span", { className: "truncate", children: selectedOrganisation.display_name })
2548
+ ] });
2549
+ }
2550
+ return null;
2551
+ }, [showOrganisations, showEvents, selectedOrganisation, selectedEvent]);
2552
+ const effectivePlaceholder = useMemo5(() => {
2553
+ if (placeholder !== "Select organisation or event") {
2554
+ return placeholder;
2555
+ }
2556
+ if (showOrganisations && showEvents) {
2557
+ return "Select organisation or event";
2558
+ }
2559
+ if (showOrganisations) {
2560
+ return "Select organisation";
2561
+ }
2562
+ if (showEvents) {
2563
+ return "Select event";
2564
+ }
2565
+ return placeholder;
2566
+ }, [placeholder, showOrganisations, showEvents]);
2567
+ return /* @__PURE__ */ jsx13("div", { className, "data-testid": "context-selector", children: /* @__PURE__ */ jsxs8(
2568
+ Select,
2569
+ {
2570
+ value: currentValue,
2571
+ onValueChange: handleValueChange,
2572
+ disabled: disabled || isLoading,
2573
+ children: [
2574
+ /* @__PURE__ */ jsx13(
2575
+ SelectTrigger,
2576
+ {
2577
+ className: "text-left",
2578
+ variant: "outline",
2579
+ children: /* @__PURE__ */ jsx13(SelectValue, { placeholder: effectivePlaceholder, children: displayValue })
2580
+ }
2581
+ ),
2582
+ /* @__PURE__ */ jsxs8(SelectContent, { children: [
2583
+ showOrganisations && organisations && organisations.length > 0 && /* @__PURE__ */ jsxs8(Fragment6, { children: [
2584
+ /* @__PURE__ */ jsxs8(SelectGroup, { children: [
2585
+ /* @__PURE__ */ jsx13(SelectLabel, { children: "Organisations" }),
2586
+ organisations.map((org) => /* @__PURE__ */ jsx13(
2587
+ SelectItem,
2588
+ {
2589
+ value: `org:${org.id}`,
2590
+ children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
2591
+ /* @__PURE__ */ jsx13(Building2, { className: "size-4" }),
2592
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-col", children: [
2593
+ /* @__PURE__ */ jsx13("span", { className: "font-medium", children: org.display_name }),
2594
+ !compact && org.description && /* @__PURE__ */ jsx13("span", { className: "text-xs text-muted-foreground truncate max-w-40", children: org.description })
2595
+ ] })
2596
+ ] })
2597
+ },
2598
+ org.id
2599
+ ))
2600
+ ] }),
2601
+ showEvents && events && events.length > 0 && /* @__PURE__ */ jsx13(SelectSeparator, {})
2602
+ ] }),
2603
+ showEvents && events && events.length > 0 && /* @__PURE__ */ jsxs8(SelectGroup, { children: [
2604
+ /* @__PURE__ */ jsx13(SelectLabel, { children: "Events" }),
2605
+ events.map((event) => /* @__PURE__ */ jsx13(
2736
2606
  SelectItem,
2737
2607
  {
2738
- value: org.id,
2739
- disabled: !hasAccess,
2740
- className: !hasAccess ? "opacity-50" : "",
2741
- children: /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between w-full", children: [
2742
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
2743
- /* @__PURE__ */ jsx14(Building2, { className: "size-4" }),
2744
- /* @__PURE__ */ jsxs9("div", { className: "flex flex-col", children: [
2745
- /* @__PURE__ */ jsx14("span", { className: "font-medium", children: org.display_name }),
2746
- !compact && org.description && /* @__PURE__ */ jsx14("span", { className: "text-xs text-muted-foreground truncate max-w-40", children: org.description })
2747
- ] })
2748
- ] }),
2749
- showRole && /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1 ml-4", children: [
2750
- /* @__PURE__ */ jsx14(Shield, { className: "size-3 text-muted-foreground" }),
2751
- /* @__PURE__ */ jsx14("span", { className: "text-xs text-muted-foreground capitalize", children: userRole?.replace("_", " ") || "No Role" })
2608
+ value: `event:${event.event_id || event.id}`,
2609
+ children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
2610
+ /* @__PURE__ */ jsx13(Calendar2, { className: "size-4" }),
2611
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-col", children: [
2612
+ /* @__PURE__ */ jsx13("span", { className: "font-medium", children: event.event_name }),
2613
+ !compact && event.event_date && /* @__PURE__ */ jsx13("span", { className: "text-xs text-muted-foreground", children: new Date(event.event_date).toLocaleDateString() })
2752
2614
  ] })
2753
2615
  ] })
2754
2616
  },
2755
- org.id
2756
- );
2757
- }) })
2758
- ]
2759
- }
2760
- ),
2761
- switchErrorDisplay && /* @__PURE__ */ jsx14("div", { className: "mt-2", children: switchErrorDisplay })
2762
- ] });
2617
+ event.event_id || event.id
2618
+ ))
2619
+ ] })
2620
+ ] })
2621
+ ]
2622
+ }
2623
+ ) });
2763
2624
  }
2764
2625
 
2765
2626
  // src/components/PasswordChange/PasswordChangeForm.tsx
2766
- import { useState as useState9 } from "react";
2767
- import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
2627
+ import { useState as useState8 } from "react";
2628
+ import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
2768
2629
  function PasswordChangeForm({ onSubmit, className }) {
2769
- const [newPassword, setNewPassword] = useState9("");
2770
- const [confirmPassword, setConfirmPassword] = useState9("");
2771
- const [error, setError] = useState9(null);
2772
- const [isSubmitting, setIsSubmitting] = useState9(false);
2630
+ const [newPassword, setNewPassword] = useState8("");
2631
+ const [confirmPassword, setConfirmPassword] = useState8("");
2632
+ const [error, setError] = useState8(null);
2633
+ const [isSubmitting, setIsSubmitting] = useState8(false);
2773
2634
  const handleSubmit = async (e) => {
2774
2635
  e.preventDefault();
2775
2636
  setError(null);
@@ -2794,11 +2655,11 @@ function PasswordChangeForm({ onSubmit, className }) {
2794
2655
  setIsSubmitting(false);
2795
2656
  }
2796
2657
  };
2797
- return /* @__PURE__ */ jsxs10("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), children: [
2798
- error && /* @__PURE__ */ jsx15("div", { role: "alert", children: error }),
2799
- /* @__PURE__ */ jsxs10("div", { className: "space-y-2", children: [
2800
- /* @__PURE__ */ jsx15(Label, { htmlFor: "new-password", children: "New Password" }),
2801
- /* @__PURE__ */ jsx15(
2658
+ return /* @__PURE__ */ jsxs9("form", { onSubmit: handleSubmit, className: cn("space-y-4", className), children: [
2659
+ error && /* @__PURE__ */ jsx14("div", { role: "alert", children: error }),
2660
+ /* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
2661
+ /* @__PURE__ */ jsx14(Label, { htmlFor: "new-password", children: "New Password" }),
2662
+ /* @__PURE__ */ jsx14(
2802
2663
  Input,
2803
2664
  {
2804
2665
  id: "new-password",
@@ -2810,9 +2671,9 @@ function PasswordChangeForm({ onSubmit, className }) {
2810
2671
  }
2811
2672
  )
2812
2673
  ] }),
2813
- /* @__PURE__ */ jsxs10("div", { className: "space-y-2", children: [
2814
- /* @__PURE__ */ jsx15(Label, { htmlFor: "confirm-password", children: "Confirm Password" }),
2815
- /* @__PURE__ */ jsx15(
2674
+ /* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
2675
+ /* @__PURE__ */ jsx14(Label, { htmlFor: "confirm-password", children: "Confirm Password" }),
2676
+ /* @__PURE__ */ jsx14(
2816
2677
  Input,
2817
2678
  {
2818
2679
  id: "confirm-password",
@@ -2824,7 +2685,7 @@ function PasswordChangeForm({ onSubmit, className }) {
2824
2685
  }
2825
2686
  )
2826
2687
  ] }),
2827
- /* @__PURE__ */ jsx15(
2688
+ /* @__PURE__ */ jsx14(
2828
2689
  Button,
2829
2690
  {
2830
2691
  type: "submit",
@@ -2837,9 +2698,9 @@ function PasswordChangeForm({ onSubmit, className }) {
2837
2698
  }
2838
2699
 
2839
2700
  // src/components/UserMenu/UserMenu.tsx
2840
- import React12, { useCallback as useCallback9, useMemo as useMemo7, useState as useState10 } from "react";
2701
+ import React12, { useCallback as useCallback8, useMemo as useMemo6, useState as useState9 } from "react";
2841
2702
  import { ChevronDown, LogOut, KeyRound } from "lucide-react";
2842
- import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
2703
+ import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
2843
2704
  var UserMenu = React12.memo(function UserMenu2({
2844
2705
  user,
2845
2706
  onSignOut,
@@ -2847,8 +2708,8 @@ var UserMenu = React12.memo(function UserMenu2({
2847
2708
  className,
2848
2709
  showAvatar = true
2849
2710
  }) {
2850
- const [isPasswordDialogOpen, setPasswordDialogOpen] = useState10(false);
2851
- const userInfo = useMemo7(() => {
2711
+ const [isPasswordDialogOpen, setPasswordDialogOpen] = useState9(false);
2712
+ const userInfo = useMemo6(() => {
2852
2713
  if (!user) return null;
2853
2714
  return {
2854
2715
  email: user.email,
@@ -2857,16 +2718,16 @@ var UserMenu = React12.memo(function UserMenu2({
2857
2718
  initial: (user.user_metadata?.display_name || user.user_metadata?.full_name || user.email || "U").charAt(0).toUpperCase()
2858
2719
  };
2859
2720
  }, [user]);
2860
- const handleSignOut = useCallback9(async () => {
2721
+ const handleSignOut = useCallback8(async () => {
2861
2722
  if (onSignOut) await onSignOut();
2862
2723
  }, [onSignOut]);
2863
2724
  if (!user || !userInfo) {
2864
2725
  return null;
2865
2726
  }
2866
- return /* @__PURE__ */ jsxs11(Dialog, { open: isPasswordDialogOpen, onOpenChange: setPasswordDialogOpen, children: [
2867
- /* @__PURE__ */ jsxs11(Select, { className, children: [
2868
- /* @__PURE__ */ jsx16(SelectTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(Button, { variant: "outline", className: "flex items-center gap-2", "aria-label": userInfo.displayName, children: [
2869
- showAvatar && /* @__PURE__ */ jsx16(
2727
+ return /* @__PURE__ */ jsxs10(Dialog, { open: isPasswordDialogOpen, onOpenChange: setPasswordDialogOpen, children: [
2728
+ /* @__PURE__ */ jsxs10(Select, { className, children: [
2729
+ /* @__PURE__ */ jsx15(SelectTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(Button, { variant: "outline", className: "flex items-center gap-2", "aria-label": userInfo.displayName, children: [
2730
+ showAvatar && /* @__PURE__ */ jsx15(
2870
2731
  Avatar,
2871
2732
  {
2872
2733
  src: userInfo.avatarUrl,
@@ -2875,30 +2736,30 @@ var UserMenu = React12.memo(function UserMenu2({
2875
2736
  className: "size-7"
2876
2737
  }
2877
2738
  ),
2878
- /* @__PURE__ */ jsx16("span", { children: userInfo.displayName }),
2879
- /* @__PURE__ */ jsx16(ChevronDown, { className: "size-4" })
2739
+ /* @__PURE__ */ jsx15("span", { children: userInfo.displayName }),
2740
+ /* @__PURE__ */ jsx15(ChevronDown, { className: "size-4" })
2880
2741
  ] }) }),
2881
- /* @__PURE__ */ jsxs11(SelectContent, { children: [
2882
- /* @__PURE__ */ jsx16(SelectLabel, { className: "font-normal", children: /* @__PURE__ */ jsxs11("li", { className: "pt-2", children: [
2742
+ /* @__PURE__ */ jsxs10(SelectContent, { children: [
2743
+ /* @__PURE__ */ jsx15(SelectLabel, { className: "font-normal", children: /* @__PURE__ */ jsxs10("li", { className: "pt-2", children: [
2883
2744
  userInfo.displayName,
2884
- /* @__PURE__ */ jsx16("br", {}),
2885
- /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: userInfo.email })
2745
+ /* @__PURE__ */ jsx15("br", {}),
2746
+ /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: userInfo.email })
2886
2747
  ] }) }),
2887
- /* @__PURE__ */ jsx16(SelectSeparator, {}),
2888
- /* @__PURE__ */ jsx16(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(SelectItem, { value: "change-password", children: [
2889
- /* @__PURE__ */ jsx16(KeyRound, { className: "mr-2 size-4" }),
2890
- /* @__PURE__ */ jsx16("span", { children: "Change Password" })
2748
+ /* @__PURE__ */ jsx15(SelectSeparator, {}),
2749
+ /* @__PURE__ */ jsx15(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(SelectItem, { value: "change-password", children: [
2750
+ /* @__PURE__ */ jsx15(KeyRound, { className: "mr-2 size-4" }),
2751
+ /* @__PURE__ */ jsx15("span", { children: "Change Password" })
2891
2752
  ] }) }),
2892
- /* @__PURE__ */ jsxs11(SelectItem, { value: "sign-out", onClick: handleSignOut, children: [
2893
- /* @__PURE__ */ jsx16(LogOut, { className: "mr-2 size-4" }),
2894
- /* @__PURE__ */ jsx16("span", { children: "Sign out" })
2753
+ /* @__PURE__ */ jsxs10(SelectItem, { value: "sign-out", onClick: handleSignOut, children: [
2754
+ /* @__PURE__ */ jsx15(LogOut, { className: "mr-2 size-4" }),
2755
+ /* @__PURE__ */ jsx15("span", { children: "Sign out" })
2895
2756
  ] })
2896
2757
  ] })
2897
2758
  ] }),
2898
- /* @__PURE__ */ jsx16(DialogOverlay, {}),
2899
- /* @__PURE__ */ jsxs11(DialogContent, { className, children: [
2900
- /* @__PURE__ */ jsx16(DialogHeader, { children: /* @__PURE__ */ jsx16(DialogTitle, { children: "Change Password" }) }),
2901
- /* @__PURE__ */ jsx16(
2759
+ /* @__PURE__ */ jsx15(DialogOverlay, {}),
2760
+ /* @__PURE__ */ jsxs10(DialogContent, { className, children: [
2761
+ /* @__PURE__ */ jsx15(DialogHeader, { children: /* @__PURE__ */ jsx15(DialogTitle, { children: "Change Password" }) }),
2762
+ /* @__PURE__ */ jsx15(
2902
2763
  PasswordChangeForm,
2903
2764
  {
2904
2765
  onSubmit: async ({ newPassword, confirmPassword }) => {
@@ -2917,7 +2778,7 @@ var UserMenu = React12.memo(function UserMenu2({
2917
2778
  ] });
2918
2779
  });
2919
2780
  var UserMenuLoading = React12.memo(function UserMenuLoading2() {
2920
- return /* @__PURE__ */ jsxs11(
2781
+ return /* @__PURE__ */ jsxs10(
2921
2782
  Button,
2922
2783
  {
2923
2784
  type: "button",
@@ -2926,9 +2787,9 @@ var UserMenuLoading = React12.memo(function UserMenuLoading2() {
2926
2787
  className: "flex items-center space-x-2",
2927
2788
  "aria-label": "Loading user menu",
2928
2789
  children: [
2929
- /* @__PURE__ */ jsx16(LoadingSpinner, { size: "sm", className: "inline-block mr-2" }),
2930
- /* @__PURE__ */ jsx16("span", { className: "truncate max-w-[150px]", children: "Loading..." }),
2931
- /* @__PURE__ */ jsx16(ChevronDown, { className: "w-4 h-4 text-muted-foreground" })
2790
+ /* @__PURE__ */ jsx15(LoadingSpinner, { size: "sm", className: "inline-block mr-2" }),
2791
+ /* @__PURE__ */ jsx15("span", { className: "truncate max-w-[150px]", children: "Loading..." }),
2792
+ /* @__PURE__ */ jsx15(ChevronDown, { className: "w-4 h-4 text-muted-foreground" })
2932
2793
  ]
2933
2794
  }
2934
2795
  );
@@ -2984,7 +2845,7 @@ function useNavigationFiltering({
2984
2845
  }
2985
2846
  const userId2 = authContext.user.id;
2986
2847
  const appName = authContext.appName;
2987
- import("./api-MVVQZLJI.js").then(({ resolveAppContext }) => {
2848
+ import("./api-6LVZTHDS.js").then(({ resolveAppContext }) => {
2988
2849
  resolveAppContext({
2989
2850
  userId: userId2,
2990
2851
  appName
@@ -3227,7 +3088,7 @@ function useNavigationFiltering({
3227
3088
  }
3228
3089
 
3229
3090
  // src/components/NavigationMenu/NavigationMenu.tsx
3230
- import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
3091
+ import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
3231
3092
  var NavigationMenu = React14.forwardRef(({
3232
3093
  items,
3233
3094
  mode = "dropdown",
@@ -3370,8 +3231,8 @@ var NavigationMenu = React14.forwardRef(({
3370
3231
  const hasChildren = item.children && item.children.length > 0;
3371
3232
  const isExpanded = expandedItems.has(item.id);
3372
3233
  const itemIsActive = isActiveItem(item);
3373
- return /* @__PURE__ */ jsx17("li", { role: "none", children: hasChildren ? /* @__PURE__ */ jsxs12("div", { children: [
3374
- /* @__PURE__ */ jsxs12(
3234
+ return /* @__PURE__ */ jsx16("li", { role: "none", children: hasChildren ? /* @__PURE__ */ jsxs11("div", { children: [
3235
+ /* @__PURE__ */ jsxs11(
3375
3236
  "button",
3376
3237
  {
3377
3238
  onClick: () => toggleExpanded(item.id),
@@ -3380,21 +3241,21 @@ var NavigationMenu = React14.forwardRef(({
3380
3241
  "aria-controls": `submenu-${item.id}`,
3381
3242
  "aria-current": itemIsActive ? "page" : void 0,
3382
3243
  children: [
3383
- /* @__PURE__ */ jsx17("span", { children: item.label }),
3384
- /* @__PURE__ */ jsx17(ChevronDown2, { "aria-hidden": "true" })
3244
+ /* @__PURE__ */ jsx16("span", { children: item.label }),
3245
+ /* @__PURE__ */ jsx16(ChevronDown2, { "aria-hidden": "true" })
3385
3246
  ]
3386
3247
  }
3387
3248
  ),
3388
- isExpanded && item.children && /* @__PURE__ */ jsx17(
3249
+ isExpanded && item.children && /* @__PURE__ */ jsx16(
3389
3250
  "ul",
3390
3251
  {
3391
3252
  id: `submenu-${item.id}`,
3392
3253
  role: "menu",
3393
3254
  "aria-label": `${item.label} submenu`,
3394
- children: item.children.map((child) => /* @__PURE__ */ jsx17(React14.Fragment, { children: renderHierarchicalItem(child, level + 1) }, child.id))
3255
+ children: item.children.map((child) => /* @__PURE__ */ jsx16(React14.Fragment, { children: renderHierarchicalItem(child, level + 1) }, child.id))
3395
3256
  }
3396
3257
  )
3397
- ] }) : /* @__PURE__ */ jsx17(
3258
+ ] }) : /* @__PURE__ */ jsx16(
3398
3259
  "a",
3399
3260
  {
3400
3261
  href: item.href || "#",
@@ -3412,26 +3273,26 @@ var NavigationMenu = React14.forwardRef(({
3412
3273
  ) });
3413
3274
  };
3414
3275
  if (mode === "dropdown") {
3415
- return /* @__PURE__ */ jsxs12(
3276
+ return /* @__PURE__ */ jsxs11(
3416
3277
  Select,
3417
3278
  {
3418
3279
  onValueChange: handleNavigationSelect,
3419
3280
  className,
3420
3281
  "data-testid": "navigation-menu-root",
3421
3282
  children: [
3422
- /* @__PURE__ */ jsx17(
3283
+ /* @__PURE__ */ jsx16(
3423
3284
  SelectTrigger,
3424
3285
  {
3425
3286
  ref: buttonRef,
3426
3287
  disabled,
3427
3288
  "aria-label": buttonText,
3428
3289
  "data-testid": "navigation-menu-trigger",
3429
- children: /* @__PURE__ */ jsx17(SelectValue, { placeholder: buttonText })
3290
+ children: /* @__PURE__ */ jsx16(SelectValue, { placeholder: buttonText })
3430
3291
  }
3431
3292
  ),
3432
- /* @__PURE__ */ jsx17(SelectContent, { children: filteredItems.map((item) => {
3293
+ /* @__PURE__ */ jsx16(SelectContent, { children: filteredItems.map((item) => {
3433
3294
  const isActive = isActiveItem(item);
3434
- return /* @__PURE__ */ jsx17(
3295
+ return /* @__PURE__ */ jsx16(
3435
3296
  SelectItem,
3436
3297
  {
3437
3298
  value: item.id,
@@ -3446,14 +3307,14 @@ var NavigationMenu = React14.forwardRef(({
3446
3307
  }
3447
3308
  );
3448
3309
  }
3449
- return /* @__PURE__ */ jsx17(
3310
+ return /* @__PURE__ */ jsx16(
3450
3311
  "nav",
3451
3312
  {
3452
3313
  ref,
3453
3314
  className,
3454
3315
  "aria-label": navigationLabel,
3455
3316
  ...props,
3456
- children: /* @__PURE__ */ jsx17("ul", { role: "menubar", children: filteredItems.map((item) => /* @__PURE__ */ jsx17(React14.Fragment, { children: renderHierarchicalItem(item, 0) }, item.id)) })
3317
+ children: /* @__PURE__ */ jsx16("ul", { role: "menubar", children: filteredItems.map((item) => /* @__PURE__ */ jsx16(React14.Fragment, { children: renderHierarchicalItem(item, 0) }, item.id)) })
3457
3318
  }
3458
3319
  );
3459
3320
  });
@@ -3461,7 +3322,7 @@ NavigationMenu.displayName = "NavigationMenu";
3461
3322
 
3462
3323
  // src/components/Header/Header.tsx
3463
3324
  import { Link } from "react-router-dom";
3464
- import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
3325
+ import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
3465
3326
  function Header({
3466
3327
  logoUrl,
3467
3328
  logoAlt = "Logo",
@@ -3473,54 +3334,43 @@ function Header({
3473
3334
  actions,
3474
3335
  userMenu,
3475
3336
  className,
3476
- showEventSelector = true,
3477
- showOrgSelector = false,
3337
+ showContextSelector = true,
3338
+ showOrganisations = true,
3339
+ showEvents = true,
3478
3340
  showUserMenu = true,
3479
3341
  currentPath,
3480
3342
  onNavigate,
3481
3343
  logoHref
3482
3344
  }) {
3483
- const OrganisationSelectorConditional = () => {
3484
- const { organisations, isContextReady } = useOrganisations();
3485
- if (!isContextReady || !organisations || organisations.length === 0) {
3486
- return null;
3487
- }
3488
- return /* @__PURE__ */ jsx18(
3489
- OrganisationSelector,
3490
- {
3491
- placeholder: "Select organisation",
3492
- className: "w-64",
3493
- "data-testid": "org-selector",
3494
- compact: true
3495
- }
3496
- );
3497
- };
3498
- return /* @__PURE__ */ jsx18("header", { className: cn(
3345
+ const shouldShowContextSelector = showContextSelector !== false;
3346
+ const { switchOrganisation } = useOrganisations();
3347
+ const { events, setSelectedEvent } = useEvents();
3348
+ return /* @__PURE__ */ jsx17("header", { className: cn(
3499
3349
  "w-full border-b border-main-200 h-16 shadow-sm bg-main-100 ",
3500
3350
  className
3501
- ), role: "banner", children: /* @__PURE__ */ jsxs13("nav", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto grid grid-cols-[auto_1fr_auto_auto_auto_auto] items-center gap-4 h-full", children: [
3502
- logo ? logoHref ? /* @__PURE__ */ jsx18(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: logo }) : logo : logoUrl ? logoHref ? /* @__PURE__ */ jsx18(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: /* @__PURE__ */ jsx18(
3351
+ ), role: "banner", children: /* @__PURE__ */ jsxs12("nav", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto grid grid-cols-[auto_1fr_auto_auto_auto_auto] items-center gap-4 h-full", children: [
3352
+ logo ? logoHref ? /* @__PURE__ */ jsx17(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: logo }) : logo : logoUrl ? logoHref ? /* @__PURE__ */ jsx17(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: /* @__PURE__ */ jsx17(
3503
3353
  "img",
3504
3354
  {
3505
3355
  src: logoUrl,
3506
3356
  alt: logoAlt || "Logo",
3507
3357
  className: "h-[2.15rem] w-auto max-w-[200px] object-contain rounded-md shadow-md bg-transparent"
3508
3358
  }
3509
- ) }) : /* @__PURE__ */ jsx18(
3359
+ ) }) : /* @__PURE__ */ jsx17(
3510
3360
  "img",
3511
3361
  {
3512
3362
  src: logoUrl,
3513
3363
  alt: logoAlt || "Logo",
3514
3364
  className: "h-[2.15rem] w-auto max-w-[200px] object-contain rounded-md shadow-md bg-transparent"
3515
3365
  }
3516
- ) : logoHref ? /* @__PURE__ */ jsx18(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: /* @__PURE__ */ jsx18(
3366
+ ) : logoHref ? /* @__PURE__ */ jsx17(Link, { to: logoHref, className: "cursor-pointer hover:opacity-80 transition-opacity", children: /* @__PURE__ */ jsx17(
3517
3367
  "img",
3518
3368
  {
3519
3369
  src: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23000'/%3E%3Ctext x='16' y='20' text-anchor='middle' fill='white' font-family='Arial' font-size='14' font-weight='bold'%3EL%3C/text%3E%3C/svg%3E",
3520
3370
  alt: logoAlt || "Logo",
3521
3371
  className: "size-8 shadow-md"
3522
3372
  }
3523
- ) }) : /* @__PURE__ */ jsx18(
3373
+ ) }) : /* @__PURE__ */ jsx17(
3524
3374
  "img",
3525
3375
  {
3526
3376
  src: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23000'/%3E%3Ctext x='16' y='20' text-anchor='middle' fill='white' font-family='Arial' font-size='14' font-weight='bold'%3EL%3C/text%3E%3C/svg%3E",
@@ -3528,7 +3378,7 @@ function Header({
3528
3378
  className: "size-8 shadow-md"
3529
3379
  }
3530
3380
  ),
3531
- navItems && navItems.length > 0 && /* @__PURE__ */ jsx18(
3381
+ navItems && navItems.length > 0 && /* @__PURE__ */ jsx17(
3532
3382
  NavigationMenu,
3533
3383
  {
3534
3384
  items: navItems,
@@ -3539,23 +3389,30 @@ function Header({
3539
3389
  itemsPreFiltered: true
3540
3390
  }
3541
3391
  ),
3542
- showOrgSelector ? /* @__PURE__ */ jsx18(OrganisationSelectorConditional, {}) : null,
3543
- showEventSelector ? /* @__PURE__ */ jsx18(
3544
- EventSelector,
3392
+ shouldShowContextSelector ? /* @__PURE__ */ jsx17(
3393
+ ContextSelector,
3545
3394
  {
3546
- placeholder: "Select event",
3395
+ placeholder: "Select organisation or event",
3547
3396
  className: cn(
3548
3397
  "w-96",
3549
- // If both org selector and actions exist, EventSelector uses 1 column
3550
- // If only one exists, EventSelector spans 2 columns
3551
- // If neither exists, EventSelector spans 3 columns
3552
- showOrgSelector && actions ? "col-span-1" : showOrgSelector || actions ? "col-span-2" : "col-span-3"
3398
+ // Adjust width based on whether actions exist
3399
+ actions ? "col-span-1" : "col-span-2"
3553
3400
  ),
3554
- "data-testid": "event-selector"
3401
+ showOrganisations,
3402
+ showEvents,
3403
+ onOrganisationSelect: async (org) => {
3404
+ setSelectedEvent(null);
3405
+ await switchOrganisation(org.id);
3406
+ },
3407
+ onEventSelect: (event) => {
3408
+ const fullEvent = events.find((e) => (e.event_id || e.id) === (event.event_id || event.id));
3409
+ setSelectedEvent(fullEvent || event);
3410
+ },
3411
+ compact: true
3555
3412
  }
3556
3413
  ) : null,
3557
3414
  actions,
3558
- showUserMenu && (userMenu ? userMenu : /* @__PURE__ */ jsx18(
3415
+ showUserMenu && (userMenu ? userMenu : /* @__PURE__ */ jsx17(
3559
3416
  UserMenu,
3560
3417
  {
3561
3418
  user: user || null,
@@ -3569,7 +3426,7 @@ function Header({
3569
3426
 
3570
3427
  // src/components/Footer/Footer.tsx
3571
3428
  import React15 from "react";
3572
- import { Fragment as Fragment7, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
3429
+ import { Fragment as Fragment8, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
3573
3430
  var FooterComponent = ({
3574
3431
  companyName = "Solvera Solutions Pty Ltd",
3575
3432
  year = (/* @__PURE__ */ new Date()).getFullYear(),
@@ -3580,11 +3437,11 @@ var FooterComponent = ({
3580
3437
  children
3581
3438
  }) => {
3582
3439
  const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
3583
- return /* @__PURE__ */ jsx19("footer", { className: cn("mt-8 py-6 flex justify-center border-t border-border bg-main-100", className), children: /* @__PURE__ */ jsxs14("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
3584
- logo && /* @__PURE__ */ jsx19("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
3585
- children && /* @__PURE__ */ jsx19(Fragment7, { children }),
3586
- /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: copyrightText }),
3587
- links && links.length > 0 && /* @__PURE__ */ jsx19("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx19("li", { children: /* @__PURE__ */ jsx19("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
3440
+ return /* @__PURE__ */ jsx18("footer", { className: cn("mt-8 py-6 flex justify-center border-t border-border bg-main-100", className), children: /* @__PURE__ */ jsxs13("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
3441
+ logo && /* @__PURE__ */ jsx18("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
3442
+ children && /* @__PURE__ */ jsx18(Fragment8, { children }),
3443
+ /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: copyrightText }),
3444
+ links && links.length > 0 && /* @__PURE__ */ jsx18("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx18("li", { children: /* @__PURE__ */ jsx18("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
3588
3445
  ] }) });
3589
3446
  };
3590
3447
  FooterComponent.displayName = "Footer";
@@ -3592,16 +3449,17 @@ var Footer = React15.memo(FooterComponent);
3592
3449
  Footer.displayName = "Footer";
3593
3450
 
3594
3451
  // src/components/PaceAppLayout/PaceAppLayout.tsx
3595
- import { useState as useState13, useEffect as useEffect8, useMemo as useMemo9 } from "react";
3452
+ import { useState as useState12, useEffect as useEffect7, useMemo as useMemo8 } from "react";
3596
3453
  import { Outlet, useNavigate, useLocation } from "react-router-dom";
3597
- import { Fragment as Fragment8, jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
3454
+ import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
3598
3455
  var EMPTY_PAGE_ID_MAPPING = {};
3599
3456
  var EMPTY_ROUTE_PERMISSIONS = {};
3600
3457
  function PaceAppLayout({
3601
3458
  appName,
3602
3459
  navItems,
3603
- showEventSelector,
3604
- showOrgSelector,
3460
+ showContextSelector = true,
3461
+ showOrganisations = true,
3462
+ showEvents = true,
3605
3463
  headerActions,
3606
3464
  customLogo,
3607
3465
  logoHref = "/dashboard",
@@ -3636,9 +3494,9 @@ function PaceAppLayout({
3636
3494
  isLoading: organisationLoading
3637
3495
  } = useOrganisations();
3638
3496
  const { isSuperAdmin: isSuperAdminFromRBAC, isLoading: rbacLoading } = useRBAC();
3639
- const [isSuperAdminDirect, setIsSuperAdminDirect] = useState13(false);
3640
- const [isCheckingSuperAdminDirect, setIsCheckingSuperAdminDirect] = useState13(false);
3641
- useEffect8(() => {
3497
+ const [isSuperAdminDirect, setIsSuperAdminDirect] = useState12(false);
3498
+ const [isCheckingSuperAdminDirect, setIsCheckingSuperAdminDirect] = useState12(false);
3499
+ useEffect7(() => {
3642
3500
  const checkSuperAdminDirect = async () => {
3643
3501
  if (!user?.id) {
3644
3502
  setIsSuperAdminDirect(false);
@@ -3681,7 +3539,7 @@ function PaceAppLayout({
3681
3539
  const scopeOrgId = resolvedScope?.organisationId || selectedOrganisation?.id || "";
3682
3540
  const scopeEventId = resolvedScope?.eventId || selectedEvent?.event_id || void 0;
3683
3541
  const scopeAppId = resolvedScope?.appId || resolvedAppId || void 0;
3684
- const scope = useMemo9(() => {
3542
+ const scope = useMemo8(() => {
3685
3543
  const newScope = {};
3686
3544
  if (scopeOrgId) {
3687
3545
  newScope.organisationId = scopeOrgId;
@@ -3694,19 +3552,19 @@ function PaceAppLayout({
3694
3552
  }
3695
3553
  return newScope;
3696
3554
  }, [scopeOrgId, scopeEventId, scopeAppId]);
3697
- const defaultNavItems = useMemo9(() => [
3555
+ const defaultNavItems = useMemo8(() => [
3698
3556
  { id: "home", label: "Home", href: "/", icon: "Home" },
3699
3557
  { id: "dashboard", label: "Dashboard", href: "/dashboard", icon: "LayoutDashboard" },
3700
3558
  { id: "settings", label: "Settings", href: "/settings", icon: "Settings" },
3701
3559
  { id: "ui-showcase", label: "UI Showcase", href: "/ui-showcase", icon: "Component" },
3702
3560
  { id: "data-table-showcase", label: "DataTable Showcase", href: "/data-table-showcase", icon: "Table" }
3703
3561
  ], []);
3704
- const baseMenuItems = useMemo9(() => navItems || defaultNavItems, [navItems]);
3705
- const currentRoutePermission = useMemo9(() => {
3562
+ const baseMenuItems = useMemo8(() => navItems || defaultNavItems, [navItems]);
3563
+ const currentRoutePermission = useMemo8(() => {
3706
3564
  const currentPath = location.pathname;
3707
3565
  return routePermissions[currentPath] || defaultPermission;
3708
3566
  }, [location.pathname, routePermissions, defaultPermission]);
3709
- const currentPageId = useMemo9(() => {
3567
+ const currentPageId = useMemo8(() => {
3710
3568
  const currentPath = location.pathname;
3711
3569
  if (pageIdMapping[currentPath]) {
3712
3570
  return pageIdMapping[currentPath];
@@ -3714,7 +3572,7 @@ function PaceAppLayout({
3714
3572
  const pathSegments = currentPath.slice(1).split("/").filter(Boolean);
3715
3573
  return pathSegments[0] || "";
3716
3574
  }, [location.pathname, pageIdMapping]);
3717
- const currentPermission = useMemo9(() => {
3575
+ const currentPermission = useMemo8(() => {
3718
3576
  if (!enforcePermissions || !currentPageId) {
3719
3577
  return "";
3720
3578
  }
@@ -3737,7 +3595,13 @@ function PaceAppLayout({
3737
3595
  );
3738
3596
  const can = isSuperAdmin2 ? true : canFromHook;
3739
3597
  const hasPermission = enforcePermissions ? can : true;
3740
- useEffect8(() => {
3598
+ const isContextError = useMemo8(() => {
3599
+ if (!permissionError) {
3600
+ return false;
3601
+ }
3602
+ return permissionError instanceof EventContextRequiredError || permissionError instanceof OrganisationContextRequiredError || permissionError.name === "EventContextRequiredError" || permissionError.name === "OrganisationContextRequiredError";
3603
+ }, [permissionError]);
3604
+ useEffect7(() => {
3741
3605
  if (!enforcePermissions) {
3742
3606
  return;
3743
3607
  }
@@ -3760,8 +3624,8 @@ function PaceAppLayout({
3760
3624
  onPageAccessDenied(currentPageId, currentRoutePermission);
3761
3625
  }
3762
3626
  }, [enforcePermissions, can, isCheckingPermission, isSuperAdmin2, currentPageId, currentRoutePermission, user?.id, strictMode, auditLog, onPageAccessDenied, onStrictModeViolation]);
3763
- const [filteredMenuItems, setFilteredMenuItems] = useState13(baseMenuItems);
3764
- useEffect8(() => {
3627
+ const [filteredMenuItems, setFilteredMenuItems] = useState12(baseMenuItems);
3628
+ useEffect7(() => {
3765
3629
  let isMounted = true;
3766
3630
  const filterItems = async () => {
3767
3631
  if (!user?.id) {
@@ -3787,7 +3651,7 @@ function PaceAppLayout({
3787
3651
  return;
3788
3652
  }
3789
3653
  try {
3790
- const { isSuperAdmin: checkSuperAdminDynamic } = await import("./api-MVVQZLJI.js");
3654
+ const { isSuperAdmin: checkSuperAdminDynamic } = await import("./api-6LVZTHDS.js");
3791
3655
  const isSuper = await checkSuperAdminDynamic(user.id);
3792
3656
  if (isSuper) {
3793
3657
  if (isMounted) {
@@ -3802,7 +3666,7 @@ function PaceAppLayout({
3802
3666
  }
3803
3667
  }
3804
3668
  try {
3805
- const { getPermissionMap } = await import("./api-MVVQZLJI.js");
3669
+ const { getPermissionMap } = await import("./api-6LVZTHDS.js");
3806
3670
  const permissionScope = {
3807
3671
  organisationId: currentScope.organisationId,
3808
3672
  eventId: currentScope.eventId,
@@ -3813,16 +3677,80 @@ function PaceAppLayout({
3813
3677
  userId: user.id,
3814
3678
  scope: permissionScope
3815
3679
  });
3816
- const filtered = baseMenuItems.map((item) => {
3817
- if (!item.href) return { item, hasAccess: true };
3818
- const pageId = pageIdMapping[item.href] || (item.href === "/" ? "dashboard" : item.href.slice(1)) || "dashboard";
3819
- const permission = routePermissions[item.href] || defaultPermission;
3820
- const fullPermission = permission.includes(":") ? permission : pageId ? `${permission}:page.${pageId}` : permission;
3821
- const hasAccess = permissionMap["*"] === true || permissionMap[fullPermission] === true;
3822
- return { item, hasAccess };
3823
- });
3680
+ const { getPageScopeType } = await import("./api-6LVZTHDS.js");
3681
+ const effectiveAppId = currentScope.appId || resolvedAppId;
3682
+ const effectiveAppName = appName;
3683
+ const hasEventContext = !!currentScope.eventId;
3684
+ const hasOrgContext = !!currentScope.organisationId;
3685
+ const filtered = await Promise.all(
3686
+ baseMenuItems.map(async (item) => {
3687
+ if (!item.href) return { item, hasAccess: true, matchesScope: true, scopeCheckError: false };
3688
+ const pageId = pageIdMapping[item.href] || (item.href === "/" ? "dashboard" : item.href.slice(1)) || "dashboard";
3689
+ const permission = routePermissions[item.href] || defaultPermission;
3690
+ const fullPermission = permission.includes(":") ? permission : pageId ? `${permission}:page.${pageId}` : permission;
3691
+ const hasAccess = permissionMap["*"] === true || permissionMap[fullPermission] === true;
3692
+ let matchesScope = true;
3693
+ let scopeCheckError = false;
3694
+ if (effectiveAppId || effectiveAppName) {
3695
+ try {
3696
+ const pageScopeType = await getPageScopeType(
3697
+ pageId,
3698
+ effectiveAppId,
3699
+ effectiveAppName
3700
+ );
3701
+ if (hasEventContext) {
3702
+ matchesScope = pageScopeType === "event" || pageScopeType === "both";
3703
+ } else if (hasOrgContext) {
3704
+ matchesScope = pageScopeType === "organisation" || pageScopeType === "both";
3705
+ } else {
3706
+ matchesScope = true;
3707
+ }
3708
+ } catch (error) {
3709
+ scopeCheckError = true;
3710
+ logger.warn("PaceAppLayout", "Failed to get page scope type for navigation filtering", {
3711
+ pageId,
3712
+ href: item.href,
3713
+ contextType: hasEventContext ? "event" : hasOrgContext ? "organisation" : "none",
3714
+ error: error instanceof Error ? error.message : String(error),
3715
+ note: "Allowing page to prevent navigation from disappearing - this may indicate missing scope_type in database"
3716
+ });
3717
+ matchesScope = true;
3718
+ }
3719
+ } else {
3720
+ matchesScope = true;
3721
+ }
3722
+ return { item, hasAccess, matchesScope, scopeCheckError };
3723
+ })
3724
+ );
3824
3725
  if (!isMounted) return;
3825
- const accessibleItems = filtered.filter(({ hasAccess }) => hasAccess).map(({ item }) => item);
3726
+ const accessibleItems = filtered.filter(({ hasAccess, matchesScope }) => hasAccess && matchesScope).map(({ item }) => item);
3727
+ if (accessibleItems.length === 0 && filtered.length > 0) {
3728
+ const itemsWithPermissions = filtered.filter(({ hasAccess }) => hasAccess);
3729
+ const itemsFilteredByScope = filtered.filter(({ hasAccess, matchesScope }) => hasAccess && !matchesScope);
3730
+ const itemsWithScopeErrors = filtered.filter(({ hasAccess, scopeCheckError }) => hasAccess && scopeCheckError);
3731
+ if (itemsWithPermissions.length > 0 && itemsWithScopeErrors.length === itemsWithPermissions.length) {
3732
+ logger.warn("PaceAppLayout", "Scope checking failed for all items - falling back to permission-only filtering", {
3733
+ contextType: hasEventContext ? "event" : hasOrgContext ? "organisation" : "none",
3734
+ totalItems: baseMenuItems.length,
3735
+ itemsWithPermissions: itemsWithPermissions.length,
3736
+ scopeCheckErrorCount: itemsWithScopeErrors.length,
3737
+ note: "Showing items based on permissions only - scope filtering disabled due to errors. This may indicate database issues or missing scope_type values."
3738
+ });
3739
+ const fallbackItems = filtered.filter(({ hasAccess }) => hasAccess).map(({ item }) => item);
3740
+ if (isMounted && fallbackItems.length > 0) {
3741
+ setFilteredMenuItems(fallbackItems);
3742
+ return;
3743
+ }
3744
+ } else if (itemsWithPermissions.length > 0 && itemsFilteredByScope.length === itemsWithPermissions.length) {
3745
+ logger.info("PaceAppLayout", "All navigation items filtered out by scope type", {
3746
+ contextType: hasEventContext ? "event" : hasOrgContext ? "organisation" : "none",
3747
+ totalItems: baseMenuItems.length,
3748
+ itemsWithPermissions: itemsWithPermissions.length,
3749
+ itemsFilteredByScope: itemsFilteredByScope.length,
3750
+ note: "All pages appear to be scoped for a different context type - this is expected behavior. Navigation will be empty until user selects the appropriate context."
3751
+ });
3752
+ }
3753
+ }
3826
3754
  setFilteredMenuItems(accessibleItems);
3827
3755
  } catch (error) {
3828
3756
  logger.error("PaceAppLayout", "Failed to load permission map for navigation filtering", { userId: user?.id, error });
@@ -3835,8 +3763,8 @@ function PaceAppLayout({
3835
3763
  return () => {
3836
3764
  isMounted = false;
3837
3765
  };
3838
- }, [baseMenuItems, pageIdMapping, routePermissions, defaultPermission, can, user?.id, scope, scopeLoading, contextAppId, resolvedScope?.appId, selectedOrganisation?.id]);
3839
- useEffect8(() => {
3766
+ }, [baseMenuItems, pageIdMapping, routePermissions, defaultPermission, can, user?.id, scope, scopeLoading, contextAppId, resolvedScope?.appId, selectedOrganisation?.id, selectedEvent?.event_id, appName]);
3767
+ useEffect7(() => {
3840
3768
  if (!roleBasedRouting || routeConfig.length === 0) return;
3841
3769
  let isMounted = true;
3842
3770
  const checkRouteAccess = async () => {
@@ -3858,7 +3786,7 @@ function PaceAppLayout({
3858
3786
  let hasAccess = true;
3859
3787
  if (currentRoute.pageId && currentRoute.permissions && currentRoute.permissions.length > 0) {
3860
3788
  try {
3861
- const { isPermittedCached } = await import("./api-MVVQZLJI.js");
3789
+ const { isPermittedCached } = await import("./api-6LVZTHDS.js");
3862
3790
  const hasPagePermission = await isPermittedCached({
3863
3791
  userId: user?.id || "",
3864
3792
  scope,
@@ -3874,7 +3802,7 @@ function PaceAppLayout({
3874
3802
  }
3875
3803
  }
3876
3804
  if (hasAccess && currentRoute.roles && currentRoute.roles.length > 0 && user?.id) {
3877
- const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-CH6Z342H.js");
3805
+ const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-QPXO24B4.js");
3878
3806
  hasAccess = true;
3879
3807
  }
3880
3808
  if (!isMounted) return;
@@ -3935,37 +3863,37 @@ function PaceAppLayout({
3935
3863
  }
3936
3864
  };
3937
3865
  if (user?.id && organisationLoading && !isSuperAdmin2 && !isCheckingSuperAdminDirect && !rbacLoading && !selectedOrganisationId) {
3938
- return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
3939
- /* @__PURE__ */ jsx20("div", { className: "animate-spin rounded-full size-8 border-b-2 border-sec-900 mx-auto mb-4" }),
3940
- /* @__PURE__ */ jsx20("p", { className: "text-sec-600", children: "Loading organisation context..." })
3866
+ return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs14("div", { className: "text-center", children: [
3867
+ /* @__PURE__ */ jsx19("div", { className: "animate-spin rounded-full size-8 border-b-2 border-sec-900 mx-auto mb-4" }),
3868
+ /* @__PURE__ */ jsx19("p", { className: "text-sec-600", children: "Loading organisation context..." })
3941
3869
  ] }) });
3942
3870
  }
3943
3871
  if (enforcePermissions && isCheckingPermission) {
3944
- return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
3945
- /* @__PURE__ */ jsx20("div", { className: "animate-spin rounded-full size-8 border-b-2 border-sec-900 mx-auto mb-4" }),
3946
- /* @__PURE__ */ jsx20("p", { className: "text-sec-600", children: "Checking permissions..." })
3872
+ return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs14("div", { className: "text-center", children: [
3873
+ /* @__PURE__ */ jsx19("div", { className: "animate-spin rounded-full size-8 border-b-2 border-sec-900 mx-auto mb-4" }),
3874
+ /* @__PURE__ */ jsx19("p", { className: "text-sec-600", children: "Checking permissions..." })
3947
3875
  ] }) });
3948
3876
  }
3949
- if (enforcePermissions && permissionError && !isSuperAdmin2) {
3950
- return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
3951
- /* @__PURE__ */ jsx20("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Permission Error" }),
3952
- /* @__PURE__ */ jsx20("p", { className: "text-sec-600 mb-4", children: permissionError.message }),
3953
- /* @__PURE__ */ jsx20(Button, { onClick: () => navigate("/"), children: "Go Home" })
3877
+ if (enforcePermissions && permissionError && !isSuperAdmin2 && !isContextError) {
3878
+ return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs14("div", { className: "text-center", children: [
3879
+ /* @__PURE__ */ jsx19("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Permission Error" }),
3880
+ /* @__PURE__ */ jsx19("p", { className: "text-sec-600 mb-4", children: permissionError.message }),
3881
+ /* @__PURE__ */ jsx19(Button, { onClick: () => navigate("/"), children: "Go Home" })
3954
3882
  ] }) });
3955
3883
  }
3956
- if (enforcePermissions && hasPermission === false && !isCheckingSuperAdminDirect && !isSuperAdmin2) {
3884
+ if (enforcePermissions && hasPermission === false && !isCheckingSuperAdminDirect && !isSuperAdmin2 && !isContextError) {
3957
3885
  if (enforcePagePermissions && pagePermissionFallback) {
3958
- return /* @__PURE__ */ jsx20(Fragment8, { children: pagePermissionFallback });
3886
+ return /* @__PURE__ */ jsx19(Fragment9, { children: pagePermissionFallback });
3959
3887
  }
3960
3888
  if (permissionFallback) {
3961
- return /* @__PURE__ */ jsx20(Fragment8, { children: permissionFallback });
3962
- }
3963
- return /* @__PURE__ */ jsx20("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs15("div", { className: "text-center", children: [
3964
- /* @__PURE__ */ jsx20("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Access Denied" }),
3965
- /* @__PURE__ */ jsx20("p", { className: "text-sec-600 mb-4", children: "You don't have permission to access this page." }),
3966
- /* @__PURE__ */ jsxs15("div", { className: "flex gap-2 justify-center", children: [
3967
- /* @__PURE__ */ jsx20(Button, { onClick: () => navigate("/"), children: "Go Home" }),
3968
- /* @__PURE__ */ jsx20(
3889
+ return /* @__PURE__ */ jsx19(Fragment9, { children: permissionFallback });
3890
+ }
3891
+ return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxs14("div", { className: "text-center", children: [
3892
+ /* @__PURE__ */ jsx19("h2", { className: "text-xl font-semibold text-acc-600 mb-2", children: "Access Denied" }),
3893
+ /* @__PURE__ */ jsx19("p", { className: "text-sec-600 mb-4", children: "You don't have permission to access this page." }),
3894
+ /* @__PURE__ */ jsxs14("div", { className: "flex gap-2 justify-center", children: [
3895
+ /* @__PURE__ */ jsx19(Button, { onClick: () => navigate("/"), children: "Go Home" }),
3896
+ /* @__PURE__ */ jsx19(
3969
3897
  Button,
3970
3898
  {
3971
3899
  variant: "outline",
@@ -3979,8 +3907,8 @@ function PaceAppLayout({
3979
3907
  ] })
3980
3908
  ] }) });
3981
3909
  }
3982
- return /* @__PURE__ */ jsxs15(Fragment8, { children: [
3983
- /* @__PURE__ */ jsx20(
3910
+ return /* @__PURE__ */ jsxs14(Fragment9, { children: [
3911
+ /* @__PURE__ */ jsx19(
3984
3912
  Header,
3985
3913
  {
3986
3914
  logo: customLogo || void 0,
@@ -3999,21 +3927,22 @@ function PaceAppLayout({
3999
3927
  navigate(item.href);
4000
3928
  }
4001
3929
  },
4002
- showEventSelector,
4003
- showOrgSelector,
3930
+ showContextSelector,
3931
+ showOrganisations,
3932
+ showEvents,
4004
3933
  showUserMenu,
4005
3934
  className: headerClassName || "sticky top-0 z-[40] w-full"
4006
3935
  }
4007
3936
  ),
4008
- /* @__PURE__ */ jsx20("main", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: /* @__PURE__ */ jsx20(Outlet, {}) }),
4009
- /* @__PURE__ */ jsx20(Footer, {})
3937
+ /* @__PURE__ */ jsx19("main", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: /* @__PURE__ */ jsx19(Outlet, {}) }),
3938
+ /* @__PURE__ */ jsx19(Footer, {})
4010
3939
  ] });
4011
3940
  }
4012
3941
 
4013
3942
  // src/components/PaceLoginPage/PaceLoginPage.tsx
4014
- import { useEffect as useEffect9, useState as useState14, useContext as useContext2 } from "react";
3943
+ import { useEffect as useEffect8, useState as useState13, useContext as useContext2 } from "react";
4015
3944
  import { useNavigate as useNavigate2, useLocation as useLocation2 } from "react-router-dom";
4016
- import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
3945
+ import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
4017
3946
  var PaceLoginPage = ({
4018
3947
  appName = "Pace",
4019
3948
  onSuccessRedirectPath = "/",
@@ -4022,21 +3951,21 @@ var PaceLoginPage = ({
4022
3951
  const { signIn, isAuthenticated, isLoading, authError, user, supabase } = useUnifiedAuth();
4023
3952
  const navigate = useNavigate2();
4024
3953
  const location = useLocation2();
4025
- const [isSigningIn, setIsSigningIn] = useState14(false);
4026
- const [accessError, setAccessError] = useState14(null);
4027
- const [isCheckingAccess, setIsCheckingAccess] = useState14(false);
3954
+ const [isSigningIn, setIsSigningIn] = useState13(false);
3955
+ const [accessError, setAccessError] = useState13(null);
3956
+ const [isCheckingAccess, setIsCheckingAccess] = useState13(false);
4028
3957
  const eventServiceContext = useContext2(EventServiceContext);
4029
3958
  const eventService = eventServiceContext?.eventService || null;
4030
- useEffect9(() => {
3959
+ useEffect8(() => {
4031
3960
  clearPalette();
4032
3961
  }, []);
4033
- useEffect9(() => {
3962
+ useEffect8(() => {
4034
3963
  const isOnLoginPage = location.pathname === "/login" || location.pathname.startsWith("/login");
4035
3964
  if (isOnLoginPage) {
4036
3965
  clearPalette();
4037
3966
  }
4038
3967
  }, [location.pathname]);
4039
- useEffect9(() => {
3968
+ useEffect8(() => {
4040
3969
  const restoreEvent = async () => {
4041
3970
  try {
4042
3971
  const isOnLoginPage = window.location.pathname === "/login" || window.location.pathname.startsWith("/login");
@@ -4051,7 +3980,7 @@ var PaceLoginPage = ({
4051
3980
  }, 100);
4052
3981
  return () => clearTimeout(timeoutId);
4053
3982
  }, [eventService]);
4054
- useEffect9(() => {
3983
+ useEffect8(() => {
4055
3984
  if (!requireAppAccess || !isAuthenticated || isLoading || !user || !supabase) {
4056
3985
  return;
4057
3986
  }
@@ -4139,8 +4068,8 @@ var PaceLoginPage = ({
4139
4068
  setIsSigningIn(false);
4140
4069
  }
4141
4070
  };
4142
- return /* @__PURE__ */ jsxs16("main", { className: "min-h-screen grid mx-auto w-fit content-center justify-items-center gap-y-8", "aria-label": `${appName} Login Page`, children: [
4143
- /* @__PURE__ */ jsx21(
4071
+ return /* @__PURE__ */ jsxs15("main", { className: "min-h-screen grid mx-auto w-fit content-center justify-items-center gap-y-8", "aria-label": `${appName} Login Page`, children: [
4072
+ /* @__PURE__ */ jsx20(
4144
4073
  "img",
4145
4074
  {
4146
4075
  src: `/${appName.toLowerCase()}_logo_square.svg`,
@@ -4148,7 +4077,7 @@ var PaceLoginPage = ({
4148
4077
  className: "h-48"
4149
4078
  }
4150
4079
  ),
4151
- /* @__PURE__ */ jsx21(
4080
+ /* @__PURE__ */ jsx20(
4152
4081
  LoginForm,
4153
4082
  {
4154
4083
  className: "w-md",
@@ -4162,20 +4091,20 @@ var PaceLoginPage = ({
4162
4091
  ),
4163
4092
  (() => {
4164
4093
  const benign = !!(authError && (authError.name === "AuthSessionMissingError" || /Auth session missing/i.test(authError.message)));
4165
- return authError && !benign ? /* @__PURE__ */ jsx21("em", { className: "mt-4 text-destructive text-center", children: authError.message }) : null;
4094
+ return authError && !benign ? /* @__PURE__ */ jsx20("em", { className: "mt-4 text-destructive text-center", children: authError.message }) : null;
4166
4095
  })(),
4167
- accessError && /* @__PURE__ */ jsx21("em", { className: "mt-4 text-destructive text-center", children: accessError }),
4168
- isCheckingAccess && /* @__PURE__ */ jsx21("em", { className: "mt-4 text-muted-foreground text-center", children: "Checking permissions..." })
4096
+ accessError && /* @__PURE__ */ jsx20("em", { className: "mt-4 text-destructive text-center", children: accessError }),
4097
+ isCheckingAccess && /* @__PURE__ */ jsx20("em", { className: "mt-4 text-muted-foreground text-center", children: "Checking permissions..." })
4169
4098
  ] });
4170
4099
  };
4171
4100
 
4172
4101
  // src/components/SessionRestorationLoader/SessionRestorationLoader.tsx
4173
- import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
4102
+ import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
4174
4103
  var SessionRestorationLoader = ({
4175
4104
  message = "Restoring session...",
4176
4105
  className
4177
4106
  }) => {
4178
- return /* @__PURE__ */ jsxs17(
4107
+ return /* @__PURE__ */ jsxs16(
4179
4108
  Alert,
4180
4109
  {
4181
4110
  className: cn(
@@ -4186,17 +4115,17 @@ var SessionRestorationLoader = ({
4186
4115
  "aria-live": "polite",
4187
4116
  "aria-label": message,
4188
4117
  children: [
4189
- /* @__PURE__ */ jsx22(LoadingSpinner, { size: "lg" }),
4190
- /* @__PURE__ */ jsx22("span", { className: "text-sm text-sec-600", children: message })
4118
+ /* @__PURE__ */ jsx21(LoadingSpinner, { size: "lg" }),
4119
+ /* @__PURE__ */ jsx21("span", { className: "text-sm text-sec-600", children: message })
4191
4120
  ]
4192
4121
  }
4193
4122
  );
4194
4123
  };
4195
4124
 
4196
4125
  // src/components/ProtectedRoute/ProtectedRoute.tsx
4197
- import { useMemo as useMemo10, useEffect as useEffect10, useRef as useRef9, useState as useState15 } from "react";
4126
+ import { useMemo as useMemo9, useEffect as useEffect9, useRef as useRef8, useState as useState14 } from "react";
4198
4127
  import { Navigate, Outlet as Outlet2 } from "react-router-dom";
4199
- import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
4128
+ import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
4200
4129
  function ProtectedRoute({
4201
4130
  requireEvent = false,
4202
4131
  noEventsFallback,
@@ -4210,17 +4139,17 @@ function ProtectedRoute({
4210
4139
  const eventLoading = requireEvent ? eventsContext.isLoading || false : false;
4211
4140
  const sessionRestoration = useSessionRestoration();
4212
4141
  usePreventTabReload({ enabled: true, gracePeriodMs: 2e3 });
4213
- const wasAuthenticatedRef = useRef9(false);
4214
- const [shouldRedirect, setShouldRedirect] = useState15(false);
4215
- const tabJustBecameVisibleRef = useRef9(false);
4216
- useEffect10(() => {
4142
+ const wasAuthenticatedRef = useRef8(false);
4143
+ const [shouldRedirect, setShouldRedirect] = useState14(false);
4144
+ const tabJustBecameVisibleRef = useRef8(false);
4145
+ useEffect9(() => {
4217
4146
  if (isAuthenticated) {
4218
4147
  wasAuthenticatedRef.current = true;
4219
4148
  setShouldRedirect(false);
4220
4149
  tabJustBecameVisibleRef.current = false;
4221
4150
  }
4222
4151
  }, [isAuthenticated]);
4223
- useEffect10(() => {
4152
+ useEffect9(() => {
4224
4153
  if (typeof document === "undefined") return;
4225
4154
  let timeoutId = null;
4226
4155
  let wasHidden = document.hidden;
@@ -4264,13 +4193,13 @@ function ProtectedRoute({
4264
4193
  }
4265
4194
  };
4266
4195
  }, [isAuthenticated]);
4267
- useEffect10(() => {
4196
+ useEffect9(() => {
4268
4197
  if (isAuthenticated) {
4269
4198
  setShouldRedirect(false);
4270
4199
  tabJustBecameVisibleRef.current = false;
4271
4200
  }
4272
4201
  }, [isAuthenticated]);
4273
- const isRestoringSession = useMemo10(() => {
4202
+ const isRestoringSession = useMemo9(() => {
4274
4203
  return sessionRestoration.isRestoring && !sessionRestoration.restorationComplete && !sessionRestoration.restorationError && !sessionRestoration.hasTimedOut;
4275
4204
  }, [
4276
4205
  sessionRestoration.isRestoring,
@@ -4279,13 +4208,13 @@ function ProtectedRoute({
4279
4208
  sessionRestoration.hasTimedOut
4280
4209
  ]);
4281
4210
  if (isRestoringSession) {
4282
- return /* @__PURE__ */ jsx23(SessionRestorationLoader, {});
4211
+ return /* @__PURE__ */ jsx22(SessionRestorationLoader, {});
4283
4212
  }
4284
4213
  if (requireEvent && eventLoading) {
4285
- return /* @__PURE__ */ jsx23(Outlet2, {});
4214
+ return /* @__PURE__ */ jsx22(Outlet2, {});
4286
4215
  }
4287
4216
  if (isLoading && !sessionRestoration.hasTimedOut) {
4288
- return loadingFallback || /* @__PURE__ */ jsx23("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx23(LoadingSpinner, {}) });
4217
+ return loadingFallback || /* @__PURE__ */ jsx22("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx22(LoadingSpinner, {}) });
4289
4218
  }
4290
4219
  if (!isAuthenticated) {
4291
4220
  if (sessionRestoration.hasTimedOut || sessionRestoration.restorationError) {
@@ -4293,41 +4222,41 @@ function ProtectedRoute({
4293
4222
  timedOut: sessionRestoration.hasTimedOut,
4294
4223
  error: sessionRestoration.restorationError?.message
4295
4224
  });
4296
- return /* @__PURE__ */ jsx23(Navigate, { to: loginPath, replace: true });
4225
+ return /* @__PURE__ */ jsx22(Navigate, { to: loginPath, replace: true });
4297
4226
  }
4298
4227
  if (!wasAuthenticatedRef.current) {
4299
- return /* @__PURE__ */ jsx23(Navigate, { to: loginPath, replace: true });
4228
+ return /* @__PURE__ */ jsx22(Navigate, { to: loginPath, replace: true });
4300
4229
  }
4301
4230
  const isTabVisible = typeof document !== "undefined" && !document.hidden;
4302
4231
  if (tabJustBecameVisibleRef.current || isTabVisible && wasAuthenticatedRef.current && isLoading) {
4303
- return loadingFallback || /* @__PURE__ */ jsx23("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx23(LoadingSpinner, {}) });
4232
+ return loadingFallback || /* @__PURE__ */ jsx22("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx22(LoadingSpinner, {}) });
4304
4233
  }
4305
4234
  if (shouldRedirect) {
4306
- return /* @__PURE__ */ jsx23(Navigate, { to: loginPath, replace: true });
4235
+ return /* @__PURE__ */ jsx22(Navigate, { to: loginPath, replace: true });
4307
4236
  }
4308
4237
  if (isLoading) {
4309
- return loadingFallback || /* @__PURE__ */ jsx23("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx23(LoadingSpinner, {}) });
4238
+ return loadingFallback || /* @__PURE__ */ jsx22("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx22(LoadingSpinner, {}) });
4310
4239
  }
4311
- return /* @__PURE__ */ jsx23(Navigate, { to: loginPath, replace: true });
4240
+ return /* @__PURE__ */ jsx22(Navigate, { to: loginPath, replace: true });
4312
4241
  }
4313
4242
  if (!requireEvent) {
4314
- return /* @__PURE__ */ jsx23(Outlet2, {});
4243
+ return /* @__PURE__ */ jsx22(Outlet2, {});
4315
4244
  }
4316
4245
  if (!events || events.length === 0) {
4317
- return noEventsFallback || /* @__PURE__ */ jsx23("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "100vh", padding: "2rem" }, children: /* @__PURE__ */ jsxs18(Alert, { variant: "destructive", className: "max-w-md", children: [
4318
- /* @__PURE__ */ jsx23(AlertTitle, { children: "No Events Available" }),
4319
- /* @__PURE__ */ jsx23(AlertDescription, { children: "You don't have access to any events. Please contact your administrator if you believe this is an error." })
4246
+ return noEventsFallback || /* @__PURE__ */ jsx22("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "100vh", padding: "2rem" }, children: /* @__PURE__ */ jsxs17(Alert, { variant: "destructive", className: "max-w-md", children: [
4247
+ /* @__PURE__ */ jsx22(AlertTitle, { children: "No Events Available" }),
4248
+ /* @__PURE__ */ jsx22(AlertDescription, { children: "You don't have access to any events. Please contact your administrator if you believe this is an error." })
4320
4249
  ] }) });
4321
4250
  }
4322
4251
  if (!selectedEvent) {
4323
- return /* @__PURE__ */ jsx23(Outlet2, {});
4252
+ return /* @__PURE__ */ jsx22(Outlet2, {});
4324
4253
  }
4325
- return /* @__PURE__ */ jsx23(Outlet2, {});
4254
+ return /* @__PURE__ */ jsx22(Outlet2, {});
4326
4255
  }
4327
4256
 
4328
4257
  // src/components/FileUpload/FileUpload.tsx
4329
- import { useState as useState16, useCallback as useCallback11, useRef as useRef10, useEffect as useEffect11, useMemo as useMemo11 } from "react";
4330
- import { Fragment as Fragment9, jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
4258
+ import { useState as useState15, useCallback as useCallback10, useRef as useRef9, useEffect as useEffect10, useMemo as useMemo10 } from "react";
4259
+ import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
4331
4260
  function FileUpload({
4332
4261
  supabase,
4333
4262
  table_name,
@@ -4360,14 +4289,14 @@ function FileUpload({
4360
4289
  }
4361
4290
  throw new Error(errorMsg);
4362
4291
  }
4363
- const [isDragging, setIsDragging] = useState16(false);
4364
- const [uploadStates, setUploadStates] = useState16(/* @__PURE__ */ new Map());
4365
- const [resolvedAppId, setResolvedAppId] = useState16(app_id || null);
4366
- const [isResolvingAppId, setIsResolvingAppId] = useState16(!app_id);
4367
- const [appIdError, setAppIdError] = useState16(null);
4368
- const fileInputRef = useRef10(null);
4292
+ const [isDragging, setIsDragging] = useState15(false);
4293
+ const [uploadStates, setUploadStates] = useState15(/* @__PURE__ */ new Map());
4294
+ const [resolvedAppId, setResolvedAppId] = useState15(app_id || null);
4295
+ const [isResolvingAppId, setIsResolvingAppId] = useState15(!app_id);
4296
+ const [appIdError, setAppIdError] = useState15(null);
4297
+ const fileInputRef = useRef9(null);
4369
4298
  const { uploadFile, isLoading, error } = useFileReference(supabase);
4370
- useEffect11(() => {
4299
+ useEffect10(() => {
4371
4300
  if (app_id) {
4372
4301
  setResolvedAppId(app_id);
4373
4302
  setIsResolvingAppId(false);
@@ -4402,15 +4331,15 @@ function FileUpload({
4402
4331
  };
4403
4332
  resolveAppId();
4404
4333
  }, [app_id, supabase]);
4405
- const isUploading = useMemo11(() => {
4334
+ const isUploading = useMemo10(() => {
4406
4335
  return uploadStates.size > 0 && Array.from(uploadStates.values()).some(
4407
4336
  (state) => state.progress.status === "uploading" || state.progress.status === "processing"
4408
4337
  );
4409
4338
  }, [uploadStates]);
4410
- const isDisabled = useMemo11(() => {
4339
+ const isDisabled = useMemo10(() => {
4411
4340
  return disabled || isUploading || isResolvingAppId || !resolvedAppId;
4412
4341
  }, [disabled, isUploading, isResolvingAppId, resolvedAppId]);
4413
- const generatePreview = useCallback11((file) => {
4342
+ const generatePreview = useCallback10((file) => {
4414
4343
  return new Promise((resolve) => {
4415
4344
  if (!file.type.startsWith("image/")) {
4416
4345
  resolve(null);
@@ -4424,7 +4353,7 @@ function FileUpload({
4424
4353
  reader.readAsDataURL(file);
4425
4354
  });
4426
4355
  }, []);
4427
- const validateFile = useCallback11((file) => {
4356
+ const validateFile = useCallback10((file) => {
4428
4357
  if (file.size > maxSize) {
4429
4358
  return `File "${file.name}" exceeds maximum size of ${Math.round(maxSize / 1024 / 1024)}MB`;
4430
4359
  }
@@ -4448,7 +4377,7 @@ function FileUpload({
4448
4377
  }
4449
4378
  return null;
4450
4379
  }, [accept, maxSize]);
4451
- const handleFileSelect = useCallback11(async (files) => {
4380
+ const handleFileSelect = useCallback10(async (files) => {
4452
4381
  if (!files || files.length === 0) return;
4453
4382
  const fileArray = Array.from(files);
4454
4383
  const validationErrors = [];
@@ -4629,19 +4558,19 @@ function FileUpload({
4629
4558
  }
4630
4559
  }
4631
4560
  }, [uploadFile, table_name, record_id, organisation_id, resolvedAppId, category, folder, isPublic, maxSize, onUploadSuccess, onUploadError, onProgress, validateFile, generatePreview, showPreview, appIdError, pageContext]);
4632
- const handleDragOver = useCallback11((e) => {
4561
+ const handleDragOver = useCallback10((e) => {
4633
4562
  e.preventDefault();
4634
4563
  e.stopPropagation();
4635
4564
  if (!isDisabled) {
4636
4565
  setIsDragging(true);
4637
4566
  }
4638
4567
  }, [isDisabled]);
4639
- const handleDragLeave = useCallback11((e) => {
4568
+ const handleDragLeave = useCallback10((e) => {
4640
4569
  e.preventDefault();
4641
4570
  e.stopPropagation();
4642
4571
  setIsDragging(false);
4643
4572
  }, []);
4644
- const handleDrop = useCallback11((e) => {
4573
+ const handleDrop = useCallback10((e) => {
4645
4574
  e.preventDefault();
4646
4575
  e.stopPropagation();
4647
4576
  setIsDragging(false);
@@ -4649,13 +4578,13 @@ function FileUpload({
4649
4578
  const files = e.dataTransfer.files;
4650
4579
  handleFileSelect(files);
4651
4580
  }, [isDisabled, handleFileSelect]);
4652
- const handleFileInputChange = useCallback11((e) => {
4581
+ const handleFileInputChange = useCallback10((e) => {
4653
4582
  handleFileSelect(e.target.files);
4654
4583
  if (e.target) {
4655
4584
  e.target.value = "";
4656
4585
  }
4657
4586
  }, [handleFileSelect]);
4658
- const handleClick = useCallback11(() => {
4587
+ const handleClick = useCallback10(() => {
4659
4588
  if (!isDisabled && fileInputRef.current) {
4660
4589
  fileInputRef.current.click();
4661
4590
  }
@@ -4669,8 +4598,8 @@ function FileUpload({
4669
4598
  };
4670
4599
  const dragClasses = isDragging ? "border-main-500 bg-main-50" : "border-sec-300 hover:border-sec-400";
4671
4600
  const disabledClasses = isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer hover:bg-sec-50";
4672
- return /* @__PURE__ */ jsxs19("div", { className: `space-y-4 ${className}`, children: [
4673
- /* @__PURE__ */ jsxs19(
4601
+ return /* @__PURE__ */ jsxs18("div", { className: `space-y-4 ${className}`, children: [
4602
+ /* @__PURE__ */ jsxs18(
4674
4603
  "div",
4675
4604
  {
4676
4605
  role: "button",
@@ -4689,8 +4618,8 @@ function FileUpload({
4689
4618
  }
4690
4619
  } : void 0,
4691
4620
  children: [
4692
- children || /* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
4693
- /* @__PURE__ */ jsx24(
4621
+ children || /* @__PURE__ */ jsxs18("div", { className: "space-y-2", children: [
4622
+ /* @__PURE__ */ jsx23(
4694
4623
  "input",
4695
4624
  {
4696
4625
  ref: fileInputRef,
@@ -4704,64 +4633,64 @@ function FileUpload({
4704
4633
  "aria-label": accept ? `Upload file${multiple ? "s" : ""} (${accept})` : `Upload file${multiple ? "s" : ""}`
4705
4634
  }
4706
4635
  ),
4707
- /* @__PURE__ */ jsx24("div", { className: "text-sec-600", children: isResolvingAppId ? "Resolving app configuration..." : isDragging ? "Drop files here..." : /* @__PURE__ */ jsxs19(Fragment9, { children: [
4708
- /* @__PURE__ */ jsx24("span", { className: "font-medium", children: "Click to upload" }),
4636
+ /* @__PURE__ */ jsx23("div", { className: "text-sec-600", children: isResolvingAppId ? "Resolving app configuration..." : isDragging ? "Drop files here..." : /* @__PURE__ */ jsxs18(Fragment10, { children: [
4637
+ /* @__PURE__ */ jsx23("span", { className: "font-medium", children: "Click to upload" }),
4709
4638
  " ",
4710
4639
  "or drag and drop"
4711
4640
  ] }) }),
4712
- /* @__PURE__ */ jsxs19("div", { className: "text-sm text-sec-500", children: [
4641
+ /* @__PURE__ */ jsxs18("div", { className: "text-sm text-sec-500", children: [
4713
4642
  !isResolvingAppId && accept !== "*/*" && `Accepted formats: ${accept}`,
4714
4643
  !isResolvingAppId && maxSize && ` \u2022 Max size: ${Math.round(maxSize / 1024 / 1024)}MB`,
4715
4644
  !isResolvingAppId && multiple && " \u2022 Multiple files allowed"
4716
4645
  ] })
4717
4646
  ] }),
4718
- isUploading && !showProgress && /* @__PURE__ */ jsx24(
4647
+ isUploading && !showProgress && /* @__PURE__ */ jsx23(
4719
4648
  "div",
4720
4649
  {
4721
4650
  className: "absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center",
4722
4651
  role: "status",
4723
4652
  "aria-live": "polite",
4724
4653
  "aria-label": "Uploading file",
4725
- children: /* @__PURE__ */ jsx24("div", { className: "animate-spin rounded-full size-8 border-b-2 border-main-500", "aria-hidden": "true" })
4654
+ children: /* @__PURE__ */ jsx23("div", { className: "animate-spin rounded-full size-8 border-b-2 border-main-500", "aria-hidden": "true" })
4726
4655
  }
4727
4656
  )
4728
4657
  ]
4729
4658
  }
4730
4659
  ),
4731
- showProgress && uploadStates.size > 0 && /* @__PURE__ */ jsx24("div", { className: "space-y-2", children: Array.from(uploadStates.entries()).map(([fileId, uploadState]) => {
4660
+ showProgress && uploadStates.size > 0 && /* @__PURE__ */ jsx23("div", { className: "space-y-2", children: Array.from(uploadStates.entries()).map(([fileId, uploadState]) => {
4732
4661
  const { file, progress, preview, result } = uploadState;
4733
4662
  const isError = progress.status === "error";
4734
4663
  const isCompleted = progress.status === "completed";
4735
4664
  const isUploading2 = progress.status === "uploading" || progress.status === "processing";
4736
- return /* @__PURE__ */ jsxs19(
4665
+ return /* @__PURE__ */ jsxs18(
4737
4666
  "div",
4738
4667
  {
4739
4668
  className: `flex items-center space-x-3 p-3 rounded-lg border ${isError ? "bg-acc-50 border-acc-200" : isCompleted ? "bg-success-50 border-success-200" : "bg-sec-50 border-sec-200"}`,
4740
4669
  children: [
4741
- /* @__PURE__ */ jsx24("div", { className: "flex-shrink-0", children: preview ? /* @__PURE__ */ jsx24(
4670
+ /* @__PURE__ */ jsx23("div", { className: "flex-shrink-0", children: preview ? /* @__PURE__ */ jsx23(
4742
4671
  "img",
4743
4672
  {
4744
4673
  src: preview,
4745
4674
  alt: file.name,
4746
4675
  className: "w-12 h-12 object-cover rounded"
4747
4676
  }
4748
- ) : /* @__PURE__ */ jsx24("div", { className: "w-12 h-12 flex items-center justify-center bg-sec-200 rounded", children: /* @__PURE__ */ jsx24("span", { className: "text-2xl", children: "\u{1F4C4}" }) }) }),
4749
- /* @__PURE__ */ jsxs19("div", { className: "flex-1 min-w-0", children: [
4750
- /* @__PURE__ */ jsx24("div", { className: "font-medium text-sec-900 truncate", children: file.name }),
4751
- /* @__PURE__ */ jsxs19("div", { className: "text-sm text-sec-500", children: [
4677
+ ) : /* @__PURE__ */ jsx23("div", { className: "w-12 h-12 flex items-center justify-center bg-sec-200 rounded", children: /* @__PURE__ */ jsx23("span", { className: "text-2xl", children: "\u{1F4C4}" }) }) }),
4678
+ /* @__PURE__ */ jsxs18("div", { className: "flex-1 min-w-0", children: [
4679
+ /* @__PURE__ */ jsx23("div", { className: "font-medium text-sec-900 truncate", children: file.name }),
4680
+ /* @__PURE__ */ jsxs18("div", { className: "text-sm text-sec-500", children: [
4752
4681
  formatFileSize(file.size),
4753
4682
  isCompleted && result && " \u2022 Uploaded",
4754
4683
  isError && progress.error && ` \u2022 ${progress.error}`
4755
4684
  ] }),
4756
- showProgress && (isUploading2 || isError) && /* @__PURE__ */ jsxs19("div", { className: "mt-2", children: [
4757
- /* @__PURE__ */ jsx24("div", { className: "w-full bg-sec-200 rounded-full h-2", children: /* @__PURE__ */ jsx24(
4685
+ showProgress && (isUploading2 || isError) && /* @__PURE__ */ jsxs18("div", { className: "mt-2", children: [
4686
+ /* @__PURE__ */ jsx23("div", { className: "w-full bg-sec-200 rounded-full h-2", children: /* @__PURE__ */ jsx23(
4758
4687
  "div",
4759
4688
  {
4760
4689
  className: `h-2 rounded-full transition-all duration-300 ${isError ? "bg-acc-500" : "bg-main-500"}`,
4761
4690
  style: { width: `${progress.percentage}%` }
4762
4691
  }
4763
4692
  ) }),
4764
- isUploading2 && /* @__PURE__ */ jsxs19("div", { className: "text-xs text-sec-500 mt-1", children: [
4693
+ isUploading2 && /* @__PURE__ */ jsxs18("div", { className: "text-xs text-sec-500 mt-1", children: [
4765
4694
  progress.percentage,
4766
4695
  "% \u2022 ",
4767
4696
  formatFileSize(progress.loaded),
@@ -4770,10 +4699,10 @@ function FileUpload({
4770
4699
  ] })
4771
4700
  ] })
4772
4701
  ] }),
4773
- /* @__PURE__ */ jsxs19("div", { className: "flex-shrink-0", children: [
4774
- isCompleted && /* @__PURE__ */ jsx24("span", { className: "text-success-500 text-xl", children: "\u2713" }),
4775
- isError && /* @__PURE__ */ jsx24("span", { className: "text-acc-500 text-xl", children: "\u2715" }),
4776
- isUploading2 && /* @__PURE__ */ jsx24(
4702
+ /* @__PURE__ */ jsxs18("div", { className: "flex-shrink-0", children: [
4703
+ isCompleted && /* @__PURE__ */ jsx23("span", { className: "text-success-500 text-xl", children: "\u2713" }),
4704
+ isError && /* @__PURE__ */ jsx23("span", { className: "text-acc-500 text-xl", children: "\u2715" }),
4705
+ isUploading2 && /* @__PURE__ */ jsx23(
4777
4706
  "div",
4778
4707
  {
4779
4708
  className: "animate-spin rounded-full size-5 border-b-2 border-main-500",
@@ -4788,7 +4717,7 @@ function FileUpload({
4788
4717
  fileId
4789
4718
  );
4790
4719
  }) }),
4791
- appIdError && /* @__PURE__ */ jsx24(
4720
+ appIdError && /* @__PURE__ */ jsx23(
4792
4721
  "div",
4793
4722
  {
4794
4723
  className: "p-3 bg-acc-50 border border-acc-200 rounded-lg text-sm text-acc-600",
@@ -4797,7 +4726,7 @@ function FileUpload({
4797
4726
  children: appIdError
4798
4727
  }
4799
4728
  ),
4800
- error && /* @__PURE__ */ jsx24(
4729
+ error && /* @__PURE__ */ jsx23(
4801
4730
  "div",
4802
4731
  {
4803
4732
  className: "p-3 bg-acc-50 border border-acc-200 rounded-lg text-sm text-acc-600",
@@ -4811,8 +4740,8 @@ function FileUpload({
4811
4740
 
4812
4741
  // src/components/Table/Table.tsx
4813
4742
  import * as React20 from "react";
4814
- import { jsx as jsx25 } from "react/jsx-runtime";
4815
- var Table = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4743
+ import { jsx as jsx24 } from "react/jsx-runtime";
4744
+ var Table = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4816
4745
  "table",
4817
4746
  {
4818
4747
  ref,
@@ -4821,9 +4750,9 @@ var Table = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
4821
4750
  }
4822
4751
  ));
4823
4752
  Table.displayName = "Table";
4824
- var TableHeader = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
4753
+ var TableHeader = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
4825
4754
  TableHeader.displayName = "TableHeader";
4826
- var TableBody = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4755
+ var TableBody = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4827
4756
  "tbody",
4828
4757
  {
4829
4758
  ref,
@@ -4832,7 +4761,7 @@ var TableBody = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE_
4832
4761
  }
4833
4762
  ));
4834
4763
  TableBody.displayName = "TableBody";
4835
- var TableFooter = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4764
+ var TableFooter = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4836
4765
  "tfoot",
4837
4766
  {
4838
4767
  ref,
@@ -4844,7 +4773,7 @@ var TableFooter = React20.forwardRef(({ className, ...props }, ref) => /* @__PUR
4844
4773
  }
4845
4774
  ));
4846
4775
  TableFooter.displayName = "TableFooter";
4847
- var TableRow = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4776
+ var TableRow = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4848
4777
  "tr",
4849
4778
  {
4850
4779
  ref,
@@ -4856,7 +4785,7 @@ var TableRow = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__
4856
4785
  }
4857
4786
  ));
4858
4787
  TableRow.displayName = "TableRow";
4859
- var TableHead = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4788
+ var TableHead = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4860
4789
  "th",
4861
4790
  {
4862
4791
  ref,
@@ -4868,7 +4797,7 @@ var TableHead = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE_
4868
4797
  }
4869
4798
  ));
4870
4799
  TableHead.displayName = "TableHead";
4871
- var TableCell = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4800
+ var TableCell = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4872
4801
  "td",
4873
4802
  {
4874
4803
  ref,
@@ -4877,7 +4806,7 @@ var TableCell = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE_
4877
4806
  }
4878
4807
  ));
4879
4808
  TableCell.displayName = "TableCell";
4880
- var TableCaption = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4809
+ var TableCaption = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
4881
4810
  "caption",
4882
4811
  {
4883
4812
  ref,
@@ -4888,7 +4817,7 @@ var TableCaption = React20.forwardRef(({ className, ...props }, ref) => /* @__PU
4888
4817
  TableCaption.displayName = "TableCaption";
4889
4818
 
4890
4819
  // src/components/PublicLayout/PublicPageLayout.tsx
4891
- import { Fragment as Fragment10, jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
4820
+ import { Fragment as Fragment11, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
4892
4821
  function PublicPageHeader({
4893
4822
  event,
4894
4823
  eventCode,
@@ -4901,11 +4830,11 @@ function PublicPageHeader({
4901
4830
  customEventLogo
4902
4831
  }) {
4903
4832
  const { appName } = useAppConfig();
4904
- return /* @__PURE__ */ jsxs20("header", { className: cn(
4833
+ return /* @__PURE__ */ jsxs19("header", { className: cn(
4905
4834
  "w-full px-[max(0rem,calc((100vw-var(--app-width))/2-0.5rem))] grid grid-cols-[auto_1fr_auto] place-items-center gap-2",
4906
4835
  className
4907
4836
  ), children: [
4908
- showAppLogo && appName && /* @__PURE__ */ jsx26(
4837
+ showAppLogo && appName && /* @__PURE__ */ jsx25(
4909
4838
  "img",
4910
4839
  {
4911
4840
  className: "ml-4 max-w-36 object-contain row-span-2",
@@ -4913,9 +4842,9 @@ function PublicPageHeader({
4913
4842
  alt: appName
4914
4843
  }
4915
4844
  ),
4916
- event && /* @__PURE__ */ jsxs20(Fragment10, { children: [
4917
- /* @__PURE__ */ jsx26("h1", { children: event.event_name }),
4918
- showEventLogo && event && /* @__PURE__ */ jsx26(Fragment10, { children: customEventLogo || /* @__PURE__ */ jsx26(
4845
+ event && /* @__PURE__ */ jsxs19(Fragment11, { children: [
4846
+ /* @__PURE__ */ jsx25("h1", { children: event.event_name }),
4847
+ showEventLogo && event && /* @__PURE__ */ jsx25(Fragment11, { children: customEventLogo || /* @__PURE__ */ jsx25(
4919
4848
  FileDisplay,
4920
4849
  {
4921
4850
  table_name: "event",
@@ -4932,13 +4861,13 @@ function PublicPageHeader({
4932
4861
  }
4933
4862
  }
4934
4863
  ) }),
4935
- event.event_venue && /* @__PURE__ */ jsx26("h4", { children: event.event_venue })
4864
+ event.event_venue && /* @__PURE__ */ jsx25("h4", { children: event.event_venue })
4936
4865
  ] }),
4937
- title && /* @__PURE__ */ jsxs20(Fragment10, { children: [
4938
- /* @__PURE__ */ jsx26("h1", { children: title }),
4939
- description && /* @__PURE__ */ jsx26("p", { className: "text-lg text-sec-600 max-w-3xl mx-auto", children: description })
4866
+ title && /* @__PURE__ */ jsxs19(Fragment11, { children: [
4867
+ /* @__PURE__ */ jsx25("h1", { children: title }),
4868
+ description && /* @__PURE__ */ jsx25("p", { className: "text-lg text-sec-600 max-w-3xl mx-auto", children: description })
4940
4869
  ] }),
4941
- children && /* @__PURE__ */ jsx26(Fragment10, { children })
4870
+ children && /* @__PURE__ */ jsx25(Fragment11, { children })
4942
4871
  ] });
4943
4872
  }
4944
4873
  function PublicPageFooter({
@@ -4952,11 +4881,11 @@ function PublicPageFooter({
4952
4881
  children
4953
4882
  }) {
4954
4883
  const copyrightText = copyright || `\xA9 Copyright 2022\u2013${year} all rights reserved, ${companyName}.`;
4955
- return /* @__PURE__ */ jsx26("footer", { className: cn("mt-8 py-6 flex justify-center", className), children: /* @__PURE__ */ jsxs20("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
4956
- logo && /* @__PURE__ */ jsx26("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
4957
- children && /* @__PURE__ */ jsx26(Fragment10, { children }),
4958
- /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground", children: copyrightText }),
4959
- links && links.length > 0 && /* @__PURE__ */ jsx26("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx26("li", { children: /* @__PURE__ */ jsx26("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
4884
+ return /* @__PURE__ */ jsx25("footer", { className: cn("mt-8 py-6 flex justify-center", className), children: /* @__PURE__ */ jsxs19("section", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto text-center", children: [
4885
+ logo && /* @__PURE__ */ jsx25("img", { src: logo, alt: "Logo", className: "h-8 w-auto" }),
4886
+ children && /* @__PURE__ */ jsx25(Fragment11, { children }),
4887
+ /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: copyrightText }),
4888
+ links && links.length > 0 && /* @__PURE__ */ jsx25("ul", { className: "flex gap-4 mt-2 md:mt-0", children: links.map((link, index) => /* @__PURE__ */ jsx25("li", { children: /* @__PURE__ */ jsx25("a", { href: link.href, className: "text-muted-foreground hover:text-foreground", children: link.label }) }, index)) })
4960
4889
  ] }) });
4961
4890
  }
4962
4891
  function PublicPageLayout({
@@ -4979,44 +4908,44 @@ function PublicPageLayout({
4979
4908
  });
4980
4909
  if (isLoading) {
4981
4910
  if (LoadingFallback) {
4982
- return /* @__PURE__ */ jsx26(LoadingFallback, {});
4911
+ return /* @__PURE__ */ jsx25(LoadingFallback, {});
4983
4912
  }
4984
- return /* @__PURE__ */ jsx26("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ jsxs20("div", { className: "max-w-md mx-auto text-center px-4", children: [
4985
- /* @__PURE__ */ jsx26(LoadingSpinner, { size: "lg", className: "mx-auto mb-4" }),
4986
- loadingMessage && /* @__PURE__ */ jsx26("p", { className: "text-sec-600", children: loadingMessage })
4913
+ return /* @__PURE__ */ jsx25("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ jsxs19("div", { className: "max-w-md mx-auto text-center px-4", children: [
4914
+ /* @__PURE__ */ jsx25(LoadingSpinner, { size: "lg", className: "mx-auto mb-4" }),
4915
+ loadingMessage && /* @__PURE__ */ jsx25("p", { className: "text-sec-600", children: loadingMessage })
4987
4916
  ] }) });
4988
4917
  }
4989
4918
  if (error && showValidationErrors) {
4990
4919
  if (ErrorFallback) {
4991
- return /* @__PURE__ */ jsx26(ErrorFallback, { error, retry: handleRefetch });
4920
+ return /* @__PURE__ */ jsx25(ErrorFallback, { error, retry: handleRefetch });
4992
4921
  }
4993
- return /* @__PURE__ */ jsxs20("main", { className: "flex flex-col items-center justify-center px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: [
4994
- /* @__PURE__ */ jsx26("h1", { children: "Event Not Found" }),
4995
- /* @__PURE__ */ jsxs20("p", { children: [
4922
+ return /* @__PURE__ */ jsxs19("main", { className: "flex flex-col items-center justify-center px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: [
4923
+ /* @__PURE__ */ jsx25("h1", { children: "Event Not Found" }),
4924
+ /* @__PURE__ */ jsxs19("p", { children: [
4996
4925
  'The event code "',
4997
4926
  eventCode,
4998
4927
  '" is invalid or the event is not available for public viewing.'
4999
4928
  ] }),
5000
- /* @__PURE__ */ jsx26(Button, { onClick: handleRefetch, children: "Try Again" })
4929
+ /* @__PURE__ */ jsx25(Button, { onClick: handleRefetch, children: "Try Again" })
5001
4930
  ] });
5002
4931
  }
5003
4932
  if (!event && showValidationErrors) {
5004
- return /* @__PURE__ */ jsxs20("main", { className: "flex flex-col items-center justify-center px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: [
5005
- /* @__PURE__ */ jsx26("h1", { children: "Event Not Available" }),
5006
- /* @__PURE__ */ jsx26("p", { children: "This event is not available for public viewing." }),
5007
- handleRefetch && /* @__PURE__ */ jsx26(Button, { onClick: handleRefetch, children: "Try Again" })
4933
+ return /* @__PURE__ */ jsxs19("main", { className: "flex flex-col items-center justify-center px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children: [
4934
+ /* @__PURE__ */ jsx25("h1", { children: "Event Not Available" }),
4935
+ /* @__PURE__ */ jsx25("p", { children: "This event is not available for public viewing." }),
4936
+ handleRefetch && /* @__PURE__ */ jsx25(Button, { onClick: handleRefetch, children: "Try Again" })
5008
4937
  ] });
5009
4938
  }
5010
- return /* @__PURE__ */ jsx26(ErrorBoundary, { componentName: "PublicPageLayout", children: /* @__PURE__ */ jsxs20(Fragment10, { children: [
5011
- customHeader || /* @__PURE__ */ jsx26(
4939
+ return /* @__PURE__ */ jsx25(ErrorBoundary, { componentName: "PublicPageLayout", children: /* @__PURE__ */ jsxs19(Fragment11, { children: [
4940
+ customHeader || /* @__PURE__ */ jsx25(
5012
4941
  PublicPageHeader,
5013
4942
  {
5014
4943
  event: event || void 0,
5015
4944
  eventCode
5016
4945
  }
5017
4946
  ),
5018
- /* @__PURE__ */ jsx26("main", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children }),
5019
- showFooter && event && (customFooter || /* @__PURE__ */ jsx26(PublicPageFooter, { event }))
4947
+ /* @__PURE__ */ jsx25("main", { className: "px-4 w-[min(var(--app-width),100%)] mx-auto py-8", children }),
4948
+ showFooter && event && (customFooter || /* @__PURE__ */ jsx25(PublicPageFooter, { event }))
5020
4949
  ] }) });
5021
4950
  }
5022
4951
 
@@ -5048,8 +4977,7 @@ export {
5048
4977
  Form,
5049
4978
  FormField,
5050
4979
  LoginForm,
5051
- EventSelector,
5052
- OrganisationSelector,
4980
+ ContextSelector,
5053
4981
  PasswordChangeForm,
5054
4982
  UserMenu,
5055
4983
  NavigationMenu,
@@ -5072,4 +5000,4 @@ export {
5072
5000
  PublicPageFooter,
5073
5001
  PublicPageLayout
5074
5002
  };
5075
- //# sourceMappingURL=chunk-NECFR5MM.js.map
5003
+ //# sourceMappingURL=chunk-I6DAQMWX.js.map