@djangocfg/api 2.1.99 → 2.1.101
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/auth-server.cjs +333 -313
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +333 -313
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +471 -386
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +42 -1
- package/dist/auth.d.ts +42 -1
- package/dist/auth.mjs +471 -386
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +458 -383
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +55 -1
- package/dist/clients.d.ts +55 -1
- package/dist/clients.mjs +458 -383
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +184 -111
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +48 -1
- package/dist/hooks.d.ts +48 -1
- package/dist/hooks.mjs +184 -111
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +382 -313
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -5
- package/dist/index.d.ts +58 -5
- package/dist/index.mjs +382 -313
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/auth/context/AuthContext.tsx +31 -0
- package/src/auth/context/types.ts +4 -0
- package/src/auth/hooks/index.ts +7 -0
- package/src/auth/hooks/useDeleteAccount.ts +90 -0
- package/src/generated/cfg_accounts/CLAUDE.md +4 -3
- package/src/generated/cfg_accounts/_utils/fetchers/accounts__user_profile.ts +58 -0
- package/src/generated/cfg_accounts/_utils/hooks/accounts__user_profile.ts +19 -0
- package/src/generated/cfg_accounts/_utils/schemas/AccountDeleteResponse.schema.ts +20 -0
- package/src/generated/cfg_accounts/_utils/schemas/index.ts +1 -0
- package/src/generated/cfg_accounts/accounts__user_profile/client.ts +14 -0
- package/src/generated/cfg_accounts/accounts__user_profile/models.ts +12 -0
- package/src/generated/cfg_accounts/schema.json +69 -0
package/dist/auth.d.cts
CHANGED
|
@@ -300,6 +300,12 @@ interface AuthContextType {
|
|
|
300
300
|
getRedirectUrl: () => string;
|
|
301
301
|
clearRedirectUrl: () => void;
|
|
302
302
|
hasRedirectUrl: () => boolean;
|
|
303
|
+
updateProfile: (data: {
|
|
304
|
+
first_name?: string;
|
|
305
|
+
last_name?: string;
|
|
306
|
+
username?: string;
|
|
307
|
+
}) => Promise<UserProfile>;
|
|
308
|
+
uploadAvatar: (avatar: File | Blob) => Promise<UserProfile>;
|
|
303
309
|
}
|
|
304
310
|
interface AuthProviderProps {
|
|
305
311
|
children: React$1.ReactNode;
|
|
@@ -851,6 +857,41 @@ declare function useTokenRefresh(options?: UseTokenRefreshOptions): {
|
|
|
851
857
|
checkAndRefresh: () => Promise<void>;
|
|
852
858
|
};
|
|
853
859
|
|
|
860
|
+
interface DeleteAccountResult {
|
|
861
|
+
success: boolean;
|
|
862
|
+
message: string;
|
|
863
|
+
}
|
|
864
|
+
interface UseDeleteAccountReturn {
|
|
865
|
+
/** Loading state */
|
|
866
|
+
isLoading: boolean;
|
|
867
|
+
/** Error message */
|
|
868
|
+
error: string | null;
|
|
869
|
+
/** Delete the account */
|
|
870
|
+
deleteAccount: () => Promise<DeleteAccountResult>;
|
|
871
|
+
/** Clear error */
|
|
872
|
+
clearError: () => void;
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Hook for deleting user account.
|
|
876
|
+
*
|
|
877
|
+
* This performs a soft delete - deactivates the account and anonymizes personal data.
|
|
878
|
+
* The account can be restored by an administrator if needed.
|
|
879
|
+
*
|
|
880
|
+
* @example
|
|
881
|
+
* ```tsx
|
|
882
|
+
* const { deleteAccount, isLoading, error } = useDeleteAccount();
|
|
883
|
+
*
|
|
884
|
+
* const handleDelete = async () => {
|
|
885
|
+
* const result = await deleteAccount();
|
|
886
|
+
* if (result.success) {
|
|
887
|
+
* // Account deleted, perform logout
|
|
888
|
+
* await logout();
|
|
889
|
+
* }
|
|
890
|
+
* };
|
|
891
|
+
* ```
|
|
892
|
+
*/
|
|
893
|
+
declare const useDeleteAccount: () => UseDeleteAccountReturn;
|
|
894
|
+
|
|
854
895
|
/**
|
|
855
896
|
* Email validation utility
|
|
856
897
|
*/
|
|
@@ -910,4 +951,4 @@ declare const Analytics: {
|
|
|
910
951
|
setUser(userId: string): void;
|
|
911
952
|
};
|
|
912
953
|
|
|
913
|
-
export { type AccountsContextValue, AccountsProvider, Analytics, AnalyticsCategory, type AnalyticsCategoryType, AnalyticsEvent, type AnalyticsEventType, type AuthChannel, type AuthConfig, type AuthContextType, type AuthFormAutoSubmit, type AuthFormContextType, type AuthFormReturn, type AuthFormState, type AuthFormStateHandlers, type AuthFormSubmitHandlers, type AuthFormValidation, type AuthHelpProps, type AuthLayoutConfig, type AuthLayoutProps, AuthProvider, type AuthProviderProps, type AuthStep, type PatchedUserProfileUpdateRequest, PatchedUserProfileUpdateRequestSchema, type ProfileCacheOptions, type TwoFactorDevice, type TwoFactorSetupData, type UseAuthFormOptions, type UseAuthFormStateReturn, type UseAutoAuthOptions, type UseGithubAuthOptions, type UseGithubAuthReturn, type UseTwoFactorOptions, type UseTwoFactorReturn, type UseTwoFactorSetupOptions, type UseTwoFactorSetupReturn, type UseTwoFactorStatusReturn, type UserProfile, authLogger, clearProfileCache, decodeBase64, detectChannelFromIdentifier, encodeBase64, formatAuthError, getCacheMetadata, getCachedProfile, hasValidCache, logger, setCachedProfile, useAccountsContext, useAuth, useAuthForm, useAuthFormState, useAuthGuard, useAuthRedirectManager, useAuthValidation, useAutoAuth, useBase64, useGithubAuth, useLocalStorage, useSessionStorage, useTokenRefresh, useTwoFactor, useTwoFactorSetup, useTwoFactorStatus, validateEmail, validateIdentifier };
|
|
954
|
+
export { type AccountsContextValue, AccountsProvider, Analytics, AnalyticsCategory, type AnalyticsCategoryType, AnalyticsEvent, type AnalyticsEventType, type AuthChannel, type AuthConfig, type AuthContextType, type AuthFormAutoSubmit, type AuthFormContextType, type AuthFormReturn, type AuthFormState, type AuthFormStateHandlers, type AuthFormSubmitHandlers, type AuthFormValidation, type AuthHelpProps, type AuthLayoutConfig, type AuthLayoutProps, AuthProvider, type AuthProviderProps, type AuthStep, type DeleteAccountResult, type PatchedUserProfileUpdateRequest, PatchedUserProfileUpdateRequestSchema, type ProfileCacheOptions, type TwoFactorDevice, type TwoFactorSetupData, type UseAuthFormOptions, type UseAuthFormStateReturn, type UseAutoAuthOptions, type UseDeleteAccountReturn, type UseGithubAuthOptions, type UseGithubAuthReturn, type UseTwoFactorOptions, type UseTwoFactorReturn, type UseTwoFactorSetupOptions, type UseTwoFactorSetupReturn, type UseTwoFactorStatusReturn, type UserProfile, authLogger, clearProfileCache, decodeBase64, detectChannelFromIdentifier, encodeBase64, formatAuthError, getCacheMetadata, getCachedProfile, hasValidCache, logger, setCachedProfile, useAccountsContext, useAuth, useAuthForm, useAuthFormState, useAuthGuard, useAuthRedirectManager, useAuthValidation, useAutoAuth, useBase64, useDeleteAccount, useGithubAuth, useLocalStorage, useSessionStorage, useTokenRefresh, useTwoFactor, useTwoFactorSetup, useTwoFactorStatus, validateEmail, validateIdentifier };
|
package/dist/auth.d.ts
CHANGED
|
@@ -300,6 +300,12 @@ interface AuthContextType {
|
|
|
300
300
|
getRedirectUrl: () => string;
|
|
301
301
|
clearRedirectUrl: () => void;
|
|
302
302
|
hasRedirectUrl: () => boolean;
|
|
303
|
+
updateProfile: (data: {
|
|
304
|
+
first_name?: string;
|
|
305
|
+
last_name?: string;
|
|
306
|
+
username?: string;
|
|
307
|
+
}) => Promise<UserProfile>;
|
|
308
|
+
uploadAvatar: (avatar: File | Blob) => Promise<UserProfile>;
|
|
303
309
|
}
|
|
304
310
|
interface AuthProviderProps {
|
|
305
311
|
children: React$1.ReactNode;
|
|
@@ -851,6 +857,41 @@ declare function useTokenRefresh(options?: UseTokenRefreshOptions): {
|
|
|
851
857
|
checkAndRefresh: () => Promise<void>;
|
|
852
858
|
};
|
|
853
859
|
|
|
860
|
+
interface DeleteAccountResult {
|
|
861
|
+
success: boolean;
|
|
862
|
+
message: string;
|
|
863
|
+
}
|
|
864
|
+
interface UseDeleteAccountReturn {
|
|
865
|
+
/** Loading state */
|
|
866
|
+
isLoading: boolean;
|
|
867
|
+
/** Error message */
|
|
868
|
+
error: string | null;
|
|
869
|
+
/** Delete the account */
|
|
870
|
+
deleteAccount: () => Promise<DeleteAccountResult>;
|
|
871
|
+
/** Clear error */
|
|
872
|
+
clearError: () => void;
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Hook for deleting user account.
|
|
876
|
+
*
|
|
877
|
+
* This performs a soft delete - deactivates the account and anonymizes personal data.
|
|
878
|
+
* The account can be restored by an administrator if needed.
|
|
879
|
+
*
|
|
880
|
+
* @example
|
|
881
|
+
* ```tsx
|
|
882
|
+
* const { deleteAccount, isLoading, error } = useDeleteAccount();
|
|
883
|
+
*
|
|
884
|
+
* const handleDelete = async () => {
|
|
885
|
+
* const result = await deleteAccount();
|
|
886
|
+
* if (result.success) {
|
|
887
|
+
* // Account deleted, perform logout
|
|
888
|
+
* await logout();
|
|
889
|
+
* }
|
|
890
|
+
* };
|
|
891
|
+
* ```
|
|
892
|
+
*/
|
|
893
|
+
declare const useDeleteAccount: () => UseDeleteAccountReturn;
|
|
894
|
+
|
|
854
895
|
/**
|
|
855
896
|
* Email validation utility
|
|
856
897
|
*/
|
|
@@ -910,4 +951,4 @@ declare const Analytics: {
|
|
|
910
951
|
setUser(userId: string): void;
|
|
911
952
|
};
|
|
912
953
|
|
|
913
|
-
export { type AccountsContextValue, AccountsProvider, Analytics, AnalyticsCategory, type AnalyticsCategoryType, AnalyticsEvent, type AnalyticsEventType, type AuthChannel, type AuthConfig, type AuthContextType, type AuthFormAutoSubmit, type AuthFormContextType, type AuthFormReturn, type AuthFormState, type AuthFormStateHandlers, type AuthFormSubmitHandlers, type AuthFormValidation, type AuthHelpProps, type AuthLayoutConfig, type AuthLayoutProps, AuthProvider, type AuthProviderProps, type AuthStep, type PatchedUserProfileUpdateRequest, PatchedUserProfileUpdateRequestSchema, type ProfileCacheOptions, type TwoFactorDevice, type TwoFactorSetupData, type UseAuthFormOptions, type UseAuthFormStateReturn, type UseAutoAuthOptions, type UseGithubAuthOptions, type UseGithubAuthReturn, type UseTwoFactorOptions, type UseTwoFactorReturn, type UseTwoFactorSetupOptions, type UseTwoFactorSetupReturn, type UseTwoFactorStatusReturn, type UserProfile, authLogger, clearProfileCache, decodeBase64, detectChannelFromIdentifier, encodeBase64, formatAuthError, getCacheMetadata, getCachedProfile, hasValidCache, logger, setCachedProfile, useAccountsContext, useAuth, useAuthForm, useAuthFormState, useAuthGuard, useAuthRedirectManager, useAuthValidation, useAutoAuth, useBase64, useGithubAuth, useLocalStorage, useSessionStorage, useTokenRefresh, useTwoFactor, useTwoFactorSetup, useTwoFactorStatus, validateEmail, validateIdentifier };
|
|
954
|
+
export { type AccountsContextValue, AccountsProvider, Analytics, AnalyticsCategory, type AnalyticsCategoryType, AnalyticsEvent, type AnalyticsEventType, type AuthChannel, type AuthConfig, type AuthContextType, type AuthFormAutoSubmit, type AuthFormContextType, type AuthFormReturn, type AuthFormState, type AuthFormStateHandlers, type AuthFormSubmitHandlers, type AuthFormValidation, type AuthHelpProps, type AuthLayoutConfig, type AuthLayoutProps, AuthProvider, type AuthProviderProps, type AuthStep, type DeleteAccountResult, type PatchedUserProfileUpdateRequest, PatchedUserProfileUpdateRequestSchema, type ProfileCacheOptions, type TwoFactorDevice, type TwoFactorSetupData, type UseAuthFormOptions, type UseAuthFormStateReturn, type UseAutoAuthOptions, type UseDeleteAccountReturn, type UseGithubAuthOptions, type UseGithubAuthReturn, type UseTwoFactorOptions, type UseTwoFactorReturn, type UseTwoFactorSetupOptions, type UseTwoFactorSetupReturn, type UseTwoFactorStatusReturn, type UserProfile, authLogger, clearProfileCache, decodeBase64, detectChannelFromIdentifier, encodeBase64, formatAuthError, getCacheMetadata, getCachedProfile, hasValidCache, logger, setCachedProfile, useAccountsContext, useAuth, useAuthForm, useAuthFormState, useAuthGuard, useAuthRedirectManager, useAuthValidation, useAutoAuth, useBase64, useDeleteAccount, useGithubAuth, useLocalStorage, useSessionStorage, useTokenRefresh, useTwoFactor, useTwoFactorSetup, useTwoFactorStatus, validateEmail, validateIdentifier };
|