@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.
- package/dist/{DataTable-ETGVF4Y5.js → DataTable-OOZS7YTJ.js} +6 -6
- package/dist/{UnifiedAuthProvider-P5SOJAQ6.js → UnifiedAuthProvider-K2IZAY5F.js} +3 -3
- package/dist/{chunk-MNJXXD6C.js → chunk-5BN3YGNK.js} +166 -57
- package/dist/chunk-5BN3YGNK.js.map +1 -0
- package/dist/{chunk-FT2M4R4F.js → chunk-CBSD3BZ3.js} +8 -3
- package/dist/{chunk-FT2M4R4F.js.map → chunk-CBSD3BZ3.js.map} +1 -1
- package/dist/{chunk-QGVSOUJ2.js → chunk-I2VVV5PQ.js} +2 -2
- package/dist/{chunk-VSOKOFRF.js → chunk-KUYWZVR2.js} +4 -4
- package/dist/{chunk-YVVGHRGI.js → chunk-MJWN5JKI.js} +14 -7
- package/dist/chunk-MJWN5JKI.js.map +1 -0
- package/dist/{chunk-ZMNXIJP4.js → chunk-MVFZYTIZ.js} +142 -75
- package/dist/{chunk-ZMNXIJP4.js.map → chunk-MVFZYTIZ.js.map} +1 -1
- package/dist/{chunk-2OGV6IRV.js → chunk-NTW3KGS4.js} +5 -5
- package/dist/{chunk-FL4ZCQLD.js → chunk-RIXPZJUB.js} +2 -2
- package/dist/{chunk-5BO3MI5Y.js → chunk-S3JKDMD5.js} +3 -3
- package/dist/{chunk-PTR5PMPE.js → chunk-V5SWX6KL.js} +4 -4
- package/dist/{chunk-LRQ6RBJC.js → chunk-YVUZWLQG.js} +3 -3
- package/dist/components.js +8 -8
- package/dist/hooks.js +7 -7
- package/dist/index.js +11 -11
- package/dist/providers.js +2 -2
- package/dist/rbac/index.js +7 -7
- package/dist/utils.js +1 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +3 -3
- package/docs/architecture/rpc-function-standards.md +757 -0
- package/package.json +1 -1
- package/src/components/DataTable/components/DataTableCore.tsx +105 -18
- package/src/components/DataTable/components/PaginationControls.tsx +78 -77
- package/src/components/DataTable/hooks/useDataTableConfiguration.ts +29 -16
- package/src/components/DataTable/hooks/useEffectiveColumnOrder.ts +6 -4
- package/src/components/DataTable/hooks/useTableColumns.ts +20 -19
- package/src/components/DataTable/hooks/useTableHandlers.ts +8 -3
- package/src/components/EventSelector/EventSelector.tsx +8 -0
- package/src/hooks/useEvents.ts +8 -1
- package/src/providers/services/UnifiedAuthProvider.tsx +177 -59
- package/src/services/EventService.ts +8 -0
- package/src/styles/core.css +1 -2
- package/dist/chunk-MNJXXD6C.js.map +0 -1
- package/dist/chunk-YVVGHRGI.js.map +0 -1
- package/src/styles/base.css +0 -208
- /package/dist/{DataTable-ETGVF4Y5.js.map → DataTable-OOZS7YTJ.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-P5SOJAQ6.js.map → UnifiedAuthProvider-K2IZAY5F.js.map} +0 -0
- /package/dist/{chunk-QGVSOUJ2.js.map → chunk-I2VVV5PQ.js.map} +0 -0
- /package/dist/{chunk-VSOKOFRF.js.map → chunk-KUYWZVR2.js.map} +0 -0
- /package/dist/{chunk-2OGV6IRV.js.map → chunk-NTW3KGS4.js.map} +0 -0
- /package/dist/{chunk-FL4ZCQLD.js.map → chunk-RIXPZJUB.js.map} +0 -0
- /package/dist/{chunk-5BO3MI5Y.js.map → chunk-S3JKDMD5.js.map} +0 -0
- /package/dist/{chunk-PTR5PMPE.js.map → chunk-V5SWX6KL.js.map} +0 -0
- /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
|
-
//
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
-
//
|
|
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:
|
|
201
|
-
error:
|
|
202
|
-
supabase:
|
|
269
|
+
authError: authError,
|
|
270
|
+
error: authError, // Alias for backward compatibility
|
|
271
|
+
supabase: supabase,
|
|
203
272
|
|
|
204
273
|
// Auth methods
|
|
205
|
-
signIn
|
|
206
|
-
signUp
|
|
207
|
-
signOut
|
|
208
|
-
resetPassword
|
|
209
|
-
updatePassword
|
|
210
|
-
refreshSession
|
|
274
|
+
signIn,
|
|
275
|
+
signUp,
|
|
276
|
+
signOut,
|
|
277
|
+
resetPassword,
|
|
278
|
+
updatePassword,
|
|
279
|
+
refreshSession,
|
|
211
280
|
|
|
212
281
|
// Organisation state
|
|
213
|
-
selectedOrganisation:
|
|
214
|
-
organisations:
|
|
215
|
-
userMemberships:
|
|
282
|
+
selectedOrganisation: selectedOrganisation,
|
|
283
|
+
organisations: organisations,
|
|
284
|
+
userMemberships: userMemberships,
|
|
216
285
|
organisationLoading: orgLoading,
|
|
217
|
-
organisationError:
|
|
218
|
-
hasValidOrganisationContext:
|
|
219
|
-
isContextReady:
|
|
286
|
+
organisationError: organisationError,
|
|
287
|
+
hasValidOrganisationContext: hasValidOrganisationContext,
|
|
288
|
+
isContextReady: isContextReady,
|
|
220
289
|
|
|
221
290
|
// Organisation methods
|
|
222
|
-
switchOrganisation
|
|
223
|
-
getUserRole
|
|
224
|
-
validateOrganisationAccess
|
|
225
|
-
refreshOrganisations
|
|
226
|
-
ensureOrganisationContext
|
|
227
|
-
isOrganisationSecure
|
|
228
|
-
getPrimaryOrganisation
|
|
291
|
+
switchOrganisation,
|
|
292
|
+
getUserRole,
|
|
293
|
+
validateOrganisationAccess,
|
|
294
|
+
refreshOrganisations,
|
|
295
|
+
ensureOrganisationContext,
|
|
296
|
+
isOrganisationSecure,
|
|
297
|
+
getPrimaryOrganisation,
|
|
229
298
|
|
|
230
299
|
// Event state
|
|
231
|
-
events:
|
|
232
|
-
selectedEvent:
|
|
300
|
+
events: events,
|
|
301
|
+
selectedEvent: selectedEvent,
|
|
233
302
|
eventLoading: eventLoading,
|
|
234
|
-
eventError:
|
|
303
|
+
eventError: eventError,
|
|
235
304
|
|
|
236
305
|
// Event methods
|
|
237
|
-
setSelectedEvent
|
|
238
|
-
refreshEvents
|
|
306
|
+
setSelectedEvent,
|
|
307
|
+
refreshEvents,
|
|
239
308
|
|
|
240
309
|
// Inactivity state
|
|
241
|
-
showInactivityWarning:
|
|
242
|
-
inactivityTimeRemaining:
|
|
243
|
-
isIdle:
|
|
244
|
-
timeRemaining:
|
|
245
|
-
showWarning:
|
|
246
|
-
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
|
|
250
|
-
startTracking
|
|
251
|
-
stopTracking
|
|
252
|
-
handleIdleLogout
|
|
253
|
-
handleStaySignedIn
|
|
254
|
-
handleSignOutNow
|
|
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:
|
|
329
|
+
hasErrors: hasErrors,
|
|
261
330
|
};
|
|
262
|
-
}, [
|
|
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
|
-
//
|
|
289
|
-
|
|
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
|
package/src/styles/core.css
CHANGED
|
@@ -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-
|
|
200
|
+
color: var(--color-main-600);
|
|
202
201
|
}
|
|
203
202
|
|
|
204
203
|
.appGradient {
|