@grasp-labs/ds-microfrontends-integration 0.24.2 → 0.24.3

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.
@@ -0,0 +1,31 @@
1
+ import { ReactNode } from 'react';
2
+ export type GroupGuardProps = {
3
+ children: ReactNode;
4
+ requiredGroups: string | string[];
5
+ fallback?: ReactNode;
6
+ };
7
+ /**
8
+ * GroupGuard component that conditionally renders children based on user groups.
9
+ *
10
+ * @param requiredGroups - Single group name or array of group names. If array, user needs all groups.
11
+ * @param fallback - Optional component to render when access is denied
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * // User needs admin group
16
+ * <GroupGuard requiredGroups="admin">
17
+ * <AdminPanel />
18
+ * </GroupGuard>
19
+ *
20
+ * // User needs all of these groups
21
+ * <GroupGuard requiredGroups={['admin', 'moderator']}>
22
+ * <ModeratedContent />
23
+ * </GroupGuard>
24
+ *
25
+ * // With fallback
26
+ * <GroupGuard requiredGroups="admin" fallback={<AccessDenied />}>
27
+ * <AdminPanel />
28
+ * </GroupGuard>
29
+ * ```
30
+ */
31
+ export declare const GroupGuard: ({ children, requiredGroups, fallback, }: GroupGuardProps) => ReactNode;
@@ -55,7 +55,7 @@ export declare const GroupsProvider: ({ children, groups, hasGroup: hasGroupOver
55
55
  * }
56
56
  *
57
57
  * if (hasGroup(['admin', 'moderator'])) {
58
- * // User has at least one of these groups
58
+ * // User has all of these groups
59
59
  * }
60
60
  * ```
61
61
  */
@@ -1,2 +1,2 @@
1
1
  export * from './GroupsProvider';
2
- export * from './RouteGuard';
2
+ export * from './GroupGuard';