@djb25/digit-ui-module-ws 1.0.67 → 1.0.69

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
@@ -10917,6 +10917,11 @@ const BILLSBreadCrumbs = _ref => {
10917
10917
  path: "/digit-ui/employee/ws/required-documents",
10918
10918
  label: t("ES_COMMON_WS_DOCUMENTS_REQUIRED"),
10919
10919
  show: location.pathname.includes("/required-documents") ? true : false
10920
+ }, {
10921
+ path: "" + (location === null || location === void 0 ? void 0 : location.pathname) + location.search,
10922
+ label: t("WS_MUTATION_CONNECTION_LABEL"),
10923
+ show: location.pathname.includes("/mutation-application") ? true : false,
10924
+ isBack: true
10920
10925
  }, {
10921
10926
  path: requestParam ? "/digit-ui/employee/ws/bill-amendment?" + requestParam : "/digit-ui/employee/ws/bill-amendment",
10922
10927
  label: t("WS_BILL_AMEND_APP"),
@@ -11251,6 +11256,9 @@ const App$1 = _ref2 => {
11251
11256
  let actions = [];
11252
11257
  const getAction = flow => {
11253
11258
  switch (flow) {
11259
+ case "MUTATION":
11260
+ actions = ['WS_MUTATION_DETAILS', 'WS_MUTATION_NEW_CONSUMER', 'WS_MUTATION_DOCUMENTS', 'WS_MUTATION_PREVIEW'];
11261
+ break;
11254
11262
  default:
11255
11263
  actions = ['WS_COMMON_PROPERTY_DETAILS', 'WS_COMMON_CONNECTION_DETAIL', 'WS_COMMON_DOCUMENT_DETAILS', 'WS_COMMON_SUMMARY'];
11256
11264
  }
@@ -17406,18 +17414,35 @@ const UploadFileDigiLocker = props => {
17406
17414
  const _useState4 = React.useState(null),
17407
17415
  showToast = _useState4[0],
17408
17416
  setShowToast = _useState4[1];
17417
+ const _useState5 = React.useState(null),
17418
+ digiLockerPreviewUrl = _useState5[0],
17419
+ setDigiLockerPreviewUrl = _useState5[1];
17420
+ const _useState6 = React.useState(false),
17421
+ showDigiLockerPreview = _useState6[0],
17422
+ setShowDigiLockerPreview = _useState6[1];
17423
+ const _useState7 = React.useState(null),
17424
+ digiLockerFilename = _useState7[0],
17425
+ setDigiLockerFilename = _useState7[1];
17409
17426
  const user_type = Digit.SessionStorage.get("userType");
17410
17427
  const _Digit$Hooks$createTo = Digit.Hooks.createTokenAPI("document");
17411
17428
  let extraStyles = {};
17412
17429
  const handleChange = () => {
17413
- if (inpRef.current.files[0]) {
17430
+ if (inpRef.current.files && inpRef.current.files[0]) {
17414
17431
  setHasFile(true);
17415
17432
  setprevSate(inpRef.current.files[0]);
17416
- } else setHasFile(false);
17433
+ } else if (!digiLockerFilename) {
17434
+ setHasFile(false);
17435
+ }
17417
17436
  };
17418
17437
  extraStyles = getCitizenStyles("OBPS");
17419
17438
  const handleDelete = () => {
17420
17439
  inpRef.current.value = "";
17440
+ if (digiLockerPreviewUrl) {
17441
+ URL.revokeObjectURL(digiLockerPreviewUrl);
17442
+ setDigiLockerPreviewUrl(null);
17443
+ }
17444
+ setDigiLockerFilename(null);
17445
+ setHasFile(false);
17421
17446
  props.onDelete();
17422
17447
  };
17423
17448
  const handleEmpty = () => {
@@ -17432,14 +17457,20 @@ const UploadFileDigiLocker = props => {
17432
17457
  }
17433
17458
  React.useEffect(() => handleEmpty(), [inpRef === null || inpRef === void 0 ? void 0 : (_inpRef$current = inpRef.current) === null || _inpRef$current === void 0 ? void 0 : _inpRef$current.files]);
17434
17459
  React.useEffect(() => handleChange(), [props.message]);
17460
+ React.useEffect(() => {
17461
+ return () => {
17462
+ if (digiLockerPreviewUrl) URL.revokeObjectURL(digiLockerPreviewUrl);
17463
+ };
17464
+ }, [digiLockerPreviewUrl]);
17435
17465
  const dataURItoBlob = dataURI => {
17436
- var binary = atob(dataURI.split(',')[1]);
17466
+ var b64Data = dataURI.split(",")[1].replace(/\s/g, "");
17467
+ var binary = atob(b64Data);
17437
17468
  var array = [];
17438
17469
  for (var i = 0; i < binary.length; i++) {
17439
17470
  array.push(binary.charCodeAt(i));
17440
17471
  }
17441
17472
  return new Blob([new Uint8Array(array)], {
17442
- type: 'application/pdf'
17473
+ type: "application/pdf"
17443
17474
  });
17444
17475
  };
17445
17476
  const fetchDigiLockerDocuments = function (e) {
@@ -17457,9 +17488,10 @@ const UploadFileDigiLocker = props => {
17457
17488
  let TokenReq = {
17458
17489
  authToken: digiLockerToken
17459
17490
  };
17491
+ const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
17460
17492
  return Promise.resolve(Digit.DigiLockerService.issueDoc({
17461
17493
  TokenReq
17462
- })).then(function (res1) {
17494
+ }, tenantId)).then(function (res1) {
17463
17495
  if (!res1 || !res1.IssuedDoc) {
17464
17496
  setShowToast({
17465
17497
  error: true,
@@ -17480,7 +17512,7 @@ const UploadFileDigiLocker = props => {
17480
17512
  };
17481
17513
  const aliases = DOCTYPE_ALIASES[doctype] || [doctype];
17482
17514
  let uri = res1.IssuedDoc.filter(item => aliases.some(alias => item.doctype === alias));
17483
- const _temp5 = function () {
17515
+ const _temp7 = function () {
17484
17516
  if ((uri === null || uri === void 0 ? void 0 : uri.length) > 0) {
17485
17517
  const uriStr = uri[0].uri || "";
17486
17518
  const parts = uriStr.split("-");
@@ -17492,48 +17524,116 @@ const UploadFileDigiLocker = props => {
17492
17524
  authToken: digiLockerToken,
17493
17525
  id: uriStr
17494
17526
  };
17495
- return Promise.resolve(Digit.DigiLockerService.uri({
17527
+ const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
17528
+ return Promise.resolve(Digit.DigiLockerService.uriFile({
17496
17529
  TokenReq: TokenReqNew
17497
- })).then(function (res2) {
17498
- function _temp4() {
17499
- let filename = doctype + "_" + (uri[0].name || "document") + ".pdf";
17500
- if (blobData) convertToFile(e, blobData, filename);else setShowToast({
17530
+ }, tenantId)).then(function (res2) {
17531
+ var _res2$headers;
17532
+ function _temp6() {
17533
+ const filename = doctype + "_" + (uri[0].name || "document") + ".pdf";
17534
+ if (blobData && blobData.size > 0) convertToFile(e, blobData, filename);else setShowToast({
17501
17535
  error: true,
17502
17536
  label: "Failed to read document from DigiLocker."
17503
17537
  });
17504
17538
  }
17505
- let blobData;
17506
- const _temp3 = function () {
17507
- if (typeof res2 === "string" && res2.includes("base64")) {
17508
- blobData = dataURItoBlob(res2);
17509
- } else {
17510
- const _temp2 = function () {
17511
- if (res2 instanceof Blob) {
17512
- blobData = res2;
17513
- } else {
17514
- const _temp = function () {
17515
- if (res2 && typeof res2 === "object" && res2.fileStoreId) {
17516
- return Promise.resolve(Digit.UploadServices.FileFetchbyid(res2.fileStoreId, Digit.ULBService.getStateId())).then(function (fileRes) {
17517
- if (fileRes !== null && fileRes !== void 0 && fileRes.data) {
17518
- var _fileRes$headers;
17519
- blobData = fileRes.data instanceof Blob ? fileRes.data : new Blob([fileRes.data], {
17520
- type: ((_fileRes$headers = fileRes.headers) === null || _fileRes$headers === void 0 ? void 0 : _fileRes$headers["content-type"]) || "application/pdf"
17521
- });
17539
+ console.log("[DigiLocker] uriFile response:", res2);
17540
+ let blobData = null;
17541
+ let contentType = (res2 === null || res2 === void 0 ? void 0 : (_res2$headers = res2.headers) === null || _res2$headers === void 0 ? void 0 : _res2$headers["content-type"]) || "";
17542
+ let isJsonString = contentType.includes("application/json");
17543
+ const _temp5 = function () {
17544
+ if (res2 !== null && res2 !== void 0 && res2.data) {
17545
+ function _temp4() {
17546
+ if (!blobData) {
17547
+ console.log("[DigiLocker] Treating response as raw binary PDF fallback.");
17548
+ blobData = new Blob([(res2 === null || res2 === void 0 ? void 0 : res2.data) || res2], {
17549
+ type: "application/pdf"
17550
+ });
17551
+ }
17552
+ }
17553
+ const firstBytes = new Uint8Array(res2.data, 0, 3);
17554
+ if (firstBytes[0] === 34 && firstBytes[1] === 37 && firstBytes[2] === 80) {
17555
+ isJsonString = true;
17556
+ }
17557
+ const _temp3 = function () {
17558
+ if (isJsonString) {
17559
+ const decoder = new TextDecoder("utf-8");
17560
+ const jsonString = decoder.decode(res2.data);
17561
+ const jsonObj = JSON.parse(jsonString);
17562
+ const findFileStoreId = obj => {
17563
+ if (!obj || typeof obj !== "object") return null;
17564
+ for (let key in obj) {
17565
+ if (key.toLowerCase() === "filestoreid") return obj[key];
17566
+ const found = findFileStoreId(obj[key]);
17567
+ if (found) return found;
17568
+ }
17569
+ return null;
17570
+ };
17571
+ const findBase64 = obj => {
17572
+ if (!obj || typeof obj !== "object") return null;
17573
+ for (let key in obj) {
17574
+ if (["doccontent", "filecontent", "base64"].includes(key.toLowerCase())) return obj[key];
17575
+ const found = findBase64(obj[key]);
17576
+ if (found && typeof found === "string") return found;
17577
+ }
17578
+ return null;
17579
+ };
17580
+ const _temp2 = function () {
17581
+ if (typeof jsonObj === "string") {
17582
+ if (jsonObj.startsWith("%PDF")) {
17583
+ console.log("[DigiLocker] Response is a literal PDF string. Trying to salvage corrupted bytes...");
17584
+ const len = jsonObj.length;
17585
+ const arr = new Uint8Array(len);
17586
+ for (let i = 0; i < len; i++) {
17587
+ arr[i] = jsonObj.charCodeAt(i) & 0xFF;
17522
17588
  }
17523
- });
17589
+ blobData = new Blob([arr], {
17590
+ type: "application/pdf"
17591
+ });
17592
+ } else {
17593
+ const dataUri = jsonObj.startsWith("data:") ? jsonObj : "data:application/pdf;base64," + jsonObj;
17594
+ try {
17595
+ blobData = dataURItoBlob(dataUri);
17596
+ } catch (e) {
17597
+ console.error("Failed to parse string as base64", e);
17598
+ }
17599
+ }
17524
17600
  } else {
17525
- blobData = new Blob([JSON.stringify(res2)], {
17526
- type: "application/pdf"
17527
- });
17601
+ const fsId = findFileStoreId(jsonObj);
17602
+ const _temp = function () {
17603
+ if (fsId) {
17604
+ console.log("[DigiLocker] Got fileStoreId from JSON:", fsId);
17605
+ return Promise.resolve(Digit.UploadServices.FileFetchbyid(fsId, Digit.ULBService.getStateId())).then(function (fileRes) {
17606
+ var _fileRes$headers;
17607
+ blobData = (fileRes === null || fileRes === void 0 ? void 0 : fileRes.data) instanceof Blob ? fileRes.data : new Blob([(fileRes === null || fileRes === void 0 ? void 0 : fileRes.data) || ""], {
17608
+ type: (fileRes === null || fileRes === void 0 ? void 0 : (_fileRes$headers = fileRes.headers) === null || _fileRes$headers === void 0 ? void 0 : _fileRes$headers["content-type"]) || "application/pdf"
17609
+ });
17610
+ });
17611
+ } else {
17612
+ const b64 = findBase64(jsonObj);
17613
+ if (b64 && typeof b64 === "string") {
17614
+ console.log("[DigiLocker] Got base64 content from JSON field");
17615
+ const dataUri = b64.startsWith("data:") ? b64 : "data:application/pdf;base64," + b64;
17616
+ blobData = dataURItoBlob(dataUri);
17617
+ } else {
17618
+ console.log("[DigiLocker] JSON did not contain filestoreid or base64.");
17619
+ }
17620
+ }
17621
+ }();
17622
+ if (_temp && _temp.then) return _temp.then(function () {});
17528
17623
  }
17529
17624
  }();
17530
- if (_temp && _temp.then) return _temp.then(function () {});
17625
+ if (_temp2 && _temp2.then) return _temp2.then(function () {});
17626
+ } else {
17627
+ console.log("[DigiLocker] Treating response as raw binary PDF.", contentType);
17628
+ blobData = new Blob([res2.data], {
17629
+ type: "application/pdf"
17630
+ });
17531
17631
  }
17532
17632
  }();
17533
- if (_temp2 && _temp2.then) return _temp2.then(function () {});
17633
+ return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
17534
17634
  }
17535
17635
  }();
17536
- return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
17636
+ return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
17537
17637
  });
17538
17638
  } else {
17539
17639
  setShowToast({
@@ -17542,7 +17642,7 @@ const UploadFileDigiLocker = props => {
17542
17642
  });
17543
17643
  }
17544
17644
  }();
17545
- if (_temp5 && _temp5.then) return _temp5.then(function () {});
17645
+ if (_temp7 && _temp7.then) return _temp7.then(function () {});
17546
17646
  });
17547
17647
  }, function (error) {
17548
17648
  console.error("DigiLocker Fetch Error:", error);
@@ -17559,6 +17659,8 @@ const UploadFileDigiLocker = props => {
17559
17659
  if (filename === void 0) {
17560
17660
  filename = "document.pdf";
17561
17661
  }
17662
+ const previewUrl = URL.createObjectURL(blob);
17663
+ setDigiLockerPreviewUrl(previewUrl);
17562
17664
  var reader = new FileReader();
17563
17665
  reader.readAsDataURL(blob);
17564
17666
  reader.onloadend = function () {
@@ -17567,6 +17669,8 @@ const UploadFileDigiLocker = props => {
17567
17669
  let newFile = new File([blobData], filename, {
17568
17670
  type: "application/pdf"
17569
17671
  });
17672
+ setDigiLockerFilename(filename);
17673
+ setHasFile(true);
17570
17674
  props.onUpload(e, newFile);
17571
17675
  };
17572
17676
  };
@@ -17631,7 +17735,30 @@ const UploadFileDigiLocker = props => {
17631
17735
  style: {
17632
17736
  width: "20px"
17633
17737
  }
17634
- }), t("CS_COMMON_FETCH_FROM_DIGILOCKER")))), props === null || props === void 0 ? void 0 : (_props$uploadedFiles = props.uploadedFiles) === null || _props$uploadedFiles === void 0 ? void 0 : _props$uploadedFiles.map((file, index) => {
17738
+ }), t("CS_COMMON_FETCH_FROM_DIGILOCKER"))), digiLockerPreviewUrl && /*#__PURE__*/React__default.createElement("button", {
17739
+ type: "button",
17740
+ title: t("WS_VIEW_DOCUMENT") || "Preview document",
17741
+ onClick: () => setShowDigiLockerPreview(true),
17742
+ style: {
17743
+ background: "none",
17744
+ border: "none",
17745
+ cursor: "pointer",
17746
+ display: "flex",
17747
+ alignItems: "center",
17748
+ padding: "4px"
17749
+ }
17750
+ }, /*#__PURE__*/React__default.createElement("svg", {
17751
+ xmlns: "http://www.w3.org/2000/svg",
17752
+ height: "22",
17753
+ viewBox: "0 0 24 24",
17754
+ width: "22",
17755
+ fill: "#00497e"
17756
+ }, /*#__PURE__*/React__default.createElement("path", {
17757
+ d: "M0 0h24v24H0z",
17758
+ fill: "none"
17759
+ }), /*#__PURE__*/React__default.createElement("path", {
17760
+ d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"
17761
+ })))), props === null || props === void 0 ? void 0 : (_props$uploadedFiles = props.uploadedFiles) === null || _props$uploadedFiles === void 0 ? void 0 : _props$uploadedFiles.map((file, index) => {
17635
17762
  var _extraStyles3;
17636
17763
  const fileDetailsData = file[1];
17637
17764
  return /*#__PURE__*/React__default.createElement("div", {
@@ -17643,7 +17770,7 @@ const UploadFileDigiLocker = props => {
17643
17770
  text: file[0],
17644
17771
  onClick: e => props === null || props === void 0 ? void 0 : props.removeTargetedFile(fileDetailsData, e)
17645
17772
  }));
17646
- }), !hasFile || props.error ? /*#__PURE__*/React__default.createElement("h2", {
17773
+ }), !hasFile && !props.file || props.error ? /*#__PURE__*/React__default.createElement("h2", {
17647
17774
  className: "file-upload-status"
17648
17775
  }, props.message) : /*#__PURE__*/React__default.createElement("div", {
17649
17776
  className: "tag-container",
@@ -17654,7 +17781,7 @@ const UploadFileDigiLocker = props => {
17654
17781
  }, /*#__PURE__*/React__default.createElement("span", {
17655
17782
  className: "text",
17656
17783
  style: extraStyles ? (_extraStyles6 = extraStyles) === null || _extraStyles6 === void 0 ? void 0 : _extraStyles6.textStyles : null
17657
- }, typeof ((_inpRef$current$files = inpRef.current.files[0]) === null || _inpRef$current$files === void 0 ? void 0 : _inpRef$current$files.name) !== "undefined" && !(props !== null && props !== void 0 && props.file) ? (_inpRef$current$files2 = inpRef.current.files[0]) === null || _inpRef$current$files2 === void 0 ? void 0 : _inpRef$current$files2.name : (_props$file = props.file) === null || _props$file === void 0 ? void 0 : _props$file.name), /*#__PURE__*/React__default.createElement("span", {
17784
+ }, digiLockerFilename ? digiLockerFilename : typeof ((_inpRef$current$files = inpRef.current.files[0]) === null || _inpRef$current$files === void 0 ? void 0 : _inpRef$current$files.name) !== "undefined" && !(props !== null && props !== void 0 && props.file) ? (_inpRef$current$files2 = inpRef.current.files[0]) === null || _inpRef$current$files2 === void 0 ? void 0 : _inpRef$current$files2.name : (_props$file = props.file) === null || _props$file === void 0 ? void 0 : _props$file.name), /*#__PURE__*/React__default.createElement("span", {
17658
17785
  onClick: () => handleDelete(),
17659
17786
  style: extraStyles ? (_extraStyles7 = extraStyles) === null || _extraStyles7 === void 0 ? void 0 : _extraStyles7.closeIconStyles : null
17660
17787
  }, /*#__PURE__*/React__default.createElement(Close, {
@@ -17690,7 +17817,72 @@ const UploadFileDigiLocker = props => {
17690
17817
  warning: showToast.warning,
17691
17818
  label: t(showToast.label),
17692
17819
  onClose: () => setShowToast(null)
17693
- }));
17820
+ }), showDigiLockerPreview && digiLockerPreviewUrl && /*#__PURE__*/React__default.createElement("div", {
17821
+ style: {
17822
+ position: "fixed",
17823
+ top: 0,
17824
+ left: 0,
17825
+ width: "100%",
17826
+ height: "100%",
17827
+ backgroundColor: "rgba(0,0,0,0.7)",
17828
+ zIndex: 9999,
17829
+ display: "flex",
17830
+ flexDirection: "column",
17831
+ alignItems: "center",
17832
+ justifyContent: "center"
17833
+ },
17834
+ onClick: () => setShowDigiLockerPreview(false)
17835
+ }, /*#__PURE__*/React__default.createElement("div", {
17836
+ style: {
17837
+ background: "#fff",
17838
+ borderRadius: "8px",
17839
+ width: "85%",
17840
+ maxWidth: "860px",
17841
+ overflow: "hidden",
17842
+ boxShadow: "0 8px 32px rgba(0,0,0,0.4)"
17843
+ },
17844
+ onClick: ev => ev.stopPropagation()
17845
+ }, /*#__PURE__*/React__default.createElement("div", {
17846
+ style: {
17847
+ display: "flex",
17848
+ justifyContent: "space-between",
17849
+ alignItems: "center",
17850
+ padding: "12px 16px",
17851
+ background: "#00497e"
17852
+ }
17853
+ }, /*#__PURE__*/React__default.createElement("span", {
17854
+ style: {
17855
+ color: "#fff",
17856
+ fontWeight: "bold",
17857
+ fontSize: "14px"
17858
+ }
17859
+ }, t("WS_VIEW_DOCUMENT") || "View Document"), /*#__PURE__*/React__default.createElement("button", {
17860
+ type: "button",
17861
+ onClick: () => setShowDigiLockerPreview(false),
17862
+ style: {
17863
+ background: "none",
17864
+ border: "none",
17865
+ cursor: "pointer",
17866
+ padding: "4px"
17867
+ }
17868
+ }, /*#__PURE__*/React__default.createElement("svg", {
17869
+ xmlns: "http://www.w3.org/2000/svg",
17870
+ viewBox: "0 0 24 24",
17871
+ fill: "#fff",
17872
+ width: "22",
17873
+ height: "22"
17874
+ }, /*#__PURE__*/React__default.createElement("path", {
17875
+ d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
17876
+ })))), /*#__PURE__*/React__default.createElement("embed", {
17877
+ src: digiLockerPreviewUrl,
17878
+ type: "application/pdf",
17879
+ width: "100%",
17880
+ height: "520px",
17881
+ style: {
17882
+ border: "none",
17883
+ display: "block"
17884
+ }
17885
+ }))));
17694
17886
  };
17695
17887
 
17696
17888
  const DIGILOCKER_SUPPORTED_CODES = ["AADHAAR", "AADHAR", "DRIVING", "DRVLC", "PAN"];
@@ -48027,8 +48219,7 @@ const ApplicationDetails$1 = () => {
48027
48219
  })), /*#__PURE__*/React__default.createElement("div", {
48028
48220
  style: {
48029
48221
  flex: "2 1 500px",
48030
- minWidth: "300px",
48031
- overflowY: "auto"
48222
+ minWidth: "300px"
48032
48223
  }
48033
48224
  }, /*#__PURE__*/React__default.createElement(ApplicationDetails, {
48034
48225
  applicationDetails: applicationDetails,
@@ -48061,11 +48252,11 @@ const ApplicationDetails$1 = () => {
48061
48252
  };
48062
48253
 
48063
48254
  const GetConnectionDetails = () => {
48064
- var _applicationDetails$a, _applicationDetails$a2, _applicationDetails$a3, _applicationDetails$a4, _applicationDetails$a5, _applicationDetails$a6, _applicationDetails$a7, _applicationDetails$a8, _applicationDetails$a9, _applicationDetails$a0, _applicationDetails$a1, _applicationDetails$a10, _applicationDetails$a11, _applicationDetails$a12, _mdmsCommonmastersDat, _applicationDetails$a14, _applicationDetails$a18, _applicationDetails$f5, _applicationDetails$p3, _applicationDetails$p4, _applicationDetails$a19, _applicationDetails$a20, _applicationDetails$a21, _applicationDetails$f6, _applicationDetails$f7;
48255
+ var _applicationDetails$a, _applicationDetails$a2, _applicationDetails$a3, _applicationDetails$a4, _applicationDetails$a5, _applicationDetails$a6, _applicationDetails$a7, _applicationDetails$a8, _applicationDetails$a9, _applicationDetails$a0, _applicationDetails$a1, _applicationDetails$a10, _applicationDetails$a11, _applicationDetails$a12, _mdmsCommonmastersDat, _applicationDetails$a14, _applicationDetails$a18, _applicationDetails$f7, _applicationDetails$p3, _applicationDetails$p4, _applicationDetails$a19, _applicationDetails$a20, _applicationDetails$a21, _applicationDetails$f8, _applicationDetails$f9;
48065
48256
  const getBillSearch = function () {
48066
48257
  try {
48067
- const _temp = function (_applicationDetails$f8) {
48068
- if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f8 = applicationDetails.fetchBillsData) === null || _applicationDetails$f8 === void 0 ? void 0 : _applicationDetails$f8.length) > 0) {
48258
+ const _temp = function (_applicationDetails$f0) {
48259
+ if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f0 = applicationDetails.fetchBillsData) === null || _applicationDetails$f0 === void 0 ? void 0 : _applicationDetails$f0.length) > 0) {
48069
48260
  var _applicationDetails$a22;
48070
48261
  const service = serviceType === "WATER" ? "WS" : "SW";
48071
48262
  let wsSearchFilters = {
@@ -48195,7 +48386,7 @@ const GetConnectionDetails = () => {
48195
48386
  const checkApplicationStatus = (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a14 = applicationDetails.applicationData) === null || _applicationDetails$a14 === void 0 ? void 0 : _applicationDetails$a14.status) === "Active" ? true : false;
48196
48387
  const checkWorkflow = applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.isApplicationApproved;
48197
48388
  const getModifyConnectionButton = () => {
48198
- var _applicationDetails$f, _applicationDetails$a15, _applicationDetails$p;
48389
+ var _applicationDetails$f, _applicationDetails$f2, _applicationDetails$a15, _applicationDetails$p;
48199
48390
  if (!checkApplicationStatus) {
48200
48391
  setshowActionToast({
48201
48392
  key: "error",
@@ -48203,7 +48394,7 @@ const GetConnectionDetails = () => {
48203
48394
  });
48204
48395
  return;
48205
48396
  }
48206
- if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f = applicationDetails.fetchBillsData[0]) === null || _applicationDetails$f === void 0 ? void 0 : _applicationDetails$f.totalAmount) > 0) {
48397
+ if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f = applicationDetails.fetchBillsData) === null || _applicationDetails$f === void 0 ? void 0 : (_applicationDetails$f2 = _applicationDetails$f[0]) === null || _applicationDetails$f2 === void 0 ? void 0 : _applicationDetails$f2.totalAmount) > 0) {
48207
48398
  setshowActionToast({
48208
48399
  key: "error",
48209
48400
  label: "WS_DUE_AMOUNT_SHOULD_BE_ZERO"
@@ -48216,7 +48407,7 @@ const GetConnectionDetails = () => {
48216
48407
  }));
48217
48408
  };
48218
48409
  const getMutationButton = () => {
48219
- var _applicationDetails$f2, _applicationDetails$a16, _applicationDetails$p2;
48410
+ var _applicationDetails$f3, _applicationDetails$f4, _applicationDetails$a16, _applicationDetails$p2;
48220
48411
  if (!checkApplicationStatus) {
48221
48412
  setshowActionToast({
48222
48413
  key: "error",
@@ -48224,7 +48415,7 @@ const GetConnectionDetails = () => {
48224
48415
  });
48225
48416
  return;
48226
48417
  }
48227
- if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f2 = applicationDetails.fetchBillsData[0]) === null || _applicationDetails$f2 === void 0 ? void 0 : _applicationDetails$f2.totalAmount) > 0) {
48418
+ if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f3 = applicationDetails.fetchBillsData) === null || _applicationDetails$f3 === void 0 ? void 0 : (_applicationDetails$f4 = _applicationDetails$f3[0]) === null || _applicationDetails$f4 === void 0 ? void 0 : _applicationDetails$f4.totalAmount) > 0) {
48228
48419
  setshowActionToast({
48229
48420
  key: "error",
48230
48421
  label: "WS_DUE_AMOUNT_SHOULD_BE_ZERO"
@@ -48278,9 +48469,9 @@ const GetConnectionDetails = () => {
48278
48469
  label: "WORKFLOW_IN_PROGRESS"
48279
48470
  });
48280
48471
  } else {
48281
- var _billData$, _applicationDetails$f3;
48472
+ var _billData$, _applicationDetails$f5;
48282
48473
  console.log("due", due, applicationDetails);
48283
- if (((_billData$ = billData[0]) === null || _billData$ === void 0 ? void 0 : _billData$.status) === "ACTIVE" || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f3 = applicationDetails.fetchBillsData) === null || _applicationDetails$f3 === void 0 ? void 0 : _applicationDetails$f3.length) <= 0 || due == "0" || due < 0) {
48474
+ if (((_billData$ = billData[0]) === null || _billData$ === void 0 ? void 0 : _billData$.status) === "ACTIVE" || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f5 = applicationDetails.fetchBillsData) === null || _applicationDetails$f5 === void 0 ? void 0 : _applicationDetails$f5.length) <= 0 || due == "0" || due < 0) {
48284
48475
  Digit.SessionStorage.set("WS_DISCONNECTION", applicationDetails);
48285
48476
  history.push("" + pathname);
48286
48477
  } else {
@@ -48296,8 +48487,8 @@ const GetConnectionDetails = () => {
48296
48487
  label: "WORKFLOW_IN_PROGRESS"
48297
48488
  });
48298
48489
  } else {
48299
- var _billData$2, _applicationDetails$f4;
48300
- if (((_billData$2 = billData[0]) === null || _billData$2 === void 0 ? void 0 : _billData$2.status) === "ACTIVE" || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f4 = applicationDetails.fetchBillsData) === null || _applicationDetails$f4 === void 0 ? void 0 : _applicationDetails$f4.length) <= 0 || due === "0") {
48490
+ var _billData$2, _applicationDetails$f6;
48491
+ if (((_billData$2 = billData[0]) === null || _billData$2 === void 0 ? void 0 : _billData$2.status) === "ACTIVE" || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f6 = applicationDetails.fetchBillsData) === null || _applicationDetails$f6 === void 0 ? void 0 : _applicationDetails$f6.length) <= 0 || due === "0") {
48301
48492
  Digit.SessionStorage.set("WS_DISCONNECTION", applicationDetails);
48302
48493
  history.push("" + pathname);
48303
48494
  } else {
@@ -48332,7 +48523,7 @@ const GetConnectionDetails = () => {
48332
48523
  label: t("WS_CONNECTION_DETAILS"),
48333
48524
  onClick: () => downloadConnectionDetails()
48334
48525
  };
48335
- if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f5 = applicationDetails.fetchBillsData) === null || _applicationDetails$f5 === void 0 ? void 0 : _applicationDetails$f5.length) > 0) dowloadOptions = [appFeeDownloadReceipt, connectionDetailsReceipt];else dowloadOptions = [connectionDetailsReceipt];
48526
+ if ((applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f7 = applicationDetails.fetchBillsData) === null || _applicationDetails$f7 === void 0 ? void 0 : _applicationDetails$f7.length) > 0) dowloadOptions = [appFeeDownloadReceipt, connectionDetailsReceipt];else dowloadOptions = [connectionDetailsReceipt];
48336
48527
  const Close = () => /*#__PURE__*/React__default.createElement("svg", {
48337
48528
  xmlns: "http://www.w3.org/2000/svg",
48338
48529
  viewBox: "0 0 24 24",
@@ -48455,7 +48646,7 @@ const GetConnectionDetails = () => {
48455
48646
  className: "modal-header-ws"
48456
48647
  }, t("WS_CLEAR_DUES_DISCONNECTION_SUB_HEADER_LABEL"), " "), /*#__PURE__*/React__default.createElement("div", {
48457
48648
  className: "modal-body-ws"
48458
- }, /*#__PURE__*/React__default.createElement("span", null, t("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"), ": \u20B9", due ? due : applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f6 = applicationDetails.fetchBillsData) === null || _applicationDetails$f6 === void 0 ? void 0 : (_applicationDetails$f7 = _applicationDetails$f6[0]) === null || _applicationDetails$f7 === void 0 ? void 0 : _applicationDetails$f7.totalAmount))) : null, showActionToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
48649
+ }, /*#__PURE__*/React__default.createElement("span", null, t("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"), ": \u20B9", due ? due : applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$f8 = applicationDetails.fetchBillsData) === null || _applicationDetails$f8 === void 0 ? void 0 : (_applicationDetails$f9 = _applicationDetails$f8[0]) === null || _applicationDetails$f9 === void 0 ? void 0 : _applicationDetails$f9.totalAmount))) : null, showActionToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
48459
48650
  error: showActionToast.key,
48460
48651
  label: t("" + showActionToast.label),
48461
48652
  onClose: closeBillToast
@@ -50241,49 +50432,230 @@ const EditModifyApplication = () => {
50241
50432
  }));
50242
50433
  };
50243
50434
 
50244
- const WSMutationApplicantDetails = _ref => {
50245
- var _formData$config$key, _errors$proposedNewCo, _errors$newOwnerMobil, _errors$newOwnerEmail, _errors$relationshipW, _errors$reasonForName;
50435
+ const Step1_ExistingConnection = _ref => {
50436
+ var _appData$connectionHo, _propertyData$Propert, _propertyData$Propert2, _appData$property, _propertyAddress$loca;
50437
+ let applicationDetails = _ref.applicationDetails,
50438
+ propertyId = _ref.propertyId;
50439
+ const getMaskedName = name => {
50440
+ if (!name) return "NA";
50441
+ return name.split("").map((char, index) => index % 2 === 1 && char !== " " ? "*" : char).join("");
50442
+ };
50443
+ const getMaskedPhone = phone => {
50444
+ if (!phone || phone.length < 10) return "NA";
50445
+ return "******" + phone.slice(-4);
50446
+ };
50447
+ const appData = (applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.applicationData) || {};
50448
+ const connectionNo = (appData === null || appData === void 0 ? void 0 : appData.connectionNo) || "NA";
50449
+ const meterId = (appData === null || appData === void 0 ? void 0 : appData.meterId) || "NA";
50450
+ const connectionStatus = (appData === null || appData === void 0 ? void 0 : appData.status) || "NA";
50451
+ const holderDetails = (appData === null || appData === void 0 ? void 0 : (_appData$connectionHo = appData.connectionHolders) === null || _appData$connectionHo === void 0 ? void 0 : _appData$connectionHo[0]) || {};
50452
+ const registeredName = getMaskedName(holderDetails === null || holderDetails === void 0 ? void 0 : holderDetails.name);
50453
+ const registeredPhone = getMaskedPhone(holderDetails === null || holderDetails === void 0 ? void 0 : holderDetails.mobileNumber);
50454
+ const tenantId = Digit.ULBService.getCurrentTenantId();
50455
+ const _Digit$Hooks$pt$usePr = Digit.Hooks.pt.usePropertySearch({
50456
+ filters: {
50457
+ propertyIds: propertyId
50458
+ },
50459
+ tenantId
50460
+ }, {
50461
+ enabled: !!propertyId
50462
+ }),
50463
+ propertyData = _Digit$Hooks$pt$usePr.data;
50464
+ const propertyAddress = (propertyData === null || propertyData === void 0 ? void 0 : (_propertyData$Propert = propertyData.Properties) === null || _propertyData$Propert === void 0 ? void 0 : (_propertyData$Propert2 = _propertyData$Propert[0]) === null || _propertyData$Propert2 === void 0 ? void 0 : _propertyData$Propert2.address) || (appData === null || appData === void 0 ? void 0 : (_appData$property = appData.property) === null || _appData$property === void 0 ? void 0 : _appData$property.address) || {};
50465
+ const formattedAddress = [(propertyAddress === null || propertyAddress === void 0 ? void 0 : propertyAddress.houseNo) || (propertyAddress === null || propertyAddress === void 0 ? void 0 : propertyAddress.doorNo), propertyAddress === null || propertyAddress === void 0 ? void 0 : propertyAddress.buildingName, propertyAddress === null || propertyAddress === void 0 ? void 0 : propertyAddress.street, propertyAddress === null || propertyAddress === void 0 ? void 0 : (_propertyAddress$loca = propertyAddress.locality) === null || _propertyAddress$loca === void 0 ? void 0 : _propertyAddress$loca.name, propertyAddress === null || propertyAddress === void 0 ? void 0 : propertyAddress.city, propertyAddress === null || propertyAddress === void 0 ? void 0 : propertyAddress.pincode].filter(Boolean).join(", ") || "NA";
50466
+ const missingFields = [];
50467
+ if (connectionNo === "NA") missingFields.push("Connection Number");
50468
+ if (registeredName === "NA") missingFields.push("Owner Name");
50469
+ if (formattedAddress === "NA") missingFields.push("Property Address");
50470
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
50471
+ style: {
50472
+ marginBottom: "20px"
50473
+ }
50474
+ }, /*#__PURE__*/React__default.createElement("div", {
50475
+ style: {
50476
+ padding: "16px",
50477
+ backgroundColor: "#fff3cd",
50478
+ color: "#856404",
50479
+ borderRadius: "8px",
50480
+ border: "1px solid #ffeeba",
50481
+ marginBottom: "20px",
50482
+ display: "flex",
50483
+ alignItems: "center"
50484
+ }
50485
+ }, /*#__PURE__*/React__default.createElement("span", {
50486
+ style: {
50487
+ marginRight: "8px",
50488
+ fontSize: "20px"
50489
+ }
50490
+ }, "\u2139\uFE0F"), /*#__PURE__*/React__default.createElement("span", {
50491
+ style: {
50492
+ fontWeight: "500"
50493
+ }
50494
+ }, "Name Change / Mutation is limited to changing the name of the consumer/account holder on the existing water connection. It does not constitute or imply transfer of property ownership.")), missingFields.length > 0 && /*#__PURE__*/React__default.createElement("div", {
50495
+ style: {
50496
+ padding: "12px 16px",
50497
+ backgroundColor: "#fdecea",
50498
+ color: "#611a15",
50499
+ borderRadius: "8px",
50500
+ border: "1px solid #f5c6cb",
50501
+ marginBottom: "16px",
50502
+ display: "flex",
50503
+ alignItems: "center"
50504
+ }
50505
+ }, /*#__PURE__*/React__default.createElement("span", {
50506
+ style: {
50507
+ marginRight: "8px",
50508
+ fontSize: "18px"
50509
+ }
50510
+ }, "\u26A0\uFE0F"), /*#__PURE__*/React__default.createElement("span", {
50511
+ style: {
50512
+ fontWeight: "500",
50513
+ fontSize: "14px"
50514
+ }
50515
+ }, "Please verify the connection data before proceeding.")), /*#__PURE__*/React__default.createElement("div", {
50516
+ style: {
50517
+ display: "flex",
50518
+ alignItems: "center",
50519
+ marginBottom: "16px"
50520
+ }
50521
+ }, /*#__PURE__*/React__default.createElement("span", {
50522
+ style: {
50523
+ fontSize: "24px",
50524
+ marginRight: "8px"
50525
+ }
50526
+ }, "\uD83C\uDFE2"), /*#__PURE__*/React__default.createElement("h2", {
50527
+ style: {
50528
+ fontSize: "20px",
50529
+ fontWeight: "700",
50530
+ margin: 0
50531
+ }
50532
+ }, "1. Existing Connection & Current Consumer Details.")), /*#__PURE__*/React__default.createElement("div", {
50533
+ style: {
50534
+ padding: "16px",
50535
+ backgroundColor: "#f9f9f9",
50536
+ borderRadius: "8px",
50537
+ borderLeft: "4px solid #00497e"
50538
+ }
50539
+ }, /*#__PURE__*/React__default.createElement("div", {
50540
+ style: {
50541
+ display: "grid",
50542
+ gridTemplateColumns: "1fr 1fr 1fr",
50543
+ gap: "16px"
50544
+ }
50545
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
50546
+ style: {
50547
+ color: "#555",
50548
+ fontSize: "14px",
50549
+ marginBottom: "4px"
50550
+ }
50551
+ }, "Connection Number"), /*#__PURE__*/React__default.createElement("div", {
50552
+ style: {
50553
+ fontWeight: "bold"
50554
+ }
50555
+ }, connectionNo)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
50556
+ style: {
50557
+ color: "#555",
50558
+ fontSize: "14px",
50559
+ marginBottom: "4px"
50560
+ }
50561
+ }, "Current Owner Name"), /*#__PURE__*/React__default.createElement("div", {
50562
+ style: {
50563
+ fontWeight: "bold"
50564
+ }
50565
+ }, registeredName)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
50566
+ style: {
50567
+ color: "#555",
50568
+ fontSize: "14px",
50569
+ marginBottom: "4px"
50570
+ }
50571
+ }, "Property Address"), /*#__PURE__*/React__default.createElement("div", {
50572
+ style: {
50573
+ fontWeight: "bold"
50574
+ }
50575
+ }, formattedAddress)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
50576
+ style: {
50577
+ color: "#555",
50578
+ fontSize: "14px",
50579
+ marginBottom: "4px"
50580
+ }
50581
+ }, "Connection Status"), /*#__PURE__*/React__default.createElement("div", {
50582
+ style: {
50583
+ fontWeight: "bold",
50584
+ color: (connectionStatus === null || connectionStatus === void 0 ? void 0 : connectionStatus.toLowerCase()) === "active" ? "#28a745" : "#dc3545"
50585
+ }
50586
+ }, connectionStatus)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
50587
+ style: {
50588
+ color: "#555",
50589
+ fontSize: "14px",
50590
+ marginBottom: "4px"
50591
+ }
50592
+ }, "Meter Number"), /*#__PURE__*/React__default.createElement("div", {
50593
+ style: {
50594
+ fontWeight: "bold"
50595
+ }
50596
+ }, meterId)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
50597
+ style: {
50598
+ color: "#555",
50599
+ fontSize: "14px",
50600
+ marginBottom: "4px"
50601
+ }
50602
+ }, "Mobile Number"), /*#__PURE__*/React__default.createElement("div", {
50603
+ style: {
50604
+ fontWeight: "bold"
50605
+ }
50606
+ }, registeredPhone)))));
50607
+ };
50608
+
50609
+ const Step2_NewConsumerDetails = _ref => {
50610
+ var _errors$proposedNewCo, _errors$gender, _errors$newOwnerMobil, _errors$newOwnerEmail, _errors$reasonForName, _errors$relationshipW;
50246
50611
  let t = _ref.t,
50247
- config = _ref.config,
50248
- onSelect = _ref.onSelect,
50249
- formData = _ref.formData,
50250
- clearErrors = _ref.clearErrors;
50612
+ onNext = _ref.onNext,
50613
+ onBack = _ref.onBack,
50614
+ defaultValues = _ref.defaultValues;
50251
50615
  const _useForm = reactHookForm.useForm({
50252
- defaultValues: (formData === null || formData === void 0 ? void 0 : formData[config.key]) || {}
50616
+ defaultValues: defaultValues || {},
50617
+ mode: "onBlur"
50253
50618
  }),
50254
50619
  control = _useForm.control,
50255
- watch = _useForm.watch,
50256
- localFormState = _useForm.formState;
50257
- const formValue = watch();
50258
- const errors = localFormState.errors;
50620
+ handleSubmit = _useForm.handleSubmit,
50621
+ errors = _useForm.formState.errors,
50622
+ trigger = _useForm.trigger,
50623
+ setError = _useForm.setError,
50624
+ clearErrors = _useForm.clearErrors;
50625
+ const _useState = React.useState(null),
50626
+ showToast = _useState[0],
50627
+ setShowToast = _useState[1];
50628
+ const _useState2 = React.useState({}),
50629
+ touched = _useState2[0],
50630
+ setTouched = _useState2[1];
50631
+ const selectedReason = reactHookForm.useWatch({
50632
+ control,
50633
+ name: "reasonForNameChange"
50634
+ });
50635
+ const isOtherReason = (selectedReason === null || selectedReason === void 0 ? void 0 : selectedReason.code) === "OTHER" || selectedReason === "OTHER";
50636
+ const genderOptions = [{
50637
+ code: "MALE",
50638
+ i18nKey: "Male"
50639
+ }, {
50640
+ code: "FEMALE",
50641
+ i18nKey: "Female"
50642
+ }, {
50643
+ code: "TRANSGENDER",
50644
+ i18nKey: "Transgender"
50645
+ }];
50259
50646
  const reasonOptions = [{
50260
50647
  code: "SALE_PURCHASE",
50261
- i18nKey: "Sale / Purchase of Property"
50648
+ i18nKey: "Purchase of Property"
50262
50649
  }, {
50263
50650
  code: "DEVOLUTION_INHERITANCE",
50264
50651
  i18nKey: "Devolution/Inheritance"
50265
50652
  }, {
50266
50653
  code: "OTHER",
50267
- i18nKey: "Other Reason(Gift, Lease, etc)"
50654
+ i18nKey: "Other Reason(Gift Deed, Lease Agreement, etc)"
50268
50655
  }];
50269
50656
  const relationshipOptions = [{
50270
- code: "MOTHER",
50271
- i18nKey: "Mother"
50272
- }, {
50273
- code: "FATHER",
50274
- i18nKey: "Father"
50275
- }, {
50276
- code: "SIBLING",
50277
- i18nKey: "Sibling"
50278
- }, {
50279
- code: "SPOUSE",
50280
- i18nKey: "Spouse"
50281
- }, {
50282
- code: "SON",
50283
- i18nKey: "Son"
50284
- }, {
50285
- code: "DAUGHTER",
50286
- i18nKey: "Daughter"
50657
+ code: "BLOOD_RELATION",
50658
+ i18nKey: "Blood Relation (Son / Daughter / Spouse)"
50287
50659
  }, {
50288
50660
  code: "LEGAL_HEIR",
50289
50661
  i18nKey: "Legal heir"
@@ -50291,365 +50663,1316 @@ const WSMutationApplicantDetails = _ref => {
50291
50663
  code: "OTHER",
50292
50664
  i18nKey: "Other"
50293
50665
  }];
50294
- const _useState = React.useState((formData === null || formData === void 0 ? void 0 : (_formData$config$key = formData[config.key]) === null || _formData$config$key === void 0 ? void 0 : _formData$config$key.saleDeedDocumentId) || null),
50295
- uploadedFile = _useState[0],
50296
- setUploadedFile = _useState[1];
50297
- const _useState2 = React.useState(null),
50298
- file = _useState2[0],
50299
- setFile = _useState2[1];
50300
- const _useState3 = React.useState(false),
50301
- isUploading = _useState3[0],
50302
- setIsUploading = _useState3[1];
50303
- React.useEffect(() => {
50304
- const currentState = _extends({}, formValue, {
50305
- saleDeedDocumentId: uploadedFile
50306
- });
50307
- if (!lodash.isEqual(formData === null || formData === void 0 ? void 0 : formData[config.key], currentState)) {
50308
- onSelect(config.key, currentState);
50309
- }
50310
- }, [formValue, uploadedFile]);
50311
- React.useEffect(() => {
50312
- (function () {
50313
- try {
50314
- const _temp2 = function () {
50315
- if (file) {
50316
- const _temp = _finallyRethrows(function () {
50317
- return _catch(function () {
50318
- setIsUploading(true);
50319
- return Promise.resolve(window.Digit.UploadServices.Filestorage("WS", file, window.Digit.ULBService.getStateId())).then(function (response) {
50320
- var _response$data, _response$data$files;
50321
- if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
50322
- setUploadedFile(response.data.files[0].fileStoreId);
50323
- clearErrors && clearErrors(config.key);
50324
- }
50325
- });
50326
- }, function (err) {
50327
- console.error("File upload error", err);
50328
- });
50329
- }, function (_wasThrown, _result) {
50330
- setIsUploading(false);
50331
- if (_wasThrown) throw _result;
50332
- return _result;
50333
- });
50334
- if (_temp && _temp.then) return _temp.then(function () {});
50335
- }
50336
- }();
50337
- return _temp2 && _temp2.then ? _temp2.then(function () {}) : void 0;
50338
- } catch (e) {
50339
- Promise.reject(e);
50340
- }
50341
- })();
50342
- }, [file]);
50343
50666
  const errorStyle = {
50344
50667
  width: "100%",
50345
50668
  marginLeft: "0px",
50346
50669
  fontSize: "12px",
50347
- marginTop: "4px"
50670
+ marginTop: "4px",
50671
+ color: "#d32f2f"
50348
50672
  };
50349
- return /*#__PURE__*/React__default.createElement("div", {
50350
- className: "formcomposer-section-grid",
50673
+ const getFieldBorderStyle = fieldName => {
50674
+ if (errors !== null && errors !== void 0 && errors[fieldName]) return {
50675
+ border: "1px solid #d32f2f"
50676
+ };
50677
+ if (touched[fieldName] && !(errors !== null && errors !== void 0 && errors[fieldName])) return {
50678
+ border: "1px solid #28a745"
50679
+ };
50680
+ return {};
50681
+ };
50682
+ const onSubmit = data => {
50683
+ if (data.proposedNewConsumerName && data.proposedNewConsumerName.trim().length < 3) {
50684
+ setError("proposedNewConsumerName", {
50685
+ type: "manual",
50686
+ message: "Name must be at least 3 characters"
50687
+ });
50688
+ return;
50689
+ }
50690
+ if (data.proposedNewConsumerName && !/^[a-zA-Z\s.'-]+$/.test(data.proposedNewConsumerName.trim())) {
50691
+ setError("proposedNewConsumerName", {
50692
+ type: "manual",
50693
+ message: "Name should only contain alphabets, spaces, dots, hyphens"
50694
+ });
50695
+ return;
50696
+ }
50697
+ onNext(data);
50698
+ };
50699
+ const onError = () => {
50700
+ const errorCount = Object.keys(errors).length;
50701
+ setShowToast({
50702
+ key: "error",
50703
+ message: "Please fix " + errorCount + " validation error" + (errorCount > 1 ? "s" : "") + " before proceeding."
50704
+ });
50705
+ };
50706
+ const mandatoryIndicator = /*#__PURE__*/React__default.createElement("span", {
50351
50707
  style: {
50352
- gridTemplateColumns: "1fr 1fr",
50353
- gap: "20px",
50354
- display: "grid"
50708
+ color: "#d32f2f",
50709
+ marginLeft: "2px"
50710
+ }
50711
+ }, "*");
50712
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
50713
+ style: {
50714
+ marginBottom: "20px"
50355
50715
  }
50356
50716
  }, /*#__PURE__*/React__default.createElement("div", {
50357
50717
  style: {
50358
50718
  display: "flex",
50359
- flexDirection: "column",
50360
- gap: "20px"
50719
+ alignItems: "center",
50720
+ marginBottom: "16px"
50721
+ }
50722
+ }, /*#__PURE__*/React__default.createElement("span", {
50723
+ style: {
50724
+ fontSize: "24px",
50725
+ marginRight: "8px"
50726
+ }
50727
+ }, "\uD83D\uDC64"), /*#__PURE__*/React__default.createElement("h2", {
50728
+ style: {
50729
+ fontSize: "20px",
50730
+ fontWeight: "700",
50731
+ margin: 0
50361
50732
  }
50362
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50733
+ }, "2. New Consumer Details.")), Object.keys(errors).length > 0 && /*#__PURE__*/React__default.createElement("div", {
50363
50734
  style: {
50735
+ padding: "12px 16px",
50736
+ backgroundColor: "#fdecea",
50737
+ color: "#611a15",
50738
+ borderRadius: "8px",
50739
+ border: "1px solid #f5c6cb",
50740
+ marginBottom: "16px",
50364
50741
  display: "flex",
50365
- flexDirection: "column",
50366
- alignItems: "flex-start",
50367
- gap: "4px"
50742
+ alignItems: "center"
50368
50743
  }
50369
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50744
+ }, /*#__PURE__*/React__default.createElement("span", {
50370
50745
  style: {
50371
- margin: 0,
50746
+ marginRight: "8px",
50747
+ fontSize: "18px"
50748
+ }
50749
+ }, "\u26A0\uFE0F"), /*#__PURE__*/React__default.createElement("span", {
50750
+ style: {
50751
+ fontWeight: "500",
50752
+ fontSize: "14px"
50753
+ }
50754
+ }, "Please fill in all required fields marked with ", /*#__PURE__*/React__default.createElement("span", {
50755
+ style: {
50756
+ color: "#d32f2f",
50372
50757
  fontWeight: "bold"
50373
50758
  }
50374
- }, "PROPOSED NEW CONSUMER NAME*"), /*#__PURE__*/React__default.createElement("div", {
50375
- className: "field",
50759
+ }, "*"), " before proceeding.")), /*#__PURE__*/React__default.createElement("form", {
50760
+ onSubmit: handleSubmit(onSubmit, onError)
50761
+ }, /*#__PURE__*/React__default.createElement("div", {
50376
50762
  style: {
50377
- width: "100%"
50763
+ display: "grid",
50764
+ gridTemplateColumns: "1fr 1fr 1fr",
50765
+ gap: "24px",
50766
+ padding: "16px 0"
50378
50767
  }
50379
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50768
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50769
+ style: {
50770
+ fontWeight: "bold"
50771
+ }
50772
+ }, "New Consumer Full Name ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50380
50773
  control: control,
50381
50774
  name: "proposedNewConsumerName",
50382
50775
  rules: {
50383
- required: "Required field"
50776
+ required: "Consumer name is required",
50777
+ minLength: {
50778
+ value: 3,
50779
+ message: "Name must be at least 3 characters"
50780
+ },
50781
+ pattern: {
50782
+ value: /^[a-zA-Z\s.'-]+$/,
50783
+ message: "Only alphabets, spaces, dots and hyphens allowed"
50784
+ }
50384
50785
  },
50385
50786
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
50386
50787
  value: props.value,
50387
50788
  onChange: e => {
50388
50789
  props.onChange(e.target.value);
50790
+ clearErrors("proposedNewConsumerName");
50389
50791
  },
50390
- placeholder: "Enter full legal name of new owner",
50391
- onBlur: props.onBlur
50792
+ onBlur: () => {
50793
+ props.onBlur();
50794
+ setTouched(p => _extends({}, p, {
50795
+ proposedNewConsumerName: true
50796
+ }));
50797
+ trigger("proposedNewConsumerName");
50798
+ },
50799
+ placeholder: "Enter full name (e.g. Rajesh Kumar)",
50800
+ style: getFieldBorderStyle("proposedNewConsumerName")
50392
50801
  })
50393
- }))), (errors === null || errors === void 0 ? void 0 : errors.proposedNewConsumerName) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50802
+ }), (errors === null || errors === void 0 ? void 0 : errors.proposedNewConsumerName) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50394
50803
  style: errorStyle
50395
- }, errors === null || errors === void 0 ? void 0 : (_errors$proposedNewCo = errors.proposedNewConsumerName) === null || _errors$proposedNewCo === void 0 ? void 0 : _errors$proposedNewCo.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50396
- style: {
50397
- display: "flex",
50398
- flexDirection: "column",
50399
- alignItems: "flex-start",
50400
- gap: "4px"
50401
- }
50402
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50804
+ }, errors === null || errors === void 0 ? void 0 : (_errors$proposedNewCo = errors.proposedNewConsumerName) === null || _errors$proposedNewCo === void 0 ? void 0 : _errors$proposedNewCo.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50403
50805
  style: {
50404
- margin: 0,
50405
50806
  fontWeight: "bold"
50406
50807
  }
50407
- }, "NEW OWNER MOBILE NUMBER*"), /*#__PURE__*/React__default.createElement("div", {
50408
- className: "field",
50808
+ }, "Gender ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50809
+ control: control,
50810
+ name: "gender",
50811
+ rules: {
50812
+ required: "Please select gender"
50813
+ },
50814
+ render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
50815
+ selected: props.value,
50816
+ option: genderOptions,
50817
+ select: val => {
50818
+ props.onChange(val);
50819
+ setTouched(p => _extends({}, p, {
50820
+ gender: true
50821
+ }));
50822
+ },
50823
+ optionKey: "i18nKey",
50824
+ t: t,
50825
+ placeholder: "Select Gender"
50826
+ })
50827
+ }), (errors === null || errors === void 0 ? void 0 : errors.gender) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50828
+ style: errorStyle
50829
+ }, errors === null || errors === void 0 ? void 0 : (_errors$gender = errors.gender) === null || _errors$gender === void 0 ? void 0 : _errors$gender.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50409
50830
  style: {
50410
- width: "100%"
50831
+ fontWeight: "bold"
50411
50832
  }
50412
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50833
+ }, "Mobile Number ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50413
50834
  control: control,
50414
50835
  name: "newOwnerMobileNumber",
50415
50836
  rules: {
50416
- required: "Required field",
50837
+ required: "Mobile number is required",
50417
50838
  pattern: {
50418
50839
  value: /^[6-9]\d{9}$/,
50419
- message: "Invalid mobile number"
50840
+ message: "Enter a valid 10-digit mobile number starting with 6-9"
50420
50841
  }
50421
50842
  },
50422
50843
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.MobileNumber, {
50423
50844
  value: props.value || "",
50424
50845
  onChange: val => {
50425
50846
  props.onChange(val);
50847
+ clearErrors("newOwnerMobileNumber");
50426
50848
  },
50427
- placeholder: "Enter mobile number",
50428
- onBlur: props.onBlur
50849
+ onBlur: () => {
50850
+ setTouched(p => _extends({}, p, {
50851
+ newOwnerMobileNumber: true
50852
+ }));
50853
+ trigger("newOwnerMobileNumber");
50854
+ },
50855
+ placeholder: "Enter 10-digit mobile number",
50856
+ maxLength: 10
50429
50857
  })
50430
- }))), (errors === null || errors === void 0 ? void 0 : errors.newOwnerMobileNumber) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50858
+ }), (errors === null || errors === void 0 ? void 0 : errors.newOwnerMobileNumber) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50431
50859
  style: errorStyle
50432
- }, errors === null || errors === void 0 ? void 0 : (_errors$newOwnerMobil = errors.newOwnerMobileNumber) === null || _errors$newOwnerMobil === void 0 ? void 0 : _errors$newOwnerMobil.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50433
- style: {
50434
- display: "flex",
50435
- flexDirection: "column",
50436
- alignItems: "flex-start",
50437
- gap: "4px"
50438
- }
50439
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50860
+ }, errors === null || errors === void 0 ? void 0 : (_errors$newOwnerMobil = errors.newOwnerMobileNumber) === null || _errors$newOwnerMobil === void 0 ? void 0 : _errors$newOwnerMobil.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50440
50861
  style: {
50441
- margin: 0,
50442
50862
  fontWeight: "bold"
50443
50863
  }
50444
- }, "NEW OWNER EMAIL ADDRESS"), /*#__PURE__*/React__default.createElement("div", {
50445
- className: "field",
50864
+ }, "Email ID ", /*#__PURE__*/React__default.createElement("span", {
50446
50865
  style: {
50447
- width: "100%"
50866
+ color: "#999",
50867
+ fontSize: "12px"
50448
50868
  }
50449
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50869
+ }, "(Optional)")), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50450
50870
  control: control,
50451
50871
  name: "newOwnerEmailAddress",
50452
50872
  rules: {
50453
50873
  pattern: {
50454
50874
  value: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
50455
- message: "Invalid email address"
50875
+ message: "Please enter a valid email address"
50456
50876
  }
50457
50877
  },
50458
50878
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
50459
50879
  value: props.value,
50460
50880
  onChange: e => {
50461
50881
  props.onChange(e.target.value);
50882
+ clearErrors("newOwnerEmailAddress");
50462
50883
  },
50463
- placeholder: "Enter email address",
50464
- onBlur: props.onBlur
50884
+ onBlur: () => {
50885
+ props.onBlur();
50886
+ setTouched(p => _extends({}, p, {
50887
+ newOwnerEmailAddress: true
50888
+ }));
50889
+ trigger("newOwnerEmailAddress");
50890
+ },
50891
+ placeholder: "example@email.com",
50892
+ style: getFieldBorderStyle("newOwnerEmailAddress")
50465
50893
  })
50466
- }))), (errors === null || errors === void 0 ? void 0 : errors.newOwnerEmailAddress) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50894
+ }), (errors === null || errors === void 0 ? void 0 : errors.newOwnerEmailAddress) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50467
50895
  style: errorStyle
50468
- }, errors === null || errors === void 0 ? void 0 : (_errors$newOwnerEmail = errors.newOwnerEmailAddress) === null || _errors$newOwnerEmail === void 0 ? void 0 : _errors$newOwnerEmail.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50469
- style: {
50470
- display: "flex",
50471
- flexDirection: "column",
50472
- alignItems: "flex-start",
50473
- gap: "4px"
50474
- }
50475
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50896
+ }, errors === null || errors === void 0 ? void 0 : (_errors$newOwnerEmail = errors.newOwnerEmailAddress) === null || _errors$newOwnerEmail === void 0 ? void 0 : _errors$newOwnerEmail.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50476
50897
  style: {
50477
- margin: 0,
50478
50898
  fontWeight: "bold"
50479
50899
  }
50480
- }, "RELATIONSHIP WITH EXISTING CONSUMER*"), /*#__PURE__*/React__default.createElement("div", {
50481
- className: "field",
50482
- style: {
50483
- width: "100%"
50484
- }
50485
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50900
+ }, "Reason for Name Change / Mutation ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50486
50901
  control: control,
50487
- name: "relationshipWithExistingConsumer",
50902
+ name: "reasonForNameChange",
50488
50903
  rules: {
50489
- required: "Required field"
50904
+ required: "Please select a reason for mutation"
50490
50905
  },
50491
50906
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
50492
50907
  selected: props.value,
50493
- option: relationshipOptions,
50494
- select: e => {
50495
- props.onChange(e);
50908
+ option: reasonOptions,
50909
+ select: val => {
50910
+ props.onChange(val);
50911
+ setTouched(p => _extends({}, p, {
50912
+ reasonForNameChange: true
50913
+ }));
50496
50914
  },
50497
50915
  optionKey: "i18nKey",
50498
50916
  t: t,
50499
- placeholder: "Select relationship"
50917
+ placeholder: "Select reason"
50500
50918
  })
50501
- }))), (errors === null || errors === void 0 ? void 0 : errors.relationshipWithExistingConsumer) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50919
+ }), (errors === null || errors === void 0 ? void 0 : errors.reasonForNameChange) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50502
50920
  style: errorStyle
50503
- }, errors === null || errors === void 0 ? void 0 : (_errors$relationshipW = errors.relationshipWithExistingConsumer) === null || _errors$relationshipW === void 0 ? void 0 : _errors$relationshipW.message))), /*#__PURE__*/React__default.createElement("div", {
50504
- style: {
50505
- display: "flex",
50506
- flexDirection: "column",
50507
- gap: "20px"
50508
- }
50509
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50510
- style: {
50511
- display: "flex",
50512
- flexDirection: "column",
50513
- alignItems: "flex-start",
50514
- gap: "4px"
50515
- }
50516
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50517
- style: {
50518
- margin: 0,
50519
- fontWeight: "bold"
50520
- }
50521
- }, "REASON FOR NAME CHANGE*"), /*#__PURE__*/React__default.createElement("div", {
50522
- className: "field",
50921
+ }, errors === null || errors === void 0 ? void 0 : (_errors$reasonForName = errors.reasonForNameChange) === null || _errors$reasonForName === void 0 ? void 0 : _errors$reasonForName.message)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50523
50922
  style: {
50524
- width: "100%"
50923
+ fontWeight: "bold",
50924
+ color: isOtherReason ? "inherit" : "#999"
50525
50925
  }
50526
- }, /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50926
+ }, "Relationship with Existing Consumer ", isOtherReason && mandatoryIndicator), /*#__PURE__*/React__default.createElement(reactHookForm.Controller, {
50527
50927
  control: control,
50528
- name: "reasonForNameChange",
50928
+ name: "relationshipWithExistingConsumer",
50529
50929
  rules: {
50530
- required: "Required field"
50930
+ required: isOtherReason ? "Relationship is required when 'Other Reason' is selected" : false
50531
50931
  },
50532
50932
  render: props => /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
50533
50933
  selected: props.value,
50534
- option: reasonOptions,
50535
- select: e => {
50536
- props.onChange(e);
50934
+ option: relationshipOptions,
50935
+ select: val => {
50936
+ props.onChange(val);
50937
+ setTouched(p => _extends({}, p, {
50938
+ relationshipWithExistingConsumer: true
50939
+ }));
50537
50940
  },
50538
50941
  optionKey: "i18nKey",
50539
50942
  t: t,
50540
- placeholder: "Select reason"
50943
+ placeholder: "Select relationship",
50944
+ disable: !isOtherReason
50541
50945
  })
50542
- }))), (errors === null || errors === void 0 ? void 0 : errors.reasonForNameChange) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50543
- style: errorStyle
50544
- }, errors === null || errors === void 0 ? void 0 : (_errors$reasonForName = errors.reasonForNameChange) === null || _errors$reasonForName === void 0 ? void 0 : _errors$reasonForName.message)), /*#__PURE__*/React__default.createElement("div", {
50946
+ }), !isOtherReason && /*#__PURE__*/React__default.createElement("span", {
50545
50947
  style: {
50546
- marginTop: "10px",
50547
- padding: "20px",
50548
- border: "1px dashed #ccc",
50549
- borderRadius: "8px",
50550
- backgroundColor: "#fafafa"
50948
+ fontSize: "11px",
50949
+ color: "#999",
50950
+ marginTop: "4px",
50951
+ display: "block"
50551
50952
  }
50552
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, {
50953
+ }, "Enabled only when \"Other Reason\" is selected above"), (errors === null || errors === void 0 ? void 0 : errors.relationshipWithExistingConsumer) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, {
50954
+ style: errorStyle
50955
+ }, errors === null || errors === void 0 ? void 0 : (_errors$relationshipW = errors.relationshipWithExistingConsumer) === null || _errors$relationshipW === void 0 ? void 0 : _errors$relationshipW.message))), /*#__PURE__*/React__default.createElement("div", {
50553
50956
  style: {
50554
50957
  display: "flex",
50555
- flexDirection: "column",
50556
- alignItems: "flex-start",
50557
- gap: "4px"
50958
+ justifyContent: "space-between",
50959
+ alignItems: "center",
50960
+ marginTop: "24px"
50558
50961
  }
50559
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
50962
+ }, /*#__PURE__*/React__default.createElement("button", {
50963
+ type: "button",
50964
+ onClick: onBack,
50560
50965
  style: {
50561
- margin: 0,
50966
+ padding: "8px 24px",
50967
+ backgroundColor: "#e0e0e0",
50968
+ border: "none",
50969
+ borderRadius: "4px",
50970
+ cursor: "pointer",
50562
50971
  fontWeight: "bold"
50563
50972
  }
50564
- }, "UPLOAD REGISTERED SALE DEED*"), /*#__PURE__*/React__default.createElement("p", {
50973
+ }, "\u2190 Back"), /*#__PURE__*/React__default.createElement("div", {
50565
50974
  style: {
50566
- color: "#666",
50567
- fontSize: "12px",
50568
- marginBottom: "15px",
50569
- marginTop: "5px"
50975
+ display: "flex",
50976
+ alignItems: "center",
50977
+ gap: "12px"
50570
50978
  }
50571
- }, "Submit a clear scan of the stamp duty Registered Sale Deed."), /*#__PURE__*/React__default.createElement("div", {
50572
- className: "field",
50979
+ }, /*#__PURE__*/React__default.createElement("span", {
50573
50980
  style: {
50574
- width: "100%"
50981
+ fontSize: "12px",
50982
+ color: "#999"
50575
50983
  }
50576
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
50577
- id: "sale-deed-upload",
50578
- onUpload: e => {
50579
- setFile(e.target.files[0]);
50580
- },
50581
- onDelete: () => {
50582
- setUploadedFile(null);
50583
- setFile(null);
50584
- },
50585
- message: uploadedFile ? "1 File Uploaded" : "Click to upload document",
50586
- accept: "image/*, .pdf, .png, .jpeg, .jpg",
50587
- uploadedFiles: uploadedFile && !file ? [["Document", {
50588
- fileStoreId: uploadedFile
50589
- }]] : undefined,
50590
- removeTargetedFile: () => {
50591
- setUploadedFile(null);
50592
- setFile(null);
50984
+ }, "Fields marked with ", /*#__PURE__*/React__default.createElement("span", {
50985
+ style: {
50986
+ color: "#d32f2f"
50593
50987
  }
50594
- }))), isUploading && /*#__PURE__*/React__default.createElement("span", {
50988
+ }, "*"), " are mandatory"), /*#__PURE__*/React__default.createElement("button", {
50989
+ type: "submit",
50595
50990
  style: {
50596
- color: "#00497e",
50597
- fontWeight: "bold",
50598
- fontSize: "12px"
50991
+ padding: "10px 24px",
50992
+ backgroundColor: "#00497e",
50993
+ color: "white",
50994
+ border: "none",
50995
+ borderRadius: "4px",
50996
+ cursor: "pointer",
50997
+ fontWeight: "bold"
50599
50998
  }
50600
- }, "Uploading..."))));
50999
+ }, "Save & Proceed to Documents \u2192")))), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
51000
+ error: showToast.key === "error",
51001
+ warning: showToast.key === "warning",
51002
+ label: t(showToast.message),
51003
+ onClose: () => setShowToast(null),
51004
+ isDleteBtn: true
51005
+ }));
50601
51006
  };
50602
51007
 
50603
- const MutationApplication = () => {
50604
- var _state, _details, _details2, _details2$application, _applicationDetails$a, _applicationDetails$a2, _applicationDetails$a3, _applicationDetails$a4, _applicationDetails$a5, _applicationDetails$a6, _applicationDetails$a7;
50605
- const _useTranslation = reactI18next.useTranslation(),
50606
- t = _useTranslation.t;
50607
- let _useLocation = reactRouterDom.useLocation(),
50608
- state = _useLocation.state;
50609
- state = state ? typeof state === "string" ? JSON.parse(state) : state : {};
50610
- const history = reactRouterDom.useHistory();
50611
- let filters = getQueryStringParams(location.search);
50612
- const _useState = React.useState(false),
50613
- canSubmit = _useState[0],
50614
- setSubmitValve = _useState[1];
50615
- const _useState2 = React.useState(null),
50616
- showToast = _useState2[0],
50617
- setShowToast = _useState2[1];
50618
- const _useState3 = React.useState({}),
50619
- appData = _useState3[0],
50620
- setAppData = _useState3[1];
50621
- const _useState4 = React.useState({
50622
- head: "",
50623
- body: []
51008
+ const Step3_UploadDocuments = _ref => {
51009
+ var _defaultValues$reason;
51010
+ let t = _ref.t,
51011
+ onNext = _ref.onNext,
51012
+ onBack = _ref.onBack,
51013
+ defaultValues = _ref.defaultValues;
51014
+ const _useState = React.useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.identityProofType) || null),
51015
+ identityProofType = _useState[0],
51016
+ setIdentityProofType = _useState[1];
51017
+ const _useState2 = React.useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.documentNumber) || ""),
51018
+ documentNumber = _useState2[0],
51019
+ setDocumentNumber = _useState2[1];
51020
+ const _useState3 = React.useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.identityProofDocumentId) || null),
51021
+ identityProofFile = _useState3[0],
51022
+ setIdentityProofFile = _useState3[1];
51023
+ const _useState4 = React.useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.saleDeedDocumentId) || null),
51024
+ mutationDocFile = _useState4[0],
51025
+ setMutationDocFile = _useState4[1];
51026
+ const _useState5 = React.useState({
51027
+ identity: null,
51028
+ mutation: null
50624
51029
  }),
50625
- config = _useState4[0],
50626
- setConfig = _useState4[1];
50627
- const _useState5 = React.useState(true),
50628
- enabledLoader = _useState5[0],
50629
- setEnabledLoader = _useState5[1];
51030
+ rawFiles = _useState5[0],
51031
+ setRawFiles = _useState5[1];
50630
51032
  const _useState6 = React.useState(false),
50631
- isAppDetailsPage = _useState6[0];
50632
- const _useState7 = React.useState(false),
50633
- isEnableLoader = _useState7[0],
50634
- setIsEnableLoader = _useState7[1];
51033
+ isUploading = _useState6[0],
51034
+ setIsUploading = _useState6[1];
51035
+ const _useState7 = React.useState(null),
51036
+ showToast = _useState7[0],
51037
+ setShowToast = _useState7[1];
51038
+ const _useState8 = React.useState({}),
51039
+ fieldErrors = _useState8[0],
51040
+ setFieldErrors = _useState8[1];
51041
+ const _useState9 = React.useState(false),
51042
+ hasAttemptedSubmit = _useState9[0],
51043
+ setHasAttemptedSubmit = _useState9[1];
51044
+ const identityOptions = [{
51045
+ code: "AADHAAR",
51046
+ i18nKey: "Aadhaar Card"
51047
+ }, {
51048
+ code: "VOTER_ID",
51049
+ i18nKey: "Voter ID"
51050
+ }, {
51051
+ code: "PAN",
51052
+ i18nKey: "PAN Card"
51053
+ }, {
51054
+ code: "OTHER",
51055
+ i18nKey: "Any other document configured by DJB"
51056
+ }];
51057
+ const getReasonDocLabel = reasonCode => {
51058
+ switch (reasonCode) {
51059
+ case "SALE_PURCHASE":
51060
+ return "Upload Purchase of Property";
51061
+ case "DEVOLUTION_INHERITANCE":
51062
+ return "Upload Devolution/ Inheritance";
51063
+ case "OTHER":
51064
+ return "Upload Other (Gift Deed, Will registration, etc.)";
51065
+ default:
51066
+ return "Upload Supporting Document";
51067
+ }
51068
+ };
51069
+ const reasonCode = (defaultValues === null || defaultValues === void 0 ? void 0 : (_defaultValues$reason = defaultValues.reasonForNameChange) === null || _defaultValues$reason === void 0 ? void 0 : _defaultValues$reason.code) || (defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.reasonForNameChange);
51070
+ const reasonDocLabel = getReasonDocLabel(reasonCode);
51071
+ const validateDocumentNumber = (value, docType) => {
51072
+ if (!value || !value.trim()) return "Document number is required";
51073
+ const trimmed = value.trim();
51074
+ if ((docType === null || docType === void 0 ? void 0 : docType.code) === "AADHAAR") {
51075
+ if (!/^\d{12}$/.test(trimmed)) return "Aadhaar number must be exactly 12 digits";
51076
+ } else if ((docType === null || docType === void 0 ? void 0 : docType.code) === "PAN") {
51077
+ if (!/^[A-Z]{5}[0-9]{4}[A-Z]{1}$/.test(trimmed.toUpperCase())) return "PAN must be in format ABCDE1234F";
51078
+ } else if ((docType === null || docType === void 0 ? void 0 : docType.code) === "VOTER_ID") {
51079
+ if (!/^[A-Z]{3}\d{7}$/.test(trimmed.toUpperCase())) return "Voter ID must be in format ABC1234567";
51080
+ } else {
51081
+ if (trimmed.length < 3) return "Document number must be at least 3 characters";
51082
+ }
51083
+ return null;
51084
+ };
51085
+ const validateFileSize = file => {
51086
+ const maxSizeMB = 5;
51087
+ if (file.size > maxSizeMB * 1024 * 1024) {
51088
+ return "File size exceeds " + maxSizeMB + "MB limit. Please choose a smaller file.";
51089
+ }
51090
+ return null;
51091
+ };
51092
+ const validateFileType = file => {
51093
+ const allowedTypes = ["image/jpeg", "image/jpg", "image/png", "application/pdf"];
51094
+ if (!allowedTypes.includes(file.type)) {
51095
+ return "Only PDF, PNG, JPEG files are allowed.";
51096
+ }
51097
+ return null;
51098
+ };
51099
+ const handleFileUpload = function (file, type) {
51100
+ try {
51101
+ const sizeError = validateFileSize(file);
51102
+ if (sizeError) {
51103
+ setShowToast({
51104
+ key: "error",
51105
+ message: sizeError
51106
+ });
51107
+ return Promise.resolve();
51108
+ }
51109
+ const typeError = validateFileType(file);
51110
+ if (typeError) {
51111
+ setShowToast({
51112
+ key: "error",
51113
+ message: typeError
51114
+ });
51115
+ return Promise.resolve();
51116
+ }
51117
+ const _temp = _finallyRethrows(function () {
51118
+ return _catch(function () {
51119
+ setIsUploading(true);
51120
+ return Promise.resolve(window.Digit.UploadServices.Filestorage("WS", file, window.Digit.ULBService.getStateId())).then(function (response) {
51121
+ var _response$data, _response$data$files;
51122
+ if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
51123
+ const fileStoreId = response.data.files[0].fileStoreId;
51124
+ if (type === "identity") {
51125
+ setIdentityProofFile(fileStoreId);
51126
+ setFieldErrors(prev => _extends({}, prev, {
51127
+ identityFile: null
51128
+ }));
51129
+ }
51130
+ if (type === "mutation") {
51131
+ setMutationDocFile(fileStoreId);
51132
+ setFieldErrors(prev => _extends({}, prev, {
51133
+ mutationFile: null
51134
+ }));
51135
+ }
51136
+ setShowToast({
51137
+ key: "success",
51138
+ message: "Document uploaded successfully!"
51139
+ });
51140
+ }
51141
+ });
51142
+ }, function (err) {
51143
+ console.error("File upload error", err);
51144
+ setShowToast({
51145
+ key: "error",
51146
+ message: "File upload failed. Please try again."
51147
+ });
51148
+ });
51149
+ }, function (_wasThrown, _result) {
51150
+ setIsUploading(false);
51151
+ if (_wasThrown) throw _result;
51152
+ return _result;
51153
+ });
51154
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
51155
+ } catch (e) {
51156
+ return Promise.reject(e);
51157
+ }
51158
+ };
51159
+ React.useEffect(() => {
51160
+ if (rawFiles.identity) handleFileUpload(rawFiles.identity, "identity");
51161
+ }, [rawFiles.identity]);
51162
+ React.useEffect(() => {
51163
+ if (rawFiles.mutation) handleFileUpload(rawFiles.mutation, "mutation");
51164
+ }, [rawFiles.mutation]);
51165
+ React.useEffect(() => {
51166
+ if (hasAttemptedSubmit) {
51167
+ const newErrors = {};
51168
+ if (!identityProofType) newErrors.identityType = "Please select a document type";
51169
+ if (!identityProofFile) newErrors.identityFile = "Please upload your identity proof document";
51170
+ if (!mutationDocFile) newErrors.mutationFile = "Please upload the reason-based supporting document";
51171
+ const docError = validateDocumentNumber(documentNumber, identityProofType);
51172
+ if (docError) newErrors.documentNumber = docError;
51173
+ setFieldErrors(newErrors);
51174
+ }
51175
+ }, [identityProofType, documentNumber, identityProofFile, mutationDocFile, hasAttemptedSubmit]);
51176
+ const onProceed = () => {
51177
+ setHasAttemptedSubmit(true);
51178
+ const newErrors = {};
51179
+ if (!identityProofType) newErrors.identityType = "Please select a document type";
51180
+ const docError = validateDocumentNumber(documentNumber, identityProofType);
51181
+ if (docError) newErrors.documentNumber = docError;
51182
+ if (!identityProofFile) newErrors.identityFile = "Please upload your identity proof document";
51183
+ if (!mutationDocFile) newErrors.mutationFile = "Please upload the reason-based supporting document";
51184
+ setFieldErrors(newErrors);
51185
+ if (Object.keys(newErrors).length > 0) {
51186
+ const errorCount = Object.keys(newErrors).length;
51187
+ setShowToast({
51188
+ key: "warning",
51189
+ message: "Please fix " + errorCount + " issue" + (errorCount > 1 ? "s" : "") + " before proceeding."
51190
+ });
51191
+ return;
51192
+ }
51193
+ onNext({
51194
+ identityProofType,
51195
+ documentNumber: documentNumber.trim(),
51196
+ identityProofDocumentId: identityProofFile,
51197
+ saleDeedDocumentId: mutationDocFile
51198
+ });
51199
+ };
51200
+ const uploadBoxStyle = (hasError, hasFile) => ({
51201
+ border: hasError ? "2px dashed #d32f2f" : hasFile ? "2px dashed #28a745" : "1px dashed #ccc",
51202
+ padding: "20px",
51203
+ borderRadius: "8px",
51204
+ backgroundColor: hasError ? "#fef2f2" : hasFile ? "#f0fff4" : "#f4f9fc",
51205
+ textAlign: "center",
51206
+ marginTop: "8px",
51207
+ transition: "all 0.2s ease"
51208
+ });
51209
+ const errorTextStyle = {
51210
+ fontSize: "12px",
51211
+ color: "#d32f2f",
51212
+ marginTop: "4px"
51213
+ };
51214
+ const successTextStyle = {
51215
+ fontSize: "12px",
51216
+ color: "#28a745",
51217
+ marginTop: "4px",
51218
+ fontWeight: "500"
51219
+ };
51220
+ const mandatoryIndicator = /*#__PURE__*/React__default.createElement("span", {
51221
+ style: {
51222
+ color: "#d32f2f",
51223
+ marginLeft: "2px"
51224
+ }
51225
+ }, "*");
51226
+ const errorCount = Object.keys(fieldErrors).length;
51227
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
51228
+ style: {
51229
+ marginBottom: "20px"
51230
+ }
51231
+ }, /*#__PURE__*/React__default.createElement("div", {
51232
+ style: {
51233
+ display: "flex",
51234
+ alignItems: "center",
51235
+ marginBottom: "8px"
51236
+ }
51237
+ }, /*#__PURE__*/React__default.createElement("span", {
51238
+ style: {
51239
+ fontSize: "24px",
51240
+ marginRight: "8px"
51241
+ }
51242
+ }, "\uD83D\uDCC4"), /*#__PURE__*/React__default.createElement("h2", {
51243
+ style: {
51244
+ fontSize: "20px",
51245
+ fontWeight: "700",
51246
+ margin: 0
51247
+ }
51248
+ }, "3. Upload Verification Documents")), /*#__PURE__*/React__default.createElement("p", {
51249
+ style: {
51250
+ color: "#666",
51251
+ marginBottom: "20px"
51252
+ }
51253
+ }, "Please upload legible scanned copies or photos (PDF, PNG, JPEG - Max 5MB)."), hasAttemptedSubmit && errorCount > 0 && /*#__PURE__*/React__default.createElement("div", {
51254
+ style: {
51255
+ padding: "12px 16px",
51256
+ backgroundColor: "#fdecea",
51257
+ color: "#611a15",
51258
+ borderRadius: "8px",
51259
+ border: "1px solid #f5c6cb",
51260
+ marginBottom: "16px",
51261
+ display: "flex",
51262
+ alignItems: "center"
51263
+ }
51264
+ }, /*#__PURE__*/React__default.createElement("span", {
51265
+ style: {
51266
+ marginRight: "8px",
51267
+ fontSize: "18px"
51268
+ }
51269
+ }, "\u26A0\uFE0F"), /*#__PURE__*/React__default.createElement("span", {
51270
+ style: {
51271
+ fontWeight: "500",
51272
+ fontSize: "14px"
51273
+ }
51274
+ }, errorCount, " required item", errorCount > 1 ? "s" : "", " still need", errorCount === 1 ? "s" : "", " your attention before proceeding.")), /*#__PURE__*/React__default.createElement("div", {
51275
+ style: {
51276
+ display: "grid",
51277
+ gridTemplateColumns: "1fr 1fr",
51278
+ gap: "24px"
51279
+ }
51280
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
51281
+ style: {
51282
+ fontWeight: "bold"
51283
+ }
51284
+ }, "1. Address / Identity Proof ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
51285
+ selected: identityProofType,
51286
+ option: identityOptions,
51287
+ select: val => {
51288
+ setIdentityProofType(val);
51289
+ setFieldErrors(prev => _extends({}, prev, {
51290
+ identityType: null
51291
+ }));
51292
+ },
51293
+ optionKey: "i18nKey",
51294
+ t: t,
51295
+ placeholder: "Select Document Type",
51296
+ style: {
51297
+ marginBottom: "12px"
51298
+ }
51299
+ }), fieldErrors.identityType && /*#__PURE__*/React__default.createElement("div", {
51300
+ style: errorTextStyle
51301
+ }, fieldErrors.identityType), /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
51302
+ style: {
51303
+ fontWeight: "bold",
51304
+ marginTop: "8px"
51305
+ }
51306
+ }, "Document Number ", mandatoryIndicator), /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
51307
+ value: documentNumber,
51308
+ onChange: e => {
51309
+ setDocumentNumber(e.target.value);
51310
+ setFieldErrors(prev => _extends({}, prev, {
51311
+ documentNumber: null
51312
+ }));
51313
+ },
51314
+ onBlur: () => {
51315
+ if (hasAttemptedSubmit) {
51316
+ const err = validateDocumentNumber(documentNumber, identityProofType);
51317
+ if (err) setFieldErrors(prev => _extends({}, prev, {
51318
+ documentNumber: err
51319
+ }));
51320
+ }
51321
+ },
51322
+ placeholder: (identityProofType === null || identityProofType === void 0 ? void 0 : identityProofType.code) === "AADHAAR" ? "Enter 12-digit Aadhaar number" : (identityProofType === null || identityProofType === void 0 ? void 0 : identityProofType.code) === "PAN" ? "Enter PAN (e.g. ABCDE1234F)" : "Enter Document Number",
51323
+ style: _extends({
51324
+ marginBottom: "4px"
51325
+ }, fieldErrors.documentNumber ? {
51326
+ border: "1px solid #d32f2f"
51327
+ } : {})
51328
+ }), fieldErrors.documentNumber && /*#__PURE__*/React__default.createElement("div", {
51329
+ style: errorTextStyle
51330
+ }, fieldErrors.documentNumber), (identityProofType === null || identityProofType === void 0 ? void 0 : identityProofType.code) === "AADHAAR" && !fieldErrors.documentNumber && /*#__PURE__*/React__default.createElement("span", {
51331
+ style: {
51332
+ fontSize: "11px",
51333
+ color: "#999"
51334
+ }
51335
+ }, "Format: 12-digit numeric (e.g. 123456789012)"), (identityProofType === null || identityProofType === void 0 ? void 0 : identityProofType.code) === "PAN" && !fieldErrors.documentNumber && /*#__PURE__*/React__default.createElement("span", {
51336
+ style: {
51337
+ fontSize: "11px",
51338
+ color: "#999"
51339
+ }
51340
+ }, "Format: ABCDE1234F"), /*#__PURE__*/React__default.createElement("div", {
51341
+ style: uploadBoxStyle(!!fieldErrors.identityFile, !!identityProofFile)
51342
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
51343
+ id: "identity-upload",
51344
+ onUpload: e => setRawFiles(prev => _extends({}, prev, {
51345
+ identity: e.target.files[0]
51346
+ })),
51347
+ onDelete: () => {
51348
+ setIdentityProofFile(null);
51349
+ setRawFiles(prev => _extends({}, prev, {
51350
+ identity: null
51351
+ }));
51352
+ },
51353
+ message: identityProofFile ? "Uploaded" : "Click to Choose File",
51354
+ accept: "image/*, .pdf, .png, .jpeg, .jpg",
51355
+ uploadedFiles: identityProofFile && !rawFiles.identity ? [["Document", {
51356
+ fileStoreId: identityProofFile
51357
+ }]] : undefined,
51358
+ removeTargetedFile: () => {
51359
+ setIdentityProofFile(null);
51360
+ setRawFiles(prev => _extends({}, prev, {
51361
+ identity: null
51362
+ }));
51363
+ }
51364
+ })), fieldErrors.identityFile && /*#__PURE__*/React__default.createElement("div", {
51365
+ style: errorTextStyle
51366
+ }, fieldErrors.identityFile), identityProofFile && /*#__PURE__*/React__default.createElement("div", {
51367
+ style: successTextStyle
51368
+ }, "\u2713 Document uploaded successfully")), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabel, {
51369
+ style: {
51370
+ fontWeight: "bold"
51371
+ }
51372
+ }, "2. Reason-Based Supporting Document ", mandatoryIndicator), /*#__PURE__*/React__default.createElement("div", {
51373
+ style: {
51374
+ padding: "10px",
51375
+ backgroundColor: "#e9ecef",
51376
+ borderRadius: "4px",
51377
+ marginBottom: "12px",
51378
+ color: "#495057",
51379
+ fontSize: "14px",
51380
+ minHeight: "42px",
51381
+ display: "flex",
51382
+ alignItems: "center"
51383
+ }
51384
+ }, reasonDocLabel), /*#__PURE__*/React__default.createElement("div", {
51385
+ style: uploadBoxStyle(!!fieldErrors.mutationFile, !!mutationDocFile)
51386
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
51387
+ id: "mutation-upload",
51388
+ onUpload: e => setRawFiles(prev => _extends({}, prev, {
51389
+ mutation: e.target.files[0]
51390
+ })),
51391
+ onDelete: () => {
51392
+ setMutationDocFile(null);
51393
+ setRawFiles(prev => _extends({}, prev, {
51394
+ mutation: null
51395
+ }));
51396
+ },
51397
+ message: mutationDocFile ? "Uploaded" : "Click to Upload",
51398
+ accept: "image/*, .pdf, .png, .jpeg, .jpg",
51399
+ uploadedFiles: mutationDocFile && !rawFiles.mutation ? [["Document", {
51400
+ fileStoreId: mutationDocFile
51401
+ }]] : undefined,
51402
+ removeTargetedFile: () => {
51403
+ setMutationDocFile(null);
51404
+ setRawFiles(prev => _extends({}, prev, {
51405
+ mutation: null
51406
+ }));
51407
+ }
51408
+ })), fieldErrors.mutationFile && /*#__PURE__*/React__default.createElement("div", {
51409
+ style: errorTextStyle
51410
+ }, fieldErrors.mutationFile), mutationDocFile && /*#__PURE__*/React__default.createElement("div", {
51411
+ style: successTextStyle
51412
+ }, "\u2713 Document uploaded successfully"))), /*#__PURE__*/React__default.createElement("div", {
51413
+ style: {
51414
+ display: "flex",
51415
+ justifyContent: "space-between",
51416
+ alignItems: "center",
51417
+ marginTop: "32px"
51418
+ }
51419
+ }, /*#__PURE__*/React__default.createElement("button", {
51420
+ type: "button",
51421
+ onClick: onBack,
51422
+ style: {
51423
+ padding: "8px 24px",
51424
+ backgroundColor: "#e0e0e0",
51425
+ border: "none",
51426
+ borderRadius: "4px",
51427
+ cursor: "pointer",
51428
+ fontWeight: "bold"
51429
+ }
51430
+ }, "\u2190 Back"), /*#__PURE__*/React__default.createElement("div", {
51431
+ style: {
51432
+ display: "flex",
51433
+ alignItems: "center",
51434
+ gap: "12px"
51435
+ }
51436
+ }, /*#__PURE__*/React__default.createElement("span", {
51437
+ style: {
51438
+ fontSize: "12px",
51439
+ color: "#999"
51440
+ }
51441
+ }, "All documents are mandatory"), /*#__PURE__*/React__default.createElement("button", {
51442
+ type: "button",
51443
+ onClick: onProceed,
51444
+ disabled: isUploading,
51445
+ style: {
51446
+ padding: "10px 24px",
51447
+ backgroundColor: isUploading ? "#ccc" : "#00497e",
51448
+ color: "white",
51449
+ border: "none",
51450
+ borderRadius: "4px",
51451
+ cursor: isUploading ? "not-allowed" : "pointer",
51452
+ fontWeight: "bold"
51453
+ }
51454
+ }, isUploading ? "Uploading..." : "Proceed to Application Preview →"))), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
51455
+ error: showToast.key === "error",
51456
+ warning: showToast.key === "warning",
51457
+ success: showToast.key === "success",
51458
+ label: t(showToast.message),
51459
+ onClose: () => setShowToast(null),
51460
+ isDleteBtn: true
51461
+ }));
51462
+ };
51463
+
51464
+ const Step4_Preview = _ref => {
51465
+ var _appData$connectionHo, _appData$property, _address$locality;
51466
+ let formData = _ref.formData,
51467
+ applicationDetails = _ref.applicationDetails,
51468
+ onBack = _ref.onBack,
51469
+ onSubmit = _ref.onSubmit,
51470
+ isLoading = _ref.isLoading;
51471
+ const _useState = React.useState(false),
51472
+ agreed = _useState[0],
51473
+ setAgreed = _useState[1];
51474
+ const _useState2 = React.useState(0),
51475
+ fee = _useState2[0],
51476
+ setFee = _useState2[1];
51477
+ const _useState3 = React.useState("Calculating..."),
51478
+ slab = _useState3[0],
51479
+ setSlab = _useState3[1];
51480
+ const getMaskedName = name => {
51481
+ if (!name) return "NA";
51482
+ return name.split("").map((char, index) => index % 2 === 1 && char !== " " ? "*" : char).join("");
51483
+ };
51484
+ const getMaskedPhone = phone => {
51485
+ if (!phone || phone.length < 10) return "NA";
51486
+ return "******" + phone.slice(-4);
51487
+ };
51488
+ const appData = (applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.applicationData) || {};
51489
+ const connectionNo = (appData === null || appData === void 0 ? void 0 : appData.connectionNo) || "NA";
51490
+ const meterId = (appData === null || appData === void 0 ? void 0 : appData.meterId) || "NA";
51491
+ const propertyId = (appData === null || appData === void 0 ? void 0 : appData.propertyId) || "NA";
51492
+ const oldHolder = (appData === null || appData === void 0 ? void 0 : (_appData$connectionHo = appData.connectionHolders) === null || _appData$connectionHo === void 0 ? void 0 : _appData$connectionHo[0]) || {};
51493
+ const oldName = getMaskedName(oldHolder === null || oldHolder === void 0 ? void 0 : oldHolder.name);
51494
+ const oldPhone = getMaskedPhone(oldHolder === null || oldHolder === void 0 ? void 0 : oldHolder.mobileNumber);
51495
+ const address = (appData === null || appData === void 0 ? void 0 : (_appData$property = appData.property) === null || _appData$property === void 0 ? void 0 : _appData$property.address) || {};
51496
+ const oldAddress = [address === null || address === void 0 ? void 0 : address.doorNo, address === null || address === void 0 ? void 0 : address.buildingName, address === null || address === void 0 ? void 0 : address.street, address === null || address === void 0 ? void 0 : (_address$locality = address.locality) === null || _address$locality === void 0 ? void 0 : _address$locality.name, address === null || address === void 0 ? void 0 : address.city].filter(Boolean).join(", ") || "NA";
51497
+ const proposedNewConsumerName = formData.proposedNewConsumerName,
51498
+ newOwnerMobileNumber = formData.newOwnerMobileNumber,
51499
+ relationshipWithExistingConsumer = formData.relationshipWithExistingConsumer,
51500
+ reasonForNameChange = formData.reasonForNameChange,
51501
+ identityProofType = formData.identityProofType,
51502
+ documentNumber = formData.documentNumber,
51503
+ identityProofDocumentId = formData.identityProofDocumentId,
51504
+ saleDeedDocumentId = formData.saleDeedDocumentId;
51505
+ const getRelationshipName = code => {
51506
+ if (code !== null && code !== void 0 && code.code) return code.i18nKey;
51507
+ const map = {
51508
+ "BLOOD_RELATION": "Blood Relation",
51509
+ "LEGAL_HEIR": "Legal Heir",
51510
+ "OTHER": "Other"
51511
+ };
51512
+ return map[code] || code;
51513
+ };
51514
+ const getReasonName = code => {
51515
+ if (code !== null && code !== void 0 && code.code) return code.i18nKey;
51516
+ const map = {
51517
+ "SALE_PURCHASE": "Sale / Purchase of Property",
51518
+ "DEVOLUTION_INHERITANCE": "Inheritance / Succession",
51519
+ "OTHER": "Other"
51520
+ };
51521
+ return map[code] || code;
51522
+ };
51523
+ const tenantId = Digit.ULBService.getCurrentTenantId();
51524
+ const viewDocument = function (fileStoreId) {
51525
+ try {
51526
+ if (!fileStoreId) return Promise.resolve();
51527
+ const _temp = _catch(function () {
51528
+ const stateId = Digit.ULBService.getStateId();
51529
+ return Promise.resolve(window.Digit.UploadServices.Filefetch([fileStoreId], stateId)).then(function (res) {
51530
+ var _res$data;
51531
+ if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data[fileStoreId]) {
51532
+ const fileUrl = res.data[fileStoreId].split(",")[0];
51533
+ window.open(fileUrl, "_blank");
51534
+ }
51535
+ });
51536
+ }, function (err) {
51537
+ console.error("Failed to fetch document", err);
51538
+ });
51539
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
51540
+ } catch (e) {
51541
+ return Promise.reject(e);
51542
+ }
51543
+ };
51544
+ React.useEffect(() => {
51545
+ const relationCode = (relationshipWithExistingConsumer === null || relationshipWithExistingConsumer === void 0 ? void 0 : relationshipWithExistingConsumer.code) || relationshipWithExistingConsumer;
51546
+ if (relationCode && relationCode !== "OTHER") {
51547
+ setFee(100);
51548
+ setSlab("Blood relation slab");
51549
+ } else {
51550
+ setFee(1350);
51551
+ setSlab("Other Slab");
51552
+ }
51553
+ }, [relationshipWithExistingConsumer]);
51554
+ const sectionStyle = {
51555
+ border: "1px solid #e0e0e0",
51556
+ borderRadius: "8px",
51557
+ padding: "16px",
51558
+ marginBottom: "16px"
51559
+ };
51560
+ const labelStyle = {
51561
+ color: "#666",
51562
+ fontSize: "14px",
51563
+ marginBottom: "4px"
51564
+ };
51565
+ const valueStyle = {
51566
+ fontWeight: "bold",
51567
+ fontSize: "16px"
51568
+ };
51569
+ const uploadDocStatusStyle = {
51570
+ fontSize: "14px",
51571
+ fontWeight: "bold"
51572
+ };
51573
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
51574
+ style: {
51575
+ marginBottom: "20px"
51576
+ }
51577
+ }, /*#__PURE__*/React__default.createElement("div", {
51578
+ style: {
51579
+ display: "flex",
51580
+ alignItems: "center",
51581
+ marginBottom: "16px"
51582
+ }
51583
+ }, /*#__PURE__*/React__default.createElement("span", {
51584
+ style: {
51585
+ fontSize: "24px",
51586
+ marginRight: "8px"
51587
+ }
51588
+ }, "\uD83D\uDCCB"), /*#__PURE__*/React__default.createElement("h2", {
51589
+ style: {
51590
+ fontSize: "20px",
51591
+ fontWeight: "700",
51592
+ margin: 0
51593
+ }
51594
+ }, "4. Application Preview & Final Declaration")), /*#__PURE__*/React__default.createElement("div", {
51595
+ style: _extends({}, sectionStyle, {
51596
+ borderLeft: "4px solid #00497e"
51597
+ })
51598
+ }, /*#__PURE__*/React__default.createElement("h3", {
51599
+ style: {
51600
+ fontSize: "16px",
51601
+ fontWeight: "bold",
51602
+ color: "#00497e",
51603
+ marginBottom: "12px"
51604
+ }
51605
+ }, "Property & Connection Summary"), /*#__PURE__*/React__default.createElement("div", {
51606
+ style: {
51607
+ display: "flex",
51608
+ justifyContent: "space-between"
51609
+ }
51610
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51611
+ style: labelStyle
51612
+ }, "Connection No"), /*#__PURE__*/React__default.createElement("div", {
51613
+ style: valueStyle
51614
+ }, connectionNo)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51615
+ style: labelStyle
51616
+ }, "Meter Number"), /*#__PURE__*/React__default.createElement("div", {
51617
+ style: valueStyle
51618
+ }, meterId)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51619
+ style: labelStyle
51620
+ }, "Property ID"), /*#__PURE__*/React__default.createElement("div", {
51621
+ style: valueStyle
51622
+ }, propertyId)))), /*#__PURE__*/React__default.createElement("div", {
51623
+ style: _extends({}, sectionStyle, {
51624
+ borderLeft: "4px solid #f29c1f"
51625
+ })
51626
+ }, /*#__PURE__*/React__default.createElement("h3", {
51627
+ style: {
51628
+ fontSize: "16px",
51629
+ fontWeight: "bold",
51630
+ color: "#f29c1f",
51631
+ marginBottom: "12px"
51632
+ }
51633
+ }, "\uD83D\uDD12 Existing / Previous Owner Details (Masked Information)"), /*#__PURE__*/React__default.createElement("div", {
51634
+ style: {
51635
+ display: "flex",
51636
+ justifyContent: "space-between",
51637
+ marginBottom: "12px"
51638
+ }
51639
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51640
+ style: labelStyle
51641
+ }, "Registered Name:"), /*#__PURE__*/React__default.createElement("div", {
51642
+ style: valueStyle
51643
+ }, oldName)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51644
+ style: labelStyle
51645
+ }, "Meter Number:"), /*#__PURE__*/React__default.createElement("div", {
51646
+ style: valueStyle
51647
+ }, meterId)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51648
+ style: labelStyle
51649
+ }, "Registered Phone:"), /*#__PURE__*/React__default.createElement("div", {
51650
+ style: valueStyle
51651
+ }, oldPhone))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51652
+ style: labelStyle
51653
+ }, "Registered Address:"), /*#__PURE__*/React__default.createElement("div", {
51654
+ style: valueStyle
51655
+ }, oldAddress))), /*#__PURE__*/React__default.createElement("div", {
51656
+ style: _extends({}, sectionStyle, {
51657
+ borderLeft: "4px solid #00497e"
51658
+ })
51659
+ }, /*#__PURE__*/React__default.createElement("h3", {
51660
+ style: {
51661
+ fontSize: "16px",
51662
+ fontWeight: "bold",
51663
+ color: "#00497e",
51664
+ marginBottom: "12px"
51665
+ }
51666
+ }, "\uD83D\uDC64 Transferee (New Owner) Summary"), /*#__PURE__*/React__default.createElement("div", {
51667
+ style: {
51668
+ display: "flex",
51669
+ justifyContent: "space-between"
51670
+ }
51671
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51672
+ style: labelStyle
51673
+ }, "New Owner Name"), /*#__PURE__*/React__default.createElement("div", {
51674
+ style: valueStyle
51675
+ }, proposedNewConsumerName)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51676
+ style: labelStyle
51677
+ }, "Mobile Number"), /*#__PURE__*/React__default.createElement("div", {
51678
+ style: valueStyle
51679
+ }, newOwnerMobileNumber)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51680
+ style: labelStyle
51681
+ }, "Relation Type"), /*#__PURE__*/React__default.createElement("div", {
51682
+ style: valueStyle
51683
+ }, getRelationshipName(relationshipWithExistingConsumer))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51684
+ style: labelStyle
51685
+ }, "Transfer Reason"), /*#__PURE__*/React__default.createElement("div", {
51686
+ style: valueStyle
51687
+ }, getReasonName(reasonForNameChange))))), /*#__PURE__*/React__default.createElement("div", {
51688
+ style: _extends({}, sectionStyle, {
51689
+ borderLeft: "4px solid #17a2b8"
51690
+ })
51691
+ }, /*#__PURE__*/React__default.createElement("h3", {
51692
+ style: {
51693
+ fontSize: "16px",
51694
+ fontWeight: "bold",
51695
+ color: "#17a2b8",
51696
+ marginBottom: "12px"
51697
+ }
51698
+ }, "Uploaded Documents"), /*#__PURE__*/React__default.createElement("div", {
51699
+ style: {
51700
+ display: "grid",
51701
+ gridTemplateColumns: "1fr 1fr 1fr",
51702
+ gap: "16px"
51703
+ }
51704
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51705
+ style: labelStyle
51706
+ }, "Address / Identity Proof"), /*#__PURE__*/React__default.createElement("div", {
51707
+ style: {
51708
+ display: "flex",
51709
+ alignItems: "center",
51710
+ gap: "8px"
51711
+ }
51712
+ }, /*#__PURE__*/React__default.createElement("span", {
51713
+ style: uploadDocStatusStyle
51714
+ }, "\u2713 ", (identityProofType === null || identityProofType === void 0 ? void 0 : identityProofType.i18nKey) || "Document"), identityProofDocumentId && /*#__PURE__*/React__default.createElement("button", {
51715
+ type: "button",
51716
+ onClick: () => viewDocument(identityProofDocumentId),
51717
+ style: {
51718
+ color: "#00497e",
51719
+ background: "none",
51720
+ border: "none",
51721
+ textDecoration: "underline",
51722
+ cursor: "pointer",
51723
+ fontSize: "14px",
51724
+ fontWeight: "bold"
51725
+ }
51726
+ }, "View"))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51727
+ style: labelStyle
51728
+ }, "Document Number"), /*#__PURE__*/React__default.createElement("div", {
51729
+ style: valueStyle
51730
+ }, documentNumber || "NA")), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51731
+ style: labelStyle
51732
+ }, "Reason-Based Proof"), /*#__PURE__*/React__default.createElement("div", {
51733
+ style: {
51734
+ display: "flex",
51735
+ alignItems: "center",
51736
+ gap: "8px"
51737
+ }
51738
+ }, /*#__PURE__*/React__default.createElement("span", {
51739
+ style: uploadDocStatusStyle
51740
+ }, "\u2713 Uploaded"), saleDeedDocumentId && /*#__PURE__*/React__default.createElement("button", {
51741
+ type: "button",
51742
+ onClick: () => viewDocument(saleDeedDocumentId),
51743
+ style: {
51744
+ color: "#00497e",
51745
+ background: "none",
51746
+ border: "none",
51747
+ textDecoration: "underline",
51748
+ cursor: "pointer",
51749
+ fontSize: "14px",
51750
+ fontWeight: "bold"
51751
+ }
51752
+ }, "View"))))), /*#__PURE__*/React__default.createElement("div", {
51753
+ style: _extends({}, sectionStyle, {
51754
+ backgroundColor: "#f2fff5",
51755
+ border: "1px solid #c3e6cb",
51756
+ borderLeft: "4px solid #28a745"
51757
+ })
51758
+ }, /*#__PURE__*/React__default.createElement("h3", {
51759
+ style: {
51760
+ fontSize: "16px",
51761
+ fontWeight: "bold",
51762
+ color: "#28a745",
51763
+ marginBottom: "12px"
51764
+ }
51765
+ }, "\uD83D\uDCB5 Mutation Fee Details (Money to Pay in Mutation)"), /*#__PURE__*/React__default.createElement("div", {
51766
+ style: {
51767
+ display: "flex",
51768
+ justifyContent: "space-between"
51769
+ }
51770
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51771
+ style: labelStyle
51772
+ }, "Mutation Money to Pay:"), /*#__PURE__*/React__default.createElement("div", {
51773
+ style: _extends({}, valueStyle, {
51774
+ color: "#28a745",
51775
+ fontSize: "20px"
51776
+ })
51777
+ }, "\u20B9 ", fee, ".00")), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51778
+ style: labelStyle
51779
+ }, "Fee Status:"), /*#__PURE__*/React__default.createElement("span", {
51780
+ style: {
51781
+ padding: "4px 8px",
51782
+ backgroundColor: "#d1ecf1",
51783
+ color: "#0c5460",
51784
+ borderRadius: "16px",
51785
+ fontSize: "12px",
51786
+ fontWeight: "bold"
51787
+ }
51788
+ }, "PAYABLE POST VERIFICATION")), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
51789
+ style: labelStyle
51790
+ }, "Applicable Slab:"), /*#__PURE__*/React__default.createElement("div", {
51791
+ style: valueStyle
51792
+ }, slab)))), /*#__PURE__*/React__default.createElement("div", {
51793
+ style: {
51794
+ padding: "16px",
51795
+ backgroundColor: "#fffbeb",
51796
+ border: "1px solid #ffeeba",
51797
+ borderRadius: "8px",
51798
+ marginBottom: "24px"
51799
+ }
51800
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CheckBox, {
51801
+ label: "I want to go ahead with submitting this application. I confirm that the details and information provided by me are true and correct to the best of my knowledge.",
51802
+ onChange: e => setAgreed(e.target.checked),
51803
+ checked: agreed
51804
+ })), /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement("button", {
51805
+ type: "button",
51806
+ onClick: onBack,
51807
+ style: {
51808
+ padding: "8px 24px",
51809
+ backgroundColor: "#e0e0e0",
51810
+ border: "none",
51811
+ borderRadius: "4px",
51812
+ cursor: "pointer",
51813
+ fontWeight: "bold",
51814
+ marginRight: "16px"
51815
+ }
51816
+ }, "\u2190 Edit Information"), /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
51817
+ label: isLoading ? "Submitting..." : "Submit Mutation Application",
51818
+ onSubmit: onSubmit,
51819
+ disabled: !agreed || isLoading
51820
+ })));
51821
+ };
51822
+
51823
+ const Step5_Submission = _ref => {
51824
+ let applicationNumber = _ref.applicationNumber,
51825
+ serviceType = _ref.serviceType,
51826
+ t = _ref.t;
51827
+ const history = reactRouterDom.useHistory();
51828
+ const _useState = React.useState(null),
51829
+ showToast = _useState[0],
51830
+ setShowToast = _useState[1];
51831
+ const _useState2 = React.useState(false);
51832
+ const _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSApplicationActions(serviceType);
51833
+ const goHome = () => {
51834
+ history.push("/digit-ui/employee");
51835
+ };
51836
+ const bannerStyle = {
51837
+ backgroundColor: "#fff",
51838
+ border: "1px solid #d4edda",
51839
+ borderTop: "4px solid #28a745",
51840
+ borderRadius: "8px",
51841
+ padding: "20px",
51842
+ display: "flex",
51843
+ justifyContent: "space-between",
51844
+ alignItems: "center",
51845
+ marginBottom: "20px"
51846
+ };
51847
+ const statusPanelStyle = {
51848
+ backgroundColor: "#fff",
51849
+ border: "1px solid #e0e0e0",
51850
+ borderRadius: "8px",
51851
+ padding: "20px"
51852
+ };
51853
+ return /*#__PURE__*/React__default.createElement("div", {
51854
+ style: {
51855
+ padding: "20px 0"
51856
+ }
51857
+ }, /*#__PURE__*/React__default.createElement("div", {
51858
+ style: bannerStyle
51859
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h2", {
51860
+ style: {
51861
+ color: "#28a745",
51862
+ fontSize: "20px",
51863
+ fontWeight: "bold",
51864
+ margin: 0,
51865
+ display: "flex",
51866
+ alignItems: "center"
51867
+ }
51868
+ }, /*#__PURE__*/React__default.createElement("span", {
51869
+ style: {
51870
+ marginRight: "8px"
51871
+ }
51872
+ }, "\u2705"), " Application Submitted Successfully!"), /*#__PURE__*/React__default.createElement("div", {
51873
+ style: {
51874
+ color: "#666",
51875
+ marginTop: "4px"
51876
+ }
51877
+ }, "Application Reference No: ", /*#__PURE__*/React__default.createElement("strong", {
51878
+ style: {
51879
+ color: "#00497e"
51880
+ }
51881
+ }, applicationNumber))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("span", {
51882
+ style: {
51883
+ padding: "6px 12px",
51884
+ backgroundColor: "#fff3cd",
51885
+ color: "#856404",
51886
+ borderRadius: "16px",
51887
+ fontSize: "12px",
51888
+ fontWeight: "bold"
51889
+ }
51890
+ }, "PENDING_APPROVAL_FOR_MUTATION"))), /*#__PURE__*/React__default.createElement("div", {
51891
+ style: statusPanelStyle
51892
+ }, /*#__PURE__*/React__default.createElement("h3", {
51893
+ style: {
51894
+ color: "#00497e",
51895
+ fontSize: "16px",
51896
+ fontWeight: "bold",
51897
+ margin: "0 0 16px 0",
51898
+ display: "flex",
51899
+ alignItems: "center"
51900
+ }
51901
+ }, /*#__PURE__*/React__default.createElement("span", {
51902
+ style: {
51903
+ marginRight: "8px"
51904
+ }
51905
+ }, "\uD83D\uDCCC"), " Current Workflow Status"), /*#__PURE__*/React__default.createElement("hr", {
51906
+ style: {
51907
+ border: "0",
51908
+ borderTop: "1px solid #e0e0e0",
51909
+ margin: "0 0 16px 0"
51910
+ }
51911
+ }), /*#__PURE__*/React__default.createElement("p", {
51912
+ style: {
51913
+ color: "#333",
51914
+ fontSize: "14px",
51915
+ margin: 0
51916
+ }
51917
+ }, "Application has been routed to ", /*#__PURE__*/React__default.createElement("strong", null, "Water Supply Department Verification Officer"), ".")), /*#__PURE__*/React__default.createElement("div", {
51918
+ style: {
51919
+ marginTop: "24px",
51920
+ textAlign: "center"
51921
+ }
51922
+ }, /*#__PURE__*/React__default.createElement("button", {
51923
+ onClick: goHome,
51924
+ style: {
51925
+ padding: "10px 24px",
51926
+ backgroundColor: "#00497e",
51927
+ color: "white",
51928
+ border: "none",
51929
+ borderRadius: "4px",
51930
+ cursor: "pointer",
51931
+ fontWeight: "bold"
51932
+ }
51933
+ }, "Go to Home")), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
51934
+ error: showToast.key === "error",
51935
+ warning: showToast.key === "warning",
51936
+ label: t(showToast.message),
51937
+ onClose: () => setShowToast(null)
51938
+ }));
51939
+ };
51940
+
51941
+ const MutationApplication = () => {
51942
+ var _state, _details$applicationD, _applicationDetails$a, _applicationDetails$a3, _applicationDetails$a4;
51943
+ const _useTranslation = reactI18next.useTranslation(),
51944
+ t = _useTranslation.t;
51945
+ let _useLocation = reactRouterDom.useLocation(),
51946
+ state = _useLocation.state;
51947
+ state = state ? typeof state === "string" ? JSON.parse(state) : state : {};
51948
+ const history = reactRouterDom.useHistory();
51949
+ let filters = getQueryStringParams(location.search);
51950
+ const _useState = React.useState(1),
51951
+ currentStep = _useState[0],
51952
+ setCurrentStep = _useState[1];
51953
+ const _useState2 = React.useState({}),
51954
+ formData = _useState2[0],
51955
+ setFormData = _useState2[1];
51956
+ const _useState3 = React.useState(null),
51957
+ showToast = _useState3[0],
51958
+ setShowToast = _useState3[1];
51959
+ const _useState4 = React.useState(null),
51960
+ generatedAppNo = _useState4[0],
51961
+ setGeneratedAppNo = _useState4[1];
51962
+ const _useState5 = React.useState(false),
51963
+ isSubmitting = _useState5[0],
51964
+ setIsSubmitting = _useState5[1];
51965
+ const _useState6 = React.useState(new Set()),
51966
+ setCompletedSteps = _useState6[1];
50635
51967
  let tenantId = Digit.ULBService.getCurrentTenantId();
50636
51968
  const applicationNumber = filters === null || filters === void 0 ? void 0 : filters.applicationNumber;
50637
51969
  const serviceType = filters === null || filters === void 0 ? void 0 : filters.service;
50638
- const stateId = Digit.ULBService.getStateId();
50639
- let _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(stateId, {}),
50640
- newConfig = _Digit$Hooks$ws$useWS.data,
50641
- isConfigLoading = _Digit$Hooks$ws$useWS.isLoading;
50642
51970
  let details = cloneDeep_1((_state = state) === null || _state === void 0 ? void 0 : _state.data);
50643
- let _Digit$Hooks$ws$useWS2 = Digit.Hooks.ws.useWSDetailsPage(t, tenantId, ((_details = details) === null || _details === void 0 ? void 0 : _details.applicationNo) || applicationNumber, (serviceType === null || serviceType === void 0 ? void 0 : serviceType.toUpperCase()) || ((_details2 = details) === null || _details2 === void 0 ? void 0 : (_details2$application = _details2.applicationData) === null || _details2$application === void 0 ? void 0 : _details2$application.serviceType)),
50644
- applicationDetails = _Digit$Hooks$ws$useWS2.data;
50645
- details = applicationDetails;
50646
- const _useState8 = React.useState(new URLSearchParams(reactRouterDom.useLocation().search).get("propertyId")),
50647
- propertyId = _useState8[0],
50648
- setPropertyId = _useState8[1];
50649
- const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM", {}),
50650
- sessionFormData = _Digit$Hooks$useSessi[0],
50651
- setSessionFormData = _Digit$Hooks$useSessi[1],
50652
- clearSessionFormData = _Digit$Hooks$useSessi[2];
51971
+ let _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSDetailsPage(t, tenantId, (details === null || details === void 0 ? void 0 : details.applicationNo) || applicationNumber, (serviceType === null || serviceType === void 0 ? void 0 : serviceType.toUpperCase()) || (details === null || details === void 0 ? void 0 : (_details$applicationD = details.applicationData) === null || _details$applicationD === void 0 ? void 0 : _details$applicationD.serviceType)),
51972
+ isDetailsLoading = _Digit$Hooks$ws$useWS.isLoading,
51973
+ applicationDetails = _Digit$Hooks$ws$useWS.data;
51974
+ const _useState7 = React.useState(new URLSearchParams(reactRouterDom.useLocation().search).get("propertyId") || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a = applicationDetails.applicationData) === null || _applicationDetails$a === void 0 ? void 0 : _applicationDetails$a.propertyId)),
51975
+ propertyId = _useState7[0];
50653
51976
  const _Digit$Hooks$pt$usePr = Digit.Hooks.pt.usePropertySearch({
50654
51977
  filters: {
50655
51978
  propertyIds: propertyId
@@ -50660,63 +51983,37 @@ const MutationApplication = () => {
50660
51983
  propertyIds: propertyId
50661
51984
  },
50662
51985
  tenantId: tenantId,
50663
- enabled: propertyId && propertyId != "" ? true : false
51986
+ enabled: !!propertyId
50664
51987
  }),
50665
- propertyDetails = _Digit$Hooks$pt$usePr.data;
51988
+ propertyDetails = _Digit$Hooks$pt$usePr.data,
51989
+ isPropertyLoading = _Digit$Hooks$pt$usePr.isLoading;
51990
+ const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM", {}),
51991
+ sessionFormData = _Digit$Hooks$useSessi[0],
51992
+ setSessionFormData = _Digit$Hooks$useSessi[1],
51993
+ clearSessionFormData = _Digit$Hooks$useSessi[2];
50666
51994
  React.useEffect(() => {
50667
- if (!isConfigLoading && newConfig && Array.isArray(newConfig)) {
50668
- const config = cloneDeep_1(newConfig.find(conf => conf.hideInCitizen && conf.isModify));
50669
- if (config) {
50670
- var _config$body;
50671
- config.head = "WS_WATER_AND_SEWERAGE_MUTATION_CONNECTION_LABEL";
50672
- let bodyDetails = [];
50673
- config === null || config === void 0 ? void 0 : (_config$body = config.body) === null || _config$body === void 0 ? void 0 : _config$body.forEach(data => {
50674
- if (data !== null && data !== void 0 && data.isModifyConnection) bodyDetails.push(data);
50675
- });
50676
- bodyDetails.forEach(bdyData => {
50677
- if ((bdyData === null || bdyData === void 0 ? void 0 : bdyData.head) === "WS_COMMON_PROPERTY_DETAILS") {
50678
- bdyData.head = "";
50679
- bdyData.className = "mutation-disabled-section";
50680
- } else if ((bdyData === null || bdyData === void 0 ? void 0 : bdyData.head) === "WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER") {
50681
- bdyData.head = "Specify ownership updates and transfer reason:";
50682
- bdyData.body = [{
50683
- type: "component",
50684
- key: "MutationApplicantDetails",
50685
- component: WSMutationApplicantDetails,
50686
- withoutLabel: true
50687
- }];
50688
- } else {
50689
- bdyData.head = "";
50690
- bdyData.className = "mutation-hidden-section";
51995
+ var _applicationDetails$a2;
51996
+ const fetchAppData = function () {
51997
+ try {
51998
+ const dataToConvert = applicationDetails || details;
51999
+ const _temp = function (_dataToConvert$applic) {
52000
+ if (dataToConvert !== null && dataToConvert !== void 0 && (_dataToConvert$applic = dataToConvert.applicationData) !== null && _dataToConvert$applic !== void 0 && _dataToConvert$applic.id) {
52001
+ var _dataToConvert$applic2;
52002
+ return Promise.resolve(convertApplicationData(dataToConvert, (serviceType === null || serviceType === void 0 ? void 0 : serviceType.toUpperCase()) || (dataToConvert === null || dataToConvert === void 0 ? void 0 : (_dataToConvert$applic2 = dataToConvert.applicationData) === null || _dataToConvert$applic2 === void 0 ? void 0 : _dataToConvert$applic2.serviceType), true, undefined, t)).then(function (convertAppData) {
52003
+ setSessionFormData(prev => _extends({}, prev, convertAppData));
52004
+ sessionStorage.setItem("IsDetailsExists", JSON.stringify(true));
52005
+ });
50691
52006
  }
50692
- });
50693
- config.body = bodyDetails;
50694
- setConfig(config);
52007
+ }();
52008
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
52009
+ } catch (e) {
52010
+ return Promise.reject(e);
50695
52011
  }
52012
+ };
52013
+ if (applicationDetails !== null && applicationDetails !== void 0 && (_applicationDetails$a2 = applicationDetails.applicationData) !== null && _applicationDetails$a2 !== void 0 && _applicationDetails$a2.id && !(sessionFormData !== null && sessionFormData !== void 0 && sessionFormData.applicationData)) {
52014
+ fetchAppData();
50696
52015
  }
50697
- }, [newConfig]);
50698
- React.useEffect(() => {
50699
- var _sessionFormData$cpt, _sessionFormData$cpt$, _sessionFormData$cpt2, _sessionFormData$cpt3;
50700
- !propertyId && (sessionFormData === null || sessionFormData === void 0 ? void 0 : (_sessionFormData$cpt = sessionFormData.cpt) === null || _sessionFormData$cpt === void 0 ? void 0 : (_sessionFormData$cpt$ = _sessionFormData$cpt.details) === null || _sessionFormData$cpt$ === void 0 ? void 0 : _sessionFormData$cpt$.propertyId) && setPropertyId(sessionFormData === null || sessionFormData === void 0 ? void 0 : (_sessionFormData$cpt2 = sessionFormData.cpt) === null || _sessionFormData$cpt2 === void 0 ? void 0 : (_sessionFormData$cpt3 = _sessionFormData$cpt2.details) === null || _sessionFormData$cpt3 === void 0 ? void 0 : _sessionFormData$cpt3.propertyId);
50701
- }, [sessionFormData === null || sessionFormData === void 0 ? void 0 : sessionFormData.cpt]);
50702
- React.useEffect(function () {
50703
- try {
50704
- const IsDetailsExists = sessionStorage.getItem("IsDetailsExists") ? JSON.parse(sessionStorage.getItem("IsDetailsExists")) : false;
50705
- const _temp = function (_details3, _details3$application) {
50706
- if ((_details3 = details) !== null && _details3 !== void 0 && (_details3$application = _details3.applicationData) !== null && _details3$application !== void 0 && _details3$application.id) {
50707
- var _details4, _details4$application;
50708
- return Promise.resolve(convertApplicationData(details, (serviceType === null || serviceType === void 0 ? void 0 : serviceType.toUpperCase()) || ((_details4 = details) === null || _details4 === void 0 ? void 0 : (_details4$application = _details4.applicationData) === null || _details4$application === void 0 ? void 0 : _details4$application.serviceType), true, undefined, t)).then(function (convertAppData) {
50709
- setSessionFormData(prev => _extends({}, prev, convertAppData));
50710
- setAppData(prev => _extends({}, prev, convertAppData));
50711
- sessionStorage.setItem("IsDetailsExists", JSON.stringify(true));
50712
- });
50713
- }
50714
- }();
50715
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
50716
- } catch (e) {
50717
- return Promise.reject(e);
50718
- }
50719
- }, [details, applicationDetails]);
52016
+ }, [applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a3 = applicationDetails.applicationData) === null || _applicationDetails$a3 === void 0 ? void 0 : _applicationDetails$a3.id]);
50720
52017
  React.useEffect(() => {
50721
52018
  var _propertyDetails$Prop;
50722
52019
  if (propertyDetails !== null && propertyDetails !== void 0 && (_propertyDetails$Prop = propertyDetails.Properties) !== null && _propertyDetails$Prop !== void 0 && _propertyDetails$Prop[0]) {
@@ -50730,220 +52027,311 @@ const MutationApplication = () => {
50730
52027
  });
50731
52028
  }
50732
52029
  }, [propertyDetails]);
50733
- React.useEffect(() => {
50734
- var _sessionFormData$Conn, _sessionFormData$Conn2;
50735
- if (sessionFormData !== null && sessionFormData !== void 0 && (_sessionFormData$Conn = sessionFormData.ConnectionDetails) !== null && _sessionFormData$Conn !== void 0 && (_sessionFormData$Conn2 = _sessionFormData$Conn[0]) !== null && _sessionFormData$Conn2 !== void 0 && _sessionFormData$Conn2.applicationNo) {
50736
- setEnabledLoader(false);
50737
- }
50738
- }, [propertyDetails, sessionFormData, sessionFormData === null || sessionFormData === void 0 ? void 0 : sessionFormData.cpt]);
50739
- React.useEffect(() => {
50740
- const timer = setTimeout(() => {
50741
- var _sessionFormData$Conn3, _sessionFormData$Conn4, _sessionFormData$Conn5, _sessionFormData$Conn6, _sessionFormData$Conn7;
50742
- if (isAppDetailsPage) window.location.href = window.location.origin + "/digit-ui/employee/ws/application-details?applicationNumber=" + (sessionFormData === null || sessionFormData === void 0 ? void 0 : (_sessionFormData$Conn3 = sessionFormData.ConnectionDetails) === null || _sessionFormData$Conn3 === void 0 ? void 0 : (_sessionFormData$Conn4 = _sessionFormData$Conn3[0]) === null || _sessionFormData$Conn4 === void 0 ? void 0 : _sessionFormData$Conn4.applicationNo) + "&service=" + (sessionFormData === null || sessionFormData === void 0 ? void 0 : (_sessionFormData$Conn5 = sessionFormData.ConnectionDetails) === null || _sessionFormData$Conn5 === void 0 ? void 0 : (_sessionFormData$Conn6 = _sessionFormData$Conn5[0]) === null || _sessionFormData$Conn6 === void 0 ? void 0 : (_sessionFormData$Conn7 = _sessionFormData$Conn6.serviceName) === null || _sessionFormData$Conn7 === void 0 ? void 0 : _sessionFormData$Conn7.toUpperCase());
50743
- }, 3000);
50744
- return () => clearTimeout(timer);
50745
- }, [isAppDetailsPage]);
50746
52030
  const _Digit$Hooks$ws$useWa = Digit.Hooks.ws.useWaterCreateAPI("WATER"),
50747
52031
  waterMutation = _Digit$Hooks$ws$useWa.mutate;
50748
- const _Digit$Hooks$ws$useWS3 = Digit.Hooks.ws.useWSApplicationActions("WATER");
50749
52032
  const _Digit$Hooks$ws$useWa2 = Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),
50750
52033
  sewerageMutation = _Digit$Hooks$ws$useWa2.mutate;
50751
- const _Digit$Hooks$ws$useWS4 = Digit.Hooks.ws.useWSApplicationActions("SEWERAGE");
50752
- const onFormValueChange = (setValue, formData, formState) => {
50753
- var _formData$cpt, _formData$cpt$details;
50754
- const updatedData = _extends({}, sessionFormData, formData);
50755
- if (!lodash.isEqual(sessionFormData, updatedData)) {
50756
- setSessionFormData(updatedData);
50757
- }
50758
- if (Object.keys(formState.errors).length > 0 && Object.keys(formState.errors).length == 1 && formState.errors["owners"] && Object.values(formState.errors["owners"].type).filter(ob => ob.type === "required").length == 0 && !(formData !== null && formData !== void 0 && (_formData$cpt = formData.cpt) !== null && _formData$cpt !== void 0 && (_formData$cpt$details = _formData$cpt.details) !== null && _formData$cpt$details !== void 0 && _formData$cpt$details.propertyId)) setSubmitValve(true);else setSubmitValve(!Object.keys(formState.errors).length);
52034
+ const _Digit$Hooks$ws$useWS2 = Digit.Hooks.ws.useWSApplicationActions("WATER"),
52035
+ waterUpdateMutation = _Digit$Hooks$ws$useWS2.mutate;
52036
+ const _Digit$Hooks$ws$useWS3 = Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),
52037
+ sewerageUpdateMutation = _Digit$Hooks$ws$useWS3.mutate;
52038
+ const handleNextStep2 = data => {
52039
+ setFormData(prev => _extends({}, prev, data));
52040
+ setCompletedSteps(prev => new Set([...prev, 2]));
52041
+ setCurrentStep(3);
50759
52042
  };
50760
- const onSubmit = function (data) {
52043
+ const handleNextStep3 = data => {
52044
+ setFormData(prev => _extends({}, prev, data));
52045
+ setCompletedSteps(prev => new Set([...prev, 3]));
52046
+ setCurrentStep(4);
52047
+ };
52048
+ const submitApplication = function () {
50761
52049
  try {
50762
- var _finalData$cpt, _propertyDetails$Prop3;
50763
- let finalData = _extends({}, sessionFormData, data);
50764
- if (!(finalData !== null && finalData !== void 0 && (_finalData$cpt = finalData.cpt) !== null && _finalData$cpt !== void 0 && _finalData$cpt.id) && !(propertyDetails !== null && propertyDetails !== void 0 && (_propertyDetails$Prop3 = propertyDetails.Properties) !== null && _propertyDetails$Prop3 !== void 0 && _propertyDetails$Prop3[0])) {
50765
- var _finalData$cpt2;
50766
- if (!(finalData !== null && finalData !== void 0 && (_finalData$cpt2 = finalData.cpt) !== null && _finalData$cpt2 !== void 0 && _finalData$cpt2.details) || !propertyDetails) {
50767
- setShowToast({
50768
- key: "error",
50769
- message: "ERR_INVALID_PROPERTY_ID"
50770
- });
50771
- return Promise.resolve();
52050
+ setIsSubmitting(true);
52051
+ const _temp2 = _catch(function () {
52052
+ var _finalData$cpt;
52053
+ let finalData = _extends({}, sessionFormData);
52054
+ if (!(finalData !== null && finalData !== void 0 && (_finalData$cpt = finalData.cpt) !== null && _finalData$cpt !== void 0 && _finalData$cpt.details)) {
52055
+ var _propertyDetails$Prop3;
52056
+ finalData.cpt = {
52057
+ details: propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop3 = propertyDetails.Properties) === null || _propertyDetails$Prop3 === void 0 ? void 0 : _propertyDetails$Prop3[0]
52058
+ };
50772
52059
  }
50773
- }
50774
- const _temp7 = function () {
50775
- if (!canSubmit) {
50776
- setShowToast({
50777
- warning: true,
50778
- message: "PLEASE_FILL_MANDATORY_DETAILS"
50779
- });
50780
- setTimeout(() => {
50781
- setShowToast(false);
50782
- }, 3000);
50783
- } else {
50784
- var _finalData$cpt3;
50785
- if (!(finalData !== null && finalData !== void 0 && (_finalData$cpt3 = finalData.cpt) !== null && _finalData$cpt3 !== void 0 && _finalData$cpt3.details)) {
50786
- var _propertyDetails$Prop4;
50787
- finalData.cpt = {
50788
- details: propertyDetails === null || propertyDetails === void 0 ? void 0 : (_propertyDetails$Prop4 = propertyDetails.Properties) === null || _propertyDetails$Prop4 === void 0 ? void 0 : _propertyDetails$Prop4[0]
50789
- };
52060
+ finalData.MutationApplicantDetails = {
52061
+ proposedNewConsumerName: formData.proposedNewConsumerName,
52062
+ newOwnerMobileNumber: formData.newOwnerMobileNumber,
52063
+ newOwnerEmailAddress: formData.newOwnerEmailAddress,
52064
+ reasonForNameChange: formData.reasonForNameChange,
52065
+ relationshipWithExistingConsumer: formData.relationshipWithExistingConsumer,
52066
+ saleDeedDocumentId: formData.saleDeedDocumentId,
52067
+ identityProofType: formData.identityProofType,
52068
+ identityProofDocumentId: formData.identityProofDocumentId,
52069
+ documentNumber: formData.documentNumber
52070
+ };
52071
+ if (finalData !== null && finalData !== void 0 && finalData.MutationApplicantDetails) {
52072
+ var _finalData$Connection;
52073
+ const mutDetails = finalData.MutationApplicantDetails;
52074
+ const existingHolder = (finalData === null || finalData === void 0 ? void 0 : (_finalData$Connection = finalData.ConnectionHolderDetails) === null || _finalData$Connection === void 0 ? void 0 : _finalData$Connection[0]) || {};
52075
+ finalData.ConnectionHolderDetails = [_extends({}, existingHolder, {
52076
+ name: mutDetails.proposedNewConsumerName || existingHolder.name,
52077
+ mobileNumber: mutDetails.newOwnerMobileNumber || existingHolder.mobileNumber,
52078
+ emailId: mutDetails.newOwnerEmailAddress || existingHolder.emailId,
52079
+ sameAsOwnerDetails: false
52080
+ })];
52081
+ }
52082
+ const sessionDetails = sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS") ? JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")) : {};
52083
+ return Promise.resolve(convertModifyApplicationDetails(finalData, sessionDetails, "INITIATE")).then(function (convertAppData) {
52084
+ if (!convertAppData.dateEffectiveFrom) {
52085
+ convertAppData.dateEffectiveFrom = Date.now();
50790
52086
  }
50791
52087
  if (finalData !== null && finalData !== void 0 && finalData.MutationApplicantDetails) {
50792
- var _finalData$Connection;
52088
+ var _mutDetails$reasonFor;
50793
52089
  const mutDetails = finalData.MutationApplicantDetails;
50794
- const existingHolder = (finalData === null || finalData === void 0 ? void 0 : (_finalData$Connection = finalData.ConnectionHolderDetails) === null || _finalData$Connection === void 0 ? void 0 : _finalData$Connection[0]) || {};
50795
- finalData.ConnectionHolderDetails = [_extends({}, existingHolder, {
50796
- name: mutDetails.proposedNewConsumerName || existingHolder.name,
50797
- mobileNumber: mutDetails.newOwnerMobileNumber || existingHolder.mobileNumber,
50798
- emailId: mutDetails.newOwnerEmailAddress || existingHolder.emailId,
50799
- sameAsOwnerDetails: false
50800
- })];
50801
- }
50802
- const details = sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS") ? JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")) : {};
50803
- return Promise.resolve(convertModifyApplicationDetails(finalData, details, "APPLY_MUTATION")).then(function (convertAppData) {
50804
- function _temp6() {
50805
- const _temp4 = function () {
50806
- if (serviceType !== "WATER") {
50807
- const _temp3 = function () {
50808
- if (sewerageMutation) {
50809
- setIsEnableLoader(true);
50810
- return Promise.resolve(sewerageMutation(reqDetails, {
50811
- onError: (error, variables) => {
50812
- var _error$response, _error$response$data, _error$response$data$, _error$response$data$2, _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
50813
- setIsEnableLoader(false);
50814
- setShowToast({
50815
- key: "error",
50816
- message: error !== null && error !== void 0 && (_error$response = error.response) !== null && _error$response !== void 0 && (_error$response$data = _error$response.data) !== null && _error$response$data !== void 0 && (_error$response$data$ = _error$response$data.Errors) !== null && _error$response$data$ !== void 0 && (_error$response$data$2 = _error$response$data$[0]) !== null && _error$response$data$2 !== void 0 && _error$response$data$2.message ? error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : (_error$response2$data2 = _error$response2$data.Errors) === null || _error$response2$data2 === void 0 ? void 0 : (_error$response2$data3 = _error$response2$data2[0]) === null || _error$response2$data3 === void 0 ? void 0 : _error$response2$data3.message : error
50817
- });
50818
- setTimeout(closeToastOfError, 5000);
50819
- },
50820
- onSuccess: function (data, variables) {
50821
- try {
50822
- var _data$SewerageConnect, _data$SewerageConnect2;
50823
- clearSessionFormData();
50824
- history.push("/digit-ui/employee/ws/ws-response?applicationNumber1=" + (data === null || data === void 0 ? void 0 : (_data$SewerageConnect = data.SewerageConnections) === null || _data$SewerageConnect === void 0 ? void 0 : (_data$SewerageConnect2 = _data$SewerageConnect[0]) === null || _data$SewerageConnect2 === void 0 ? void 0 : _data$SewerageConnect2.applicationNo));
50825
- return Promise.resolve();
50826
- } catch (e) {
50827
- return Promise.reject(e);
50828
- }
50829
- }
50830
- })).then(function () {});
50831
- }
50832
- }();
50833
- if (_temp3 && _temp3.then) return _temp3.then(function () {});
50834
- }
50835
- }();
50836
- if (_temp4 && _temp4.then) return _temp4.then(function () {});
52090
+ if (!convertAppData.additionalDetails) convertAppData.additionalDetails = {};
52091
+ if (mutDetails.reasonForNameChange) convertAppData.additionalDetails.reasonForNameChange = ((_mutDetails$reasonFor = mutDetails.reasonForNameChange) === null || _mutDetails$reasonFor === void 0 ? void 0 : _mutDetails$reasonFor.code) || mutDetails.reasonForNameChange;
52092
+ if (mutDetails.relationshipWithExistingConsumer) {
52093
+ var _mutDetails$relations;
52094
+ const relationCode = ((_mutDetails$relations = mutDetails.relationshipWithExistingConsumer) === null || _mutDetails$relations === void 0 ? void 0 : _mutDetails$relations.code) || mutDetails.relationshipWithExistingConsumer;
52095
+ convertAppData.additionalDetails.relationshipWithExistingConsumer = relationCode;
52096
+ convertAppData.additionalDetails.isBloodRelation = relationCode !== "OTHER";
50837
52097
  }
50838
- if (finalData !== null && finalData !== void 0 && finalData.MutationApplicantDetails) {
50839
- var _mutDetails$reasonFor;
50840
- const mutDetails = finalData.MutationApplicantDetails;
50841
- if (!convertAppData.additionalDetails) convertAppData.additionalDetails = {};
50842
- if (mutDetails.reasonForNameChange) convertAppData.additionalDetails.reasonForNameChange = ((_mutDetails$reasonFor = mutDetails.reasonForNameChange) === null || _mutDetails$reasonFor === void 0 ? void 0 : _mutDetails$reasonFor.code) || mutDetails.reasonForNameChange;
50843
- if (mutDetails.relationshipWithExistingConsumer) {
50844
- var _mutDetails$relations;
50845
- const relationCode = ((_mutDetails$relations = mutDetails.relationshipWithExistingConsumer) === null || _mutDetails$relations === void 0 ? void 0 : _mutDetails$relations.code) || mutDetails.relationshipWithExistingConsumer;
50846
- convertAppData.additionalDetails.relationshipWithExistingConsumer = relationCode;
50847
- convertAppData.additionalDetails.isBloodRelation = relationCode !== "OTHER";
50848
- }
50849
- if (mutDetails.saleDeedDocumentId) {
50850
- convertAppData.additionalDetails.saleDeedDocumentId = mutDetails.saleDeedDocumentId;
50851
- if (!convertAppData.documents) convertAppData.documents = [];
50852
- convertAppData.documents.push({
50853
- documentType: "REGISTERED_SALE_DEED",
50854
- fileStoreId: mutDetails.saleDeedDocumentId,
50855
- documentUid: mutDetails.saleDeedDocumentId
52098
+ if (mutDetails.saleDeedDocumentId) {
52099
+ convertAppData.additionalDetails.saleDeedDocumentId = mutDetails.saleDeedDocumentId;
52100
+ if (!convertAppData.documents) convertAppData.documents = [];
52101
+ convertAppData.documents.push({
52102
+ documentType: "REGISTERED_SALE_DEED",
52103
+ fileStoreId: mutDetails.saleDeedDocumentId,
52104
+ documentUid: mutDetails.saleDeedDocumentId,
52105
+ status: "ACTIVE"
52106
+ });
52107
+ }
52108
+ if (mutDetails.identityProofDocumentId) {
52109
+ var _mutDetails$identityP;
52110
+ if (!convertAppData.documents) convertAppData.documents = [];
52111
+ convertAppData.documents.push({
52112
+ documentType: ((_mutDetails$identityP = mutDetails.identityProofType) === null || _mutDetails$identityP === void 0 ? void 0 : _mutDetails$identityP.code) || "IDENTITY_PROOF",
52113
+ fileStoreId: mutDetails.identityProofDocumentId,
52114
+ documentUid: mutDetails.documentNumber || mutDetails.identityProofDocumentId,
52115
+ documentNumber: mutDetails.documentNumber,
52116
+ status: "ACTIVE"
52117
+ });
52118
+ }
52119
+ }
52120
+ convertAppData.applicationType = serviceType == "WATER" ? "MUTATION_WATER_CONNECTION" : "MUTATION_SEWERAGE_CONNECTION";
52121
+ const reqDetails = serviceType == "WATER" ? {
52122
+ WaterConnection: convertAppData,
52123
+ reconnectRequest: false,
52124
+ disconnectRequest: false
52125
+ } : {
52126
+ SewerageConnection: convertAppData,
52127
+ reconnectRequest: false,
52128
+ disconnectRequest: false
52129
+ };
52130
+ const mutation = serviceType == "WATER" ? waterMutation : sewerageMutation;
52131
+ return Promise.resolve(mutation(reqDetails, {
52132
+ onError: error => {
52133
+ var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
52134
+ setIsSubmitting(false);
52135
+ setShowToast({
52136
+ key: "error",
52137
+ message: (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.Errors) === null || _error$response$data$ === void 0 ? void 0 : (_error$response$data$2 = _error$response$data$[0]) === null || _error$response$data$2 === void 0 ? void 0 : _error$response$data$2.message) || "Failed to submit application"
52138
+ });
52139
+ },
52140
+ onSuccess: data => {
52141
+ var _data$response, _data$response$data;
52142
+ if (data instanceof Error || data !== null && data !== void 0 && data.isAxiosError || data !== null && data !== void 0 && (_data$response = data.response) !== null && _data$response !== void 0 && (_data$response$data = _data$response.data) !== null && _data$response$data !== void 0 && _data$response$data.Errors) {
52143
+ var _data$response2, _data$response2$data, _apiErrors$;
52144
+ setIsSubmitting(false);
52145
+ const apiErrors = data === null || data === void 0 ? void 0 : (_data$response2 = data.response) === null || _data$response2 === void 0 ? void 0 : (_data$response2$data = _data$response2.data) === null || _data$response2$data === void 0 ? void 0 : _data$response2$data.Errors;
52146
+ const errorMessage = (apiErrors === null || apiErrors === void 0 ? void 0 : (_apiErrors$ = apiErrors[0]) === null || _apiErrors$ === void 0 ? void 0 : _apiErrors$.message) || (data === null || data === void 0 ? void 0 : data.message) || "Failed to submit application";
52147
+ setShowToast({
52148
+ key: "error",
52149
+ message: errorMessage
50856
52150
  });
52151
+ return;
50857
52152
  }
50858
- }
50859
- convertAppData.applicationType = serviceType == "WATER" ? "MUTATION_WATER_CONNECTION" : "MUTATION_SEWERAGE_CONNECTION";
50860
- const reqDetails = serviceType == "WATER" ? {
50861
- WaterConnection: convertAppData,
50862
- reconnectRequest: false,
50863
- disconnectRequest: false
50864
- } : {
50865
- SewerageConnection: convertAppData,
50866
- reconnectRequest: false,
50867
- disconnectRequest: false
50868
- };
50869
- const _temp5 = function () {
50870
- if (serviceType == "WATER") {
50871
- const _temp2 = function () {
50872
- if (waterMutation) {
50873
- setIsEnableLoader(true);
50874
- return Promise.resolve(waterMutation(reqDetails, {
50875
- onError: (error, variables) => {
50876
- var _error$response3, _error$response3$data, _error$response3$data2, _error$response4, _error$response4$data, _error$response4$data2;
50877
- setIsEnableLoader(false);
50878
- setShowToast({
50879
- key: "error",
50880
- message: error !== null && error !== void 0 && (_error$response3 = error.response) !== null && _error$response3 !== void 0 && (_error$response3$data = _error$response3.data) !== null && _error$response3$data !== void 0 && (_error$response3$data2 = _error$response3$data.Errors) !== null && _error$response3$data2 !== void 0 && _error$response3$data2[0].message ? error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : (_error$response4$data = _error$response4.data) === null || _error$response4$data === void 0 ? void 0 : (_error$response4$data2 = _error$response4$data.Errors) === null || _error$response4$data2 === void 0 ? void 0 : _error$response4$data2[0].message : error
50881
- });
50882
- setTimeout(closeToastOfError, 5000);
50883
- },
50884
- onSuccess: function (data, variables) {
50885
- try {
50886
- var _data$WaterConnection, _data$WaterConnection2;
50887
- clearSessionFormData();
50888
- history.push("/digit-ui/employee/ws/ws-response?applicationNumber=" + (data === null || data === void 0 ? void 0 : (_data$WaterConnection = data.WaterConnection) === null || _data$WaterConnection === void 0 ? void 0 : (_data$WaterConnection2 = _data$WaterConnection[0]) === null || _data$WaterConnection2 === void 0 ? void 0 : _data$WaterConnection2.applicationNo));
50889
- return Promise.resolve();
50890
- } catch (e) {
50891
- return Promise.reject(e);
50892
- }
50893
- }
50894
- })).then(function () {});
52153
+ if (data !== null && data !== void 0 && data.Errors && data.Errors.length > 0) {
52154
+ setIsSubmitting(false);
52155
+ setShowToast({
52156
+ key: "error",
52157
+ message: data.Errors[0].message || "Failed to submit application"
52158
+ });
52159
+ } else {
52160
+ var _data$WaterConnection, _data$SewerageConnect, _Digit, _Digit$Customizations, _Digit$Customizations2;
52161
+ const updateMutation = serviceType == "WATER" ? waterUpdateMutation : sewerageUpdateMutation;
52162
+ const createdConnection = serviceType == "WATER" ? data === null || data === void 0 ? void 0 : (_data$WaterConnection = data.WaterConnection) === null || _data$WaterConnection === void 0 ? void 0 : _data$WaterConnection[0] : data === null || data === void 0 ? void 0 : (_data$SewerageConnect = data.SewerageConnections) === null || _data$SewerageConnect === void 0 ? void 0 : _data$SewerageConnect[0];
52163
+ let updatePayload = _extends({}, createdConnection, {
52164
+ dateEffectiveFrom: (createdConnection === null || createdConnection === void 0 ? void 0 : createdConnection.dateEffectiveFrom) || Date.now(),
52165
+ processInstance: _extends({}, createdConnection === null || createdConnection === void 0 ? void 0 : createdConnection.processInstance, {
52166
+ action: "APPLY_MUTATION"
52167
+ })
52168
+ });
52169
+ if ((_Digit = Digit) !== null && _Digit !== void 0 && (_Digit$Customizations = _Digit.Customizations) !== null && _Digit$Customizations !== void 0 && (_Digit$Customizations2 = _Digit$Customizations.WS) !== null && _Digit$Customizations2 !== void 0 && _Digit$Customizations2.customiseUpdatePayloadOfWS) {
52170
+ updatePayload = Digit.Customizations.WS.customiseUpdatePayloadOfWS(createdConnection, updatePayload, serviceType);
52171
+ }
52172
+ let reqDetailsUpdate = serviceType == "WATER" ? {
52173
+ WaterConnection: updatePayload,
52174
+ reconnectRequest: false,
52175
+ disconnectRequest: false
52176
+ } : {
52177
+ SewerageConnection: updatePayload,
52178
+ reconnectRequest: false,
52179
+ disconnectRequest: false
52180
+ };
52181
+ updateMutation(reqDetailsUpdate, {
52182
+ onError: error => {
52183
+ var _error$response2, _error$response2$data, _error$response2$data2, _error$response2$data3;
52184
+ setIsSubmitting(false);
52185
+ setShowToast({
52186
+ key: "error",
52187
+ message: (error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : (_error$response2$data2 = _error$response2$data.Errors) === null || _error$response2$data2 === void 0 ? void 0 : (_error$response2$data3 = _error$response2$data2[0]) === null || _error$response2$data3 === void 0 ? void 0 : _error$response2$data3.message) || "Failed to update workflow"
52188
+ });
52189
+ },
52190
+ onSuccess: updateData => {
52191
+ var _updateData$response, _updateData$response$, _updateData$WaterConn, _updateData$WaterConn2, _updateData$SewerageC, _updateData$SewerageC2;
52192
+ setIsSubmitting(false);
52193
+ if (updateData instanceof Error || updateData !== null && updateData !== void 0 && updateData.isAxiosError || updateData !== null && updateData !== void 0 && (_updateData$response = updateData.response) !== null && _updateData$response !== void 0 && (_updateData$response$ = _updateData$response.data) !== null && _updateData$response$ !== void 0 && _updateData$response$.Errors) {
52194
+ var _updateData$response2, _updateData$response3, _apiErrors$2;
52195
+ const apiErrors = updateData === null || updateData === void 0 ? void 0 : (_updateData$response2 = updateData.response) === null || _updateData$response2 === void 0 ? void 0 : (_updateData$response3 = _updateData$response2.data) === null || _updateData$response3 === void 0 ? void 0 : _updateData$response3.Errors;
52196
+ const errorMessage = (apiErrors === null || apiErrors === void 0 ? void 0 : (_apiErrors$2 = apiErrors[0]) === null || _apiErrors$2 === void 0 ? void 0 : _apiErrors$2.message) || (updateData === null || updateData === void 0 ? void 0 : updateData.message) || "Failed to update workflow";
52197
+ setShowToast({
52198
+ key: "error",
52199
+ message: errorMessage
52200
+ });
52201
+ return;
52202
+ }
52203
+ if (updateData !== null && updateData !== void 0 && updateData.Errors && updateData.Errors.length > 0) {
52204
+ setShowToast({
52205
+ key: "error",
52206
+ message: updateData.Errors[0].message || "Failed to update workflow"
52207
+ });
52208
+ return;
52209
+ }
52210
+ clearSessionFormData();
52211
+ const newAppNo = serviceType == "WATER" ? updateData === null || updateData === void 0 ? void 0 : (_updateData$WaterConn = updateData.WaterConnection) === null || _updateData$WaterConn === void 0 ? void 0 : (_updateData$WaterConn2 = _updateData$WaterConn[0]) === null || _updateData$WaterConn2 === void 0 ? void 0 : _updateData$WaterConn2.applicationNo : updateData === null || updateData === void 0 ? void 0 : (_updateData$SewerageC = updateData.SewerageConnections) === null || _updateData$SewerageC === void 0 ? void 0 : (_updateData$SewerageC2 = _updateData$SewerageC[0]) === null || _updateData$SewerageC2 === void 0 ? void 0 : _updateData$SewerageC2.applicationNo;
52212
+ setGeneratedAppNo(newAppNo);
52213
+ setCurrentStep(5);
50895
52214
  }
50896
- }();
50897
- if (_temp2 && _temp2.then) return _temp2.then(function () {});
52215
+ });
50898
52216
  }
50899
- }();
50900
- return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
50901
- });
50902
- }
50903
- }();
50904
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
52217
+ }
52218
+ })).then(function () {});
52219
+ });
52220
+ }, function (e) {
52221
+ console.error(e);
52222
+ setIsSubmitting(false);
52223
+ setShowToast({
52224
+ key: "error",
52225
+ message: "Failed to submit application"
52226
+ });
52227
+ });
52228
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
50905
52229
  } catch (e) {
50906
52230
  return Promise.reject(e);
50907
52231
  }
50908
52232
  };
50909
- const closeToastOfError = () => {
50910
- setShowToast(null);
50911
- };
50912
- const closeToast = () => {
50913
- setShowToast(null);
52233
+ const handleTimelineSelect = (route, index) => {
52234
+ const targetStep = index + 1;
52235
+ if (targetStep < currentStep) {
52236
+ setCurrentStep(targetStep);
52237
+ return;
52238
+ }
52239
+ if (targetStep === currentStep) return;
52240
+ if (targetStep > currentStep) {
52241
+ setShowToast({
52242
+ key: "warning",
52243
+ message: "Please complete Step " + currentStep + " before proceeding to Step " + targetStep + "."
52244
+ });
52245
+ }
50914
52246
  };
50915
- if (enabledLoader || isEnableLoader || isConfigLoading) {
52247
+ const timelineConfig = [{
52248
+ sectionId: "application",
52249
+ route: "application-selection",
52250
+ actions: "Existing Connection"
52251
+ }, {
52252
+ sectionId: "applicant",
52253
+ route: "applicant-details",
52254
+ actions: "New Consumer Details"
52255
+ }, {
52256
+ sectionId: "documents",
52257
+ route: "documents",
52258
+ actions: "Documents"
52259
+ }, {
52260
+ sectionId: "Review",
52261
+ route: "review",
52262
+ actions: "Preview"
52263
+ }].map((step, index) => _extends({}, step, {
52264
+ timeLine: [{
52265
+ actions: step.actions,
52266
+ currentStep: index + 1
52267
+ }]
52268
+ }));
52269
+ if (isDetailsLoading || propertyId && isPropertyLoading) {
50916
52270
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
50917
52271
  }
50918
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("style", null, "\n .mutation-disabled-section { pointer-events: none; opacity: 0.8; margin-top: -24px !important; }\n .mutation-hidden-section { display: none !important; margin: 0 !important; padding: 0 !important; height: 0 !important; overflow: hidden !important; border: 0 !important; }\n .mutation-hidden-section + hr { display: none !important; margin: 0 !important; }\n .mutation-hidden-section + .break-line { display: none !important; margin: 0 !important; }\n "), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Header, null, t(config.head)), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSubHeader, null, t("WS_MUTATION_DETAILS")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.StatusTable, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50919
- label: t("WS_MYCONNECTIONS_APPLICATION_NO"),
50920
- text: (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a = applicationDetails.applicationData) === null || _applicationDetails$a === void 0 ? void 0 : _applicationDetails$a.applicationNo) || "NA"
50921
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50922
- label: t("WS_CONNECTION_CATEGORY"),
50923
- text: (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a2 = applicationDetails.applicationData) === null || _applicationDetails$a2 === void 0 ? void 0 : _applicationDetails$a2.connectionCategory) || "NA"
50924
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50925
- label: t("WS_PROPERTY_ID_LABEL"),
50926
- text: (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a3 = applicationDetails.applicationData) === null || _applicationDetails$a3 === void 0 ? void 0 : _applicationDetails$a3.propertyId) || propertyId || "NA"
50927
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50928
- label: t("WS_APPLICATION_ID"),
50929
- text: (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a4 = applicationDetails.applicationData) === null || _applicationDetails$a4 === void 0 ? void 0 : _applicationDetails$a4.id) || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a5 = applicationDetails.applicationData) === null || _applicationDetails$a5 === void 0 ? void 0 : _applicationDetails$a5.connectionNo) || "NA"
50930
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Row, {
50931
- label: t("WS_CONNECTION_DATE"),
50932
- text: applicationDetails !== null && applicationDetails !== void 0 && (_applicationDetails$a6 = applicationDetails.applicationData) !== null && _applicationDetails$a6 !== void 0 && _applicationDetails$a6.connectionExecutionDate ? Digit.DateUtils.ConvertEpochToDate(applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a7 = applicationDetails.applicationData) === null || _applicationDetails$a7 === void 0 ? void 0 : _applicationDetails$a7.connectionExecutionDate) : "NA"
50933
- }))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormComposer, {
50934
- config: config.body,
50935
- userType: "employee",
50936
- onFormValueChange: onFormValueChange,
50937
- label: t("CS_COMMON_SUBMIT"),
50938
- onSubmit: onSubmit,
50939
- defaultValues: sessionFormData,
50940
- appData: appData
52272
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
52273
+ className: "employee-form-section-wrapper"
52274
+ }, currentStep !== 5 && /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
52275
+ config: timelineConfig,
52276
+ currentActiveIndex: currentStep - 1,
52277
+ showFinalStep: false,
52278
+ onSelect: handleTimelineSelect
52279
+ }), /*#__PURE__*/React__default.createElement("div", {
52280
+ style: {
52281
+ flex: "1",
52282
+ minWidth: 0
52283
+ }
52284
+ }, currentStep === 1 && /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(Step1_ExistingConnection, {
52285
+ t: t,
52286
+ applicationDetails: applicationDetails,
52287
+ propertyId: propertyId
52288
+ }), /*#__PURE__*/React__default.createElement("div", {
52289
+ style: {
52290
+ display: "flex",
52291
+ justifyContent: "flex-end"
52292
+ }
52293
+ }, /*#__PURE__*/React__default.createElement("button", {
52294
+ onClick: () => {
52295
+ setCompletedSteps(prev => new Set([...prev, 1]));
52296
+ setCurrentStep(2);
52297
+ },
52298
+ style: {
52299
+ padding: "10px 24px",
52300
+ backgroundColor: "#00497e",
52301
+ color: "white",
52302
+ border: "none",
52303
+ borderRadius: "4px",
52304
+ cursor: "pointer",
52305
+ fontWeight: "bold"
52306
+ }
52307
+ }, "Proceed to New Consumer Details \u2192"))), currentStep === 2 && /*#__PURE__*/React__default.createElement(Step2_NewConsumerDetails, {
52308
+ t: t,
52309
+ defaultValues: formData,
52310
+ onNext: handleNextStep2,
52311
+ onBack: () => setCurrentStep(1)
52312
+ }), currentStep === 3 && /*#__PURE__*/React__default.createElement(Step3_UploadDocuments, {
52313
+ t: t,
52314
+ defaultValues: formData,
52315
+ onNext: handleNextStep3,
52316
+ onBack: () => setCurrentStep(2)
52317
+ }), currentStep === 4 && /*#__PURE__*/React__default.createElement(Step4_Preview, {
52318
+ t: t,
52319
+ formData: formData,
52320
+ applicationDetails: applicationDetails,
52321
+ onBack: () => setCurrentStep(3),
52322
+ onSubmit: submitApplication,
52323
+ isLoading: isSubmitting
52324
+ }), currentStep === 5 && /*#__PURE__*/React__default.createElement(Step5_Submission, {
52325
+ t: t,
52326
+ applicationNumber: generatedAppNo,
52327
+ serviceType: serviceType || (applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$a4 = applicationDetails.applicationData) === null || _applicationDetails$a4 === void 0 ? void 0 : _applicationDetails$a4.serviceType)
50941
52328
  }), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
50942
- isDleteBtn: true,
50943
- error: (showToast === null || showToast === void 0 ? void 0 : showToast.key) === "error" ? true : false,
52329
+ error: (showToast === null || showToast === void 0 ? void 0 : showToast.key) === "error",
52330
+ warning: (showToast === null || showToast === void 0 ? void 0 : showToast.key) === "warning",
50944
52331
  label: t(showToast === null || showToast === void 0 ? void 0 : showToast.message),
50945
- onClose: closeToast
50946
- }));
52332
+ onClose: () => setShowToast(null),
52333
+ isDleteBtn: true
52334
+ }))));
50947
52335
  };
50948
52336
 
50949
52337
  const getPath$5 = (path, params) => {