@djb25/digit-ui-module-wt 1.0.57 → 1.0.58

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.
@@ -27844,6 +27844,27 @@ const EmergencyFixedPointRequestDetails = ({
27844
27844
  }
27845
27845
  })();
27846
27846
  }, [file]);
27847
+ useEffect(() => {
27848
+ if (!waterType && WaterTypeData !== null && WaterTypeData !== void 0 && WaterTypeData.length) {
27849
+ const drinkableOption = WaterTypeData.find(data => {
27850
+ var _data$code, _data$code2;
27851
+ return data.code === "Drinkable" || ((_data$code = data.code) === null || _data$code === void 0 ? void 0 : _data$code.toUpperCase()) === "DRINKABLE" || ((_data$code2 = data.code) === null || _data$code2 === void 0 ? void 0 : _data$code2.toUpperCase()) === "DRINKING_WATER";
27852
+ });
27853
+ if (drinkableOption) {
27854
+ setWaterType({
27855
+ i18nKey: `${drinkableOption.code}`,
27856
+ code: `${drinkableOption.code}`,
27857
+ value: `${drinkableOption.code}`
27858
+ });
27859
+ } else {
27860
+ setWaterType({
27861
+ i18nKey: `${WaterTypeData[0].code}`,
27862
+ code: `${WaterTypeData[0].code}`,
27863
+ value: `${WaterTypeData[0].code}`
27864
+ });
27865
+ }
27866
+ }
27867
+ }, [WaterTypeData, waterType]);
27847
27868
  const goNext = () => {
27848
27869
  let requestDetails = formData.requestDetails;
27849
27870
  let request = {
@@ -28739,9 +28760,13 @@ const WTEmergencyFixedPointCreate = () => {
28739
28760
  paramsRef.current = newParams;
28740
28761
  }
28741
28762
  } else {
28763
+ const {
28764
+ silent,
28765
+ ...restData
28766
+ } = data;
28742
28767
  const updatedValue = {
28743
28768
  ...currentParams[key],
28744
- ...data
28769
+ ...restData
28745
28770
  };
28746
28771
  let isDifferent = true;
28747
28772
  try {
@@ -29015,24 +29040,18 @@ const EmergencyFixedPointApplicantDetails = ({
29015
29040
  i18nKey: "COMMON_FATHER"
29016
29041
  }];
29017
29042
  const goNext = () => {
29018
- let owner = formData.owner;
29019
- let finalApplicantName = "";
29020
- if ((isExistingFixedPoint === null || isExistingFixedPoint === void 0 ? void 0 : isExistingFixedPoint.code) === "YES") {
29021
- var _fixedPoint$applicant;
29022
- finalApplicantName = (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant = fixedPoint.applicantDetail) === null || _fixedPoint$applicant === void 0 ? void 0 : _fixedPoint$applicant.name) || (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "";
29023
- } else {
29024
- finalApplicantName = typeof fixedPoint === "string" ? fixedPoint : (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "";
29025
- }
29043
+ var _fixedPoint$applicant, _fixedPoint$applicant2, _fixedPoint$applicant3, _fixedPoint$applicant4;
29044
+ let owner = formData.owner || {};
29026
29045
  let applicantDetails = {
29027
29046
  ...owner,
29028
- applicantName: finalApplicantName,
29029
- mobileNumber,
29047
+ applicantName: (isExistingFixedPoint === null || isExistingFixedPoint === void 0 ? void 0 : isExistingFixedPoint.code) === "YES" ? (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant = fixedPoint.applicantDetail) === null || _fixedPoint$applicant === void 0 ? void 0 : _fixedPoint$applicant.name) || (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "" : typeof fixedPoint === "string" ? fixedPoint : (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "",
29048
+ mobileNumber: (isExistingFixedPoint === null || isExistingFixedPoint === void 0 ? void 0 : isExistingFixedPoint.code) === "YES" ? (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant2 = fixedPoint.applicantDetail) === null || _fixedPoint$applicant2 === void 0 ? void 0 : _fixedPoint$applicant2.mobileNumber) || mobileNumber || "" : mobileNumber || "",
29049
+ alternateNumber: (isExistingFixedPoint === null || isExistingFixedPoint === void 0 ? void 0 : isExistingFixedPoint.code) === "YES" ? (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant3 = fixedPoint.applicantDetail) === null || _fixedPoint$applicant3 === void 0 ? void 0 : _fixedPoint$applicant3.alternateNumber) || alternateNumber || "" : alternateNumber || "",
29050
+ emailId: (isExistingFixedPoint === null || isExistingFixedPoint === void 0 ? void 0 : isExistingFixedPoint.code) === "YES" ? (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant4 = fixedPoint.applicantDetail) === null || _fixedPoint$applicant4 === void 0 ? void 0 : _fixedPoint$applicant4.emailId) || emailId || "" : emailId || "",
29030
29051
  gender,
29031
29052
  dateOfBirth,
29032
- alternateNumber,
29033
29053
  relationShipType,
29034
29054
  guardianName,
29035
- emailId,
29036
29055
  fixedPoint,
29037
29056
  isExistingFixedPoint
29038
29057
  };
@@ -29046,12 +29065,30 @@ const EmergencyFixedPointApplicantDetails = ({
29046
29065
  onSelect(config.key, applicantDetails, false);
29047
29066
  }
29048
29067
  };
29068
+ const normalizeForCompare = val => {
29069
+ if (val === null || val === undefined || val === "") return "";
29070
+ if (typeof val === "object") {
29071
+ if (val.code !== undefined) return val.code;
29072
+ if (val.uuid !== undefined) return val.uuid;
29073
+ if (val.id !== undefined) return val.id;
29074
+ try {
29075
+ return JSON.stringify(val);
29076
+ } catch (e) {
29077
+ return String(val);
29078
+ }
29079
+ }
29080
+ return String(val);
29081
+ };
29049
29082
  const lastSentValue = React.useRef(null);
29050
29083
  React.useEffect(() => {
29084
+ const hasUserData = fixedPoint || mobileNumber || emailId || alternateNumber;
29085
+ if (!hasUserData) {
29086
+ return;
29087
+ }
29051
29088
  let finalApplicantName = "";
29052
29089
  if ((isExistingFixedPoint === null || isExistingFixedPoint === void 0 ? void 0 : isExistingFixedPoint.code) === "YES") {
29053
- var _fixedPoint$applicant2;
29054
- finalApplicantName = (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant2 = fixedPoint.applicantDetail) === null || _fixedPoint$applicant2 === void 0 ? void 0 : _fixedPoint$applicant2.name) || (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "";
29090
+ var _fixedPoint$applicant5;
29091
+ finalApplicantName = (fixedPoint === null || fixedPoint === void 0 ? void 0 : (_fixedPoint$applicant5 = fixedPoint.applicantDetail) === null || _fixedPoint$applicant5 === void 0 ? void 0 : _fixedPoint$applicant5.name) || (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "";
29055
29092
  } else {
29056
29093
  finalApplicantName = typeof fixedPoint === "string" ? fixedPoint : (fixedPoint === null || fixedPoint === void 0 ? void 0 : fixedPoint.name) || "";
29057
29094
  }
@@ -29067,23 +29104,37 @@ const EmergencyFixedPointApplicantDetails = ({
29067
29104
  fixedPoint,
29068
29105
  isExistingFixedPoint
29069
29106
  };
29070
- let isDifferent = true;
29071
- try {
29072
- isDifferent = JSON.stringify(lastSentValue.current) !== JSON.stringify(applicantDetails);
29073
- } catch (e) {
29074
- isDifferent = Object.keys(applicantDetails).some(k => {
29075
- var _lastSentValue$curren;
29076
- return ((_lastSentValue$curren = lastSentValue.current) === null || _lastSentValue$curren === void 0 ? void 0 : _lastSentValue$curren[k]) !== applicantDetails[k];
29077
- });
29107
+ let isDifferent = false;
29108
+ if (!lastSentValue.current) {
29109
+ isDifferent = true;
29110
+ } else {
29111
+ for (const key of Object.keys(applicantDetails)) {
29112
+ if (normalizeForCompare(lastSentValue.current[key]) !== normalizeForCompare(applicantDetails[key])) {
29113
+ isDifferent = true;
29114
+ break;
29115
+ }
29116
+ }
29078
29117
  }
29079
- if (isDifferent) {
29118
+ const parentOwner = (formData === null || formData === void 0 ? void 0 : formData.owner) || {};
29119
+ let isDifferentFromParent = false;
29120
+ for (const key of Object.keys(applicantDetails)) {
29121
+ const localVal = normalizeForCompare(applicantDetails[key]);
29122
+ const parentVal = normalizeForCompare(parentOwner[key]);
29123
+ if (localVal !== parentVal) {
29124
+ if (!localVal && parentVal) {
29125
+ continue;
29126
+ }
29127
+ isDifferentFromParent = true;
29128
+ }
29129
+ }
29130
+ if (isDifferent || isDifferentFromParent) {
29080
29131
  lastSentValue.current = applicantDetails;
29081
29132
  onSelect(config.key, {
29082
29133
  ...applicantDetails,
29083
29134
  silent: true
29084
29135
  }, false);
29085
29136
  }
29086
- }, [fixedPoint, isExistingFixedPoint, mobileNumber, gender, dateOfBirth, alternateNumber, relationShipType, guardianName, emailId, onSelect, config.key]);
29137
+ }, [fixedPoint, isExistingFixedPoint, mobileNumber, gender, dateOfBirth, alternateNumber, relationShipType, guardianName, emailId, onSelect, config.key, formData === null || formData === void 0 ? void 0 : formData.owner]);
29087
29138
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormStep, {
29088
29139
  config: config,
29089
29140
  onSelect: goNext,