@djb25/digit-ui-module-ws 1.0.65 → 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.
@@ -8930,7 +8930,8 @@ const App = _ref => {
8930
8930
  const _temp = _catch(function () {
8931
8931
  const TokenReq = {
8932
8932
  module: "WS",
8933
- code: code
8933
+ code: code,
8934
+ dlReqRef: sessionStorage.getItem("code_verfier_register")
8934
8935
  };
8935
8936
  const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
8936
8937
  return Promise.resolve(Digit.DigiLockerService.token({
@@ -10977,7 +10978,8 @@ const App$1 = _ref2 => {
10977
10978
  const _temp4 = _catch(function () {
10978
10979
  const TokenReq = {
10979
10980
  module: "WS",
10980
- code: code
10981
+ code: code,
10982
+ dlReqRef: sessionStorage.getItem("code_verfier_register")
10981
10983
  };
10982
10984
  const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
10983
10985
  return Promise.resolve(Digit.DigiLockerService.token({
@@ -17452,10 +17454,9 @@ const UploadFileDigiLocker = props => {
17452
17454
  let TokenReq = {
17453
17455
  authToken: digiLockerToken
17454
17456
  };
17455
- const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
17456
17457
  return Promise.resolve(Digit.DigiLockerService.issueDoc({
17457
17458
  TokenReq
17458
- }, tenantId)).then(function (res1) {
17459
+ })).then(function (res1) {
17459
17460
  if (!res1 || !res1.IssuedDoc) {
17460
17461
  setShowToast({
17461
17462
  error: true,
@@ -17468,20 +17469,68 @@ const UploadFileDigiLocker = props => {
17468
17469
  const code = props.documentType.toUpperCase();
17469
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";
17470
17471
  }
17471
- let uri = res1.IssuedDoc.filter(item => item.doctype === doctype);
17472
- 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 () {
17473
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
+ }
17474
17488
  let TokenReqNew = {
17475
17489
  authToken: digiLockerToken,
17476
- id: uri[0].uri
17490
+ id: uriStr
17477
17491
  };
17478
- const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
17479
17492
  return Promise.resolve(Digit.DigiLockerService.uri({
17480
17493
  TokenReq: TokenReqNew
17481
- }, tenantId)).then(function (res2) {
17482
- let c = new Blob([res2]);
17483
- let filename = doctype + "_" + (uri[0].name || "document") + ".pdf";
17484
- 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);
17485
17534
  });
17486
17535
  } else {
17487
17536
  setShowToast({
@@ -17490,7 +17539,7 @@ const UploadFileDigiLocker = props => {
17490
17539
  });
17491
17540
  }
17492
17541
  }();
17493
- if (_temp && _temp.then) return _temp.then(function () {});
17542
+ if (_temp5 && _temp5.then) return _temp5.then(function () {});
17494
17543
  });
17495
17544
  }, function (error) {
17496
17545
  console.error("DigiLocker Fetch Error:", error);
@@ -17816,25 +17865,28 @@ function SelectDocument(_ref2) {
17816
17865
  documentUid = _useState7[0],
17817
17866
  setDocumentUid = _useState7[1];
17818
17867
  const _useState8 = useState(false),
17819
- showCamera = _useState8[0],
17820
- setShowCamera = _useState8[1];
17868
+ isDocumentUidLocked = _useState8[0],
17869
+ setIsDocumentUidLocked = _useState8[1];
17821
17870
  const _useState9 = useState(false),
17822
- isUploading = _useState9[0],
17823
- setIsUploading = _useState9[1];
17871
+ showCamera = _useState9[0],
17872
+ setShowCamera = _useState9[1];
17824
17873
  const _useState0 = useState(false),
17825
- setIsCameraFile = _useState0[1];
17874
+ isUploading = _useState0[0],
17875
+ setIsUploading = _useState0[1];
17826
17876
  const _useState1 = useState(false),
17827
- showDocModal = _useState1[0],
17828
- setShowDocModal = _useState1[1];
17829
- const _useState10 = useState(""),
17830
- docFileUrl = _useState10[0],
17831
- setDocFileUrl = _useState10[1];
17877
+ setIsCameraFile = _useState1[1];
17878
+ const _useState10 = useState(false),
17879
+ showDocModal = _useState10[0],
17880
+ setShowDocModal = _useState10[1];
17832
17881
  const _useState11 = useState(""),
17833
- docFileType = _useState11[0],
17834
- setDocFileType = _useState11[1];
17835
- const _useState12 = useState(false),
17836
- digiLockerUpload = _useState12[0],
17837
- 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];
17838
17890
  useEffect(() => {
17839
17891
  const eligible = isDigiLockerEligible((selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code) || "");
17840
17892
  setDigilockerUpload(eligible);
@@ -17852,17 +17904,16 @@ function SelectDocument(_ref2) {
17852
17904
  const _temp = _catch(function () {
17853
17905
  return Promise.resolve(Digit.UploadServices.FileFetchbyid(uploadedFile, Digit.ULBService.getStateId())).then(function (res) {
17854
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";
17855
17911
  const blob = res.data instanceof Blob ? res.data : new Blob([res.data], {
17856
- type: res.headers["content-type"] || res.headers["Content-Type"] || "image/jpeg"
17912
+ type: mimeType
17857
17913
  });
17858
17914
  const fileURL = URL.createObjectURL(blob);
17859
17915
  setDocFileUrl(fileURL);
17860
- const contentType = res.headers["content-type"] || res.headers["Content-Type"] || "";
17861
- if (contentType.toLowerCase().includes("pdf")) {
17862
- setDocFileType("pdf");
17863
- } else {
17864
- setDocFileType("image");
17865
- }
17916
+ setDocFileType(isPdf ? "pdf" : "image");
17866
17917
  setShowDocModal(true);
17867
17918
  }
17868
17919
  });
@@ -17901,8 +17952,8 @@ function SelectDocument(_ref2) {
17901
17952
  }
17902
17953
  const dropdownData = doc.dropdownData;
17903
17954
  var dropDownData = dropdownData;
17904
- const _useState13 = useState(false),
17905
- isHidden = _useState13[0];
17955
+ const _useState14 = useState(false),
17956
+ isHidden = _useState14[0];
17906
17957
  const addError = () => {
17907
17958
  var _formState$errors, _formState$errors$con;
17908
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;
@@ -18042,8 +18093,16 @@ function SelectDocument(_ref2) {
18042
18093
  }, /*#__PURE__*/React.createElement(TextInput, {
18043
18094
  type: "text",
18044
18095
  value: documentUid,
18045
- onChange: e => setDocumentUid(e.target.value),
18046
- 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
+ } : {}
18047
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", {
18048
18107
  className: "field",
18049
18108
  style: {
@@ -18062,6 +18121,7 @@ function SelectDocument(_ref2) {
18062
18121
  setUploadedFile(null);
18063
18122
  setFile(null);
18064
18123
  setIsCameraFile(false);
18124
+ setIsDocumentUidLocked(false);
18065
18125
  },
18066
18126
  id: id,
18067
18127
  message: uploadedFile ? "1 " + t("CS_ACTION_FILEUPLOADED") : t("CS_ACTION_NO_FILEUPLOADED"),
@@ -18078,8 +18138,13 @@ function SelectDocument(_ref2) {
18078
18138
  setUploadedFile(null);
18079
18139
  setFile(null);
18080
18140
  setIsCameraFile(false);
18141
+ setIsDocumentUidLocked(false);
18081
18142
  },
18082
- 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
+ }
18083
18148
  }) : /*#__PURE__*/React.createElement(UploadFile, {
18084
18149
  onUpload: selectfile,
18085
18150
  onDelete: () => {
@@ -18216,12 +18281,12 @@ const CameraCaptureModal = _ref4 => {
18216
18281
  t = _ref4.t;
18217
18282
  const videoRef = useRef(null);
18218
18283
  const canvasRef = useRef(null);
18219
- const _useState14 = useState(null),
18220
- stream = _useState14[0],
18221
- setStream = _useState14[1];
18222
18284
  const _useState15 = useState(null),
18223
- error = _useState15[0],
18224
- setError = _useState15[1];
18285
+ stream = _useState15[0],
18286
+ setStream = _useState15[1];
18287
+ const _useState16 = useState(null),
18288
+ error = _useState16[0],
18289
+ setError = _useState16[1];
18225
18290
  useEffect(() => {
18226
18291
  const startCamera = function () {
18227
18292
  try {
@@ -36407,8 +36472,9 @@ const WSInfoPage = () => {
36407
36472
  tenantId
36408
36473
  })).then(function (data) {
36409
36474
  const redirectUrl = (data === null || data === void 0 ? void 0 : data.redirectURL) || (data === null || data === void 0 ? void 0 : data.redirectUrl);
36410
- if (data !== null && data !== void 0 && data.codeverifier) {
36411
- sessionStorage.setItem("code_verfier_register", data === null || data === void 0 ? void 0 : data.codeverifier);
36475
+ const verifier = (data === null || data === void 0 ? void 0 : data.dlReqRef) || (data === null || data === void 0 ? void 0 : data.codeverifier) || (data === null || data === void 0 ? void 0 : data.codeVerifier) || (data === null || data === void 0 ? void 0 : data.code_verifier);
36476
+ if (verifier) {
36477
+ sessionStorage.setItem("code_verfier_register", verifier);
36412
36478
  }
36413
36479
  if (redirectUrl) {
36414
36480
  window.location.href = redirectUrl;
@@ -49540,7 +49606,15 @@ const ConsumptionDetails = _ref => {
49540
49606
  meterReadings = _ref2.meterReadings;
49541
49607
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
49542
49608
  className: "employee-form-section-wrapper"
49543
- }, /*#__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", {
49544
49618
  style: {
49545
49619
  flex: 1,
49546
49620
  display: "flex",