@cedros/login-react 0.0.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.
- package/LICENSE +21 -0
- package/README.md +1183 -0
- package/dist/EmailRegisterForm-D_uCEdX9.cjs +1 -0
- package/dist/EmailRegisterForm-D_uCEdX9.cjs.map +1 -0
- package/dist/EmailRegisterForm-m3rX3A6X.js +2923 -0
- package/dist/EmailRegisterForm-m3rX3A6X.js.map +1 -0
- package/dist/ErrorMessage-Bm1j5mBT.js +2042 -0
- package/dist/ErrorMessage-Bm1j5mBT.js.map +1 -0
- package/dist/ErrorMessage-CntMyn93.cjs +1 -0
- package/dist/ErrorMessage-CntMyn93.cjs.map +1 -0
- package/dist/GoogleLoginButton-CJNJ-THo.cjs +1 -0
- package/dist/GoogleLoginButton-CJNJ-THo.cjs.map +1 -0
- package/dist/GoogleLoginButton-CvDoOc-0.js +227 -0
- package/dist/GoogleLoginButton-CvDoOc-0.js.map +1 -0
- package/dist/SolanaLoginButton-BlSgPW50.cjs +1 -0
- package/dist/SolanaLoginButton-BlSgPW50.cjs.map +1 -0
- package/dist/SolanaLoginButton-h32xN2PQ.js +261 -0
- package/dist/SolanaLoginButton-h32xN2PQ.js.map +1 -0
- package/dist/assets/argon2Worker-Bi5TuQvD.js +1 -0
- package/dist/assets/argon2Worker-Bi5TuQvD.js.map +1 -0
- package/dist/components/LoginButton.d.ts +23 -0
- package/dist/components/LoginForm.d.ts +9 -0
- package/dist/components/LoginModal.d.ts +9 -0
- package/dist/components/admin/AdminUserDetail.d.ts +21 -0
- package/dist/components/admin/AdminUserList.d.ts +25 -0
- package/dist/components/admin/CedrosAdminDashboard.d.ts +48 -0
- package/dist/components/admin/SystemSettings.d.ts +19 -0
- package/dist/components/apple/AppleLoginButton.d.ts +29 -0
- package/dist/components/deposit/CreditBalance.d.ts +19 -0
- package/dist/components/deposit/DepositFlow.d.ts +118 -0
- package/dist/components/deposit/FeeConfigDisplay.d.ts +15 -0
- package/dist/components/deposit/History.d.ts +21 -0
- package/dist/components/deposit/TieredAmountSlider.d.ts +19 -0
- package/dist/components/deposit/TokenSelector.d.ts +23 -0
- package/dist/components/deposit/admin/AdminDepositList.d.ts +21 -0
- package/dist/components/deposit/admin/AdminDepositStats.d.ts +15 -0
- package/dist/components/deposit/admin/AdminPrivacyPeriodDeposits.d.ts +19 -0
- package/dist/components/deposit/admin/AdminWithdrawalHistory.d.ts +19 -0
- package/dist/components/deposit/admin/AdminWithdrawalQueue.d.ts +23 -0
- package/dist/components/deposit/admin/PrivacySystemStatus.d.ts +15 -0
- package/dist/components/deposit/admin/index.d.ts +17 -0
- package/dist/components/deposit/index.d.ts +12 -0
- package/dist/components/deposit/tierUtils.d.ts +8 -0
- package/dist/components/deposit/tokens.d.ts +19 -0
- package/dist/components/email/EmailLoginForm.d.ts +11 -0
- package/dist/components/email/EmailRegisterForm.d.ts +14 -0
- package/dist/components/email/ForgotPasswordForm.d.ts +17 -0
- package/dist/components/email/PasswordInput.d.ts +14 -0
- package/dist/components/email/ResetPasswordForm.d.ts +22 -0
- package/dist/components/google/GoogleLoginButton.d.ts +12 -0
- package/dist/components/invites/InviteForm.d.ts +38 -0
- package/dist/components/invites/InviteList.d.ts +40 -0
- package/dist/components/members/MemberList.d.ts +47 -0
- package/dist/components/org/CreateOrgForm.d.ts +7 -0
- package/dist/components/org/OrgAvatar.d.ts +7 -0
- package/dist/components/org/OrgListView.d.ts +9 -0
- package/dist/components/org/OrgSelector.d.ts +51 -0
- package/dist/components/org/OrgSwitcher.d.ts +47 -0
- package/dist/components/org/icons.d.ts +8 -0
- package/dist/components/sessions/SessionList.d.ts +33 -0
- package/dist/components/shared/ErrorBoundary.d.ts +38 -0
- package/dist/components/shared/ErrorMessage.d.ts +14 -0
- package/dist/components/shared/LoadingSpinner.d.ts +16 -0
- package/dist/components/solana/SolanaLoginButton.d.ts +49 -0
- package/dist/components/templates/FullPageLayout.d.ts +40 -0
- package/dist/components/templates/SplitPageLayout.d.ts +44 -0
- package/dist/components/templates/index.d.ts +4 -0
- package/dist/components/totp/OtpInput.d.ts +32 -0
- package/dist/components/totp/QrCode.d.ts +21 -0
- package/dist/components/totp/TotpSettings.d.ts +38 -0
- package/dist/components/totp/TotpSetup.d.ts +23 -0
- package/dist/components/totp/TotpVerify.d.ts +25 -0
- package/dist/components/totp/index.d.ts +10 -0
- package/dist/components/wallet/CapabilityWarning.d.ts +11 -0
- package/dist/components/wallet/PasskeyPrompt.d.ts +34 -0
- package/dist/components/wallet/RecoveryPhraseDisplay.d.ts +18 -0
- package/dist/components/wallet/RecoveryPhraseInput.d.ts +21 -0
- package/dist/components/wallet/WalletAddressRow.d.ts +10 -0
- package/dist/components/wallet/WalletEnrollment.d.ts +15 -0
- package/dist/components/wallet/WalletManager.d.ts +9 -0
- package/dist/components/wallet/WalletRecovery.d.ts +19 -0
- package/dist/components/wallet/WalletStatus.d.ts +28 -0
- package/dist/components/wallet/WalletUnlock.d.ts +23 -0
- package/dist/components/wallet/index.d.ts +23 -0
- package/dist/components/webauthn/PasskeyLoginButton.d.ts +8 -0
- package/dist/context/CedrosLoginContext.d.ts +24 -0
- package/dist/context/CedrosLoginProvider.d.ts +17 -0
- package/dist/context/EmbeddedWalletExposure.d.ts +19 -0
- package/dist/context/useCedrosLogin.d.ts +12 -0
- package/dist/crypto/aesGcm.d.ts +89 -0
- package/dist/crypto/argon2.d.ts +65 -0
- package/dist/crypto/argon2Worker.d.ts +1 -0
- package/dist/crypto/argon2WorkerClient.d.ts +28 -0
- package/dist/crypto/bip39.d.ts +106 -0
- package/dist/crypto/capabilities.d.ts +35 -0
- package/dist/crypto/entropy.d.ts +56 -0
- package/dist/crypto/hkdf.d.ts +38 -0
- package/dist/crypto/index.d.ts +30 -0
- package/dist/crypto/secureWipe.d.ts +90 -0
- package/dist/crypto/shamir.d.ts +52 -0
- package/dist/crypto/solanaKeypair.d.ts +63 -0
- package/dist/crypto/types.d.ts +134 -0
- package/dist/crypto/webauthnPrf.d.ts +118 -0
- package/dist/email-only.cjs +1 -0
- package/dist/email-only.cjs.map +1 -0
- package/dist/email-only.d.ts +16 -0
- package/dist/email-only.js +15 -0
- package/dist/email-only.js.map +1 -0
- package/dist/google-only.cjs +1 -0
- package/dist/google-only.cjs.map +1 -0
- package/dist/google-only.d.ts +13 -0
- package/dist/google-only.js +11 -0
- package/dist/google-only.js.map +1 -0
- package/dist/hooks/useAdminDeposits.d.ts +10 -0
- package/dist/hooks/useAdminUsers.d.ts +28 -0
- package/dist/hooks/useAppleAuth.d.ts +52 -0
- package/dist/hooks/useAuth.d.ts +34 -0
- package/dist/hooks/useAuthSession.d.ts +19 -0
- package/dist/hooks/useAuthorize.d.ts +62 -0
- package/dist/hooks/useCredits.d.ts +11 -0
- package/dist/hooks/useDeposit.d.ts +16 -0
- package/dist/hooks/useEmailAuth.d.ts +60 -0
- package/dist/hooks/useGoogleAuth.d.ts +67 -0
- package/dist/hooks/useInstantLink.d.ts +42 -0
- package/dist/hooks/useInvites.d.ts +57 -0
- package/dist/hooks/useMembers.d.ts +52 -0
- package/dist/hooks/useOrgs.d.ts +49 -0
- package/dist/hooks/usePasswordReset.d.ts +32 -0
- package/dist/hooks/usePendingRecovery.d.ts +34 -0
- package/dist/hooks/useRateLimiter.d.ts +58 -0
- package/dist/hooks/useSessions.d.ts +45 -0
- package/dist/hooks/useSolanaAuth.d.ts +30 -0
- package/dist/hooks/useSystemSettings.d.ts +47 -0
- package/dist/hooks/useThemeManager.d.ts +11 -0
- package/dist/hooks/useTotp.d.ts +52 -0
- package/dist/hooks/useTotpVerify.d.ts +38 -0
- package/dist/hooks/useTransactionSigning.d.ts +45 -0
- package/dist/hooks/useWallet.d.ts +10 -0
- package/dist/hooks/useWalletDiscovery.d.ts +24 -0
- package/dist/hooks/useWalletEnrollment.d.ts +9 -0
- package/dist/hooks/useWalletMaterial.d.ts +10 -0
- package/dist/hooks/useWalletRecovery.d.ts +9 -0
- package/dist/hooks/useWalletSigning.d.ts +31 -0
- package/dist/hooks/useWebAuthn.d.ts +25 -0
- package/dist/i18n/I18nProvider.d.ts +16 -0
- package/dist/i18n/context.d.ts +6 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/translations.d.ts +66 -0
- package/dist/i18n/useI18n.d.ts +9 -0
- package/dist/index.cjs +2061 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +126 -0
- package/dist/index.js +14910 -0
- package/dist/index.js.map +1 -0
- package/dist/login-react.css +1 -0
- package/dist/solana-only.cjs +1 -0
- package/dist/solana-only.cjs.map +1 -0
- package/dist/solana-only.d.ts +13 -0
- package/dist/solana-only.js +11 -0
- package/dist/solana-only.js.map +1 -0
- package/dist/style.cjs +1 -0
- package/dist/style.cjs.map +1 -0
- package/dist/style.js +1 -0
- package/dist/style.js.map +1 -0
- package/dist/types/adminUser.d.ts +112 -0
- package/dist/types/auth.d.ts +122 -0
- package/dist/types/config.d.ts +266 -0
- package/dist/types/deposit.d.ts +488 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/invite.d.ts +71 -0
- package/dist/types/member.d.ts +45 -0
- package/dist/types/org.d.ts +101 -0
- package/dist/types/session.d.ts +28 -0
- package/dist/types/systemSettings.d.ts +81 -0
- package/dist/types/totp.d.ts +52 -0
- package/dist/types/wallet.d.ts +309 -0
- package/dist/utils/adminUserApi.d.ts +51 -0
- package/dist/utils/apiClient.d.ts +78 -0
- package/dist/utils/cryptoShim.d.ts +17 -0
- package/dist/utils/csrf.d.ts +1 -0
- package/dist/utils/deviceDetection.d.ts +17 -0
- package/dist/utils/embeddedWallet.d.ts +75 -0
- package/dist/utils/inviteApi.d.ts +31 -0
- package/dist/utils/memberApi.d.ts +23 -0
- package/dist/utils/orgApi.d.ts +36 -0
- package/dist/utils/sanitization.d.ts +66 -0
- package/dist/utils/sessionApi.d.ts +16 -0
- package/dist/utils/silentWalletEnroll.d.ts +41 -0
- package/dist/utils/systemSettingsApi.d.ts +18 -0
- package/dist/utils/tabSync.d.ts +46 -0
- package/dist/utils/tokenManager.d.ts +107 -0
- package/dist/utils/unlockCredential.d.ts +5 -0
- package/dist/utils/validation.d.ts +48 -0
- package/dist/utils/walletDetection.d.ts +23 -0
- package/dist/utils/webauthnJson.d.ts +21 -0
- package/dist/validation-BeXIfuHB.cjs +1 -0
- package/dist/validation-BeXIfuHB.cjs.map +1 -0
- package/dist/validation-BebL7hMF.js +56 -0
- package/dist/validation-BebL7hMF.js.map +1 -0
- package/package.json +109 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
import { PasswordValidation } from '../../types';
|
|
3
|
+
export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
4
|
+
label?: string;
|
|
5
|
+
/** Action element shown on the right side of the label (e.g., "Forgot password?" link) */
|
|
6
|
+
labelAction?: React.ReactNode;
|
|
7
|
+
showStrengthMeter?: boolean;
|
|
8
|
+
onValidationChange?: (validation: PasswordValidation) => void;
|
|
9
|
+
error?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Password input with visibility toggle and optional strength meter
|
|
13
|
+
*/
|
|
14
|
+
export declare function PasswordInput({ label, labelAction, showStrengthMeter, onValidationChange, error, className, onChange, value, ...props }: PasswordInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ResetPasswordFormProps {
|
|
2
|
+
token: string;
|
|
3
|
+
onSuccess?: () => void;
|
|
4
|
+
onLoginClick?: () => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Form for resetting password using a reset token.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* // Get token from URL params
|
|
13
|
+
* const token = new URLSearchParams(location.search).get('token');
|
|
14
|
+
*
|
|
15
|
+
* <ResetPasswordForm
|
|
16
|
+
* token={token}
|
|
17
|
+
* onSuccess={() => navigate('/login')}
|
|
18
|
+
* onLoginClick={() => navigate('/login')}
|
|
19
|
+
* />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function ResetPasswordForm({ token, onSuccess, onLoginClick, className, }: ResetPasswordFormProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface GoogleLoginButtonProps {
|
|
2
|
+
onSuccess?: () => void;
|
|
3
|
+
onError?: (error: Error) => void;
|
|
4
|
+
className?: string;
|
|
5
|
+
variant?: 'default' | 'outline';
|
|
6
|
+
size?: 'sm' | 'md' | 'lg';
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Google OAuth login button
|
|
11
|
+
*/
|
|
12
|
+
export declare function GoogleLoginButton({ onSuccess, onError, className, variant, size, disabled, }: GoogleLoginButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { OrgRole, DisplayError } from '../../types';
|
|
2
|
+
type InviteRole = Exclude<OrgRole, 'owner'>;
|
|
3
|
+
export interface InviteFormProps {
|
|
4
|
+
/** Callback when invite is submitted */
|
|
5
|
+
onSubmit: (email: string, role: InviteRole) => Promise<void>;
|
|
6
|
+
/** Loading state */
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
/** Error message */
|
|
9
|
+
error?: DisplayError;
|
|
10
|
+
/** Available roles for invite (default: admin, member, viewer) */
|
|
11
|
+
availableRoles?: InviteRole[];
|
|
12
|
+
/** Default role for new invites */
|
|
13
|
+
defaultRole?: InviteRole;
|
|
14
|
+
/** Additional CSS class */
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Form for inviting new members to an organization.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* function InviteManager() {
|
|
23
|
+
* const { activeOrg } = useOrgs();
|
|
24
|
+
* const { createInvite, isLoading, error } = useInvites(activeOrg?.id);
|
|
25
|
+
*
|
|
26
|
+
* return (
|
|
27
|
+
* <InviteForm
|
|
28
|
+
* onSubmit={createInvite}
|
|
29
|
+
* isLoading={isLoading}
|
|
30
|
+
* error={error?.message}
|
|
31
|
+
* defaultRole="member"
|
|
32
|
+
* />
|
|
33
|
+
* );
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function InviteForm({ onSubmit, isLoading, error, availableRoles, defaultRole, className, }: InviteFormProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Invite, DisplayError } from '../../types';
|
|
2
|
+
export interface InviteListProps {
|
|
3
|
+
/** List of pending invites */
|
|
4
|
+
invites: Invite[];
|
|
5
|
+
/** Loading state */
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
/** Error message */
|
|
8
|
+
error?: DisplayError;
|
|
9
|
+
/** Whether the current user can manage invites */
|
|
10
|
+
canManage?: boolean;
|
|
11
|
+
/** Callback when invite is cancelled */
|
|
12
|
+
onCancel?: (inviteId: string) => Promise<void>;
|
|
13
|
+
/** Callback when invite is resent */
|
|
14
|
+
onResend?: (inviteId: string) => Promise<void>;
|
|
15
|
+
/** Additional CSS class */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Display and manage pending organization invites.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* function PendingInvites() {
|
|
24
|
+
* const { activeOrg, hasPermission } = useOrgs();
|
|
25
|
+
* const { invites, isLoading, error, cancelInvite, resendInvite } = useInvites(activeOrg?.id);
|
|
26
|
+
*
|
|
27
|
+
* return (
|
|
28
|
+
* <InviteList
|
|
29
|
+
* invites={invites}
|
|
30
|
+
* isLoading={isLoading}
|
|
31
|
+
* error={error?.message}
|
|
32
|
+
* canManage={hasPermission('invite:cancel')}
|
|
33
|
+
* onCancel={cancelInvite}
|
|
34
|
+
* onResend={resendInvite}
|
|
35
|
+
* />
|
|
36
|
+
* );
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function InviteList({ invites, isLoading, error, canManage, onCancel, onResend, className, }: InviteListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Member, OrgRole, DisplayError } from '../../types';
|
|
2
|
+
export interface MemberListProps {
|
|
3
|
+
/** List of members to display */
|
|
4
|
+
members: Member[];
|
|
5
|
+
/** Current user's ID (to prevent self-actions) */
|
|
6
|
+
currentUserId?: string;
|
|
7
|
+
/** Loading state */
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
/** Error message */
|
|
10
|
+
error?: DisplayError;
|
|
11
|
+
/** Whether the current user can manage members */
|
|
12
|
+
canManage?: boolean;
|
|
13
|
+
/** Whether the current user can change roles */
|
|
14
|
+
canChangeRoles?: boolean;
|
|
15
|
+
/** Callback when role is updated */
|
|
16
|
+
onUpdateRole?: (userId: string, role: OrgRole) => Promise<void>;
|
|
17
|
+
/** Callback when member is removed */
|
|
18
|
+
onRemove?: (userId: string) => Promise<void>;
|
|
19
|
+
/** Additional CSS class */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Display and manage organization members.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* function TeamMembers() {
|
|
28
|
+
* const { activeOrg, hasPermission } = useOrgs();
|
|
29
|
+
* const { members, isLoading, error, updateMemberRole, removeMember } = useMembers(activeOrg?.id);
|
|
30
|
+
* const { user } = useAuth();
|
|
31
|
+
*
|
|
32
|
+
* return (
|
|
33
|
+
* <MemberList
|
|
34
|
+
* members={members}
|
|
35
|
+
* currentUserId={user?.id}
|
|
36
|
+
* isLoading={isLoading}
|
|
37
|
+
* error={error?.message}
|
|
38
|
+
* canManage={hasPermission('member:remove')}
|
|
39
|
+
* canChangeRoles={hasPermission('member:role_change')}
|
|
40
|
+
* onUpdateRole={updateMemberRole}
|
|
41
|
+
* onRemove={removeMember}
|
|
42
|
+
* />
|
|
43
|
+
* );
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function MemberList({ members, currentUserId, isLoading, error, canManage, canChangeRoles, onUpdateRole, onRemove, className, }: MemberListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CreateOrgRequest } from '../../types';
|
|
2
|
+
export interface CreateOrgFormProps {
|
|
3
|
+
isLoading: boolean;
|
|
4
|
+
onSubmit: (data: CreateOrgRequest) => Promise<void>;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function CreateOrgForm({ isLoading, onSubmit, onCancel }: CreateOrgFormProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OrgWithMembership } from '../../types';
|
|
2
|
+
export interface OrgAvatarProps {
|
|
3
|
+
org: OrgWithMembership;
|
|
4
|
+
size?: 'sm' | 'lg';
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function OrgAvatar({ org, size, className }: OrgAvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OrgWithMembership } from '../../types';
|
|
2
|
+
export interface OrgListViewProps {
|
|
3
|
+
orgs: OrgWithMembership[];
|
|
4
|
+
activeOrg: OrgWithMembership | null;
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
onSelect: (orgId: string) => void;
|
|
7
|
+
onCreateClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function OrgListView({ orgs, activeOrg, isLoading, onSelect, onCreateClick, }: OrgListViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { OrgWithMembership } from '../../types';
|
|
2
|
+
export interface OrgSelectorProps {
|
|
3
|
+
/** List of organizations to display */
|
|
4
|
+
orgs: OrgWithMembership[];
|
|
5
|
+
/** Currently active organization */
|
|
6
|
+
activeOrg: OrgWithMembership | null;
|
|
7
|
+
/** Loading state */
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
/** Callback when organization is selected */
|
|
10
|
+
onSelect: (orgId: string) => void;
|
|
11
|
+
/** Callback when "Create organization" is clicked */
|
|
12
|
+
onCreateClick?: () => void;
|
|
13
|
+
/** Additional CSS class */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Placeholder when no orgs */
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Dropdown selector for switching between organizations.
|
|
20
|
+
*
|
|
21
|
+
* ## A11Y-02: Keyboard Navigation Limitation
|
|
22
|
+
*
|
|
23
|
+
* Currently supports:
|
|
24
|
+
* - Tab/Shift+Tab: Move focus between trigger and items
|
|
25
|
+
* - Escape: Close dropdown
|
|
26
|
+
* - Enter/Space: Select focused item
|
|
27
|
+
*
|
|
28
|
+
* TODO: Implement arrow key navigation for better accessibility:
|
|
29
|
+
* - ArrowUp/ArrowDown: Navigate between items in the list
|
|
30
|
+
* - Home/End: Jump to first/last item
|
|
31
|
+
* - Type-ahead: Focus item starting with typed character
|
|
32
|
+
*
|
|
33
|
+
* See WAI-ARIA Listbox Pattern for reference implementation.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* function Header() {
|
|
38
|
+
* const { orgs, activeOrg, switchOrg } = useOrgs();
|
|
39
|
+
*
|
|
40
|
+
* return (
|
|
41
|
+
* <OrgSelector
|
|
42
|
+
* orgs={orgs}
|
|
43
|
+
* activeOrg={activeOrg}
|
|
44
|
+
* onSelect={switchOrg}
|
|
45
|
+
* onCreateClick={() => setShowCreateModal(true)}
|
|
46
|
+
* />
|
|
47
|
+
* );
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function OrgSelector({ orgs, activeOrg, isLoading, onSelect, onCreateClick, className, placeholder, }: OrgSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { OrgWithMembership, CreateOrgRequest, DisplayError } from '../../types';
|
|
2
|
+
export interface OrgSwitcherProps {
|
|
3
|
+
/** Whether the modal is open */
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
/** Callback to close the modal */
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
/** List of organizations */
|
|
8
|
+
orgs: OrgWithMembership[];
|
|
9
|
+
/** Currently active organization */
|
|
10
|
+
activeOrg: OrgWithMembership | null;
|
|
11
|
+
/** Loading state */
|
|
12
|
+
isLoading?: boolean;
|
|
13
|
+
/** Error message */
|
|
14
|
+
error?: DisplayError;
|
|
15
|
+
/** Callback when organization is selected */
|
|
16
|
+
onSelect: (orgId: string) => void;
|
|
17
|
+
/** Callback when new organization is created */
|
|
18
|
+
onCreate?: (data: CreateOrgRequest) => Promise<void>;
|
|
19
|
+
/** Additional CSS class */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Modal for switching organizations and creating new ones.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* function App() {
|
|
28
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
29
|
+
* const { orgs, activeOrg, switchOrg, createOrg } = useOrgs();
|
|
30
|
+
*
|
|
31
|
+
* return (
|
|
32
|
+
* <>
|
|
33
|
+
* <button onClick={() => setIsOpen(true)}>Switch org</button>
|
|
34
|
+
* <OrgSwitcher
|
|
35
|
+
* isOpen={isOpen}
|
|
36
|
+
* onClose={() => setIsOpen(false)}
|
|
37
|
+
* orgs={orgs}
|
|
38
|
+
* activeOrg={activeOrg}
|
|
39
|
+
* onSelect={switchOrg}
|
|
40
|
+
* onCreate={createOrg}
|
|
41
|
+
* />
|
|
42
|
+
* </>
|
|
43
|
+
* );
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function OrgSwitcher({ isOpen, onClose, orgs, activeOrg, isLoading, error, onSelect, onCreate, className, }: OrgSwitcherProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon components for organization UI
|
|
3
|
+
*
|
|
4
|
+
* Extracted from OrgSwitcher.tsx (F-02)
|
|
5
|
+
*/
|
|
6
|
+
export declare function CloseIcon(): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function CheckIcon(): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function PlusIcon(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Session, DisplayError } from '../../types';
|
|
2
|
+
export interface SessionListProps {
|
|
3
|
+
/** List of active sessions */
|
|
4
|
+
sessions: Session[];
|
|
5
|
+
/** Loading state */
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
/** Error message */
|
|
8
|
+
error?: DisplayError;
|
|
9
|
+
/** Callback to revoke all other sessions */
|
|
10
|
+
onRevokeAll?: () => Promise<void>;
|
|
11
|
+
/** Additional CSS class */
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Display active sessions and allow revoking all other sessions.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* function SecuritySettings() {
|
|
20
|
+
* const { sessions, isLoading, error, revokeAllSessions } = useSessions();
|
|
21
|
+
*
|
|
22
|
+
* return (
|
|
23
|
+
* <SessionList
|
|
24
|
+
* sessions={sessions}
|
|
25
|
+
* isLoading={isLoading}
|
|
26
|
+
* error={error?.message}
|
|
27
|
+
* onRevokeAll={revokeAllSessions}
|
|
28
|
+
* />
|
|
29
|
+
* );
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function SessionList({ sessions, isLoading, error, onRevokeAll, className, }: SessionListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Component, ReactNode, ErrorInfo } from 'react';
|
|
2
|
+
export interface ErrorBoundaryProps {
|
|
3
|
+
/** Child components to render */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Custom fallback UI to show when an error occurs */
|
|
6
|
+
fallback?: ReactNode;
|
|
7
|
+
/** Callback when an error is caught */
|
|
8
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
9
|
+
/** Whether to show error details (useful for development) */
|
|
10
|
+
showDetails?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface ErrorBoundaryState {
|
|
13
|
+
hasError: boolean;
|
|
14
|
+
error: Error | null;
|
|
15
|
+
errorInfo: ErrorInfo | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Error Boundary component that catches JavaScript errors in child components.
|
|
19
|
+
* Prevents the entire app from crashing and shows a fallback UI.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <ErrorBoundary
|
|
24
|
+
* fallback={<div>Something went wrong</div>}
|
|
25
|
+
* onError={(error) => logError(error)}
|
|
26
|
+
* >
|
|
27
|
+
* <LoginForm />
|
|
28
|
+
* </ErrorBoundary>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
32
|
+
constructor(props: ErrorBoundaryProps);
|
|
33
|
+
static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState>;
|
|
34
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
35
|
+
handleRetry: () => void;
|
|
36
|
+
render(): ReactNode;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DisplayError } from '../../types';
|
|
2
|
+
export interface ErrorMessageProps {
|
|
3
|
+
error: DisplayError;
|
|
4
|
+
className?: string;
|
|
5
|
+
onDismiss?: () => void;
|
|
6
|
+
/** If true, focus the error message when it appears (for accessibility) */
|
|
7
|
+
autoFocus?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Error message display component with accessibility support.
|
|
11
|
+
* Announces errors to screen readers and optionally focuses the message.
|
|
12
|
+
* Wrapped with React.memo to prevent unnecessary re-renders.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ErrorMessage: import('react').NamedExoticComponent<ErrorMessageProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export interface LoadingSpinnerProps {
|
|
3
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
/** Custom label for screen readers (default: "Loading") */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** If true, announce the loading state to screen readers */
|
|
9
|
+
announce?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Accessible loading spinner component.
|
|
13
|
+
* Announces loading state to screen readers when announce prop is true.
|
|
14
|
+
* Wrapped with React.memo to prevent unnecessary re-renders.
|
|
15
|
+
*/
|
|
16
|
+
export declare const LoadingSpinner: import('react').NamedExoticComponent<LoadingSpinnerProps>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface SolanaLoginButtonProps {
|
|
2
|
+
onSuccess?: () => void;
|
|
3
|
+
onError?: (error: Error) => void;
|
|
4
|
+
className?: string;
|
|
5
|
+
variant?: 'default' | 'outline';
|
|
6
|
+
size?: 'sm' | 'md' | 'lg';
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Hide the button if no Solana wallets are detected.
|
|
10
|
+
* When true (default), button renders nothing if no wallets are installed.
|
|
11
|
+
* When false, button always renders (useful for showing "install wallet" prompts).
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
hideIfNoWallet?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Solana wallet adapter context. Pass this from @solana/wallet-adapter-react's useWallet().
|
|
17
|
+
* The button will handle connection and signing automatically for a one-click experience.
|
|
18
|
+
*/
|
|
19
|
+
walletContext?: {
|
|
20
|
+
publicKey: {
|
|
21
|
+
toBase58: () => string;
|
|
22
|
+
} | null;
|
|
23
|
+
signMessage: ((message: Uint8Array) => Promise<Uint8Array>) | null;
|
|
24
|
+
connected: boolean;
|
|
25
|
+
connecting: boolean;
|
|
26
|
+
connect: () => Promise<void>;
|
|
27
|
+
wallet: {
|
|
28
|
+
adapter: {
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
31
|
+
} | null;
|
|
32
|
+
select: (walletName: string) => void;
|
|
33
|
+
wallets: Array<{
|
|
34
|
+
adapter: {
|
|
35
|
+
name: string;
|
|
36
|
+
icon: string;
|
|
37
|
+
readyState: string;
|
|
38
|
+
};
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Solana wallet login button with one-click authentication.
|
|
44
|
+
*
|
|
45
|
+
* Handles wallet connection and message signing automatically.
|
|
46
|
+
* If wallet is already connected, signs immediately.
|
|
47
|
+
* If not connected, connects first then auto-signs.
|
|
48
|
+
*/
|
|
49
|
+
export declare function SolanaLoginButton({ onSuccess, onError, className, variant, size, disabled, hideIfNoWallet, walletContext, }: SolanaLoginButtonProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface FullPageLayoutProps {
|
|
3
|
+
/** Brand logo element (e.g., an img or svg) */
|
|
4
|
+
brandLogo?: ReactNode;
|
|
5
|
+
/** Brand name displayed next to the logo */
|
|
6
|
+
brandName?: string;
|
|
7
|
+
/** Title displayed above the form. @default "Welcome back" */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Subtitle displayed below the title. @default "Login with your Apple or Google account" */
|
|
10
|
+
subtitle?: string;
|
|
11
|
+
/** Terms/legal text displayed below the card */
|
|
12
|
+
termsText?: ReactNode;
|
|
13
|
+
/** Called when login/register succeeds */
|
|
14
|
+
onSuccess?: () => void;
|
|
15
|
+
/** Default tab for the form. @default "login" */
|
|
16
|
+
defaultTab?: 'login' | 'register';
|
|
17
|
+
/** Custom content to render instead of LoginForm */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/** Additional CSS class for the outer container */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Full page login layout with centered card on gradient background.
|
|
24
|
+
* Follows shadcn/ui login block pattern.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* // Basic usage
|
|
29
|
+
* <FullPageLayout onSuccess={() => navigate('/dashboard')} />
|
|
30
|
+
*
|
|
31
|
+
* // With branding and terms
|
|
32
|
+
* <FullPageLayout
|
|
33
|
+
* brandLogo={<img src="/logo.svg" alt="" />}
|
|
34
|
+
* brandName="Acme Inc."
|
|
35
|
+
* termsText={<>By clicking continue, you agree to our <a href="/terms">Terms</a>.</>}
|
|
36
|
+
* onSuccess={handleSuccess}
|
|
37
|
+
* />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function FullPageLayout({ brandLogo, brandName, title, subtitle, termsText, onSuccess, defaultTab, children, className, }: FullPageLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SplitPageLayoutProps {
|
|
3
|
+
/** Brand name or logo text displayed on the left panel */
|
|
4
|
+
brandName?: string;
|
|
5
|
+
/** Brand logo element (replaces default logo) */
|
|
6
|
+
brandLogo?: ReactNode;
|
|
7
|
+
/** Tagline displayed below the brand name */
|
|
8
|
+
tagline?: string;
|
|
9
|
+
/** Title displayed above the form. @default "Sign in" */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Subtitle displayed below the title */
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
/** Called when login/register succeeds */
|
|
14
|
+
onSuccess?: () => void;
|
|
15
|
+
/** Default tab for the form. @default "login" */
|
|
16
|
+
defaultTab?: 'login' | 'register';
|
|
17
|
+
/** Custom content to render instead of LoginForm */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/** Additional CSS class for the outer container */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Split page login layout with branding on the left and form on the right.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* // Basic usage
|
|
28
|
+
* <SplitPageLayout
|
|
29
|
+
* brandName="MyApp"
|
|
30
|
+
* tagline="The best app for everything"
|
|
31
|
+
* onSuccess={() => navigate('/dashboard')}
|
|
32
|
+
* />
|
|
33
|
+
*
|
|
34
|
+
* // With custom logo
|
|
35
|
+
* <SplitPageLayout
|
|
36
|
+
* brandLogo={<img src="/logo.svg" alt="MyApp" />}
|
|
37
|
+
* brandName="MyApp"
|
|
38
|
+
* tagline="Enterprise-grade solutions"
|
|
39
|
+
* title="Welcome back"
|
|
40
|
+
* subtitle="Sign in to continue"
|
|
41
|
+
* />
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function SplitPageLayout({ brandName, brandLogo, tagline, title, subtitle, onSuccess, defaultTab, children, className, }: SplitPageLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OTP Input component (shadcn-style)
|
|
3
|
+
*
|
|
4
|
+
* A 6-digit input with separate boxes for each digit,
|
|
5
|
+
* designed for TOTP verification codes.
|
|
6
|
+
*/
|
|
7
|
+
export interface OtpInputProps {
|
|
8
|
+
/** Current value (up to 6 digits) */
|
|
9
|
+
value?: string;
|
|
10
|
+
/** Called when the value changes */
|
|
11
|
+
onChange?: (value: string) => void;
|
|
12
|
+
/** Called when all 6 digits are entered */
|
|
13
|
+
onComplete?: (value: string) => void;
|
|
14
|
+
/** Whether the input is disabled */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Error message to display */
|
|
17
|
+
error?: string;
|
|
18
|
+
/** Auto-focus the first input on mount */
|
|
19
|
+
autoFocus?: boolean;
|
|
20
|
+
/** Additional CSS class */
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* OTP input with separate boxes for each digit (shadcn pattern)
|
|
25
|
+
*
|
|
26
|
+
* Features:
|
|
27
|
+
* - Auto-advances to next input on digit entry
|
|
28
|
+
* - Backspace moves to previous input
|
|
29
|
+
* - Supports paste of full code
|
|
30
|
+
* - Numeric keyboard on mobile
|
|
31
|
+
*/
|
|
32
|
+
export declare function OtpInput({ value, onChange, onComplete, disabled, error, autoFocus, className, }: OtpInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QR Code component for TOTP setup
|
|
3
|
+
*
|
|
4
|
+
* Generates QR codes client-side using the qrcode library.
|
|
5
|
+
* SECURITY: Never sends the TOTP secret to external services.
|
|
6
|
+
*/
|
|
7
|
+
export interface QrCodeProps {
|
|
8
|
+
/** The data to encode in the QR code (e.g., otpauth:// URL) */
|
|
9
|
+
value: string;
|
|
10
|
+
/** Size in pixels (width and height) */
|
|
11
|
+
size?: number;
|
|
12
|
+
/** Alt text for accessibility */
|
|
13
|
+
alt?: string;
|
|
14
|
+
/** Additional CSS class */
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Renders a QR code as a canvas element.
|
|
19
|
+
* Generated entirely client-side for security.
|
|
20
|
+
*/
|
|
21
|
+
export declare function QrCode({ value, size, alt, className }: QrCodeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TOTP Settings component for managing two-factor authentication
|
|
3
|
+
*
|
|
4
|
+
* Allows users to:
|
|
5
|
+
* - View current 2FA status
|
|
6
|
+
* - Enable 2FA (via TotpSetup wizard)
|
|
7
|
+
* - Disable 2FA (requires verification)
|
|
8
|
+
* - Regenerate backup codes
|
|
9
|
+
*/
|
|
10
|
+
export interface TotpSettingsProps {
|
|
11
|
+
/** Called when 2FA status changes */
|
|
12
|
+
onStatusChange?: (enabled: boolean) => void;
|
|
13
|
+
/** Additional CSS class */
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Two-factor authentication settings panel.
|
|
18
|
+
*
|
|
19
|
+
* Shows current 2FA status and provides controls for
|
|
20
|
+
* enabling, disabling, and managing backup codes.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* function SecuritySettings() {
|
|
25
|
+
* return (
|
|
26
|
+
* <div>
|
|
27
|
+
* <h2>Security</h2>
|
|
28
|
+
* <TotpSettings
|
|
29
|
+
* onStatusChange={(enabled) => {
|
|
30
|
+
* console.log('2FA is now', enabled ? 'enabled' : 'disabled');
|
|
31
|
+
* }}
|
|
32
|
+
* />
|
|
33
|
+
* </div>
|
|
34
|
+
* );
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function TotpSettings({ onStatusChange, className }: TotpSettingsProps): import("react/jsx-runtime").JSX.Element;
|