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

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.
@@ -17454,10 +17454,9 @@ const UploadFileDigiLocker = props => {
17454
17454
  let TokenReq = {
17455
17455
  authToken: digiLockerToken
17456
17456
  };
17457
- const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
17458
17457
  return Promise.resolve(Digit.DigiLockerService.issueDoc({
17459
17458
  TokenReq
17460
- }, tenantId)).then(function (res1) {
17459
+ })).then(function (res1) {
17461
17460
  if (!res1 || !res1.IssuedDoc) {
17462
17461
  setShowToast({
17463
17462
  error: true,
@@ -17470,20 +17469,68 @@ const UploadFileDigiLocker = props => {
17470
17469
  const code = props.documentType.toUpperCase();
17471
17470
  if (code.includes("AADHAAR") || code.includes("AADHAR")) doctype = "ADHAR";else if (code.includes("DRIVING") || code.includes("DRVLC")) doctype = "DRVLC";else if (code.includes("PAN")) doctype = "PANCR";else if (code.includes("VOTER")) doctype = "VOTER";
17472
17471
  }
17473
- let uri = res1.IssuedDoc.filter(item => item.doctype === doctype);
17474
- const _temp = function () {
17472
+ const DOCTYPE_ALIASES = {
17473
+ ADHAR: ["ADHAR", "AADHAAR", "AADHAR"],
17474
+ DRVLC: ["DRVLC", "DRIVING"],
17475
+ PANCR: ["PANCR", "PANCH", "PAN"],
17476
+ VOTER: ["VOTER", "VOTERID"]
17477
+ };
17478
+ const aliases = DOCTYPE_ALIASES[doctype] || [doctype];
17479
+ let uri = res1.IssuedDoc.filter(item => aliases.some(alias => item.doctype === alias));
17480
+ const _temp5 = function () {
17475
17481
  if ((uri === null || uri === void 0 ? void 0 : uri.length) > 0) {
17482
+ const uriStr = uri[0].uri || "";
17483
+ const parts = uriStr.split("-");
17484
+ const documentNumber = parts.length > 1 ? parts[parts.length - 1] : "";
17485
+ if (documentNumber && props !== null && props !== void 0 && props.onDocumentNumber) {
17486
+ props.onDocumentNumber(documentNumber);
17487
+ }
17476
17488
  let TokenReqNew = {
17477
17489
  authToken: digiLockerToken,
17478
- id: uri[0].uri
17490
+ id: uriStr
17479
17491
  };
17480
- const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
17481
17492
  return Promise.resolve(Digit.DigiLockerService.uri({
17482
17493
  TokenReq: TokenReqNew
17483
- }, tenantId)).then(function (res2) {
17484
- let c = new Blob([res2]);
17485
- let filename = doctype + "_" + (uri[0].name || "document") + ".pdf";
17486
- convertToFile(e, c, filename);
17494
+ })).then(function (res2) {
17495
+ function _temp4() {
17496
+ let filename = doctype + "_" + (uri[0].name || "document") + ".pdf";
17497
+ if (blobData) convertToFile(e, blobData, filename);else setShowToast({
17498
+ error: true,
17499
+ label: "Failed to read document from DigiLocker."
17500
+ });
17501
+ }
17502
+ let blobData;
17503
+ const _temp3 = function () {
17504
+ if (typeof res2 === "string" && res2.includes("base64")) {
17505
+ blobData = dataURItoBlob(res2);
17506
+ } else {
17507
+ const _temp2 = function () {
17508
+ if (res2 instanceof Blob) {
17509
+ blobData = res2;
17510
+ } else {
17511
+ const _temp = function () {
17512
+ if (res2 && typeof res2 === "object" && res2.fileStoreId) {
17513
+ return Promise.resolve(Digit.UploadServices.FileFetchbyid(res2.fileStoreId, Digit.ULBService.getStateId())).then(function (fileRes) {
17514
+ if (fileRes !== null && fileRes !== void 0 && fileRes.data) {
17515
+ var _fileRes$headers;
17516
+ blobData = fileRes.data instanceof Blob ? fileRes.data : new Blob([fileRes.data], {
17517
+ type: ((_fileRes$headers = fileRes.headers) === null || _fileRes$headers === void 0 ? void 0 : _fileRes$headers["content-type"]) || "application/pdf"
17518
+ });
17519
+ }
17520
+ });
17521
+ } else {
17522
+ blobData = new Blob([JSON.stringify(res2)], {
17523
+ type: "application/pdf"
17524
+ });
17525
+ }
17526
+ }();
17527
+ if (_temp && _temp.then) return _temp.then(function () {});
17528
+ }
17529
+ }();
17530
+ if (_temp2 && _temp2.then) return _temp2.then(function () {});
17531
+ }
17532
+ }();
17533
+ return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
17487
17534
  });
17488
17535
  } else {
17489
17536
  setShowToast({
@@ -17492,7 +17539,7 @@ const UploadFileDigiLocker = props => {
17492
17539
  });
17493
17540
  }
17494
17541
  }();
17495
- if (_temp && _temp.then) return _temp.then(function () {});
17542
+ if (_temp5 && _temp5.then) return _temp5.then(function () {});
17496
17543
  });
17497
17544
  }, function (error) {
17498
17545
  console.error("DigiLocker Fetch Error:", error);
@@ -17818,25 +17865,28 @@ function SelectDocument(_ref2) {
17818
17865
  documentUid = _useState7[0],
17819
17866
  setDocumentUid = _useState7[1];
17820
17867
  const _useState8 = useState(false),
17821
- showCamera = _useState8[0],
17822
- setShowCamera = _useState8[1];
17868
+ isDocumentUidLocked = _useState8[0],
17869
+ setIsDocumentUidLocked = _useState8[1];
17823
17870
  const _useState9 = useState(false),
17824
- isUploading = _useState9[0],
17825
- setIsUploading = _useState9[1];
17871
+ showCamera = _useState9[0],
17872
+ setShowCamera = _useState9[1];
17826
17873
  const _useState0 = useState(false),
17827
- setIsCameraFile = _useState0[1];
17874
+ isUploading = _useState0[0],
17875
+ setIsUploading = _useState0[1];
17828
17876
  const _useState1 = useState(false),
17829
- showDocModal = _useState1[0],
17830
- setShowDocModal = _useState1[1];
17831
- const _useState10 = useState(""),
17832
- docFileUrl = _useState10[0],
17833
- setDocFileUrl = _useState10[1];
17877
+ setIsCameraFile = _useState1[1];
17878
+ const _useState10 = useState(false),
17879
+ showDocModal = _useState10[0],
17880
+ setShowDocModal = _useState10[1];
17834
17881
  const _useState11 = useState(""),
17835
- docFileType = _useState11[0],
17836
- setDocFileType = _useState11[1];
17837
- const _useState12 = useState(false),
17838
- digiLockerUpload = _useState12[0],
17839
- setDigilockerUpload = _useState12[1];
17882
+ docFileUrl = _useState11[0],
17883
+ setDocFileUrl = _useState11[1];
17884
+ const _useState12 = useState(""),
17885
+ docFileType = _useState12[0],
17886
+ setDocFileType = _useState12[1];
17887
+ const _useState13 = useState(false),
17888
+ digiLockerUpload = _useState13[0],
17889
+ setDigilockerUpload = _useState13[1];
17840
17890
  useEffect(() => {
17841
17891
  const eligible = isDigiLockerEligible((selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code) || "");
17842
17892
  setDigilockerUpload(eligible);
@@ -17854,17 +17904,16 @@ function SelectDocument(_ref2) {
17854
17904
  const _temp = _catch(function () {
17855
17905
  return Promise.resolve(Digit.UploadServices.FileFetchbyid(uploadedFile, Digit.ULBService.getStateId())).then(function (res) {
17856
17906
  if (res !== null && res !== void 0 && res.data) {
17907
+ var _res$headers, _res$headers2;
17908
+ const contentType = ((_res$headers = res.headers) === null || _res$headers === void 0 ? void 0 : _res$headers["content-type"]) || ((_res$headers2 = res.headers) === null || _res$headers2 === void 0 ? void 0 : _res$headers2["Content-Type"]) || "";
17909
+ const isPdf = contentType.toLowerCase().includes("pdf") || res.data instanceof Blob && res.data.type && res.data.type.toLowerCase().includes("pdf");
17910
+ const mimeType = isPdf ? "application/pdf" : contentType || "image/jpeg";
17857
17911
  const blob = res.data instanceof Blob ? res.data : new Blob([res.data], {
17858
- type: res.headers["content-type"] || res.headers["Content-Type"] || "image/jpeg"
17912
+ type: mimeType
17859
17913
  });
17860
17914
  const fileURL = URL.createObjectURL(blob);
17861
17915
  setDocFileUrl(fileURL);
17862
- const contentType = res.headers["content-type"] || res.headers["Content-Type"] || "";
17863
- if (contentType.toLowerCase().includes("pdf")) {
17864
- setDocFileType("pdf");
17865
- } else {
17866
- setDocFileType("image");
17867
- }
17916
+ setDocFileType(isPdf ? "pdf" : "image");
17868
17917
  setShowDocModal(true);
17869
17918
  }
17870
17919
  });
@@ -17903,8 +17952,8 @@ function SelectDocument(_ref2) {
17903
17952
  }
17904
17953
  const dropdownData = doc.dropdownData;
17905
17954
  var dropDownData = dropdownData;
17906
- const _useState13 = useState(false),
17907
- isHidden = _useState13[0];
17955
+ const _useState14 = useState(false),
17956
+ isHidden = _useState14[0];
17908
17957
  const addError = () => {
17909
17958
  var _formState$errors, _formState$errors$con;
17910
17959
  let type = formState === null || formState === void 0 ? void 0 : (_formState$errors = formState.errors) === null || _formState$errors === void 0 ? void 0 : (_formState$errors$con = _formState$errors[config.key]) === null || _formState$errors$con === void 0 ? void 0 : _formState$errors$con.type;
@@ -18044,8 +18093,16 @@ function SelectDocument(_ref2) {
18044
18093
  }, /*#__PURE__*/React.createElement(TextInput, {
18045
18094
  type: "text",
18046
18095
  value: documentUid,
18047
- onChange: e => setDocumentUid(e.target.value),
18048
- placeholder: t("WS_IDENTITY_NO_PLACEHOLDER")
18096
+ onChange: e => {
18097
+ if (!isDocumentUidLocked) setDocumentUid(e.target.value);
18098
+ },
18099
+ placeholder: t("WS_IDENTITY_NO_PLACEHOLDER"),
18100
+ disabled: isDocumentUidLocked,
18101
+ style: isDocumentUidLocked ? {
18102
+ backgroundColor: "#f0f0f0",
18103
+ cursor: "not-allowed",
18104
+ color: "#555"
18105
+ } : {}
18049
18106
  }))), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, doc !== null && doc !== void 0 && doc.required ? t((doc === null || doc === void 0 ? void 0 : (_doc$i18nKey2 = doc.i18nKey) === null || _doc$i18nKey2 === void 0 ? void 0 : _doc$i18nKey2.replaceAll(".", "_")) + "_UPLOAD_DOCUMENT") + "*" : "" + t((doc === null || doc === void 0 ? void 0 : (_doc$i18nKey3 = doc.i18nKey) === null || _doc$i18nKey3 === void 0 ? void 0 : _doc$i18nKey3.replaceAll(".", "_")) + "_UPLOAD_DOCUMENT")), /*#__PURE__*/React.createElement("div", {
18050
18107
  className: "field",
18051
18108
  style: {
@@ -18064,6 +18121,7 @@ function SelectDocument(_ref2) {
18064
18121
  setUploadedFile(null);
18065
18122
  setFile(null);
18066
18123
  setIsCameraFile(false);
18124
+ setIsDocumentUidLocked(false);
18067
18125
  },
18068
18126
  id: id,
18069
18127
  message: uploadedFile ? "1 " + t("CS_ACTION_FILEUPLOADED") : t("CS_ACTION_NO_FILEUPLOADED"),
@@ -18080,8 +18138,13 @@ function SelectDocument(_ref2) {
18080
18138
  setUploadedFile(null);
18081
18139
  setFile(null);
18082
18140
  setIsCameraFile(false);
18141
+ setIsDocumentUidLocked(false);
18083
18142
  },
18084
- documentType: selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code
18143
+ documentType: selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code,
18144
+ onDocumentNumber: num => {
18145
+ setDocumentUid(num);
18146
+ setIsDocumentUidLocked(true);
18147
+ }
18085
18148
  }) : /*#__PURE__*/React.createElement(UploadFile, {
18086
18149
  onUpload: selectfile,
18087
18150
  onDelete: () => {
@@ -18218,12 +18281,12 @@ const CameraCaptureModal = _ref4 => {
18218
18281
  t = _ref4.t;
18219
18282
  const videoRef = useRef(null);
18220
18283
  const canvasRef = useRef(null);
18221
- const _useState14 = useState(null),
18222
- stream = _useState14[0],
18223
- setStream = _useState14[1];
18224
18284
  const _useState15 = useState(null),
18225
- error = _useState15[0],
18226
- setError = _useState15[1];
18285
+ stream = _useState15[0],
18286
+ setStream = _useState15[1];
18287
+ const _useState16 = useState(null),
18288
+ error = _useState16[0],
18289
+ setError = _useState16[1];
18227
18290
  useEffect(() => {
18228
18291
  const startCamera = function () {
18229
18292
  try {
@@ -49543,7 +49606,15 @@ const ConsumptionDetails = _ref => {
49543
49606
  meterReadings = _ref2.meterReadings;
49544
49607
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
49545
49608
  className: "employee-form-section-wrapper"
49546
- }, /*#__PURE__*/React.createElement("div", {
49609
+ }, /*#__PURE__*/React.createElement(VerticalTimeline, {
49610
+ config: [{
49611
+ timeLine: [{
49612
+ actions: "WS_VIEW_CONSUMPTION",
49613
+ currentStep: 1
49614
+ }]
49615
+ }],
49616
+ showFinalStep: false
49617
+ }), /*#__PURE__*/React.createElement("div", {
49547
49618
  style: {
49548
49619
  flex: 1,
49549
49620
  display: "flex",