@djangocfg/api 2.1.103 → 2.1.104

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.d.cts CHANGED
@@ -342,6 +342,82 @@ interface AccountsProviderProps {
342
342
  declare function AccountsProvider({ children }: AccountsProviderProps): react_jsx_runtime.JSX.Element;
343
343
  declare function useAccountsContext(): AccountsContextValue;
344
344
 
345
+ /**
346
+ * Universal Router Hook with BasePath Support
347
+ *
348
+ * Wrapper around Next.js useRouter that automatically handles basePath
349
+ * for static builds served via iframe or subdirectory
350
+ *
351
+ * IMPORTANT: In Next.js 15 App Router, router.push() does NOT automatically
352
+ * handle basePath (unlike Pages Router). This is a breaking change in App Router.
353
+ *
354
+ * This hook ensures basePath is always included when navigating, especially
355
+ * important for static exports served via iframe where basePath is critical.
356
+ *
357
+ * @see https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration
358
+ */
359
+ /**
360
+ * Router with basePath support
361
+ *
362
+ * Automatically adds basePath to all navigation methods when basePath is configured.
363
+ * In Next.js 15 App Router, router.push() doesn't handle basePath automatically,
364
+ * so this hook uses window.location to ensure basePath is always included.
365
+ *
366
+ * @example
367
+ * ```tsx
368
+ * const router = useCfgRouter();
369
+ *
370
+ * // With basePath='/cfg/admin':
371
+ * router.push('/dashboard'); // Client-side navigation to '/cfg/admin/dashboard'
372
+ * router.replace('/auth'); // Client-side replace with '/cfg/admin/auth'
373
+ * router.hardPush('/dashboard'); // Full page reload to '/cfg/admin/dashboard'
374
+ * router.hardReplace('/auth'); // Full page replace with '/cfg/admin/auth'
375
+ * ```
376
+ */
377
+ declare function useCfgRouter(): {
378
+ push: (href: string, options?: {
379
+ scroll?: boolean;
380
+ }) => void;
381
+ replace: (href: string, options?: {
382
+ scroll?: boolean;
383
+ }) => void;
384
+ hardPush: (href: string) => void;
385
+ hardReplace: (href: string) => void;
386
+ prefetch: (href: string) => void;
387
+ back: () => void;
388
+ forward: () => void;
389
+ refresh: () => void;
390
+ };
391
+
392
+ /**
393
+ * useQueryParams Hook
394
+ *
395
+ * Safe hook to access URL query parameters without requiring Suspense boundary.
396
+ * Works on client-side only, returns empty URLSearchParams during SSR/prerendering.
397
+ *
398
+ * @example
399
+ * ```tsx
400
+ * const params = useQueryParams();
401
+ * const flow = params.get('flow');
402
+ * const hasFlow = params.has('flow');
403
+ * const allTags = params.getAll('tags');
404
+ * ```
405
+ */
406
+ /**
407
+ * Hook to safely access URL query parameters without useSearchParams()
408
+ *
409
+ * This hook reads query parameters directly from window.location.search,
410
+ * avoiding the need for Suspense boundaries that useSearchParams() requires.
411
+ *
412
+ * Automatically updates when URL changes (navigation, back/forward, etc.)
413
+ * Uses pathname from Next.js to detect route changes and polls for query param changes.
414
+ *
415
+ * Returns a URLSearchParams object with get(), getAll(), has(), etc.
416
+ *
417
+ * @returns URLSearchParams object (empty during SSR)
418
+ */
419
+ declare function useQueryParams(): URLSearchParams;
420
+
345
421
  /**
346
422
  * Auth Form Types
347
423
  *
@@ -953,4 +1029,4 @@ declare const Analytics: {
953
1029
  setUser(userId: string): void;
954
1030
  };
955
1031
 
956
- 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 };
1032
+ 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, useCfgRouter, useDeleteAccount, useGithubAuth, useLocalStorage, useQueryParams, useSessionStorage, useTokenRefresh, useTwoFactor, useTwoFactorSetup, useTwoFactorStatus, validateEmail, validateIdentifier };
package/dist/auth.d.ts CHANGED
@@ -342,6 +342,82 @@ interface AccountsProviderProps {
342
342
  declare function AccountsProvider({ children }: AccountsProviderProps): react_jsx_runtime.JSX.Element;
343
343
  declare function useAccountsContext(): AccountsContextValue;
344
344
 
345
+ /**
346
+ * Universal Router Hook with BasePath Support
347
+ *
348
+ * Wrapper around Next.js useRouter that automatically handles basePath
349
+ * for static builds served via iframe or subdirectory
350
+ *
351
+ * IMPORTANT: In Next.js 15 App Router, router.push() does NOT automatically
352
+ * handle basePath (unlike Pages Router). This is a breaking change in App Router.
353
+ *
354
+ * This hook ensures basePath is always included when navigating, especially
355
+ * important for static exports served via iframe where basePath is critical.
356
+ *
357
+ * @see https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration
358
+ */
359
+ /**
360
+ * Router with basePath support
361
+ *
362
+ * Automatically adds basePath to all navigation methods when basePath is configured.
363
+ * In Next.js 15 App Router, router.push() doesn't handle basePath automatically,
364
+ * so this hook uses window.location to ensure basePath is always included.
365
+ *
366
+ * @example
367
+ * ```tsx
368
+ * const router = useCfgRouter();
369
+ *
370
+ * // With basePath='/cfg/admin':
371
+ * router.push('/dashboard'); // Client-side navigation to '/cfg/admin/dashboard'
372
+ * router.replace('/auth'); // Client-side replace with '/cfg/admin/auth'
373
+ * router.hardPush('/dashboard'); // Full page reload to '/cfg/admin/dashboard'
374
+ * router.hardReplace('/auth'); // Full page replace with '/cfg/admin/auth'
375
+ * ```
376
+ */
377
+ declare function useCfgRouter(): {
378
+ push: (href: string, options?: {
379
+ scroll?: boolean;
380
+ }) => void;
381
+ replace: (href: string, options?: {
382
+ scroll?: boolean;
383
+ }) => void;
384
+ hardPush: (href: string) => void;
385
+ hardReplace: (href: string) => void;
386
+ prefetch: (href: string) => void;
387
+ back: () => void;
388
+ forward: () => void;
389
+ refresh: () => void;
390
+ };
391
+
392
+ /**
393
+ * useQueryParams Hook
394
+ *
395
+ * Safe hook to access URL query parameters without requiring Suspense boundary.
396
+ * Works on client-side only, returns empty URLSearchParams during SSR/prerendering.
397
+ *
398
+ * @example
399
+ * ```tsx
400
+ * const params = useQueryParams();
401
+ * const flow = params.get('flow');
402
+ * const hasFlow = params.has('flow');
403
+ * const allTags = params.getAll('tags');
404
+ * ```
405
+ */
406
+ /**
407
+ * Hook to safely access URL query parameters without useSearchParams()
408
+ *
409
+ * This hook reads query parameters directly from window.location.search,
410
+ * avoiding the need for Suspense boundaries that useSearchParams() requires.
411
+ *
412
+ * Automatically updates when URL changes (navigation, back/forward, etc.)
413
+ * Uses pathname from Next.js to detect route changes and polls for query param changes.
414
+ *
415
+ * Returns a URLSearchParams object with get(), getAll(), has(), etc.
416
+ *
417
+ * @returns URLSearchParams object (empty during SSR)
418
+ */
419
+ declare function useQueryParams(): URLSearchParams;
420
+
345
421
  /**
346
422
  * Auth Form Types
347
423
  *
@@ -953,4 +1029,4 @@ declare const Analytics: {
953
1029
  setUser(userId: string): void;
954
1030
  };
955
1031
 
956
- 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 };
1032
+ 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, useCfgRouter, useDeleteAccount, useGithubAuth, useLocalStorage, useQueryParams, useSessionStorage, useTokenRefresh, useTwoFactor, useTwoFactorSetup, useTwoFactorStatus, validateEmail, validateIdentifier };