@djb25/digit-ui-module-ekyc 1.0.5 → 1.0.7

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.
@@ -1,4 +1,4 @@
1
- import React, { useState, useRef, Fragment } from "react";
1
+ import React, { useState, useRef, Fragment, useEffect } from "react";
2
2
  import {
3
3
  Card,
4
4
  LabelFieldPair,
@@ -14,6 +14,7 @@ import {
14
14
  } from "@djb25/digit-ui-react-components";
15
15
  import { useTranslation } from "react-i18next";
16
16
  import { useLocation, useHistory } from "react-router-dom";
17
+ import { getSavedData } from "../../utils";
17
18
  import AddressDetails from "./AddressDetails";
18
19
 
19
20
  // ─── Icons ───────────────────────────────────────────────────────────────────
@@ -156,26 +157,68 @@ const AadhaarVerification = () => {
156
157
  };
157
158
 
158
159
  // Normalize the nested data shape (API returns .connectionDetails, fallback uses .connectionDetailsInfo)
159
- const details =
160
+ const initialDetails =
160
161
  connectionDetails?.connectionDetails ||
161
162
  connectionDetails?.connectionDetailsInfo ||
162
163
  {};
163
164
 
164
165
  // ── State ──
165
- const [aadhaarLastFour, setAadhaarLastFour] = useState("");
166
- const [isAadhaarVerified, setIsAadhaarVerified] = useState(false);
166
+ const [initialData] = useState(() => getSavedData("EKYC_INITIAL_DATA", {
167
+ userName: initialDetails.consumerName || "",
168
+ mobileNumber: initialDetails.phoneNumber || "",
169
+ whatsappNumber: initialDetails.phoneNumber || "",
170
+ email: initialDetails.email || "",
171
+ noOfPersons: connectionDetails?.addressDetails?.noOfPerson || "",
172
+ // Property and Connection Info
173
+ pidNumber: connectionDetails?.propertyDetails?.pidNumber || "",
174
+ typeOfConnection: connectionDetails?.connectionDetails?.connectionType || "",
175
+ connectionCategory: connectionDetails?.connectionDetails?.connectionCategory || "",
176
+ userType: connectionDetails?.propertyDetails?.userType || "",
177
+ noOfFloor: connectionDetails?.propertyDetails?.noOfFloor || null,
178
+ // Address Info
179
+ fullAddress: connectionDetails?.addressDetails?.fullAddress || "",
180
+ flatNo: connectionDetails?.addressDetails?.flatHouseNumber || "",
181
+ building: connectionDetails?.addressDetails?.buildingTower || "",
182
+ landmark: connectionDetails?.addressDetails?.landmark || "",
183
+ pincode: connectionDetails?.addressDetails?.pinCode || "",
184
+ assembly: connectionDetails?.addressDetails?.assembly || "",
185
+ ward: connectionDetails?.addressDetails?.ward || "",
186
+ }));
187
+
188
+ // Sync initial data snapshot
189
+ useEffect(() => {
190
+ sessionStorage.setItem("EKYC_INITIAL_DATA", JSON.stringify(initialData));
191
+ }, [initialData]);
192
+
193
+ const [aadhaarLastFour, setAadhaarLastFour] = useState(() => sessionStorage.getItem("EKYC_AADHAAR_LAST_FOUR") || "");
194
+ const [isAadhaarVerified, setIsAadhaarVerified] = useState(() => sessionStorage.getItem("EKYC_AADHAAR_VERIFIED") === "true");
167
195
  const [isVerifying, setIsVerifying] = useState(false);
168
- const [nameCorrect, setNameCorrect] = useState({ code: "NO", name: "CORE_COMMON_NO" });
169
- const [userName, setUserName] = useState(details.consumerName || "");
170
-
171
- const [mobileChange, setMobileChange] = useState({ code: "NO", name: "CORE_COMMON_NO" });
172
- const [mobileNumber, setMobileNumber] = useState(details.phoneNumber || "");
173
-
174
- const [whatsappNumber, setWhatsappNumber] = useState(details.phoneNumber || "");
175
- const [email, setEmail] = useState(details.email || "");
176
- const [noOfPersons, setNoOfPersons] = useState(
177
- connectionDetails?.addressDetails?.noOfPerson || ""
178
- );
196
+ const [showOtpField, setShowOtpField] = useState(false);
197
+ const [otp, setOtp] = useState("");
198
+ const [otpError, setOtpError] = useState(false);
199
+ const [nameCorrect, setNameCorrect] = useState(() => getSavedData("EKYC_NAME_CORRECT", { code: "NO", name: "CORE_COMMON_NO" }));
200
+ const [userName, setUserName] = useState(() => sessionStorage.getItem("EKYC_USER_NAME") || initialData.userName);
201
+
202
+ const [mobileChange, setMobileChange] = useState(() => getSavedData("EKYC_MOBILE_CHANGE", { code: "NO", name: "CORE_COMMON_NO" }));
203
+ const [mobileNumber, setMobileNumber] = useState(() => sessionStorage.getItem("EKYC_MOBILE_NUMBER") || initialData.mobileNumber);
204
+
205
+ const [whatsappNumber, setWhatsappNumber] = useState(() => sessionStorage.getItem("EKYC_WHATSAPP_NUMBER") || initialData.whatsappNumber);
206
+ const [email, setEmail] = useState(() => sessionStorage.getItem("EKYC_EMAIL") || initialData.email);
207
+ const [noOfPersons, setNoOfPersons] = useState(() => sessionStorage.getItem("EKYC_NO_OF_PERSONS") || initialData.noOfPersons);
208
+
209
+ // Sync current form state to sessionStorage
210
+ useEffect(() => {
211
+ sessionStorage.setItem("EKYC_AADHAAR_LAST_FOUR", aadhaarLastFour);
212
+ sessionStorage.setItem("EKYC_AADHAAR_VERIFIED", isAadhaarVerified);
213
+ sessionStorage.setItem("EKYC_NAME_CORRECT", JSON.stringify(nameCorrect));
214
+ sessionStorage.setItem("EKYC_USER_NAME", userName);
215
+ sessionStorage.setItem("EKYC_MOBILE_CHANGE", JSON.stringify(mobileChange));
216
+ sessionStorage.setItem("EKYC_MOBILE_NUMBER", mobileNumber);
217
+ sessionStorage.setItem("EKYC_WHATSAPP_NUMBER", whatsappNumber);
218
+ sessionStorage.setItem("EKYC_EMAIL", email);
219
+ sessionStorage.setItem("EKYC_NO_OF_PERSONS", noOfPersons);
220
+ sessionStorage.setItem("EKYC_CURRENT_STEP", "AADHAAR");
221
+ }, [aadhaarLastFour, isAadhaarVerified, nameCorrect, userName, mobileChange, mobileNumber, whatsappNumber, email, noOfPersons]);
179
222
  const [showAddressSection, setShowAddressSection] = useState(false);
180
223
  const [addressData, setAddressData] = useState(null);
181
224
 
@@ -186,17 +229,27 @@ const AadhaarVerification = () => {
186
229
 
187
230
  // ── Handlers ──
188
231
  const handleVerifyAadhaar = () => {
189
- if (aadhaarLastFour.length !== 4 || isVerifying) return;
232
+ if (aadhaarLastFour.length !== 12 || isVerifying) return;
190
233
  setIsVerifying(true);
191
234
  setTimeout(() => {
192
235
  setIsVerifying(false);
236
+ setShowOtpField(true);
237
+ }, 1200);
238
+ };
239
+
240
+ const handleVerifyOtp = () => {
241
+ if (otp === "123456") {
193
242
  setIsAadhaarVerified(true);
243
+ setShowOtpField(false);
244
+ setOtpError(false);
194
245
  // Auto-expand address section upon verification
195
246
  setShowAddressSection(true);
196
247
  setTimeout(() => {
197
248
  addressSectionRef.current?.scrollIntoView({ behavior: "smooth", block: "start" });
198
249
  }, 100);
199
- }, 1200);
250
+ } else {
251
+ setOtpError(true);
252
+ }
200
253
  };
201
254
 
202
255
  const handleSaveAndContinue = () => {
@@ -222,6 +275,7 @@ const AadhaarVerification = () => {
222
275
  noOfPersons,
223
276
  },
224
277
  addressDetails,
278
+ initialData: initialData, // Pass the initial snapshot
225
279
  });
226
280
  };
227
281
 
@@ -273,8 +327,9 @@ const AadhaarVerification = () => {
273
327
  };
274
328
 
275
329
  return (
276
- <div className="inbox-container">
277
- <style>{`
330
+ <div className="ground-container employee-app-container form-container">
331
+ <div className="inbox-container">
332
+ <style>{`
278
333
  @keyframes fadeSlideIn {
279
334
  from { opacity: 0; transform: translateY(6px); }
280
335
  to { opacity: 1; transform: translateY(0); }
@@ -295,259 +350,296 @@ const AadhaarVerification = () => {
295
350
  .ekyc-field-label { font-size: 11px; font-weight: 600; color: #667085; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
296
351
  `}</style>
297
352
 
298
- {/* ── Sidebar ── */}
299
- <div className="filters-container">
300
- <Card style={{ display: "flex", alignItems: "center", padding: "12px 16px", marginBottom: "12px", borderRadius: "8px" }}>
301
- <div style={{ color: "#185FA5", marginRight: "10px", display: "flex" }}>
302
- <HomeIcon style={{ width: "20px", height: "20px" }} />
303
- </div>
304
- <div style={{ fontWeight: "600", fontSize: "15px", color: "#0B0C0C" }}>
305
- {t("EKYC_PROCESS") || "eKYC Process"}
306
- </div>
307
- </Card>
308
-
309
- <div style={{ background: "#fff", padding: "16px 14px", borderRadius: "8px", border: "1px solid #EAECF0" }}>
310
- {[
311
- { label: t("EKYC_STEP_AADHAAR") || "Aadhaar", done: showAddressSection, active: !showAddressSection },
312
- { label: t("EKYC_STEP_ADDRESS") || "Address", done: addressData !== null, active: showAddressSection && addressData === null },
313
- { label: t("EKYC_STEP_PROPERTY") || "Property", done: false, active: false },
314
- { label: t("EKYC_STEP_REVIEW") || "Review", done: false, active: false },
315
- ].map((step, i) => (
316
- <div className="ekyc-sidebar-step" key={i}>
317
- <div className={`ekyc-step-dot${step.done ? " done" : step.active ? " active" : ""}`}>
318
- {step.done
319
- ? <CheckIcon size={11} color="#fff" />
320
- : i + 1}
321
- </div>
322
- {i < 3 && <div className="ekyc-step-line" />}
323
- <div className={`ekyc-step-label${step.done ? " done" : step.active ? " active" : ""}`}>
324
- {step.label}
325
- </div>
353
+ {/* ── Sidebar ── */}
354
+ <div className="filters-container">
355
+ <Card style={{ display: "flex", alignItems: "center", padding: "12px 16px", marginBottom: "12px", borderRadius: "8px" }}>
356
+ <div style={{ color: "#185FA5", marginRight: "10px", display: "flex" }}>
357
+ <HomeIcon style={{ width: "20px", height: "20px" }} />
358
+ </div>
359
+ <div style={{ fontWeight: "600", fontSize: "15px", color: "#0B0C0C" }}>
360
+ {t("EKYC_PROCESS") || "eKYC Process"}
326
361
  </div>
327
- ))}
362
+ </Card>
363
+
364
+ <div style={{ background: "#fff", padding: "16px 14px", borderRadius: "8px", border: "1px solid #EAECF0" }}>
365
+ {[
366
+ { label: t("EKYC_STEP_AADHAAR") || "Aadhaar", done: showAddressSection, active: !showAddressSection },
367
+ { label: t("EKYC_STEP_ADDRESS") || "Address", done: addressData !== null, active: showAddressSection && addressData === null },
368
+ { label: t("EKYC_STEP_PROPERTY") || "Property", done: false, active: false },
369
+ { label: t("EKYC_STEP_REVIEW") || "Review", done: false, active: false },
370
+ ].map((step, i) => (
371
+ <div className="ekyc-sidebar-step" key={i}>
372
+ <div className={`ekyc-step-dot${step.done ? " done" : step.active ? " active" : ""}`}>
373
+ {step.done
374
+ ? <CheckIcon size={11} color="#fff" />
375
+ : i + 1}
376
+ </div>
377
+ {i < 3 && <div className="ekyc-step-line" />}
378
+ <div className={`ekyc-step-label${step.done ? " done" : step.active ? " active" : ""}`}>
379
+ {step.label}
380
+ </div>
381
+ </div>
382
+ ))}
383
+ </div>
328
384
  </div>
329
- </div>
330
-
331
- {/* ── Main content ── */}
332
- <div style={{ flex: 1, marginLeft: "16px" }}>
333
- <Card>
334
385
 
335
- {/* K-Number badge */}
336
- <div style={{ display: "flex", justifyContent: "flex-end", marginBottom: "20px" }}>
337
- <div style={{
338
- background: "#F9FAFB", border: "0.5px solid #EAECF0",
339
- borderRadius: "20px", padding: "4px 14px",
340
- fontSize: "12px", color: "#667085",
341
- }}>
342
- {t("EKYC_K_NUMBER") || "K Number"}:{" "}
343
- <span style={{ color: "#0B0C0C", fontWeight: "600" }}>{kNumber}</span>
386
+ {/* ── Main content ── */}
387
+ <div style={{ flex: 1, marginLeft: "16px" }}>
388
+ <Card>
389
+
390
+ {/* K-Number badge */}
391
+ <div style={{ display: "flex", justifyContent: "flex-end", marginBottom: "20px" }}>
392
+ <div style={{
393
+ background: "#F9FAFB", border: "0.5px solid #EAECF0",
394
+ borderRadius: "20px", padding: "4px 14px",
395
+ fontSize: "12px", color: "#667085",
396
+ }}>
397
+ {t("EKYC_K_NUMBER") || "K Number"}:{" "}
398
+ <span style={{ color: "#0B0C0C", fontWeight: "600" }}>{kNumber}</span>
399
+ </div>
344
400
  </div>
345
- </div>
346
401
 
347
- {/* ── Section 1: Aadhaar ── */}
348
- <SectionHead
349
- icon={<LockIcon size={16} />}
350
- label={t("EKYC_AADHAAR_NUMBER_HEADER") || "Aadhaar Number"}
351
- />
402
+ {/* ── Section 1: Aadhaar ── */}
403
+ <SectionHead
404
+ icon={<LockIcon size={16} />}
405
+ label={t("EKYC_AADHAAR_NUMBER_HEADER") || "Aadhaar Number"}
406
+ />
352
407
 
353
- <div className="ekyc-field-label">
354
- {t("EKYC_LAST_4_DIGIT_AADHAAR") || "Enter 12 digits of Aadhaar"}
355
- </div>
356
- <LabelFieldPair>
357
- <div className="field">
358
- <IconInput
359
- icon={<LockIcon size={15} />}
360
- rightIcon={isAadhaarVerified ? <CheckIcon size={15} /> : null}
361
- value={aadhaarLastFour}
362
- onChange={(e) => {
363
- const val = e.target.value;
364
- if (val.length <= 12 && /^\d*$/.test(val)) setAadhaarLastFour(val);
365
- }}
366
- placeholder={t("EKYC_ENTER_LAST_4_DIGIT") || "Enter 12 digits"}
367
- maxLength={12}
368
- disabled={isAadhaarVerified}
369
- inputStyle={isAadhaarVerified ? styles.verifiedInput : {}}
370
- />
408
+ <div className="ekyc-field-label">
409
+ {t("EKYC_LAST_4_DIGIT_AADHAAR") || "Enter 12 digits of Aadhaar"}
371
410
  </div>
372
- </LabelFieldPair>
373
-
374
- {!isAadhaarVerified && (
375
- <SubmitBar
376
- label={isVerifying
377
- ? t("EKYC_VERIFYING") || "Verifying..."
378
- : t("EKYC_VERIFY_AADHAAR_BTN") || "Verify Aadhaar"}
379
- onSubmit={handleVerifyAadhaar}
380
- disabled={aadhaarLastFour.length !== 4 || isVerifying}
381
- style={{ marginTop: "12px" }}
382
- />
383
- )}
384
-
385
- {isAadhaarVerified && (
386
- <div style={styles.verifiedCard}>
387
- <div style={{ display: "flex", alignItems: "center", gap: "8px", marginBottom: "14px" }}>
388
- <div style={{
389
- width: "24px", height: "24px", borderRadius: "50%",
390
- background: "#9FE1CB", display: "flex", alignItems: "center",
391
- justifyContent: "center", animation: "pulseGreen 2s ease infinite",
392
- flexShrink: 0,
393
- }}>
394
- <CheckIcon size={13} color="#085041" />
395
- </div>
396
- <span style={{ fontWeight: "600", color: "#085041", fontSize: "14px" }}>
397
- {t("EKYC_AADHAAR_VERIFIED_SUCCESS") || "Aadhaar Verified Successfully"}
398
- </span>
411
+ <LabelFieldPair>
412
+ <div className="field">
413
+ <IconInput
414
+ icon={<LockIcon size={15} />}
415
+ rightIcon={isAadhaarVerified ? <CheckIcon size={15} /> : null}
416
+ value={aadhaarLastFour}
417
+ onChange={(e) => {
418
+ const val = e.target.value;
419
+ if (val.length <= 12 && /^\d*$/.test(val)) setAadhaarLastFour(val);
420
+ }}
421
+ placeholder={t("EKYC_ENTER_LAST_4_DIGIT") || "Enter 12 digits"}
422
+ maxLength={12}
423
+ disabled={isAadhaarVerified}
424
+ inputStyle={isAadhaarVerified ? styles.verifiedInput : {}}
425
+ />
399
426
  </div>
400
- <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: "12px" }}>
401
- <div>
402
- <div style={styles.infoLabel}>{t("EKYC_NAME") || "Name"}</div>
403
- <div style={styles.infoValue}>{details.consumerName}</div>
427
+ </LabelFieldPair>
428
+
429
+ {!isAadhaarVerified && !showOtpField && (
430
+ <SubmitBar
431
+ label={isVerifying
432
+ ? t("EKYC_VERIFYING") || "Verifying..."
433
+ : t("EKYC_VERIFY_AADHAAR_BTN") || "Verify Aadhaar"}
434
+ onSubmit={handleVerifyAadhaar}
435
+ disabled={aadhaarLastFour.length !== 12 || isVerifying}
436
+ style={{ marginTop: "12px" }}
437
+ />
438
+ )}
439
+
440
+ {!isAadhaarVerified && showOtpField && (
441
+ <Fragment>
442
+ <div className="ekyc-field-label" style={{ marginTop: "16px" }}>
443
+ {t("EKYC_ENTER_OTP")}
404
444
  </div>
405
- <div>
406
- <div style={styles.infoLabel}>{t("EKYC_AADHAAR") || "Aadhaar"}</div>
407
- <div style={styles.infoValue}>XXXX XXXX {aadhaarLastFour}</div>
445
+ <LabelFieldPair>
446
+ <div className="field">
447
+ <IconInput
448
+ icon={<LockIcon size={15} />}
449
+ value={otp}
450
+ onChange={(e) => {
451
+ const val = e.target.value;
452
+ if (/^\d*$/.test(val)) {
453
+ setOtp(val);
454
+ if (otpError) setOtpError(false);
455
+ }
456
+ }}
457
+ placeholder={t("EKYC_ENTER_OTP_PLACEHOLDER") || "Enter 123456"}
458
+ maxLength={6}
459
+ />
460
+ </div>
461
+ </LabelFieldPair>
462
+ {otpError && (
463
+ <div style={{ color: "#D4351C", fontSize: "12px", marginTop: "4px" }}>
464
+ {t("EKYC_INVALID_OTP") || "Invalid OTP. Please enter 123456."}
465
+ </div>
466
+ )}
467
+ <SubmitBar
468
+ label={t("EKYC_VERIFY_OTP_BTN") || "Verify OTP"}
469
+ onSubmit={handleVerifyOtp}
470
+ disabled={otp.length !== 6}
471
+ style={{ marginTop: "12px" }}
472
+ />
473
+ </Fragment>
474
+ )}
475
+
476
+ {isAadhaarVerified && (
477
+ <div style={styles.verifiedCard}>
478
+ <div style={{ display: "flex", alignItems: "center", gap: "8px", marginBottom: "14px" }}>
479
+ <div style={{
480
+ width: "24px", height: "24px", borderRadius: "50%",
481
+ background: "#9FE1CB", display: "flex", alignItems: "center",
482
+ justifyContent: "center", animation: "pulseGreen 2s ease infinite",
483
+ flexShrink: 0,
484
+ }}>
485
+ <CheckIcon size={13} color="#085041" />
486
+ </div>
487
+ <span style={{ fontWeight: "600", color: "#085041", fontSize: "14px" }}>
488
+ {t("EKYC_AADHAAR_VERIFIED_SUCCESS") || "Aadhaar Verified Successfully"}
489
+ </span>
408
490
  </div>
409
- <div style={{ gridColumn: "span 2" }}>
410
- <div style={styles.infoLabel}>{t("EKYC_ADDRESS") || "Address"}</div>
411
- <div style={{ ...styles.infoValue, fontSize: "13px" }}>{details.address}</div>
491
+ <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: "12px" }}>
492
+ <div>
493
+ <div style={styles.infoLabel}>{t("EKYC_NAME") || "Name"}</div>
494
+ <div style={styles.infoValue}>{initialDetails.consumerName}</div>
495
+ </div>
496
+ <div>
497
+ <div style={styles.infoLabel}>{t("EKYC_AADHAAR") || "Aadhaar"}</div>
498
+ <div style={styles.infoValue}>{aadhaarLastFour}</div>
499
+ </div>
500
+ <div style={{ gridColumn: "span 2" }}>
501
+ <div style={styles.infoLabel}>{t("EKYC_ADDRESS") || "Address"}</div>
502
+ <div style={{ ...styles.infoValue, fontSize: "13px" }}>{initialDetails.address}</div>
503
+ </div>
412
504
  </div>
413
505
  </div>
414
- </div>
415
- )}
416
-
417
- <hr style={{ margin: "24px 0", border: 0, borderTop: "1px solid #EAECF0" }} />
418
-
419
- {/* ── Section 2: Contact Details ── */}
420
- <SectionHead
421
- icon={<UserIcon size={16} />}
422
- label={t("EKYC_CONTACT_DETAILS_HEADER") || "Contact Details"}
423
- />
424
-
425
- {/* Name */}
426
- <RadioToggleRow
427
- label={`${t("EKYC_USER_NAME")} (${t("EKYC_NAME_CORRECT_HINT")})`}
428
- selected={nameCorrect}
429
- onSelect={setNameCorrect}
430
- options={yesNoOptions}
431
- sty
432
- t={t}
433
- />
434
- <LabelFieldPair>
435
- <div className="field">
436
- <IconInput
437
- icon={<UserIcon size={15} color={nameCorrect.code === "YES" ? "#64748b" : "#94a3b8"} />}
438
- style={{ marginBottom: "12px" }}
439
- value={userName}
440
- onChange={(e) => setUserName(e.target.value)}
441
- placeholder={t("EKYC_ENTER_NAME_PLACEHOLDER") || "Enter full name"}
442
- disabled={nameCorrect.code !== "YES"}
443
- />
444
- </div>
445
- </LabelFieldPair>
446
-
447
- {/* Mobile */}
448
- <RadioToggleRow
449
- label={`${t("EKYC_USER_MOBILE_NUMBER")} (${t("EKYC_UPDATE_MOBILE_HINT")})`}
450
- selected={mobileChange}
451
- onSelect={setMobileChange}
452
- options={yesNoOptions}
453
- t={t}
454
- />
455
- <LabelFieldPair>
456
- <div className="field">
457
- <IconInput
458
- icon={<PhoneIcon size={15} color={mobileChange.code === "YES" ? "#64748b" : "#94a3b8"} />}
459
- style={{ marginBottom: "12px" }}
460
- value={mobileNumber}
461
- onChange={(e) => setMobileNumber(e.target.value)}
462
- placeholder="+91 XXXXX XXXXX"
463
- disabled={mobileChange.code !== "YES"}
464
- />
465
- </div>
466
- </LabelFieldPair>
506
+ )}
467
507
 
468
- {/* WhatsApp + Email */}
469
- <div style={styles.twoCol}>
470
- <div>
471
- <div className="ekyc-field-label">
472
- {t("EKYC_WHATSAPP_NUMBER") || "WhatsApp Number"}
508
+ <hr style={{ margin: "24px 0", border: 0, borderTop: "1px solid #EAECF0" }} />
509
+
510
+ {/* ── Section 2: Contact Details ── */}
511
+ <SectionHead
512
+ icon={<UserIcon size={16} />}
513
+ label={t("EKYC_CONTACT_DETAILS_HEADER") || "Contact Details"}
514
+ />
515
+
516
+ {/* Name */}
517
+ <RadioToggleRow
518
+ label={`${t("EKYC_USER_NAME")} (${t("EKYC_NAME_CORRECT_HINT")})`}
519
+ selected={nameCorrect}
520
+ onSelect={setNameCorrect}
521
+ options={yesNoOptions}
522
+ sty
523
+ t={t}
524
+ />
525
+ <LabelFieldPair>
526
+ <div className="field">
527
+ <IconInput
528
+ icon={<UserIcon size={15} color={nameCorrect.code === "YES" ? "#64748b" : "#94a3b8"} />}
529
+ style={{ marginBottom: "12px" }}
530
+ value={userName}
531
+ onChange={(e) => setUserName(e.target.value)}
532
+ placeholder={t("EKYC_ENTER_NAME_PLACEHOLDER") || "Enter full name"}
533
+ disabled={nameCorrect.code !== "YES"}
534
+ />
473
535
  </div>
474
- <IconInput
475
- icon={<WhatsappIcon size={15} />}
476
- value={whatsappNumber}
477
- onChange={(e) => setWhatsappNumber(e.target.value)}
478
- placeholder="+91 XXXXX XXXXX"
479
- />
480
- </div>
481
- <div>
482
- <div className="ekyc-field-label">
483
- {t("EKYC_EMAIL_ADDRESS") || "Email Address"}
484
- <span style={styles.optionalTag}>{t("EKYC_OPTIONAL") || "Optional"}</span>
536
+ </LabelFieldPair>
537
+
538
+ {/* Mobile */}
539
+ <RadioToggleRow
540
+ label={`${t("EKYC_USER_MOBILE_NUMBER")} (${t("EKYC_UPDATE_MOBILE_HINT")})`}
541
+ selected={mobileChange}
542
+ onSelect={setMobileChange}
543
+ options={yesNoOptions}
544
+ t={t}
545
+ />
546
+ <LabelFieldPair>
547
+ <div className="field">
548
+ <IconInput
549
+ icon={<PhoneIcon size={15} color={mobileChange.code === "YES" ? "#64748b" : "#94a3b8"} />}
550
+ style={{ marginBottom: "12px" }}
551
+ value={mobileNumber}
552
+ onChange={(e) => setMobileNumber(e.target.value)}
553
+ placeholder="+91 XXXXX XXXXX"
554
+ disabled={mobileChange.code !== "YES"}
555
+ />
556
+ </div>
557
+ </LabelFieldPair>
558
+
559
+ {/* WhatsApp + Email */}
560
+ <div style={styles.twoCol}>
561
+ <div>
562
+ <div className="ekyc-field-label">
563
+ {t("EKYC_WHATSAPP_NUMBER") || "WhatsApp Number"}
564
+ </div>
565
+ <IconInput
566
+ icon={<WhatsappIcon size={15} />}
567
+ value={whatsappNumber}
568
+ onChange={(e) => setWhatsappNumber(e.target.value)}
569
+ placeholder="+91 XXXXX XXXXX"
570
+ />
571
+ </div>
572
+ <div>
573
+ <div className="ekyc-field-label">
574
+ {t("EKYC_EMAIL_ADDRESS") || "Email Address"}
575
+ <span style={styles.optionalTag}>{t("EKYC_OPTIONAL") || "Optional"}</span>
576
+ </div>
577
+ <IconInput
578
+ icon={<MailIcon size={15} />}
579
+ value={email}
580
+ onChange={(e) => setEmail(e.target.value)}
581
+ placeholder={t("EKYC_EMAIL_ADDRESS_PLACEHOLDER") || "example@email.com"}
582
+ />
485
583
  </div>
486
- <IconInput
487
- icon={<MailIcon size={15} />}
488
- value={email}
489
- onChange={(e) => setEmail(e.target.value)}
490
- placeholder={t("EKYC_EMAIL_ADDRESS_PLACEHOLDER") || "example@email.com"}
491
- />
492
584
  </div>
493
- </div>
494
585
 
495
- <hr style={{ margin: "24px 0", border: 0, borderTop: "1px solid #EAECF0" }} />
586
+ <hr style={{ margin: "24px 0", border: 0, borderTop: "1px solid #EAECF0" }} />
496
587
 
497
- {/* ── Section 3: Family Details ── */}
498
- <SectionHead
499
- icon={<UsersIcon size={16} />}
500
- label={t("EKYC_FAMILY_DETAILS_HEADER") || "Family Details"}
501
- />
588
+ {/* ── Section 3: Family Details ── */}
589
+ <SectionHead
590
+ icon={<UsersIcon size={16} />}
591
+ label={t("EKYC_FAMILY_DETAILS_HEADER") || "Family Details"}
592
+ />
502
593
 
503
- <div className="ekyc-field-label">
504
- {t("EKYC_NO_OF_PERSONS") || "Number of Family Members"}
505
- </div>
506
- <LabelFieldPair>
507
- <div className="field">
508
- <IconInput
509
- icon={<UsersIcon size={15} />}
510
- value={noOfPersons}
511
- onChange={(e) => {
512
- if (/^\d*$/.test(e.target.value)) setNoOfPersons(e.target.value);
513
- }}
514
- placeholder={t("EKYC_ENTER_NO_OF_PERSONS") || "Enter total number of persons"}
515
- />
594
+ <div className="ekyc-field-label">
595
+ {t("EKYC_NO_OF_PERSONS") || "Number of Family Members"}
516
596
  </div>
517
- </LabelFieldPair>
597
+ <LabelFieldPair>
598
+ <div className="field">
599
+ <IconInput
600
+ icon={<UsersIcon size={15} />}
601
+ value={noOfPersons}
602
+ onChange={(e) => {
603
+ if (/^\d*$/.test(e.target.value)) setNoOfPersons(e.target.value);
604
+ }}
605
+ placeholder={t("EKYC_ENTER_NO_OF_PERSONS") || "Enter total number of persons"}
606
+ />
607
+ </div>
608
+ </LabelFieldPair>
609
+
610
+ {/* Save & Continue (Non-sticky, at form end) */}
611
+ {!showAddressSection && (
612
+ <div style={{ marginTop: "24px" }}>
613
+ <SubmitBar
614
+ label={t("ES_COMMON_SAVE_CONTINUE") || "Save & Continue"}
615
+ onSubmit={handleSaveAndContinue}
616
+ />
617
+ </div>
618
+ )}
619
+
620
+ {/* Address section (injected inline) */}
621
+ {showAddressSection && (
622
+ <div ref={addressSectionRef}>
623
+ <AddressDetails
624
+ isSection={true}
625
+ onComplete={handleCompleteAll}
626
+ parentState={{ kNumber, selectedOption, connectionDetails }}
627
+ />
628
+ </div>
629
+ )}
518
630
 
519
- {/* Save & Continue (Non-sticky, at form end) */}
520
- {!showAddressSection && (
521
- <div style={{ marginTop: "24px" }}>
522
- <SubmitBar
523
- label={t("ES_COMMON_SAVE_CONTINUE") || "Save & Continue"}
524
- onSubmit={handleSaveAndContinue}
525
- />
526
- </div>
527
- )}
528
-
529
- {/* Address section (injected inline) */}
530
- {showAddressSection && (
531
- <div ref={addressSectionRef}>
532
- <AddressDetails
533
- isSection={true}
534
- onComplete={handleCompleteAll}
535
- parentState={{ kNumber, selectedOption, connectionDetails }}
536
- />
631
+ {/* Secure notice */}
632
+ <div style={{
633
+ display: "flex", alignItems: "center", justifyContent: "center",
634
+ gap: "5px", marginTop: "20px",
635
+ fontSize: "11px", color: "#98A2B3",
636
+ }}>
637
+ <LockIcon size={11} />
638
+ {t("EKYC_SECURE_DATA_NOTICE") || "Your data is encrypted and secure"}
537
639
  </div>
538
- )}
539
-
540
- {/* Secure notice */}
541
- <div style={{
542
- display: "flex", alignItems: "center", justifyContent: "center",
543
- gap: "5px", marginTop: "20px",
544
- fontSize: "11px", color: "#98A2B3",
545
- }}>
546
- <LockIcon size={11} />
547
- {t("EKYC_SECURE_DATA_NOTICE") || "Your data is encrypted and secure"}
548
- </div>
549
640
 
550
- </Card>
641
+ </Card>
642
+ </div>
551
643
  </div>
552
644
  </div>
553
645
  );