@jmruthers/pace-core 0.5.71 → 0.5.73

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 (149) hide show
  1. package/dist/{DataTable-V3RFYBBB.js → DataTable-INW5YIFV.js} +7 -5
  2. package/dist/UnifiedAuthProvider-6SYT5WFN.js +14 -0
  3. package/dist/UnifiedAuthProvider-6SYT5WFN.js.map +1 -0
  4. package/dist/{chunk-67FGPOHX.js → chunk-2PRPDH66.js} +6 -4
  5. package/dist/{chunk-67FGPOHX.js.map → chunk-2PRPDH66.js.map} +1 -1
  6. package/dist/chunk-3SP4P7NS.js +82 -0
  7. package/dist/chunk-3SP4P7NS.js.map +1 -0
  8. package/dist/{chunk-BUM2ZPYC.js → chunk-43C63KLH.js} +4 -4
  9. package/dist/{chunk-VLFIYM6B.js → chunk-5A4RL4BC.js} +72 -67
  10. package/dist/chunk-5A4RL4BC.js.map +1 -0
  11. package/dist/{chunk-2NWIXRSB.js → chunk-BYG6OSTC.js} +97 -48
  12. package/dist/chunk-BYG6OSTC.js.map +1 -0
  13. package/dist/{chunk-6RBH67W7.js → chunk-CDDYJCYU.js} +2 -77
  14. package/dist/chunk-CDDYJCYU.js.map +1 -0
  15. package/dist/{chunk-XC4ZCSO4.js → chunk-F24P24TZ.js} +6 -4
  16. package/dist/{chunk-XC4ZCSO4.js.map → chunk-F24P24TZ.js.map} +1 -1
  17. package/dist/{chunk-4CET7YQI.js → chunk-GBC5PC3N.js} +9 -945
  18. package/dist/chunk-GBC5PC3N.js.map +1 -0
  19. package/dist/{chunk-GDIBOLKV.js → chunk-LANO5IFV.js} +6 -4
  20. package/dist/{chunk-GDIBOLKV.js.map → chunk-LANO5IFV.js.map} +1 -1
  21. package/dist/{chunk-C353TCFY.js → chunk-M4UMXYNK.js} +2 -2
  22. package/dist/chunk-RJNE764D.js +953 -0
  23. package/dist/chunk-RJNE764D.js.map +1 -0
  24. package/dist/{chunk-MTI7X73I.js → chunk-UC2BWIK7.js} +7 -5
  25. package/dist/{chunk-MTI7X73I.js.map → chunk-UC2BWIK7.js.map} +1 -1
  26. package/dist/components.js +9 -7
  27. package/dist/components.js.map +1 -1
  28. package/dist/hooks.js +7 -5
  29. package/dist/hooks.js.map +1 -1
  30. package/dist/index.js +19 -16
  31. package/dist/index.js.map +1 -1
  32. package/dist/providers.js +10 -7
  33. package/dist/rbac/index.js +7 -5
  34. package/dist/utils.js +8 -6
  35. package/dist/utils.js.map +1 -1
  36. package/docs/api/classes/ColumnFactory.md +1 -1
  37. package/docs/api/classes/ErrorBoundary.md +1 -1
  38. package/docs/api/classes/InvalidScopeError.md +1 -1
  39. package/docs/api/classes/MissingUserContextError.md +1 -1
  40. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  41. package/docs/api/classes/PermissionDeniedError.md +1 -1
  42. package/docs/api/classes/PublicErrorBoundary.md +1 -1
  43. package/docs/api/classes/RBACAuditManager.md +1 -1
  44. package/docs/api/classes/RBACCache.md +1 -1
  45. package/docs/api/classes/RBACEngine.md +1 -1
  46. package/docs/api/classes/RBACError.md +1 -1
  47. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  48. package/docs/api/classes/SecureSupabaseClient.md +1 -1
  49. package/docs/api/classes/StorageUtils.md +1 -1
  50. package/docs/api/enums/FileCategory.md +1 -1
  51. package/docs/api/interfaces/AggregateConfig.md +1 -1
  52. package/docs/api/interfaces/ButtonProps.md +1 -1
  53. package/docs/api/interfaces/CardProps.md +1 -1
  54. package/docs/api/interfaces/ColorPalette.md +1 -1
  55. package/docs/api/interfaces/ColorShade.md +1 -1
  56. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  57. package/docs/api/interfaces/DataTableAction.md +1 -1
  58. package/docs/api/interfaces/DataTableColumn.md +1 -1
  59. package/docs/api/interfaces/DataTableProps.md +1 -1
  60. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  61. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  62. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  63. package/docs/api/interfaces/EventContextType.md +1 -1
  64. package/docs/api/interfaces/EventLogoProps.md +1 -1
  65. package/docs/api/interfaces/EventProviderProps.md +1 -1
  66. package/docs/api/interfaces/FileDisplayProps.md +1 -1
  67. package/docs/api/interfaces/FileMetadata.md +1 -1
  68. package/docs/api/interfaces/FileReference.md +1 -1
  69. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  70. package/docs/api/interfaces/FileUploadOptions.md +1 -1
  71. package/docs/api/interfaces/FileUploadProps.md +1 -1
  72. package/docs/api/interfaces/FooterProps.md +1 -1
  73. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  74. package/docs/api/interfaces/InputProps.md +1 -1
  75. package/docs/api/interfaces/LabelProps.md +1 -1
  76. package/docs/api/interfaces/LoginFormProps.md +1 -1
  77. package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
  78. package/docs/api/interfaces/NavigationContextType.md +1 -1
  79. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  80. package/docs/api/interfaces/NavigationItem.md +1 -1
  81. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  82. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  83. package/docs/api/interfaces/Organisation.md +1 -1
  84. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  85. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  86. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  87. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  88. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  89. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  90. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  91. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  92. package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
  93. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  94. package/docs/api/interfaces/PaletteData.md +1 -1
  95. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  96. package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
  97. package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
  98. package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
  99. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  100. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  101. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  102. package/docs/api/interfaces/RBACConfig.md +1 -1
  103. package/docs/api/interfaces/RBACContextType.md +1 -1
  104. package/docs/api/interfaces/RBACLogger.md +1 -1
  105. package/docs/api/interfaces/RBACProviderProps.md +1 -1
  106. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  107. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  108. package/docs/api/interfaces/RouteAccessRecord.md +1 -1
  109. package/docs/api/interfaces/RouteConfig.md +1 -1
  110. package/docs/api/interfaces/SecureDataContextType.md +1 -1
  111. package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
  112. package/docs/api/interfaces/StorageConfig.md +1 -1
  113. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  114. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  115. package/docs/api/interfaces/StorageListOptions.md +1 -1
  116. package/docs/api/interfaces/StorageListResult.md +1 -1
  117. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  118. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  119. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  120. package/docs/api/interfaces/StyleImport.md +1 -1
  121. package/docs/api/interfaces/SwitchProps.md +1 -1
  122. package/docs/api/interfaces/ToastActionElement.md +1 -1
  123. package/docs/api/interfaces/ToastProps.md +1 -1
  124. package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
  125. package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
  126. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  127. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  128. package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
  129. package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
  130. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  131. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  132. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  133. package/docs/api/interfaces/UserEventAccess.md +1 -1
  134. package/docs/api/interfaces/UserMenuProps.md +1 -1
  135. package/docs/api/interfaces/UserProfile.md +1 -1
  136. package/docs/api/modules.md +2 -2
  137. package/docs/implementation-guides/data-tables.md +191 -0
  138. package/package.json +1 -1
  139. package/src/components/DataTable/components/DataTableBody.tsx +38 -27
  140. package/src/components/DataTable/components/UnifiedTableBody.tsx +72 -64
  141. package/src/components/NavigationMenu/NavigationMenu.tsx +32 -2
  142. package/src/components/PaceAppLayout/PaceAppLayout.tsx +81 -46
  143. package/dist/chunk-2NWIXRSB.js.map +0 -1
  144. package/dist/chunk-4CET7YQI.js.map +0 -1
  145. package/dist/chunk-6RBH67W7.js.map +0 -1
  146. package/dist/chunk-VLFIYM6B.js.map +0 -1
  147. /package/dist/{DataTable-V3RFYBBB.js.map → DataTable-INW5YIFV.js.map} +0 -0
  148. /package/dist/{chunk-BUM2ZPYC.js.map → chunk-43C63KLH.js.map} +0 -0
  149. /package/dist/{chunk-C353TCFY.js.map → chunk-M4UMXYNK.js.map} +0 -0
@@ -15,7 +15,7 @@ import {
15
15
  SelectSeparator,
16
16
  SelectTrigger,
17
17
  SelectValue
18
- } from "./chunk-VLFIYM6B.js";
18
+ } from "./chunk-5A4RL4BC.js";
19
19
  import {
20
20
  isPermitted
21
21
  } from "./chunk-FGMFQSHX.js";
@@ -25,7 +25,15 @@ import {
25
25
  usePublicEventLogo,
26
26
  usePublicPageContext,
27
27
  useToast
28
- } from "./chunk-C353TCFY.js";
28
+ } from "./chunk-M4UMXYNK.js";
29
+ import {
30
+ EventProvider_exports,
31
+ OrganisationProvider_exports,
32
+ init_EventProvider,
33
+ init_OrganisationProvider,
34
+ useEvents,
35
+ useOrganisations
36
+ } from "./chunk-RJNE764D.js";
29
37
  import {
30
38
  Button,
31
39
  Dialog,
@@ -34,17 +42,11 @@ import {
34
42
  DialogOverlay,
35
43
  DialogTitle,
36
44
  DialogTrigger,
37
- EventProvider_exports,
38
- OrganisationProvider_exports,
39
45
  UnifiedAuthProvider_exports,
40
46
  init_Button,
41
- init_EventProvider,
42
- init_OrganisationProvider,
43
47
  init_UnifiedAuthProvider,
44
- useEvents,
45
- useOrganisations,
46
48
  useUnifiedAuth
47
- } from "./chunk-4CET7YQI.js";
49
+ } from "./chunk-GBC5PC3N.js";
48
50
  import {
49
51
  LoadingSpinner
50
52
  } from "./chunk-CDQ3PX7L.js";
@@ -54,7 +56,7 @@ import {
54
56
  import {
55
57
  cn,
56
58
  init_cn
57
- } from "./chunk-6RBH67W7.js";
59
+ } from "./chunk-CDDYJCYU.js";
58
60
  import {
59
61
  __require,
60
62
  __toCommonJS
@@ -930,7 +932,30 @@ var NavigationMenu = React9.forwardRef(({
930
932
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
931
933
  });
932
934
  }
933
- const hasPermission = true;
935
+ if (!authContext) {
936
+ if (onNavigate) {
937
+ onNavigate(item);
938
+ } else if (item.href) {
939
+ window.location.href = item.href;
940
+ }
941
+ return;
942
+ }
943
+ const isItemVisible = filteredItems.some((filtered) => filtered.id === item.id);
944
+ let hasPermission = true;
945
+ if (item.permissions && item.permissions.length > 0) {
946
+ hasPermission = item.permissions.some((permission) => {
947
+ if (typeof permission !== "string") return true;
948
+ return authContext.hasPermission(permission);
949
+ });
950
+ }
951
+ if (!hasPermission) {
952
+ if (item.roles && item.roles.length > 0) {
953
+ hasPermission = item.roles.some((role) => {
954
+ if (typeof role !== "string") return true;
955
+ return authContext.hasRole(role);
956
+ });
957
+ }
958
+ }
934
959
  if (!hasPermission) {
935
960
  if (onNavigationAccessDenied) {
936
961
  onNavigationAccessDenied(item.id, "Insufficient permissions");
@@ -1330,53 +1355,77 @@ function PaceAppLayout({
1330
1355
  }, [baseMenuItems, filterNavigationByPermissions, enforcePermissions, pageIdMapping, routePermissions, defaultPermission]);
1331
1356
  useEffect3(() => {
1332
1357
  if (!roleBasedRouting || routeConfig.length === 0) return;
1333
- const currentPath = location.pathname;
1334
- const currentRoute = routeConfig.find((route) => route.path === currentPath);
1335
- if (!currentRoute) {
1336
- if (strictMode) {
1337
- console.error(`[PaceAppLayout] STRICT MODE VIOLATION: Route not found in configuration`, {
1338
- route: currentPath,
1339
- userId: user?.id,
1340
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
1341
- });
1342
- if (onRouteStrictModeViolation) {
1343
- onRouteStrictModeViolation(currentPath, "Route not found in configuration");
1358
+ let isMounted = true;
1359
+ const checkRouteAccess = async () => {
1360
+ const currentPath = location.pathname;
1361
+ const currentRoute = routeConfig.find((route) => route.path === currentPath);
1362
+ if (!currentRoute) {
1363
+ if (strictMode) {
1364
+ console.error(`[PaceAppLayout] STRICT MODE VIOLATION: Route not found in configuration`, {
1365
+ route: currentPath,
1366
+ userId: user?.id,
1367
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1368
+ });
1369
+ if (onRouteStrictModeViolation) {
1370
+ onRouteStrictModeViolation(currentPath, "Route not found in configuration");
1371
+ }
1344
1372
  }
1373
+ return;
1345
1374
  }
1346
- return;
1347
- }
1348
- const hasAccess = true;
1349
- if (!hasAccess) {
1350
- if (onRouteAccessDenied) {
1351
- onRouteAccessDenied(currentPath, "Insufficient permissions");
1375
+ let hasAccess = true;
1376
+ if (currentRoute.pageId && currentRoute.permissions && currentRoute.permissions.length > 0) {
1377
+ try {
1378
+ const hasPagePermission = await checkPermission(currentRoute.permissions[0], currentRoute.pageId);
1379
+ if (!isMounted) return;
1380
+ hasAccess = hasPagePermission;
1381
+ } catch (error) {
1382
+ console.error("[PaceAppLayout] Failed to check page permission:", error);
1383
+ if (!isMounted) return;
1384
+ hasAccess = false;
1385
+ }
1352
1386
  }
1353
- if (strictMode) {
1354
- console.error(`[PaceAppLayout] STRICT MODE VIOLATION: User attempted to access protected route without permission`, {
1387
+ if (hasAccess && currentRoute.roles && currentRoute.roles.length > 0 && user?.id) {
1388
+ const { useUnifiedAuth: useUnifiedAuth2 } = await import("./UnifiedAuthProvider-6SYT5WFN.js");
1389
+ hasAccess = true;
1390
+ }
1391
+ if (!isMounted) return;
1392
+ if (!hasAccess) {
1393
+ if (onRouteAccessDenied) {
1394
+ onRouteAccessDenied(currentPath, "Insufficient permissions");
1395
+ }
1396
+ if (strictMode) {
1397
+ console.error(`[PaceAppLayout] STRICT MODE VIOLATION: User attempted to access protected route without permission`, {
1398
+ route: currentPath,
1399
+ userId: user?.id,
1400
+ permissions: currentRoute.permissions,
1401
+ roles: currentRoute.roles,
1402
+ accessLevel: currentRoute.accessLevel,
1403
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1404
+ });
1405
+ if (onRouteStrictModeViolation) {
1406
+ onRouteStrictModeViolation(currentPath, "Insufficient permissions");
1407
+ }
1408
+ }
1409
+ navigate(fallbackRoute, { replace: true });
1410
+ return;
1411
+ }
1412
+ if (auditLog) {
1413
+ console.log(`[PaceAppLayout] Route access attempt:`, {
1355
1414
  route: currentPath,
1356
1415
  userId: user?.id,
1416
+ allowed: hasAccess,
1357
1417
  permissions: currentRoute.permissions,
1358
1418
  roles: currentRoute.roles,
1359
1419
  accessLevel: currentRoute.accessLevel,
1360
1420
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
1361
1421
  });
1362
- if (onRouteStrictModeViolation) {
1363
- onRouteStrictModeViolation(currentPath, "Insufficient permissions");
1364
- }
1365
1422
  }
1366
- navigate(fallbackRoute, { replace: true });
1367
- }
1368
- if (auditLog) {
1369
- console.log(`[PaceAppLayout] Route access attempt:`, {
1370
- route: currentPath,
1371
- userId: user?.id,
1372
- allowed: hasAccess,
1373
- permissions: currentRoute.permissions,
1374
- roles: currentRoute.roles,
1375
- accessLevel: currentRoute.accessLevel,
1376
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
1377
- });
1378
- }
1379
- }, [roleBasedRouting, routeConfig, location.pathname, strictMode, user?.id, fallbackRoute]);
1423
+ };
1424
+ checkRouteAccess();
1425
+ return () => {
1426
+ isMounted = false;
1427
+ };
1428
+ }, [roleBasedRouting, routeConfig, location.pathname, strictMode, user?.id, fallbackRoute, checkPermission, navigate, auditLog, onRouteAccessDenied, onRouteStrictModeViolation]);
1380
1429
  const handleSignOut = async () => {
1381
1430
  await signOut();
1382
1431
  };
@@ -3753,4 +3802,4 @@ export {
3753
3802
  PublicPageDiagnostic,
3754
3803
  PublicPageContextChecker
3755
3804
  };
3756
- //# sourceMappingURL=chunk-2NWIXRSB.js.map
3805
+ //# sourceMappingURL=chunk-BYG6OSTC.js.map