@jmruthers/pace-core 0.6.3 → 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 (40) hide show
  1. package/dist/{DataTable-THFPBKTP.js → DataTable-E7YQZD7D.js} +7 -7
  2. package/dist/{UnifiedAuthProvider-KAGUYQ4J.js → UnifiedAuthProvider-QPXO24B4.js} +4 -4
  3. package/dist/{api-IAGWF3ZG.js → api-6LVZTHDS.js} +3 -3
  4. package/dist/{chunk-QRPVRXYT.js → chunk-36LVWXB2.js} +2 -1
  5. package/dist/{chunk-RWEBCB47.js → chunk-3LPHPB62.js} +2 -2
  6. package/dist/{chunk-HFZBI76P.js → chunk-5EC5MEWX.js} +4 -4
  7. package/dist/{chunk-PQBSKX33.js → chunk-7JPAB3T5.js} +4 -4
  8. package/dist/{chunk-CNCQDFLN.js → chunk-ATKZM7RX.js} +14 -14
  9. package/dist/{chunk-DWUBLJJM.js → chunk-AVMLPIM7.js} +88 -8
  10. package/dist/chunk-AVMLPIM7.js.map +1 -0
  11. package/dist/{chunk-ZNIWI3UC.js → chunk-I6DAQMWX.js} +25 -15
  12. package/dist/{chunk-ZNIWI3UC.js.map → chunk-I6DAQMWX.js.map} +1 -1
  13. package/dist/{chunk-YDQHOZNA.js → chunk-NN6WWZ5U.js} +8 -8
  14. package/dist/{chunk-6Z7LTB3D.js → chunk-OEWDTMG7.js} +4 -4
  15. package/dist/{chunk-2T2IG7T7.js → chunk-YKRAFF5K.js} +3 -3
  16. package/dist/components.js +8 -8
  17. package/dist/{contextValidator-3JNZKUTX.js → contextValidator-OOPCLPZW.js} +2 -2
  18. package/dist/hooks.js +6 -6
  19. package/dist/index.js +10 -10
  20. package/dist/providers.js +3 -3
  21. package/dist/rbac/index.js +6 -6
  22. package/dist/utils.js +1 -1
  23. package/docs/api/modules.md +2 -2
  24. package/package.json +8 -3
  25. package/scripts/audit/core/checks/dependencies.cjs +9 -0
  26. package/src/components/PaceAppLayout/PaceAppLayout.tsx +22 -3
  27. package/src/services/EventService.ts +99 -2
  28. package/dist/chunk-DWUBLJJM.js.map +0 -1
  29. /package/dist/{DataTable-THFPBKTP.js.map → DataTable-E7YQZD7D.js.map} +0 -0
  30. /package/dist/{UnifiedAuthProvider-KAGUYQ4J.js.map → UnifiedAuthProvider-QPXO24B4.js.map} +0 -0
  31. /package/dist/{api-IAGWF3ZG.js.map → api-6LVZTHDS.js.map} +0 -0
  32. /package/dist/{chunk-QRPVRXYT.js.map → chunk-36LVWXB2.js.map} +0 -0
  33. /package/dist/{chunk-RWEBCB47.js.map → chunk-3LPHPB62.js.map} +0 -0
  34. /package/dist/{chunk-HFZBI76P.js.map → chunk-5EC5MEWX.js.map} +0 -0
  35. /package/dist/{chunk-PQBSKX33.js.map → chunk-7JPAB3T5.js.map} +0 -0
  36. /package/dist/{chunk-CNCQDFLN.js.map → chunk-ATKZM7RX.js.map} +0 -0
  37. /package/dist/{chunk-YDQHOZNA.js.map → chunk-NN6WWZ5U.js.map} +0 -0
  38. /package/dist/{chunk-6Z7LTB3D.js.map → chunk-OEWDTMG7.js.map} +0 -0
  39. /package/dist/{chunk-2T2IG7T7.js.map → chunk-YKRAFF5K.js.map} +0 -0
  40. /package/dist/{contextValidator-3JNZKUTX.js.map → contextValidator-OOPCLPZW.js.map} +0 -0
@@ -60,8 +60,8 @@ import {
60
60
  sum,
61
61
  validateHierarchicalData,
62
62
  validatePaginationConfig
63
- } from "./chunk-PQBSKX33.js";
64
- import "./chunk-YDQHOZNA.js";
63
+ } from "./chunk-7JPAB3T5.js";
64
+ import "./chunk-NN6WWZ5U.js";
65
65
  import {
66
66
  CircuitBreaker,
67
67
  DEFAULT_FALLBACK_CONFIG,
@@ -80,12 +80,12 @@ import {
80
80
  throttle,
81
81
  useDataTablePerformance
82
82
  } from "./chunk-6SOIHG6Z.js";
83
- import "./chunk-6Z7LTB3D.js";
83
+ import "./chunk-OEWDTMG7.js";
84
84
  import "./chunk-KQCRWDSA.js";
85
- import "./chunk-DWUBLJJM.js";
86
- import "./chunk-RWEBCB47.js";
85
+ import "./chunk-AVMLPIM7.js";
86
+ import "./chunk-3LPHPB62.js";
87
87
  import "./chunk-63FOKYGO.js";
88
- import "./chunk-QRPVRXYT.js";
88
+ import "./chunk-36LVWXB2.js";
89
89
  import "./chunk-QXHPKYJV.js";
90
90
  import "./chunk-M43Y4SSO.js";
91
91
  import "./chunk-M7MPQISP.js";
@@ -172,4 +172,4 @@ export {
172
172
  validateHierarchicalData,
173
173
  validatePaginationConfig
174
174
  };
175
- //# sourceMappingURL=DataTable-THFPBKTP.js.map
175
+ //# sourceMappingURL=DataTable-E7YQZD7D.js.map
@@ -2,10 +2,10 @@ import {
2
2
  UnifiedAuthContext,
3
3
  UnifiedAuthProvider,
4
4
  useUnifiedAuth
5
- } from "./chunk-DWUBLJJM.js";
6
- import "./chunk-RWEBCB47.js";
5
+ } from "./chunk-AVMLPIM7.js";
6
+ import "./chunk-3LPHPB62.js";
7
7
  import "./chunk-63FOKYGO.js";
8
- import "./chunk-QRPVRXYT.js";
8
+ import "./chunk-36LVWXB2.js";
9
9
  import "./chunk-QXHPKYJV.js";
10
10
  import "./chunk-VBXEHIUJ.js";
11
11
  import "./chunk-PWLANIRT.js";
@@ -15,4 +15,4 @@ export {
15
15
  UnifiedAuthProvider,
16
16
  useUnifiedAuth
17
17
  };
18
- //# sourceMappingURL=UnifiedAuthProvider-KAGUYQ4J.js.map
18
+ //# sourceMappingURL=UnifiedAuthProvider-QPXO24B4.js.map
@@ -19,11 +19,11 @@ import {
19
19
  isSuperAdmin,
20
20
  resolveAppContext,
21
21
  setupRBAC
22
- } from "./chunk-RWEBCB47.js";
22
+ } from "./chunk-3LPHPB62.js";
23
23
  import "./chunk-63FOKYGO.js";
24
24
  import {
25
25
  OrganisationContextRequiredError
26
- } from "./chunk-QRPVRXYT.js";
26
+ } from "./chunk-36LVWXB2.js";
27
27
  import "./chunk-PWLANIRT.js";
28
28
  import "./chunk-DGUM43GV.js";
29
29
  export {
@@ -49,4 +49,4 @@ export {
49
49
  resolveAppContext,
50
50
  setupRBAC
51
51
  };
52
- //# sourceMappingURL=api-IAGWF3ZG.js.map
52
+ //# sourceMappingURL=api-6LVZTHDS.js.map
@@ -218,9 +218,10 @@ export {
218
218
  RBACError,
219
219
  PermissionDeniedError,
220
220
  OrganisationContextRequiredError,
221
+ EventContextRequiredError,
221
222
  RBACNotInitializedError,
222
223
  InvalidScopeError,
223
224
  MissingUserContextError,
224
225
  ContextValidator
225
226
  };
226
- //# sourceMappingURL=chunk-QRPVRXYT.js.map
227
+ //# sourceMappingURL=chunk-36LVWXB2.js.map
@@ -11,7 +11,7 @@ import {
11
11
  PermissionDeniedError,
12
12
  RBACError,
13
13
  RBACNotInitializedError
14
- } from "./chunk-QRPVRXYT.js";
14
+ } from "./chunk-36LVWXB2.js";
15
15
  import {
16
16
  createLogger
17
17
  } from "./chunk-PWLANIRT.js";
@@ -1990,4 +1990,4 @@ export {
1990
1990
  invalidateAppCache,
1991
1991
  clearCache
1992
1992
  };
1993
- //# sourceMappingURL=chunk-RWEBCB47.js.map
1993
+ //# sourceMappingURL=chunk-3LPHPB62.js.map
@@ -9,14 +9,14 @@ import {
9
9
  getSignedUrl,
10
10
  listFiles,
11
11
  uploadFile
12
- } from "./chunk-2T2IG7T7.js";
12
+ } from "./chunk-YKRAFF5K.js";
13
13
  import {
14
14
  useOrganisationSecurity,
15
15
  usePublicPageContext
16
- } from "./chunk-6Z7LTB3D.js";
16
+ } from "./chunk-OEWDTMG7.js";
17
17
  import {
18
18
  useOrganisations
19
- } from "./chunk-DWUBLJJM.js";
19
+ } from "./chunk-AVMLPIM7.js";
20
20
  import {
21
21
  assertOrganisationId
22
22
  } from "./chunk-QXHPKYJV.js";
@@ -685,4 +685,4 @@ export {
685
685
  generatePublicRoutePath,
686
686
  extractEventCodeFromPath
687
687
  };
688
- //# sourceMappingURL=chunk-HFZBI76P.js.map
688
+ //# sourceMappingURL=chunk-5EC5MEWX.js.map
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  useCan,
3
3
  useResolvedScope
4
- } from "./chunk-YDQHOZNA.js";
4
+ } from "./chunk-NN6WWZ5U.js";
5
5
  import {
6
6
  toast,
7
7
  useDataTablePerformance
8
8
  } from "./chunk-6SOIHG6Z.js";
9
9
  import {
10
10
  useUnifiedAuth
11
- } from "./chunk-DWUBLJJM.js";
11
+ } from "./chunk-AVMLPIM7.js";
12
12
  import {
13
13
  isSuperAdmin
14
- } from "./chunk-RWEBCB47.js";
14
+ } from "./chunk-3LPHPB62.js";
15
15
  import {
16
16
  cn,
17
17
  renderSafeHtml
@@ -7790,4 +7790,4 @@ export {
7790
7790
  min,
7791
7791
  max
7792
7792
  };
7793
- //# sourceMappingURL=chunk-PQBSKX33.js.map
7793
+ //# sourceMappingURL=chunk-7JPAB3T5.js.map
@@ -5,22 +5,22 @@ import {
5
5
  useMultiplePermissions,
6
6
  useResolvedScope,
7
7
  useSecureSupabase
8
- } from "./chunk-YDQHOZNA.js";
8
+ } from "./chunk-NN6WWZ5U.js";
9
9
  import {
10
10
  useOrganisationSecurity
11
- } from "./chunk-6Z7LTB3D.js";
11
+ } from "./chunk-OEWDTMG7.js";
12
12
  import {
13
13
  useUnifiedAuth
14
- } from "./chunk-DWUBLJJM.js";
14
+ } from "./chunk-AVMLPIM7.js";
15
15
  import {
16
16
  RBACCache,
17
17
  getRBACConfig,
18
18
  getRBACLogger,
19
19
  rbacCache
20
- } from "./chunk-RWEBCB47.js";
20
+ } from "./chunk-3LPHPB62.js";
21
21
  import {
22
22
  RBACNotInitializedError
23
- } from "./chunk-QRPVRXYT.js";
23
+ } from "./chunk-36LVWXB2.js";
24
24
  import {
25
25
  createLogger,
26
26
  logger
@@ -192,7 +192,7 @@ var PagePermissionGuardComponent = ({
192
192
  const checkSuperAdmin = async () => {
193
193
  const startTime = Date.now();
194
194
  try {
195
- const { isSuperAdmin: checkSuperAdmin2 } = await import("./api-IAGWF3ZG.js");
195
+ const { isSuperAdmin: checkSuperAdmin2 } = await import("./api-6LVZTHDS.js");
196
196
  const timeoutPromise = new Promise((_, reject) => {
197
197
  setTimeout(() => reject(new Error("Super admin check timeout")), 1e4);
198
198
  });
@@ -1380,7 +1380,7 @@ function withPermissionGuard(config, handler) {
1380
1380
  if (!userId || !organisationId) {
1381
1381
  throw new Error("User context required for permission check");
1382
1382
  }
1383
- const { isPermitted: isPermitted2 } = await import("./api-IAGWF3ZG.js");
1383
+ const { isPermitted: isPermitted2 } = await import("./api-6LVZTHDS.js");
1384
1384
  const hasPermission2 = await isPermitted2({
1385
1385
  userId,
1386
1386
  scope: { organisationId, eventId, appId },
@@ -1403,7 +1403,7 @@ function withAccessLevelGuard(minLevel, handler) {
1403
1403
  if (!userId || !organisationId) {
1404
1404
  throw new Error("User context required for access level check");
1405
1405
  }
1406
- const { getAccessLevel: getAccessLevel2 } = await import("./api-IAGWF3ZG.js");
1406
+ const { getAccessLevel: getAccessLevel2 } = await import("./api-6LVZTHDS.js");
1407
1407
  const accessLevel = await getAccessLevel2({
1408
1408
  userId,
1409
1409
  scope: { organisationId, eventId, appId }
@@ -1428,7 +1428,7 @@ function withRoleGuard(config, handler) {
1428
1428
  throw new Error("User context required for role check");
1429
1429
  }
1430
1430
  if (config.globalRoles && config.globalRoles.length > 0) {
1431
- const { isSuperAdmin } = await import("./api-IAGWF3ZG.js");
1431
+ const { isSuperAdmin } = await import("./api-6LVZTHDS.js");
1432
1432
  const isSuper = await isSuperAdmin(userId);
1433
1433
  if (isSuper) {
1434
1434
  if (organisationId) {
@@ -1454,14 +1454,14 @@ function withRoleGuard(config, handler) {
1454
1454
  }
1455
1455
  }
1456
1456
  if (config.organisationRoles && config.organisationRoles.length > 0) {
1457
- const { isOrganisationAdmin } = await import("./api-IAGWF3ZG.js");
1457
+ const { isOrganisationAdmin } = await import("./api-6LVZTHDS.js");
1458
1458
  const isOrgAdmin = await isOrganisationAdmin(userId, organisationId);
1459
1459
  if (!isOrgAdmin && config.requireAll !== false) {
1460
1460
  throw new Error(`Organisation admin role required`);
1461
1461
  }
1462
1462
  }
1463
1463
  if (config.eventAppRoles && config.eventAppRoles.length > 0 && eventId && appId) {
1464
- const { isEventAdmin } = await import("./api-IAGWF3ZG.js");
1464
+ const { isEventAdmin } = await import("./api-6LVZTHDS.js");
1465
1465
  const isEventAdminUser = await isEventAdmin(userId, { organisationId, eventId, appId });
1466
1466
  if (!isEventAdminUser && config.requireAll !== false) {
1467
1467
  throw new Error(`Event admin role required`);
@@ -1501,7 +1501,7 @@ function createRBACMiddleware(config) {
1501
1501
  );
1502
1502
  if (protectedRoute) {
1503
1503
  try {
1504
- const { isPermitted: isPermitted2 } = await import("./api-IAGWF3ZG.js");
1504
+ const { isPermitted: isPermitted2 } = await import("./api-6LVZTHDS.js");
1505
1505
  const hasPermission2 = await isPermitted2({
1506
1506
  userId,
1507
1507
  scope: { organisationId },
@@ -1528,7 +1528,7 @@ function createRBACExpressMiddleware(config) {
1528
1528
  return res.status(401).json({ error: "User context required" });
1529
1529
  }
1530
1530
  try {
1531
- const { isPermitted: isPermitted2 } = await import("./api-IAGWF3ZG.js");
1531
+ const { isPermitted: isPermitted2 } = await import("./api-6LVZTHDS.js");
1532
1532
  const hasPermission2 = await isPermitted2({
1533
1533
  userId,
1534
1534
  scope: { organisationId, eventId, appId },
@@ -2050,4 +2050,4 @@ export {
2050
2050
  getDirectSupabaseAuthFixes,
2051
2051
  getQuickFixes
2052
2052
  };
2053
- //# sourceMappingURL=chunk-CNCQDFLN.js.map
2053
+ //# sourceMappingURL=chunk-ATKZM7RX.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isRBACInitialized,
3
3
  setupRBAC
4
- } from "./chunk-RWEBCB47.js";
4
+ } from "./chunk-3LPHPB62.js";
5
5
  import {
6
6
  assertOrganisationId,
7
7
  assertUserId
@@ -1016,7 +1016,7 @@ var _OrganisationService = class _OrganisationService extends BaseService {
1016
1016
  let userIsSuperAdmin = false;
1017
1017
  if (this.user?.id) {
1018
1018
  try {
1019
- const { isSuperAdmin: checkSuperAdmin, isRBACInitialized: isRBACInitialized2, setupRBAC: setupRBAC2 } = await import("./api-IAGWF3ZG.js");
1019
+ const { isSuperAdmin: checkSuperAdmin, isRBACInitialized: isRBACInitialized2, setupRBAC: setupRBAC2 } = await import("./api-6LVZTHDS.js");
1020
1020
  if (!isRBACInitialized2() && this.supabaseClient) {
1021
1021
  setupRBAC2(this.supabaseClient);
1022
1022
  }
@@ -1275,6 +1275,8 @@ var _EventService = class _EventService extends BaseService {
1275
1275
  this.resetInitialization();
1276
1276
  this.isInitializedRef = false;
1277
1277
  this.isFetchingRef = false;
1278
+ this.userClearedEventRef = false;
1279
+ this.hasAutoSelectedRef = false;
1278
1280
  logger.debug("EventService", `User changed [ID:${this.instanceId}]`, {
1279
1281
  previousUserId,
1280
1282
  newUserId,
@@ -1289,7 +1291,7 @@ var _EventService = class _EventService extends BaseService {
1289
1291
  this.setSelectedEventId = setSelectedEventId;
1290
1292
  if (user?.id) {
1291
1293
  try {
1292
- const { isRBACInitialized: isRBACInitialized2, isSuperAdmin: checkSuperAdmin, setupRBAC: setupRBAC2 } = await import("./api-IAGWF3ZG.js");
1294
+ const { isRBACInitialized: isRBACInitialized2, isSuperAdmin: checkSuperAdmin, setupRBAC: setupRBAC2 } = await import("./api-6LVZTHDS.js");
1293
1295
  if (!isRBACInitialized2() && this.supabaseClient) {
1294
1296
  setupRBAC2(this.supabaseClient);
1295
1297
  }
@@ -1321,12 +1323,28 @@ var _EventService = class _EventService extends BaseService {
1321
1323
  this.isInitializedRef = false;
1322
1324
  this.isFetchingRef = false;
1323
1325
  const shouldClearEvents = !this.isSuperAdmin;
1324
- if (previousOrgId !== null && newOrgId !== null && previousOrgId !== newOrgId) {
1326
+ const isFirstOrgSet = (previousOrgId === null || previousOrgId === void 0) && newOrgId !== null && newOrgId !== void 0;
1327
+ if (isFirstOrgSet) {
1328
+ const hadAutoSelectedEvent = this.hasAutoSelectedRef && !!this.selectedEvent;
1329
+ this.userClearedEventRef = false;
1330
+ if (!hadAutoSelectedEvent) {
1331
+ this.hasAutoSelectedRef = false;
1332
+ }
1333
+ logger.debug("EventService", "Organisation first set - preserving event and resetting auto-selection flags", {
1334
+ organisationId: newOrgId,
1335
+ hasSelectedEvent: !!this.selectedEvent,
1336
+ selectedEventId: this.selectedEvent?.event_id,
1337
+ hadAutoSelectedEvent,
1338
+ preservingEvent: hadAutoSelectedEvent,
1339
+ previousOrgId,
1340
+ newOrgId
1341
+ });
1342
+ } else if (previousOrgId !== null && previousOrgId !== void 0 && newOrgId !== null && newOrgId !== void 0 && previousOrgId !== newOrgId) {
1325
1343
  if (shouldClearEvents) {
1326
1344
  this.events = [];
1327
1345
  this.setSelectedEvent(null);
1328
1346
  }
1329
- } else if (previousOrgId !== null && newOrgId === null) {
1347
+ } else if (previousOrgId !== null && previousOrgId !== void 0 && newOrgId === null) {
1330
1348
  if (shouldClearEvents) {
1331
1349
  this.events = [];
1332
1350
  this.setSelectedEvent(null);
@@ -1357,7 +1375,13 @@ var _EventService = class _EventService extends BaseService {
1357
1375
  logger.warn("EventService", "Failed to persist event selection:", error);
1358
1376
  });
1359
1377
  this.userClearedEventRef = false;
1378
+ logger.debug("EventService", "Event selected", {
1379
+ eventId: event.event_id,
1380
+ eventName: event.event_name,
1381
+ userClearedEventRef: this.userClearedEventRef
1382
+ });
1360
1383
  } else {
1384
+ const previousEventId = this.selectedEvent?.event_id;
1361
1385
  this.selectedEvent = null;
1362
1386
  this.setSelectedEventId?.(null);
1363
1387
  this.clearEventSelection().catch((error) => {
@@ -1365,6 +1389,11 @@ var _EventService = class _EventService extends BaseService {
1365
1389
  });
1366
1390
  this.hasAutoSelectedRef = false;
1367
1391
  this.userClearedEventRef = true;
1392
+ logger.debug("EventService", "Event cleared via setSelectedEvent(null)", {
1393
+ previousEventId,
1394
+ userClearedEventRef: this.userClearedEventRef,
1395
+ stackTrace: new Error().stack
1396
+ });
1368
1397
  }
1369
1398
  this.notify();
1370
1399
  }
@@ -1504,7 +1533,7 @@ var _EventService = class _EventService extends BaseService {
1504
1533
  let organisationIdForRpc = null;
1505
1534
  let userIsSuperAdmin = this.isSuperAdmin;
1506
1535
  try {
1507
- const { isRBACInitialized: isRBACInitialized2, isSuperAdmin: checkSuperAdmin, setupRBAC: setupRBAC2 } = await import("./api-IAGWF3ZG.js");
1536
+ const { isRBACInitialized: isRBACInitialized2, isSuperAdmin: checkSuperAdmin, setupRBAC: setupRBAC2 } = await import("./api-6LVZTHDS.js");
1508
1537
  if (!isRBACInitialized2() && this.supabaseClient) {
1509
1538
  setupRBAC2(this.supabaseClient);
1510
1539
  }
@@ -1618,23 +1647,74 @@ var _EventService = class _EventService extends BaseService {
1618
1647
  });
1619
1648
  this.events = sortedEvents;
1620
1649
  this.error = null;
1650
+ if (this.selectedEvent) {
1651
+ const selectedEventId = this.selectedEvent.event_id;
1652
+ const eventStillExists = transformedEvents.some(
1653
+ (e) => e.event_id === selectedEventId
1654
+ );
1655
+ if (!eventStillExists) {
1656
+ const previousUserClearedRef = this.userClearedEventRef;
1657
+ this.selectedEvent = null;
1658
+ this.setSelectedEventId?.(null);
1659
+ this.userClearedEventRef = previousUserClearedRef;
1660
+ logger.debug("EventService", "Cleared selected event - no longer in events list", {
1661
+ previousEventId: selectedEventId,
1662
+ eventsCount: transformedEvents.length
1663
+ });
1664
+ }
1665
+ }
1621
1666
  this.hasAutoSelectedRef = false;
1622
1667
  if (!skipLoadPersisted) {
1623
1668
  const persistedEventLoaded = await this.loadPersistedEvent(transformedEvents);
1669
+ logger.debug("EventService", "Event selection check", {
1670
+ persistedEventLoaded,
1671
+ userClearedEventRef: this.userClearedEventRef,
1672
+ eventsCount: transformedEvents.length,
1673
+ hasSelectedEvent: !!this.selectedEvent
1674
+ });
1624
1675
  if (!persistedEventLoaded && !this.userClearedEventRef) {
1625
1676
  const nextEvent = this.getNextEventByDate(transformedEvents);
1677
+ logger.debug("EventService", "Auto-selection attempt", {
1678
+ nextEventFound: !!nextEvent,
1679
+ nextEventId: nextEvent?.event_id,
1680
+ nextEventDate: nextEvent?.event_date
1681
+ });
1626
1682
  if (nextEvent) {
1627
1683
  this.hasAutoSelectedRef = true;
1628
1684
  this.setSelectedEvent(nextEvent);
1685
+ logger.debug("EventService", "Auto-selected next event", {
1686
+ eventId: nextEvent.event_id,
1687
+ eventName: nextEvent.event_name,
1688
+ eventDate: nextEvent.event_date
1689
+ });
1690
+ } else {
1691
+ logger.debug("EventService", "No next event found for auto-selection", {
1692
+ eventsCount: transformedEvents.length,
1693
+ eventsWithDates: transformedEvents.filter((e) => e.event_date).length
1694
+ });
1629
1695
  }
1696
+ } else if (persistedEventLoaded) {
1697
+ logger.debug("EventService", "Skipped auto-selection - persisted event loaded");
1698
+ } else if (this.userClearedEventRef) {
1699
+ logger.debug("EventService", "Skipped auto-selection - user explicitly cleared event");
1630
1700
  }
1631
1701
  } else {
1632
1702
  if (!this.userClearedEventRef) {
1633
1703
  const nextEvent = this.getNextEventByDate(transformedEvents);
1704
+ logger.debug("EventService", "Auto-selection attempt (skip persisted)", {
1705
+ nextEventFound: !!nextEvent,
1706
+ nextEventId: nextEvent?.event_id
1707
+ });
1634
1708
  if (nextEvent) {
1635
1709
  this.hasAutoSelectedRef = true;
1636
1710
  this.setSelectedEvent(nextEvent);
1711
+ logger.debug("EventService", "Auto-selected next event (skip persisted)", {
1712
+ eventId: nextEvent.event_id,
1713
+ eventName: nextEvent.event_name
1714
+ });
1637
1715
  }
1716
+ } else {
1717
+ logger.debug("EventService", "Skipped auto-selection (skip persisted) - user explicitly cleared event");
1638
1718
  }
1639
1719
  }
1640
1720
  }
@@ -2414,7 +2494,7 @@ function UnifiedAuthContextProvider({
2414
2494
  resolvedUserIdRef.current = currentUserId;
2415
2495
  const userId = currentUserId;
2416
2496
  const appNameValue = appName;
2417
- import("./api-IAGWF3ZG.js").then(async ({ resolveAppContext, setupRBAC: setupRBAC2 }) => {
2497
+ import("./api-6LVZTHDS.js").then(async ({ resolveAppContext, setupRBAC: setupRBAC2 }) => {
2418
2498
  try {
2419
2499
  setupRBAC2(supabase);
2420
2500
  const result = await resolveAppContext({
@@ -2881,4 +2961,4 @@ export {
2881
2961
  useUnifiedAuth,
2882
2962
  UnifiedAuthProvider
2883
2963
  };
2884
- //# sourceMappingURL=chunk-DWUBLJJM.js.map
2964
+ //# sourceMappingURL=chunk-AVMLPIM7.js.map