@sudobility/components 5.0.58 → 5.0.61

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.
@@ -9,5 +9,6 @@ export { useCopyToClipboard, useMultipleCopyToClipboard, type CopyToClipboardOpt
9
9
  export { useLocalizedNavigate, addLanguageToPath, removeLanguageFromPath, } from './useLocalizedNavigate';
10
10
  export type { UseLocalizedNavigateOptions, UseLocalizedNavigateReturn, } from './useLocalizedNavigate';
11
11
  export { useRoutePerformance } from './useRoutePerformance';
12
+ export { useLoginRedirect, type UseLoginRedirectOptions, type UseLoginRedirectResult, } from './useLoginRedirect';
12
13
  export { useFormValidation, type ValidationRule, type FieldConfig, type FormFieldState, type UseFormValidationOptions, type UseFormValidationResult, } from './useFormValidation';
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,GAC5B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Hook for managing login redirect flows.
3
+ *
4
+ * Provides utilities for:
5
+ * - Navigating to login with a redirect-after-login path
6
+ * - Extracting the redirect path from URL query params on the login page
7
+ * - Handling post-login navigation
8
+ */
9
+ export interface UseLoginRedirectOptions {
10
+ /** Path to the login page (without language prefix). @default '/login' */
11
+ loginPath?: string;
12
+ /** Where to redirect after login if no ?redirect param is present. @default '/' */
13
+ defaultRedirect?: string;
14
+ /** Current language code for localized navigation */
15
+ currentLanguage?: string;
16
+ }
17
+ export interface UseLoginRedirectResult {
18
+ /** The redirect path from ?redirect= query param, or null if not present */
19
+ redirectPath: string | null;
20
+ /** redirectPath if present, otherwise defaultRedirect */
21
+ effectiveRedirect: string;
22
+ /** Navigate to login page, optionally specifying where to redirect after login */
23
+ navigateToLogin: (redirectAfterLogin?: string) => void;
24
+ /** Navigate to effectiveRedirect (call this on login success) */
25
+ handleLoginSuccess: () => void;
26
+ }
27
+ /**
28
+ * Hook for login redirect flows.
29
+ *
30
+ * On pages that need login:
31
+ * ```tsx
32
+ * const { navigateToLogin } = useLoginRedirect({ currentLanguage: lang });
33
+ * // navigateToLogin('/profile/subscription') → /en/login?redirect=/profile/subscription
34
+ * ```
35
+ *
36
+ * On the login page:
37
+ * ```tsx
38
+ * const { handleLoginSuccess } = useLoginRedirect({ currentLanguage: lang });
39
+ * // After successful auth:
40
+ * handleLoginSuccess(); // navigates to ?redirect= value or defaultRedirect
41
+ * ```
42
+ */
43
+ export declare function useLoginRedirect(options?: UseLoginRedirectOptions): UseLoginRedirectResult;
44
+ //# sourceMappingURL=useLoginRedirect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLoginRedirect.d.ts","sourceRoot":"","sources":["../../src/hooks/useLoginRedirect.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,4EAA4E;IAC5E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,yDAAyD;IACzD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kFAAkF;IAClF,eAAe,EAAE,CAAC,kBAAkB,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACvD,iEAAiE;IACjE,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAChC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,CAAC,EAAE,uBAAuB,GAChC,sBAAsB,CA4CxB"}