@ollaid/native-sso 1.0.6 → 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(
@@ -2872,25 +2901,220 @@ function LoginModal({
2872
2901
  )
2873
2902
  ] });
2874
2903
  }
2875
- const SUPPORTED_COUNTRIES = [
2876
- { code: "+221", name: "Sénégal", flag: "🇸🇳", digits: 9 },
2877
- { code: "+229", name: "Bénin", flag: "🇧🇯", digits: 8 },
2878
- { code: "+225", name: "Côte d'Ivoire", flag: "🇨🇮", digits: 10 },
2879
- { code: "+228", name: "Togo", flag: "🇹🇬", digits: 8 },
2880
- { code: "+237", name: "Cameroun", flag: "🇨🇲", digits: 9 },
2881
- { code: "+33", name: "France", flag: "🇫🇷", digits: 9 }
2904
+ const COUNTRIES = [
2905
+ // ── Afrique de l'Ouest (prioritaires) ──
2906
+ { code: "SN", name: "Sénégal", dialCode: "+221", flag: "🇸🇳", digits: 9 },
2907
+ { code: "CI", name: "Côte d'Ivoire", dialCode: "+225", flag: "🇨🇮", digits: 10 },
2908
+ { code: "ML", name: "Mali", dialCode: "+223", flag: "🇲🇱", digits: 8 },
2909
+ { code: "BF", name: "Burkina Faso", dialCode: "+226", flag: "🇧🇫", digits: 8 },
2910
+ { code: "GN", name: "Guinée", dialCode: "+224", flag: "🇬🇳", digits: 9 },
2911
+ { code: "TG", name: "Togo", dialCode: "+228", flag: "🇹🇬", digits: 8 },
2912
+ { code: "BJ", name: "Bénin", dialCode: "+229", flag: "🇧🇯", digits: 8 },
2913
+ { code: "NE", name: "Niger", dialCode: "+227", flag: "🇳🇪", digits: 8 },
2914
+ { code: "MR", name: "Mauritanie", dialCode: "+222", flag: "🇲🇷", digits: 8 },
2915
+ { code: "GW", name: "Guinée-Bissau", dialCode: "+245", flag: "🇬🇼", digits: 7 },
2916
+ { code: "GM", name: "Gambie", dialCode: "+220", flag: "🇬🇲", digits: 7 },
2917
+ { code: "CV", name: "Cap-Vert", dialCode: "+238", flag: "🇨🇻", digits: 7 },
2918
+ { code: "SL", name: "Sierra Leone", dialCode: "+232", flag: "🇸🇱", digits: 8 },
2919
+ { code: "LR", name: "Liberia", dialCode: "+231", flag: "🇱🇷", digits: 7 },
2920
+ { code: "GH", name: "Ghana", dialCode: "+233", flag: "🇬🇭", digits: 9 },
2921
+ { code: "NG", name: "Nigeria", dialCode: "+234", flag: "🇳🇬", digits: 10 },
2922
+ // ── Afrique Centrale ──
2923
+ { code: "CM", name: "Cameroun", dialCode: "+237", flag: "🇨🇲", digits: 9 },
2924
+ { code: "GA", name: "Gabon", dialCode: "+241", flag: "🇬🇦", digits: 7 },
2925
+ { code: "CG", name: "Congo", dialCode: "+242", flag: "🇨🇬", digits: 9 },
2926
+ { code: "CD", name: "RD Congo", dialCode: "+243", flag: "🇨🇩", digits: 9 },
2927
+ { code: "TD", name: "Tchad", dialCode: "+235", flag: "🇹🇩", digits: 8 },
2928
+ { code: "CF", name: "Centrafrique", dialCode: "+236", flag: "🇨🇫", digits: 8 },
2929
+ { code: "GQ", name: "Guinée équatoriale", dialCode: "+240", flag: "🇬🇶", digits: 9 },
2930
+ { code: "ST", name: "São Tomé-et-Príncipe", dialCode: "+239", flag: "🇸🇹", digits: 7 },
2931
+ { code: "BI", name: "Burundi", dialCode: "+257", flag: "🇧🇮", digits: 8 },
2932
+ { code: "RW", name: "Rwanda", dialCode: "+250", flag: "🇷🇼", digits: 9 },
2933
+ // ── Afrique de l'Est ──
2934
+ { code: "KE", name: "Kenya", dialCode: "+254", flag: "🇰🇪", digits: 9 },
2935
+ { code: "TZ", name: "Tanzanie", dialCode: "+255", flag: "🇹🇿", digits: 9 },
2936
+ { code: "UG", name: "Ouganda", dialCode: "+256", flag: "🇺🇬", digits: 9 },
2937
+ { code: "ET", name: "Éthiopie", dialCode: "+251", flag: "🇪🇹", digits: 9 },
2938
+ { code: "SO", name: "Somalie", dialCode: "+252", flag: "🇸🇴", digits: 8 },
2939
+ { code: "DJ", name: "Djibouti", dialCode: "+253", flag: "🇩🇯", digits: 8 },
2940
+ { code: "ER", name: "Érythrée", dialCode: "+291", flag: "🇪🇷", digits: 7 },
2941
+ { code: "SS", name: "Soudan du Sud", dialCode: "+211", flag: "🇸🇸", digits: 9 },
2942
+ { code: "MG", name: "Madagascar", dialCode: "+261", flag: "🇲🇬", digits: 9 },
2943
+ { code: "MU", name: "Maurice", dialCode: "+230", flag: "🇲🇺", digits: 8 },
2944
+ { code: "SC", name: "Seychelles", dialCode: "+248", flag: "🇸🇨", digits: 7 },
2945
+ { code: "KM", name: "Comores", dialCode: "+269", flag: "🇰🇲", digits: 7 },
2946
+ // ── Afrique Australe ──
2947
+ { code: "ZA", name: "Afrique du Sud", dialCode: "+27", flag: "🇿🇦", digits: 9 },
2948
+ { code: "MZ", name: "Mozambique", dialCode: "+258", flag: "🇲🇿", digits: 9 },
2949
+ { code: "ZW", name: "Zimbabwe", dialCode: "+263", flag: "🇿🇼", digits: 9 },
2950
+ { code: "ZM", name: "Zambie", dialCode: "+260", flag: "🇿🇲", digits: 9 },
2951
+ { code: "MW", name: "Malawi", dialCode: "+265", flag: "🇲🇼", digits: 9 },
2952
+ { code: "BW", name: "Botswana", dialCode: "+267", flag: "🇧🇼", digits: 8 },
2953
+ { code: "NA", name: "Namibie", dialCode: "+264", flag: "🇳🇦", digits: 9 },
2954
+ { code: "AO", name: "Angola", dialCode: "+244", flag: "🇦🇴", digits: 9 },
2955
+ { code: "SZ", name: "Eswatini", dialCode: "+268", flag: "🇸🇿", digits: 8 },
2956
+ { code: "LS", name: "Lesotho", dialCode: "+266", flag: "🇱🇸", digits: 8 },
2957
+ // ── Afrique du Nord ──
2958
+ { code: "MA", name: "Maroc", dialCode: "+212", flag: "🇲🇦", digits: 9 },
2959
+ { code: "DZ", name: "Algérie", dialCode: "+213", flag: "🇩🇿", digits: 9 },
2960
+ { code: "TN", name: "Tunisie", dialCode: "+216", flag: "🇹🇳", digits: 8 },
2961
+ { code: "LY", name: "Libye", dialCode: "+218", flag: "🇱🇾", digits: 9 },
2962
+ { code: "EG", name: "Égypte", dialCode: "+20", flag: "🇪🇬", digits: 10 },
2963
+ { code: "SD", name: "Soudan", dialCode: "+249", flag: "🇸🇩", digits: 9 },
2964
+ // ── Europe ──
2965
+ { code: "FR", name: "France", dialCode: "+33", flag: "🇫🇷", digits: 9 },
2966
+ { code: "BE", name: "Belgique", dialCode: "+32", flag: "🇧🇪", digits: 9 },
2967
+ { code: "CH", name: "Suisse", dialCode: "+41", flag: "🇨🇭", digits: 9 },
2968
+ { code: "DE", name: "Allemagne", dialCode: "+49", flag: "🇩🇪", digits: 10 },
2969
+ { code: "GB", name: "Royaume-Uni", dialCode: "+44", flag: "🇬🇧", digits: 10 },
2970
+ { code: "ES", name: "Espagne", dialCode: "+34", flag: "🇪🇸", digits: 9 },
2971
+ { code: "IT", name: "Italie", dialCode: "+39", flag: "🇮🇹", digits: 10 },
2972
+ { code: "PT", name: "Portugal", dialCode: "+351", flag: "🇵🇹", digits: 9 },
2973
+ { code: "NL", name: "Pays-Bas", dialCode: "+31", flag: "🇳🇱", digits: 9 },
2974
+ { code: "SE", name: "Suède", dialCode: "+46", flag: "🇸🇪", digits: 9 },
2975
+ { code: "NO", name: "Norvège", dialCode: "+47", flag: "🇳🇴", digits: 8 },
2976
+ { code: "DK", name: "Danemark", dialCode: "+45", flag: "🇩🇰", digits: 8 },
2977
+ { code: "FI", name: "Finlande", dialCode: "+358", flag: "🇫🇮", digits: 10 },
2978
+ { code: "PL", name: "Pologne", dialCode: "+48", flag: "🇵🇱", digits: 9 },
2979
+ { code: "AT", name: "Autriche", dialCode: "+43", flag: "🇦🇹", digits: 10 },
2980
+ { code: "IE", name: "Irlande", dialCode: "+353", flag: "🇮🇪", digits: 9 },
2981
+ { code: "GR", name: "Grèce", dialCode: "+30", flag: "🇬🇷", digits: 10 },
2982
+ { code: "CZ", name: "Tchéquie", dialCode: "+420", flag: "🇨🇿", digits: 9 },
2983
+ { code: "RO", name: "Roumanie", dialCode: "+40", flag: "🇷🇴", digits: 9 },
2984
+ { code: "HU", name: "Hongrie", dialCode: "+36", flag: "🇭🇺", digits: 9 },
2985
+ { code: "BG", name: "Bulgarie", dialCode: "+359", flag: "🇧🇬", digits: 9 },
2986
+ { code: "HR", name: "Croatie", dialCode: "+385", flag: "🇭🇷", digits: 9 },
2987
+ { code: "SK", name: "Slovaquie", dialCode: "+421", flag: "🇸🇰", digits: 9 },
2988
+ { code: "SI", name: "Slovénie", dialCode: "+386", flag: "🇸🇮", digits: 8 },
2989
+ { code: "RS", name: "Serbie", dialCode: "+381", flag: "🇷🇸", digits: 9 },
2990
+ { code: "UA", name: "Ukraine", dialCode: "+380", flag: "🇺🇦", digits: 9 },
2991
+ { code: "RU", name: "Russie", dialCode: "+7", flag: "🇷🇺", digits: 10 },
2992
+ { code: "TR", name: "Turquie", dialCode: "+90", flag: "🇹🇷", digits: 10 },
2993
+ { code: "LU", name: "Luxembourg", dialCode: "+352", flag: "🇱🇺", digits: 9 },
2994
+ { code: "MC", name: "Monaco", dialCode: "+377", flag: "🇲🇨", digits: 8 },
2995
+ { code: "IS", name: "Islande", dialCode: "+354", flag: "🇮🇸", digits: 7 },
2996
+ { code: "AL", name: "Albanie", dialCode: "+355", flag: "🇦🇱", digits: 9 },
2997
+ { code: "ME", name: "Monténégro", dialCode: "+382", flag: "🇲🇪", digits: 8 },
2998
+ { code: "MK", name: "Macédoine du Nord", dialCode: "+389", flag: "🇲🇰", digits: 8 },
2999
+ { code: "BA", name: "Bosnie-Herzégovine", dialCode: "+387", flag: "🇧🇦", digits: 8 },
3000
+ { code: "LT", name: "Lituanie", dialCode: "+370", flag: "🇱🇹", digits: 8 },
3001
+ { code: "LV", name: "Lettonie", dialCode: "+371", flag: "🇱🇻", digits: 8 },
3002
+ { code: "EE", name: "Estonie", dialCode: "+372", flag: "🇪🇪", digits: 8 },
3003
+ { code: "MT", name: "Malte", dialCode: "+356", flag: "🇲🇹", digits: 8 },
3004
+ { code: "CY", name: "Chypre", dialCode: "+357", flag: "🇨🇾", digits: 8 },
3005
+ { code: "MD", name: "Moldavie", dialCode: "+373", flag: "🇲🇩", digits: 8 },
3006
+ { code: "GE", name: "Géorgie", dialCode: "+995", flag: "🇬🇪", digits: 9 },
3007
+ { code: "AM", name: "Arménie", dialCode: "+374", flag: "🇦🇲", digits: 8 },
3008
+ { code: "AZ", name: "Azerbaïdjan", dialCode: "+994", flag: "🇦🇿", digits: 9 },
3009
+ { code: "BY", name: "Biélorussie", dialCode: "+375", flag: "🇧🇾", digits: 9 },
3010
+ // ── Amérique du Nord ──
3011
+ { code: "US", name: "États-Unis", dialCode: "+1", flag: "🇺🇸", digits: 10 },
3012
+ { code: "CA", name: "Canada", dialCode: "+1", flag: "🇨🇦", digits: 10 },
3013
+ { code: "MX", name: "Mexique", dialCode: "+52", flag: "🇲🇽", digits: 10 },
3014
+ // ── Amérique Centrale & Caraïbes ──
3015
+ { code: "HT", name: "Haïti", dialCode: "+509", flag: "🇭🇹", digits: 8 },
3016
+ { code: "DO", name: "République dominicaine", dialCode: "+1809", flag: "🇩🇴", digits: 10 },
3017
+ { code: "CU", name: "Cuba", dialCode: "+53", flag: "🇨🇺", digits: 8 },
3018
+ { code: "JM", name: "Jamaïque", dialCode: "+1876", flag: "🇯🇲", digits: 7 },
3019
+ { code: "GT", name: "Guatemala", dialCode: "+502", flag: "🇬🇹", digits: 8 },
3020
+ { code: "HN", name: "Honduras", dialCode: "+504", flag: "🇭🇳", digits: 8 },
3021
+ { code: "SV", name: "El Salvador", dialCode: "+503", flag: "🇸🇻", digits: 8 },
3022
+ { code: "NI", name: "Nicaragua", dialCode: "+505", flag: "🇳🇮", digits: 8 },
3023
+ { code: "CR", name: "Costa Rica", dialCode: "+506", flag: "🇨🇷", digits: 8 },
3024
+ { code: "PA", name: "Panama", dialCode: "+507", flag: "🇵🇦", digits: 8 },
3025
+ { code: "TT", name: "Trinité-et-Tobago", dialCode: "+1868", flag: "🇹🇹", digits: 7 },
3026
+ // ── Amérique du Sud ──
3027
+ { code: "BR", name: "Brésil", dialCode: "+55", flag: "🇧🇷", digits: 11 },
3028
+ { code: "AR", name: "Argentine", dialCode: "+54", flag: "🇦🇷", digits: 10 },
3029
+ { code: "CO", name: "Colombie", dialCode: "+57", flag: "🇨🇴", digits: 10 },
3030
+ { code: "CL", name: "Chili", dialCode: "+56", flag: "🇨🇱", digits: 9 },
3031
+ { code: "PE", name: "Pérou", dialCode: "+51", flag: "🇵🇪", digits: 9 },
3032
+ { code: "VE", name: "Venezuela", dialCode: "+58", flag: "🇻🇪", digits: 10 },
3033
+ { code: "EC", name: "Équateur", dialCode: "+593", flag: "🇪🇨", digits: 9 },
3034
+ { code: "BO", name: "Bolivie", dialCode: "+591", flag: "🇧🇴", digits: 8 },
3035
+ { code: "PY", name: "Paraguay", dialCode: "+595", flag: "🇵🇾", digits: 9 },
3036
+ { code: "UY", name: "Uruguay", dialCode: "+598", flag: "🇺🇾", digits: 8 },
3037
+ { code: "GY", name: "Guyana", dialCode: "+592", flag: "🇬🇾", digits: 7 },
3038
+ { code: "SR", name: "Suriname", dialCode: "+597", flag: "🇸🇷", digits: 7 },
3039
+ // ── Moyen-Orient ──
3040
+ { code: "AE", name: "Émirats arabes unis", dialCode: "+971", flag: "🇦🇪", digits: 9 },
3041
+ { code: "SA", name: "Arabie saoudite", dialCode: "+966", flag: "🇸🇦", digits: 9 },
3042
+ { code: "QA", name: "Qatar", dialCode: "+974", flag: "🇶🇦", digits: 8 },
3043
+ { code: "KW", name: "Koweït", dialCode: "+965", flag: "🇰🇼", digits: 8 },
3044
+ { code: "BH", name: "Bahreïn", dialCode: "+973", flag: "🇧🇭", digits: 8 },
3045
+ { code: "OM", name: "Oman", dialCode: "+968", flag: "🇴🇲", digits: 8 },
3046
+ { code: "JO", name: "Jordanie", dialCode: "+962", flag: "🇯🇴", digits: 9 },
3047
+ { code: "LB", name: "Liban", dialCode: "+961", flag: "🇱🇧", digits: 8 },
3048
+ { code: "IQ", name: "Irak", dialCode: "+964", flag: "🇮🇶", digits: 10 },
3049
+ { code: "IR", name: "Iran", dialCode: "+98", flag: "🇮🇷", digits: 10 },
3050
+ { code: "IL", name: "Israël", dialCode: "+972", flag: "🇮🇱", digits: 9 },
3051
+ { code: "PS", name: "Palestine", dialCode: "+970", flag: "🇵🇸", digits: 9 },
3052
+ { code: "YE", name: "Yémen", dialCode: "+967", flag: "🇾🇪", digits: 9 },
3053
+ { code: "SY", name: "Syrie", dialCode: "+963", flag: "🇸🇾", digits: 9 },
3054
+ // ── Asie ──
3055
+ { code: "CN", name: "Chine", dialCode: "+86", flag: "🇨🇳", digits: 11 },
3056
+ { code: "JP", name: "Japon", dialCode: "+81", flag: "🇯🇵", digits: 10 },
3057
+ { code: "KR", name: "Corée du Sud", dialCode: "+82", flag: "🇰🇷", digits: 10 },
3058
+ { code: "IN", name: "Inde", dialCode: "+91", flag: "🇮🇳", digits: 10 },
3059
+ { code: "PK", name: "Pakistan", dialCode: "+92", flag: "🇵🇰", digits: 10 },
3060
+ { code: "BD", name: "Bangladesh", dialCode: "+880", flag: "🇧🇩", digits: 10 },
3061
+ { code: "ID", name: "Indonésie", dialCode: "+62", flag: "🇮🇩", digits: 10 },
3062
+ { code: "MY", name: "Malaisie", dialCode: "+60", flag: "🇲🇾", digits: 10 },
3063
+ { code: "PH", name: "Philippines", dialCode: "+63", flag: "🇵🇭", digits: 10 },
3064
+ { code: "TH", name: "Thaïlande", dialCode: "+66", flag: "🇹🇭", digits: 9 },
3065
+ { code: "VN", name: "Vietnam", dialCode: "+84", flag: "🇻🇳", digits: 9 },
3066
+ { code: "SG", name: "Singapour", dialCode: "+65", flag: "🇸🇬", digits: 8 },
3067
+ { code: "HK", name: "Hong Kong", dialCode: "+852", flag: "🇭🇰", digits: 8 },
3068
+ { code: "TW", name: "Taïwan", dialCode: "+886", flag: "🇹🇼", digits: 9 },
3069
+ { code: "MM", name: "Myanmar", dialCode: "+95", flag: "🇲🇲", digits: 9 },
3070
+ { code: "KH", name: "Cambodge", dialCode: "+855", flag: "🇰🇭", digits: 9 },
3071
+ { code: "LA", name: "Laos", dialCode: "+856", flag: "🇱🇦", digits: 10 },
3072
+ { code: "NP", name: "Népal", dialCode: "+977", flag: "🇳🇵", digits: 10 },
3073
+ { code: "LK", name: "Sri Lanka", dialCode: "+94", flag: "🇱🇰", digits: 9 },
3074
+ { code: "AF", name: "Afghanistan", dialCode: "+93", flag: "🇦🇫", digits: 9 },
3075
+ { code: "UZ", name: "Ouzbékistan", dialCode: "+998", flag: "🇺🇿", digits: 9 },
3076
+ { code: "KZ", name: "Kazakhstan", dialCode: "+7", flag: "🇰🇿", digits: 10 },
3077
+ { code: "MN", name: "Mongolie", dialCode: "+976", flag: "🇲🇳", digits: 8 },
3078
+ // ── Océanie ──
3079
+ { code: "AU", name: "Australie", dialCode: "+61", flag: "🇦🇺", digits: 9 },
3080
+ { code: "NZ", name: "Nouvelle-Zélande", dialCode: "+64", flag: "🇳🇿", digits: 9 },
3081
+ { code: "FJ", name: "Fidji", dialCode: "+679", flag: "🇫🇯", digits: 7 },
3082
+ { code: "PG", name: "Papouasie-Nouvelle-Guinée", dialCode: "+675", flag: "🇵🇬", digits: 8 }
2882
3083
  ];
3084
+ const DEFAULT_COUNTRY_CODE = "SN";
3085
+ const DEFAULT_DIAL_CODE = "+221";
3086
+ const COUNTRIES_SORTED_BY_CODE = [...COUNTRIES].sort((a, b) => a.code.localeCompare(b.code));
3087
+ const getCountryByCode = (code) => COUNTRIES.find((c) => c.code.toLowerCase() === code.toLowerCase());
3088
+ const getCountryByDialCode = (dialCode) => COUNTRIES.find((c) => c.dialCode === dialCode);
3089
+ const getDefaultCountry = () => COUNTRIES.find((c) => c.code === DEFAULT_COUNTRY_CODE);
3090
+ const searchCountries = (query) => {
3091
+ const q = query.toLowerCase().trim();
3092
+ if (!q) return COUNTRIES;
3093
+ return COUNTRIES.filter(
3094
+ (c) => c.name.toLowerCase().includes(q) || c.dialCode.includes(q) || c.code.toLowerCase().includes(q)
3095
+ );
3096
+ };
2883
3097
  function PhoneInput({
2884
3098
  value,
2885
3099
  onChange,
2886
- ccphone = "+221",
3100
+ ccphone = DEFAULT_DIAL_CODE,
2887
3101
  onCcphoneChange,
2888
3102
  disabled = false,
2889
3103
  error,
2890
3104
  placeholder = "77 123 45 67",
2891
3105
  lockCcphone = false
2892
3106
  }) {
2893
- const selectedCountry = SUPPORTED_COUNTRIES.find((c) => c.code === ccphone) || SUPPORTED_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]);
2894
3118
  const handleChange = (e) => {
2895
3119
  const cleaned = e.target.value.replace(/\D/g, "");
2896
3120
  onChange(cleaned.slice(0, selectedCountry.digits));
@@ -2901,33 +3125,96 @@ function PhoneInput({
2901
3125
  if (phone.length <= 7) return `${phone.slice(0, 2)} ${phone.slice(2, 5)} ${phone.slice(5)}`;
2902
3126
  return `${phone.slice(0, 2)} ${phone.slice(2, 5)} ${phone.slice(5, 7)} ${phone.slice(7)}`;
2903
3127
  };
3128
+ const handleSelect = (dialCode) => {
3129
+ if (onCcphoneChange) onCcphoneChange(dialCode);
3130
+ setDropdownOpen(false);
3131
+ };
2904
3132
  return /* @__PURE__ */ jsxs("div", { children: [
2905
3133
  /* @__PURE__ */ jsxs("div", { style: {
2906
3134
  display: "flex",
2907
3135
  alignItems: "center",
2908
3136
  border: `2px solid ${error ? "#ef4444" : "#d1d5db"}`,
2909
3137
  borderRadius: "0.5rem",
2910
- overflow: "hidden",
3138
+ overflow: "visible",
2911
3139
  opacity: disabled ? 0.5 : 1,
2912
- backgroundColor: disabled ? "#f3f4f6" : "white"
3140
+ backgroundColor: disabled ? "#f3f4f6" : "white",
3141
+ position: "relative"
2913
3142
  }, children: [
2914
- onCcphoneChange && !lockCcphone ? /* @__PURE__ */ jsx(
2915
- "select",
2916
- {
2917
- value: ccphone,
2918
- onChange: (e) => onCcphoneChange(e.target.value),
2919
- disabled,
2920
- style: { padding: "0.75rem", backgroundColor: "#f9fafb", borderRight: "1px solid #e5e7eb", fontWeight: 500, color: "#374151", outline: "none", border: "none" },
2921
- children: SUPPORTED_COUNTRIES.map((c) => /* @__PURE__ */ jsxs("option", { value: c.code, children: [
2922
- c.flag,
2923
- " ",
2924
- c.code
2925
- ] }, c.code))
2926
- }
2927
- ) : /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", padding: "0.75rem", backgroundColor: "#f9fafb", borderRight: "1px solid #e5e7eb" }, children: [
2928
- /* @__PURE__ */ jsx("span", { style: { fontSize: "1.125rem" }, children: selectedCountry.flag }),
2929
- /* @__PURE__ */ jsx("span", { style: { fontWeight: 500, color: "#374151" }, children: selectedCountry.code })
2930
- ] }),
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
+ ),
2931
3218
  /* @__PURE__ */ jsx(
2932
3219
  "input",
2933
3220
  {
@@ -3230,6 +3517,18 @@ function useMobileRegistration(options) {
3230
3517
  }));
3231
3518
  return { success: false, error_type: response.error_type };
3232
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
+ }
3233
3532
  const message = getErrorMessage(err, "l'inscription");
3234
3533
  setState((prev) => ({ ...prev, loading: false, error: message, conflict: null }));
3235
3534
  return { success: false };
@@ -3375,6 +3674,7 @@ const C$1 = {
3375
3674
  gray900: "#111827",
3376
3675
  red: "#dc2626",
3377
3676
  redBg: "#fef2f2",
3677
+ amber: "#f59e0b",
3378
3678
  amberBg: "#fef3c7",
3379
3679
  white: "#ffffff"
3380
3680
  };
@@ -3467,12 +3767,14 @@ function SuccessOrbit() {
3467
3767
  })
3468
3768
  ] });
3469
3769
  }
3470
- 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;
3471
3772
  const {
3472
3773
  status,
3473
3774
  formData,
3474
3775
  loading: regLoading,
3475
3776
  error: regError,
3777
+ conflict,
3476
3778
  accountType,
3477
3779
  setAccountType,
3478
3780
  isPhoneOnly,
@@ -3484,6 +3786,7 @@ function SignupModal({ open, onOpenChange, onSwitchToLogin, onSignupSuccess, saa
3484
3786
  reset: resetReg,
3485
3787
  clearError
3486
3788
  } = useMobileRegistration({ saasApiUrl, iamApiUrl });
3789
+ const [showPasswordRecovery, setShowPasswordRecovery] = useState(false);
3487
3790
  const [step, setStep] = useState("intro");
3488
3791
  const [otpCode, setOtpCode] = useState("");
3489
3792
  const [password, setPassword] = useState("");
@@ -3536,31 +3839,35 @@ function SignupModal({ open, onOpenChange, onSwitchToLogin, onSignupSuccess, saa
3536
3839
  }
3537
3840
  };
3538
3841
  const handleInfoSubmit = async (e) => {
3539
- var _a, _b, _c, _d, _e, _f;
3842
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
3540
3843
  e.preventDefault();
3541
3844
  setLocalError(null);
3542
3845
  clearError();
3543
- if (!((_a = formData.name) == null ? void 0 : _a.trim())) {
3846
+ if (!((_a2 = formData.name) == null ? void 0 : _a2.trim())) {
3544
3847
  setLocalError("Le nom est requis");
3545
3848
  return;
3546
3849
  }
3547
- if (!isPhoneOnly && !((_b = formData.email) == null ? void 0 : _b.trim())) {
3850
+ if (!isPhoneOnly && !((_b2 = formData.email) == null ? void 0 : _b2.trim())) {
3548
3851
  setLocalError("L'adresse email est requise");
3549
3852
  return;
3550
3853
  }
3551
- 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) {
3552
3855
  setLocalError("Numéro de téléphone invalide");
3553
3856
  return;
3554
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
+ }
3555
3862
  if (isPhoneOnly && formData.ccphone !== "+221") {
3556
3863
  setLocalError("L'inscription par téléphone est réservée aux numéros sénégalais (+221)");
3557
3864
  return;
3558
3865
  }
3559
- if (!((_e = formData.town) == null ? void 0 : _e.trim())) {
3866
+ if (!((_f2 = formData.town) == null ? void 0 : _f2.trim())) {
3560
3867
  setLocalError("La ville est requise");
3561
3868
  return;
3562
3869
  }
3563
- if (!((_f = formData.country) == null ? void 0 : _f.trim())) {
3870
+ if (!((_g = formData.country) == null ? void 0 : _g.trim())) {
3564
3871
  setLocalError("Le pays est requis");
3565
3872
  return;
3566
3873
  }
@@ -3607,185 +3914,286 @@ function SignupModal({ open, onOpenChange, onSwitchToLogin, onSignupSuccess, saa
3607
3914
  };
3608
3915
  const handleAccountTypeSelect = (type) => {
3609
3916
  setAccountType(type);
3610
- if (type === "phone-only") updateFormData({ ccphone: "+221", country: "Sénégal", email: "" });
3917
+ if (type === "phone-only") updateFormData({ ccphone: "+221", country: "SN", email: "" });
3918
+ else if (!formData.country) updateFormData({ country: DEFAULT_COUNTRY_CODE });
3611
3919
  goToStep("info");
3612
3920
  };
3613
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;
3614
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsx(DialogContent, { children: signupSuccess && signupData ? /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3615
- /* @__PURE__ */ jsx(SuccessOrbit, {}),
3616
- /* @__PURE__ */ jsx(DialogTitle, { children: "Félicitations !" }),
3617
- /* @__PURE__ */ jsxs(DialogDescription, { children: [
3618
- "Votre compte a été créé avec succès. Bienvenue ",
3619
- formData.name,
3620
- " !"
3621
- ] }),
3622
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "0.5rem", fontSize: "0.875rem", color: C$1.gray500, marginTop: "1rem" }, children: [
3623
- /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
3624
- "Connexion automatique en cours..."
3625
- ] })
3626
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3627
- step === "intro" && /* @__PURE__ */ jsxs(Fragment, { children: [
3628
- /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3629
- /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.accent + "1a", "4rem"), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "2rem", height: "2rem", color: C$1.accent } }) }),
3630
- /* @__PURE__ */ jsx(DialogTitle, { children: "Ouvrez un compte Ollaid" }),
3631
- /* @__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
+ " !"
3632
3930
  ] }),
3633
- /* @__PURE__ */ jsx(AppsLogoSlider, { iamApiUrl }),
3634
- /* @__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: [
3635
- /* @__PURE__ */ jsx(IconCheckCircle2, { style: { width: "1.25rem", height: "1.25rem", color: C$1.green, flexShrink: 0 } }),
3636
- text
3637
- ] }, text)) }),
3638
- /* @__PURE__ */ jsx(StepIndicator, { current: 1 }),
3639
- /* @__PURE__ */ jsx(Button, { onClick: () => goToStep("account-type"), style: { width: "100%", marginTop: "1rem" }, children: "Suivant →" }),
3640
- /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", fontSize: "0.875rem", marginTop: "1rem" }, children: [
3641
- /* @__PURE__ */ jsx("span", { style: { color: C$1.gray500 }, children: "Déjà un compte ? " }),
3642
- /* @__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..."
3643
3934
  ] })
3644
- ] }),
3645
- step === "account-type" && /* @__PURE__ */ jsxs(Fragment, { children: [
3646
- /* @__PURE__ */ jsx("button", { onClick: () => goToStep("intro"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
3647
- /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3648
- /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.gray100), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "1.5rem", height: "1.5rem", color: C$1.primary } }) }),
3649
- /* @__PURE__ */ jsx(DialogTitle, { children: "Choisissez votre type de compte" })
3650
- ] }),
3651
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem", marginTop: "1rem" }, children: [
3652
- /* @__PURE__ */ jsxs(
3653
- "button",
3654
- {
3655
- type: "button",
3656
- onClick: () => handleAccountTypeSelect("email"),
3657
- 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" },
3658
- children: [
3659
- /* @__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 } }) }),
3660
- /* @__PURE__ */ jsxs("div", { children: [
3661
- /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, color: C$1.gray900 }, children: "Email + Téléphone" }),
3662
- /* @__PURE__ */ jsx("div", { style: { fontSize: "0.875rem", color: C$1.gray500 }, children: "Compte complet" })
3663
- ] })
3664
- ]
3665
- }
3666
- ),
3667
- /* @__PURE__ */ jsxs(
3668
- "button",
3669
- {
3670
- type: "button",
3671
- onClick: () => handleAccountTypeSelect("phone-only"),
3672
- 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" },
3673
- children: [
3674
- /* @__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 } }) }),
3675
- /* @__PURE__ */ jsxs("div", { children: [
3676
- /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, color: C$1.gray900 }, children: "Téléphone uniquement" }),
3677
- /* @__PURE__ */ jsx("div", { style: { fontSize: "0.875rem", color: C$1.gray500 }, children: "🇸🇳 Sénégal uniquement" })
3678
- ] })
3679
- ]
3680
- }
3681
- )
3682
- ] }),
3683
- /* @__PURE__ */ jsx(StepIndicator, { current: 2 })
3684
- ] }),
3685
- step === "info" && /* @__PURE__ */ jsxs(Fragment, { children: [
3686
- /* @__PURE__ */ jsx("button", { onClick: () => goToStep("account-type"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
3687
- /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3688
- /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.primary + "1a"), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "1.5rem", height: "1.5rem", color: C$1.primary } }) }),
3689
- /* @__PURE__ */ jsx(DialogTitle, { children: "Créer votre compte" })
3690
- ] }),
3691
- 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" }),
3692
- !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" }),
3693
- /* @__PURE__ */ jsxs("form", { onSubmit: handleInfoSubmit, style: { display: "flex", flexDirection: "column", gap: "0.75rem", marginTop: "0.75rem" }, children: [
3694
- renderError(),
3695
- /* @__PURE__ */ jsxs("div", { children: [
3696
- /* @__PURE__ */ jsx(Label, { children: "Nom complet" }),
3697
- /* @__PURE__ */ jsx(Input, { placeholder: "Jean Dupont", value: formData.name || "", onChange: (e) => updateFormData({ name: e.target.value }), disabled: regLoading })
3698
- ] }),
3699
- !isPhoneOnly && /* @__PURE__ */ jsxs("div", { children: [
3700
- /* @__PURE__ */ jsx(Label, { children: "Adresse email" }),
3701
- /* @__PURE__ */ jsx(Input, { type: "email", placeholder: "vous@exemple.com", value: formData.email || "", onChange: (e) => updateFormData({ email: 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" })
3702
3941
  ] }),
3703
- /* @__PURE__ */ jsxs("div", { children: [
3704
- /* @__PURE__ */ jsx(Label, { children: "Numéro de téléphone" }),
3705
- /* @__PURE__ */ jsx(PhoneInput, { value: formData.phone || "", onChange: (p) => updateFormData({ phone: p }), ccphone: formData.ccphone || "+221", onCcphoneChange: (c) => updateFormData({ ccphone: c }), disabled: regLoading, lockCcphone: isPhoneOnly })
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 })
3706
3949
  ] }),
3707
- /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.75rem" }, children: [
3708
- /* @__PURE__ */ jsxs("div", { children: [
3709
- /* @__PURE__ */ jsx(Label, { children: "Ville" }),
3710
- /* @__PURE__ */ jsx(Input, { placeholder: "Dakar", value: formData.town || "", onChange: (e) => updateFormData({ town: e.target.value }), disabled: regLoading })
3711
- ] }),
3712
- /* @__PURE__ */ jsxs("div", { children: [
3713
- /* @__PURE__ */ jsx(Label, { children: "Pays" }),
3714
- /* @__PURE__ */ jsx(Input, { placeholder: "Sénégal", value: formData.country || "", onChange: (e) => updateFormData({ country: e.target.value }), disabled: regLoading || 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" })
3715
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" })
3716
3963
  ] }),
3717
- /* @__PURE__ */ jsx(StepIndicator, { current: 3 }),
3718
- /* @__PURE__ */ jsx(Button, { type: "submit", disabled: regLoading, style: { width: "100%" }, children: regLoading ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
3719
- /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
3720
- " Vérification..."
3721
- ] }) : "Continuer" })
3722
- ] })
3723
- ] }),
3724
- step === "otp" && /* @__PURE__ */ jsxs(Fragment, { children: [
3725
- /* @__PURE__ */ jsx("button", { onClick: () => goToStep("info"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
3726
- /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3727
- /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.accent), children: /* @__PURE__ */ jsx(IconKeyRound, { style: { width: "1.5rem", height: "1.5rem", color: C$1.white } }) }),
3728
- /* @__PURE__ */ jsx(DialogTitle, { children: "Vérification" }),
3729
- /* @__PURE__ */ jsxs(DialogDescription, { children: [
3730
- "Entrez le code envoyé ",
3731
- isPhoneOnly ? `au ${formData.ccphone} ${formData.phone}` : `à ${formData.email}`
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
+ )
3996
+ ] }),
3997
+ /* @__PURE__ */ jsx(StepIndicator, { current: 2 })
3732
3998
  ] })
3733
3999
  ] }),
3734
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem", display: "flex", flexDirection: "column", gap: "1rem" }, children: [
3735
- renderError(),
3736
- /* @__PURE__ */ jsx(OTPInput, { value: otpCode, onChange: setOtpCode, disabled: regLoading }),
3737
- /* @__PURE__ */ jsx("div", { style: { textAlign: "center", fontSize: "0.875rem" }, children: resendCooldown > 0 ? /* @__PURE__ */ jsxs("span", { style: { color: C$1.gray500 }, children: [
3738
- "Renvoyer dans ",
3739
- resendCooldown,
3740
- "s"
3741
- ] }) : /* @__PURE__ */ jsx("button", { type: "button", onClick: handleResendOTP, style: linkStyle, children: "Code non reçu ? Renvoyer" }) }),
3742
- /* @__PURE__ */ jsx(StepIndicator, { current: 4 }),
3743
- /* @__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: [
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,
4015
+ {
4016
+ onClick: () => {
4017
+ const fullPhone = formData.phone || "";
4018
+ if (onSwitchToLoginWithPhone) onSwitchToLoginWithPhone(fullPhone);
4019
+ else onSwitchToLogin();
4020
+ },
4021
+ style: { width: "100%" },
4022
+ children: [
4023
+ /* @__PURE__ */ jsx(IconSmartphone, { style: { width: "1rem", height: "1rem" } }),
4024
+ "Se connecter par téléphone"
4025
+ ]
4026
+ }
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
+ ] })
4039
+ ] })
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
+ )
4118
+ ] }),
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: [
3744
4140
  /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
3745
4141
  " Vérification..."
3746
- ] }) : "Vérifier" })
3747
- ] })
3748
- ] }),
3749
- step === "password" && /* @__PURE__ */ jsxs(Fragment, { children: [
3750
- /* @__PURE__ */ jsx("button", { onClick: () => goToStep("otp"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
3751
- /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3752
- /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.accent), children: /* @__PURE__ */ jsx(IconLock, { style: { width: "1.5rem", height: "1.5rem", color: C$1.white } }) }),
3753
- /* @__PURE__ */ jsx(DialogTitle, { children: "Créer un mot de passe" })
4142
+ ] }) : "Vérifier" }) })
3754
4143
  ] }),
3755
- /* @__PURE__ */ jsxs("form", { onSubmit: handlePasswordSubmit, style: { display: "flex", flexDirection: "column", gap: "0.75rem", marginTop: "0.75rem" }, children: [
3756
- renderError(),
3757
- /* @__PURE__ */ jsxs("div", { children: [
3758
- /* @__PURE__ */ jsx(Label, { children: "Mot de passe" }),
3759
- /* @__PURE__ */ jsx(Input, { type: "password", placeholder: "Minimum 8 caractères", value: password, onChange: (e) => setPassword(e.target.value), disabled: regLoading })
3760
- ] }),
3761
- /* @__PURE__ */ jsxs("div", { children: [
3762
- /* @__PURE__ */ jsx(Label, { children: "Confirmer le mot de passe" }),
3763
- /* @__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" })
3764
4149
  ] }),
3765
- /* @__PURE__ */ jsx(StepIndicator, { current: 5 }),
3766
- /* @__PURE__ */ jsx(Button, { type: "submit", disabled: regLoading, style: { width: "100%" }, children: "Continuer" })
3767
- ] })
3768
- ] }),
3769
- step === "confirm" && /* @__PURE__ */ jsxs(Fragment, { children: [
3770
- /* @__PURE__ */ jsx("button", { onClick: () => goToStep("password"), style: backBtnStyle, type: "button", children: /* @__PURE__ */ jsx(IconArrowLeft, { style: { width: "1rem", height: "1rem" } }) }),
3771
- /* @__PURE__ */ jsxs(DialogHeader, { style: { textAlign: "center" }, children: [
3772
- /* @__PURE__ */ jsx("div", { style: iconCircle(C$1.primary + "1a"), children: /* @__PURE__ */ jsx(IconShieldCheck, { style: { width: "1.5rem", height: "1.5rem", color: C$1.primary } }) }),
3773
- /* @__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
+ ] })
3774
4165
  ] }),
3775
- /* @__PURE__ */ jsxs("div", { style: { marginTop: "1rem", display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
3776
- renderError(),
3777
- /* @__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: [
3778
- /* @__PURE__ */ jsx("span", { style: { fontSize: "0.875rem", color: C$1.gray500 }, children: label }),
3779
- /* @__PURE__ */ jsx("span", { style: { fontSize: "0.875rem", fontWeight: 500 }, children: value })
3780
- ] }, label)) }),
3781
- /* @__PURE__ */ jsx(StepIndicator, { current: 6 }),
3782
- /* @__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: [
3783
4181
  /* @__PURE__ */ jsx(IconLoader2, { style: { width: "1rem", height: "1rem" } }),
3784
4182
  " Création du compte..."
3785
- ] }) : "Créer mon compte" })
4183
+ ] }) : "Créer mon compte" }) })
3786
4184
  ] })
3787
- ] })
3788
- ] }) }) });
4185
+ ] }) }) }),
4186
+ /* @__PURE__ */ jsx(
4187
+ PasswordRecoveryModal,
4188
+ {
4189
+ open: showPasswordRecovery,
4190
+ onOpenChange: setShowPasswordRecovery,
4191
+ onSuccess: () => setShowPasswordRecovery(false),
4192
+ saasApiUrl,
4193
+ iamApiUrl
4194
+ }
4195
+ )
4196
+ ] });
3789
4197
  }
3790
4198
  const C = {
3791
4199
  primary: "#002147",
@@ -3852,7 +4260,7 @@ function OnboardingModal({ open, onOpenChange, user, onComplete, onSkip }) {
3852
4260
  ] }),
3853
4261
  /* @__PURE__ */ jsx(DialogDescription, { children: "Ajoutez les informations manquantes pour finaliser votre compte." })
3854
4262
  ] }),
3855
- /* @__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: [
3856
4264
  needsPhoto && /* @__PURE__ */ jsxs("div", { children: [
3857
4265
  /* @__PURE__ */ jsx(Label, { style: { display: "block", marginBottom: "0.5rem", color: C.gray700, fontWeight: 500 }, children: "Photo de profil" }),
3858
4266
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "1rem" }, children: [
@@ -3884,15 +4292,7 @@ function OnboardingModal({ open, onOpenChange, user, onComplete, onSkip }) {
3884
4292
  fontWeight: 500
3885
4293
  }, children: [
3886
4294
  "Choisir une photo",
3887
- /* @__PURE__ */ jsx(
3888
- "input",
3889
- {
3890
- type: "file",
3891
- accept: "image/*",
3892
- onChange: handleFileChange,
3893
- style: { display: "none" }
3894
- }
3895
- )
4295
+ /* @__PURE__ */ jsx("input", { type: "file", accept: "image/*", onChange: handleFileChange, style: { display: "none" } })
3896
4296
  ] }),
3897
4297
  /* @__PURE__ */ jsx("p", { style: { fontSize: "0.75rem", color: fileError ? "#dc2626" : C.gray500, marginTop: "0.25rem" }, children: fileError || "JPG, PNG. Max 2 Mo." })
3898
4298
  ] })
@@ -3900,15 +4300,7 @@ function OnboardingModal({ open, onOpenChange, user, onComplete, onSkip }) {
3900
4300
  ] }),
3901
4301
  needsPhone && /* @__PURE__ */ jsxs("div", { children: [
3902
4302
  /* @__PURE__ */ jsx(Label, { style: { display: "block", marginBottom: "0.5rem", color: C.gray700, fontWeight: 500 }, children: "Numéro de téléphone" }),
3903
- /* @__PURE__ */ jsx(
3904
- PhoneInput,
3905
- {
3906
- value: phone,
3907
- onChange: setPhone,
3908
- ccphone,
3909
- onCcphoneChange: setCcphone
3910
- }
3911
- )
4303
+ /* @__PURE__ */ jsx(PhoneInput, { value: phone, onChange: setPhone, ccphone, onCcphoneChange: setCcphone })
3912
4304
  ] }),
3913
4305
  needsEmail && /* @__PURE__ */ jsxs("div", { children: [
3914
4306
  /* @__PURE__ */ jsxs(Label, { style: { display: "block", marginBottom: "0.5rem", color: C.gray700, fontWeight: 500 }, children: [
@@ -3950,38 +4342,32 @@ function OnboardingModal({ open, onOpenChange, user, onComplete, onSkip }) {
3950
4342
  type: "checkbox",
3951
4343
  checked: confirmed,
3952
4344
  onChange: (e) => setConfirmed(e.target.checked),
3953
- style: {
3954
- width: "1rem",
3955
- height: "1rem",
3956
- marginTop: "0.125rem",
3957
- accentColor: C.primary,
3958
- cursor: "pointer"
3959
- }
4345
+ style: { width: "1rem", height: "1rem", marginTop: "0.125rem", accentColor: C.primary, cursor: "pointer" }
3960
4346
  }
3961
4347
  ),
3962
4348
  /* @__PURE__ */ jsx("span", { children: "Je confirme que ces informations sont exactes" })
3963
- ] }),
3964
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
3965
- /* @__PURE__ */ jsx(
3966
- Button,
3967
- {
3968
- onClick: handleSubmit,
3969
- disabled: !canSubmit || submitting,
3970
- style: { width: "100%", height: "2.75rem", opacity: canSubmit && !submitting ? 1 : 0.5 },
3971
- children: submitting ? "Enregistrement..." : "Valider"
3972
- }
3973
- ),
3974
- /* @__PURE__ */ jsx(
3975
- Button,
3976
- {
3977
- variant: "outline",
3978
- onClick: onSkip,
3979
- disabled: submitting,
3980
- style: { width: "100%", height: "2.75rem" },
3981
- children: "Passer pour l'instant"
3982
- }
3983
- )
3984
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
+ )
3985
4371
  ] })
3986
4372
  ] }) });
3987
4373
  }
@@ -4232,6 +4618,7 @@ function NativeSSOPage({
4232
4618
  redirectAfterLogout
4233
4619
  }) {
4234
4620
  const [modal, setModal] = useState("none");
4621
+ const [loginInitialPhone, setLoginInitialPhone] = useState();
4235
4622
  const [showOnboarding, setShowOnboarding] = useState(false);
4236
4623
  const [pendingSession, setPendingSession] = useState(null);
4237
4624
  const [session, setSession] = useState(() => {
@@ -4273,13 +4660,23 @@ function NativeSSOPage({
4273
4660
  }, []);
4274
4661
  const openLogin = useCallback(() => setModal("login"), []);
4275
4662
  const openSignup = useCallback(() => setModal("signup"), []);
4276
- const closeModal = useCallback(() => setModal("none"), []);
4663
+ const closeModal = useCallback(() => {
4664
+ setModal("none");
4665
+ setLoginInitialPhone(void 0);
4666
+ }, []);
4277
4667
  const switchToSignup = useCallback(() => {
4278
4668
  setModal("none");
4669
+ setLoginInitialPhone(void 0);
4279
4670
  setTimeout(() => setModal("signup"), 150);
4280
4671
  }, []);
4281
4672
  const switchToLogin = useCallback(() => {
4282
4673
  setModal("none");
4674
+ setLoginInitialPhone(void 0);
4675
+ setTimeout(() => setModal("login"), 150);
4676
+ }, []);
4677
+ const switchToLoginWithPhone = useCallback((phone) => {
4678
+ setModal("none");
4679
+ setLoginInitialPhone(phone);
4283
4680
  setTimeout(() => setModal("login"), 150);
4284
4681
  }, []);
4285
4682
  const handleLoginSuccess = useCallback((token, user) => {
@@ -4379,6 +4776,13 @@ function NativeSSOPage({
4379
4776
  }, children: /* @__PURE__ */ jsx(AppsLogoSlider, { iamApiUrl, speed: "normal" }) }) })
4380
4777
  ] }) });
4381
4778
  if (session) {
4779
+ if (redirectAfterLogin) {
4780
+ window.location.href = redirectAfterLogin;
4781
+ return /* @__PURE__ */ jsxs("div", { style: containerStyle, children: [
4782
+ /* @__PURE__ */ jsx(TopBranding, { subtitle: title }),
4783
+ /* @__PURE__ */ jsx("p", { style: { color: "rgba(255,255,255,0.7)", fontSize: "0.875rem" }, children: "Redirection en cours..." })
4784
+ ] });
4785
+ }
4382
4786
  return /* @__PURE__ */ jsxs("div", { style: containerStyle, children: [
4383
4787
  /* @__PURE__ */ jsx(TopBranding, { subtitle: title }),
4384
4788
  /* @__PURE__ */ jsx(SliderBadge, {}),
@@ -4423,7 +4827,8 @@ function NativeSSOPage({
4423
4827
  onLoginSuccess: handleLoginSuccess,
4424
4828
  saasApiUrl,
4425
4829
  iamApiUrl,
4426
- defaultAccountType: accountType
4830
+ defaultAccountType: accountType,
4831
+ initialPhone: loginInitialPhone
4427
4832
  }
4428
4833
  ),
4429
4834
  /* @__PURE__ */ jsx(
@@ -4434,6 +4839,7 @@ function NativeSSOPage({
4434
4839
  if (!open) closeModal();
4435
4840
  },
4436
4841
  onSwitchToLogin: switchToLogin,
4842
+ onSwitchToLoginWithPhone: switchToLoginWithPhone,
4437
4843
  onSignupSuccess: handleLoginSuccess,
4438
4844
  saasApiUrl,
4439
4845
  iamApiUrl,
@@ -4623,6 +5029,9 @@ const iamAccountService = {
4623
5029
  export {
4624
5030
  ApiError,
4625
5031
  AppsLogoSlider,
5032
+ COUNTRIES,
5033
+ DEFAULT_COUNTRY_CODE,
5034
+ DEFAULT_DIAL_CODE,
4626
5035
  LoginModal,
4627
5036
  NativeSSOPage,
4628
5037
  NativeSSOProvider,
@@ -4635,10 +5044,14 @@ export {
4635
5044
  getAccountType,
4636
5045
  getAuthToken,
4637
5046
  getAuthUser,
5047
+ getCountryByCode,
5048
+ getCountryByDialCode,
5049
+ getDefaultCountry,
4638
5050
  getNativeAuthConfig,
4639
5051
  iamAccountService,
4640
5052
  mobilePasswordService,
4641
5053
  nativeAuthService,
5054
+ searchCountries,
4642
5055
  setNativeAuthConfig,
4643
5056
  useMobilePassword,
4644
5057
  useMobileRegistration,