@jmruthers/pace-core 0.5.78 → 0.5.80

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 (148) hide show
  1. package/dist/{DataTable-ETGVF4Y5.js → DataTable-OOZS7YTJ.js} +6 -6
  2. package/dist/{UnifiedAuthProvider-P5SOJAQ6.js → UnifiedAuthProvider-K2IZAY5F.js} +3 -3
  3. package/dist/{chunk-MNJXXD6C.js → chunk-5BN3YGNK.js} +166 -57
  4. package/dist/chunk-5BN3YGNK.js.map +1 -0
  5. package/dist/{chunk-FT2M4R4F.js → chunk-CBSD3BZ3.js} +8 -3
  6. package/dist/{chunk-FT2M4R4F.js.map → chunk-CBSD3BZ3.js.map} +1 -1
  7. package/dist/{chunk-QGVSOUJ2.js → chunk-I2VVV5PQ.js} +2 -2
  8. package/dist/{chunk-VSOKOFRF.js → chunk-KUYWZVR2.js} +4 -4
  9. package/dist/{chunk-YVVGHRGI.js → chunk-MJWN5JKI.js} +14 -7
  10. package/dist/chunk-MJWN5JKI.js.map +1 -0
  11. package/dist/{chunk-ZMNXIJP4.js → chunk-MVFZYTIZ.js} +142 -75
  12. package/dist/{chunk-ZMNXIJP4.js.map → chunk-MVFZYTIZ.js.map} +1 -1
  13. package/dist/{chunk-2OGV6IRV.js → chunk-NTW3KGS4.js} +5 -5
  14. package/dist/{chunk-FL4ZCQLD.js → chunk-RIXPZJUB.js} +2 -2
  15. package/dist/{chunk-5BO3MI5Y.js → chunk-S3JKDMD5.js} +3 -3
  16. package/dist/{chunk-PTR5PMPE.js → chunk-V5SWX6KL.js} +4 -4
  17. package/dist/{chunk-LRQ6RBJC.js → chunk-YVUZWLQG.js} +3 -3
  18. package/dist/components.js +8 -8
  19. package/dist/hooks.js +7 -7
  20. package/dist/index.js +11 -11
  21. package/dist/providers.js +2 -2
  22. package/dist/rbac/index.js +7 -7
  23. package/dist/utils.js +1 -1
  24. package/docs/api/classes/ColumnFactory.md +1 -1
  25. package/docs/api/classes/ErrorBoundary.md +1 -1
  26. package/docs/api/classes/InvalidScopeError.md +1 -1
  27. package/docs/api/classes/MissingUserContextError.md +1 -1
  28. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  29. package/docs/api/classes/PermissionDeniedError.md +1 -1
  30. package/docs/api/classes/PublicErrorBoundary.md +1 -1
  31. package/docs/api/classes/RBACAuditManager.md +1 -1
  32. package/docs/api/classes/RBACCache.md +1 -1
  33. package/docs/api/classes/RBACEngine.md +1 -1
  34. package/docs/api/classes/RBACError.md +1 -1
  35. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  36. package/docs/api/classes/SecureSupabaseClient.md +1 -1
  37. package/docs/api/classes/StorageUtils.md +1 -1
  38. package/docs/api/enums/FileCategory.md +1 -1
  39. package/docs/api/interfaces/AggregateConfig.md +1 -1
  40. package/docs/api/interfaces/ButtonProps.md +1 -1
  41. package/docs/api/interfaces/CardProps.md +1 -1
  42. package/docs/api/interfaces/ColorPalette.md +1 -1
  43. package/docs/api/interfaces/ColorShade.md +1 -1
  44. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  45. package/docs/api/interfaces/DataRecord.md +1 -1
  46. package/docs/api/interfaces/DataTableAction.md +1 -1
  47. package/docs/api/interfaces/DataTableColumn.md +1 -1
  48. package/docs/api/interfaces/DataTableProps.md +1 -1
  49. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  50. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  51. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  52. package/docs/api/interfaces/EventLogoProps.md +1 -1
  53. package/docs/api/interfaces/FileDisplayProps.md +1 -1
  54. package/docs/api/interfaces/FileMetadata.md +1 -1
  55. package/docs/api/interfaces/FileReference.md +1 -1
  56. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  57. package/docs/api/interfaces/FileUploadOptions.md +1 -1
  58. package/docs/api/interfaces/FileUploadProps.md +1 -1
  59. package/docs/api/interfaces/FooterProps.md +1 -1
  60. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  61. package/docs/api/interfaces/InputProps.md +1 -1
  62. package/docs/api/interfaces/LabelProps.md +1 -1
  63. package/docs/api/interfaces/LoginFormProps.md +1 -1
  64. package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
  65. package/docs/api/interfaces/NavigationContextType.md +1 -1
  66. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  67. package/docs/api/interfaces/NavigationItem.md +1 -1
  68. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  69. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  70. package/docs/api/interfaces/Organisation.md +1 -1
  71. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  72. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  73. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  74. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  75. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  76. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  77. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  78. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  79. package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
  80. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  81. package/docs/api/interfaces/PaletteData.md +1 -1
  82. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  83. package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
  84. package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
  85. package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
  86. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  87. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  88. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  89. package/docs/api/interfaces/RBACConfig.md +1 -1
  90. package/docs/api/interfaces/RBACLogger.md +1 -1
  91. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  92. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  93. package/docs/api/interfaces/RouteAccessRecord.md +1 -1
  94. package/docs/api/interfaces/RouteConfig.md +1 -1
  95. package/docs/api/interfaces/SecureDataContextType.md +1 -1
  96. package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
  97. package/docs/api/interfaces/StorageConfig.md +1 -1
  98. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  99. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  100. package/docs/api/interfaces/StorageListOptions.md +1 -1
  101. package/docs/api/interfaces/StorageListResult.md +1 -1
  102. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  103. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  104. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  105. package/docs/api/interfaces/StyleImport.md +1 -1
  106. package/docs/api/interfaces/SwitchProps.md +1 -1
  107. package/docs/api/interfaces/ToastActionElement.md +1 -1
  108. package/docs/api/interfaces/ToastProps.md +1 -1
  109. package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
  110. package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
  111. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  112. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  113. package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
  114. package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
  115. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  116. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  117. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  118. package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
  119. package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
  120. package/docs/api/interfaces/UserEventAccess.md +1 -1
  121. package/docs/api/interfaces/UserMenuProps.md +1 -1
  122. package/docs/api/interfaces/UserProfile.md +1 -1
  123. package/docs/api/modules.md +3 -3
  124. package/docs/architecture/rpc-function-standards.md +757 -0
  125. package/package.json +1 -1
  126. package/src/components/DataTable/components/DataTableCore.tsx +105 -18
  127. package/src/components/DataTable/components/PaginationControls.tsx +78 -77
  128. package/src/components/DataTable/hooks/useDataTableConfiguration.ts +29 -16
  129. package/src/components/DataTable/hooks/useEffectiveColumnOrder.ts +6 -4
  130. package/src/components/DataTable/hooks/useTableColumns.ts +20 -19
  131. package/src/components/DataTable/hooks/useTableHandlers.ts +8 -3
  132. package/src/components/EventSelector/EventSelector.tsx +8 -0
  133. package/src/hooks/useEvents.ts +8 -1
  134. package/src/providers/services/UnifiedAuthProvider.tsx +177 -59
  135. package/src/services/EventService.ts +8 -0
  136. package/src/styles/core.css +1 -2
  137. package/dist/chunk-MNJXXD6C.js.map +0 -1
  138. package/dist/chunk-YVVGHRGI.js.map +0 -1
  139. package/src/styles/base.css +0 -208
  140. /package/dist/{DataTable-ETGVF4Y5.js.map → DataTable-OOZS7YTJ.js.map} +0 -0
  141. /package/dist/{UnifiedAuthProvider-P5SOJAQ6.js.map → UnifiedAuthProvider-K2IZAY5F.js.map} +0 -0
  142. /package/dist/{chunk-QGVSOUJ2.js.map → chunk-I2VVV5PQ.js.map} +0 -0
  143. /package/dist/{chunk-VSOKOFRF.js.map → chunk-KUYWZVR2.js.map} +0 -0
  144. /package/dist/{chunk-2OGV6IRV.js.map → chunk-NTW3KGS4.js.map} +0 -0
  145. /package/dist/{chunk-FL4ZCQLD.js.map → chunk-RIXPZJUB.js.map} +0 -0
  146. /package/dist/{chunk-5BO3MI5Y.js.map → chunk-S3JKDMD5.js.map} +0 -0
  147. /package/dist/{chunk-PTR5PMPE.js.map → chunk-V5SWX6KL.js.map} +0 -0
  148. /package/dist/{chunk-LRQ6RBJC.js.map → chunk-YVUZWLQG.js.map} +0 -0
@@ -8,7 +8,7 @@
8
8
  * Note: RBAC functionality is available via useRBAC() hook from '@jmruthers/pace-core/rbac'
9
9
  */
10
10
 
11
- import React, { createContext, useContext, useMemo } from 'react';
11
+ import React, { createContext, useContext, useMemo, useCallback, useRef } from 'react';
12
12
  import { type SupabaseClient, type User, type Session } from '@supabase/supabase-js';
13
13
  import { AuthServiceProvider } from './AuthServiceProvider';
14
14
  import { OrganisationServiceProvider } from './OrganisationServiceProvider';
@@ -177,19 +177,88 @@ function UnifiedAuthContextProvider({
177
177
  const eventLoading = eventService.isLoading();
178
178
  const totalLoading = authLoading || orgLoading || eventLoading;
179
179
 
180
- // Log auth state for debugging with detailed loading states
181
- console.log('[UnifiedAuthContext] Auth state:', {
182
- isAuthenticated: isAuth,
183
- user: currentUser?.email,
184
- session: currentSession ? 'exists' : 'null',
185
- totalLoading,
186
- authLoading,
187
- orgLoading,
188
- eventLoading,
189
- orgContextReady: organisationService.isContextReady()
190
- });
180
+ // Extract all primitive values from services to use in dependencies
181
+ const authError = authService.getError();
182
+ const supabase = authService.getSupabaseClient();
183
+ const selectedOrganisation = organisationService.getSelectedOrganisation();
184
+ const organisations = organisationService.getOrganisations();
185
+ const userMemberships = organisationService.getUserMemberships();
186
+ const organisationError = organisationService.getError();
187
+ const hasValidOrganisationContext = organisationService.hasValidOrganisationContext();
188
+ const isContextReady = organisationService.isContextReady();
189
+ const events = eventService.getEvents();
190
+ const selectedEvent = eventService.getSelectedEvent();
191
+ const eventError = eventService.getError();
192
+ const showInactivityWarning = inactivityService.getShowInactivityWarning();
193
+ const inactivityTimeRemaining = inactivityService.getInactivityTimeRemaining();
194
+ const isIdle = inactivityService.isIdle();
195
+ const timeRemaining = inactivityService.getTimeRemaining();
196
+ const showWarning = inactivityService.isWarningShown();
197
+ const isTracking = inactivityService.isTracking();
198
+ const hasErrors = !!(authError || organisationError || eventError);
199
+
200
+ // Create stable references for all methods using useCallback
201
+ const signIn = useCallback((email: string, password?: string) => authService.signIn(email, password), [authService]);
202
+ const signUp = useCallback((email: string, password: string) => authService.signUp(email, password), [authService]);
203
+ const signOut = useCallback(() => authService.signOut(), [authService]);
204
+ const resetPassword = useCallback((email: string) => authService.resetPassword(email), [authService]);
205
+ const updatePassword = useCallback((password: string) => authService.updatePassword(password), [authService]);
206
+ const refreshSession = useCallback(() => authService.refreshSession(), [authService]);
207
+
208
+ const switchOrganisation = useCallback((orgId: string) => organisationService.switchOrganisation(orgId), [organisationService]);
209
+ const getUserRole = useCallback((orgId?: string) => organisationService.getUserRole(orgId), [organisationService]);
210
+ const validateOrganisationAccess = useCallback((orgId: string) => organisationService.validateOrganisationAccess(orgId), [organisationService]);
211
+ const refreshOrganisations = useCallback(() => organisationService.refreshOrganisations(), [organisationService]);
212
+ const ensureOrganisationContext = useCallback(() => organisationService.ensureOrganisationContext(), [organisationService]);
213
+ const isOrganisationSecure = useCallback(() => organisationService.isOrganisationSecure(), [organisationService]);
214
+ const getPrimaryOrganisation = useCallback(() => organisationService.getPrimaryOrganisation(), [organisationService]);
215
+
216
+ const setSelectedEvent = useCallback((event: Event | null) => eventService.setSelectedEvent(event), [eventService]);
217
+ const refreshEvents = useCallback(() => eventService.refreshEvents(), [eventService]);
218
+
219
+ const resetActivity = useCallback(() => inactivityService.resetActivity(), [inactivityService]);
220
+ const startTracking = useCallback(() => inactivityService.startTracking(), [inactivityService]);
221
+ const stopTracking = useCallback(() => inactivityService.stopTracking(), [inactivityService]);
222
+ const handleIdleLogout = useCallback(() => inactivityService.handleIdleLogout(), [inactivityService]);
223
+ const handleStaySignedIn = useCallback(() => inactivityService.handleStaySignedIn(), [inactivityService]);
224
+ const handleSignOutNow = useCallback(() => inactivityService.handleSignOutNow(), [inactivityService]);
225
+
226
+ // Use ref to track previous state for conditional logging (dev only)
227
+ const prevStateRef = useRef<{
228
+ isAuthenticated: boolean;
229
+ userEmail: string | undefined;
230
+ totalLoading: boolean;
231
+ } | null>(null);
191
232
 
192
- // Memoized combined context value
233
+ // Only log when state actually changes (dev mode detection)
234
+ const isDev = import.meta.env.DEV || import.meta.env.MODE === 'development';
235
+ if (isDev) {
236
+ const currentState = {
237
+ isAuthenticated: isAuth,
238
+ userEmail: currentUser?.email,
239
+ totalLoading,
240
+ };
241
+
242
+ const prevState = prevStateRef.current;
243
+ if (!prevState ||
244
+ prevState.isAuthenticated !== currentState.isAuthenticated ||
245
+ prevState.userEmail !== currentState.userEmail ||
246
+ prevState.totalLoading !== currentState.totalLoading) {
247
+ console.log('[UnifiedAuthContext] Auth state changed:', {
248
+ isAuthenticated: isAuth,
249
+ user: currentUser?.email,
250
+ session: currentSession ? 'exists' : 'null',
251
+ totalLoading,
252
+ authLoading,
253
+ orgLoading,
254
+ eventLoading,
255
+ orgContextReady: isContextReady
256
+ });
257
+ prevStateRef.current = currentState;
258
+ }
259
+ }
260
+
261
+ // Memoized combined context value - only depends on primitive values
193
262
  const contextValue = useMemo<UnifiedAuthContextType>(() => {
194
263
  return {
195
264
  // Auth state
@@ -197,69 +266,121 @@ function UnifiedAuthContextProvider({
197
266
  session: currentSession,
198
267
  isAuthenticated: isAuth,
199
268
  authLoading: authLoading,
200
- authError: authService.getError(),
201
- error: authService.getError(), // Alias for backward compatibility
202
- supabase: authService.getSupabaseClient(),
269
+ authError: authError,
270
+ error: authError, // Alias for backward compatibility
271
+ supabase: supabase,
203
272
 
204
273
  // Auth methods
205
- signIn: authService.signIn.bind(authService),
206
- signUp: authService.signUp.bind(authService),
207
- signOut: authService.signOut.bind(authService),
208
- resetPassword: authService.resetPassword.bind(authService),
209
- updatePassword: authService.updatePassword.bind(authService),
210
- refreshSession: authService.refreshSession.bind(authService),
274
+ signIn,
275
+ signUp,
276
+ signOut,
277
+ resetPassword,
278
+ updatePassword,
279
+ refreshSession,
211
280
 
212
281
  // Organisation state
213
- selectedOrganisation: organisationService.getSelectedOrganisation(),
214
- organisations: organisationService.getOrganisations(),
215
- userMemberships: organisationService.getUserMemberships(),
282
+ selectedOrganisation: selectedOrganisation,
283
+ organisations: organisations,
284
+ userMemberships: userMemberships,
216
285
  organisationLoading: orgLoading,
217
- organisationError: organisationService.getError(),
218
- hasValidOrganisationContext: organisationService.hasValidOrganisationContext(),
219
- isContextReady: organisationService.isContextReady(),
286
+ organisationError: organisationError,
287
+ hasValidOrganisationContext: hasValidOrganisationContext,
288
+ isContextReady: isContextReady,
220
289
 
221
290
  // Organisation methods
222
- switchOrganisation: organisationService.switchOrganisation.bind(organisationService),
223
- getUserRole: organisationService.getUserRole.bind(organisationService),
224
- validateOrganisationAccess: organisationService.validateOrganisationAccess.bind(organisationService),
225
- refreshOrganisations: organisationService.refreshOrganisations.bind(organisationService),
226
- ensureOrganisationContext: organisationService.ensureOrganisationContext.bind(organisationService),
227
- isOrganisationSecure: organisationService.isOrganisationSecure.bind(organisationService),
228
- getPrimaryOrganisation: organisationService.getPrimaryOrganisation.bind(organisationService),
291
+ switchOrganisation,
292
+ getUserRole,
293
+ validateOrganisationAccess,
294
+ refreshOrganisations,
295
+ ensureOrganisationContext,
296
+ isOrganisationSecure,
297
+ getPrimaryOrganisation,
229
298
 
230
299
  // Event state
231
- events: eventService.getEvents(),
232
- selectedEvent: eventService.getSelectedEvent(),
300
+ events: events,
301
+ selectedEvent: selectedEvent,
233
302
  eventLoading: eventLoading,
234
- eventError: eventService.getError(),
303
+ eventError: eventError,
235
304
 
236
305
  // Event methods
237
- setSelectedEvent: eventService.setSelectedEvent.bind(eventService),
238
- refreshEvents: eventService.refreshEvents.bind(eventService),
306
+ setSelectedEvent,
307
+ refreshEvents,
239
308
 
240
309
  // Inactivity state
241
- showInactivityWarning: inactivityService.getShowInactivityWarning(),
242
- inactivityTimeRemaining: inactivityService.getInactivityTimeRemaining(),
243
- isIdle: inactivityService.isIdle(),
244
- timeRemaining: inactivityService.getTimeRemaining(),
245
- showWarning: inactivityService.isWarningShown(),
246
- isTracking: inactivityService.isTracking(),
310
+ showInactivityWarning: showInactivityWarning,
311
+ inactivityTimeRemaining: inactivityTimeRemaining,
312
+ isIdle: isIdle,
313
+ timeRemaining: timeRemaining,
314
+ showWarning: showWarning,
315
+ isTracking: isTracking,
247
316
 
248
317
  // Inactivity methods
249
- resetActivity: inactivityService.resetActivity.bind(inactivityService),
250
- startTracking: inactivityService.startTracking.bind(inactivityService),
251
- stopTracking: inactivityService.stopTracking.bind(inactivityService),
252
- handleIdleLogout: inactivityService.handleIdleLogout.bind(inactivityService),
253
- handleStaySignedIn: inactivityService.handleStaySignedIn.bind(inactivityService),
254
- handleSignOutNow: inactivityService.handleSignOutNow.bind(inactivityService),
318
+ resetActivity,
319
+ startTracking,
320
+ stopTracking,
321
+ handleIdleLogout,
322
+ handleStaySignedIn,
323
+ handleSignOutNow,
255
324
 
256
325
  // Additional unified properties
257
326
  appName,
258
327
  appConfig: appConfig,
259
328
  isLoading: totalLoading,
260
- hasErrors: !!(authService.getError() || organisationService.getError() || eventService.getError()),
329
+ hasErrors: hasErrors,
261
330
  };
262
- }, [authService, organisationService, eventService, inactivityService, appName, appConfig, currentUser, currentSession, isAuth, authLoading, orgLoading, eventLoading, totalLoading]);
331
+ }, [
332
+ // All primitive values extracted from services
333
+ // Note: Arrays/objects from services are stable references (same reference unless data changes)
334
+ currentUser,
335
+ currentSession,
336
+ isAuth,
337
+ authLoading,
338
+ authError,
339
+ supabase,
340
+ selectedOrganisation,
341
+ organisations,
342
+ userMemberships,
343
+ orgLoading,
344
+ organisationError,
345
+ hasValidOrganisationContext,
346
+ isContextReady,
347
+ events,
348
+ selectedEvent,
349
+ eventLoading,
350
+ eventError,
351
+ showInactivityWarning,
352
+ inactivityTimeRemaining,
353
+ isIdle,
354
+ timeRemaining,
355
+ showWarning,
356
+ isTracking,
357
+ totalLoading,
358
+ hasErrors,
359
+ appName,
360
+ appConfig,
361
+ // Stable function references from useCallback (services are stable, so callbacks are too)
362
+ signIn,
363
+ signUp,
364
+ signOut,
365
+ resetPassword,
366
+ updatePassword,
367
+ refreshSession,
368
+ switchOrganisation,
369
+ getUserRole,
370
+ validateOrganisationAccess,
371
+ refreshOrganisations,
372
+ ensureOrganisationContext,
373
+ isOrganisationSecure,
374
+ getPrimaryOrganisation,
375
+ setSelectedEvent,
376
+ refreshEvents,
377
+ resetActivity,
378
+ startTracking,
379
+ stopTracking,
380
+ handleIdleLogout,
381
+ handleStaySignedIn,
382
+ handleSignOutNow,
383
+ ]);
263
384
 
264
385
  return (
265
386
  <UnifiedAuthContext.Provider value={contextValue}>
@@ -285,11 +406,8 @@ function EventServiceProviderWrapper({
285
406
  const organisationService = useOrganisationService();
286
407
  const selectedOrganisation = organisationService.getSelectedOrganisation();
287
408
 
288
- // Only render EventServiceProvider if user and session are available
289
- if (!user || !session) {
290
- return <>{children}</>;
291
- }
292
-
409
+ // Always render EventServiceProvider - it handles null user/session gracefully
410
+ // This ensures EventServiceContext is always available for components calling useEvents()
293
411
  return (
294
412
  <EventServiceProvider
295
413
  supabaseClient={supabaseClient}
@@ -89,6 +89,10 @@ export class EventService extends BaseService implements IEventService {
89
89
 
90
90
  // Event state getters
91
91
  getEvents(): Event[] {
92
+ console.log('[EventService] getEvents() called, returning:', {
93
+ count: this.events.length,
94
+ events: this.events.map(e => ({ id: e.event_id, name: e.event_name }))
95
+ });
92
96
  return this.events;
93
97
  }
94
98
 
@@ -298,6 +302,10 @@ export class EventService extends BaseService implements IEventService {
298
302
  }));
299
303
 
300
304
  this.events = transformedEvents;
305
+ console.log('[EventService] Set events in service:', {
306
+ count: transformedEvents.length,
307
+ events: transformedEvents.map(e => ({ id: e.event_id, name: e.event_name }))
308
+ });
301
309
  this.error = null;
302
310
 
303
311
  // Reset auto-selection ref for new events
@@ -176,7 +176,6 @@
176
176
  margin: 0.25lh 0;
177
177
  padding-left: 1.5rem;
178
178
  }
179
-
180
179
  ul {
181
180
  list-style-type: disc;
182
181
  }
@@ -198,7 +197,7 @@
198
197
 
199
198
  small {
200
199
  font-size: 0.875em;
201
- color: var(--color-main-500);
200
+ color: var(--color-main-600);
202
201
  }
203
202
 
204
203
  .appGradient {