@djb25/digit-ui-module-ws 1.0.98 → 1.0.99

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.
@@ -23393,6 +23393,13 @@ const WSRestorationForm = _ref => {
23393
23393
  };
23394
23394
  const handleProceedToDemand = function () {
23395
23395
  try {
23396
+ if (!ownershipDocument) {
23397
+ setError({
23398
+ key: "error",
23399
+ message: "Please upload property ownership proof."
23400
+ });
23401
+ return Promise.resolve();
23402
+ }
23396
23403
  setEstimateLoading(true);
23397
23404
  return Promise.resolve(_finallyRethrows(function () {
23398
23405
  return _catch(function () {
@@ -23421,16 +23428,18 @@ const WSRestorationForm = _ref => {
23421
23428
  return Promise.resolve(Digit.WSService.wsCalculationEstimate(estimatePayload, serviceType === "WATER" ? "WS" : "SW")).then(function (estimateResponse) {
23422
23429
  var _estimateResponse$Cal, _estimateResponse$Cal2;
23423
23430
  const taxHeadEstimates = (estimateResponse === null || estimateResponse === void 0 ? void 0 : (_estimateResponse$Cal = estimateResponse.Calculation) === null || _estimateResponse$Cal === void 0 ? void 0 : (_estimateResponse$Cal2 = _estimateResponse$Cal[0]) === null || _estimateResponse$Cal2 === void 0 ? void 0 : _estimateResponse$Cal2.taxHeadEstimates) || [];
23424
- const reconnectionFee = taxHeadEstimates.find(item => {
23431
+ const allowedFees = ["WS_RECONNECTION_FEE", "SW_RECONNECTION_FEE", "WS_DISCONNECTION_FEE", "SW_DISCONNECTION_FEE"];
23432
+ const validFees = taxHeadEstimates.filter(item => {
23425
23433
  const code = String((item === null || item === void 0 ? void 0 : item.taxHeadCode) || "").toUpperCase();
23426
- return code === "WS_RECONNECTION_FEE" || code === "SW_RECONNECTION_FEE" || code === "WS_REOPENING_FEE" || code === "SW_REOPENING_FEE";
23434
+ return allowedFees.includes(code);
23427
23435
  });
23428
- if (!reconnectionFee) throw new Error("Reconnection fee was not returned by the estimate service");
23436
+ if (validFees.length === 0) throw new Error("Reconnection fee was not returned by the estimate service");
23437
+ const totalAmt = validFees.reduce((acc, curr) => acc + Number((curr === null || curr === void 0 ? void 0 : curr.estimateAmount) ?? (curr === null || curr === void 0 ? void 0 : curr.amount) ?? 0), 0);
23429
23438
  setEstimateData({
23430
23439
  Calculation: [{
23431
23440
  ...estimateResponse.Calculation[0],
23432
- taxHeadEstimates: [reconnectionFee],
23433
- totalAmount: Number((reconnectionFee === null || reconnectionFee === void 0 ? void 0 : reconnectionFee.estimateAmount) ?? (reconnectionFee === null || reconnectionFee === void 0 ? void 0 : reconnectionFee.amount) ?? 0)
23441
+ taxHeadEstimates: validFees,
23442
+ totalAmount: totalAmt
23434
23443
  }]
23435
23444
  });
23436
23445
  setShowDemandClearance(true);
@@ -23496,10 +23505,23 @@ const WSRestorationForm = _ref => {
23496
23505
  const ownershipProof = ownershipDocument ? [{
23497
23506
  fileStoreId: ownershipDocument.fileStoreId,
23498
23507
  documentUid: ownershipDocument.fileStoreId,
23499
- documentType: "PROPERTY_OWNERSHIP_PROOF"
23508
+ documentType: "PROPERTY_OWNERSHIP_PROOF",
23509
+ status: "ACTIVE",
23510
+ id: null
23500
23511
  }] : [];
23501
23512
  const docs = [...existingDocuments, ...ownershipProof];
23502
23513
  const reconnectionValidation = (latestApplicationData === null || latestApplicationData === void 0 ? void 0 : latestApplicationData.reconnectionValidation) || {};
23514
+ const baseAdditionalDetails = {
23515
+ ...(submittedConnection === null || submittedConnection === void 0 ? void 0 : submittedConnection.additionalDetails),
23516
+ ...reconnectionValidation,
23517
+ isAltered: reconnectionValidation.isAltered ?? isAltered,
23518
+ isModified: reconnectionValidation.isModified ?? isModified,
23519
+ ownershipProofFileStoreId: reconnectionValidation.ownershipProofFileStoreId || (ownershipDocument === null || ownershipDocument === void 0 ? void 0 : ownershipDocument.fileStoreId)
23520
+ };
23521
+ const finalDwellingUnits = reconnectionValidation.dwellingUnits ?? dwellingUnits;
23522
+ if (finalDwellingUnits) baseAdditionalDetails.dwellingUnits = finalDwellingUnits;
23523
+ const finalExtendedArea = reconnectionValidation.extendedArea ?? extendedArea;
23524
+ if (finalExtendedArea) baseAdditionalDetails.extendedArea = finalExtendedArea;
23503
23525
  const createPayload = {
23504
23526
  [connectionKey]: {
23505
23527
  ...submittedConnection,
@@ -23515,15 +23537,7 @@ const WSRestorationForm = _ref => {
23515
23537
  water: serviceType === "WATER",
23516
23538
  sewerage: serviceType === "SEWERAGE",
23517
23539
  service: serviceType === "WATER" ? "Water" : "Sewerage",
23518
- additionalDetails: {
23519
- ...(submittedConnection === null || submittedConnection === void 0 ? void 0 : submittedConnection.additionalDetails),
23520
- ...reconnectionValidation,
23521
- isAltered: reconnectionValidation.isAltered ?? isAltered,
23522
- isModified: reconnectionValidation.isModified ?? isModified,
23523
- dwellingUnits: reconnectionValidation.dwellingUnits ?? dwellingUnits,
23524
- extendedArea: reconnectionValidation.extendedArea ?? extendedArea,
23525
- ownershipProofFileStoreId: reconnectionValidation.ownershipProofFileStoreId || (ownershipDocument === null || ownershipDocument === void 0 ? void 0 : ownershipDocument.fileStoreId)
23526
- },
23540
+ additionalDetails: baseAdditionalDetails,
23527
23541
  processInstance: {
23528
23542
  ...(connection === null || connection === void 0 ? void 0 : connection.processInstance),
23529
23543
  action: "INITIATE",
@@ -33022,8 +33036,8 @@ const WSFeeEstimation = _ref => {
33022
33036
  const [values, setValues] = useState(wsAdditionalDetails.additionalDetails.values ? wsAdditionalDetails.additionalDetails.values : []);
33023
33037
  const isDisconnectionExecuted = (wsAdditionalDetails === null || wsAdditionalDetails === void 0 ? void 0 : (_wsAdditionalDetails$2 = wsAdditionalDetails.additionalDetails) === null || _wsAdditionalDetails$2 === void 0 ? void 0 : (_wsAdditionalDetails$3 = _wsAdditionalDetails$2.appDetails) === null || _wsAdditionalDetails$3 === void 0 ? void 0 : _wsAdditionalDetails$3.applicationStatus) === "DISCONNECTION_EXECUTED";
33024
33038
  const billRows = (billDetails === null || billDetails === void 0 ? void 0 : (_billDetails$billDeta = billDetails.billDetails) === null || _billDetails$billDeta === void 0 ? void 0 : (_billDetails$billDeta2 = _billDetails$billDeta[0]) === null || _billDetails$billDeta2 === void 0 ? void 0 : _billDetails$billDeta2.billAccountDetails) || (billDetails === null || billDetails === void 0 ? void 0 : billDetails.taxHeadEstimates) || [];
33025
- const disconnectionFee = billRows.find(row => (row === null || row === void 0 ? void 0 : row.taxHeadCode) === "WS_DISCONNECTION_FEE");
33026
- const displayedValues = onlyDisconnectionFee || isDisconnectionExecuted ? values.filter(value => (value === null || value === void 0 ? void 0 : value.title) === "WS_DISCONNECTION_FEE") : values;
33039
+ const disconnectionFee = billRows.find(row => (row === null || row === void 0 ? void 0 : row.taxHeadCode) === "WS_DISCONNECTION_FEE" || (row === null || row === void 0 ? void 0 : row.taxHeadCode) === "SW_DISCONNECTION_FEE");
33040
+ const displayedValues = onlyDisconnectionFee || isDisconnectionExecuted ? values.filter(value => (value === null || value === void 0 ? void 0 : value.title) === "WS_DISCONNECTION_FEE" || (value === null || value === void 0 ? void 0 : value.title) === "SW_DISCONNECTION_FEE") : values;
33027
33041
  const displayedTotalAmount = onlyDisconnectionFee || isDisconnectionExecuted ? (disconnectionFee === null || disconnectionFee === void 0 ? void 0 : disconnectionFee.amount) ?? (disconnectionFee === null || disconnectionFee === void 0 ? void 0 : disconnectionFee.estimateAmount) ?? 0 : billDetails === null || billDetails === void 0 ? void 0 : billDetails.totalAmount;
33028
33042
  const displayedIsPaid = isDisconnectionExecuted ? (disconnectionFee === null || disconnectionFee === void 0 ? void 0 : disconnectionFee.status) === "PAID" : isPaid;
33029
33043
  const stateCode = Digit.ULBService.getStateId();
@@ -51198,12 +51212,15 @@ const ApplicationDetails = props => {
51198
51212
  }
51199
51213
  try {
51200
51214
  if (moduleCode !== null && moduleCode !== void 0 && moduleCode.includes("WS")) {
51201
- setShowConfirmation({
51202
- data,
51203
- nocData,
51204
- isOBPS
51205
- });
51206
- return Promise.resolve();
51215
+ const actionStr = (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.action) || "";
51216
+ if (actionStr === "INITIATE" || actionStr === "EXECUTE_DISCONNECTION") {
51217
+ setShowConfirmation({
51218
+ data,
51219
+ nocData,
51220
+ isOBPS
51221
+ });
51222
+ return Promise.resolve();
51223
+ }
51207
51224
  }
51208
51225
  return executeSubmitAction(data, nocData, isOBPS);
51209
51226
  } catch (e) {