@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.
- package/dist/index.js +115 -44
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +115 -44
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17457,10 +17457,9 @@ const UploadFileDigiLocker = props => {
|
|
|
17457
17457
|
let TokenReq = {
|
|
17458
17458
|
authToken: digiLockerToken
|
|
17459
17459
|
};
|
|
17460
|
-
const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
|
|
17461
17460
|
return Promise.resolve(Digit.DigiLockerService.issueDoc({
|
|
17462
17461
|
TokenReq
|
|
17463
|
-
}
|
|
17462
|
+
})).then(function (res1) {
|
|
17464
17463
|
if (!res1 || !res1.IssuedDoc) {
|
|
17465
17464
|
setShowToast({
|
|
17466
17465
|
error: true,
|
|
@@ -17473,20 +17472,68 @@ const UploadFileDigiLocker = props => {
|
|
|
17473
17472
|
const code = props.documentType.toUpperCase();
|
|
17474
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";
|
|
17475
17474
|
}
|
|
17476
|
-
|
|
17477
|
-
|
|
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 () {
|
|
17478
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
|
+
}
|
|
17479
17491
|
let TokenReqNew = {
|
|
17480
17492
|
authToken: digiLockerToken,
|
|
17481
|
-
id:
|
|
17493
|
+
id: uriStr
|
|
17482
17494
|
};
|
|
17483
|
-
const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
|
|
17484
17495
|
return Promise.resolve(Digit.DigiLockerService.uri({
|
|
17485
17496
|
TokenReq: TokenReqNew
|
|
17486
|
-
}
|
|
17487
|
-
|
|
17488
|
-
|
|
17489
|
-
|
|
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);
|
|
17490
17537
|
});
|
|
17491
17538
|
} else {
|
|
17492
17539
|
setShowToast({
|
|
@@ -17495,7 +17542,7 @@ const UploadFileDigiLocker = props => {
|
|
|
17495
17542
|
});
|
|
17496
17543
|
}
|
|
17497
17544
|
}();
|
|
17498
|
-
if (
|
|
17545
|
+
if (_temp5 && _temp5.then) return _temp5.then(function () {});
|
|
17499
17546
|
});
|
|
17500
17547
|
}, function (error) {
|
|
17501
17548
|
console.error("DigiLocker Fetch Error:", error);
|
|
@@ -17821,25 +17868,28 @@ function SelectDocument(_ref2) {
|
|
|
17821
17868
|
documentUid = _useState7[0],
|
|
17822
17869
|
setDocumentUid = _useState7[1];
|
|
17823
17870
|
const _useState8 = React.useState(false),
|
|
17824
|
-
|
|
17825
|
-
|
|
17871
|
+
isDocumentUidLocked = _useState8[0],
|
|
17872
|
+
setIsDocumentUidLocked = _useState8[1];
|
|
17826
17873
|
const _useState9 = React.useState(false),
|
|
17827
|
-
|
|
17828
|
-
|
|
17874
|
+
showCamera = _useState9[0],
|
|
17875
|
+
setShowCamera = _useState9[1];
|
|
17829
17876
|
const _useState0 = React.useState(false),
|
|
17830
|
-
|
|
17877
|
+
isUploading = _useState0[0],
|
|
17878
|
+
setIsUploading = _useState0[1];
|
|
17831
17879
|
const _useState1 = React.useState(false),
|
|
17832
|
-
|
|
17833
|
-
|
|
17834
|
-
|
|
17835
|
-
|
|
17836
|
-
setDocFileUrl = _useState10[1];
|
|
17880
|
+
setIsCameraFile = _useState1[1];
|
|
17881
|
+
const _useState10 = React.useState(false),
|
|
17882
|
+
showDocModal = _useState10[0],
|
|
17883
|
+
setShowDocModal = _useState10[1];
|
|
17837
17884
|
const _useState11 = React.useState(""),
|
|
17838
|
-
|
|
17839
|
-
|
|
17840
|
-
const _useState12 = React.useState(
|
|
17841
|
-
|
|
17842
|
-
|
|
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];
|
|
17843
17893
|
React.useEffect(() => {
|
|
17844
17894
|
const eligible = isDigiLockerEligible((selectedDocument === null || selectedDocument === void 0 ? void 0 : selectedDocument.code) || "");
|
|
17845
17895
|
setDigilockerUpload(eligible);
|
|
@@ -17857,17 +17907,16 @@ function SelectDocument(_ref2) {
|
|
|
17857
17907
|
const _temp = _catch(function () {
|
|
17858
17908
|
return Promise.resolve(Digit.UploadServices.FileFetchbyid(uploadedFile, Digit.ULBService.getStateId())).then(function (res) {
|
|
17859
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";
|
|
17860
17914
|
const blob = res.data instanceof Blob ? res.data : new Blob([res.data], {
|
|
17861
|
-
type:
|
|
17915
|
+
type: mimeType
|
|
17862
17916
|
});
|
|
17863
17917
|
const fileURL = URL.createObjectURL(blob);
|
|
17864
17918
|
setDocFileUrl(fileURL);
|
|
17865
|
-
|
|
17866
|
-
if (contentType.toLowerCase().includes("pdf")) {
|
|
17867
|
-
setDocFileType("pdf");
|
|
17868
|
-
} else {
|
|
17869
|
-
setDocFileType("image");
|
|
17870
|
-
}
|
|
17919
|
+
setDocFileType(isPdf ? "pdf" : "image");
|
|
17871
17920
|
setShowDocModal(true);
|
|
17872
17921
|
}
|
|
17873
17922
|
});
|
|
@@ -17906,8 +17955,8 @@ function SelectDocument(_ref2) {
|
|
|
17906
17955
|
}
|
|
17907
17956
|
const dropdownData = doc.dropdownData;
|
|
17908
17957
|
var dropDownData = dropdownData;
|
|
17909
|
-
const
|
|
17910
|
-
isHidden =
|
|
17958
|
+
const _useState14 = React.useState(false),
|
|
17959
|
+
isHidden = _useState14[0];
|
|
17911
17960
|
const addError = () => {
|
|
17912
17961
|
var _formState$errors, _formState$errors$con;
|
|
17913
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;
|
|
@@ -18047,8 +18096,16 @@ function SelectDocument(_ref2) {
|
|
|
18047
18096
|
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.TextInput, {
|
|
18048
18097
|
type: "text",
|
|
18049
18098
|
value: documentUid,
|
|
18050
|
-
onChange: e =>
|
|
18051
|
-
|
|
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
|
+
} : {}
|
|
18052
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", {
|
|
18053
18110
|
className: "field",
|
|
18054
18111
|
style: {
|
|
@@ -18067,6 +18124,7 @@ function SelectDocument(_ref2) {
|
|
|
18067
18124
|
setUploadedFile(null);
|
|
18068
18125
|
setFile(null);
|
|
18069
18126
|
setIsCameraFile(false);
|
|
18127
|
+
setIsDocumentUidLocked(false);
|
|
18070
18128
|
},
|
|
18071
18129
|
id: id,
|
|
18072
18130
|
message: uploadedFile ? "1 " + t("CS_ACTION_FILEUPLOADED") : t("CS_ACTION_NO_FILEUPLOADED"),
|
|
@@ -18083,8 +18141,13 @@ function SelectDocument(_ref2) {
|
|
|
18083
18141
|
setUploadedFile(null);
|
|
18084
18142
|
setFile(null);
|
|
18085
18143
|
setIsCameraFile(false);
|
|
18144
|
+
setIsDocumentUidLocked(false);
|
|
18086
18145
|
},
|
|
18087
|
-
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
|
+
}
|
|
18088
18151
|
}) : /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
|
|
18089
18152
|
onUpload: selectfile,
|
|
18090
18153
|
onDelete: () => {
|
|
@@ -18221,12 +18284,12 @@ const CameraCaptureModal = _ref4 => {
|
|
|
18221
18284
|
t = _ref4.t;
|
|
18222
18285
|
const videoRef = React.useRef(null);
|
|
18223
18286
|
const canvasRef = React.useRef(null);
|
|
18224
|
-
const _useState14 = React.useState(null),
|
|
18225
|
-
stream = _useState14[0],
|
|
18226
|
-
setStream = _useState14[1];
|
|
18227
18287
|
const _useState15 = React.useState(null),
|
|
18228
|
-
|
|
18229
|
-
|
|
18288
|
+
stream = _useState15[0],
|
|
18289
|
+
setStream = _useState15[1];
|
|
18290
|
+
const _useState16 = React.useState(null),
|
|
18291
|
+
error = _useState16[0],
|
|
18292
|
+
setError = _useState16[1];
|
|
18230
18293
|
React.useEffect(() => {
|
|
18231
18294
|
const startCamera = function () {
|
|
18232
18295
|
try {
|
|
@@ -49546,7 +49609,15 @@ const ConsumptionDetails = _ref => {
|
|
|
49546
49609
|
meterReadings = _ref2.meterReadings;
|
|
49547
49610
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
49548
49611
|
className: "employee-form-section-wrapper"
|
|
49549
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
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", {
|
|
49550
49621
|
style: {
|
|
49551
49622
|
flex: 1,
|
|
49552
49623
|
display: "flex",
|