finance-shared 0.0.20 → 0.0.22
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/finance-shared-library.es.js +254 -18
- package/dist/finance-shared-library.es.js.map +1 -1
- package/dist/finance-shared-library.umd.js +25 -25
- package/dist/finance-shared-library.umd.js.map +1 -1
- package/dist/finance-shared.css +1 -1
- package/dist/index.d.ts +9 -3
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
import i18next from "i18next";
|
|
5
5
|
import { default as default2 } from "i18next";
|
|
6
6
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
7
|
-
import { Dialog as Dialog$1, DialogTitle, DialogContent as DialogContent$1, DialogContentText, DialogActions as DialogActions$1, Button as Button$1, Typography as Typography$1, IconButton as IconButton$1, Box as Box$1, Tooltip, Zoom, TextField as TextField$1, Paper as Paper$1, Grid as Grid$1, styled as styled$3, CircularProgress as CircularProgress$1, Autocomplete as Autocomplete$1, Badge, Checkbox as Checkbox$1, Chip as Chip$1, Divider, RadioGroup, FormControlLabel, Radio, Grid2, Popover as Popover$1 } from "@mui/material";
|
|
7
|
+
import { Dialog as Dialog$1, DialogTitle, DialogContent as DialogContent$1, DialogContentText, DialogActions as DialogActions$1, Button as Button$1, Typography as Typography$1, IconButton as IconButton$1, Box as Box$1, Tooltip, Zoom, TextField as TextField$1, Paper as Paper$1, Grid as Grid$1, styled as styled$3, CircularProgress as CircularProgress$1, Autocomplete as Autocomplete$1, Badge, Checkbox as Checkbox$1, Chip as Chip$1, Divider, RadioGroup, FormControlLabel, Radio, Grid2, InputAdornment as InputAdornment$1, Popover as Popover$1 } from "@mui/material";
|
|
8
8
|
import { useTranslation } from "react-i18next";
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import React__default, { useState, isValidElement, cloneElement, Children, useEffect, memo, createElement, useRef, useCallback, useMemo, createContext, useContext } from "react";
|
|
@@ -13,6 +13,7 @@ import emStyled from "@emotion/styled";
|
|
|
13
13
|
import { ThemeContext } from "@emotion/react";
|
|
14
14
|
import * as ReactDOM from "react-dom";
|
|
15
15
|
import ReactDOM__default from "react-dom";
|
|
16
|
+
import { VisibilityOff, Visibility } from "@mui/icons-material";
|
|
16
17
|
const confirmDialog$1 = { "cancel": "Cancel", "ok": "Ok", "confirm": "Confirm", "delete": "Delete", "save": "Save", "yes": "Yes", "no": "No" };
|
|
17
18
|
const en$1 = {
|
|
18
19
|
confirmDialog: confirmDialog$1
|
|
@@ -91,7 +92,16 @@ const locale$3 = {
|
|
|
91
92
|
DURATION: "Duration",
|
|
92
93
|
STAMP_DUTY: "Stamp Duty",
|
|
93
94
|
LEGAL_FEES: "Legal Fees",
|
|
94
|
-
MONTHS: "Months"
|
|
95
|
+
MONTHS: "Months",
|
|
96
|
+
ENTER_SIGNING_OTP: "Enter OTP",
|
|
97
|
+
ENTER_SIGNING_OTP_DESC: "Enter the OTP sent to your registered mobile number to confirm signing.",
|
|
98
|
+
ENTER_SIGNING_PIN: "Enter PIN",
|
|
99
|
+
ENTER_SIGNING_PIN_DESC: "Enter your PIN to confirm signing.",
|
|
100
|
+
OTP: "OTP",
|
|
101
|
+
PIN: "PIN",
|
|
102
|
+
RESEND_OTP: "Resend OTP",
|
|
103
|
+
RESEND_OTP_IN: "Resend OTP in {{seconds}}s",
|
|
104
|
+
VERIFY_AND_SIGN: "Verify & Sign"
|
|
95
105
|
};
|
|
96
106
|
const locale$2 = {
|
|
97
107
|
CHANGE_DETECT_TITLE: "Adakah anda pasti mahu membuang perubahan?",
|
|
@@ -160,7 +170,16 @@ const locale$2 = {
|
|
|
160
170
|
DURATION: "Tempoh",
|
|
161
171
|
STAMP_DUTY: "Duti Setem",
|
|
162
172
|
LEGAL_FEES: "Yuran Guaman",
|
|
163
|
-
MONTHS: "Bulan"
|
|
173
|
+
MONTHS: "Bulan",
|
|
174
|
+
ENTER_SIGNING_OTP: "Masukkan OTP",
|
|
175
|
+
ENTER_SIGNING_OTP_DESC: "Masukkan OTP yang dihantar ke nombor telefon berdaftar anda untuk mengesahkan tandatangan.",
|
|
176
|
+
ENTER_SIGNING_PIN: "Masukkan PIN",
|
|
177
|
+
ENTER_SIGNING_PIN_DESC: "Masukkan PIN anda untuk mengesahkan tandatangan.",
|
|
178
|
+
OTP: "OTP",
|
|
179
|
+
PIN: "PIN",
|
|
180
|
+
RESEND_OTP: "Hantar Semula OTP",
|
|
181
|
+
RESEND_OTP_IN: "Hantar semula OTP dalam {{seconds}}s",
|
|
182
|
+
VERIFY_AND_SIGN: "Sahkan & Tandatangan"
|
|
164
183
|
};
|
|
165
184
|
i18next.addResourceBundle("en", "Dialog", locale$3);
|
|
166
185
|
i18next.addResourceBundle("ms", "Dialog", locale$2);
|
|
@@ -5856,11 +5875,14 @@ function CustomDialog({
|
|
|
5856
5875
|
content,
|
|
5857
5876
|
size,
|
|
5858
5877
|
maxWidth: maxWidth2,
|
|
5859
|
-
hideCloseIcon = false
|
|
5878
|
+
hideCloseIcon = false,
|
|
5879
|
+
disableBackdropClose = false,
|
|
5880
|
+
disableEscapeKeyDown = false,
|
|
5881
|
+
closeIconDisabled = false
|
|
5860
5882
|
}) {
|
|
5861
5883
|
const dialogSize = maxWidth2 !== void 0 ? maxWidth2 : size || "md";
|
|
5862
5884
|
const handleClose = (_event, reason) => {
|
|
5863
|
-
if (
|
|
5885
|
+
if (reason === "backdropClick" && (hideCloseIcon || disableBackdropClose)) return;
|
|
5864
5886
|
onClose();
|
|
5865
5887
|
};
|
|
5866
5888
|
return /* @__PURE__ */ jsxs(
|
|
@@ -5870,6 +5892,7 @@ function CustomDialog({
|
|
|
5870
5892
|
onClose: handleClose,
|
|
5871
5893
|
maxWidth: dialogSize,
|
|
5872
5894
|
fullWidth: true,
|
|
5895
|
+
disableEscapeKeyDown,
|
|
5873
5896
|
children: [
|
|
5874
5897
|
/* @__PURE__ */ jsxs(DialogTitle, { children: [
|
|
5875
5898
|
content.title,
|
|
@@ -5879,6 +5902,7 @@ function CustomDialog({
|
|
|
5879
5902
|
{
|
|
5880
5903
|
"aria-label": "close",
|
|
5881
5904
|
onClick: onClose,
|
|
5905
|
+
disabled: closeIconDisabled,
|
|
5882
5906
|
sx: {
|
|
5883
5907
|
position: "absolute",
|
|
5884
5908
|
right: 8,
|
|
@@ -10396,13 +10420,30 @@ const DigitalProcessSignature = (request_data) => async (dispatch) => {
|
|
|
10396
10420
|
}
|
|
10397
10421
|
dispatch(setDocumentSignJPDF(""));
|
|
10398
10422
|
dispatch(setSignedDocumentJPDF(response.result));
|
|
10423
|
+
return true;
|
|
10399
10424
|
}
|
|
10425
|
+
return false;
|
|
10400
10426
|
} catch (error) {
|
|
10401
10427
|
dispatch(showMessage({ message: error.message, variant: "error" }));
|
|
10428
|
+
return false;
|
|
10402
10429
|
} finally {
|
|
10403
10430
|
dispatch(setIsProcessSignatureLoading(false));
|
|
10404
10431
|
}
|
|
10405
10432
|
};
|
|
10433
|
+
const RequestSigningOtp = (financeApplicationId) => async (dispatch) => {
|
|
10434
|
+
try {
|
|
10435
|
+
dispatch(setIsRequestSigningOtpLoading(true));
|
|
10436
|
+
await api.post(`/v1/DigitalSignature/RequestSigningOtp`, {
|
|
10437
|
+
FinanceApplicationId: financeApplicationId
|
|
10438
|
+
});
|
|
10439
|
+
return true;
|
|
10440
|
+
} catch (error) {
|
|
10441
|
+
dispatch(showMessage({ message: error.message, variant: "error" }));
|
|
10442
|
+
return false;
|
|
10443
|
+
} finally {
|
|
10444
|
+
dispatch(setIsRequestSigningOtpLoading(false));
|
|
10445
|
+
}
|
|
10446
|
+
};
|
|
10406
10447
|
const generateFromJPDF = (financeApplicationId) => async (dispatch) => {
|
|
10407
10448
|
dispatch(setDocumentSignJPDFLoading(true));
|
|
10408
10449
|
try {
|
|
@@ -10441,6 +10482,7 @@ const setIsChangeStatusDialogOpen = (value) => setLoadingState$1("isChangeStatus
|
|
|
10441
10482
|
const setIsUserChangeStatusFormLoading = (value) => setLoadingState$1("isUserChangeStatusFormLoading", value);
|
|
10442
10483
|
const setIsDocumentSignatureDialogOpen = (value) => setLoadingState$1("isDocumentSignatureDialogOpen", value);
|
|
10443
10484
|
const setIsProcessSignatureLoading = (value) => setLoadingState$1("isProcessSignatureLoading", value);
|
|
10485
|
+
const setIsRequestSigningOtpLoading = (value) => setLoadingState$1("isRequestSigningOtpLoading", value);
|
|
10444
10486
|
const setDocumentSignJPDFLoading = (value) => setLoadingState$1("isDocumentSignJPDFLoading", value);
|
|
10445
10487
|
const setIsPdfDialogOpen = (value) => setLoadingState$1("isPdfDialogOpen", value);
|
|
10446
10488
|
const setIsPopoverOpen = (value) => setLoadingState$1("isPopoverOpen", value);
|
|
@@ -10456,6 +10498,7 @@ const getIsChangeStatusDialogOpen = getLoadingStateFactory("isChangeStatusDialog
|
|
|
10456
10498
|
const getIsUserChangeStatusFormLoading = getLoadingStateFactory("isUserChangeStatusFormLoading");
|
|
10457
10499
|
const getIsDocumentSignatureDialogOpen = getLoadingStateFactory("isDocumentSignatureDialogOpen");
|
|
10458
10500
|
const getIsProcessSignatureLoading = getLoadingStateFactory("isProcessSignatureLoading");
|
|
10501
|
+
const getIsRequestSigningOtpLoading = getLoadingStateFactory("isRequestSigningOtpLoading");
|
|
10459
10502
|
const getDocumentSignJPDFLoading = getLoadingStateFactory("isDocumentSignJPDFLoading");
|
|
10460
10503
|
const getIsPdfDialogOpen = getLoadingStateFactory("isPdfDialogOpen");
|
|
10461
10504
|
const getIsPopoverOpen = getLoadingStateFactory("isPopoverOpen");
|
|
@@ -10495,6 +10538,7 @@ const initialState$1 = {
|
|
|
10495
10538
|
isUserChangeStatusFormLoading: false,
|
|
10496
10539
|
isDocumentSignatureDialogOpen: false,
|
|
10497
10540
|
isProcessSignatureLoading: false,
|
|
10541
|
+
isRequestSigningOtpLoading: false,
|
|
10498
10542
|
isDocumentSignJPDFLoading: false,
|
|
10499
10543
|
isPdfDialogOpen: false,
|
|
10500
10544
|
isPopoverOpen: false
|
|
@@ -17730,6 +17774,10 @@ const loginUserRoles = {
|
|
|
17730
17774
|
SuperAdmin: "super-admin"
|
|
17731
17775
|
};
|
|
17732
17776
|
const IMAGE_TYPES = ["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg"];
|
|
17777
|
+
const AuthFactorMode = {
|
|
17778
|
+
OTP: "OTP",
|
|
17779
|
+
PIN: "PIN"
|
|
17780
|
+
};
|
|
17733
17781
|
dayjs.extend(customParseFormat);
|
|
17734
17782
|
function decodeUrlAndGetFileType(url) {
|
|
17735
17783
|
try {
|
|
@@ -25928,6 +25976,13 @@ const PDFPreviewForTheSignature = ({
|
|
|
25928
25976
|
applicationDetailsData
|
|
25929
25977
|
);
|
|
25930
25978
|
const [isTermsConfirmed, setIsTermsConfirmed] = useState(false);
|
|
25979
|
+
const isMobileWebView = (() => {
|
|
25980
|
+
try {
|
|
25981
|
+
return localStorage.getItem("isMobileView") === "true";
|
|
25982
|
+
} catch {
|
|
25983
|
+
return false;
|
|
25984
|
+
}
|
|
25985
|
+
})();
|
|
25931
25986
|
return /* @__PURE__ */ jsx(Dialog$1, { open, onClose, maxWidth: "lg", fullWidth: true, ...props, children: /* @__PURE__ */ jsxs(DialogContent$1, { className: "p-0", children: [
|
|
25932
25987
|
!pdfOnly && (dialogTitle || financeCalculation) && /* @__PURE__ */ jsxs("div", { className: "px-16 pt-12 pb-16", children: [
|
|
25933
25988
|
dialogTitle && /* @__PURE__ */ jsx(Typography$1, { variant: "h6", className: "font-semibold mb-12", children: dialogTitle }),
|
|
@@ -26000,7 +26055,21 @@ const PDFPreviewForTheSignature = ({
|
|
|
26000
26055
|
] }) })
|
|
26001
26056
|
] })
|
|
26002
26057
|
] }),
|
|
26003
|
-
/* @__PURE__ */ jsx("div", { className: "px-16 py-12", children:
|
|
26058
|
+
/* @__PURE__ */ jsx("div", { className: "px-16 py-12", children: isMobileWebView ? (
|
|
26059
|
+
// The embedded app WebView has no native PDF plugin, so a plain
|
|
26060
|
+
// <embed> renders blank there. Route through Google's viewer
|
|
26061
|
+
// instead, which fetches and rasterizes the PDF itself — regular
|
|
26062
|
+
// browsers (desktop and mobile) keep the native <embed> below.
|
|
26063
|
+
/* @__PURE__ */ jsx(
|
|
26064
|
+
"iframe",
|
|
26065
|
+
{
|
|
26066
|
+
src: `https://docs.google.com/viewer?embedded=true&url=${encodeURIComponent(filePath)}`,
|
|
26067
|
+
width: "100%",
|
|
26068
|
+
style: { height: pdfOnly ? "85vh" : "70vh", border: "none" },
|
|
26069
|
+
title: "PDF preview"
|
|
26070
|
+
}
|
|
26071
|
+
)
|
|
26072
|
+
) : /* @__PURE__ */ jsx(
|
|
26004
26073
|
"embed",
|
|
26005
26074
|
{
|
|
26006
26075
|
src: filePath,
|
|
@@ -26043,6 +26112,122 @@ const PDFPreviewForTheSignature = ({
|
|
|
26043
26112
|
) }) })
|
|
26044
26113
|
] }) });
|
|
26045
26114
|
};
|
|
26115
|
+
const OTP_LENGTH = 6;
|
|
26116
|
+
const MAX_PIN_LENGTH = 12;
|
|
26117
|
+
const RESEND_SECONDS = 30;
|
|
26118
|
+
const AuthFactorStep = ({
|
|
26119
|
+
open,
|
|
26120
|
+
mode,
|
|
26121
|
+
loading = false,
|
|
26122
|
+
error,
|
|
26123
|
+
onClose,
|
|
26124
|
+
onSubmit,
|
|
26125
|
+
onResendOtp,
|
|
26126
|
+
resendLoading = false,
|
|
26127
|
+
ColoredSubmitButton
|
|
26128
|
+
}) => {
|
|
26129
|
+
const { t: t2 } = useTranslation("Dialog");
|
|
26130
|
+
const [value, setValue] = useState("");
|
|
26131
|
+
const [secondsLeft, setSecondsLeft] = useState(RESEND_SECONDS);
|
|
26132
|
+
const [showValue, setShowValue] = useState(false);
|
|
26133
|
+
useEffect(() => {
|
|
26134
|
+
if (!open) return;
|
|
26135
|
+
setValue("");
|
|
26136
|
+
setSecondsLeft(RESEND_SECONDS);
|
|
26137
|
+
setShowValue(false);
|
|
26138
|
+
}, [open, mode]);
|
|
26139
|
+
useEffect(() => {
|
|
26140
|
+
if (mode !== AuthFactorMode.OTP || !open || secondsLeft <= 0) return;
|
|
26141
|
+
const timer = setTimeout(() => setSecondsLeft((s4) => s4 - 1), 1e3);
|
|
26142
|
+
return () => clearTimeout(timer);
|
|
26143
|
+
}, [mode, open, secondsLeft]);
|
|
26144
|
+
const handleChange = (newValue) => {
|
|
26145
|
+
const digitsOnly = newValue.replace(/\D/g, "");
|
|
26146
|
+
setValue(digitsOnly.slice(0, mode === AuthFactorMode.OTP ? OTP_LENGTH : MAX_PIN_LENGTH));
|
|
26147
|
+
};
|
|
26148
|
+
const handleResend = () => {
|
|
26149
|
+
setSecondsLeft(RESEND_SECONDS);
|
|
26150
|
+
onResendOtp == null ? void 0 : onResendOtp();
|
|
26151
|
+
};
|
|
26152
|
+
const isValueValid = mode === AuthFactorMode.OTP ? value.length === OTP_LENGTH : value.length > 0;
|
|
26153
|
+
return /* @__PURE__ */ jsx(
|
|
26154
|
+
CustomDialog,
|
|
26155
|
+
{
|
|
26156
|
+
open,
|
|
26157
|
+
onClose,
|
|
26158
|
+
maxWidth: "xs",
|
|
26159
|
+
disableBackdropClose: true,
|
|
26160
|
+
disableEscapeKeyDown: true,
|
|
26161
|
+
closeIconDisabled: loading,
|
|
26162
|
+
content: {
|
|
26163
|
+
title: mode === AuthFactorMode.OTP ? t2("ENTER_SIGNING_OTP") : t2("ENTER_SIGNING_PIN"),
|
|
26164
|
+
description: mode === AuthFactorMode.OTP ? t2("ENTER_SIGNING_OTP_DESC") : t2("ENTER_SIGNING_PIN_DESC"),
|
|
26165
|
+
component: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-16", children: [
|
|
26166
|
+
/* @__PURE__ */ jsx(
|
|
26167
|
+
CommonTextField,
|
|
26168
|
+
{
|
|
26169
|
+
autoFocus: true,
|
|
26170
|
+
label: mode === AuthFactorMode.OTP ? t2("OTP") : t2("PIN"),
|
|
26171
|
+
type: mode === AuthFactorMode.PIN && !showValue ? "password" : "text",
|
|
26172
|
+
inputMode: "numeric",
|
|
26173
|
+
value,
|
|
26174
|
+
onChange: handleChange,
|
|
26175
|
+
error: !!error,
|
|
26176
|
+
helperText: error,
|
|
26177
|
+
isTextUpperCase: false,
|
|
26178
|
+
fullWidth: true,
|
|
26179
|
+
InputProps: mode === AuthFactorMode.PIN ? {
|
|
26180
|
+
endAdornment: /* @__PURE__ */ jsx(InputAdornment$1, { position: "end", children: /* @__PURE__ */ jsx(
|
|
26181
|
+
IconButton$1,
|
|
26182
|
+
{
|
|
26183
|
+
onClick: () => setShowValue((s4) => !s4),
|
|
26184
|
+
edge: "end",
|
|
26185
|
+
tabIndex: -1,
|
|
26186
|
+
children: showValue ? /* @__PURE__ */ jsx(VisibilityOff, { fontSize: "small" }) : /* @__PURE__ */ jsx(Visibility, { fontSize: "small" })
|
|
26187
|
+
}
|
|
26188
|
+
) })
|
|
26189
|
+
} : void 0,
|
|
26190
|
+
"data-test-id": "auth-factor-input"
|
|
26191
|
+
}
|
|
26192
|
+
),
|
|
26193
|
+
mode === AuthFactorMode.OTP && /* @__PURE__ */ jsx(Box$1, { className: "flex justify-end", children: /* @__PURE__ */ jsx(
|
|
26194
|
+
ColoredSubmitButton,
|
|
26195
|
+
{
|
|
26196
|
+
variant: "text",
|
|
26197
|
+
onClick: handleResend,
|
|
26198
|
+
disabled: secondsLeft > 0 || resendLoading,
|
|
26199
|
+
isLoading: resendLoading,
|
|
26200
|
+
text: secondsLeft > 0 ? t2("RESEND_OTP_IN", { seconds: secondsLeft }) : t2("RESEND_OTP")
|
|
26201
|
+
}
|
|
26202
|
+
) }),
|
|
26203
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-10", children: [
|
|
26204
|
+
/* @__PURE__ */ jsx(
|
|
26205
|
+
ColoredSubmitButton,
|
|
26206
|
+
{
|
|
26207
|
+
variant: "outlined",
|
|
26208
|
+
onClick: onClose,
|
|
26209
|
+
disabled: loading,
|
|
26210
|
+
className: "rounded-6",
|
|
26211
|
+
text: t2("CANCEL")
|
|
26212
|
+
}
|
|
26213
|
+
),
|
|
26214
|
+
/* @__PURE__ */ jsx(
|
|
26215
|
+
ColoredSubmitButton,
|
|
26216
|
+
{
|
|
26217
|
+
variant: "contained",
|
|
26218
|
+
onClick: () => onSubmit(value),
|
|
26219
|
+
disabled: !isValueValid || loading,
|
|
26220
|
+
isLoading: loading,
|
|
26221
|
+
className: "rounded-6",
|
|
26222
|
+
text: t2("VERIFY_AND_SIGN")
|
|
26223
|
+
}
|
|
26224
|
+
)
|
|
26225
|
+
] })
|
|
26226
|
+
] })
|
|
26227
|
+
}
|
|
26228
|
+
}
|
|
26229
|
+
);
|
|
26230
|
+
};
|
|
26046
26231
|
i18next.addResourceBundle("en", "Dialog", locale$3);
|
|
26047
26232
|
i18next.addResourceBundle("ms", "Dialog", locale$2);
|
|
26048
26233
|
function DocumentSigningDialog({
|
|
@@ -26052,30 +26237,66 @@ function DocumentSigningDialog({
|
|
|
26052
26237
|
ColoredSubmitButton,
|
|
26053
26238
|
financeCalculation,
|
|
26054
26239
|
showConfirmCheckbox = false,
|
|
26055
|
-
showTitle = true
|
|
26240
|
+
showTitle = true,
|
|
26241
|
+
requireAuthFactor = false,
|
|
26242
|
+
isOfficer
|
|
26056
26243
|
}) {
|
|
26057
26244
|
const { t: t2 } = useTranslation("Dialog");
|
|
26058
26245
|
const open = useSelector(getIsDocumentSignatureDialogOpen);
|
|
26059
26246
|
const documentSignJPDF = useSelector(getDocumentSignJPDF);
|
|
26060
26247
|
const signedDocumentJPDF = useSelector(getSignedDocumentJPDF);
|
|
26061
26248
|
const isProcessSignatureLoading = useSelector(getIsProcessSignatureLoading);
|
|
26249
|
+
const isRequestSigningOtpLoading = useSelector(getIsRequestSigningOtpLoading);
|
|
26062
26250
|
const activeFinanceDetail = useSelector(getActiveFinanceDetail);
|
|
26063
26251
|
const dispatch = useDispatch();
|
|
26252
|
+
const [authFactorOpen, setAuthFactorOpen] = useState(false);
|
|
26253
|
+
const getSignatureRole = () => {
|
|
26254
|
+
if (loginUserDetail.data.slug === loginUserRoles.Admin) {
|
|
26255
|
+
return digitalSignatureRole.Admin;
|
|
26256
|
+
}
|
|
26257
|
+
if (loginUserDetail.data.slug === loginUserRoles.Lawyer) {
|
|
26258
|
+
return digitalSignatureRole.Lawyer;
|
|
26259
|
+
}
|
|
26260
|
+
return digitalSignatureRole.User;
|
|
26261
|
+
};
|
|
26064
26262
|
const onClose = () => {
|
|
26263
|
+
setAuthFactorOpen(false);
|
|
26065
26264
|
dispatch(setIsDocumentSignatureDialogOpen(false));
|
|
26066
26265
|
};
|
|
26067
26266
|
const handleButtonClick = () => {
|
|
26068
|
-
|
|
26069
|
-
|
|
26070
|
-
|
|
26071
|
-
|
|
26072
|
-
|
|
26267
|
+
if (!requireAuthFactor) {
|
|
26268
|
+
const request_data = {
|
|
26269
|
+
FinanceApplicationId: financeDetail.id,
|
|
26270
|
+
SignatureRole: getSignatureRole()
|
|
26271
|
+
};
|
|
26272
|
+
dispatch(DigitalProcessSignature(request_data));
|
|
26273
|
+
return;
|
|
26274
|
+
}
|
|
26275
|
+
if (isOfficer) {
|
|
26276
|
+
setAuthFactorOpen(true);
|
|
26277
|
+
return;
|
|
26073
26278
|
}
|
|
26279
|
+
dispatch(RequestSigningOtp(financeDetail.id)).then((success) => {
|
|
26280
|
+
if (success) {
|
|
26281
|
+
setAuthFactorOpen(true);
|
|
26282
|
+
}
|
|
26283
|
+
});
|
|
26284
|
+
};
|
|
26285
|
+
const handleAuthFactorClose = () => {
|
|
26286
|
+
setAuthFactorOpen(false);
|
|
26287
|
+
};
|
|
26288
|
+
const handleAuthFactorSubmit = async (authFactorValue) => {
|
|
26074
26289
|
const request_data = {
|
|
26075
26290
|
FinanceApplicationId: financeDetail.id,
|
|
26076
|
-
|
|
26291
|
+
AuthFactor: authFactorValue
|
|
26077
26292
|
};
|
|
26078
|
-
dispatch(DigitalProcessSignature(request_data));
|
|
26293
|
+
const success = await dispatch(DigitalProcessSignature(request_data));
|
|
26294
|
+
if (success) {
|
|
26295
|
+
setAuthFactorOpen(false);
|
|
26296
|
+
}
|
|
26297
|
+
};
|
|
26298
|
+
const handleResendOtp = () => {
|
|
26299
|
+
dispatch(RequestSigningOtp(financeDetail.id));
|
|
26079
26300
|
};
|
|
26080
26301
|
const handleClose = (_event, reason) => {
|
|
26081
26302
|
if (reason && reason === "backdropClick") return;
|
|
@@ -26094,11 +26315,13 @@ function DocumentSigningDialog({
|
|
|
26094
26315
|
}
|
|
26095
26316
|
};
|
|
26096
26317
|
const handlePDFPreviewClose = () => {
|
|
26318
|
+
setAuthFactorOpen(false);
|
|
26097
26319
|
dispatch(setDocumentSignJPDF(""));
|
|
26098
26320
|
dispatch(setActiveFinanceDetail(null));
|
|
26099
26321
|
dispatch(setIsDocumentSignatureDialogOpen(false));
|
|
26100
26322
|
};
|
|
26101
26323
|
const handleSignedPDFClose = () => {
|
|
26324
|
+
setAuthFactorOpen(false);
|
|
26102
26325
|
dispatch(setSignedDocumentJPDF(""));
|
|
26103
26326
|
dispatch(setActiveFinanceDetail(null));
|
|
26104
26327
|
dispatch(setIsDocumentSignatureDialogOpen(false));
|
|
@@ -26166,7 +26389,7 @@ function DocumentSigningDialog({
|
|
|
26166
26389
|
{
|
|
26167
26390
|
filePath: signedDocumentJPDF || documentSignJPDF,
|
|
26168
26391
|
open: !!(signedDocumentJPDF || documentSignJPDF),
|
|
26169
|
-
isButtonLoading: isProcessSignatureLoading,
|
|
26392
|
+
isButtonLoading: isProcessSignatureLoading || isRequestSigningOtpLoading,
|
|
26170
26393
|
onClose: signedDocumentJPDF ? handleSignedPDFClose : handlePDFPreviewClose,
|
|
26171
26394
|
bottomButtonLabel: t2("SIGN_DOCUMENT"),
|
|
26172
26395
|
onConfirm: handleButtonClick,
|
|
@@ -26180,6 +26403,19 @@ function DocumentSigningDialog({
|
|
|
26180
26403
|
showConfirmCheckbox,
|
|
26181
26404
|
pdfOnly: !!signedDocumentJPDF
|
|
26182
26405
|
}
|
|
26406
|
+
),
|
|
26407
|
+
requireAuthFactor && /* @__PURE__ */ jsx(
|
|
26408
|
+
AuthFactorStep,
|
|
26409
|
+
{
|
|
26410
|
+
open: authFactorOpen,
|
|
26411
|
+
mode: isOfficer ? AuthFactorMode.PIN : AuthFactorMode.OTP,
|
|
26412
|
+
loading: isProcessSignatureLoading,
|
|
26413
|
+
onClose: handleAuthFactorClose,
|
|
26414
|
+
onSubmit: handleAuthFactorSubmit,
|
|
26415
|
+
onResendOtp: isOfficer ? void 0 : handleResendOtp,
|
|
26416
|
+
resendLoading: isRequestSigningOtpLoading,
|
|
26417
|
+
ColoredSubmitButton
|
|
26418
|
+
}
|
|
26183
26419
|
)
|
|
26184
26420
|
] })
|
|
26185
26421
|
] }) }) });
|
|
@@ -46686,9 +46922,9 @@ const useDesktopPicker = (_ref) => {
|
|
|
46686
46922
|
additionalViewProps: {},
|
|
46687
46923
|
wrapperVariant: "desktop"
|
|
46688
46924
|
}));
|
|
46689
|
-
const InputAdornment$
|
|
46925
|
+
const InputAdornment$12 = (_slots$inputAdornment = slots.inputAdornment) != null ? _slots$inputAdornment : InputAdornment;
|
|
46690
46926
|
const _useSlotProps = useSlotProps({
|
|
46691
|
-
elementType: InputAdornment$
|
|
46927
|
+
elementType: InputAdornment$12,
|
|
46692
46928
|
externalSlotProps: innerSlotProps == null ? void 0 : innerSlotProps.inputAdornment,
|
|
46693
46929
|
additionalProps: {
|
|
46694
46930
|
position: "end"
|
|
@@ -46731,7 +46967,7 @@ const useDesktopPicker = (_ref) => {
|
|
|
46731
46967
|
if (hasUIView) {
|
|
46732
46968
|
fieldProps.InputProps = _extends({}, fieldProps.InputProps, {
|
|
46733
46969
|
ref: containerRef,
|
|
46734
|
-
[`${inputAdornmentProps.position}Adornment`]: /* @__PURE__ */ jsx(InputAdornment$
|
|
46970
|
+
[`${inputAdornmentProps.position}Adornment`]: /* @__PURE__ */ jsx(InputAdornment$12, _extends({}, inputAdornmentProps, {
|
|
46735
46971
|
children: /* @__PURE__ */ jsx(OpenPickerButton, _extends({}, openPickerButtonProps, {
|
|
46736
46972
|
children: /* @__PURE__ */ jsx(OpenPickerIcon, _extends({}, innerSlotProps == null ? void 0 : innerSlotProps.openPickerIcon))
|
|
46737
46973
|
}))
|