azirid-react 0.6.0 → 0.8.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/README.md +92 -1
- package/dist/index.cjs +456 -355
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -4
- package/dist/index.d.ts +112 -4
- package/dist/index.js +453 -356
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -3,6 +3,7 @@ import { ReactNode, CSSProperties, 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';
|
|
6
|
+
import { TenantRole, Environment } from '@azirid/shared';
|
|
6
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
8
|
import { ClassValue } from 'clsx';
|
|
8
9
|
|
|
@@ -14,9 +15,10 @@ interface AuthUser {
|
|
|
14
15
|
emailVerified: boolean;
|
|
15
16
|
mfaEnabled?: boolean;
|
|
16
17
|
appId?: string;
|
|
17
|
-
tenantId
|
|
18
|
+
tenantId: string;
|
|
19
|
+
tenantRole: TenantRole | string;
|
|
18
20
|
workspaceId?: string;
|
|
19
|
-
environment?:
|
|
21
|
+
environment?: Environment;
|
|
20
22
|
mustChangePassword?: boolean;
|
|
21
23
|
publicMetadata?: Record<string, unknown> | null;
|
|
22
24
|
unsafeMetadata?: Record<string, unknown> | null;
|
|
@@ -258,6 +260,8 @@ interface AziridContextValue extends AuthState {
|
|
|
258
260
|
clearError: () => void;
|
|
259
261
|
/** Refresh the access token manually */
|
|
260
262
|
refresh: () => Promise<void>;
|
|
263
|
+
/** Switch the active tenant (re-issues tokens via refresh endpoint) */
|
|
264
|
+
switchTenant: (tenantId: string) => Promise<void>;
|
|
261
265
|
/** Update local user state after profile changes */
|
|
262
266
|
setUser: (user: AuthUser | null) => void;
|
|
263
267
|
/** TanStack mutation states */
|
|
@@ -501,6 +505,31 @@ interface TransferProof {
|
|
|
501
505
|
notes?: string;
|
|
502
506
|
createdAt: string;
|
|
503
507
|
}
|
|
508
|
+
interface TenantWithRole {
|
|
509
|
+
tenantId: string;
|
|
510
|
+
name: string;
|
|
511
|
+
slug: string;
|
|
512
|
+
description?: string | null;
|
|
513
|
+
enabled: boolean;
|
|
514
|
+
role: TenantRole;
|
|
515
|
+
joinedAt: string;
|
|
516
|
+
}
|
|
517
|
+
interface TenantMemberInfo {
|
|
518
|
+
id: string;
|
|
519
|
+
role: TenantRole;
|
|
520
|
+
joinedAt: string;
|
|
521
|
+
user: {
|
|
522
|
+
id: string;
|
|
523
|
+
email: string;
|
|
524
|
+
firstName?: string | null;
|
|
525
|
+
lastName?: string | null;
|
|
526
|
+
emailVerified: boolean;
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
interface CreateTenantData {
|
|
530
|
+
name: string;
|
|
531
|
+
description?: string;
|
|
532
|
+
}
|
|
504
533
|
|
|
505
534
|
declare const LoginForm: react.ForwardRefExoticComponent<LoginFormProps & react.RefAttributes<HTMLFormElement>>;
|
|
506
535
|
|
|
@@ -630,6 +659,7 @@ declare const SUFFIXES: {
|
|
|
630
659
|
readonly payphoneConfirm: "billing/payphone/confirm";
|
|
631
660
|
readonly referralMe: "referrals/me";
|
|
632
661
|
readonly referralStats: "referrals/stats";
|
|
662
|
+
readonly userTenants: "tenants";
|
|
633
663
|
};
|
|
634
664
|
/** Base paths for each mode */
|
|
635
665
|
declare const BASE_PATHS: {
|
|
@@ -686,7 +716,9 @@ interface AccessClient {
|
|
|
686
716
|
/** Get the current CSRF token (from memory or cookie) */
|
|
687
717
|
getCsrfToken: () => string | null;
|
|
688
718
|
/** Deduplicated refresh — safe to call from multiple places concurrently */
|
|
689
|
-
refreshSession: (
|
|
719
|
+
refreshSession: (opts?: {
|
|
720
|
+
tenantId?: string;
|
|
721
|
+
}) => Promise<void>;
|
|
690
722
|
}
|
|
691
723
|
declare function createAccessClient(config: AccessClientConfig, appContext?: AccessClient['appContext']): AccessClient;
|
|
692
724
|
|
|
@@ -1405,6 +1437,58 @@ interface UsePayphoneConfirmOptions {
|
|
|
1405
1437
|
}
|
|
1406
1438
|
declare function usePayphoneConfirm(options?: UsePayphoneConfirmOptions): _tanstack_react_query.UseMutationResult<PayphoneConfirmResult, Error, PayphoneConfirmParams, unknown>;
|
|
1407
1439
|
|
|
1440
|
+
declare function useTenants(): _tanstack_react_query.UseQueryResult<TenantWithRole[], Error>;
|
|
1441
|
+
declare function useTenantMembers(tenantId: string): _tanstack_react_query.UseQueryResult<TenantMemberInfo[], Error>;
|
|
1442
|
+
declare function useSwitchTenant(): {
|
|
1443
|
+
switchTenant: (tenantId: string) => Promise<void>;
|
|
1444
|
+
};
|
|
1445
|
+
|
|
1446
|
+
/**
|
|
1447
|
+
* Options common to all simple mutation hooks created via `createMutationHook`.
|
|
1448
|
+
*/
|
|
1449
|
+
interface SimpleMutationOptions<TData> {
|
|
1450
|
+
onSuccess?: (data: TData) => void;
|
|
1451
|
+
onError?: (error: Error) => void;
|
|
1452
|
+
}
|
|
1453
|
+
/**
|
|
1454
|
+
* Configuration for `createMutationHook`.
|
|
1455
|
+
*
|
|
1456
|
+
* @template TData The response type from the API
|
|
1457
|
+
* @template TInput The input/variables type for the mutation
|
|
1458
|
+
*/
|
|
1459
|
+
interface MutationHookConfig<TData, TInput> {
|
|
1460
|
+
/** Static mutation key for deduplication / devtools */
|
|
1461
|
+
mutationKey: string[];
|
|
1462
|
+
/**
|
|
1463
|
+
* Derive the mutation function from the AccessClient and input.
|
|
1464
|
+
* Most hooks simply call `client.post<TData>(client.paths.someEndpoint, data)`.
|
|
1465
|
+
*/
|
|
1466
|
+
mutationFn: (client: AccessClient, input: TInput) => Promise<TData>;
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* Factory that creates a simple `useMutation`-based hook.
|
|
1470
|
+
*
|
|
1471
|
+
* Eliminates the boilerplate of:
|
|
1472
|
+
* 1. Calling `useAccessClient()`
|
|
1473
|
+
* 2. Creating a `useMutation` with `mutationKey`, `mutationFn`, `onSuccess`, `onError`
|
|
1474
|
+
*
|
|
1475
|
+
* The resulting hook has the same return type as `useMutation` (`UseMutationResult`),
|
|
1476
|
+
* preserving full compatibility with TanStack Query.
|
|
1477
|
+
*
|
|
1478
|
+
* @example
|
|
1479
|
+
* ```ts
|
|
1480
|
+
* export const useChangePassword = createMutationHook<
|
|
1481
|
+
* { updated: boolean },
|
|
1482
|
+
* ChangePasswordData
|
|
1483
|
+
* >({
|
|
1484
|
+
* mutationKey: ['azirid-access', 'change-password'],
|
|
1485
|
+
* mutationFn: (client, data) =>
|
|
1486
|
+
* client.post<{ updated: boolean }>(client.paths.changePassword, data),
|
|
1487
|
+
* })
|
|
1488
|
+
* ```
|
|
1489
|
+
*/
|
|
1490
|
+
declare function createMutationHook<TData, TInput = void>(config: MutationHookConfig<TData, TInput>): (options?: SimpleMutationOptions<TData>) => UseMutationResult<TData, Error, TInput>;
|
|
1491
|
+
|
|
1408
1492
|
declare function useFormState<T extends Record<string, unknown>>(initialValues: T, schema: z.ZodType<unknown, z.ZodTypeDef, unknown>, onSubmit: (values: T) => void | Promise<void>): UseFormReturn<T>;
|
|
1409
1493
|
|
|
1410
1494
|
declare function usePasswordToggle(): {
|
|
@@ -1543,6 +1627,30 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
1543
1627
|
/** Remove injected styles from the DOM (useful when embedding in host apps). */
|
|
1544
1628
|
declare function removeStyles(): void;
|
|
1545
1629
|
|
|
1630
|
+
interface PricingCardProps {
|
|
1631
|
+
plan: BillingPlan;
|
|
1632
|
+
isCurrentPlan: boolean;
|
|
1633
|
+
isCheckoutPending: boolean;
|
|
1634
|
+
onSelect: (plan: BillingPlan) => void;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
interface PricingFeatureListProps {
|
|
1638
|
+
features: string[];
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
interface ProviderModalProps {
|
|
1642
|
+
providers: AvailableProvider[];
|
|
1643
|
+
isPending: boolean;
|
|
1644
|
+
onSelect: (provider: PaymentProviderType) => void;
|
|
1645
|
+
onClose: () => void;
|
|
1646
|
+
labels?: Record<string, string>;
|
|
1647
|
+
}
|
|
1648
|
+
interface TransferModalProps {
|
|
1649
|
+
data: CheckoutResponse;
|
|
1650
|
+
onClose: () => void;
|
|
1651
|
+
labels?: Record<string, string>;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1546
1654
|
declare global {
|
|
1547
1655
|
interface Window {
|
|
1548
1656
|
PPaymentButtonBox: new (config: Record<string, unknown>) => {
|
|
@@ -1567,4 +1675,4 @@ interface SessionSyncOptions {
|
|
|
1567
1675
|
|
|
1568
1676
|
declare const SDK_VERSION: string;
|
|
1569
1677
|
|
|
1570
|
-
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 FieldError, InvoiceList, type InvoiceListProps, type LoginData, LoginForm, type LoginFormProps, type LoginInput, type MagicLinkRequestData, type MagicLinkRequestInput, type MagicLinkVerifyData, type MagicLinkVerifyInput, 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, PricingTable, type PricingTableProps, 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 SocialLoginData, type SocialLoginInput, type SubmitTransferProofData, SubscriptionBadge, type SubscriptionBadgeProps, type SupportedLocale, 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, 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, useTransferProofs };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { ReactNode, CSSProperties, 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';
|
|
6
|
+
import { TenantRole, Environment } from '@azirid/shared';
|
|
6
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
8
|
import { ClassValue } from 'clsx';
|
|
8
9
|
|
|
@@ -14,9 +15,10 @@ interface AuthUser {
|
|
|
14
15
|
emailVerified: boolean;
|
|
15
16
|
mfaEnabled?: boolean;
|
|
16
17
|
appId?: string;
|
|
17
|
-
tenantId
|
|
18
|
+
tenantId: string;
|
|
19
|
+
tenantRole: TenantRole | string;
|
|
18
20
|
workspaceId?: string;
|
|
19
|
-
environment?:
|
|
21
|
+
environment?: Environment;
|
|
20
22
|
mustChangePassword?: boolean;
|
|
21
23
|
publicMetadata?: Record<string, unknown> | null;
|
|
22
24
|
unsafeMetadata?: Record<string, unknown> | null;
|
|
@@ -258,6 +260,8 @@ interface AziridContextValue extends AuthState {
|
|
|
258
260
|
clearError: () => void;
|
|
259
261
|
/** Refresh the access token manually */
|
|
260
262
|
refresh: () => Promise<void>;
|
|
263
|
+
/** Switch the active tenant (re-issues tokens via refresh endpoint) */
|
|
264
|
+
switchTenant: (tenantId: string) => Promise<void>;
|
|
261
265
|
/** Update local user state after profile changes */
|
|
262
266
|
setUser: (user: AuthUser | null) => void;
|
|
263
267
|
/** TanStack mutation states */
|
|
@@ -501,6 +505,31 @@ interface TransferProof {
|
|
|
501
505
|
notes?: string;
|
|
502
506
|
createdAt: string;
|
|
503
507
|
}
|
|
508
|
+
interface TenantWithRole {
|
|
509
|
+
tenantId: string;
|
|
510
|
+
name: string;
|
|
511
|
+
slug: string;
|
|
512
|
+
description?: string | null;
|
|
513
|
+
enabled: boolean;
|
|
514
|
+
role: TenantRole;
|
|
515
|
+
joinedAt: string;
|
|
516
|
+
}
|
|
517
|
+
interface TenantMemberInfo {
|
|
518
|
+
id: string;
|
|
519
|
+
role: TenantRole;
|
|
520
|
+
joinedAt: string;
|
|
521
|
+
user: {
|
|
522
|
+
id: string;
|
|
523
|
+
email: string;
|
|
524
|
+
firstName?: string | null;
|
|
525
|
+
lastName?: string | null;
|
|
526
|
+
emailVerified: boolean;
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
interface CreateTenantData {
|
|
530
|
+
name: string;
|
|
531
|
+
description?: string;
|
|
532
|
+
}
|
|
504
533
|
|
|
505
534
|
declare const LoginForm: react.ForwardRefExoticComponent<LoginFormProps & react.RefAttributes<HTMLFormElement>>;
|
|
506
535
|
|
|
@@ -630,6 +659,7 @@ declare const SUFFIXES: {
|
|
|
630
659
|
readonly payphoneConfirm: "billing/payphone/confirm";
|
|
631
660
|
readonly referralMe: "referrals/me";
|
|
632
661
|
readonly referralStats: "referrals/stats";
|
|
662
|
+
readonly userTenants: "tenants";
|
|
633
663
|
};
|
|
634
664
|
/** Base paths for each mode */
|
|
635
665
|
declare const BASE_PATHS: {
|
|
@@ -686,7 +716,9 @@ interface AccessClient {
|
|
|
686
716
|
/** Get the current CSRF token (from memory or cookie) */
|
|
687
717
|
getCsrfToken: () => string | null;
|
|
688
718
|
/** Deduplicated refresh — safe to call from multiple places concurrently */
|
|
689
|
-
refreshSession: (
|
|
719
|
+
refreshSession: (opts?: {
|
|
720
|
+
tenantId?: string;
|
|
721
|
+
}) => Promise<void>;
|
|
690
722
|
}
|
|
691
723
|
declare function createAccessClient(config: AccessClientConfig, appContext?: AccessClient['appContext']): AccessClient;
|
|
692
724
|
|
|
@@ -1405,6 +1437,58 @@ interface UsePayphoneConfirmOptions {
|
|
|
1405
1437
|
}
|
|
1406
1438
|
declare function usePayphoneConfirm(options?: UsePayphoneConfirmOptions): _tanstack_react_query.UseMutationResult<PayphoneConfirmResult, Error, PayphoneConfirmParams, unknown>;
|
|
1407
1439
|
|
|
1440
|
+
declare function useTenants(): _tanstack_react_query.UseQueryResult<TenantWithRole[], Error>;
|
|
1441
|
+
declare function useTenantMembers(tenantId: string): _tanstack_react_query.UseQueryResult<TenantMemberInfo[], Error>;
|
|
1442
|
+
declare function useSwitchTenant(): {
|
|
1443
|
+
switchTenant: (tenantId: string) => Promise<void>;
|
|
1444
|
+
};
|
|
1445
|
+
|
|
1446
|
+
/**
|
|
1447
|
+
* Options common to all simple mutation hooks created via `createMutationHook`.
|
|
1448
|
+
*/
|
|
1449
|
+
interface SimpleMutationOptions<TData> {
|
|
1450
|
+
onSuccess?: (data: TData) => void;
|
|
1451
|
+
onError?: (error: Error) => void;
|
|
1452
|
+
}
|
|
1453
|
+
/**
|
|
1454
|
+
* Configuration for `createMutationHook`.
|
|
1455
|
+
*
|
|
1456
|
+
* @template TData The response type from the API
|
|
1457
|
+
* @template TInput The input/variables type for the mutation
|
|
1458
|
+
*/
|
|
1459
|
+
interface MutationHookConfig<TData, TInput> {
|
|
1460
|
+
/** Static mutation key for deduplication / devtools */
|
|
1461
|
+
mutationKey: string[];
|
|
1462
|
+
/**
|
|
1463
|
+
* Derive the mutation function from the AccessClient and input.
|
|
1464
|
+
* Most hooks simply call `client.post<TData>(client.paths.someEndpoint, data)`.
|
|
1465
|
+
*/
|
|
1466
|
+
mutationFn: (client: AccessClient, input: TInput) => Promise<TData>;
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* Factory that creates a simple `useMutation`-based hook.
|
|
1470
|
+
*
|
|
1471
|
+
* Eliminates the boilerplate of:
|
|
1472
|
+
* 1. Calling `useAccessClient()`
|
|
1473
|
+
* 2. Creating a `useMutation` with `mutationKey`, `mutationFn`, `onSuccess`, `onError`
|
|
1474
|
+
*
|
|
1475
|
+
* The resulting hook has the same return type as `useMutation` (`UseMutationResult`),
|
|
1476
|
+
* preserving full compatibility with TanStack Query.
|
|
1477
|
+
*
|
|
1478
|
+
* @example
|
|
1479
|
+
* ```ts
|
|
1480
|
+
* export const useChangePassword = createMutationHook<
|
|
1481
|
+
* { updated: boolean },
|
|
1482
|
+
* ChangePasswordData
|
|
1483
|
+
* >({
|
|
1484
|
+
* mutationKey: ['azirid-access', 'change-password'],
|
|
1485
|
+
* mutationFn: (client, data) =>
|
|
1486
|
+
* client.post<{ updated: boolean }>(client.paths.changePassword, data),
|
|
1487
|
+
* })
|
|
1488
|
+
* ```
|
|
1489
|
+
*/
|
|
1490
|
+
declare function createMutationHook<TData, TInput = void>(config: MutationHookConfig<TData, TInput>): (options?: SimpleMutationOptions<TData>) => UseMutationResult<TData, Error, TInput>;
|
|
1491
|
+
|
|
1408
1492
|
declare function useFormState<T extends Record<string, unknown>>(initialValues: T, schema: z.ZodType<unknown, z.ZodTypeDef, unknown>, onSubmit: (values: T) => void | Promise<void>): UseFormReturn<T>;
|
|
1409
1493
|
|
|
1410
1494
|
declare function usePasswordToggle(): {
|
|
@@ -1543,6 +1627,30 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
1543
1627
|
/** Remove injected styles from the DOM (useful when embedding in host apps). */
|
|
1544
1628
|
declare function removeStyles(): void;
|
|
1545
1629
|
|
|
1630
|
+
interface PricingCardProps {
|
|
1631
|
+
plan: BillingPlan;
|
|
1632
|
+
isCurrentPlan: boolean;
|
|
1633
|
+
isCheckoutPending: boolean;
|
|
1634
|
+
onSelect: (plan: BillingPlan) => void;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
interface PricingFeatureListProps {
|
|
1638
|
+
features: string[];
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
interface ProviderModalProps {
|
|
1642
|
+
providers: AvailableProvider[];
|
|
1643
|
+
isPending: boolean;
|
|
1644
|
+
onSelect: (provider: PaymentProviderType) => void;
|
|
1645
|
+
onClose: () => void;
|
|
1646
|
+
labels?: Record<string, string>;
|
|
1647
|
+
}
|
|
1648
|
+
interface TransferModalProps {
|
|
1649
|
+
data: CheckoutResponse;
|
|
1650
|
+
onClose: () => void;
|
|
1651
|
+
labels?: Record<string, string>;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1546
1654
|
declare global {
|
|
1547
1655
|
interface Window {
|
|
1548
1656
|
PPaymentButtonBox: new (config: Record<string, unknown>) => {
|
|
@@ -1567,4 +1675,4 @@ interface SessionSyncOptions {
|
|
|
1567
1675
|
|
|
1568
1676
|
declare const SDK_VERSION: string;
|
|
1569
1677
|
|
|
1570
|
-
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 FieldError, InvoiceList, type InvoiceListProps, type LoginData, LoginForm, type LoginFormProps, type LoginInput, type MagicLinkRequestData, type MagicLinkRequestInput, type MagicLinkVerifyData, type MagicLinkVerifyInput, 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, PricingTable, type PricingTableProps, 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 SocialLoginData, type SocialLoginInput, type SubmitTransferProofData, SubscriptionBadge, type SubscriptionBadgeProps, type SupportedLocale, 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, 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, useTransferProofs };
|
|
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 };
|