@djb25/digit-ui-module-ekyc 1.0.6 → 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,29 +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
196
  const [showOtpField, setShowOtpField] = useState(false);
169
197
  const [otp, setOtp] = useState("");
170
198
  const [otpError, setOtpError] = useState(false);
171
- const [nameCorrect, setNameCorrect] = useState({ code: "NO", name: "CORE_COMMON_NO" });
172
- const [userName, setUserName] = useState(details.consumerName || "");
173
-
174
- const [mobileChange, setMobileChange] = useState({ code: "NO", name: "CORE_COMMON_NO" });
175
- const [mobileNumber, setMobileNumber] = useState(details.phoneNumber || "");
176
-
177
- const [whatsappNumber, setWhatsappNumber] = useState(details.phoneNumber || "");
178
- const [email, setEmail] = useState(details.email || "");
179
- const [noOfPersons, setNoOfPersons] = useState(
180
- connectionDetails?.addressDetails?.noOfPerson || ""
181
- );
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]);
182
222
  const [showAddressSection, setShowAddressSection] = useState(false);
183
223
  const [addressData, setAddressData] = useState(null);
184
224
 
@@ -235,6 +275,7 @@ const AadhaarVerification = () => {
235
275
  noOfPersons,
236
276
  },
237
277
  addressDetails,
278
+ initialData: initialData, // Pass the initial snapshot
238
279
  });
239
280
  };
240
281
 
@@ -286,8 +327,9 @@ const AadhaarVerification = () => {
286
327
  };
287
328
 
288
329
  return (
289
- <div className="inbox-container">
290
- <style>{`
330
+ <div className="ground-container employee-app-container form-container">
331
+ <div className="inbox-container">
332
+ <style>{`
291
333
  @keyframes fadeSlideIn {
292
334
  from { opacity: 0; transform: translateY(6px); }
293
335
  to { opacity: 1; transform: translateY(0); }
@@ -308,295 +350,296 @@ const AadhaarVerification = () => {
308
350
  .ekyc-field-label { font-size: 11px; font-weight: 600; color: #667085; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
309
351
  `}</style>
310
352
 
311
- {/* ── Sidebar ── */}
312
- <div className="filters-container">
313
- <Card style={{ display: "flex", alignItems: "center", padding: "12px 16px", marginBottom: "12px", borderRadius: "8px" }}>
314
- <div style={{ color: "#185FA5", marginRight: "10px", display: "flex" }}>
315
- <HomeIcon style={{ width: "20px", height: "20px" }} />
316
- </div>
317
- <div style={{ fontWeight: "600", fontSize: "15px", color: "#0B0C0C" }}>
318
- {t("EKYC_PROCESS") || "eKYC Process"}
319
- </div>
320
- </Card>
321
-
322
- <div style={{ background: "#fff", padding: "16px 14px", borderRadius: "8px", border: "1px solid #EAECF0" }}>
323
- {[
324
- { label: t("EKYC_STEP_AADHAAR") || "Aadhaar", done: showAddressSection, active: !showAddressSection },
325
- { label: t("EKYC_STEP_ADDRESS") || "Address", done: addressData !== null, active: showAddressSection && addressData === null },
326
- { label: t("EKYC_STEP_PROPERTY") || "Property", done: false, active: false },
327
- { label: t("EKYC_STEP_REVIEW") || "Review", done: false, active: false },
328
- ].map((step, i) => (
329
- <div className="ekyc-sidebar-step" key={i}>
330
- <div className={`ekyc-step-dot${step.done ? " done" : step.active ? " active" : ""}`}>
331
- {step.done
332
- ? <CheckIcon size={11} color="#fff" />
333
- : i + 1}
334
- </div>
335
- {i < 3 && <div className="ekyc-step-line" />}
336
- <div className={`ekyc-step-label${step.done ? " done" : step.active ? " active" : ""}`}>
337
- {step.label}
338
- </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" }} />
339
358
  </div>
340
- ))}
341
- </div>
342
- </div>
343
-
344
- {/* ── Main content ── */}
345
- <div style={{ flex: 1, marginLeft: "16px" }}>
346
- <Card>
347
-
348
- {/* K-Number badge */}
349
- <div style={{ display: "flex", justifyContent: "flex-end", marginBottom: "20px" }}>
350
- <div style={{
351
- background: "#F9FAFB", border: "0.5px solid #EAECF0",
352
- borderRadius: "20px", padding: "4px 14px",
353
- fontSize: "12px", color: "#667085",
354
- }}>
355
- {t("EKYC_K_NUMBER") || "K Number"}:{" "}
356
- <span style={{ color: "#0B0C0C", fontWeight: "600" }}>{kNumber}</span>
359
+ <div style={{ fontWeight: "600", fontSize: "15px", color: "#0B0C0C" }}>
360
+ {t("EKYC_PROCESS") || "eKYC Process"}
357
361
  </div>
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
+ ))}
358
383
  </div>
384
+ </div>
359
385
 
360
- {/* ── Section 1: Aadhaar ── */}
361
- <SectionHead
362
- icon={<LockIcon size={16} />}
363
- label={t("EKYC_AADHAAR_NUMBER_HEADER") || "Aadhaar Number"}
364
- />
365
-
366
- <div className="ekyc-field-label">
367
- {t("EKYC_LAST_4_DIGIT_AADHAAR") || "Enter 12 digits of Aadhaar"}
368
- </div>
369
- <LabelFieldPair>
370
- <div className="field">
371
- <IconInput
372
- icon={<LockIcon size={15} />}
373
- rightIcon={isAadhaarVerified ? <CheckIcon size={15} /> : null}
374
- value={aadhaarLastFour}
375
- onChange={(e) => {
376
- const val = e.target.value;
377
- if (val.length <= 12 && /^\d*$/.test(val)) setAadhaarLastFour(val);
378
- }}
379
- placeholder={t("EKYC_ENTER_LAST_4_DIGIT") || "Enter 12 digits"}
380
- maxLength={12}
381
- disabled={isAadhaarVerified}
382
- inputStyle={isAadhaarVerified ? styles.verifiedInput : {}}
383
- />
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>
384
400
  </div>
385
- </LabelFieldPair>
386
-
387
- {!isAadhaarVerified && !showOtpField && (
388
- <SubmitBar
389
- label={isVerifying
390
- ? t("EKYC_VERIFYING") || "Verifying..."
391
- : t("EKYC_VERIFY_AADHAAR_BTN") || "Verify Aadhaar"}
392
- onSubmit={handleVerifyAadhaar}
393
- disabled={aadhaarLastFour.length !== 12 || isVerifying}
394
- style={{ marginTop: "12px" }}
401
+
402
+ {/* ── Section 1: Aadhaar ── */}
403
+ <SectionHead
404
+ icon={<LockIcon size={16} />}
405
+ label={t("EKYC_AADHAAR_NUMBER_HEADER") || "Aadhaar Number"}
395
406
  />
396
- )}
397
407
 
398
- {!isAadhaarVerified && showOtpField && (
399
- <Fragment>
400
- <div className="ekyc-field-label" style={{ marginTop: "16px" }}>
401
- {t("EKYC_ENTER_OTP") || "Enter OTP"}
408
+ <div className="ekyc-field-label">
409
+ {t("EKYC_LAST_4_DIGIT_AADHAAR") || "Enter 12 digits of Aadhaar"}
410
+ </div>
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
+ />
402
426
  </div>
403
- <LabelFieldPair>
404
- <div className="field">
405
- <IconInput
406
- icon={<LockIcon size={15} />}
407
- value={otp}
408
- onChange={(e) => {
409
- const val = e.target.value;
410
- if (/^\d*$/.test(val)) {
411
- setOtp(val);
412
- if (otpError) setOtpError(false);
413
- }
414
- }}
415
- placeholder={t("EKYC_ENTER_OTP_PLACEHOLDER") || "Enter 123456"}
416
- maxLength={6}
417
- />
418
- </div>
419
- </LabelFieldPair>
420
- {otpError && (
421
- <div style={{ color: "#D4351C", fontSize: "12px", marginTop: "4px" }}>
422
- {t("EKYC_INVALID_OTP") || "Invalid OTP. Please enter 123456."}
423
- </div>
424
- )}
427
+ </LabelFieldPair>
428
+
429
+ {!isAadhaarVerified && !showOtpField && (
425
430
  <SubmitBar
426
- label={t("EKYC_VERIFY_OTP_BTN") || "Verify OTP"}
427
- onSubmit={handleVerifyOtp}
428
- disabled={otp.length !== 6}
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}
429
436
  style={{ marginTop: "12px" }}
430
437
  />
431
- </Fragment>
432
- )}
433
-
434
- {isAadhaarVerified && (
435
- <div style={styles.verifiedCard}>
436
- <div style={{ display: "flex", alignItems: "center", gap: "8px", marginBottom: "14px" }}>
437
- <div style={{
438
- width: "24px", height: "24px", borderRadius: "50%",
439
- background: "#9FE1CB", display: "flex", alignItems: "center",
440
- justifyContent: "center", animation: "pulseGreen 2s ease infinite",
441
- flexShrink: 0,
442
- }}>
443
- <CheckIcon size={13} color="#085041" />
444
- </div>
445
- <span style={{ fontWeight: "600", color: "#085041", fontSize: "14px" }}>
446
- {t("EKYC_AADHAAR_VERIFIED_SUCCESS") || "Aadhaar Verified Successfully"}
447
- </span>
448
- </div>
449
- <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: "12px" }}>
450
- <div>
451
- <div style={styles.infoLabel}>{t("EKYC_NAME") || "Name"}</div>
452
- <div style={styles.infoValue}>{details.consumerName}</div>
438
+ )}
439
+
440
+ {!isAadhaarVerified && showOtpField && (
441
+ <Fragment>
442
+ <div className="ekyc-field-label" style={{ marginTop: "16px" }}>
443
+ {t("EKYC_ENTER_OTP")}
453
444
  </div>
454
- <div>
455
- <div style={styles.infoLabel}>{t("EKYC_AADHAAR") || "Aadhaar"}</div>
456
- <div style={styles.infoValue}>{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>
457
490
  </div>
458
- <div style={{ gridColumn: "span 2" }}>
459
- <div style={styles.infoLabel}>{t("EKYC_ADDRESS") || "Address"}</div>
460
- <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>
461
504
  </div>
462
505
  </div>
463
- </div>
464
- )}
465
-
466
- <hr style={{ margin: "24px 0", border: 0, borderTop: "1px solid #EAECF0" }} />
467
-
468
- {/* ── Section 2: Contact Details ── */}
469
- <SectionHead
470
- icon={<UserIcon size={16} />}
471
- label={t("EKYC_CONTACT_DETAILS_HEADER") || "Contact Details"}
472
- />
473
-
474
- {/* Name */}
475
- <RadioToggleRow
476
- label={`${t("EKYC_USER_NAME")} (${t("EKYC_NAME_CORRECT_HINT")})`}
477
- selected={nameCorrect}
478
- onSelect={setNameCorrect}
479
- options={yesNoOptions}
480
- sty
481
- t={t}
482
- />
483
- <LabelFieldPair>
484
- <div className="field">
485
- <IconInput
486
- icon={<UserIcon size={15} color={nameCorrect.code === "YES" ? "#64748b" : "#94a3b8"} />}
487
- style={{ marginBottom: "12px" }}
488
- value={userName}
489
- onChange={(e) => setUserName(e.target.value)}
490
- placeholder={t("EKYC_ENTER_NAME_PLACEHOLDER") || "Enter full name"}
491
- disabled={nameCorrect.code !== "YES"}
492
- />
493
- </div>
494
- </LabelFieldPair>
495
-
496
- {/* Mobile */}
497
- <RadioToggleRow
498
- label={`${t("EKYC_USER_MOBILE_NUMBER")} (${t("EKYC_UPDATE_MOBILE_HINT")})`}
499
- selected={mobileChange}
500
- onSelect={setMobileChange}
501
- options={yesNoOptions}
502
- t={t}
503
- />
504
- <LabelFieldPair>
505
- <div className="field">
506
- <IconInput
507
- icon={<PhoneIcon size={15} color={mobileChange.code === "YES" ? "#64748b" : "#94a3b8"} />}
508
- style={{ marginBottom: "12px" }}
509
- value={mobileNumber}
510
- onChange={(e) => setMobileNumber(e.target.value)}
511
- placeholder="+91 XXXXX XXXXX"
512
- disabled={mobileChange.code !== "YES"}
513
- />
514
- </div>
515
- </LabelFieldPair>
506
+ )}
507
+
508
+ <hr style={{ margin: "24px 0", border: 0, borderTop: "1px solid #EAECF0" }} />
516
509
 
517
- {/* WhatsApp + Email */}
518
- <div style={styles.twoCol}>
519
- <div>
520
- <div className="ekyc-field-label">
521
- {t("EKYC_WHATSAPP_NUMBER") || "WhatsApp Number"}
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
+ />
522
535
  </div>
523
- <IconInput
524
- icon={<WhatsappIcon size={15} />}
525
- value={whatsappNumber}
526
- onChange={(e) => setWhatsappNumber(e.target.value)}
527
- placeholder="+91 XXXXX XXXXX"
528
- />
529
- </div>
530
- <div>
531
- <div className="ekyc-field-label">
532
- {t("EKYC_EMAIL_ADDRESS") || "Email Address"}
533
- <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
+ />
534
583
  </div>
535
- <IconInput
536
- icon={<MailIcon size={15} />}
537
- value={email}
538
- onChange={(e) => setEmail(e.target.value)}
539
- placeholder={t("EKYC_EMAIL_ADDRESS_PLACEHOLDER") || "example@email.com"}
540
- />
541
584
  </div>
542
- </div>
543
585
 
544
- <hr style={{ margin: "24px 0", border: 0, borderTop: "1px solid #EAECF0" }} />
586
+ <hr style={{ margin: "24px 0", border: 0, borderTop: "1px solid #EAECF0" }} />
545
587
 
546
- {/* ── Section 3: Family Details ── */}
547
- <SectionHead
548
- icon={<UsersIcon size={16} />}
549
- label={t("EKYC_FAMILY_DETAILS_HEADER") || "Family Details"}
550
- />
588
+ {/* ── Section 3: Family Details ── */}
589
+ <SectionHead
590
+ icon={<UsersIcon size={16} />}
591
+ label={t("EKYC_FAMILY_DETAILS_HEADER") || "Family Details"}
592
+ />
551
593
 
552
- <div className="ekyc-field-label">
553
- {t("EKYC_NO_OF_PERSONS") || "Number of Family Members"}
554
- </div>
555
- <LabelFieldPair>
556
- <div className="field">
557
- <IconInput
558
- icon={<UsersIcon size={15} />}
559
- value={noOfPersons}
560
- onChange={(e) => {
561
- if (/^\d*$/.test(e.target.value)) setNoOfPersons(e.target.value);
562
- }}
563
- placeholder={t("EKYC_ENTER_NO_OF_PERSONS") || "Enter total number of persons"}
564
- />
594
+ <div className="ekyc-field-label">
595
+ {t("EKYC_NO_OF_PERSONS") || "Number of Family Members"}
565
596
  </div>
566
- </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
+ )}
567
630
 
568
- {/* Save & Continue (Non-sticky, at form end) */}
569
- {!showAddressSection && (
570
- <div style={{ marginTop: "24px" }}>
571
- <SubmitBar
572
- label={t("ES_COMMON_SAVE_CONTINUE") || "Save & Continue"}
573
- onSubmit={handleSaveAndContinue}
574
- />
575
- </div>
576
- )}
577
-
578
- {/* Address section (injected inline) */}
579
- {showAddressSection && (
580
- <div ref={addressSectionRef}>
581
- <AddressDetails
582
- isSection={true}
583
- onComplete={handleCompleteAll}
584
- parentState={{ kNumber, selectedOption, connectionDetails }}
585
- />
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"}
586
639
  </div>
587
- )}
588
-
589
- {/* Secure notice */}
590
- <div style={{
591
- display: "flex", alignItems: "center", justifyContent: "center",
592
- gap: "5px", marginTop: "20px",
593
- fontSize: "11px", color: "#98A2B3",
594
- }}>
595
- <LockIcon size={11} />
596
- {t("EKYC_SECURE_DATA_NOTICE") || "Your data is encrypted and secure"}
597
- </div>
598
640
 
599
- </Card>
641
+ </Card>
642
+ </div>
600
643
  </div>
601
644
  </div>
602
645
  );