@ollaid/native-sso 2.1.5 → 2.6.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.
Files changed (41) hide show
  1. package/README.md +398 -63
  2. package/dist/components/AvatarCropModal.d.ts +16 -0
  3. package/dist/components/DebugPanel.d.ts +7 -2
  4. package/dist/components/LoginModal.d.ts +2 -2
  5. package/dist/components/NativeSSOPage.d.ts +11 -3
  6. package/dist/components/OnboardingModal.d.ts +14 -7
  7. package/dist/components/PasswordRecoveryModal.d.ts +1 -1
  8. package/dist/components/PhoneInput.d.ts +2 -1
  9. package/dist/components/SignupModal.d.ts +1 -1
  10. package/dist/components/ui.d.ts +4 -2
  11. package/dist/hooks/useLogout.d.ts +1 -1
  12. package/dist/hooks/useMobilePassword.d.ts +1 -1
  13. package/dist/hooks/useMobileRegistration.d.ts +2 -2
  14. package/dist/hooks/useNativeAuth.d.ts +8 -5
  15. package/dist/hooks/useTokenHealthCheck.d.ts +11 -1
  16. package/dist/index-Bpixveaz.js +489 -0
  17. package/dist/index-Bpixveaz.js.map +1 -0
  18. package/dist/index-DDOXM37y.cjs +488 -0
  19. package/dist/index-DDOXM37y.cjs.map +1 -0
  20. package/dist/index.cjs +9231 -414
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.ts +8 -5
  23. package/dist/index.js +9232 -415
  24. package/dist/index.js.map +1 -1
  25. package/dist/provider.d.ts +4 -1
  26. package/dist/services/api.d.ts +76 -7
  27. package/dist/services/debugLogger.d.ts +1 -1
  28. package/dist/services/iamAccount.d.ts +1 -1
  29. package/dist/services/mobilePassword.d.ts +1 -1
  30. package/dist/services/mobileRegistration.d.ts +1 -1
  31. package/dist/services/nativeAuth.d.ts +3 -2
  32. package/dist/services/profile.d.ts +31 -0
  33. package/dist/services/profileChange.d.ts +30 -0
  34. package/dist/services/profileMedia.d.ts +16 -0
  35. package/dist/types/mobile.d.ts +1 -1
  36. package/dist/types/native.d.ts +23 -1
  37. package/dist/web-BQDVoI6q.cjs +146 -0
  38. package/dist/web-BQDVoI6q.cjs.map +1 -0
  39. package/dist/web-DPmAPlXS.js +146 -0
  40. package/dist/web-DPmAPlXS.js.map +1 -0
  41. package/package.json +11 -4
@@ -0,0 +1,16 @@
1
+ /**
2
+ * AvatarCropModal — recadrage carré simple et déterministe
3
+ *
4
+ * Version réécrite from scratch pour éviter les états qui bloquent le bouton Valider.
5
+ *
6
+ * @version 2.6.0
7
+ */
8
+ export interface AvatarCropModalProps {
9
+ open: boolean;
10
+ imageSrc: string | null;
11
+ onOpenChange: (open: boolean) => void;
12
+ onCancel: () => void;
13
+ onConfirm: (blob: Blob) => Promise<void> | void;
14
+ }
15
+ export declare function AvatarCropModal({ open, imageSrc, onOpenChange, onCancel, onConfirm }: AvatarCropModalProps): import("react/jsx-runtime").JSX.Element;
16
+ export default AvatarCropModal;
@@ -2,11 +2,16 @@
2
2
  * DebugPanel — Panneau de debug flottant pour @ollaid/native-sso
3
3
  * Affiche l'historique des appels API en temps réel (style terminal)
4
4
  * N'apparaît que quand debug=true
5
- * @version 2.1.4
5
+ * @version 2.6.0
6
6
  */
7
+ export type DebugOnboardingPreset = 'current' | 'photo' | 'phone' | 'email' | 'all';
7
8
  interface DebugPanelProps {
8
9
  saasApiUrl: string;
9
10
  iamApiUrl: string;
11
+ onOpenLogin?: () => void;
12
+ onOpenSignup?: () => void;
13
+ onOpenOnboarding?: (preset: DebugOnboardingPreset) => void;
14
+ onResetProfilePrompt?: () => void;
10
15
  }
11
- export declare function DebugPanel({ saasApiUrl, iamApiUrl }: DebugPanelProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function DebugPanel({ saasApiUrl, iamApiUrl, onOpenLogin, onOpenSignup, onOpenOnboarding, onResetProfilePrompt }: DebugPanelProps): import("react/jsx-runtime").JSX.Element;
12
17
  export default DebugPanel;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Login Modal for @ollaid/native-sso
3
- * Complete login flow aligned with web SSO /sso/auth design
3
+ * Complete login flow aligned with Native SSO design
4
4
  *
5
- * @version 2.1.4
5
+ * @version 2.6.0
6
6
  */
7
7
  import type { UserInfos } from '../types/native';
8
8
  export interface LoginModalProps {
@@ -1,19 +1,26 @@
1
1
  /**
2
2
  * NativeSSOPage — Page autonome complète pour @ollaid/native-sso
3
- * Design aligné sur /sso/auth (fond primary, card blanche, ShieldCheck branding)
3
+ * Design aligné sur le parcours Native SSO (fond primary, card blanche, ShieldCheck branding)
4
4
  *
5
- * @version 2.1.4
5
+ * @version 2.6.0
6
6
  */
7
7
  import type { UserInfos } from '../types/native';
8
+ import type { NativeStorageAdapter } from '../services/api';
8
9
  export interface NativeSSOPageProps {
9
10
  saasApiUrl: string;
10
11
  iamApiUrl: string;
11
12
  onLoginSuccess?: (token: string, user: UserInfos) => void;
12
13
  onLogout?: () => void;
13
14
  onOnboardingComplete?: (data: {
15
+ name?: string;
14
16
  image_url?: string;
15
17
  ccphone?: string;
16
18
  phone?: string;
19
+ email?: string;
20
+ address?: string;
21
+ town?: string;
22
+ country?: string;
23
+ user_infos?: UserInfos;
17
24
  }) => void;
18
25
  accountType?: 'user' | 'client';
19
26
  configPrefix?: string;
@@ -23,6 +30,7 @@ export interface NativeSSOPageProps {
23
30
  hideFooter?: boolean;
24
31
  redirectAfterLogin?: string;
25
32
  redirectAfterLogout?: string;
33
+ storage?: NativeStorageAdapter;
26
34
  }
27
- export declare function NativeSSOPage({ saasApiUrl, iamApiUrl, onLoginSuccess, onLogout, onOnboardingComplete, accountType, configPrefix, title, description, logoUrl, hideFooter, redirectAfterLogin, redirectAfterLogout, }: NativeSSOPageProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare function NativeSSOPage({ saasApiUrl, iamApiUrl, onLoginSuccess, onLogout, onOnboardingComplete, accountType, configPrefix, title, description, logoUrl, hideFooter, redirectAfterLogin, redirectAfterLogout, storage, }: NativeSSOPageProps): import("react/jsx-runtime").JSX.Element;
28
36
  export default NativeSSOPage;
@@ -1,23 +1,30 @@
1
1
  /**
2
- * OnboardingModal — Post-login modal for missing profile info
3
- * Asks for photo + phone if not present in user_infos
2
+ * OnboardingModal — Modal de profil unifiée
3
+ * Mode `missing` : champs absents uniquement
4
+ * Mode `edit` : édition complète du profil depuis le SaaS
4
5
  *
5
- * @version 2.1.4
6
+ * @version 2.6.0
6
7
  */
7
- import type { NativeUser } from '../types/native';
8
+ import type { NativeUser, UserInfos } from '../types/native';
8
9
  export interface OnboardingModalProps {
9
10
  open: boolean;
10
11
  onOpenChange: (open: boolean) => void;
12
+ onDismiss: () => void;
11
13
  user: NativeUser;
12
- /** Called with updated data when user submits */
14
+ variant?: 'missing' | 'edit';
15
+ profileHydrating?: boolean;
13
16
  onComplete: (data: {
17
+ name?: string;
14
18
  image_url?: string;
15
19
  ccphone?: string;
16
20
  phone?: string;
17
21
  email?: string;
22
+ address?: string;
23
+ town?: string;
24
+ country?: string;
25
+ user_infos?: UserInfos;
18
26
  }) => void;
19
- /** Called when user skips onboarding */
20
27
  onSkip: () => void;
21
28
  }
22
- export declare function OnboardingModal({ open, onOpenChange, user, onComplete, onSkip }: OnboardingModalProps): import("react/jsx-runtime").JSX.Element;
29
+ export declare function OnboardingModal({ open, onOpenChange, onDismiss, user, variant, profileHydrating, onComplete, onSkip }: OnboardingModalProps): import("react/jsx-runtime").JSX.Element;
23
30
  export default OnboardingModal;
@@ -3,7 +3,7 @@
3
3
  * Flow: email → method-choice → OTP → new password → success
4
4
  * Design aligned with web SSO
5
5
  *
6
- * @version 2.1.4
6
+ * @version 2.6.0
7
7
  */
8
8
  export interface PasswordRecoveryModalProps {
9
9
  open: boolean;
@@ -8,9 +8,10 @@ interface PhoneInputProps {
8
8
  ccphone?: string;
9
9
  onCcphoneChange?: (value: string) => void;
10
10
  disabled?: boolean;
11
+ readOnly?: boolean;
11
12
  error?: string;
12
13
  placeholder?: string;
13
14
  lockCcphone?: boolean;
14
15
  }
15
- export declare function PhoneInput({ value, onChange, ccphone, onCcphoneChange, disabled, error, placeholder, lockCcphone, }: PhoneInputProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function PhoneInput({ value, onChange, ccphone, onCcphoneChange, disabled, readOnly, error, placeholder, lockCcphone, }: PhoneInputProps): import("react/jsx-runtime").JSX.Element;
16
17
  export default PhoneInput;
@@ -2,7 +2,7 @@
2
2
  * Signup Modal for @ollaid/native-sso — Design aligned with web SSO
3
3
  * Full signup flow: intro → account-type → info → OTP → password → confirm → success
4
4
  *
5
- * @version 2.1.4
5
+ * @version 2.6.0
6
6
  */
7
7
  import type { UserInfos } from '../types/native';
8
8
  export interface SignupModalProps {
@@ -3,7 +3,7 @@
3
3
  * Lightweight replacements for shadcn/ui components + inline SVG icons
4
4
  * No external dependencies required
5
5
  *
6
- * @version 2.1.4
6
+ * @version 2.6.0
7
7
  */
8
8
  import React from 'react';
9
9
  export declare function IconShieldCheck(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -30,9 +30,11 @@ export declare function Dialog({ open, onOpenChange, children }: {
30
30
  onOpenChange: (open: boolean) => void;
31
31
  children: React.ReactNode;
32
32
  }): import("react/jsx-runtime").JSX.Element | null;
33
- export declare function DialogContent({ children, className }: {
33
+ export declare function DialogContent({ children, className, style, hideCloseButton }: {
34
34
  children: React.ReactNode;
35
35
  className?: string;
36
+ style?: React.CSSProperties;
37
+ hideCloseButton?: boolean;
36
38
  }): import("react/jsx-runtime").JSX.Element;
37
39
  export declare function DialogBody({ children, className, style }: {
38
40
  children: React.ReactNode;
@@ -22,7 +22,7 @@
22
22
  * };
23
23
  * ```
24
24
  *
25
- * @version 2.1.4
25
+ * @version 2.6.0
26
26
  */
27
27
  export interface UseLogoutOptions {
28
28
  /** Callback appelé après une déconnexion réussie (redirection, toast, etc.) */
@@ -2,7 +2,7 @@
2
2
  * Hook de récupération de mot de passe v1.0
3
3
  * Architecture Frontend-First avec appels directs à l'IAM
4
4
  *
5
- * @version 2.1.4
5
+ * @version 2.6.0
6
6
  */
7
7
  export interface UseMobilePasswordOptions {
8
8
  saasApiUrl: string;
@@ -2,7 +2,7 @@
2
2
  * Hook d'inscription Mobile SSO v1.0
3
3
  * Gère le flow: init → verify-otp → complete
4
4
  *
5
- * @version 2.1.4
5
+ * @version 2.6.0
6
6
  */
7
7
  import type { MobileRegistrationFormData, AccountType } from '../types/mobile';
8
8
  interface RegistrationConflict {
@@ -41,7 +41,7 @@ export declare function useMobileRegistration(options?: UseMobileRegistrationOpt
41
41
  error_type?: undefined;
42
42
  } | {
43
43
  success: boolean;
44
- error_type: any;
44
+ error_type: string | undefined;
45
45
  otp_code_dev?: undefined;
46
46
  otp_method?: undefined;
47
47
  otp_sent_to?: undefined;
@@ -2,8 +2,9 @@
2
2
  * Hook d'authentification Native SSO v1.0
3
3
  * Architecture Frontend-First avec appels directs à l'IAM
4
4
  *
5
- * @version 2.1.4
5
+ * @version 2.6.0
6
6
  */
7
+ import { type NativeStorageAdapter } from '../services/api';
7
8
  import type { NativeAuthStatus, NativeExchangeResponse, AccountType } from '../types/native';
8
9
  export interface UseNativeAuthOptions {
9
10
  /** URL du Backend SaaS */
@@ -19,6 +20,8 @@ export interface UseNativeAuthOptions {
19
20
  * Permet le multi-tenant dynamique : 'iam', 'iam_vendor', 'iam_client', etc.
20
21
  */
21
22
  configPrefix?: string;
23
+ /** Stockage injecté pour les apps natives / Capacitor */
24
+ storage?: NativeStorageAdapter;
22
25
  }
23
26
  export declare function useNativeAuth(options: UseNativeAuthOptions): {
24
27
  credentialsLoaded: boolean;
@@ -126,7 +129,7 @@ export declare function useNativeAuth(options: UseNativeAuthOptions): {
126
129
  success: boolean;
127
130
  user: {
128
131
  iam_reference: string;
129
- alias_reference: any;
132
+ alias_reference: string;
130
133
  id?: number;
131
134
  reference: string;
132
135
  name: string;
@@ -181,7 +184,7 @@ export declare function useNativeAuth(options: UseNativeAuthOptions): {
181
184
  success: boolean;
182
185
  user: {
183
186
  iam_reference: string;
184
- alias_reference: any;
187
+ alias_reference: string;
185
188
  id?: number;
186
189
  reference: string;
187
190
  name: string;
@@ -223,7 +226,7 @@ export declare function useNativeAuth(options: UseNativeAuthOptions): {
223
226
  success: boolean;
224
227
  user: {
225
228
  iam_reference: string;
226
- alias_reference: any;
229
+ alias_reference: string;
227
230
  id?: number;
228
231
  reference: string;
229
232
  name: string;
@@ -255,7 +258,7 @@ export declare function useNativeAuth(options: UseNativeAuthOptions): {
255
258
  success: boolean;
256
259
  user: {
257
260
  iam_reference: string;
258
- alias_reference: any;
261
+ alias_reference: string;
259
262
  id?: number;
260
263
  reference: string;
261
264
  name: string;
@@ -10,7 +10,7 @@
10
10
  * - Si 401 → révoque l'IAM (POST /iam/disconnect) + nettoie le frontend
11
11
  * - Ne déconnecte PAS si offline ou serveur inaccessible
12
12
  *
13
- * @version 2.1.4
13
+ * @version 2.6.0
14
14
  */
15
15
  import type { UserInfos } from '../types/native';
16
16
  export interface UseTokenHealthCheckOptions {
@@ -22,6 +22,16 @@ export interface UseTokenHealthCheckOptions {
22
22
  iamApiUrl: string;
23
23
  /** Called when the backend explicitly invalidates the token (401) */
24
24
  onTokenInvalid: () => void;
25
+ /**
26
+ * Optional handler for 401. If provided, it can attempt a refresh and decide
27
+ * whether the session was recovered.
28
+ *
29
+ * Return values:
30
+ * - 'recovered': session is valid again (do NOT call onTokenInvalid)
31
+ * - 'invalid': token is explicitly invalid (call onTokenInvalid)
32
+ * - 'noop': fall back to default behavior
33
+ */
34
+ onUnauthorized?: () => Promise<'recovered' | 'invalid' | 'noop'>;
25
35
  /** Called when fresh user_infos are received */
26
36
  onUserUpdated?: (userInfos: UserInfos) => void;
27
37
  /** Debug mode */