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

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
@@ -1324,7 +1324,8 @@ const updatePayloadOfWSRestoration = function (data, type) {
1324
1324
  payload.processInstance = {
1325
1325
  ...payload.processInstance,
1326
1326
  businessService: type === "WATER" ? "WSReconnection" : "SWReconnection",
1327
- action: "SUBMIT_APPLICATION"
1327
+ action: "SUBMIT_APPLICATION",
1328
+ moduleName: "ws-services"
1328
1329
  };
1329
1330
  return payload;
1330
1331
  });
@@ -23367,10 +23368,11 @@ const WSRestorationForm = _ref => {
23367
23368
  var _event$target, _event$target$files;
23368
23369
  const file = event === null || event === void 0 ? void 0 : (_event$target = event.target) === null || _event$target === void 0 ? void 0 : (_event$target$files = _event$target.files) === null || _event$target$files === void 0 ? void 0 : _event$target$files[0];
23369
23370
  if (!file) return Promise.resolve();
23370
- if (file.size > 5242880 || file.type && file.type !== "application/pdf") {
23371
+ const allowedMimeTypes = ["application/pdf", "image/jpeg", "image/jpg"];
23372
+ if (file.size > 5242880 || file.type && !allowedMimeTypes.includes(file.type)) {
23371
23373
  setError({
23372
23374
  key: "error",
23373
- message: "Only PDF files up to 5MB are allowed"
23375
+ message: "Only PDF, JPEG, or JPG files up to 5MB are allowed"
23374
23376
  });
23375
23377
  return Promise.resolve();
23376
23378
  }
@@ -23394,75 +23396,36 @@ const WSRestorationForm = _ref => {
23394
23396
  return Promise.reject(e);
23395
23397
  }
23396
23398
  };
23397
- const handleProceedToDemand = function () {
23398
- try {
23399
- setEstimateLoading(true);
23400
- return Promise.resolve(_finallyRethrows(function () {
23401
- return _catch(function () {
23402
- const serviceType = String((connection === null || connection === void 0 ? void 0 : connection.serviceType) || (connection === null || connection === void 0 ? void 0 : connection.service) || "WATER").toUpperCase() === "SEWERAGE" ? "SEWERAGE" : "WATER";
23403
- const connectionKey = serviceType === "WATER" ? "waterConnection" : "sewerageConnection";
23404
- const estimateConnection = {
23405
- ...connection,
23406
- applicationType: serviceType === "WATER" ? "WATER_RECONNECTION" : "SEWERAGE_RECONNECTION",
23407
- dateEffectiveFrom: Date.now(),
23408
- isdisconnection: false,
23409
- isDisconnectionTemporary: true,
23410
- reconnectionReason: "RECONNECTION",
23411
- disconnectionReason: "",
23412
- water: serviceType === "WATER",
23413
- sewerage: serviceType === "SEWERAGE",
23414
- service: serviceType === "WATER" ? "Water" : "Sewerage"
23415
- };
23416
- const estimatePayload = {
23417
- CalculationCriteria: [{
23418
- applicationNo: estimateConnection === null || estimateConnection === void 0 ? void 0 : estimateConnection.applicationNo,
23419
- tenantId: (estimateConnection === null || estimateConnection === void 0 ? void 0 : estimateConnection.tenantId) || tenantId,
23420
- [connectionKey]: estimateConnection
23421
- }],
23422
- isconnectionCalculation: false
23423
- };
23424
- return Promise.resolve(Digit.WSService.wsCalculationEstimate(estimatePayload, serviceType === "WATER" ? "WS" : "SW")).then(function (estimateResponse) {
23425
- var _estimateResponse$Cal, _estimateResponse$Cal2;
23426
- 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 => {
23428
- 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";
23430
- });
23431
- if (!reconnectionFee) throw new Error("Reconnection fee was not returned by the estimate service");
23432
- setEstimateData({
23433
- Calculation: [{
23434
- ...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)
23437
- }]
23438
- });
23439
- setShowDemandClearance(true);
23440
- Digit.SessionStorage.set("WS_DISCONNECTION", {
23441
- ...applicationData,
23442
- reconnectionValidation: {
23443
- isAltered,
23444
- isModified,
23445
- dwellingUnits,
23446
- extendedArea,
23447
- ownershipProofFileStoreId: ownershipDocument === null || ownershipDocument === void 0 ? void 0 : ownershipDocument.fileStoreId
23448
- }
23449
- });
23450
- });
23451
- }, function (estimateError) {
23452
- var _estimateError$respon, _estimateError$respon2, _estimateError$respon3, _estimateError$respon4;
23453
- setError({
23454
- key: "error",
23455
- message: (estimateError === null || estimateError === void 0 ? void 0 : (_estimateError$respon = estimateError.response) === null || _estimateError$respon === void 0 ? void 0 : (_estimateError$respon2 = _estimateError$respon.data) === null || _estimateError$respon2 === void 0 ? void 0 : (_estimateError$respon3 = _estimateError$respon2.Errors) === null || _estimateError$respon3 === void 0 ? void 0 : (_estimateError$respon4 = _estimateError$respon3[0]) === null || _estimateError$respon4 === void 0 ? void 0 : _estimateError$respon4.message) || "Unable to calculate reconnection demand"
23456
- });
23457
- });
23458
- }, function (_wasThrown, _result3) {
23459
- setEstimateLoading(false);
23460
- if (_wasThrown) throw _result3;
23461
- return _result3;
23462
- }));
23463
- } catch (e) {
23464
- return Promise.reject(e);
23399
+ const handleProceedToDemand = () => {
23400
+ if (!ownershipDocument) {
23401
+ setError({
23402
+ key: "error",
23403
+ message: "Please upload property ownership proof."
23404
+ });
23405
+ return;
23465
23406
  }
23407
+ const staticFee = {
23408
+ taxHeadCode: "WS_RECONNECTION_FEE",
23409
+ estimateAmount: 250,
23410
+ amount: 250
23411
+ };
23412
+ setEstimateData({
23413
+ Calculation: [{
23414
+ taxHeadEstimates: [staticFee],
23415
+ totalAmount: 250
23416
+ }]
23417
+ });
23418
+ setShowDemandClearance(true);
23419
+ Digit.SessionStorage.set("WS_DISCONNECTION", {
23420
+ ...applicationData,
23421
+ reconnectionValidation: {
23422
+ isAltered,
23423
+ isModified,
23424
+ dwellingUnits,
23425
+ extendedArea,
23426
+ ownershipProofFileStoreId: ownershipDocument === null || ownershipDocument === void 0 ? void 0 : ownershipDocument.fileStoreId
23427
+ }
23428
+ });
23466
23429
  };
23467
23430
  const executeMutation = (mutation, payload) => new Promise((resolve, reject) => mutation(payload, {
23468
23431
  onSuccess: resolve,
@@ -23499,10 +23462,23 @@ const WSRestorationForm = _ref => {
23499
23462
  const ownershipProof = ownershipDocument ? [{
23500
23463
  fileStoreId: ownershipDocument.fileStoreId,
23501
23464
  documentUid: ownershipDocument.fileStoreId,
23502
- documentType: "PROPERTY_OWNERSHIP_PROOF"
23465
+ documentType: "PROPERTY_OWNERSHIP_PROOF",
23466
+ status: "ACTIVE",
23467
+ id: null
23503
23468
  }] : [];
23504
23469
  const docs = [...existingDocuments, ...ownershipProof];
23505
23470
  const reconnectionValidation = (latestApplicationData === null || latestApplicationData === void 0 ? void 0 : latestApplicationData.reconnectionValidation) || {};
23471
+ const baseAdditionalDetails = {
23472
+ ...(submittedConnection === null || submittedConnection === void 0 ? void 0 : submittedConnection.additionalDetails),
23473
+ ...reconnectionValidation,
23474
+ isAltered: reconnectionValidation.isAltered ?? isAltered,
23475
+ isModified: reconnectionValidation.isModified ?? isModified,
23476
+ ownershipProofFileStoreId: reconnectionValidation.ownershipProofFileStoreId || (ownershipDocument === null || ownershipDocument === void 0 ? void 0 : ownershipDocument.fileStoreId)
23477
+ };
23478
+ const finalDwellingUnits = reconnectionValidation.dwellingUnits ?? dwellingUnits;
23479
+ if (finalDwellingUnits) baseAdditionalDetails.dwellingUnits = finalDwellingUnits;
23480
+ const finalExtendedArea = reconnectionValidation.extendedArea ?? extendedArea;
23481
+ if (finalExtendedArea) baseAdditionalDetails.extendedArea = finalExtendedArea;
23506
23482
  const createPayload = {
23507
23483
  [connectionKey]: {
23508
23484
  ...submittedConnection,
@@ -23518,19 +23494,12 @@ const WSRestorationForm = _ref => {
23518
23494
  water: serviceType === "WATER",
23519
23495
  sewerage: serviceType === "SEWERAGE",
23520
23496
  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
- },
23497
+ additionalDetails: baseAdditionalDetails,
23530
23498
  processInstance: {
23531
23499
  ...(connection === null || connection === void 0 ? void 0 : connection.processInstance),
23532
23500
  action: "INITIATE",
23533
- businessService: serviceType === "WATER" ? "WSReconnection" : "SWReconnection"
23501
+ businessService: serviceType === "WATER" ? "WSReconnection" : "SWReconnection",
23502
+ moduleName: "ws-services"
23534
23503
  },
23535
23504
  channel: (user === null || user === void 0 ? void 0 : user.toUpperCase()) === "CITIZEN" ? "CITIZEN" : "CFC_COUNTER"
23536
23505
  },
@@ -23660,8 +23629,8 @@ const WSRestorationForm = _ref => {
23660
23629
  flex: 1,
23661
23630
  padding: "12px 16px",
23662
23631
  borderRadius: "14px",
23663
- border: selected ? "1px solid #4b35f5" : "1px solid #d5deea",
23664
- background: selected ? "#4b35f5" : "#fff",
23632
+ border: selected ? "1px solid linear-gradient(135deg,#1f5fa8,#0b2e5b)" : "1px solid #d5deea",
23633
+ background: selected ? "linear-gradient(135deg,#1f5fa8,#0b2e5b)" : "#fff",
23665
23634
  color: selected ? "#fff" : "#172b4d",
23666
23635
  fontWeight: 700,
23667
23636
  cursor: "pointer"
@@ -23704,11 +23673,10 @@ const WSRestorationForm = _ref => {
23704
23673
  }
23705
23674
  }, "Upload Property Ownership Proof (Registry / Sale Deed)"), /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
23706
23675
  id: "reconnection-ownership-proof",
23707
- accept: ".pdf",
23708
23676
  buttonType: "button",
23709
23677
  onUpload: handleOwnershipUpload,
23710
23678
  onDelete: () => setOwnershipDocument(null),
23711
- message: (ownershipDocument === null || ownershipDocument === void 0 ? void 0 : ownershipDocument.fileName) || "Drag & drop your property deed PDF here or click to browse from files (Max 5MB)"
23679
+ message: (ownershipDocument === null || ownershipDocument === void 0 ? void 0 : ownershipDocument.fileName) || "Drag & drop your file here or click to browse (PDF, JPEG, JPG — Max 5MB)"
23712
23680
  }))), /*#__PURE__*/React__default.createElement("div", {
23713
23681
  style: {
23714
23682
  background: "#f7f9fc",
@@ -33025,8 +32993,8 @@ const WSFeeEstimation = _ref => {
33025
32993
  const [values, setValues] = React.useState(wsAdditionalDetails.additionalDetails.values ? wsAdditionalDetails.additionalDetails.values : []);
33026
32994
  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
32995
  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;
32996
+ 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");
32997
+ 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
32998
  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
32999
  const displayedIsPaid = isDisconnectionExecuted ? (disconnectionFee === null || disconnectionFee === void 0 ? void 0 : disconnectionFee.status) === "PAID" : isPaid;
33032
33000
  const stateCode = Digit.ULBService.getStateId();
@@ -51201,12 +51169,15 @@ const ApplicationDetails = props => {
51201
51169
  }
51202
51170
  try {
51203
51171
  if (moduleCode !== null && moduleCode !== void 0 && moduleCode.includes("WS")) {
51204
- setShowConfirmation({
51205
- data,
51206
- nocData,
51207
- isOBPS
51208
- });
51209
- return Promise.resolve();
51172
+ const actionStr = (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.action) || "";
51173
+ if (actionStr === "INITIATE" || actionStr === "EXECUTE_DISCONNECTION") {
51174
+ setShowConfirmation({
51175
+ data,
51176
+ nocData,
51177
+ isOBPS
51178
+ });
51179
+ return Promise.resolve();
51180
+ }
51210
51181
  }
51211
51182
  return executeSubmitAction(data, nocData, isOBPS);
51212
51183
  } catch (e) {
@@ -57075,6 +57046,7 @@ const MutationApplication = () => {
57075
57046
  }
57076
57047
  }
57077
57048
  convertAppData.applicationType = resolvedServiceType === "WATER" ? "MUTATION_WATER_CONNECTION" : "MUTATION_SEWERAGE_CONNECTION";
57049
+ delete convertAppData.dueVerification;
57078
57050
  if (isEditFlow) {
57079
57051
  var _applicationDetails$a6, _applicationDetails$a7, _updatePayload, _updatePayload$docume, _Digit, _Digit$Customizations, _Digit$Customizations2;
57080
57052
  let updatePayload = {