azirid-react 0.8.0 → 0.9.0
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/index.cjs +467 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +214 -2
- package/dist/index.d.ts +214 -2
- package/dist/index.js +462 -5
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSProperties, ReactNode, FormEvent } from 'react';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { UseMutationResult, UseQueryResult } from '@tanstack/react-query';
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -127,6 +127,14 @@ interface AccessMessages {
|
|
|
127
127
|
cancel: string;
|
|
128
128
|
processing: string;
|
|
129
129
|
};
|
|
130
|
+
navigation: {
|
|
131
|
+
noAccountText: string;
|
|
132
|
+
signUpLink: string;
|
|
133
|
+
hasAccountText: string;
|
|
134
|
+
signInLink: string;
|
|
135
|
+
forgotPassword: string;
|
|
136
|
+
backToLogin: string;
|
|
137
|
+
};
|
|
130
138
|
validation: {
|
|
131
139
|
emailRequired: string;
|
|
132
140
|
emailInvalid: string;
|
|
@@ -360,6 +368,101 @@ interface SignupFormProps {
|
|
|
360
368
|
confirmPasswordPlaceholder?: string;
|
|
361
369
|
};
|
|
362
370
|
}
|
|
371
|
+
type AuthView = 'login' | 'signup' | 'forgot-password' | 'reset-password';
|
|
372
|
+
interface ForgotPasswordFormProps {
|
|
373
|
+
/** Override the default onSubmit */
|
|
374
|
+
onSubmit?: (data: {
|
|
375
|
+
email: string;
|
|
376
|
+
}) => void | Promise<void>;
|
|
377
|
+
/** Custom Zod schema for validation */
|
|
378
|
+
schema?: z.ZodType;
|
|
379
|
+
/** Show a loading spinner / disable the form */
|
|
380
|
+
isLoading?: boolean;
|
|
381
|
+
/** Error message to display */
|
|
382
|
+
error?: string | null;
|
|
383
|
+
/** Custom class name for the root element */
|
|
384
|
+
className?: string;
|
|
385
|
+
/** Inline styles for the root element */
|
|
386
|
+
style?: CSSProperties;
|
|
387
|
+
/** Title displayed above the form */
|
|
388
|
+
title?: string;
|
|
389
|
+
/** Subtitle / description below the title */
|
|
390
|
+
description?: string;
|
|
391
|
+
/** Logo or branding element rendered above the card */
|
|
392
|
+
logo?: ReactNode;
|
|
393
|
+
/** Text for the submit button */
|
|
394
|
+
submitText?: string;
|
|
395
|
+
/** Render a footer below the form */
|
|
396
|
+
footer?: ReactNode;
|
|
397
|
+
/** Pre-fill the form fields */
|
|
398
|
+
defaultValues?: {
|
|
399
|
+
email?: string;
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
interface ResetPasswordFormProps {
|
|
403
|
+
/** Token from the reset URL */
|
|
404
|
+
token: string;
|
|
405
|
+
/** Override the default onSubmit */
|
|
406
|
+
onSubmit?: (data: {
|
|
407
|
+
token: string;
|
|
408
|
+
newPassword: string;
|
|
409
|
+
}) => void | Promise<void>;
|
|
410
|
+
/** Custom Zod schema for validation */
|
|
411
|
+
schema?: z.ZodType;
|
|
412
|
+
/** Show a loading spinner / disable the form */
|
|
413
|
+
isLoading?: boolean;
|
|
414
|
+
/** Error message to display */
|
|
415
|
+
error?: string | null;
|
|
416
|
+
/** Custom class name for the root element */
|
|
417
|
+
className?: string;
|
|
418
|
+
/** Inline styles for the root element */
|
|
419
|
+
style?: CSSProperties;
|
|
420
|
+
/** Title displayed above the form */
|
|
421
|
+
title?: string;
|
|
422
|
+
/** Subtitle / description below the title */
|
|
423
|
+
description?: string;
|
|
424
|
+
/** Logo or branding element rendered above the card */
|
|
425
|
+
logo?: ReactNode;
|
|
426
|
+
/** Text for the submit button */
|
|
427
|
+
submitText?: string;
|
|
428
|
+
/** Render a footer below the form */
|
|
429
|
+
footer?: ReactNode;
|
|
430
|
+
/** Callback on successful password reset */
|
|
431
|
+
onSuccess?: () => void;
|
|
432
|
+
}
|
|
433
|
+
interface AuthFormProps {
|
|
434
|
+
/** Controlled view (parent manages state) */
|
|
435
|
+
view?: AuthView;
|
|
436
|
+
/** Callback when navigation links are clicked (controlled mode) */
|
|
437
|
+
onViewChange?: (view: AuthView) => void;
|
|
438
|
+
/** Initial view for uncontrolled mode (default: 'login') */
|
|
439
|
+
defaultView?: AuthView;
|
|
440
|
+
/** Custom class name for the root element */
|
|
441
|
+
className?: string;
|
|
442
|
+
/** Inline styles for the root element */
|
|
443
|
+
style?: CSSProperties;
|
|
444
|
+
/** Logo or branding element rendered above the card */
|
|
445
|
+
logo?: ReactNode;
|
|
446
|
+
/** Show SSO buttons on login/signup (default: true) */
|
|
447
|
+
showSocialButtons?: boolean;
|
|
448
|
+
/** Hide navigation links between views */
|
|
449
|
+
hideNavigation?: boolean;
|
|
450
|
+
/** Token for reset-password view */
|
|
451
|
+
resetToken?: string;
|
|
452
|
+
/** Default form values passed to child forms */
|
|
453
|
+
defaultValues?: {
|
|
454
|
+
email?: string;
|
|
455
|
+
password?: string;
|
|
456
|
+
};
|
|
457
|
+
/** Props forwarded to LoginForm */
|
|
458
|
+
loginProps?: Omit<LoginFormProps, 'className' | 'style' | 'logo' | 'showSocialButtons' | 'footer' | 'forgotPassword'>;
|
|
459
|
+
/** Props forwarded to SignupForm */
|
|
460
|
+
signupProps?: Omit<SignupFormProps, 'className' | 'style' | 'logo' | 'showSocialButtons' | 'footer'>;
|
|
461
|
+
/** Props forwarded to ForgotPasswordForm */
|
|
462
|
+
forgotPasswordProps?: Omit<ForgotPasswordFormProps, 'className' | 'style' | 'logo' | 'footer'>;
|
|
463
|
+
/** Props forwarded to ResetPasswordForm */
|
|
464
|
+
resetPasswordProps?: Omit<ResetPasswordFormProps, 'className' | 'style' | 'logo' | 'footer' | 'token'>;
|
|
465
|
+
}
|
|
363
466
|
interface FieldError {
|
|
364
467
|
field: string;
|
|
365
468
|
message: string;
|
|
@@ -535,6 +638,15 @@ declare const LoginForm: react.ForwardRefExoticComponent<LoginFormProps & react.
|
|
|
535
638
|
|
|
536
639
|
declare const SignupForm: react.ForwardRefExoticComponent<SignupFormProps & react.RefAttributes<HTMLFormElement>>;
|
|
537
640
|
|
|
641
|
+
declare const ForgotPasswordForm: react.ForwardRefExoticComponent<ForgotPasswordFormProps & react.RefAttributes<HTMLFormElement>>;
|
|
642
|
+
|
|
643
|
+
declare const ResetPasswordForm: react.ForwardRefExoticComponent<ResetPasswordFormProps & react.RefAttributes<HTMLFormElement>>;
|
|
644
|
+
|
|
645
|
+
declare function AuthForm({ view: controlledView, onViewChange, defaultView, className, style, logo, showSocialButtons, hideNavigation, resetToken, defaultValues, loginProps, signupProps, forgotPasswordProps, resetPasswordProps, }: AuthFormProps): react_jsx_runtime.JSX.Element;
|
|
646
|
+
declare namespace AuthForm {
|
|
647
|
+
var displayName: string;
|
|
648
|
+
}
|
|
649
|
+
|
|
538
650
|
interface ReferralCardProps {
|
|
539
651
|
className?: string;
|
|
540
652
|
style?: CSSProperties;
|
|
@@ -657,6 +769,8 @@ declare const SUFFIXES: {
|
|
|
657
769
|
readonly submitTransferProof: "billing/transfer-proof";
|
|
658
770
|
readonly transferProofs: "billing/transfer-proofs";
|
|
659
771
|
readonly payphoneConfirm: "billing/payphone/confirm";
|
|
772
|
+
readonly passwordResetRequest: "password/reset/request";
|
|
773
|
+
readonly passwordResetConfirm: "password/reset/confirm";
|
|
660
774
|
readonly referralMe: "referrals/me";
|
|
661
775
|
readonly referralStats: "referrals/stats";
|
|
662
776
|
readonly userTenants: "tenants";
|
|
@@ -1443,6 +1557,46 @@ declare function useSwitchTenant(): {
|
|
|
1443
1557
|
switchTenant: (tenantId: string) => Promise<void>;
|
|
1444
1558
|
};
|
|
1445
1559
|
|
|
1560
|
+
interface PasswordResetRequestData {
|
|
1561
|
+
email: string;
|
|
1562
|
+
}
|
|
1563
|
+
interface PasswordResetConfirmData {
|
|
1564
|
+
token: string;
|
|
1565
|
+
newPassword: string;
|
|
1566
|
+
}
|
|
1567
|
+
interface UsePasswordResetOptions {
|
|
1568
|
+
/** Callback after reset email sent */
|
|
1569
|
+
onRequestSuccess?: () => void;
|
|
1570
|
+
/** Callback after password successfully reset */
|
|
1571
|
+
onConfirmSuccess?: () => void;
|
|
1572
|
+
/** Callback on error */
|
|
1573
|
+
onError?: (error: Error) => void;
|
|
1574
|
+
}
|
|
1575
|
+
interface UsePasswordResetReturn {
|
|
1576
|
+
/** Request a password reset email */
|
|
1577
|
+
request: UseMutationResult<unknown, Error, PasswordResetRequestData>;
|
|
1578
|
+
/** Confirm the password reset with token + new password */
|
|
1579
|
+
confirm: UseMutationResult<unknown, Error, PasswordResetConfirmData>;
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* Standalone hook for password reset flow. Requires `<AziridProvider>`.
|
|
1583
|
+
*
|
|
1584
|
+
* @example
|
|
1585
|
+
* ```tsx
|
|
1586
|
+
* const passwordReset = usePasswordReset({
|
|
1587
|
+
* onRequestSuccess: () => toast.success("Check your email"),
|
|
1588
|
+
* onConfirmSuccess: () => router.push("/login"),
|
|
1589
|
+
* });
|
|
1590
|
+
*
|
|
1591
|
+
* // Step 1: request reset
|
|
1592
|
+
* passwordReset.request.mutate({ email: "user@test.com" });
|
|
1593
|
+
*
|
|
1594
|
+
* // Step 2: confirm with token from URL
|
|
1595
|
+
* passwordReset.confirm.mutate({ token: "abc", newPassword: "newPass123!" });
|
|
1596
|
+
* ```
|
|
1597
|
+
*/
|
|
1598
|
+
declare function usePasswordReset(options?: UsePasswordResetOptions): UsePasswordResetReturn;
|
|
1599
|
+
|
|
1446
1600
|
/**
|
|
1447
1601
|
* Options common to all simple mutation hooks created via `createMutationHook`.
|
|
1448
1602
|
*/
|
|
@@ -1613,6 +1767,64 @@ declare const socialLoginSchema: z.ZodObject<{
|
|
|
1613
1767
|
turnstileToken?: string | undefined;
|
|
1614
1768
|
}>;
|
|
1615
1769
|
type SocialLoginInput = z.infer<typeof socialLoginSchema>;
|
|
1770
|
+
declare function createForgotPasswordSchema(v: AccessMessages['validation']): z.ZodObject<{
|
|
1771
|
+
email: z.ZodString;
|
|
1772
|
+
}, "strip", z.ZodTypeAny, {
|
|
1773
|
+
email: string;
|
|
1774
|
+
}, {
|
|
1775
|
+
email: string;
|
|
1776
|
+
}>;
|
|
1777
|
+
declare const forgotPasswordSchema: z.ZodObject<{
|
|
1778
|
+
email: z.ZodString;
|
|
1779
|
+
}, "strip", z.ZodTypeAny, {
|
|
1780
|
+
email: string;
|
|
1781
|
+
}, {
|
|
1782
|
+
email: string;
|
|
1783
|
+
}>;
|
|
1784
|
+
type ForgotPasswordInput = z.infer<typeof forgotPasswordSchema>;
|
|
1785
|
+
declare function createResetPasswordConfirmSchema(v: AccessMessages['validation']): z.ZodEffects<z.ZodObject<{
|
|
1786
|
+
token: z.ZodString;
|
|
1787
|
+
newPassword: z.ZodString;
|
|
1788
|
+
confirmPassword: z.ZodString;
|
|
1789
|
+
}, "strip", z.ZodTypeAny, {
|
|
1790
|
+
token: string;
|
|
1791
|
+
newPassword: string;
|
|
1792
|
+
confirmPassword: string;
|
|
1793
|
+
}, {
|
|
1794
|
+
token: string;
|
|
1795
|
+
newPassword: string;
|
|
1796
|
+
confirmPassword: string;
|
|
1797
|
+
}>, {
|
|
1798
|
+
token: string;
|
|
1799
|
+
newPassword: string;
|
|
1800
|
+
confirmPassword: string;
|
|
1801
|
+
}, {
|
|
1802
|
+
token: string;
|
|
1803
|
+
newPassword: string;
|
|
1804
|
+
confirmPassword: string;
|
|
1805
|
+
}>;
|
|
1806
|
+
declare const resetPasswordConfirmSchema: z.ZodEffects<z.ZodObject<{
|
|
1807
|
+
token: z.ZodString;
|
|
1808
|
+
newPassword: z.ZodString;
|
|
1809
|
+
confirmPassword: z.ZodString;
|
|
1810
|
+
}, "strip", z.ZodTypeAny, {
|
|
1811
|
+
token: string;
|
|
1812
|
+
newPassword: string;
|
|
1813
|
+
confirmPassword: string;
|
|
1814
|
+
}, {
|
|
1815
|
+
token: string;
|
|
1816
|
+
newPassword: string;
|
|
1817
|
+
confirmPassword: string;
|
|
1818
|
+
}>, {
|
|
1819
|
+
token: string;
|
|
1820
|
+
newPassword: string;
|
|
1821
|
+
confirmPassword: string;
|
|
1822
|
+
}, {
|
|
1823
|
+
token: string;
|
|
1824
|
+
newPassword: string;
|
|
1825
|
+
confirmPassword: string;
|
|
1826
|
+
}>;
|
|
1827
|
+
type ResetPasswordConfirmInput = z.infer<typeof resetPasswordConfirmSchema>;
|
|
1616
1828
|
declare const passkeyRegisterStartSchema: z.ZodObject<{
|
|
1617
1829
|
deviceName: z.ZodOptional<z.ZodString>;
|
|
1618
1830
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1675,4 +1887,4 @@ interface SessionSyncOptions {
|
|
|
1675
1887
|
|
|
1676
1888
|
declare const SDK_VERSION: string;
|
|
1677
1889
|
|
|
1678
|
-
export { type AccessClient, type AccessClientConfig, type AccessMessages, type ApiError, type AppBranding, type AuthPaths, type AuthState, type AuthSuccessResponse, type AuthUser, type AvailableProvider, type AziridContextValue, AziridProvider, type AziridProviderProps, BASE_PATHS, type BillingInvoice, type BillingPlan, type BootstrapResponse, type ChangePasswordData, type ChangePasswordInput, CheckoutButton, type CheckoutButtonProps, type CheckoutParams, type CheckoutResponse, type CreateTenantData, type FieldError, InvoiceList, type InvoiceListProps, type LoginData, LoginForm, type LoginFormProps, type LoginInput, type MagicLinkRequestData, type MagicLinkRequestInput, type MagicLinkVerifyData, type MagicLinkVerifyInput, type MutationHookConfig, PATHS, type PasskeyItem, type PasskeyLoginData, type PasskeyLoginStartData, type PasskeyLoginStartResponse, type PasskeyLoginVerifyData, type PasskeyRegisterStartData, type PasskeyRegisterStartInput, type PasskeyRegisterStartResponse, type PasskeyRegisterVerifyData, PayButton, type PayButtonProps, type PaymentIntent, type PaymentProviderType, PayphoneCallback, type PayphoneCallbackProps, type PayphoneConfirmParams, type PayphoneConfirmResult, type PayphoneModalProps, type PayphoneWidgetConfig, type PricingCardProps, type PricingFeatureListProps, PricingTable, type PricingTableProps, type ProviderModalProps, ReferralCard, type ReferralCardProps, type ReferralInfo, type ReferralItem, ReferralStats, type ReferralStatsData, type ReferralStatsProps, type RegisterPasskeyData, SDK_VERSION, type SessionSyncOptions, type SignupData, SignupForm, type SignupFormProps, type SignupInput, type SimpleMutationOptions, type SocialLoginData, type SocialLoginInput, type SubmitTransferProofData, SubscriptionBadge, type SubscriptionBadgeProps, type SupportedLocale, type TenantMemberInfo, type TenantWithRole, type TransferModalProps, type TransferProof, type UseBootstrapOptions, type UseBootstrapReturn, type UseChangePasswordOptions, type UseChangePasswordReturn, type UseCheckoutOptions, type UseFormReturn, type UseLoginOptions, type UseLoginReturn, type UseLogoutOptions, type UseLogoutReturn, type UseMagicLinkOptions, type UseMagicLinkReturn, type UsePasskeysOptions, type UsePasskeysReturn, type UsePayphoneConfirmOptions, type UseRefreshOptions, type UseRefreshReturn, type UseSessionOptions, type UseSessionReturn, type UseSignupOptions, type UseSignupReturn, type UseSocialLoginOptions, type UseSocialLoginReturn, type UserSubscription, buildPaths, changePasswordSchema, cn, createAccessClient, createLoginSchema, createMutationHook, createSignupSchema, en, es, isAuthError, loginSchema, magicLinkRequestSchema, magicLinkVerifySchema, passkeyRegisterStartSchema, removeStyles, resolveMessages, signupSchema, socialLoginSchema, useAccessClient, useAzirid, useBootstrap, useBranding, useChangePassword, useCheckout, useFormState, useInvoices, useLogin, useLogout, useMagicLink, useMessages, usePasskeys, usePasswordToggle, usePaymentProviders, usePayphoneConfirm, usePlans, useReferral, useReferralStats, useRefresh, useSession, useSignup, useSocialLogin, useSubmitTransferProof, useSubscription, useSwitchTenant, useTenantMembers, useTenants, useTransferProofs };
|
|
1890
|
+
export { type AccessClient, type AccessClientConfig, type AccessMessages, type ApiError, type AppBranding, AuthForm, type AuthFormProps, type AuthPaths, type AuthState, type AuthSuccessResponse, type AuthUser, type AuthView, type AvailableProvider, type AziridContextValue, AziridProvider, type AziridProviderProps, BASE_PATHS, type BillingInvoice, type BillingPlan, type BootstrapResponse, type ChangePasswordData, type ChangePasswordInput, CheckoutButton, type CheckoutButtonProps, type CheckoutParams, type CheckoutResponse, type CreateTenantData, type FieldError, ForgotPasswordForm, type ForgotPasswordFormProps, type ForgotPasswordInput, InvoiceList, type InvoiceListProps, type LoginData, LoginForm, type LoginFormProps, type LoginInput, type MagicLinkRequestData, type MagicLinkRequestInput, type MagicLinkVerifyData, type MagicLinkVerifyInput, type MutationHookConfig, PATHS, type PasskeyItem, type PasskeyLoginData, type PasskeyLoginStartData, type PasskeyLoginStartResponse, type PasskeyLoginVerifyData, type PasskeyRegisterStartData, type PasskeyRegisterStartInput, type PasskeyRegisterStartResponse, type PasskeyRegisterVerifyData, type PasswordResetConfirmData, type PasswordResetRequestData, PayButton, type PayButtonProps, type PaymentIntent, type PaymentProviderType, PayphoneCallback, type PayphoneCallbackProps, type PayphoneConfirmParams, type PayphoneConfirmResult, type PayphoneModalProps, type PayphoneWidgetConfig, type PricingCardProps, type PricingFeatureListProps, PricingTable, type PricingTableProps, type ProviderModalProps, ReferralCard, type ReferralCardProps, type ReferralInfo, type ReferralItem, ReferralStats, type ReferralStatsData, type ReferralStatsProps, type RegisterPasskeyData, type ResetPasswordConfirmInput, ResetPasswordForm, type ResetPasswordFormProps, SDK_VERSION, type SessionSyncOptions, type SignupData, SignupForm, type SignupFormProps, type SignupInput, type SimpleMutationOptions, type SocialLoginData, type SocialLoginInput, type SubmitTransferProofData, SubscriptionBadge, type SubscriptionBadgeProps, type SupportedLocale, type TenantMemberInfo, type TenantWithRole, type TransferModalProps, type TransferProof, type UseBootstrapOptions, type UseBootstrapReturn, type UseChangePasswordOptions, type UseChangePasswordReturn, type UseCheckoutOptions, type UseFormReturn, type UseLoginOptions, type UseLoginReturn, type UseLogoutOptions, type UseLogoutReturn, type UseMagicLinkOptions, type UseMagicLinkReturn, type UsePasskeysOptions, type UsePasskeysReturn, type UsePasswordResetOptions, type UsePasswordResetReturn, type UsePayphoneConfirmOptions, type UseRefreshOptions, type UseRefreshReturn, type UseSessionOptions, type UseSessionReturn, type UseSignupOptions, type UseSignupReturn, type UseSocialLoginOptions, type UseSocialLoginReturn, type UserSubscription, buildPaths, changePasswordSchema, cn, createAccessClient, createForgotPasswordSchema, createLoginSchema, createMutationHook, createResetPasswordConfirmSchema, createSignupSchema, en, es, forgotPasswordSchema, isAuthError, loginSchema, magicLinkRequestSchema, magicLinkVerifySchema, passkeyRegisterStartSchema, removeStyles, resetPasswordConfirmSchema, resolveMessages, signupSchema, socialLoginSchema, useAccessClient, useAzirid, useBootstrap, useBranding, useChangePassword, useCheckout, useFormState, useInvoices, useLogin, useLogout, useMagicLink, useMessages, usePasskeys, usePasswordReset, usePasswordToggle, usePaymentProviders, usePayphoneConfirm, usePlans, useReferral, useReferralStats, useRefresh, useSession, useSignup, useSocialLogin, useSubmitTransferProof, useSubscription, useSwitchTenant, useTenantMembers, useTenants, useTransferProofs };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSProperties, ReactNode, FormEvent } from 'react';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { UseMutationResult, UseQueryResult } from '@tanstack/react-query';
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -127,6 +127,14 @@ interface AccessMessages {
|
|
|
127
127
|
cancel: string;
|
|
128
128
|
processing: string;
|
|
129
129
|
};
|
|
130
|
+
navigation: {
|
|
131
|
+
noAccountText: string;
|
|
132
|
+
signUpLink: string;
|
|
133
|
+
hasAccountText: string;
|
|
134
|
+
signInLink: string;
|
|
135
|
+
forgotPassword: string;
|
|
136
|
+
backToLogin: string;
|
|
137
|
+
};
|
|
130
138
|
validation: {
|
|
131
139
|
emailRequired: string;
|
|
132
140
|
emailInvalid: string;
|
|
@@ -360,6 +368,101 @@ interface SignupFormProps {
|
|
|
360
368
|
confirmPasswordPlaceholder?: string;
|
|
361
369
|
};
|
|
362
370
|
}
|
|
371
|
+
type AuthView = 'login' | 'signup' | 'forgot-password' | 'reset-password';
|
|
372
|
+
interface ForgotPasswordFormProps {
|
|
373
|
+
/** Override the default onSubmit */
|
|
374
|
+
onSubmit?: (data: {
|
|
375
|
+
email: string;
|
|
376
|
+
}) => void | Promise<void>;
|
|
377
|
+
/** Custom Zod schema for validation */
|
|
378
|
+
schema?: z.ZodType;
|
|
379
|
+
/** Show a loading spinner / disable the form */
|
|
380
|
+
isLoading?: boolean;
|
|
381
|
+
/** Error message to display */
|
|
382
|
+
error?: string | null;
|
|
383
|
+
/** Custom class name for the root element */
|
|
384
|
+
className?: string;
|
|
385
|
+
/** Inline styles for the root element */
|
|
386
|
+
style?: CSSProperties;
|
|
387
|
+
/** Title displayed above the form */
|
|
388
|
+
title?: string;
|
|
389
|
+
/** Subtitle / description below the title */
|
|
390
|
+
description?: string;
|
|
391
|
+
/** Logo or branding element rendered above the card */
|
|
392
|
+
logo?: ReactNode;
|
|
393
|
+
/** Text for the submit button */
|
|
394
|
+
submitText?: string;
|
|
395
|
+
/** Render a footer below the form */
|
|
396
|
+
footer?: ReactNode;
|
|
397
|
+
/** Pre-fill the form fields */
|
|
398
|
+
defaultValues?: {
|
|
399
|
+
email?: string;
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
interface ResetPasswordFormProps {
|
|
403
|
+
/** Token from the reset URL */
|
|
404
|
+
token: string;
|
|
405
|
+
/** Override the default onSubmit */
|
|
406
|
+
onSubmit?: (data: {
|
|
407
|
+
token: string;
|
|
408
|
+
newPassword: string;
|
|
409
|
+
}) => void | Promise<void>;
|
|
410
|
+
/** Custom Zod schema for validation */
|
|
411
|
+
schema?: z.ZodType;
|
|
412
|
+
/** Show a loading spinner / disable the form */
|
|
413
|
+
isLoading?: boolean;
|
|
414
|
+
/** Error message to display */
|
|
415
|
+
error?: string | null;
|
|
416
|
+
/** Custom class name for the root element */
|
|
417
|
+
className?: string;
|
|
418
|
+
/** Inline styles for the root element */
|
|
419
|
+
style?: CSSProperties;
|
|
420
|
+
/** Title displayed above the form */
|
|
421
|
+
title?: string;
|
|
422
|
+
/** Subtitle / description below the title */
|
|
423
|
+
description?: string;
|
|
424
|
+
/** Logo or branding element rendered above the card */
|
|
425
|
+
logo?: ReactNode;
|
|
426
|
+
/** Text for the submit button */
|
|
427
|
+
submitText?: string;
|
|
428
|
+
/** Render a footer below the form */
|
|
429
|
+
footer?: ReactNode;
|
|
430
|
+
/** Callback on successful password reset */
|
|
431
|
+
onSuccess?: () => void;
|
|
432
|
+
}
|
|
433
|
+
interface AuthFormProps {
|
|
434
|
+
/** Controlled view (parent manages state) */
|
|
435
|
+
view?: AuthView;
|
|
436
|
+
/** Callback when navigation links are clicked (controlled mode) */
|
|
437
|
+
onViewChange?: (view: AuthView) => void;
|
|
438
|
+
/** Initial view for uncontrolled mode (default: 'login') */
|
|
439
|
+
defaultView?: AuthView;
|
|
440
|
+
/** Custom class name for the root element */
|
|
441
|
+
className?: string;
|
|
442
|
+
/** Inline styles for the root element */
|
|
443
|
+
style?: CSSProperties;
|
|
444
|
+
/** Logo or branding element rendered above the card */
|
|
445
|
+
logo?: ReactNode;
|
|
446
|
+
/** Show SSO buttons on login/signup (default: true) */
|
|
447
|
+
showSocialButtons?: boolean;
|
|
448
|
+
/** Hide navigation links between views */
|
|
449
|
+
hideNavigation?: boolean;
|
|
450
|
+
/** Token for reset-password view */
|
|
451
|
+
resetToken?: string;
|
|
452
|
+
/** Default form values passed to child forms */
|
|
453
|
+
defaultValues?: {
|
|
454
|
+
email?: string;
|
|
455
|
+
password?: string;
|
|
456
|
+
};
|
|
457
|
+
/** Props forwarded to LoginForm */
|
|
458
|
+
loginProps?: Omit<LoginFormProps, 'className' | 'style' | 'logo' | 'showSocialButtons' | 'footer' | 'forgotPassword'>;
|
|
459
|
+
/** Props forwarded to SignupForm */
|
|
460
|
+
signupProps?: Omit<SignupFormProps, 'className' | 'style' | 'logo' | 'showSocialButtons' | 'footer'>;
|
|
461
|
+
/** Props forwarded to ForgotPasswordForm */
|
|
462
|
+
forgotPasswordProps?: Omit<ForgotPasswordFormProps, 'className' | 'style' | 'logo' | 'footer'>;
|
|
463
|
+
/** Props forwarded to ResetPasswordForm */
|
|
464
|
+
resetPasswordProps?: Omit<ResetPasswordFormProps, 'className' | 'style' | 'logo' | 'footer' | 'token'>;
|
|
465
|
+
}
|
|
363
466
|
interface FieldError {
|
|
364
467
|
field: string;
|
|
365
468
|
message: string;
|
|
@@ -535,6 +638,15 @@ declare const LoginForm: react.ForwardRefExoticComponent<LoginFormProps & react.
|
|
|
535
638
|
|
|
536
639
|
declare const SignupForm: react.ForwardRefExoticComponent<SignupFormProps & react.RefAttributes<HTMLFormElement>>;
|
|
537
640
|
|
|
641
|
+
declare const ForgotPasswordForm: react.ForwardRefExoticComponent<ForgotPasswordFormProps & react.RefAttributes<HTMLFormElement>>;
|
|
642
|
+
|
|
643
|
+
declare const ResetPasswordForm: react.ForwardRefExoticComponent<ResetPasswordFormProps & react.RefAttributes<HTMLFormElement>>;
|
|
644
|
+
|
|
645
|
+
declare function AuthForm({ view: controlledView, onViewChange, defaultView, className, style, logo, showSocialButtons, hideNavigation, resetToken, defaultValues, loginProps, signupProps, forgotPasswordProps, resetPasswordProps, }: AuthFormProps): react_jsx_runtime.JSX.Element;
|
|
646
|
+
declare namespace AuthForm {
|
|
647
|
+
var displayName: string;
|
|
648
|
+
}
|
|
649
|
+
|
|
538
650
|
interface ReferralCardProps {
|
|
539
651
|
className?: string;
|
|
540
652
|
style?: CSSProperties;
|
|
@@ -657,6 +769,8 @@ declare const SUFFIXES: {
|
|
|
657
769
|
readonly submitTransferProof: "billing/transfer-proof";
|
|
658
770
|
readonly transferProofs: "billing/transfer-proofs";
|
|
659
771
|
readonly payphoneConfirm: "billing/payphone/confirm";
|
|
772
|
+
readonly passwordResetRequest: "password/reset/request";
|
|
773
|
+
readonly passwordResetConfirm: "password/reset/confirm";
|
|
660
774
|
readonly referralMe: "referrals/me";
|
|
661
775
|
readonly referralStats: "referrals/stats";
|
|
662
776
|
readonly userTenants: "tenants";
|
|
@@ -1443,6 +1557,46 @@ declare function useSwitchTenant(): {
|
|
|
1443
1557
|
switchTenant: (tenantId: string) => Promise<void>;
|
|
1444
1558
|
};
|
|
1445
1559
|
|
|
1560
|
+
interface PasswordResetRequestData {
|
|
1561
|
+
email: string;
|
|
1562
|
+
}
|
|
1563
|
+
interface PasswordResetConfirmData {
|
|
1564
|
+
token: string;
|
|
1565
|
+
newPassword: string;
|
|
1566
|
+
}
|
|
1567
|
+
interface UsePasswordResetOptions {
|
|
1568
|
+
/** Callback after reset email sent */
|
|
1569
|
+
onRequestSuccess?: () => void;
|
|
1570
|
+
/** Callback after password successfully reset */
|
|
1571
|
+
onConfirmSuccess?: () => void;
|
|
1572
|
+
/** Callback on error */
|
|
1573
|
+
onError?: (error: Error) => void;
|
|
1574
|
+
}
|
|
1575
|
+
interface UsePasswordResetReturn {
|
|
1576
|
+
/** Request a password reset email */
|
|
1577
|
+
request: UseMutationResult<unknown, Error, PasswordResetRequestData>;
|
|
1578
|
+
/** Confirm the password reset with token + new password */
|
|
1579
|
+
confirm: UseMutationResult<unknown, Error, PasswordResetConfirmData>;
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* Standalone hook for password reset flow. Requires `<AziridProvider>`.
|
|
1583
|
+
*
|
|
1584
|
+
* @example
|
|
1585
|
+
* ```tsx
|
|
1586
|
+
* const passwordReset = usePasswordReset({
|
|
1587
|
+
* onRequestSuccess: () => toast.success("Check your email"),
|
|
1588
|
+
* onConfirmSuccess: () => router.push("/login"),
|
|
1589
|
+
* });
|
|
1590
|
+
*
|
|
1591
|
+
* // Step 1: request reset
|
|
1592
|
+
* passwordReset.request.mutate({ email: "user@test.com" });
|
|
1593
|
+
*
|
|
1594
|
+
* // Step 2: confirm with token from URL
|
|
1595
|
+
* passwordReset.confirm.mutate({ token: "abc", newPassword: "newPass123!" });
|
|
1596
|
+
* ```
|
|
1597
|
+
*/
|
|
1598
|
+
declare function usePasswordReset(options?: UsePasswordResetOptions): UsePasswordResetReturn;
|
|
1599
|
+
|
|
1446
1600
|
/**
|
|
1447
1601
|
* Options common to all simple mutation hooks created via `createMutationHook`.
|
|
1448
1602
|
*/
|
|
@@ -1613,6 +1767,64 @@ declare const socialLoginSchema: z.ZodObject<{
|
|
|
1613
1767
|
turnstileToken?: string | undefined;
|
|
1614
1768
|
}>;
|
|
1615
1769
|
type SocialLoginInput = z.infer<typeof socialLoginSchema>;
|
|
1770
|
+
declare function createForgotPasswordSchema(v: AccessMessages['validation']): z.ZodObject<{
|
|
1771
|
+
email: z.ZodString;
|
|
1772
|
+
}, "strip", z.ZodTypeAny, {
|
|
1773
|
+
email: string;
|
|
1774
|
+
}, {
|
|
1775
|
+
email: string;
|
|
1776
|
+
}>;
|
|
1777
|
+
declare const forgotPasswordSchema: z.ZodObject<{
|
|
1778
|
+
email: z.ZodString;
|
|
1779
|
+
}, "strip", z.ZodTypeAny, {
|
|
1780
|
+
email: string;
|
|
1781
|
+
}, {
|
|
1782
|
+
email: string;
|
|
1783
|
+
}>;
|
|
1784
|
+
type ForgotPasswordInput = z.infer<typeof forgotPasswordSchema>;
|
|
1785
|
+
declare function createResetPasswordConfirmSchema(v: AccessMessages['validation']): z.ZodEffects<z.ZodObject<{
|
|
1786
|
+
token: z.ZodString;
|
|
1787
|
+
newPassword: z.ZodString;
|
|
1788
|
+
confirmPassword: z.ZodString;
|
|
1789
|
+
}, "strip", z.ZodTypeAny, {
|
|
1790
|
+
token: string;
|
|
1791
|
+
newPassword: string;
|
|
1792
|
+
confirmPassword: string;
|
|
1793
|
+
}, {
|
|
1794
|
+
token: string;
|
|
1795
|
+
newPassword: string;
|
|
1796
|
+
confirmPassword: string;
|
|
1797
|
+
}>, {
|
|
1798
|
+
token: string;
|
|
1799
|
+
newPassword: string;
|
|
1800
|
+
confirmPassword: string;
|
|
1801
|
+
}, {
|
|
1802
|
+
token: string;
|
|
1803
|
+
newPassword: string;
|
|
1804
|
+
confirmPassword: string;
|
|
1805
|
+
}>;
|
|
1806
|
+
declare const resetPasswordConfirmSchema: z.ZodEffects<z.ZodObject<{
|
|
1807
|
+
token: z.ZodString;
|
|
1808
|
+
newPassword: z.ZodString;
|
|
1809
|
+
confirmPassword: z.ZodString;
|
|
1810
|
+
}, "strip", z.ZodTypeAny, {
|
|
1811
|
+
token: string;
|
|
1812
|
+
newPassword: string;
|
|
1813
|
+
confirmPassword: string;
|
|
1814
|
+
}, {
|
|
1815
|
+
token: string;
|
|
1816
|
+
newPassword: string;
|
|
1817
|
+
confirmPassword: string;
|
|
1818
|
+
}>, {
|
|
1819
|
+
token: string;
|
|
1820
|
+
newPassword: string;
|
|
1821
|
+
confirmPassword: string;
|
|
1822
|
+
}, {
|
|
1823
|
+
token: string;
|
|
1824
|
+
newPassword: string;
|
|
1825
|
+
confirmPassword: string;
|
|
1826
|
+
}>;
|
|
1827
|
+
type ResetPasswordConfirmInput = z.infer<typeof resetPasswordConfirmSchema>;
|
|
1616
1828
|
declare const passkeyRegisterStartSchema: z.ZodObject<{
|
|
1617
1829
|
deviceName: z.ZodOptional<z.ZodString>;
|
|
1618
1830
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1675,4 +1887,4 @@ interface SessionSyncOptions {
|
|
|
1675
1887
|
|
|
1676
1888
|
declare const SDK_VERSION: string;
|
|
1677
1889
|
|
|
1678
|
-
export { type AccessClient, type AccessClientConfig, type AccessMessages, type ApiError, type AppBranding, type AuthPaths, type AuthState, type AuthSuccessResponse, type AuthUser, type AvailableProvider, type AziridContextValue, AziridProvider, type AziridProviderProps, BASE_PATHS, type BillingInvoice, type BillingPlan, type BootstrapResponse, type ChangePasswordData, type ChangePasswordInput, CheckoutButton, type CheckoutButtonProps, type CheckoutParams, type CheckoutResponse, type CreateTenantData, type FieldError, InvoiceList, type InvoiceListProps, type LoginData, LoginForm, type LoginFormProps, type LoginInput, type MagicLinkRequestData, type MagicLinkRequestInput, type MagicLinkVerifyData, type MagicLinkVerifyInput, type MutationHookConfig, PATHS, type PasskeyItem, type PasskeyLoginData, type PasskeyLoginStartData, type PasskeyLoginStartResponse, type PasskeyLoginVerifyData, type PasskeyRegisterStartData, type PasskeyRegisterStartInput, type PasskeyRegisterStartResponse, type PasskeyRegisterVerifyData, PayButton, type PayButtonProps, type PaymentIntent, type PaymentProviderType, PayphoneCallback, type PayphoneCallbackProps, type PayphoneConfirmParams, type PayphoneConfirmResult, type PayphoneModalProps, type PayphoneWidgetConfig, type PricingCardProps, type PricingFeatureListProps, PricingTable, type PricingTableProps, type ProviderModalProps, ReferralCard, type ReferralCardProps, type ReferralInfo, type ReferralItem, ReferralStats, type ReferralStatsData, type ReferralStatsProps, type RegisterPasskeyData, SDK_VERSION, type SessionSyncOptions, type SignupData, SignupForm, type SignupFormProps, type SignupInput, type SimpleMutationOptions, type SocialLoginData, type SocialLoginInput, type SubmitTransferProofData, SubscriptionBadge, type SubscriptionBadgeProps, type SupportedLocale, type TenantMemberInfo, type TenantWithRole, type TransferModalProps, type TransferProof, type UseBootstrapOptions, type UseBootstrapReturn, type UseChangePasswordOptions, type UseChangePasswordReturn, type UseCheckoutOptions, type UseFormReturn, type UseLoginOptions, type UseLoginReturn, type UseLogoutOptions, type UseLogoutReturn, type UseMagicLinkOptions, type UseMagicLinkReturn, type UsePasskeysOptions, type UsePasskeysReturn, type UsePayphoneConfirmOptions, type UseRefreshOptions, type UseRefreshReturn, type UseSessionOptions, type UseSessionReturn, type UseSignupOptions, type UseSignupReturn, type UseSocialLoginOptions, type UseSocialLoginReturn, type UserSubscription, buildPaths, changePasswordSchema, cn, createAccessClient, createLoginSchema, createMutationHook, createSignupSchema, en, es, isAuthError, loginSchema, magicLinkRequestSchema, magicLinkVerifySchema, passkeyRegisterStartSchema, removeStyles, resolveMessages, signupSchema, socialLoginSchema, useAccessClient, useAzirid, useBootstrap, useBranding, useChangePassword, useCheckout, useFormState, useInvoices, useLogin, useLogout, useMagicLink, useMessages, usePasskeys, usePasswordToggle, usePaymentProviders, usePayphoneConfirm, usePlans, useReferral, useReferralStats, useRefresh, useSession, useSignup, useSocialLogin, useSubmitTransferProof, useSubscription, useSwitchTenant, useTenantMembers, useTenants, useTransferProofs };
|
|
1890
|
+
export { type AccessClient, type AccessClientConfig, type AccessMessages, type ApiError, type AppBranding, AuthForm, type AuthFormProps, type AuthPaths, type AuthState, type AuthSuccessResponse, type AuthUser, type AuthView, type AvailableProvider, type AziridContextValue, AziridProvider, type AziridProviderProps, BASE_PATHS, type BillingInvoice, type BillingPlan, type BootstrapResponse, type ChangePasswordData, type ChangePasswordInput, CheckoutButton, type CheckoutButtonProps, type CheckoutParams, type CheckoutResponse, type CreateTenantData, type FieldError, ForgotPasswordForm, type ForgotPasswordFormProps, type ForgotPasswordInput, InvoiceList, type InvoiceListProps, type LoginData, LoginForm, type LoginFormProps, type LoginInput, type MagicLinkRequestData, type MagicLinkRequestInput, type MagicLinkVerifyData, type MagicLinkVerifyInput, type MutationHookConfig, PATHS, type PasskeyItem, type PasskeyLoginData, type PasskeyLoginStartData, type PasskeyLoginStartResponse, type PasskeyLoginVerifyData, type PasskeyRegisterStartData, type PasskeyRegisterStartInput, type PasskeyRegisterStartResponse, type PasskeyRegisterVerifyData, type PasswordResetConfirmData, type PasswordResetRequestData, PayButton, type PayButtonProps, type PaymentIntent, type PaymentProviderType, PayphoneCallback, type PayphoneCallbackProps, type PayphoneConfirmParams, type PayphoneConfirmResult, type PayphoneModalProps, type PayphoneWidgetConfig, type PricingCardProps, type PricingFeatureListProps, PricingTable, type PricingTableProps, type ProviderModalProps, ReferralCard, type ReferralCardProps, type ReferralInfo, type ReferralItem, ReferralStats, type ReferralStatsData, type ReferralStatsProps, type RegisterPasskeyData, type ResetPasswordConfirmInput, ResetPasswordForm, type ResetPasswordFormProps, SDK_VERSION, type SessionSyncOptions, type SignupData, SignupForm, type SignupFormProps, type SignupInput, type SimpleMutationOptions, type SocialLoginData, type SocialLoginInput, type SubmitTransferProofData, SubscriptionBadge, type SubscriptionBadgeProps, type SupportedLocale, type TenantMemberInfo, type TenantWithRole, type TransferModalProps, type TransferProof, type UseBootstrapOptions, type UseBootstrapReturn, type UseChangePasswordOptions, type UseChangePasswordReturn, type UseCheckoutOptions, type UseFormReturn, type UseLoginOptions, type UseLoginReturn, type UseLogoutOptions, type UseLogoutReturn, type UseMagicLinkOptions, type UseMagicLinkReturn, type UsePasskeysOptions, type UsePasskeysReturn, type UsePasswordResetOptions, type UsePasswordResetReturn, type UsePayphoneConfirmOptions, type UseRefreshOptions, type UseRefreshReturn, type UseSessionOptions, type UseSessionReturn, type UseSignupOptions, type UseSignupReturn, type UseSocialLoginOptions, type UseSocialLoginReturn, type UserSubscription, buildPaths, changePasswordSchema, cn, createAccessClient, createForgotPasswordSchema, createLoginSchema, createMutationHook, createResetPasswordConfirmSchema, createSignupSchema, en, es, forgotPasswordSchema, isAuthError, loginSchema, magicLinkRequestSchema, magicLinkVerifySchema, passkeyRegisterStartSchema, removeStyles, resetPasswordConfirmSchema, resolveMessages, signupSchema, socialLoginSchema, useAccessClient, useAzirid, useBootstrap, useBranding, useChangePassword, useCheckout, useFormState, useInvoices, useLogin, useLogout, useMagicLink, useMessages, usePasskeys, usePasswordReset, usePasswordToggle, usePaymentProviders, usePayphoneConfirm, usePlans, useReferral, useReferralStats, useRefresh, useSession, useSignup, useSocialLogin, useSubmitTransferProof, useSubscription, useSwitchTenant, useTenantMembers, useTenants, useTransferProofs };
|