@ollaid/native-sso 1.0.7 → 1.0.8

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/index.js CHANGED
@@ -125,8 +125,13 @@ function DialogContent({ children, className = "" }) {
125
125
  /* @__PURE__ */ jsx(
126
126
  "div",
127
127
  {
128
- style: { position: "fixed", inset: 0, backgroundColor: "rgba(0,0,0,0.5)" },
129
- onClick: () => onOpenChange(false)
128
+ style: {
129
+ position: "fixed",
130
+ inset: 0,
131
+ backgroundColor: "rgba(0,0,0,0.5)",
132
+ backdropFilter: "blur(4px)",
133
+ animation: "ollaid-overlay-in 0.25s ease-out"
134
+ }
130
135
  }
131
136
  ),
132
137
  /* @__PURE__ */ jsxs(
@@ -139,19 +144,21 @@ function DialogContent({ children, className = "" }) {
139
144
  width: "100%",
140
145
  maxWidth: "28rem",
141
146
  margin: "1rem",
142
- padding: "1.5rem",
147
+ padding: "1rem",
143
148
  borderRadius: "0.75rem",
144
149
  backgroundColor: "white",
145
150
  boxShadow: "0 25px 50px -12px rgba(0,0,0,0.25)",
146
151
  maxHeight: "90vh",
147
- overflowY: "auto"
152
+ display: "flex",
153
+ flexDirection: "column",
154
+ animation: "ollaid-modal-in 0.3s ease-out"
148
155
  },
149
156
  children: [
150
157
  /* @__PURE__ */ jsx(
151
158
  "button",
152
159
  {
153
160
  onClick: () => onOpenChange(false),
154
- style: { position: "absolute", right: "1rem", top: "1rem", background: "none", border: "none", cursor: "pointer", fontSize: "1.25rem", color: "#9ca3af", lineHeight: 1 },
161
+ style: { position: "absolute", right: "0.75rem", top: "0.75rem", background: "none", border: "none", cursor: "pointer", fontSize: "1.25rem", color: "#9ca3af", lineHeight: 1, zIndex: 2 },
155
162
  "aria-label": "Close",
156
163
  children: "✕"
157
164
  }
@@ -162,8 +169,14 @@ function DialogContent({ children, className = "" }) {
162
169
  )
163
170
  ] });
164
171
  }
172
+ function DialogBody({ children, className = "", style }) {
173
+ return /* @__PURE__ */ jsx("div", { className, style: { flex: 1, overflowY: "auto", paddingBottom: "0.5rem", minHeight: 0, ...style }, children });
174
+ }
175
+ function DialogFooter({ children, className = "", style }) {
176
+ return /* @__PURE__ */ jsx("div", { className, style: { flexShrink: 0, paddingTop: "0.75rem", borderTop: "1px solid #e5e7eb", display: "flex", flexDirection: "column", gap: "0.5rem", ...style }, children });
177
+ }
165
178
  function DialogHeader({ children, className = "", style }) {
166
- return /* @__PURE__ */ jsx("div", { className, style: { marginBottom: "0.5rem", ...style }, children });
179
+ return /* @__PURE__ */ jsx("div", { className, style: { marginBottom: "0.5rem", flexShrink: 0, ...style }, children });
167
180
  }
168
181
  function DialogTitle({ children, className = "" }) {
169
182
  return /* @__PURE__ */ jsx("h2", { className, style: { fontSize: "1.25rem", fontWeight: 600, color: "#111827" }, children });
@@ -263,7 +276,7 @@ if (typeof document !== "undefined") {
263
276
  if (!document.getElementById(styleId)) {
264
277
  const style = document.createElement("style");
265
278
  style.id = styleId;
266
- style.textContent = `@keyframes spin { to { transform: rotate(360deg); } }`;
279
+ style.textContent = `@keyframes spin { to { transform: rotate(360deg); } } @keyframes ollaid-overlay-in { from { opacity: 0; } to { opacity: 1; } } @keyframes ollaid-modal-in { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }`;
267
280
  document.head.appendChild(style);
268
281
  }
269
282
  }
@@ -939,7 +952,8 @@ function getIAMHeaders() {
939
952
  }
940
953
  return {
941
954
  "Content-Type": "application/json",
942
- "Accept": "application/json"
955
+ "Accept": "application/json",
956
+ "X-IAM-App-Key": creds.appKey
943
957
  };
944
958
  }
945
959
  const mobilePasswordService = {
@@ -1427,7 +1441,7 @@ function PasswordRecoveryModal({ open, onOpenChange, onSuccess, saasApiUrl, iamA
1427
1441
  /* @__PURE__ */ jsx(DialogTitle, { children: "Mot de passe modifié !" }),
1428
1442
  /* @__PURE__ */ jsx(DialogDescription, { children: "Votre mot de passe a été changé avec succès." })
1429
1443
  ] }),
1430
- /* @__PURE__ */ jsx(Button, { onClick: handleBackToLogin, style: { width: "100%", marginTop: "1rem" }, children: "Retour à la connexion" })
1444
+ /* @__PURE__ */ jsx(DialogFooter, { style: { borderTop: "none" }, children: /* @__PURE__ */ jsx(Button, { onClick: handleBackToLogin, style: { width: "100%" }, children: "Retour à la connexion" }) })
1431
1445
  ] }) });
1432
1446
  }
1433
1447
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
@@ -1447,49 +1461,35 @@ function PasswordRecoveryModal({ open, onOpenChange, onSuccess, saasApiUrl, iamA
1447
1461
  step === "password" && "Définissez votre nouveau mot de passe"
1448
1462
  ] })
1449
1463
  ] }),
1450
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem", display: "flex", flexDirection: "column", gap: "1rem" }, children: [
1464
+ /* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
1451
1465
  error && /* @__PURE__ */ jsx("div", { style: { padding: "0.75rem", borderRadius: "0.375rem", backgroundColor: C$3.redBg, color: C$3.red, fontSize: "0.875rem" }, children: error }),
1452
- step === "email" && /* @__PURE__ */ jsxs(Fragment, { children: [
1453
- /* @__PURE__ */ jsxs("div", { children: [
1454
- /* @__PURE__ */ jsx(Label, { htmlFor: "recovery-email", children: "Adresse email" }),
1455
- /* @__PURE__ */ jsx(Input, { id: "recovery-email", type: "email", placeholder: "vous@exemple.com", value: email, onChange: (e) => setEmail(e.target.value), disabled: pwLoading })
1456
- ] }),
1457
- /* @__PURE__ */ jsx(Button, { onClick: handleEmailSubmit, disabled: pwLoading, style: { width: "100%" }, children: pwLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
1458
- /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
1459
- " Vérification..."
1460
- ] }) : "Continuer" }),
1461
- /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleBackToLogin, style: { width: "100%" }, children: "Retour à la connexion" })
1466
+ step === "email" && /* @__PURE__ */ jsxs("div", { children: [
1467
+ /* @__PURE__ */ jsx(Label, { htmlFor: "recovery-email", children: "Adresse email" }),
1468
+ /* @__PURE__ */ jsx(Input, { id: "recovery-email", type: "email", placeholder: "vous@exemple.com", value: email, onChange: (e) => setEmail(e.target.value), disabled: pwLoading })
1462
1469
  ] }),
1463
- step === "method-choice" && /* @__PURE__ */ jsxs(Fragment, { children: [
1464
- /* @__PURE__ */ jsx(RadioGroup, { value: selectedMethod, onValueChange: (v) => setSelectedMethod(v), children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
1465
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.75rem", padding: "1rem", borderRadius: "0.5rem", border: `2px solid ${selectedMethod === "email" ? C$3.primary : C$3.gray200}`, cursor: "pointer" }, onClick: () => setSelectedMethod("email"), children: [
1466
- /* @__PURE__ */ jsx(RadioGroupItem, { value: "email", id: "method-email" }),
1467
- /* @__PURE__ */ jsxs("div", { children: [
1468
- /* @__PURE__ */ jsx("div", { style: { fontWeight: 500 }, children: "Par email" }),
1469
- /* @__PURE__ */ jsx("div", { style: { fontSize: "0.75rem", color: C$3.gray500 }, children: maskedEmail })
1470
- ] })
1471
- ] }),
1472
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.75rem", padding: "1rem", borderRadius: "0.5rem", border: `2px solid ${selectedMethod === "phone" ? C$3.primary : C$3.gray200}`, cursor: "pointer" }, onClick: () => setSelectedMethod("phone"), children: [
1473
- /* @__PURE__ */ jsx(RadioGroupItem, { value: "phone", id: "method-phone" }),
1474
- /* @__PURE__ */ jsxs("div", { children: [
1475
- /* @__PURE__ */ jsx("div", { style: { fontWeight: 500 }, children: "Par SMS" }),
1476
- /* @__PURE__ */ jsx("div", { style: { fontSize: "0.75rem", color: C$3.gray500 }, children: maskedPhone })
1477
- ] })
1470
+ step === "method-choice" && /* @__PURE__ */ jsx(RadioGroup, { value: selectedMethod, onValueChange: (v) => setSelectedMethod(v), children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
1471
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.75rem", padding: "1rem", borderRadius: "0.5rem", border: `2px solid ${selectedMethod === "email" ? C$3.primary : C$3.gray200}`, cursor: "pointer" }, onClick: () => setSelectedMethod("email"), children: [
1472
+ /* @__PURE__ */ jsx(RadioGroupItem, { value: "email", id: "method-email" }),
1473
+ /* @__PURE__ */ jsxs("div", { children: [
1474
+ /* @__PURE__ */ jsx("div", { style: { fontWeight: 500 }, children: "Par email" }),
1475
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "0.75rem", color: C$3.gray500 }, children: maskedEmail })
1478
1476
  ] })
1479
- ] }) }),
1480
- /* @__PURE__ */ jsx(Button, { onClick: handleMethodSubmit, disabled: pwLoading, style: { width: "100%" }, children: pwLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
1481
- /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
1482
- " Envoi..."
1483
- ] }) : "Envoyer le code" })
1484
- ] }),
1477
+ ] }),
1478
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.75rem", padding: "1rem", borderRadius: "0.5rem", border: `2px solid ${selectedMethod === "phone" ? C$3.primary : C$3.gray200}`, cursor: "pointer" }, onClick: () => setSelectedMethod("phone"), children: [
1479
+ /* @__PURE__ */ jsx(RadioGroupItem, { value: "phone", id: "method-phone" }),
1480
+ /* @__PURE__ */ jsxs("div", { children: [
1481
+ /* @__PURE__ */ jsx("div", { style: { fontWeight: 500 }, children: "Par SMS" }),
1482
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "0.75rem", color: C$3.gray500 }, children: maskedPhone })
1483
+ ] })
1484
+ ] })
1485
+ ] }) }),
1485
1486
  step === "otp" && /* @__PURE__ */ jsxs(Fragment, { children: [
1486
1487
  /* @__PURE__ */ jsx(OTPInput, { value: otp, onChange: setOtp, disabled: pwLoading }),
1487
1488
  /* @__PURE__ */ jsx("div", { style: { textAlign: "center", fontSize: "0.875rem" }, children: resendCooldown > 0 ? /* @__PURE__ */ jsxs("span", { style: { color: C$3.gray500 }, children: [
1488
1489
  "Renvoyer dans ",
1489
1490
  resendCooldown,
1490
1491
  "s"
1491
- ] }) : /* @__PURE__ */ jsx("button", { type: "button", style: { color: C$3.primary, background: "none", border: "none", cursor: "pointer", textDecoration: "underline" }, onClick: handleResendOTP, children: "Code non reçu ? Renvoyer" }) }),
1492
- /* @__PURE__ */ jsx(Button, { onClick: handleOTPSubmit, disabled: otp.length !== 6, style: { width: "100%" }, children: "Vérifier" })
1492
+ ] }) : /* @__PURE__ */ jsx("button", { type: "button", style: { color: C$3.primary, background: "none", border: "none", cursor: "pointer", textDecoration: "underline" }, onClick: handleResendOTP, children: "Code non reçu ? Renvoyer" }) })
1493
1493
  ] }),
1494
1494
  step === "password" && /* @__PURE__ */ jsxs(Fragment, { children: [
1495
1495
  /* @__PURE__ */ jsxs("div", { children: [
@@ -1499,12 +1499,26 @@ function PasswordRecoveryModal({ open, onOpenChange, onSuccess, saasApiUrl, iamA
1499
1499
  /* @__PURE__ */ jsxs("div", { children: [
1500
1500
  /* @__PURE__ */ jsx(Label, { children: "Confirmer le mot de passe" }),
1501
1501
  /* @__PURE__ */ jsx(Input, { type: "password", placeholder: "Retapez votre mot de passe", value: confirmPassword, onChange: (e) => setConfirmPassword(e.target.value), disabled: pwLoading })
1502
- ] }),
1503
- /* @__PURE__ */ jsx(Button, { onClick: handlePasswordSubmit, disabled: pwLoading || !password || !confirmPassword, style: { width: "100%" }, children: pwLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
1504
- /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
1505
- " Modification..."
1506
- ] }) : "Modifier le mot de passe" })
1502
+ ] })
1507
1503
  ] })
1504
+ ] }) }),
1505
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
1506
+ step === "email" && /* @__PURE__ */ jsxs(Fragment, { children: [
1507
+ /* @__PURE__ */ jsx(Button, { onClick: handleEmailSubmit, disabled: pwLoading, style: { width: "100%" }, children: pwLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
1508
+ /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
1509
+ " Vérification..."
1510
+ ] }) : "Continuer" }),
1511
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleBackToLogin, style: { width: "100%" }, children: "Retour à la connexion" })
1512
+ ] }),
1513
+ step === "method-choice" && /* @__PURE__ */ jsx(Button, { onClick: handleMethodSubmit, disabled: pwLoading, style: { width: "100%" }, children: pwLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
1514
+ /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
1515
+ " Envoi..."
1516
+ ] }) : "Envoyer le code" }),
1517
+ step === "otp" && /* @__PURE__ */ jsx(Button, { onClick: handleOTPSubmit, disabled: otp.length !== 6, style: { width: "100%" }, children: "Vérifier" }),
1518
+ step === "password" && /* @__PURE__ */ jsx(Button, { onClick: handlePasswordSubmit, disabled: pwLoading || !password || !confirmPassword, style: { width: "100%" }, children: pwLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
1519
+ /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
1520
+ " Modification..."
1521
+ ] }) : "Modifier le mot de passe" })
1508
1522
  ] })
1509
1523
  ] }) });
1510
1524
  }
@@ -1871,7 +1885,7 @@ function useNativeAuth(options) {
1871
1885
  await nativeAuthService.loadCredentials();
1872
1886
  }
1873
1887
  const response = await nativeAuthService.loginAccessOtp(otpCode);
1874
- if (response.success && response.needs_access && response.process_token) {
1888
+ if ((response.needs_access || response.status === "needs_access") && response.process_token) {
1875
1889
  setState((prev) => ({
1876
1890
  ...prev,
1877
1891
  processToken: response.process_token,
@@ -2339,7 +2353,8 @@ function LoginModal({
2339
2353
  iamApiUrl,
2340
2354
  loading,
2341
2355
  showSwitchToSignup = true,
2342
- defaultAccountType
2356
+ defaultAccountType,
2357
+ initialPhone
2343
2358
  }) {
2344
2359
  const {
2345
2360
  status,
@@ -2418,6 +2433,12 @@ function LoginModal({
2418
2433
  useEffect(() => {
2419
2434
  if (!open) resetState();
2420
2435
  }, [open]);
2436
+ useEffect(() => {
2437
+ if (open && initialPhone) {
2438
+ setStep("phone-input");
2439
+ setPhone(initialPhone);
2440
+ }
2441
+ }, [open, initialPhone]);
2421
2442
  const exchangeCallbackToken = async (callbackToken) => {
2422
2443
  try {
2423
2444
  const response = await nativeAuthService.exchange(callbackToken);
@@ -2574,23 +2595,25 @@ function LoginModal({
2574
2595
  "."
2575
2596
  ] })
2576
2597
  ] }),
2577
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem" }, children: [
2578
- /* @__PURE__ */ jsxs("div", { style: { padding: "1rem", backgroundColor: C$2.gray100, borderRadius: "0.5rem", marginBottom: "1rem", fontSize: "0.875rem", color: C$2.gray500 }, children: [
2598
+ /* @__PURE__ */ jsxs(DialogBody, { children: [
2599
+ /* @__PURE__ */ jsxs("div", { style: { padding: "1rem", backgroundColor: C$2.gray100, borderRadius: "0.5rem", fontSize: "0.875rem", color: C$2.gray500 }, children: [
2579
2600
  "Votre compte ",
2580
2601
  /* @__PURE__ */ jsx("strong", { style: { color: C$2.primary }, children: "iam.ollaid.com" }),
2581
2602
  " existe déjà. Cliquez sur Confirmer pour créer votre accès à ",
2582
2603
  /* @__PURE__ */ jsx("strong", { style: { color: C$2.gray900 }, children: application.name }),
2583
2604
  "."
2584
2605
  ] }),
2585
- renderError(),
2586
- /* @__PURE__ */ jsx(Button, { onClick: handleGrantAccess, disabled: isSubmitting, style: { width: "100%", marginTop: "0.75rem" }, children: isSubmitting ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
2606
+ renderError()
2607
+ ] }),
2608
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
2609
+ /* @__PURE__ */ jsx(Button, { onClick: handleGrantAccess, disabled: isSubmitting, style: { width: "100%" }, children: isSubmitting ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
2587
2610
  /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
2588
2611
  "Création en cours..."
2589
2612
  ] }) : "Confirmer la création de mon compte" }),
2590
2613
  /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => {
2591
2614
  resetAuth();
2592
2615
  setStep("choice");
2593
- }, disabled: isSubmitting, style: { width: "100%", marginTop: "0.5rem" }, children: "Annuler" })
2616
+ }, disabled: isSubmitting, style: { width: "100%" }, children: "Annuler" })
2594
2617
  ] })
2595
2618
  ] }) : alternativeMethod ? /* @__PURE__ */ jsxs(Fragment, { children: [
2596
2619
  /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
@@ -2598,21 +2621,21 @@ function LoginModal({
2598
2621
  /* @__PURE__ */ jsx(DialogTitle, { children: "Moyen de connexion désactivé" }),
2599
2622
  /* @__PURE__ */ jsx(DialogDescription, { children: "Vos identifiants sont corrects, mais vous avez désactivé ce moyen de connexion depuis votre compte IAM." })
2600
2623
  ] }),
2601
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem" }, children: [
2602
- alternativeMethod.value && /* @__PURE__ */ jsxs("div", { style: { padding: "1rem", backgroundColor: C$2.gray100, borderRadius: "0.5rem", marginBottom: "1rem" }, children: [
2603
- /* @__PURE__ */ jsx("p", { style: { fontSize: "0.875rem", color: C$2.gray500, marginBottom: "0.75rem" }, children: "Vous pouvez vous connecter avec :" }),
2604
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", fontSize: "0.875rem", fontWeight: 500, color: C$2.gray900 }, children: [
2605
- alternativeMethod.type === "phone" ? /* @__PURE__ */ jsx(IconPhone, { style: { width: "1rem", height: "1rem", color: C$2.primary } }) : /* @__PURE__ */ jsx(IconMail, { style: { width: "1rem", height: "1rem", color: C$2.primary } }),
2606
- /* @__PURE__ */ jsx("span", { children: alternativeMethod.value })
2607
- ] })
2608
- ] }),
2624
+ /* @__PURE__ */ jsx(DialogBody, { children: alternativeMethod.value && /* @__PURE__ */ jsxs("div", { style: { padding: "1rem", backgroundColor: C$2.gray100, borderRadius: "0.5rem" }, children: [
2625
+ /* @__PURE__ */ jsx("p", { style: { fontSize: "0.875rem", color: C$2.gray500, marginBottom: "0.75rem" }, children: "Vous pouvez vous connecter avec :" }),
2626
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", fontSize: "0.875rem", fontWeight: 500, color: C$2.gray900 }, children: [
2627
+ alternativeMethod.type === "phone" ? /* @__PURE__ */ jsx(IconPhone, { style: { width: "1rem", height: "1rem", color: C$2.primary } }) : /* @__PURE__ */ jsx(IconMail, { style: { width: "1rem", height: "1rem", color: C$2.primary } }),
2628
+ /* @__PURE__ */ jsx("span", { children: alternativeMethod.value })
2629
+ ] })
2630
+ ] }) }),
2631
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
2609
2632
  /* @__PURE__ */ jsx(Button, { onClick: () => {
2610
2633
  if (alternativeMethod.type === "phone") setStep("phone-input");
2611
2634
  else setStep("email-check");
2612
2635
  resetAuth();
2613
2636
  }, style: { width: "100%" }, children: alternativeMethod.type === "phone" ? "Se connecter par téléphone" : "Se connecter par email" }),
2614
- /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => window.open("https://iam.ollaid.com", "_blank"), style: { width: "100%", marginTop: "0.5rem" }, children: "Réactiver depuis iam.ollaid.com" }),
2615
- /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => onOpenChange(false), style: { width: "100%", marginTop: "0.5rem" }, children: "Annuler" })
2637
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => window.open("https://iam.ollaid.com", "_blank"), style: { width: "100%" }, children: "Réactiver depuis iam.ollaid.com" }),
2638
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => onOpenChange(false), style: { width: "100%" }, children: "Annuler" })
2616
2639
  ] })
2617
2640
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2618
2641
  step !== "choice" && renderBackBtn(),
@@ -2622,7 +2645,7 @@ function LoginModal({
2622
2645
  /* @__PURE__ */ jsx(DialogTitle, { children: "Connexion" }),
2623
2646
  /* @__PURE__ */ jsx(DialogDescription, { children: "Choisissez votre méthode de connexion" })
2624
2647
  ] }),
2625
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem", display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
2648
+ /* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
2626
2649
  renderError(),
2627
2650
  /* @__PURE__ */ jsxs(Button, { variant: "outline", onClick: () => setStep("email-check"), style: methodBtnStyle, children: [
2628
2651
  /* @__PURE__ */ jsx("div", { style: methodIconStyle(C$2.accent), children: /* @__PURE__ */ jsx(IconMail, { style: { width: "1.25rem", height: "1.25rem", color: C$2.white } }) }),
@@ -2657,7 +2680,7 @@ function LoginModal({
2657
2680
  /* @__PURE__ */ jsx("span", { style: { color: C$2.gray500 }, children: "Pas encore de compte ? " }),
2658
2681
  /* @__PURE__ */ jsx("button", { type: "button", style: linkStyle$1, onClick: onSwitchToSignup, children: "Inscrivez-vous" })
2659
2682
  ] })
2660
- ] })
2683
+ ] }) })
2661
2684
  ] }),
2662
2685
  step === "email-check" && /* @__PURE__ */ jsxs(Fragment, { children: [
2663
2686
  /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
@@ -2665,7 +2688,7 @@ function LoginModal({
2665
2688
  /* @__PURE__ */ jsx(DialogTitle, { children: "Connexion par email" }),
2666
2689
  /* @__PURE__ */ jsx(DialogDescription, { children: "Entrez votre adresse email" })
2667
2690
  ] }),
2668
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem", display: "flex", flexDirection: "column", gap: "1rem" }, children: [
2691
+ /* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
2669
2692
  renderError(),
2670
2693
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.25rem" }, children: [
2671
2694
  /* @__PURE__ */ jsx(Label, { htmlFor: "email", children: "Adresse email" }),
@@ -2687,7 +2710,9 @@ function LoginModal({
2687
2710
  }
2688
2711
  )
2689
2712
  ] }),
2690
- /* @__PURE__ */ jsx("div", { style: { textAlign: "right" }, children: /* @__PURE__ */ jsx("button", { type: "button", style: { ...linkStyle$1, fontSize: "0.75rem" }, onClick: () => setShowPasswordRecovery(true), children: "Mot de passe oublié ?" }) }),
2713
+ /* @__PURE__ */ jsx("div", { style: { textAlign: "right" }, children: /* @__PURE__ */ jsx("button", { type: "button", style: { ...linkStyle$1, fontSize: "0.75rem" }, onClick: () => setShowPasswordRecovery(true), children: "Mot de passe oublié ?" }) })
2714
+ ] }) }),
2715
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
2691
2716
  renderLoaderBtn("Continuer", "Vérification...", handleEmailCheck, !email.trim()),
2692
2717
  showSwitchToSignup && /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", fontSize: "0.875rem" }, children: [
2693
2718
  /* @__PURE__ */ jsx("span", { style: { color: C$2.gray500 }, children: "Pas encore de compte ? " }),
@@ -2705,41 +2730,43 @@ function LoginModal({
2705
2730
  ] }),
2706
2731
  /* @__PURE__ */ jsx(DialogDescription, { children: email })
2707
2732
  ] }),
2708
- /* @__PURE__ */ jsxs("form", { onSubmit: handleEmailPasswordSubmit, style: { marginTop: "1rem", display: "flex", flexDirection: "column", gap: "1rem" }, children: [
2709
- renderError(),
2710
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.25rem" }, children: [
2711
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
2712
- /* @__PURE__ */ jsx(Label, { htmlFor: "password", children: "Mot de passe" }),
2713
- /* @__PURE__ */ jsx("button", { type: "button", style: { ...linkStyle$1, fontSize: "0.75rem" }, onClick: () => setShowPasswordRecovery(true), children: "Mot de passe oublié ?" })
2714
- ] }),
2715
- /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
2716
- /* @__PURE__ */ jsx(
2717
- Input,
2718
- {
2719
- id: "password",
2720
- type: showPassword ? "text" : "password",
2721
- placeholder: "••••••••",
2722
- value: password,
2723
- onChange: (e) => setPassword(e.target.value),
2724
- disabled: isSubmitting,
2725
- style: { paddingRight: "2.5rem" }
2726
- }
2727
- ),
2728
- /* @__PURE__ */ jsx(
2729
- "button",
2730
- {
2731
- type: "button",
2732
- onClick: () => setShowPassword(!showPassword),
2733
- style: { position: "absolute", right: 0, top: 0, height: "100%", padding: "0 0.75rem", background: "none", border: "none", cursor: "pointer" },
2734
- children: showPassword ? /* @__PURE__ */ jsx(IconEyeOff, { style: { width: "1rem", height: "1rem", color: C$2.gray500 } }) : /* @__PURE__ */ jsx(IconEye, { style: { width: "1rem", height: "1rem", color: C$2.gray500 } })
2735
- }
2736
- )
2733
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleEmailPasswordSubmit, style: { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 }, children: [
2734
+ /* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
2735
+ renderError(),
2736
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.25rem" }, children: [
2737
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
2738
+ /* @__PURE__ */ jsx(Label, { htmlFor: "password", children: "Mot de passe" }),
2739
+ /* @__PURE__ */ jsx("button", { type: "button", style: { ...linkStyle$1, fontSize: "0.75rem" }, onClick: () => setShowPasswordRecovery(true), children: "Mot de passe oublié ?" })
2740
+ ] }),
2741
+ /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
2742
+ /* @__PURE__ */ jsx(
2743
+ Input,
2744
+ {
2745
+ id: "password",
2746
+ type: showPassword ? "text" : "password",
2747
+ placeholder: "••••••••",
2748
+ value: password,
2749
+ onChange: (e) => setPassword(e.target.value),
2750
+ disabled: isSubmitting,
2751
+ style: { paddingRight: "2.5rem" }
2752
+ }
2753
+ ),
2754
+ /* @__PURE__ */ jsx(
2755
+ "button",
2756
+ {
2757
+ type: "button",
2758
+ onClick: () => setShowPassword(!showPassword),
2759
+ style: { position: "absolute", right: 0, top: 0, height: "100%", padding: "0 0.75rem", background: "none", border: "none", cursor: "pointer" },
2760
+ children: showPassword ? /* @__PURE__ */ jsx(IconEyeOff, { style: { width: "1rem", height: "1rem", color: C$2.gray500 } }) : /* @__PURE__ */ jsx(IconEye, { style: { width: "1rem", height: "1rem", color: C$2.gray500 } })
2761
+ }
2762
+ )
2763
+ ] })
2737
2764
  ] })
2738
- ] }),
2739
- /* @__PURE__ */ jsx(Button, { type: "submit", disabled: isSubmitting || !password, style: { width: "100%" }, children: isSubmitting ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
2765
+ ] }) }),
2766
+ /* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsx(Button, { type: "submit", disabled: isSubmitting || !password, style: { width: "100%" }, children: isSubmitting ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
2740
2767
  /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
2741
2768
  "Connexion..."
2742
- ] }) : "Se connecter" })
2769
+ ] }) : "Se connecter" }) })
2743
2770
  ] })
2744
2771
  ] }),
2745
2772
  step === "email-otp" && /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -2752,12 +2779,12 @@ function LoginModal({
2752
2779
  /* @__PURE__ */ jsx("strong", { style: { color: C$2.gray900 }, children: email })
2753
2780
  ] })
2754
2781
  ] }),
2755
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem", display: "flex", flexDirection: "column", gap: "1rem" }, children: [
2782
+ /* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
2756
2783
  renderError(),
2757
2784
  /* @__PURE__ */ jsx(OTPInput, { value: emailOtpCode, onChange: setEmailOtpCode, disabled: isSubmitting }),
2758
- renderResendLink(),
2759
- renderLoaderBtn("Vérifier", "Vérification...", handleEmailOtpVerify, emailOtpCode.length !== 6)
2760
- ] })
2785
+ renderResendLink()
2786
+ ] }) }),
2787
+ /* @__PURE__ */ jsx(DialogFooter, { children: renderLoaderBtn("Vérifier", "Vérification...", handleEmailOtpVerify, emailOtpCode.length !== 6) })
2761
2788
  ] }),
2762
2789
  step === "phone-input" && /* @__PURE__ */ jsxs(Fragment, { children: [
2763
2790
  /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
@@ -2765,7 +2792,7 @@ function LoginModal({
2765
2792
  /* @__PURE__ */ jsx(DialogTitle, { children: "Connexion par téléphone" }),
2766
2793
  /* @__PURE__ */ jsx(DialogDescription, { children: "Entrez votre numéro pour recevoir un code SMS" })
2767
2794
  ] }),
2768
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem", display: "flex", flexDirection: "column", gap: "1rem" }, children: [
2795
+ /* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
2769
2796
  renderError(),
2770
2797
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.25rem" }, children: [
2771
2798
  /* @__PURE__ */ jsx(Label, { children: "Indicatif" }),
@@ -2802,7 +2829,9 @@ function LoginModal({
2802
2829
  phone.replace(/\D/g, "").length,
2803
2830
  "/9)"
2804
2831
  ] })
2805
- ] }),
2832
+ ] })
2833
+ ] }) }),
2834
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
2806
2835
  renderLoaderBtn("Recevoir le code SMS", "Envoi en cours...", handlePhoneInit, phone.replace(/\D/g, "").length !== 9),
2807
2836
  showSwitchToSignup && /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", fontSize: "0.875rem" }, children: [
2808
2837
  /* @__PURE__ */ jsx("span", { style: { color: C$2.gray500 }, children: "Pas encore de compte ? " }),
@@ -2825,12 +2854,12 @@ function LoginModal({
2825
2854
  ] })
2826
2855
  ] })
2827
2856
  ] }),
2828
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem", display: "flex", flexDirection: "column", gap: "1rem" }, children: [
2857
+ /* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
2829
2858
  renderError(),
2830
2859
  /* @__PURE__ */ jsx(OTPInput, { value: phoneOtpCode, onChange: setPhoneOtpCode, disabled: isSubmitting }),
2831
- renderResendLink(),
2832
- renderLoaderBtn("Se connecter", "Vérification...", handlePhoneVerify, phoneOtpCode.length !== 6)
2833
- ] })
2860
+ renderResendLink()
2861
+ ] }) }),
2862
+ /* @__PURE__ */ jsx(DialogFooter, { children: renderLoaderBtn("Se connecter", "Vérification...", handlePhoneVerify, phoneOtpCode.length !== 6) })
2834
2863
  ] }),
2835
2864
  step === "access-otp" && /* @__PURE__ */ jsxs(Fragment, { children: [
2836
2865
  /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
@@ -2838,7 +2867,7 @@ function LoginModal({
2838
2867
  /* @__PURE__ */ jsx(DialogTitle, { children: "Code d'accès" }),
2839
2868
  /* @__PURE__ */ jsx(DialogDescription, { children: "Entrez le code d'accès à 8 chiffres" })
2840
2869
  ] }),
2841
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem", display: "flex", flexDirection: "column", gap: "1rem" }, children: [
2870
+ /* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
2842
2871
  renderError(),
2843
2872
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.25rem" }, children: [
2844
2873
  /* @__PURE__ */ jsx(Label, { children: "Code d'accès (8 chiffres)" }),
@@ -2855,9 +2884,9 @@ function LoginModal({
2855
2884
  maxLength: 8
2856
2885
  }
2857
2886
  )
2858
- ] }),
2859
- renderLoaderBtn("Se connecter", "Vérification...", handleAccessOtpSubmit, accessOtpCode.length !== 8)
2860
- ] })
2887
+ ] })
2888
+ ] }) }),
2889
+ /* @__PURE__ */ jsx(DialogFooter, { children: renderLoaderBtn("Se connecter", "Vérification...", handleAccessOtpSubmit, accessOtpCode.length !== 8) })
2861
2890
  ] })
2862
2891
  ] }) }) }),
2863
2892
  /* @__PURE__ */ jsx(
@@ -3054,6 +3083,7 @@ const COUNTRIES = [
3054
3083
  ];
3055
3084
  const DEFAULT_COUNTRY_CODE = "SN";
3056
3085
  const DEFAULT_DIAL_CODE = "+221";
3086
+ const COUNTRIES_SORTED_BY_CODE = [...COUNTRIES].sort((a, b) => a.code.localeCompare(b.code));
3057
3087
  const getCountryByCode = (code) => COUNTRIES.find((c) => c.code.toLowerCase() === code.toLowerCase());
3058
3088
  const getCountryByDialCode = (dialCode) => COUNTRIES.find((c) => c.dialCode === dialCode);
3059
3089
  const getDefaultCountry = () => COUNTRIES.find((c) => c.code === DEFAULT_COUNTRY_CODE);
@@ -3074,7 +3104,17 @@ function PhoneInput({
3074
3104
  placeholder = "77 123 45 67",
3075
3105
  lockCcphone = false
3076
3106
  }) {
3077
- const selectedCountry = getCountryByDialCode(ccphone) || COUNTRIES[0];
3107
+ const selectedCountry = getCountryByDialCode(ccphone) || COUNTRIES_SORTED_BY_CODE[0];
3108
+ const [dropdownOpen, setDropdownOpen] = useState(false);
3109
+ const dropdownRef = useRef(null);
3110
+ useEffect(() => {
3111
+ if (!dropdownOpen) return;
3112
+ const handler = (e) => {
3113
+ if (dropdownRef.current && !dropdownRef.current.contains(e.target)) setDropdownOpen(false);
3114
+ };
3115
+ document.addEventListener("mousedown", handler);
3116
+ return () => document.removeEventListener("mousedown", handler);
3117
+ }, [dropdownOpen]);
3078
3118
  const handleChange = (e) => {
3079
3119
  const cleaned = e.target.value.replace(/\D/g, "");
3080
3120
  onChange(cleaned.slice(0, selectedCountry.digits));
@@ -3085,33 +3125,96 @@ function PhoneInput({
3085
3125
  if (phone.length <= 7) return `${phone.slice(0, 2)} ${phone.slice(2, 5)} ${phone.slice(5)}`;
3086
3126
  return `${phone.slice(0, 2)} ${phone.slice(2, 5)} ${phone.slice(5, 7)} ${phone.slice(7)}`;
3087
3127
  };
3128
+ const handleSelect = (dialCode) => {
3129
+ if (onCcphoneChange) onCcphoneChange(dialCode);
3130
+ setDropdownOpen(false);
3131
+ };
3088
3132
  return /* @__PURE__ */ jsxs("div", { children: [
3089
3133
  /* @__PURE__ */ jsxs("div", { style: {
3090
3134
  display: "flex",
3091
3135
  alignItems: "center",
3092
3136
  border: `2px solid ${error ? "#ef4444" : "#d1d5db"}`,
3093
3137
  borderRadius: "0.5rem",
3094
- overflow: "hidden",
3138
+ overflow: "visible",
3095
3139
  opacity: disabled ? 0.5 : 1,
3096
- backgroundColor: disabled ? "#f3f4f6" : "white"
3140
+ backgroundColor: disabled ? "#f3f4f6" : "white",
3141
+ position: "relative"
3097
3142
  }, children: [
3098
- onCcphoneChange && !lockCcphone ? /* @__PURE__ */ jsx(
3099
- "select",
3100
- {
3101
- value: ccphone,
3102
- onChange: (e) => onCcphoneChange(e.target.value),
3103
- disabled,
3104
- style: { padding: "0.75rem", backgroundColor: "#f9fafb", borderRight: "1px solid #e5e7eb", fontWeight: 500, color: "#374151", outline: "none", border: "none", maxWidth: "7rem" },
3105
- children: COUNTRIES.map((c) => /* @__PURE__ */ jsxs("option", { value: c.dialCode, children: [
3106
- c.flag,
3107
- " ",
3108
- c.dialCode
3109
- ] }, `${c.code}-${c.dialCode}`))
3110
- }
3111
- ) : /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", padding: "0.75rem", backgroundColor: "#f9fafb", borderRight: "1px solid #e5e7eb" }, children: [
3112
- /* @__PURE__ */ jsx("span", { style: { fontSize: "1.125rem" }, children: selectedCountry.flag }),
3113
- /* @__PURE__ */ jsx("span", { style: { fontWeight: 500, color: "#374151" }, children: selectedCountry.dialCode })
3114
- ] }),
3143
+ onCcphoneChange && !lockCcphone ? /* @__PURE__ */ jsxs("div", { ref: dropdownRef, style: { position: "relative" }, children: [
3144
+ /* @__PURE__ */ jsxs(
3145
+ "button",
3146
+ {
3147
+ type: "button",
3148
+ onClick: () => !disabled && setDropdownOpen(!dropdownOpen),
3149
+ disabled,
3150
+ style: {
3151
+ display: "flex",
3152
+ alignItems: "center",
3153
+ gap: "0.375rem",
3154
+ padding: "0.75rem",
3155
+ backgroundColor: "#f9fafb",
3156
+ borderRight: "1px solid #e5e7eb",
3157
+ border: "none",
3158
+ cursor: disabled ? "not-allowed" : "pointer",
3159
+ fontWeight: 500,
3160
+ color: "#374151",
3161
+ fontSize: "0.9375rem",
3162
+ whiteSpace: "nowrap"
3163
+ },
3164
+ children: [
3165
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "1.125rem" }, children: selectedCountry.flag }),
3166
+ /* @__PURE__ */ jsx("span", { children: selectedCountry.dialCode }),
3167
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "0.625rem", marginLeft: "0.125rem" }, children: "▼" })
3168
+ ]
3169
+ }
3170
+ ),
3171
+ dropdownOpen && /* @__PURE__ */ jsx("div", { style: {
3172
+ position: "absolute",
3173
+ top: "100%",
3174
+ left: 0,
3175
+ zIndex: 50,
3176
+ backgroundColor: "white",
3177
+ border: "1px solid #d1d5db",
3178
+ borderRadius: "0.375rem",
3179
+ boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
3180
+ maxHeight: "15rem",
3181
+ overflowY: "auto",
3182
+ minWidth: "12rem",
3183
+ marginTop: "0.25rem"
3184
+ }, children: COUNTRIES_SORTED_BY_CODE.map((c) => /* @__PURE__ */ jsxs(
3185
+ "button",
3186
+ {
3187
+ type: "button",
3188
+ onClick: () => handleSelect(c.dialCode),
3189
+ style: {
3190
+ display: "flex",
3191
+ alignItems: "center",
3192
+ gap: "0.5rem",
3193
+ width: "100%",
3194
+ padding: "0.5rem 0.75rem",
3195
+ border: "none",
3196
+ cursor: "pointer",
3197
+ fontSize: "0.875rem",
3198
+ backgroundColor: c.dialCode === ccphone ? "#f3f4f6" : "transparent",
3199
+ textAlign: "left"
3200
+ },
3201
+ onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "#f3f4f6",
3202
+ onMouseLeave: (e) => e.currentTarget.style.backgroundColor = c.dialCode === ccphone ? "#f3f4f6" : "transparent",
3203
+ children: [
3204
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, color: "#374151", minWidth: "1.75rem" }, children: c.code }),
3205
+ /* @__PURE__ */ jsx("span", { children: c.flag }),
3206
+ /* @__PURE__ */ jsx("span", { style: { color: "#6b7280" }, children: c.dialCode })
3207
+ ]
3208
+ },
3209
+ `${c.code}-${c.dialCode}`
3210
+ )) })
3211
+ ] }) : (
3212
+ /* Locked view: only flag + dialCode */
3213
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.375rem", padding: "0.75rem", backgroundColor: "#f9fafb", borderRight: "1px solid #e5e7eb" }, children: [
3214
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "1.125rem" }, children: selectedCountry.flag }),
3215
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: 500, color: "#374151" }, children: selectedCountry.dialCode })
3216
+ ] })
3217
+ ),
3115
3218
  /* @__PURE__ */ jsx(
3116
3219
  "input",
3117
3220
  {
@@ -3414,6 +3517,18 @@ function useMobileRegistration(options) {
3414
3517
  }));
3415
3518
  return { success: false, error_type: response.error_type };
3416
3519
  } catch (err) {
3520
+ if (err instanceof ApiError && err.statusCode === 409 && err.response) {
3521
+ const resp = err.response;
3522
+ if (resp.conflict) {
3523
+ setState((prev) => ({
3524
+ ...prev,
3525
+ loading: false,
3526
+ error: resp.message || "Ce compte existe déjà",
3527
+ conflict: resp.conflict
3528
+ }));
3529
+ return { success: false, error_type: resp.error_type };
3530
+ }
3531
+ }
3417
3532
  const message = getErrorMessage(err, "l'inscription");
3418
3533
  setState((prev) => ({ ...prev, loading: false, error: message, conflict: null }));
3419
3534
  return { success: false };
@@ -3559,6 +3674,7 @@ const C$1 = {
3559
3674
  gray900: "#111827",
3560
3675
  red: "#dc2626",
3561
3676
  redBg: "#fef2f2",
3677
+ amber: "#f59e0b",
3562
3678
  amberBg: "#fef3c7",
3563
3679
  white: "#ffffff"
3564
3680
  };
@@ -3651,12 +3767,14 @@ function SuccessOrbit() {
3651
3767
  })
3652
3768
  ] });
3653
3769
  }
3654
- function SignupModal({ open, onOpenChange, onSwitchToLogin, onSignupSuccess, saasApiUrl, iamApiUrl, defaultAccountType }) {
3770
+ function SignupModal({ open, onOpenChange, onSwitchToLogin, onSignupSuccess, saasApiUrl, iamApiUrl, defaultAccountType, onSwitchToLoginWithPhone }) {
3771
+ var _a, _b, _c, _d, _e, _f;
3655
3772
  const {
3656
3773
  status,
3657
3774
  formData,
3658
3775
  loading: regLoading,
3659
3776
  error: regError,
3777
+ conflict,
3660
3778
  accountType,
3661
3779
  setAccountType,
3662
3780
  isPhoneOnly,
@@ -3668,6 +3786,7 @@ function SignupModal({ open, onOpenChange, onSwitchToLogin, onSignupSuccess, saa
3668
3786
  reset: resetReg,
3669
3787
  clearError
3670
3788
  } = useMobileRegistration({ saasApiUrl, iamApiUrl });
3789
+ const [showPasswordRecovery, setShowPasswordRecovery] = useState(false);
3671
3790
  const [step, setStep] = useState("intro");
3672
3791
  const [otpCode, setOtpCode] = useState("");
3673
3792
  const [password, setPassword] = useState("");
@@ -3720,31 +3839,35 @@ function SignupModal({ open, onOpenChange, onSwitchToLogin, onSignupSuccess, saa
3720
3839
  }
3721
3840
  };
3722
3841
  const handleInfoSubmit = async (e) => {
3723
- var _a, _b, _c, _d, _e, _f;
3842
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
3724
3843
  e.preventDefault();
3725
3844
  setLocalError(null);
3726
3845
  clearError();
3727
- if (!((_a = formData.name) == null ? void 0 : _a.trim())) {
3846
+ if (!((_a2 = formData.name) == null ? void 0 : _a2.trim())) {
3728
3847
  setLocalError("Le nom est requis");
3729
3848
  return;
3730
3849
  }
3731
- if (!isPhoneOnly && !((_b = formData.email) == null ? void 0 : _b.trim())) {
3850
+ if (!isPhoneOnly && !((_b2 = formData.email) == null ? void 0 : _b2.trim())) {
3732
3851
  setLocalError("L'adresse email est requise");
3733
3852
  return;
3734
3853
  }
3735
- if (!((_c = formData.phone) == null ? void 0 : _c.trim()) || (((_d = formData.phone) == null ? void 0 : _d.length) || 0) < 6) {
3854
+ if (!((_c2 = formData.phone) == null ? void 0 : _c2.trim()) || (((_d2 = formData.phone) == null ? void 0 : _d2.length) || 0) < 6) {
3736
3855
  setLocalError("Numéro de téléphone invalide");
3737
3856
  return;
3738
3857
  }
3858
+ if (formData.ccphone === "+221" && ((_e2 = formData.phone) == null ? void 0 : _e2.length) !== 9) {
3859
+ setLocalError("Le numéro sénégalais doit contenir exactement 9 chiffres");
3860
+ return;
3861
+ }
3739
3862
  if (isPhoneOnly && formData.ccphone !== "+221") {
3740
3863
  setLocalError("L'inscription par téléphone est réservée aux numéros sénégalais (+221)");
3741
3864
  return;
3742
3865
  }
3743
- if (!((_e = formData.town) == null ? void 0 : _e.trim())) {
3866
+ if (!((_f2 = formData.town) == null ? void 0 : _f2.trim())) {
3744
3867
  setLocalError("La ville est requise");
3745
3868
  return;
3746
3869
  }
3747
- if (!((_f = formData.country) == null ? void 0 : _f.trim())) {
3870
+ if (!((_g = formData.country) == null ? void 0 : _g.trim())) {
3748
3871
  setLocalError("Le pays est requis");
3749
3872
  return;
3750
3873
  }
@@ -3796,197 +3919,281 @@ function SignupModal({ open, onOpenChange, onSwitchToLogin, onSignupSuccess, saa
3796
3919
  goToStep("info");
3797
3920
  };
3798
3921
  const renderError = () => error ? /* @__PURE__ */ jsx("div", { style: { padding: "0.75rem", borderRadius: "0.375rem", backgroundColor: C$1.redBg, color: C$1.red, fontSize: "0.875rem" }, children: error }) : null;
3799
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsx(DialogContent, { children: signupSuccess && signupData ? /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3800
- /* @__PURE__ */ jsx(SuccessOrbit, {}),
3801
- /* @__PURE__ */ jsx(DialogTitle, { children: "Félicitations !" }),
3802
- /* @__PURE__ */ jsxs(DialogDescription, { children: [
3803
- "Votre compte a été créé avec succès. Bienvenue ",
3804
- formData.name,
3805
- " !"
3806
- ] }),
3807
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "0.5rem", fontSize: "0.875rem", color: C$1.gray500, marginTop: "1rem" }, children: [
3808
- /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
3809
- "Connexion automatique en cours..."
3810
- ] })
3811
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3812
- step === "intro" && /* @__PURE__ */ jsxs(Fragment, { children: [
3813
- /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3814
- /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.accent + "1a", "4rem"), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "2rem", height: "2rem", color: C$1.accent } }) }),
3815
- /* @__PURE__ */ jsx(DialogTitle, { children: "Ouvrez un compte Ollaid" }),
3816
- /* @__PURE__ */ jsx(DialogDescription, { children: "Un compte unique qui vous donne accès à toutes les applications" })
3922
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3923
+ /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsx(DialogContent, { children: signupSuccess && signupData ? /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3924
+ /* @__PURE__ */ jsx(SuccessOrbit, {}),
3925
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Félicitations !" }),
3926
+ /* @__PURE__ */ jsxs(DialogDescription, { children: [
3927
+ "Votre compte a été créé avec succès. Bienvenue ",
3928
+ formData.name,
3929
+ " !"
3817
3930
  ] }),
3818
- /* @__PURE__ */ jsx(AppsLogoSlider, { iamApiUrl }),
3819
- /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem", fontSize: "0.875rem", color: C$1.gray500, margin: "1rem 0" }, children: ["Un seul compte pour toutes les applications", "Plus besoin de multiples mots de passe", "Connexion simplifiée et sécurisée"].map((text) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.75rem" }, children: [
3820
- /* @__PURE__ */ jsx(IconCheckCircle2, { style: { width: "1.25rem", height: "1.25rem", color: C$1.green, flexShrink: 0 } }),
3821
- text
3822
- ] }, text)) }),
3823
- /* @__PURE__ */ jsx(StepIndicator, { current: 1 }),
3824
- /* @__PURE__ */ jsx(Button, { onClick: () => goToStep("account-type"), style: { width: "100%", marginTop: "1rem" }, children: "Suivant →" }),
3825
- /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", fontSize: "0.875rem", marginTop: "1rem" }, children: [
3826
- /* @__PURE__ */ jsx("span", { style: { color: C$1.gray500 }, children: "Déjà un compte ? " }),
3827
- /* @__PURE__ */ jsx("button", { type: "button", style: linkStyle, onClick: onSwitchToLogin, children: "Connectez-vous" })
3931
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "0.5rem", fontSize: "0.875rem", color: C$1.gray500, marginTop: "1rem" }, children: [
3932
+ /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
3933
+ "Connexion automatique en cours..."
3828
3934
  ] })
3829
- ] }),
3830
- step === "account-type" && /* @__PURE__ */ jsxs(Fragment, { children: [
3831
- /* @__PURE__ */ jsx("button", { onClick: () => goToStep("intro"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
3832
- /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3833
- /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.gray100), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "1.5rem", height: "1.5rem", color: C$1.primary } }) }),
3834
- /* @__PURE__ */ jsx(DialogTitle, { children: "Choisissez votre type de compte" })
3835
- ] }),
3836
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem", marginTop: "1rem" }, children: [
3837
- /* @__PURE__ */ jsxs(
3838
- "button",
3839
- {
3840
- type: "button",
3841
- onClick: () => handleAccountTypeSelect("email"),
3842
- style: { width: "100%", padding: "1rem", border: `2px solid ${C$1.gray200}`, borderRadius: "0.5rem", textAlign: "left", cursor: "pointer", background: C$1.white, display: "flex", alignItems: "center", gap: "0.75rem" },
3843
- children: [
3844
- /* @__PURE__ */ jsx("div", { style: { width: "2.5rem", height: "2.5rem", backgroundColor: C$1.accent, borderRadius: "0.5rem", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0 }, children: /* @__PURE__ */ jsx(IconMail, { style: { width: "1.25rem", height: "1.25rem", color: C$1.white } }) }),
3845
- /* @__PURE__ */ jsxs("div", { children: [
3846
- /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, color: C$1.gray900 }, children: "Email + Téléphone" }),
3847
- /* @__PURE__ */ jsx("div", { style: { fontSize: "0.875rem", color: C$1.gray500 }, children: "Compte complet" })
3848
- ] })
3849
- ]
3850
- }
3851
- ),
3852
- /* @__PURE__ */ jsxs(
3853
- "button",
3854
- {
3855
- type: "button",
3856
- onClick: () => handleAccountTypeSelect("phone-only"),
3857
- style: { width: "100%", padding: "1rem", border: `2px solid ${C$1.gray200}`, borderRadius: "0.5rem", textAlign: "left", cursor: "pointer", background: C$1.white, display: "flex", alignItems: "center", gap: "0.75rem" },
3858
- children: [
3859
- /* @__PURE__ */ jsx("div", { style: { width: "2.5rem", height: "2.5rem", backgroundColor: C$1.accent, borderRadius: "0.5rem", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0 }, children: /* @__PURE__ */ jsx(IconSmartphone, { style: { width: "1.25rem", height: "1.25rem", color: C$1.white } }) }),
3860
- /* @__PURE__ */ jsxs("div", { children: [
3861
- /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, color: C$1.gray900 }, children: "Téléphone uniquement" }),
3862
- /* @__PURE__ */ jsx("div", { style: { fontSize: "0.875rem", color: C$1.gray500 }, children: "🇸🇳 Sénégal uniquement" })
3863
- ] })
3864
- ]
3865
- }
3866
- )
3867
- ] }),
3868
- /* @__PURE__ */ jsx(StepIndicator, { current: 2 })
3869
- ] }),
3870
- step === "info" && /* @__PURE__ */ jsxs(Fragment, { children: [
3871
- /* @__PURE__ */ jsx("button", { onClick: () => goToStep("account-type"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
3872
- /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3873
- /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.primary + "1a"), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "1.5rem", height: "1.5rem", color: C$1.primary } }) }),
3874
- /* @__PURE__ */ jsx(DialogTitle, { children: "Créer votre compte" })
3875
- ] }),
3876
- isPhoneOnly && /* @__PURE__ */ jsx("div", { style: { padding: "0.75rem", borderRadius: "0.375rem", backgroundColor: C$1.accent + "1a", color: C$1.accent, fontSize: "0.8125rem", marginTop: "0.5rem", textAlign: "center" }, children: "📱 Inscription par téléphone — 🇸🇳 Sénégal uniquement" }),
3877
- !isPhoneOnly && /* @__PURE__ */ jsx("div", { style: { padding: "0.75rem", borderRadius: "0.375rem", backgroundColor: C$1.amberBg, color: "#92400e", fontSize: "0.8125rem", marginTop: "0.5rem", textAlign: "center" }, children: "⚠️ Un code OTP sera envoyé par email pour vérification" }),
3878
- /* @__PURE__ */ jsxs("form", { onSubmit: handleInfoSubmit, style: { display: "flex", flexDirection: "column", gap: "0.75rem", marginTop: "0.75rem" }, children: [
3879
- renderError(),
3880
- /* @__PURE__ */ jsxs("div", { children: [
3881
- /* @__PURE__ */ jsx(Label, { children: "Nom complet" }),
3882
- /* @__PURE__ */ jsx(Input, { placeholder: "Jean Dupont", value: formData.name || "", onChange: (e) => updateFormData({ name: e.target.value }), disabled: regLoading })
3935
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3936
+ step === "intro" && /* @__PURE__ */ jsxs(Fragment, { children: [
3937
+ /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3938
+ /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.accent + "1a", "4rem"), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "2rem", height: "2rem", color: C$1.accent } }) }),
3939
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Ouvrez un compte Ollaid" }),
3940
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Un compte unique qui vous donne accès à toutes les applications" })
3883
3941
  ] }),
3884
- !isPhoneOnly && /* @__PURE__ */ jsxs("div", { children: [
3885
- /* @__PURE__ */ jsx(Label, { children: "Adresse email" }),
3886
- /* @__PURE__ */ jsx(Input, { type: "email", placeholder: "vous@exemple.com", value: formData.email || "", onChange: (e) => updateFormData({ email: e.target.value }), disabled: regLoading })
3942
+ /* @__PURE__ */ jsxs(DialogBody, { children: [
3943
+ /* @__PURE__ */ jsx(AppsLogoSlider, { iamApiUrl }),
3944
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem", fontSize: "0.875rem", color: C$1.gray500, margin: "0.75rem 0" }, children: ["Un seul compte pour toutes les applications", "Plus besoin de multiples mots de passe", "Connexion simplifiée et sécurisée"].map((text) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.75rem" }, children: [
3945
+ /* @__PURE__ */ jsx(IconCheckCircle2, { style: { width: "1.25rem", height: "1.25rem", color: C$1.green, flexShrink: 0 } }),
3946
+ text
3947
+ ] }, text)) }),
3948
+ /* @__PURE__ */ jsx(StepIndicator, { current: 1 })
3887
3949
  ] }),
3888
- /* @__PURE__ */ jsxs("div", { children: [
3889
- /* @__PURE__ */ jsx(Label, { children: "Numéro de téléphone" }),
3890
- /* @__PURE__ */ jsx(PhoneInput, { value: formData.phone || "", onChange: (p) => updateFormData({ phone: p }), ccphone: formData.ccphone || "+221", onCcphoneChange: (c) => updateFormData({ ccphone: c }), disabled: regLoading, lockCcphone: isPhoneOnly })
3950
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
3951
+ /* @__PURE__ */ jsx(Button, { onClick: () => goToStep("account-type"), style: { width: "100%" }, children: "Suivant →" }),
3952
+ /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", fontSize: "0.875rem" }, children: [
3953
+ /* @__PURE__ */ jsx("span", { style: { color: C$1.gray500 }, children: "Déjà un compte ? " }),
3954
+ /* @__PURE__ */ jsx("button", { type: "button", style: linkStyle, onClick: onSwitchToLogin, children: "Connectez-vous" })
3955
+ ] })
3956
+ ] })
3957
+ ] }),
3958
+ step === "account-type" && /* @__PURE__ */ jsxs(Fragment, { children: [
3959
+ /* @__PURE__ */ jsx("button", { onClick: () => goToStep("intro"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
3960
+ /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3961
+ /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.gray100), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "1.5rem", height: "1.5rem", color: C$1.primary } }) }),
3962
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Choisissez votre type de compte" })
3891
3963
  ] }),
3892
- /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.75rem" }, children: [
3893
- /* @__PURE__ */ jsxs("div", { children: [
3894
- /* @__PURE__ */ jsx(Label, { children: "Ville" }),
3895
- /* @__PURE__ */ jsx(Input, { placeholder: "Dakar", value: formData.town || "", onChange: (e) => updateFormData({ town: e.target.value }), disabled: regLoading })
3964
+ /* @__PURE__ */ jsxs(DialogBody, { children: [
3965
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
3966
+ /* @__PURE__ */ jsxs(
3967
+ "button",
3968
+ {
3969
+ type: "button",
3970
+ onClick: () => handleAccountTypeSelect("email"),
3971
+ style: { width: "100%", padding: "1rem", border: `2px solid ${C$1.gray200}`, borderRadius: "0.5rem", textAlign: "left", cursor: "pointer", background: C$1.white, display: "flex", alignItems: "center", gap: "0.75rem" },
3972
+ children: [
3973
+ /* @__PURE__ */ jsx("div", { style: { width: "2.5rem", height: "2.5rem", backgroundColor: C$1.accent, borderRadius: "0.5rem", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0 }, children: /* @__PURE__ */ jsx(IconMail, { style: { width: "1.25rem", height: "1.25rem", color: C$1.white } }) }),
3974
+ /* @__PURE__ */ jsxs("div", { children: [
3975
+ /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, color: C$1.gray900 }, children: "Email + Téléphone" }),
3976
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "0.875rem", color: C$1.gray500 }, children: "Compte complet" })
3977
+ ] })
3978
+ ]
3979
+ }
3980
+ ),
3981
+ /* @__PURE__ */ jsxs(
3982
+ "button",
3983
+ {
3984
+ type: "button",
3985
+ onClick: () => handleAccountTypeSelect("phone-only"),
3986
+ style: { width: "100%", padding: "1rem", border: `2px solid ${C$1.gray200}`, borderRadius: "0.5rem", textAlign: "left", cursor: "pointer", background: C$1.white, display: "flex", alignItems: "center", gap: "0.75rem" },
3987
+ children: [
3988
+ /* @__PURE__ */ jsx("div", { style: { width: "2.5rem", height: "2.5rem", backgroundColor: C$1.accent, borderRadius: "0.5rem", display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0 }, children: /* @__PURE__ */ jsx(IconSmartphone, { style: { width: "1.25rem", height: "1.25rem", color: C$1.white } }) }),
3989
+ /* @__PURE__ */ jsxs("div", { children: [
3990
+ /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, color: C$1.gray900 }, children: "Téléphone uniquement" }),
3991
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "0.875rem", color: C$1.gray500 }, children: "🇸🇳 Sénégal uniquement" })
3992
+ ] })
3993
+ ]
3994
+ }
3995
+ )
3896
3996
  ] }),
3897
- /* @__PURE__ */ jsxs("div", { children: [
3898
- /* @__PURE__ */ jsx(Label, { children: "Pays" }),
3899
- /* @__PURE__ */ jsx(
3900
- "select",
3997
+ /* @__PURE__ */ jsx(StepIndicator, { current: 2 })
3998
+ ] })
3999
+ ] }),
4000
+ step === "info" && /* @__PURE__ */ jsxs(Fragment, { children: [
4001
+ /* @__PURE__ */ jsx("button", { onClick: () => goToStep("account-type"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
4002
+ conflict ? /* @__PURE__ */ jsxs(Fragment, { children: [
4003
+ /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
4004
+ /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.amberBg), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "1.5rem", height: "1.5rem", color: C$1.amber } }) }),
4005
+ /* @__PURE__ */ jsx(DialogTitle, { children: conflict.type === "phone" ? "Numéro déjà utilisé" : "Email déjà utilisé" }),
4006
+ /* @__PURE__ */ jsxs(DialogDescription, { children: [
4007
+ conflict.type === "phone" ? `Le numéro ${formData.ccphone || ""} ${formData.phone || ""} est déjà associé à un compte.` : `L'adresse ${formData.email || ""} est déjà associée à un compte.`,
4008
+ " ",
4009
+ "S'il s'agit du vôtre, connectez-vous."
4010
+ ] })
4011
+ ] }),
4012
+ /* @__PURE__ */ jsxs(DialogFooter, { style: { borderTop: "none" }, children: [
4013
+ conflict.type === "phone" && formData.ccphone === "+221" && ((_a = conflict.options) == null ? void 0 : _a.can_login) && /* @__PURE__ */ jsxs(
4014
+ Button,
3901
4015
  {
3902
- value: formData.country || DEFAULT_COUNTRY_CODE,
3903
- onChange: (e) => {
3904
- const country = getCountryByCode(e.target.value);
3905
- updateFormData({ country: e.target.value, ccphone: (country == null ? void 0 : country.dialCode) || "+221" });
4016
+ onClick: () => {
4017
+ const fullPhone = formData.phone || "";
4018
+ if (onSwitchToLoginWithPhone) onSwitchToLoginWithPhone(fullPhone);
4019
+ else onSwitchToLogin();
3906
4020
  },
3907
- disabled: regLoading || isPhoneOnly,
3908
- style: { width: "100%", padding: "0.5rem", borderRadius: "0.375rem", border: "1px solid #d1d5db", backgroundColor: regLoading || isPhoneOnly ? "#f3f4f6" : "white", fontSize: "0.875rem" },
3909
- children: COUNTRIES.map((c) => /* @__PURE__ */ jsxs("option", { value: c.code, children: [
3910
- c.flag,
3911
- " ",
3912
- c.name
3913
- ] }, c.code))
4021
+ style: { width: "100%" },
4022
+ children: [
4023
+ /* @__PURE__ */ jsx(IconSmartphone, { style: { width: "1rem", height: "1rem" } }),
4024
+ "Se connecter par téléphone"
4025
+ ]
3914
4026
  }
3915
- )
4027
+ ),
4028
+ (conflict.type === "email" || conflict.type === "phone" && formData.ccphone !== "+221") && ((_b = conflict.options) == null ? void 0 : _b.can_login) && /* @__PURE__ */ jsx(Button, { onClick: onSwitchToLogin, style: { width: "100%" }, children: "Se connecter" }),
4029
+ !isPhoneOnly && (((_c = conflict.options) == null ? void 0 : _c.can_recover_by_email) || ((_d = conflict.options) == null ? void 0 : _d.can_recover_by_sms)) && /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => setShowPasswordRecovery(true), style: { width: "100%" }, children: "Récupérer mon compte" }),
4030
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => clearError(), style: { width: "100%" }, children: conflict.type === "phone" ? "Changer le numéro" : "Changer l'email" }),
4031
+ ((_e = conflict.options) == null ? void 0 : _e.masked_email) && /* @__PURE__ */ jsxs("div", { style: { padding: "0.75rem", backgroundColor: C$1.gray100, borderRadius: "0.375rem", fontSize: "0.8125rem", color: C$1.gray500, textAlign: "center" }, children: [
4032
+ "Email lié : ",
4033
+ /* @__PURE__ */ jsx("strong", { style: { color: C$1.gray900 }, children: conflict.options.masked_email })
4034
+ ] }),
4035
+ ((_f = conflict.options) == null ? void 0 : _f.masked_phone) && /* @__PURE__ */ jsxs("div", { style: { padding: "0.75rem", backgroundColor: C$1.gray100, borderRadius: "0.375rem", fontSize: "0.8125rem", color: C$1.gray500, textAlign: "center" }, children: [
4036
+ "Téléphone lié : ",
4037
+ /* @__PURE__ */ jsx("strong", { style: { color: C$1.gray900 }, children: conflict.options.masked_phone })
4038
+ ] })
3916
4039
  ] })
3917
- ] }),
3918
- /* @__PURE__ */ jsx(StepIndicator, { current: 3 }),
3919
- /* @__PURE__ */ jsx(Button, { type: "submit", disabled: regLoading, style: { width: "100%" }, children: regLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
3920
- /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
3921
- " Vérification..."
3922
- ] }) : "Continuer" })
3923
- ] })
3924
- ] }),
3925
- step === "otp" && /* @__PURE__ */ jsxs(Fragment, { children: [
3926
- /* @__PURE__ */ jsx("button", { onClick: () => goToStep("info"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
3927
- /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3928
- /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.accent), children: /* @__PURE__ */ jsx(IconKeyRound, { style: { width: "1.5rem", height: "1.5rem", color: C$1.white } }) }),
3929
- /* @__PURE__ */ jsx(DialogTitle, { children: "Vérification" }),
3930
- /* @__PURE__ */ jsxs(DialogDescription, { children: [
3931
- "Entrez le code envoyé ",
3932
- isPhoneOnly ? `au ${formData.ccphone} ${formData.phone}` : `à ${formData.email}`
3933
- ] })
4040
+ ] }) : (
4041
+ /* ---- NORMAL INFO FORM ---- */
4042
+ /* @__PURE__ */ jsxs(Fragment, { children: [
4043
+ /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
4044
+ /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.primary + "1a"), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "1.5rem", height: "1.5rem", color: C$1.primary } }) }),
4045
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Créer votre compte" })
4046
+ ] }),
4047
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleInfoSubmit, style: { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 }, children: [
4048
+ /* @__PURE__ */ jsxs(DialogBody, { children: [
4049
+ isPhoneOnly && /* @__PURE__ */ jsx("div", { style: { padding: "0.75rem", borderRadius: "0.375rem", backgroundColor: C$1.accent + "1a", color: C$1.accent, fontSize: "0.8125rem", marginBottom: "0.5rem", textAlign: "center" }, children: "📱 Inscription par téléphone — 🇸🇳 Sénégal uniquement" }),
4050
+ !isPhoneOnly && /* @__PURE__ */ jsx("div", { style: { padding: "0.75rem", borderRadius: "0.375rem", backgroundColor: C$1.amberBg, color: "#92400e", fontSize: "0.8125rem", marginBottom: "0.5rem", textAlign: "center" }, children: "⚠️ Un code OTP sera envoyé par email pour vérification" }),
4051
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
4052
+ renderError(),
4053
+ /* @__PURE__ */ jsxs("div", { children: [
4054
+ /* @__PURE__ */ jsxs(Label, { children: [
4055
+ "Nom complet ",
4056
+ /* @__PURE__ */ jsx("span", { style: { color: C$1.red }, children: "*" })
4057
+ ] }),
4058
+ /* @__PURE__ */ jsx(Input, { placeholder: "Jean Dupont", value: formData.name || "", onChange: (e) => updateFormData({ name: e.target.value }), disabled: regLoading })
4059
+ ] }),
4060
+ !isPhoneOnly && /* @__PURE__ */ jsxs("div", { children: [
4061
+ /* @__PURE__ */ jsxs(Label, { children: [
4062
+ "Adresse email ",
4063
+ /* @__PURE__ */ jsx("span", { style: { color: C$1.red }, children: "*" })
4064
+ ] }),
4065
+ /* @__PURE__ */ jsx(Input, { type: "email", placeholder: "vous@exemple.com", value: formData.email || "", onChange: (e) => updateFormData({ email: e.target.value }), disabled: regLoading })
4066
+ ] }),
4067
+ /* @__PURE__ */ jsxs("div", { children: [
4068
+ /* @__PURE__ */ jsxs(Label, { children: [
4069
+ "Numéro de téléphone ",
4070
+ /* @__PURE__ */ jsx("span", { style: { color: C$1.red }, children: "*" })
4071
+ ] }),
4072
+ /* @__PURE__ */ jsx(PhoneInput, { value: formData.phone || "", onChange: (p) => updateFormData({ phone: p }), ccphone: formData.ccphone || "+221", onCcphoneChange: (c) => updateFormData({ ccphone: c }), disabled: regLoading, lockCcphone: isPhoneOnly })
4073
+ ] }),
4074
+ /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.75rem" }, children: [
4075
+ /* @__PURE__ */ jsxs("div", { children: [
4076
+ /* @__PURE__ */ jsxs(Label, { children: [
4077
+ "Ville ",
4078
+ /* @__PURE__ */ jsx("span", { style: { color: C$1.red }, children: "*" })
4079
+ ] }),
4080
+ /* @__PURE__ */ jsx(Input, { placeholder: "Dakar", value: formData.town || "", onChange: (e) => updateFormData({ town: e.target.value }), disabled: regLoading })
4081
+ ] }),
4082
+ /* @__PURE__ */ jsxs("div", { children: [
4083
+ /* @__PURE__ */ jsxs(Label, { children: [
4084
+ "Pays ",
4085
+ /* @__PURE__ */ jsx("span", { style: { color: C$1.red }, children: "*" })
4086
+ ] }),
4087
+ /* @__PURE__ */ jsx(
4088
+ "select",
4089
+ {
4090
+ value: formData.country || DEFAULT_COUNTRY_CODE,
4091
+ onChange: (e) => {
4092
+ const country = getCountryByCode(e.target.value);
4093
+ updateFormData({ country: e.target.value, ccphone: (country == null ? void 0 : country.dialCode) || "+221" });
4094
+ },
4095
+ disabled: regLoading || isPhoneOnly,
4096
+ style: { width: "100%", padding: "0.5rem", borderRadius: "0.375rem", border: "1px solid #d1d5db", backgroundColor: regLoading || isPhoneOnly ? "#f3f4f6" : "white", fontSize: "0.875rem" },
4097
+ children: COUNTRIES_SORTED_BY_CODE.map((c) => /* @__PURE__ */ jsxs("option", { value: c.code, children: [
4098
+ c.code,
4099
+ " ",
4100
+ c.flag,
4101
+ " ",
4102
+ c.name
4103
+ ] }, c.code))
4104
+ }
4105
+ )
4106
+ ] })
4107
+ ] }),
4108
+ /* @__PURE__ */ jsx(StepIndicator, { current: 3 })
4109
+ ] })
4110
+ ] }),
4111
+ /* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsx(Button, { type: "submit", disabled: regLoading, style: { width: "100%" }, children: regLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
4112
+ /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
4113
+ " Vérification..."
4114
+ ] }) : "Continuer" }) })
4115
+ ] })
4116
+ ] })
4117
+ )
3934
4118
  ] }),
3935
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem", display: "flex", flexDirection: "column", gap: "1rem" }, children: [
3936
- renderError(),
3937
- /* @__PURE__ */ jsx(OTPInput, { value: otpCode, onChange: setOtpCode, disabled: regLoading }),
3938
- /* @__PURE__ */ jsx("div", { style: { textAlign: "center", fontSize: "0.875rem" }, children: resendCooldown > 0 ? /* @__PURE__ */ jsxs("span", { style: { color: C$1.gray500 }, children: [
3939
- "Renvoyer dans ",
3940
- resendCooldown,
3941
- "s"
3942
- ] }) : /* @__PURE__ */ jsx("button", { type: "button", onClick: handleResendOTP, style: linkStyle, children: "Code non reçu ? Renvoyer" }) }),
3943
- /* @__PURE__ */ jsx(StepIndicator, { current: 4 }),
3944
- /* @__PURE__ */ jsx(Button, { onClick: handleOTPSubmit, disabled: regLoading || otpCode.length !== 6, style: { width: "100%" }, children: regLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
4119
+ step === "otp" && /* @__PURE__ */ jsxs(Fragment, { children: [
4120
+ /* @__PURE__ */ jsx("button", { onClick: () => goToStep("info"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
4121
+ /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
4122
+ /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.accent), children: /* @__PURE__ */ jsx(IconKeyRound, { style: { width: "1.5rem", height: "1.5rem", color: C$1.white } }) }),
4123
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Vérification" }),
4124
+ /* @__PURE__ */ jsxs(DialogDescription, { children: [
4125
+ "Entrez le code envoyé ",
4126
+ isPhoneOnly ? `au ${formData.ccphone} ${formData.phone}` : ${formData.email}`
4127
+ ] })
4128
+ ] }),
4129
+ /* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
4130
+ renderError(),
4131
+ /* @__PURE__ */ jsx(OTPInput, { value: otpCode, onChange: setOtpCode, disabled: regLoading }),
4132
+ /* @__PURE__ */ jsx("div", { style: { textAlign: "center", fontSize: "0.875rem" }, children: resendCooldown > 0 ? /* @__PURE__ */ jsxs("span", { style: { color: C$1.gray500 }, children: [
4133
+ "Renvoyer dans ",
4134
+ resendCooldown,
4135
+ "s"
4136
+ ] }) : /* @__PURE__ */ jsx("button", { type: "button", onClick: handleResendOTP, style: linkStyle, children: "Code non reçu ? Renvoyer" }) }),
4137
+ /* @__PURE__ */ jsx(StepIndicator, { current: 4 })
4138
+ ] }) }),
4139
+ /* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsx(Button, { onClick: handleOTPSubmit, disabled: regLoading || otpCode.length !== 6, style: { width: "100%" }, children: regLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
3945
4140
  /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
3946
4141
  " Vérification..."
3947
- ] }) : "Vérifier" })
3948
- ] })
3949
- ] }),
3950
- step === "password" && /* @__PURE__ */ jsxs(Fragment, { children: [
3951
- /* @__PURE__ */ jsx("button", { onClick: () => goToStep("otp"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
3952
- /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3953
- /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.accent), children: /* @__PURE__ */ jsx(IconLock, { style: { width: "1.5rem", height: "1.5rem", color: C$1.white } }) }),
3954
- /* @__PURE__ */ jsx(DialogTitle, { children: "Créer un mot de passe" })
4142
+ ] }) : "Vérifier" }) })
3955
4143
  ] }),
3956
- /* @__PURE__ */ jsxs("form", { onSubmit: handlePasswordSubmit, style: { display: "flex", flexDirection: "column", gap: "0.75rem", marginTop: "0.75rem" }, children: [
3957
- renderError(),
3958
- /* @__PURE__ */ jsxs("div", { children: [
3959
- /* @__PURE__ */ jsx(Label, { children: "Mot de passe" }),
3960
- /* @__PURE__ */ jsx(Input, { type: "password", placeholder: "Minimum 8 caractères", value: password, onChange: (e) => setPassword(e.target.value), disabled: regLoading })
3961
- ] }),
3962
- /* @__PURE__ */ jsxs("div", { children: [
3963
- /* @__PURE__ */ jsx(Label, { children: "Confirmer le mot de passe" }),
3964
- /* @__PURE__ */ jsx(Input, { type: "password", placeholder: "••••••••", value: passwordConfirm, onChange: (e) => setPasswordConfirm(e.target.value), disabled: regLoading })
4144
+ step === "password" && /* @__PURE__ */ jsxs(Fragment, { children: [
4145
+ /* @__PURE__ */ jsx("button", { onClick: () => goToStep("otp"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
4146
+ /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
4147
+ /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.accent), children: /* @__PURE__ */ jsx(IconLock, { style: { width: "1.5rem", height: "1.5rem", color: C$1.white } }) }),
4148
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Créer un mot de passe" })
3965
4149
  ] }),
3966
- /* @__PURE__ */ jsx(StepIndicator, { current: 5 }),
3967
- /* @__PURE__ */ jsx(Button, { type: "submit", disabled: regLoading, style: { width: "100%" }, children: "Continuer" })
3968
- ] })
3969
- ] }),
3970
- step === "confirm" && /* @__PURE__ */ jsxs(Fragment, { children: [
3971
- /* @__PURE__ */ jsx("button", { onClick: () => goToStep("password"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
3972
- /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3973
- /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.primary + "1a"), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "1.5rem", height: "1.5rem", color: C$1.primary } }) }),
3974
- /* @__PURE__ */ jsx(DialogTitle, { children: "Confirmer votre inscription" })
4150
+ /* @__PURE__ */ jsxs("form", { onSubmit: handlePasswordSubmit, style: { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 }, children: [
4151
+ /* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
4152
+ renderError(),
4153
+ /* @__PURE__ */ jsxs("div", { children: [
4154
+ /* @__PURE__ */ jsx(Label, { children: "Mot de passe" }),
4155
+ /* @__PURE__ */ jsx(Input, { type: "password", placeholder: "Minimum 8 caractères", value: password, onChange: (e) => setPassword(e.target.value), disabled: regLoading })
4156
+ ] }),
4157
+ /* @__PURE__ */ jsxs("div", { children: [
4158
+ /* @__PURE__ */ jsx(Label, { children: "Confirmer le mot de passe" }),
4159
+ /* @__PURE__ */ jsx(Input, { type: "password", placeholder: "••••••••", value: passwordConfirm, onChange: (e) => setPasswordConfirm(e.target.value), disabled: regLoading })
4160
+ ] }),
4161
+ /* @__PURE__ */ jsx(StepIndicator, { current: 5 })
4162
+ ] }) }),
4163
+ /* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsx(Button, { type: "submit", disabled: regLoading, style: { width: "100%" }, children: "Continuer" }) })
4164
+ ] })
3975
4165
  ] }),
3976
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem", display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
3977
- renderError(),
3978
- /* @__PURE__ */ jsx("div", { style: { backgroundColor: C$1.gray100, borderRadius: "0.5rem", padding: "1rem" }, children: [["Nom", formData.name], ...!isPhoneOnly ? [["Email", formData.email]] : [], ["Téléphone", `${formData.ccphone} ${formData.phone}`], ["Ville", formData.town], ["Pays", formData.country]].map(([label, value]) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", padding: "0.375rem 0" }, children: [
3979
- /* @__PURE__ */ jsx("span", { style: { fontSize: "0.875rem", color: C$1.gray500 }, children: label }),
3980
- /* @__PURE__ */ jsx("span", { style: { fontSize: "0.875rem", fontWeight: 500 }, children: value })
3981
- ] }, label)) }),
3982
- /* @__PURE__ */ jsx(StepIndicator, { current: 6 }),
3983
- /* @__PURE__ */ jsx(Button, { onClick: handleConfirm, disabled: regLoading, style: { width: "100%" }, children: regLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
4166
+ step === "confirm" && /* @__PURE__ */ jsxs(Fragment, { children: [
4167
+ /* @__PURE__ */ jsx("button", { onClick: () => goToStep("password"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
4168
+ /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
4169
+ /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.primary + "1a"), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "1.5rem", height: "1.5rem", color: C$1.primary } }) }),
4170
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Confirmer votre inscription" })
4171
+ ] }),
4172
+ /* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
4173
+ renderError(),
4174
+ /* @__PURE__ */ jsx("div", { style: { backgroundColor: C$1.gray100, borderRadius: "0.5rem", padding: "1rem" }, children: [["Nom", formData.name], ...!isPhoneOnly ? [["Email", formData.email]] : [], ["Téléphone", `${formData.ccphone} ${formData.phone}`], ["Ville", formData.town], ["Pays", formData.country]].map(([label, value]) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", padding: "0.375rem 0" }, children: [
4175
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "0.875rem", color: C$1.gray500 }, children: label }),
4176
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "0.875rem", fontWeight: 500 }, children: value })
4177
+ ] }, label)) }),
4178
+ /* @__PURE__ */ jsx(StepIndicator, { current: 6 })
4179
+ ] }) }),
4180
+ /* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsx(Button, { onClick: handleConfirm, disabled: regLoading, style: { width: "100%" }, children: regLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
3984
4181
  /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
3985
4182
  " Création du compte..."
3986
- ] }) : "Créer mon compte" })
4183
+ ] }) : "Créer mon compte" }) })
3987
4184
  ] })
3988
- ] })
3989
- ] }) }) });
4185
+ ] }) }) }),
4186
+ /* @__PURE__ */ jsx(
4187
+ PasswordRecoveryModal,
4188
+ {
4189
+ open: showPasswordRecovery,
4190
+ onOpenChange: setShowPasswordRecovery,
4191
+ onSuccess: () => setShowPasswordRecovery(false),
4192
+ saasApiUrl,
4193
+ iamApiUrl
4194
+ }
4195
+ )
4196
+ ] });
3990
4197
  }
3991
4198
  const C = {
3992
4199
  primary: "#002147",
@@ -4053,7 +4260,7 @@ function OnboardingModal({ open, onOpenChange, user, onComplete, onSkip }) {
4053
4260
  ] }),
4054
4261
  /* @__PURE__ */ jsx(DialogDescription, { children: "Ajoutez les informations manquantes pour finaliser votre compte." })
4055
4262
  ] }),
4056
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1.25rem", marginTop: "1rem" }, children: [
4263
+ /* @__PURE__ */ jsx(DialogBody, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1.25rem", marginTop: "0.75rem" }, children: [
4057
4264
  needsPhoto && /* @__PURE__ */ jsxs("div", { children: [
4058
4265
  /* @__PURE__ */ jsx(Label, { style: { display: "block", marginBottom: "0.5rem", color: C.gray700, fontWeight: 500 }, children: "Photo de profil" }),
4059
4266
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "1rem" }, children: [
@@ -4085,15 +4292,7 @@ function OnboardingModal({ open, onOpenChange, user, onComplete, onSkip }) {
4085
4292
  fontWeight: 500
4086
4293
  }, children: [
4087
4294
  "Choisir une photo",
4088
- /* @__PURE__ */ jsx(
4089
- "input",
4090
- {
4091
- type: "file",
4092
- accept: "image/*",
4093
- onChange: handleFileChange,
4094
- style: { display: "none" }
4095
- }
4096
- )
4295
+ /* @__PURE__ */ jsx("input", { type: "file", accept: "image/*", onChange: handleFileChange, style: { display: "none" } })
4097
4296
  ] }),
4098
4297
  /* @__PURE__ */ jsx("p", { style: { fontSize: "0.75rem", color: fileError ? "#dc2626" : C.gray500, marginTop: "0.25rem" }, children: fileError || "JPG, PNG. Max 2 Mo." })
4099
4298
  ] })
@@ -4101,15 +4300,7 @@ function OnboardingModal({ open, onOpenChange, user, onComplete, onSkip }) {
4101
4300
  ] }),
4102
4301
  needsPhone && /* @__PURE__ */ jsxs("div", { children: [
4103
4302
  /* @__PURE__ */ jsx(Label, { style: { display: "block", marginBottom: "0.5rem", color: C.gray700, fontWeight: 500 }, children: "Numéro de téléphone" }),
4104
- /* @__PURE__ */ jsx(
4105
- PhoneInput,
4106
- {
4107
- value: phone,
4108
- onChange: setPhone,
4109
- ccphone,
4110
- onCcphoneChange: setCcphone
4111
- }
4112
- )
4303
+ /* @__PURE__ */ jsx(PhoneInput, { value: phone, onChange: setPhone, ccphone, onCcphoneChange: setCcphone })
4113
4304
  ] }),
4114
4305
  needsEmail && /* @__PURE__ */ jsxs("div", { children: [
4115
4306
  /* @__PURE__ */ jsxs(Label, { style: { display: "block", marginBottom: "0.5rem", color: C.gray700, fontWeight: 500 }, children: [
@@ -4151,38 +4342,32 @@ function OnboardingModal({ open, onOpenChange, user, onComplete, onSkip }) {
4151
4342
  type: "checkbox",
4152
4343
  checked: confirmed,
4153
4344
  onChange: (e) => setConfirmed(e.target.checked),
4154
- style: {
4155
- width: "1rem",
4156
- height: "1rem",
4157
- marginTop: "0.125rem",
4158
- accentColor: C.primary,
4159
- cursor: "pointer"
4160
- }
4345
+ style: { width: "1rem", height: "1rem", marginTop: "0.125rem", accentColor: C.primary, cursor: "pointer" }
4161
4346
  }
4162
4347
  ),
4163
4348
  /* @__PURE__ */ jsx("span", { children: "Je confirme que ces informations sont exactes" })
4164
- ] }),
4165
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
4166
- /* @__PURE__ */ jsx(
4167
- Button,
4168
- {
4169
- onClick: handleSubmit,
4170
- disabled: !canSubmit || submitting,
4171
- style: { width: "100%", height: "2.75rem", opacity: canSubmit && !submitting ? 1 : 0.5 },
4172
- children: submitting ? "Enregistrement..." : "Valider"
4173
- }
4174
- ),
4175
- /* @__PURE__ */ jsx(
4176
- Button,
4177
- {
4178
- variant: "outline",
4179
- onClick: onSkip,
4180
- disabled: submitting,
4181
- style: { width: "100%", height: "2.75rem" },
4182
- children: "Passer pour l'instant"
4183
- }
4184
- )
4185
4349
  ] })
4350
+ ] }) }),
4351
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
4352
+ /* @__PURE__ */ jsx(
4353
+ Button,
4354
+ {
4355
+ onClick: handleSubmit,
4356
+ disabled: !canSubmit || submitting,
4357
+ style: { width: "100%", height: "2.75rem", opacity: canSubmit && !submitting ? 1 : 0.5 },
4358
+ children: submitting ? "Enregistrement..." : "Valider"
4359
+ }
4360
+ ),
4361
+ /* @__PURE__ */ jsx(
4362
+ Button,
4363
+ {
4364
+ variant: "outline",
4365
+ onClick: onSkip,
4366
+ disabled: submitting,
4367
+ style: { width: "100%", height: "2.75rem" },
4368
+ children: "Passer pour l'instant"
4369
+ }
4370
+ )
4186
4371
  ] })
4187
4372
  ] }) });
4188
4373
  }
@@ -4433,6 +4618,7 @@ function NativeSSOPage({
4433
4618
  redirectAfterLogout
4434
4619
  }) {
4435
4620
  const [modal, setModal] = useState("none");
4621
+ const [loginInitialPhone, setLoginInitialPhone] = useState();
4436
4622
  const [showOnboarding, setShowOnboarding] = useState(false);
4437
4623
  const [pendingSession, setPendingSession] = useState(null);
4438
4624
  const [session, setSession] = useState(() => {
@@ -4474,13 +4660,23 @@ function NativeSSOPage({
4474
4660
  }, []);
4475
4661
  const openLogin = useCallback(() => setModal("login"), []);
4476
4662
  const openSignup = useCallback(() => setModal("signup"), []);
4477
- const closeModal = useCallback(() => setModal("none"), []);
4663
+ const closeModal = useCallback(() => {
4664
+ setModal("none");
4665
+ setLoginInitialPhone(void 0);
4666
+ }, []);
4478
4667
  const switchToSignup = useCallback(() => {
4479
4668
  setModal("none");
4669
+ setLoginInitialPhone(void 0);
4480
4670
  setTimeout(() => setModal("signup"), 150);
4481
4671
  }, []);
4482
4672
  const switchToLogin = useCallback(() => {
4483
4673
  setModal("none");
4674
+ setLoginInitialPhone(void 0);
4675
+ setTimeout(() => setModal("login"), 150);
4676
+ }, []);
4677
+ const switchToLoginWithPhone = useCallback((phone) => {
4678
+ setModal("none");
4679
+ setLoginInitialPhone(phone);
4484
4680
  setTimeout(() => setModal("login"), 150);
4485
4681
  }, []);
4486
4682
  const handleLoginSuccess = useCallback((token, user) => {
@@ -4631,7 +4827,8 @@ function NativeSSOPage({
4631
4827
  onLoginSuccess: handleLoginSuccess,
4632
4828
  saasApiUrl,
4633
4829
  iamApiUrl,
4634
- defaultAccountType: accountType
4830
+ defaultAccountType: accountType,
4831
+ initialPhone: loginInitialPhone
4635
4832
  }
4636
4833
  ),
4637
4834
  /* @__PURE__ */ jsx(
@@ -4642,6 +4839,7 @@ function NativeSSOPage({
4642
4839
  if (!open) closeModal();
4643
4840
  },
4644
4841
  onSwitchToLogin: switchToLogin,
4842
+ onSwitchToLoginWithPhone: switchToLoginWithPhone,
4645
4843
  onSignupSuccess: handleLoginSuccess,
4646
4844
  saasApiUrl,
4647
4845
  iamApiUrl,