@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.
package/dist/index.js CHANGED
@@ -8933,7 +8933,8 @@ const App = _ref => {
8933
8933
  const _temp = _catch(function () {
8934
8934
  const TokenReq = {
8935
8935
  module: "WS",
8936
- code: code
8936
+ code: code,
8937
+ dlReqRef: sessionStorage.getItem("code_verfier_register")
8937
8938
  };
8938
8939
  const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
8939
8940
  return Promise.resolve(Digit.DigiLockerService.token({
@@ -10980,7 +10981,8 @@ const App$1 = _ref2 => {
10980
10981
  const _temp4 = _catch(function () {
10981
10982
  const TokenReq = {
10982
10983
  module: "WS",
10983
- code: code
10984
+ code: code,
10985
+ dlReqRef: sessionStorage.getItem("code_verfier_register")
10984
10986
  };
10985
10987
  const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
10986
10988
  return Promise.resolve(Digit.DigiLockerService.token({
@@ -17455,10 +17457,9 @@ const UploadFileDigiLocker = props => {
17455
17457
  let TokenReq = {
17456
17458
  authToken: digiLockerToken
17457
17459
  };
17458
- const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
17459
17460
  return Promise.resolve(Digit.DigiLockerService.issueDoc({
17460
17461
  TokenReq
17461
- }, tenantId)).then(function (res1) {
17462
+ })).then(function (res1) {
17462
17463
  if (!res1 || !res1.IssuedDoc) {
17463
17464
  setShowToast({
17464
17465
  error: true,
@@ -17471,20 +17472,68 @@ const UploadFileDigiLocker = props => {
17471
17472
  const code = props.documentType.toUpperCase();
17472
17473
  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";
17473
17474
  }
17474
- let uri = res1.IssuedDoc.filter(item => item.doctype === doctype);
17475
- const _temp = function () {
17475
+ const DOCTYPE_ALIASES = {
17476
+ ADHAR: ["ADHAR", "AADHAAR", "AADHAR"],
17477
+ DRVLC: ["DRVLC", "DRIVING"],
17478
+ PANCR: ["PANCR", "PANCH", "PAN"],
17479
+ VOTER: ["VOTER", "VOTERID"]
17480
+ };
17481
+ const aliases = DOCTYPE_ALIASES[doctype] || [doctype];
17482
+ let uri = res1.IssuedDoc.filter(item => aliases.some(alias => item.doctype === alias));
17483
+ const _temp5 = function () {
17476
17484
  if ((uri === null || uri === void 0 ? void 0 : uri.length) > 0) {
17485
+ const uriStr = uri[0].uri || "";
17486
+ const parts = uriStr.split("-");
17487
+ const documentNumber = parts.length > 1 ? parts[parts.length - 1] : "";
17488
+ if (documentNumber && props !== null && props !== void 0 && props.onDocumentNumber) {
17489
+ props.onDocumentNumber(documentNumber);
17490
+ }
17477
17491
  let TokenReqNew = {
17478
17492
  authToken: digiLockerToken,
17479
- id: uri[0].uri
17493
+ id: uriStr
17480
17494
  };
17481
- const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
17482
17495
  return Promise.resolve(Digit.DigiLockerService.uri({
17483
17496
  TokenReq: TokenReqNew
17484
- }, tenantId)).then(function (res2) {
17485
- let c = new Blob([res2]);
17486
- let filename = doctype + "_" + (uri[0].name || "document") + ".pdf";
17487
- convertToFile(e, c, filename);
17497
+ })).then(function (res2) {
17498
+ function _temp4() {
17499
+ let filename = doctype + "_" + (uri[0].name || "document") + ".pdf";
17500
+ if (blobData) convertToFile(e, blobData, filename);else setShowToast({
17501
+ error: true,
17502
+ label: "Failed to read document from DigiLocker."
17503
+ });
17504
+ }
17505
+ let blobData;
17506
+ const _temp3 = function () {
17507
+ if (typeof res2 === "string" && res2.includes("base64")) {
17508
+ blobData = dataURItoBlob(res2);
17509
+ } else {
17510
+ const _temp2 = function () {
17511
+ if (res2 instanceof Blob) {
17512
+ blobData = res2;
17513
+ } else {
17514
+ const _temp = function () {
17515
+ if (res2 && typeof res2 === "object" && res2.fileStoreId) {
17516
+ return Promise.resolve(Digit.UploadServices.FileFetchbyid(res2.fileStoreId, Digit.ULBService.getStateId())).then(function (fileRes) {
17517
+ if (fileRes !== null && fileRes !== void 0 && fileRes.data) {
17518
+ var _fileRes$headers;
17519
+ blobData = fileRes.data instanceof Blob ? fileRes.data : new Blob([fileRes.data], {
17520
+ type: ((_fileRes$headers = fileRes.headers) === null || _fileRes$headers === void 0 ? void 0 : _fileRes$headers["content-type"]) || "application/pdf"
17521
+ });
17522
+ }
17523
+ });
17524
+ } else {
17525
+ blobData = new Blob([JSON.stringify(res2)], {
17526
+ type: "application/pdf"
17527
+ });
17528
+ }
17529
+ }();
17530
+ if (_temp && _temp.then) return _temp.then(function () {});
17531
+ }
17532
+ }();
17533
+ if (_temp2 && _temp2.then) return _temp2.then(function () {});
17534
+ }
17535
+ }();
17536
+ return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
17488
17537
  });
17489
17538
  } else {
17490
17539
  setShowToast({
@@ -17493,7 +17542,7 @@ const UploadFileDigiLocker = props => {
17493
17542
  });
17494
17543
  }
17495
17544
  }();
17496
- if (_temp && _temp.then) return _temp.then(function () {});
17545
+ if (_temp5 && _temp5.then) return _temp5.then(function () {});
17497
17546
  });
17498
17547
  }, function (error) {
17499
17548
  console.error("DigiLocker Fetch Error:", error);
@@ -17819,25 +17868,28 @@ function SelectDocument(_ref2) {
17819
17868
  documentUid = _useState7[0],
17820
17869
  setDocumentUid = _useState7[1];
17821
17870
  const _useState8 = React.useState(false),
17822
- showCamera = _useState8[0],
17823
- setShowCamera = _useState8[1];
17871
+ isDocumentUidLocked = _useState8[0],
17872
+ setIsDocumentUidLocked = _useState8[1];
17824
17873
  const _useState9 = React.useState(false),
17825
- isUploading = _useState9[0],
17826
- setIsUploading = _useState9[1];
17874
+ showCamera = _useState9[0],
17875
+ setShowCamera = _useState9[1];
17827
17876
  const _useState0 = React.useState(false),
17828
- setIsCameraFile = _useState0[1];
17877
+ isUploading = _useState0[0],
17878
+ setIsUploading = _useState0[1];
17829
17879
  const _useState1 = React.useState(false),
17830
- showDocModal = _useState1[0],
17831
- setShowDocModal = _useState1[1];
17832
- const _useState10 = React.useState(""),
17833
- docFileUrl = _useState10[0],
17834
- setDocFileUrl = _useState10[1];
17880
+ setIsCameraFile = _useState1[1];
17881
+ const _useState10 = React.useState(false),
17882
+ showDocModal = _useState10[0],
17883
+ setShowDocModal = _useState10[1];
17835
17884
  const _useState11 = React.useState(""),
17836
- docFileType = _useState11[0],
17837
- setDocFileType = _useState11[1];
17838
- const _useState12 = React.useState(false),
17839
- digiLockerUpload = _useState12[0],
17840
- setDigilockerUpload = _useState12[1];
17885
+ docFileUrl = _useState11[0],
17886
+ setDocFileUrl = _useState11[1];
17887
+ const _useState12 = React.useState(""),
17888
+ docFileType = _useState12[0],
17889
+ setDocFileType = _useState12[1];
17890
+ const _useState13 = React.useState(false),
17891
+ digiLockerUpload = _useState13[0],
17892
+ setDigilockerUpload = _useState13[1];
17841
17893
  React.useEffect(() => {
17842
17894
  const eligible = isDigiLockerEligible((selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code) || "");
17843
17895
  setDigilockerUpload(eligible);
@@ -17855,17 +17907,16 @@ function SelectDocument(_ref2) {
17855
17907
  const _temp = _catch(function () {
17856
17908
  return Promise.resolve(Digit.UploadServices.FileFetchbyid(uploadedFile, Digit.ULBService.getStateId())).then(function (res) {
17857
17909
  if (res !== null && res !== void 0 && res.data) {
17910
+ var _res$headers, _res$headers2;
17911
+ 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"]) || "";
17912
+ const isPdf = contentType.toLowerCase().includes("pdf") || res.data instanceof Blob && res.data.type && res.data.type.toLowerCase().includes("pdf");
17913
+ const mimeType = isPdf ? "application/pdf" : contentType || "image/jpeg";
17858
17914
  const blob = res.data instanceof Blob ? res.data : new Blob([res.data], {
17859
- type: res.headers["content-type"] || res.headers["Content-Type"] || "image/jpeg"
17915
+ type: mimeType
17860
17916
  });
17861
17917
  const fileURL = URL.createObjectURL(blob);
17862
17918
  setDocFileUrl(fileURL);
17863
- const contentType = res.headers["content-type"] || res.headers["Content-Type"] || "";
17864
- if (contentType.toLowerCase().includes("pdf")) {
17865
- setDocFileType("pdf");
17866
- } else {
17867
- setDocFileType("image");
17868
- }
17919
+ setDocFileType(isPdf ? "pdf" : "image");
17869
17920
  setShowDocModal(true);
17870
17921
  }
17871
17922
  });
@@ -17904,8 +17955,8 @@ function SelectDocument(_ref2) {
17904
17955
  }
17905
17956
  const dropdownData = doc.dropdownData;
17906
17957
  var dropDownData = dropdownData;
17907
- const _useState13 = React.useState(false),
17908
- isHidden = _useState13[0];
17958
+ const _useState14 = React.useState(false),
17959
+ isHidden = _useState14[0];
17909
17960
  const addError = () => {
17910
17961
  var _formState$errors, _formState$errors$con;
17911
17962
  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;
@@ -18045,8 +18096,16 @@ function SelectDocument(_ref2) {
18045
18096
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
18046
18097
  type: "text",
18047
18098
  value: documentUid,
18048
- onChange: e => setDocumentUid(e.target.value),
18049
- placeholder: t("WS_IDENTITY_NO_PLACEHOLDER")
18099
+ onChange: e => {
18100
+ if (!isDocumentUidLocked) setDocumentUid(e.target.value);
18101
+ },
18102
+ placeholder: t("WS_IDENTITY_NO_PLACEHOLDER"),
18103
+ disabled: isDocumentUidLocked,
18104
+ style: isDocumentUidLocked ? {
18105
+ backgroundColor: "#f0f0f0",
18106
+ cursor: "not-allowed",
18107
+ color: "#555"
18108
+ } : {}
18050
18109
  }))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.LabelFieldPair, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.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__default.createElement("div", {
18051
18110
  className: "field",
18052
18111
  style: {
@@ -18065,6 +18124,7 @@ function SelectDocument(_ref2) {
18065
18124
  setUploadedFile(null);
18066
18125
  setFile(null);
18067
18126
  setIsCameraFile(false);
18127
+ setIsDocumentUidLocked(false);
18068
18128
  },
18069
18129
  id: id,
18070
18130
  message: uploadedFile ? "1 " + t("CS_ACTION_FILEUPLOADED") : t("CS_ACTION_NO_FILEUPLOADED"),
@@ -18081,8 +18141,13 @@ function SelectDocument(_ref2) {
18081
18141
  setUploadedFile(null);
18082
18142
  setFile(null);
18083
18143
  setIsCameraFile(false);
18144
+ setIsDocumentUidLocked(false);
18084
18145
  },
18085
- documentType: selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code
18146
+ documentType: selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code,
18147
+ onDocumentNumber: num => {
18148
+ setDocumentUid(num);
18149
+ setIsDocumentUidLocked(true);
18150
+ }
18086
18151
  }) : /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
18087
18152
  onUpload: selectfile,
18088
18153
  onDelete: () => {
@@ -18219,12 +18284,12 @@ const CameraCaptureModal = _ref4 => {
18219
18284
  t = _ref4.t;
18220
18285
  const videoRef = React.useRef(null);
18221
18286
  const canvasRef = React.useRef(null);
18222
- const _useState14 = React.useState(null),
18223
- stream = _useState14[0],
18224
- setStream = _useState14[1];
18225
18287
  const _useState15 = React.useState(null),
18226
- error = _useState15[0],
18227
- setError = _useState15[1];
18288
+ stream = _useState15[0],
18289
+ setStream = _useState15[1];
18290
+ const _useState16 = React.useState(null),
18291
+ error = _useState16[0],
18292
+ setError = _useState16[1];
18228
18293
  React.useEffect(() => {
18229
18294
  const startCamera = function () {
18230
18295
  try {
@@ -36410,8 +36475,9 @@ const WSInfoPage = () => {
36410
36475
  tenantId
36411
36476
  })).then(function (data) {
36412
36477
  const redirectUrl = (data === null || data === void 0 ? void 0 : data.redirectURL) || (data === null || data === void 0 ? void 0 : data.redirectUrl);
36413
- if (data !== null && data !== void 0 && data.codeverifier) {
36414
- sessionStorage.setItem("code_verfier_register", data === null || data === void 0 ? void 0 : data.codeverifier);
36478
+ 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);
36479
+ if (verifier) {
36480
+ sessionStorage.setItem("code_verfier_register", verifier);
36415
36481
  }
36416
36482
  if (redirectUrl) {
36417
36483
  window.location.href = redirectUrl;
@@ -49543,7 +49609,15 @@ const ConsumptionDetails = _ref => {
49543
49609
  meterReadings = _ref2.meterReadings;
49544
49610
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
49545
49611
  className: "employee-form-section-wrapper"
49546
- }, /*#__PURE__*/React__default.createElement("div", {
49612
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
49613
+ config: [{
49614
+ timeLine: [{
49615
+ actions: "WS_VIEW_CONSUMPTION",
49616
+ currentStep: 1
49617
+ }]
49618
+ }],
49619
+ showFinalStep: false
49620
+ }), /*#__PURE__*/React__default.createElement("div", {
49547
49621
  style: {
49548
49622
  flex: 1,
49549
49623
  display: "flex",