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