@jmruthers/pace-core 0.5.21 → 0.5.23
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/{chunk-ULP6OIQE.js → chunk-O2VJ5KRZ.js} +122 -7
- package/dist/chunk-O2VJ5KRZ.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/rbac/index.js +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/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/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/EventContextType.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/EventProviderProps.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.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/RBACContextType.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACProviderProps.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/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/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/package.json +1 -1
- package/src/rbac/components/PagePermissionGuard.tsx +146 -6
- package/dist/chunk-ULP6OIQE.js.map +0 -1
|
@@ -284,6 +284,18 @@ var PagePermissionGuardComponent = ({
|
|
|
284
284
|
loading = /* @__PURE__ */ jsx2(DefaultLoading, {})
|
|
285
285
|
}) => {
|
|
286
286
|
const instanceId = useMemo2(() => Math.random().toString(36).substr(2, 9), []);
|
|
287
|
+
const renderCountRef = useRef(0);
|
|
288
|
+
renderCountRef.current += 1;
|
|
289
|
+
console.log(`[PagePermissionGuard] RENDER #${renderCountRef.current} for ${pageName}:${operation}`, {
|
|
290
|
+
instanceId,
|
|
291
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
292
|
+
});
|
|
293
|
+
useEffect2(() => {
|
|
294
|
+
console.log(`[PagePermissionGuard] MOUNTED: ${pageName}:${operation}`, { instanceId });
|
|
295
|
+
return () => {
|
|
296
|
+
console.log(`[PagePermissionGuard] UNMOUNTED: ${pageName}:${operation}`, { instanceId });
|
|
297
|
+
};
|
|
298
|
+
}, [pageName, operation, instanceId]);
|
|
287
299
|
const { user, selectedOrganisationId, selectedEventId, supabase } = useUnifiedAuth();
|
|
288
300
|
const [hasChecked, setHasChecked] = useState2(false);
|
|
289
301
|
const [checkError, setCheckError] = useState2(null);
|
|
@@ -452,6 +464,16 @@ var PagePermissionGuardComponent = ({
|
|
|
452
464
|
true
|
|
453
465
|
// Use cache
|
|
454
466
|
);
|
|
467
|
+
console.log(`[PagePermissionGuard] useCan result for ${pageName}:${operation}`, {
|
|
468
|
+
instanceId,
|
|
469
|
+
can,
|
|
470
|
+
canIsLoading,
|
|
471
|
+
canError: !!canError,
|
|
472
|
+
userId: user?.id,
|
|
473
|
+
stableScope,
|
|
474
|
+
permission,
|
|
475
|
+
effectivePageId
|
|
476
|
+
});
|
|
455
477
|
const isLoading = !resolvedScope || canIsLoading;
|
|
456
478
|
const error = checkError || canError;
|
|
457
479
|
useEffect2(() => {
|
|
@@ -509,19 +531,110 @@ var PagePermissionGuardComponent = ({
|
|
|
509
531
|
permissionKey
|
|
510
532
|
});
|
|
511
533
|
}, [isLoading, hasChecked, resolvedScope, checkError, can, shouldShowAccessDenied, shouldShowContent, permissionKey, instanceId]);
|
|
534
|
+
const renderDecision = {
|
|
535
|
+
instanceId,
|
|
536
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
537
|
+
renderCount: renderCountRef.current,
|
|
538
|
+
// State values
|
|
539
|
+
isLoading,
|
|
540
|
+
hasValidScope,
|
|
541
|
+
hasValidUser,
|
|
542
|
+
hasChecked,
|
|
543
|
+
checkError: !!checkError,
|
|
544
|
+
can,
|
|
545
|
+
// Calculated values
|
|
546
|
+
shouldShowAccessDenied,
|
|
547
|
+
shouldShowContent,
|
|
548
|
+
// Render conditions
|
|
549
|
+
willShowLoading: isLoading || !hasValidScope || !hasValidUser || !hasChecked,
|
|
550
|
+
willShowError: checkError && !can,
|
|
551
|
+
willShowDenied: shouldShowAccessDenied,
|
|
552
|
+
willShowContent: shouldShowContent,
|
|
553
|
+
// Raw data for debugging
|
|
554
|
+
resolvedScope: resolvedScope ? {
|
|
555
|
+
organisationId: resolvedScope.organisationId,
|
|
556
|
+
eventId: resolvedScope.eventId,
|
|
557
|
+
appId: resolvedScope.appId
|
|
558
|
+
} : null,
|
|
559
|
+
user: user ? { id: user.id, email: user.email } : null
|
|
560
|
+
};
|
|
561
|
+
console.log("[PagePermissionGuard] RENDER DECISION:", renderDecision);
|
|
562
|
+
if (can && !shouldShowContent) {
|
|
563
|
+
console.error("[PagePermissionGuard] CRITICAL BUG DETECTED: Has permission but shouldShowContent is false!", {
|
|
564
|
+
...renderDecision,
|
|
565
|
+
bug: "PERMISSION_GRANTED_BUT_CONTENT_NOT_SHOWING"
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
if (shouldShowContent && !(isLoading || !hasValidScope || !hasValidUser || !hasChecked) && !(checkError && !can) && !shouldShowAccessDenied) {
|
|
569
|
+
console.log("[PagePermissionGuard] SHOULD RENDER CONTENT - This is the correct path!", {
|
|
570
|
+
...renderDecision,
|
|
571
|
+
status: "CONTENT_SHOULD_BE_RENDERED"
|
|
572
|
+
});
|
|
573
|
+
}
|
|
512
574
|
if (isLoading || !hasValidScope || !hasValidUser || !hasChecked) {
|
|
513
|
-
|
|
575
|
+
console.log("[PagePermissionGuard] RENDERING: LOADING STATE");
|
|
576
|
+
return /* @__PURE__ */ jsxs("div", { style: { border: "3px solid orange", padding: "5px", backgroundColor: "lightyellow" }, children: [
|
|
577
|
+
/* @__PURE__ */ jsx2("div", { style: { color: "orange", fontWeight: "bold" }, children: "\u{1F504} LOADING STATE" }),
|
|
578
|
+
loading
|
|
579
|
+
] }, `loading-${permissionKey}`);
|
|
514
580
|
}
|
|
515
581
|
if (checkError && !can) {
|
|
516
|
-
|
|
582
|
+
console.log("[PagePermissionGuard] RENDERING: ERROR STATE");
|
|
583
|
+
return /* @__PURE__ */ jsxs("div", { style: { border: "3px solid red", padding: "5px", backgroundColor: "lightcoral" }, children: [
|
|
584
|
+
/* @__PURE__ */ jsx2("div", { style: { color: "red", fontWeight: "bold" }, children: "\u274C ERROR STATE" }),
|
|
585
|
+
fallback
|
|
586
|
+
] }, `error-${permissionKey}`);
|
|
517
587
|
}
|
|
518
588
|
if (shouldShowAccessDenied) {
|
|
519
|
-
|
|
589
|
+
console.log("[PagePermissionGuard] RENDERING: ACCESS DENIED STATE");
|
|
590
|
+
return /* @__PURE__ */ jsxs("div", { style: { border: "3px solid red", padding: "5px", backgroundColor: "lightcoral" }, children: [
|
|
591
|
+
/* @__PURE__ */ jsx2("div", { style: { color: "red", fontWeight: "bold" }, children: "\u{1F6AB} ACCESS DENIED STATE" }),
|
|
592
|
+
fallback
|
|
593
|
+
] }, `denied-${permissionKey}`);
|
|
520
594
|
}
|
|
521
595
|
if (shouldShowContent) {
|
|
522
|
-
|
|
596
|
+
console.log("[PagePermissionGuard] RENDERING: CONTENT STATE - SHOWING CHILDREN");
|
|
597
|
+
console.log("[PagePermissionGuard] CONTENT RENDER SUCCESS - This should fix the Access Denied issue!");
|
|
598
|
+
const forceRenderContent = /* @__PURE__ */ jsxs(
|
|
599
|
+
"div",
|
|
600
|
+
{
|
|
601
|
+
style: {
|
|
602
|
+
border: "5px solid red",
|
|
603
|
+
padding: "10px",
|
|
604
|
+
margin: "10px",
|
|
605
|
+
backgroundColor: "yellow",
|
|
606
|
+
position: "relative",
|
|
607
|
+
zIndex: 9999
|
|
608
|
+
},
|
|
609
|
+
children: [
|
|
610
|
+
/* @__PURE__ */ jsx2("div", { style: {
|
|
611
|
+
background: "red",
|
|
612
|
+
color: "white",
|
|
613
|
+
padding: "10px",
|
|
614
|
+
fontSize: "16px",
|
|
615
|
+
fontWeight: "bold",
|
|
616
|
+
marginBottom: "10px",
|
|
617
|
+
textAlign: "center"
|
|
618
|
+
}, children: "\u{1F6A8} FORCE RENDER: PagePermissionGuard Content is ACTUALLY RENDERING! \u{1F6A8}" }),
|
|
619
|
+
/* @__PURE__ */ jsx2("div", { style: {
|
|
620
|
+
background: "lightgreen",
|
|
621
|
+
padding: "5px",
|
|
622
|
+
fontSize: "14px",
|
|
623
|
+
marginBottom: "10px",
|
|
624
|
+
border: "2px solid green"
|
|
625
|
+
}, children: "\u2705 This proves the PagePermissionGuard is working correctly!" }),
|
|
626
|
+
/* @__PURE__ */ jsxs("div", { style: { border: "2px solid blue", padding: "5px" }, children: [
|
|
627
|
+
/* @__PURE__ */ jsx2("strong", { children: "Original Children:" }),
|
|
628
|
+
children
|
|
629
|
+
] })
|
|
630
|
+
]
|
|
631
|
+
},
|
|
632
|
+
`content-${permissionKey}`
|
|
633
|
+
);
|
|
634
|
+
console.log("[PagePermissionGuard] RETURNING FORCE RENDER CONTENT");
|
|
635
|
+
return forceRenderContent;
|
|
523
636
|
}
|
|
524
|
-
console.
|
|
637
|
+
console.error("[PagePermissionGuard] CRITICAL: UNEXPECTED STATE - FALLING BACK TO LOADING", {
|
|
525
638
|
instanceId,
|
|
526
639
|
isLoading,
|
|
527
640
|
hasValidScope,
|
|
@@ -530,7 +643,9 @@ var PagePermissionGuardComponent = ({
|
|
|
530
643
|
checkError: !!checkError,
|
|
531
644
|
can,
|
|
532
645
|
shouldShowAccessDenied,
|
|
533
|
-
shouldShowContent
|
|
646
|
+
shouldShowContent,
|
|
647
|
+
resolvedScope,
|
|
648
|
+
user: user ? { id: user.id, email: user.email } : null
|
|
534
649
|
});
|
|
535
650
|
return /* @__PURE__ */ jsx2("div", { children: loading }, `fallback-${permissionKey}`);
|
|
536
651
|
};
|
|
@@ -1974,4 +2089,4 @@ export {
|
|
|
1974
2089
|
getPermissionsForRole,
|
|
1975
2090
|
ALL_PERMISSIONS
|
|
1976
2091
|
};
|
|
1977
|
-
//# sourceMappingURL=chunk-
|
|
2092
|
+
//# sourceMappingURL=chunk-O2VJ5KRZ.js.map
|