@burdenoff/microfe-auth 2026.718.4 → 2026.725.1

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 (79) hide show
  1. package/dist/auth/AuthRoot.d.ts +29 -0
  2. package/dist/auth/AuthRoutes.d.ts +27 -0
  3. package/dist/auth/components/AuthIcons.d.ts +16 -0
  4. package/dist/auth/components/AuthLayout.d.ts +16 -0
  5. package/dist/auth/components/CaptchaV2.d.ts +25 -0
  6. package/dist/auth/components/ConfirmActionDialog.d.ts +15 -0
  7. package/dist/auth/components/index.d.ts +3 -0
  8. package/dist/auth/components/profile/UserProfileMenu.d.ts +41 -0
  9. package/dist/auth/components/workspace/WorkspaceSelector.d.ts +49 -0
  10. package/dist/auth/constants/permissions.d.ts +29 -0
  11. package/dist/auth/constants/sessionKeys.d.ts +17 -0
  12. package/dist/auth/hooks/index.d.ts +19 -0
  13. package/dist/auth/hooks/useAccountOperations.d.ts +18 -0
  14. package/dist/auth/hooks/useActiveContextBootstrapMirror.d.ts +91 -0
  15. package/dist/auth/hooks/useApiKeyOperations.d.ts +28 -0
  16. package/dist/auth/hooks/useAppOperations.d.ts +32 -0
  17. package/dist/auth/hooks/useAuthOperations.d.ts +59 -0
  18. package/dist/auth/hooks/useAuthPermissions.d.ts +19 -0
  19. package/dist/auth/hooks/useCaptchaV3.d.ts +12 -0
  20. package/dist/auth/hooks/useContextSwitcherData.d.ts +91 -0
  21. package/dist/auth/hooks/useDelegationOperations.d.ts +38 -0
  22. package/dist/auth/hooks/useMfaOperations.d.ts +17 -0
  23. package/dist/auth/hooks/useMyWorkspaces.d.ts +47 -0
  24. package/dist/auth/hooks/useOAuthOperations.d.ts +18 -0
  25. package/dist/auth/hooks/usePasswordOperations.d.ts +12 -0
  26. package/dist/auth/hooks/useSessionOperations.d.ts +57 -0
  27. package/dist/auth/hooks/useSignupCaptcha.d.ts +22 -0
  28. package/dist/auth/hooks/useSsoOperations.d.ts +67 -0
  29. package/dist/auth/hooks/useTokenRefresh.d.ts +55 -0
  30. package/dist/auth/hooks/useUserOperations.d.ts +32 -0
  31. package/dist/auth/hooks/useWorkspaceOperations.d.ts +34 -0
  32. package/dist/auth/hooks/useWorkspaceToken.d.ts +55 -0
  33. package/dist/auth/index.d.ts +63 -0
  34. package/dist/auth/pages/AuditLogPage.d.ts +11 -0
  35. package/dist/auth/pages/EmailVerifyPage.d.ts +4 -0
  36. package/dist/auth/pages/LoginPage.d.ts +5 -0
  37. package/dist/auth/pages/MagicLinkPage.d.ts +5 -0
  38. package/dist/auth/pages/MfaSetupPage.d.ts +4 -0
  39. package/dist/auth/pages/MfaVerifyPage.d.ts +6 -0
  40. package/dist/auth/pages/OAuthCallbackPage.d.ts +6 -0
  41. package/dist/auth/pages/PasswordResetPage.d.ts +5 -0
  42. package/dist/auth/pages/ReactivatePage.d.ts +5 -0
  43. package/dist/auth/pages/RegisterPage.d.ts +4 -0
  44. package/dist/auth/pages/SSOClearPage.d.ts +21 -0
  45. package/dist/auth/pages/SSODepositPage.d.ts +23 -0
  46. package/dist/auth/pages/SSORelayCallbackPage.d.ts +7 -0
  47. package/dist/auth/pages/SSORelayPage.d.ts +17 -0
  48. package/dist/auth/pages/SecurityPage.d.ts +6 -0
  49. package/dist/auth/pages/SessionBridgePage.d.ts +13 -0
  50. package/dist/auth/pages/SessionsPage.d.ts +7 -0
  51. package/dist/auth/pages/SsoCallbackPage.d.ts +7 -0
  52. package/dist/auth/pages/SsoConfigPage.d.ts +12 -0
  53. package/dist/auth/pages/SsoLoginPage.d.ts +6 -0
  54. package/dist/auth/pages/UserDetailsPage.d.ts +10 -0
  55. package/dist/auth/pages/UserDetailsPage.js.map +1 -1
  56. package/dist/auth/pages/UserProfilePage.d.ts +4 -0
  57. package/dist/auth/pages/UsersPage.d.ts +4 -0
  58. package/dist/auth/providers/AuthProvider.d.ts +17 -0
  59. package/dist/auth/providers/CaptchaProvider.d.ts +12 -0
  60. package/dist/auth/store/authStore.d.ts +110 -0
  61. package/dist/auth/types/index.d.ts +678 -0
  62. package/dist/auth/utils/captchaConfig.d.ts +3 -0
  63. package/dist/auth/utils/formatters.d.ts +36 -0
  64. package/dist/auth/utils/gatewayBaseUrls.d.ts +5 -0
  65. package/dist/auth/utils/index.d.ts +2 -0
  66. package/dist/auth/utils/ssoOrigins.d.ts +28 -0
  67. package/dist/auth/utils/validation.d.ts +29 -0
  68. package/dist/dev/main.d.ts +1 -0
  69. package/dist/generated/global-operations.d.ts +3095 -0
  70. package/dist/generated/global-types.d.ts +23528 -0
  71. package/dist/generated/wspace-operations.d.ts +123 -0
  72. package/dist/generated/wspace-types.d.ts +57850 -0
  73. package/dist/index.d.ts +3 -0
  74. package/dist/shared/hooks/index.d.ts +6 -0
  75. package/dist/shared/index.d.ts +5 -0
  76. package/dist/shared/types/index.d.ts +108 -0
  77. package/dist/translations/en.d.ts +320 -0
  78. package/dist/utils/nativeBridge.d.ts +2 -0
  79. package/package.json +4 -2
@@ -0,0 +1,29 @@
1
+ import { FC } from 'react';
2
+ import { AuthRootProps } from './types';
3
+
4
+ /**
5
+ * Root component for the Auth microfrontend.
6
+ *
7
+ * This is the main entry point that host applications import and render.
8
+ * It sets up the necessary providers and renders the internal routing.
9
+ * Automatically registers navigation items with the shell if registration functions are provided.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * import { AuthRoot, type AuthRootProps } from '@burdenoff/microfe-auth';
14
+ *
15
+ * function App() {
16
+ * const props: AuthRootProps = {
17
+ * basePath: '/auth',
18
+ * navigate: (path) => router.push(path),
19
+ * apiGatewayUrl: 'http://localhost:4002',
20
+ * authToken: 'token',
21
+ * onAuthSuccess: (user) => shellLogin(user),
22
+ * onLogout: () => shellLogout(),
23
+ * };
24
+ *
25
+ * return <AuthRoot {...props} />;
26
+ * }
27
+ * ```
28
+ */
29
+ export declare const AuthRoot: FC<AuthRootProps>;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Internal router for the Auth microfrontend.
3
+ * This component handles routing within the microfrontend using React Router v7.
4
+ *
5
+ * When used within a parent route (e.g., <Route path="/auth/*">), all paths are relative:
6
+ * - login → Login page (accessible at /auth/login)
7
+ * - register → Registration page (accessible at /auth/register)
8
+ * - reset-password → Password reset page (accessible at /auth/reset-password)
9
+ * - verify-email → Email verification page (accessible at /auth/verify-email)
10
+ * - mfa-verify → MFA verification page (accessible at /auth/mfa-verify)
11
+ * - magic-link → Magic link authentication page (accessible at /auth/magic-link)
12
+ * - sso/login → SSO login page (accessible at /auth/sso/login)
13
+ * - sso/callback → SSO callback handler (accessible at /auth/sso/callback)
14
+ * - oauth/callback → OAuth callback handler (accessible at /auth/oauth/callback)
15
+ * - security → Security settings (protected, accessible at /auth/security)
16
+ * - sessions → Active sessions (protected, accessible at /auth/sessions)
17
+ * - mfa → MFA setup (protected, accessible at /auth/mfa)
18
+ * - users → Users management (protected, admin only, accessible at /auth/users)
19
+ * - profile → User profile page (protected, accessible at /auth/profile)
20
+ * - audit-log → Security audit log (protected, accessible at /auth/audit-log)
21
+ * - sso → SSO configuration (protected, admin only, accessible at /auth/sso)
22
+ */
23
+ export declare function AuthRoutes({ basePath: _basePath, enableAdminRoutes, bypassEnterprisePlanGate, }: {
24
+ basePath?: string;
25
+ enableAdminRoutes?: boolean;
26
+ bypassEnterprisePlanGate?: boolean;
27
+ }): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { SVGProps } from 'react';
2
+
3
+ type IconProps = SVGProps<SVGSVGElement>;
4
+ export declare function EmailIcon(props: IconProps): import("react").JSX.Element;
5
+ export declare function LockIcon(props: IconProps): import("react").JSX.Element;
6
+ export declare function UserIcon(props: IconProps): import("react").JSX.Element;
7
+ export declare function EyeIcon(props: IconProps): import("react").JSX.Element;
8
+ export declare function EyeOffIcon(props: IconProps): import("react").JSX.Element;
9
+ export declare function CheckIcon(props: IconProps): import("react").JSX.Element;
10
+ export declare function XIcon(props: IconProps): import("react").JSX.Element;
11
+ export declare function AlertIcon(props: IconProps): import("react").JSX.Element;
12
+ export declare function SpinnerIcon(props: IconProps): import("react").JSX.Element;
13
+ export declare function GoogleIcon(props: IconProps): import("react").JSX.Element;
14
+ export declare function GitHubIcon(props: IconProps): import("react").JSX.Element;
15
+ export declare function MicrosoftIcon(props: IconProps): import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ interface AuthLayoutProps {
4
+ children: ReactNode;
5
+ title: string;
6
+ subtitle: string;
7
+ productName?: string;
8
+ tagline?: string;
9
+ }
10
+ /**
11
+ * Professional auth layout with split-screen design
12
+ * Left side: Branding with gradient background
13
+ * Right side: Auth form
14
+ */
15
+ export declare function AuthLayout({ children, title, subtitle, productName, tagline, }: AuthLayoutProps): import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,25 @@
1
+ interface CaptchaV2Props {
2
+ onVerify: (token: string | null) => void;
3
+ onExpired?: () => void;
4
+ /**
5
+ * Host-driven enable flag. When provided it takes precedence over the
6
+ * build-time env switch (used so a per-product site key can turn the widget
7
+ * on/off without rebuilding). When omitted, falls back to env.
8
+ */
9
+ enabled?: boolean;
10
+ /**
11
+ * reCAPTCHA v2 site key to render with. Overrides the build-time env key.
12
+ * Resolved per-product by the caller (see `useSignupCaptcha`).
13
+ */
14
+ siteKey?: string;
15
+ }
16
+ /**
17
+ * reCAPTCHA v2 checkbox component.
18
+ *
19
+ * Enablement is host-driven via the `enabled` prop (resolved per-product from
20
+ * the platform catalog). When `enabled` is omitted it falls back to the
21
+ * build-time `VITE_CAPTCHA_ENABLED` env for local source-dev. Renders nothing
22
+ * when disabled and lazily loads the Google reCAPTCHA library only when enabled.
23
+ */
24
+ export declare function CaptchaV2({ onVerify, onExpired, enabled, siteKey, }: CaptchaV2Props): import("react").JSX.Element | null;
25
+ export {};
@@ -0,0 +1,15 @@
1
+ type ConfirmActionDialogVariant = "default" | "warning" | "danger";
2
+ interface ConfirmActionDialogProps {
3
+ open: boolean;
4
+ onOpenChange: (open: boolean) => void;
5
+ title: string;
6
+ description: string;
7
+ confirmText?: string;
8
+ cancelText?: string;
9
+ variant?: ConfirmActionDialogVariant;
10
+ isPending?: boolean;
11
+ disabled?: boolean;
12
+ onConfirm: () => void | Promise<void>;
13
+ }
14
+ export declare function ConfirmActionDialog({ open, onOpenChange, title, description, confirmText, cancelText, variant, isPending, disabled, onConfirm, }: ConfirmActionDialogProps): import("react").JSX.Element;
15
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './AuthLayout';
2
+ export * from './AuthIcons';
3
+ export * from './ConfirmActionDialog';
@@ -0,0 +1,41 @@
1
+ export interface UserProfileMenuProps {
2
+ /**
3
+ * Callback when workspace switcher should be shown
4
+ */
5
+ onSwitchWorkspace?: () => void;
6
+ /**
7
+ * Logout handler (REQUIRED)
8
+ * Should clear auth state and redirect to login
9
+ */
10
+ onLogout: () => void;
11
+ /**
12
+ * Position of the dropdown menu
13
+ * @default 'right'
14
+ */
15
+ position?: "left" | "right";
16
+ }
17
+ /**
18
+ * User Profile Menu Component
19
+ *
20
+ * Displays user avatar/icon with dropdown menu containing:
21
+ * - User information
22
+ * - Switch Workspace option
23
+ * - Logout button
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * import { UserProfileMenu } from '@burdenoff/microfe-auth';
28
+ *
29
+ * function AppHeader() {
30
+ * return (
31
+ * <div className="header">
32
+ * <UserProfileMenu
33
+ * onSwitchWorkspace={() => setShowWorkspaceSwitcher(true)}
34
+ * position="right"
35
+ * />
36
+ * </div>
37
+ * );
38
+ * }
39
+ * ```
40
+ */
41
+ export declare function UserProfileMenu({ onSwitchWorkspace, onLogout, position, }: UserProfileMenuProps): import("react").JSX.Element | null;
@@ -0,0 +1,49 @@
1
+ import { Workspace } from '../../types';
2
+
3
+ /**
4
+ * Organization interface (grouped from workspaces)
5
+ */
6
+ export interface Organization {
7
+ id: string;
8
+ name: string;
9
+ workspaceCount: number;
10
+ }
11
+ /**
12
+ * Project interface (optional, for future use)
13
+ */
14
+ export interface Project {
15
+ id: string;
16
+ name: string;
17
+ workspaceId: string;
18
+ }
19
+ export interface WorkspaceSelectorProps {
20
+ /**
21
+ * Control modal visibility
22
+ */
23
+ isOpen: boolean;
24
+ /**
25
+ * Callback when modal is closed without selection
26
+ */
27
+ onClose: () => void;
28
+ /**
29
+ * List of workspaces to choose from
30
+ */
31
+ workspaces: Workspace[];
32
+ /**
33
+ * Optional list of projects (filtered by workspace)
34
+ */
35
+ projects?: Project[];
36
+ /**
37
+ * Callback when workspace is selected and confirmed
38
+ */
39
+ onSelect: (workspace: Workspace, project?: Project) => void;
40
+ /**
41
+ * Loading state while issuing workspace token
42
+ */
43
+ isLoading?: boolean;
44
+ /**
45
+ * Error message to display
46
+ */
47
+ error?: string | null;
48
+ }
49
+ export declare function WorkspaceSelector({ isOpen, onClose, workspaces, projects, onSelect, isLoading, error, }: WorkspaceSelectorProps): import("react").JSX.Element | null;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Auth Permission Constants
3
+ *
4
+ * Permission strings matching the @rbac directives on global-auth-svc.
5
+ * Only covers admin-facing operations — public auth flows (login, signup,
6
+ * password reset, MFA verify, OAuth, SSO) don't need RBAC.
7
+ * Self-service operations (own profile, sessions, API keys) are identity-scoped.
8
+ *
9
+ * Resource types and actions from global-rbac-svc seed:
10
+ * user: read, update, delete
11
+ * app: read, create, update
12
+ * sso-config: manage, delete
13
+ * oidc-config: manage, delete
14
+ * auth-method: update
15
+ */
16
+ export declare const AUTH_PERMISSIONS: {
17
+ readonly USER_READ: "user:read";
18
+ readonly USER_UPDATE: "user:update";
19
+ readonly USER_DELETE: "user:delete";
20
+ readonly APP_READ: "app:read";
21
+ readonly APP_CREATE: "app:create";
22
+ readonly APP_UPDATE: "app:update";
23
+ readonly SSO_CONFIG_MANAGE: "sso-config:manage";
24
+ readonly SSO_CONFIG_DELETE: "sso-config:delete";
25
+ readonly OIDC_CONFIG_MANAGE: "oidc-config:manage";
26
+ readonly OIDC_CONFIG_DELETE: "oidc-config:delete";
27
+ readonly AUTH_METHOD_UPDATE: "auth-method:update";
28
+ };
29
+ export type AuthPermission = (typeof AUTH_PERMISSIONS)[keyof typeof AUTH_PERMISSIONS];
@@ -0,0 +1,17 @@
1
+ /**
2
+ * sessionStorage key constants for auth flows.
3
+ * Centralizing these avoids silent key mismatches across files.
4
+ */
5
+ export declare const MFA_CHALLENGE_ID = "mfa_challenge_id";
6
+ export declare const MFA_PENDING_TOKEN = "mfa_pending_token";
7
+ export declare const MFA_PENDING_REFRESH = "mfa_pending_refresh";
8
+ export declare const MFA_REDIRECT = "mfa_redirect";
9
+ export declare const OIDC_CODE_VERIFIER = "oidc_code_verifier";
10
+ export declare const OIDC_STATE = "oidc_state";
11
+ export declare const OIDC_NONCE = "oidc_nonce";
12
+ export declare const OIDC_TENANT_ID = "oidc_tenant_id";
13
+ export declare const OIDC_FLOW = "oidc_flow";
14
+ export declare const OIDC_REDIRECT = "oidc_redirect";
15
+ export declare const OIDC_CLIENT_ID = "oidc_client_id";
16
+ export declare const MFA_SESSION_KEYS: readonly ["mfa_challenge_id", "mfa_pending_token", "mfa_pending_refresh", "mfa_redirect"];
17
+ export declare const OIDC_SESSION_KEYS: readonly ["oidc_code_verifier", "oidc_state", "oidc_nonce", "oidc_tenant_id", "oidc_flow", "oidc_redirect"];
@@ -0,0 +1,19 @@
1
+ export { useAuthOperations } from './useAuthOperations';
2
+ export { useMfaOperations } from './useMfaOperations';
3
+ export { usePasswordOperations } from './usePasswordOperations';
4
+ export { useSessionOperations } from './useSessionOperations';
5
+ export { useApiKeyOperations } from './useApiKeyOperations';
6
+ export { useAppOperations } from './useAppOperations';
7
+ export { useWorkspaceOperations } from './useWorkspaceOperations';
8
+ export { useMyWorkspaces } from './useMyWorkspaces';
9
+ export { useContextSwitcherData, useWorkspaceSyncEffect, useProjectSyncEffect, } from './useContextSwitcherData';
10
+ export type { UseContextSwitcherDataOptions } from './useContextSwitcherData';
11
+ export { useActiveContextBootstrapMirror } from './useActiveContextBootstrapMirror';
12
+ export type { ActiveContextBootstrapMirrorArgs } from './useActiveContextBootstrapMirror';
13
+ export { useDelegationOperations } from './useDelegationOperations';
14
+ export { useUserOperations } from './useUserOperations';
15
+ export { useSsoOperations } from './useSsoOperations';
16
+ export { useOAuthOperations } from './useOAuthOperations';
17
+ export { useAccountOperations } from './useAccountOperations';
18
+ export { useAuthPermissions } from './useAuthPermissions';
19
+ export { useAuthStore } from '../store/authStore';
@@ -0,0 +1,18 @@
1
+ import { AuthResult } from '../types';
2
+
3
+ export interface AccountActionResult {
4
+ success: boolean;
5
+ message: string;
6
+ }
7
+ /**
8
+ * Hook for account management operations (deactivate, delete, reactivate)
9
+ */
10
+ export declare function useAccountOperations(): {
11
+ deactivateAccount: (password: string) => Promise<AccountActionResult>;
12
+ deleteAccount: (password: string, confirmPhrase: string) => Promise<AccountActionResult>;
13
+ reactivateAccount: (email: string, password: string) => Promise<AuthResult>;
14
+ isDeactivating: boolean;
15
+ isDeleting: boolean;
16
+ isReactivating: boolean;
17
+ isLoading: boolean;
18
+ };
@@ -0,0 +1,91 @@
1
+ type ContextId = string | null | undefined;
2
+ interface MirrorWorkspace {
3
+ id: string;
4
+ organizationId?: string | null;
5
+ }
6
+ interface MirrorProject {
7
+ id: string;
8
+ workspaceId?: string | null;
9
+ }
10
+ export interface ActiveContextBootstrapMirrorArgs {
11
+ /** Auth-store `currentOrganizationId` */
12
+ storeOrganizationId: ContextId;
13
+ /** Auth-store `currentWorkspaceId` */
14
+ storeWorkspaceId: ContextId;
15
+ /** Auth-store `currentProjectId` */
16
+ storeProjectId: ContextId;
17
+ /** ActiveContext `organizationId` */
18
+ activeOrganizationId: ContextId;
19
+ /** ActiveContext `workspaceId` */
20
+ activeWorkspaceId: ContextId;
21
+ /** ActiveContext `projectId` */
22
+ activeProjectId: ContextId;
23
+ /**
24
+ * The auth store's loaded `workspaces`. Used to verify that
25
+ * `storeWorkspaceId` actually belongs to the organization being mirrored
26
+ * before it is filled. If omitted, the workspace axis is never mirrored
27
+ * (safe default — better no workspace than one from the wrong org).
28
+ */
29
+ storeWorkspaces?: ReadonlyArray<MirrorWorkspace>;
30
+ /**
31
+ * The auth store's loaded `projects`. Used to verify that `storeProjectId`
32
+ * actually belongs to the workspace being mirrored before it is filled. If
33
+ * omitted, the project axis is never mirrored.
34
+ */
35
+ storeProjects?: ReadonlyArray<MirrorProject>;
36
+ /**
37
+ * ActiveContext setters. Must be **stable references** (they are, coming
38
+ * from `ActiveContextProvider`'s memoized value) — passing inline arrows
39
+ * makes this effect re-run every render. Likewise prefer stable references
40
+ * for `storeWorkspaces` / `storeProjects` (e.g. a shallow-equal Zustand
41
+ * selector or `useMemo`); a new array reference each render re-runs the
42
+ * effect. Re-runs are harmless (the fills are idempotent), just wasted work.
43
+ */
44
+ setOrganization: (organizationId: string | null) => void;
45
+ setWorkspace: (workspaceId: string | null) => void;
46
+ setProject: (projectId: string | null) => void;
47
+ }
48
+ /**
49
+ * One-way, **fill-only** mirror of the auth store's org / workspace / project
50
+ * ids into ActiveContext, for app-shell headers / context switchers.
51
+ *
52
+ * Some context ids are derived programmatically in the Zustand auth store
53
+ * without a paired ActiveContext write:
54
+ * - the bootstrap in `useContextSwitcherData` auto-selects an organization
55
+ * (`setCurrentOrganizationId`) and, on the persisted-workspace path, a
56
+ * workspace (`setCurrentWorkspaceId`) without calling `setActiveContext`;
57
+ * - `useProjectSyncEffect` / `selectWorkspace` auto-select a project.
58
+ *
59
+ * ActiveContext is the source of truth for the URL + storage + the props passed
60
+ * to workspace MFEs and the workspace-token context, so those store-only ids
61
+ * must reach it — otherwise e.g. a fresh `defaultWorkspaceId` login leaves
62
+ * `organizationId` undefined and the token / MFE context break until the user
63
+ * reselects.
64
+ *
65
+ * The rule is **fill, never override**: copy a store id into ActiveContext only
66
+ * when ActiveContext has no value for that axis yet. We must NOT overwrite a
67
+ * non-null ActiveContext value, because:
68
+ * 1. it would clobber an explicit selection — a switch handler's write, or a
69
+ * deep-link / browser-back `?workspace=`/`?project=` that the router already
70
+ * applied; and
71
+ * 2. overriding is exactly what turns this into a two-store ping-pong — the
72
+ * store→AC and AC→store effects each read the other's pre-commit value and
73
+ * swap the ids every commit until React throws "Maximum update depth
74
+ * exceeded" (error #185). Filling only nulls is self-terminating: once the
75
+ * axis is set the guard is false forever, so it can never alternate.
76
+ *
77
+ * Cross-context safety: a value is filled only when it provably belongs to the
78
+ * parent context being mirrored, validated against the loaded store metadata —
79
+ * the **workspace** must belong to the target organization (`storeWorkspaces`),
80
+ * and the **project** must belong to the target workspace (`storeProjects`).
81
+ * The store can transiently hold a stale child id after its parent advanced
82
+ * (e.g. `useContextSwitcherData` copies a new org into the store before the new
83
+ * org's — unpersisted — workspace list loads, leaving `currentWorkspaceId`
84
+ * pointing at the previous org; or the workspace advances to B while the
85
+ * project still points at A). Gating on loaded metadata means such a stale id
86
+ * isn't in the list yet, so it is not mirrored until it is genuinely valid.
87
+ *
88
+ * See BOFF-2805.
89
+ */
90
+ export declare function useActiveContextBootstrapMirror({ storeOrganizationId, storeWorkspaceId, storeProjectId, activeOrganizationId, activeWorkspaceId, activeProjectId, storeWorkspaces, storeProjects, setOrganization, setWorkspace, setProject, }: ActiveContextBootstrapMirrorArgs): void;
91
+ export {};
@@ -0,0 +1,28 @@
1
+ import { GenerateAPIKeyInput, APIKeyResult, APIKeyRotateResult, AuthResult, ApiKey } from '../types';
2
+
3
+ interface MyApiKeysResponse {
4
+ myApiKeys: {
5
+ apiKeys: ApiKey[];
6
+ hasMore: boolean;
7
+ totalCount: number;
8
+ };
9
+ }
10
+ /**
11
+ * Hook for API key operations
12
+ */
13
+ export declare function useApiKeyOperations(): {
14
+ generateAPIKey: (input: GenerateAPIKeyInput) => Promise<APIKeyResult>;
15
+ revokeAPIKey: (keyId: string) => Promise<boolean>;
16
+ rotateAPIKey: (keyId: string) => Promise<APIKeyRotateResult>;
17
+ authenticateAPIKey: (apiKey: string, apiSecret: string) => Promise<AuthResult>;
18
+ refetchApiKeys: () => Promise<void> | import("@apollo/client").ObservableQuery.ResultPromise<{
19
+ data: MyApiKeysResponse | undefined;
20
+ error?: import('@apollo/client').ErrorLike;
21
+ }>;
22
+ createApiKey: (input: GenerateAPIKeyInput) => Promise<APIKeyResult>;
23
+ revokeApiKey: (keyId: string) => Promise<boolean>;
24
+ apiKeys: ApiKey[];
25
+ isLoading: boolean;
26
+ error: import('@apollo/client').ErrorLike | undefined;
27
+ };
28
+ export {};
@@ -0,0 +1,32 @@
1
+ import { App, AppCreateResponse, CreateAppInput, UpdateAppInput, AppTokenResponse, AppAsUserTokenResponse } from '../types';
2
+
3
+ interface CurrentUserAppsResponse {
4
+ currentUserApps: {
5
+ apps: App[];
6
+ hasMore: boolean;
7
+ totalCount: number;
8
+ };
9
+ }
10
+ /**
11
+ * Hook for app management operations
12
+ */
13
+ export declare function useAppOperations(): {
14
+ getApp: (id: string) => Promise<App | null>;
15
+ refetchApps: () => Promise<void> | import("@apollo/client").ObservableQuery.ResultPromise<{
16
+ data: CurrentUserAppsResponse | undefined;
17
+ error?: import('@apollo/client').ErrorLike;
18
+ }>;
19
+ createApp: (input: CreateAppInput) => Promise<AppCreateResponse>;
20
+ updateApp: (id: string, input: UpdateAppInput) => Promise<App>;
21
+ deactivateApp: (id: string) => Promise<boolean>;
22
+ rotateAppSecret: (id: string) => Promise<AppCreateResponse>;
23
+ authenticateApp: (clientId: string, clientSecret: string, scopes?: string[]) => Promise<AppTokenResponse>;
24
+ generateAppToken: (clientId: string, clientSecret: string, scopes?: string[]) => Promise<AppTokenResponse>;
25
+ generateAppAsUserToken: (targetUserId: string, scopes?: string[]) => Promise<AppAsUserTokenResponse>;
26
+ exchangeToken: (appId: string, userId: string, scopes?: string[]) => Promise<AppAsUserTokenResponse>;
27
+ apps: App[];
28
+ currentApp: App | null;
29
+ isLoading: boolean;
30
+ error: import('@apollo/client').ErrorLike | undefined;
31
+ };
32
+ export {};
@@ -0,0 +1,59 @@
1
+ import { SignInInput, SignUpInput, User, AuthPayload, AuthResult } from '../types';
2
+
3
+ interface CurrentUserResponse {
4
+ currentUser: User | null;
5
+ }
6
+ interface UseAuthOperationsOptions {
7
+ disableCurrentUserQuery?: boolean;
8
+ }
9
+ /**
10
+ * Hook for authentication operations
11
+ * Uses Zustand v5 pattern: selectors for state, getState() for actions
12
+ */
13
+ export declare function useAuthOperations(options?: UseAuthOperationsOptions): {
14
+ signIn: (input: SignInInput) => Promise<AuthResult>;
15
+ signUp: (input: SignUpInput) => Promise<AuthPayload | {
16
+ requiresEmailVerification: boolean;
17
+ user: User | null;
18
+ accessToken: string | null;
19
+ refreshToken: string | null;
20
+ expiresIn: number | null;
21
+ requiresMFA?: boolean;
22
+ mfaChallengeId?: string;
23
+ mfaMethod?: import('..').MFAMethod;
24
+ }>;
25
+ signOut: () => Promise<void>;
26
+ refreshToken: () => Promise<AuthPayload>;
27
+ verifyEmail: (token: string) => Promise<{
28
+ success: boolean;
29
+ message: string;
30
+ email?: string;
31
+ }>;
32
+ resendVerification: (email: string) => Promise<{
33
+ success: boolean;
34
+ message: string;
35
+ }>;
36
+ refetchCurrentUser: (variables?: Partial<import('@apollo/client').OperationVariables> | undefined) => Promise<{
37
+ data: CurrentUserResponse | undefined;
38
+ error?: import('@apollo/client').ErrorLike;
39
+ }>;
40
+ login: (input: SignInInput) => Promise<AuthResult>;
41
+ register: (input: SignUpInput) => Promise<AuthPayload | {
42
+ requiresEmailVerification: boolean;
43
+ user: User | null;
44
+ accessToken: string | null;
45
+ refreshToken: string | null;
46
+ expiresIn: number | null;
47
+ requiresMFA?: boolean;
48
+ mfaChallengeId?: string;
49
+ mfaMethod?: import('..').MFAMethod;
50
+ }>;
51
+ logout: () => Promise<void>;
52
+ isLoading: boolean;
53
+ error: string | null;
54
+ errorCode: string | null;
55
+ isAuthenticated: boolean;
56
+ user: User | null;
57
+ accessToken: string | null;
58
+ };
59
+ export {};
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Hook for auth admin RBAC permissions.
3
+ *
4
+ * Only covers admin-facing operations. Public auth flows and self-service
5
+ * operations don't need RBAC checks — they're either @rbac(public: true)
6
+ * or scoped to the current user's own data.
7
+ */
8
+ export declare function useAuthPermissions(): {
9
+ canViewUsers: boolean;
10
+ canUpdateUsers: boolean;
11
+ canDeleteUsers: boolean;
12
+ canViewApps: boolean;
13
+ canCreateApps: boolean;
14
+ canUpdateApps: boolean;
15
+ canManageSsoConfig: boolean;
16
+ canManageOidcConfig: boolean;
17
+ canManageAuthMethods: boolean;
18
+ isLoading: boolean;
19
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Hook for reCAPTCHA v3 invisible verification.
3
+ * Returns a no-op when VITE_CAPTCHA_ENABLED is not "true".
4
+ *
5
+ * When enabled, dynamically imports `react-google-recaptcha-v3` and uses
6
+ * the `useGoogleReCaptcha` hook from the `GoogleReCaptchaProvider` context.
7
+ * The provider must be mounted above this hook in the component tree
8
+ * (handled by CaptchaProvider in AuthRoot).
9
+ */
10
+ export declare function useCaptchaV3(): {
11
+ executeRecaptcha: (action: string) => Promise<string | undefined>;
12
+ };
@@ -0,0 +1,91 @@
1
+ import { Organization, Workspace, Project } from '../types';
2
+
3
+ export interface UseContextSwitcherDataOptions {
4
+ /**
5
+ * Optional Global API Gateway base URL override.
6
+ * If not provided, uses GATEWAYS config from fe-libs.
7
+ */
8
+ globalBaseUrl?: string;
9
+ /**
10
+ * Optional Workspaces API Gateway base URL override.
11
+ * If not provided, uses GATEWAYS config from fe-libs.
12
+ */
13
+ workspaceBaseUrl?: string;
14
+ /** Disable initial organization/workspace bootstrap fetches */
15
+ disableBootstrap?: boolean;
16
+ /** Disable the workspace sync effect */
17
+ disableWorkspaceSync?: boolean;
18
+ /** Disable the project sync effect */
19
+ disableProjectSync?: boolean;
20
+ /** Only hydrate the workspace token; do not eagerly fetch projects */
21
+ skipProjectFetch?: boolean;
22
+ }
23
+ export declare function useContextSwitcherData(options?: UseContextSwitcherDataOptions): {
24
+ organizations: Organization[];
25
+ workspaces: Workspace[];
26
+ projects: Project[];
27
+ currentOrganizationId: string | null;
28
+ currentWorkspaceId: string | null;
29
+ currentProjectId: string | null;
30
+ currentOrganization: Organization | undefined;
31
+ currentWorkspace: Workspace | undefined;
32
+ currentProject: Project | undefined;
33
+ workspaceToken: string | null;
34
+ isLoadingOrganizations: boolean;
35
+ isLoadingWorkspaces: boolean;
36
+ isLoadingProjects: boolean;
37
+ isLoading: boolean;
38
+ error: string | null;
39
+ fetchOrganizations: () => Promise<Organization[]>;
40
+ fetchWorkspacesForOrg: (organizationId: string) => Promise<Workspace[]>;
41
+ issueWorkspaceToken: (organizationId: string, workspaceId?: string, projectId?: string | null, tenantId?: string) => Promise<{
42
+ success: boolean;
43
+ token?: string;
44
+ resolvedWorkspaceId?: string;
45
+ error?: string;
46
+ }>;
47
+ fetchProjects: () => Promise<Project[]>;
48
+ selectOrganization: (org: Organization) => Promise<Workspace[]>;
49
+ selectWorkspace: (workspace: Workspace) => Promise<{
50
+ success: boolean;
51
+ projects?: Project[];
52
+ error?: string;
53
+ }>;
54
+ selectProject: (project: Project) => void;
55
+ };
56
+ /**
57
+ * Hook to reactively ensure workspaces are synced with the current organization.
58
+ *
59
+ * This handles edge cases where the organization changes but workspaces
60
+ * from a different org are still in the store (e.g., stale data, race conditions).
61
+ *
62
+ * Usage:
63
+ * ```tsx
64
+ * import { useWorkspaceSyncEffect } from '@burdenoff/microfe-auth';
65
+ *
66
+ * function MyComponent() {
67
+ * useWorkspaceSyncEffect(); // Ensures workspaces stay in sync
68
+ * // ...
69
+ * }
70
+ * ```
71
+ */
72
+ export declare function useWorkspaceSyncEffect(options?: UseContextSwitcherDataOptions): void;
73
+ /**
74
+ * Hook to reactively ensure projects are loaded when a workspace is selected.
75
+ *
76
+ * This handles the case where a workspace is auto-selected (from URL/localStorage)
77
+ * but projects haven't been fetched yet. It will:
78
+ * 1. Issue a workspace token if not present
79
+ * 2. Fetch projects for the selected workspace
80
+ *
81
+ * Usage:
82
+ * ```tsx
83
+ * import { useProjectSyncEffect } from '@burdenoff/microfe-auth';
84
+ *
85
+ * function MyComponent() {
86
+ * useProjectSyncEffect(); // Ensures projects are loaded for selected workspace
87
+ * // ...
88
+ * }
89
+ * ```
90
+ */
91
+ export declare function useProjectSyncEffect(options?: UseContextSwitcherDataOptions): void;