Merge pull request #612 from OpenSignLabs/fix_issue

fix: issue of signUrl and subscription details in guest login flow
This commit is contained in:
prafull-opensignlabs
2024-04-17 20:14:47 +05:30
committed by GitHub
4 changed files with 18 additions and 14 deletions
+9 -3
View File
@@ -13,10 +13,16 @@ export const openInNewTab = (url) => {
window.open(url, "_blank", "noopener,noreferrer");
};
export async function fetchSubscription() {
export async function fetchSubscription(extUserId) {
try {
const extClass = localStorage.getItem("Extand_Class");
const jsonSender = JSON.parse(extClass);
let extUser;
if (extClass) {
const jsonSender = JSON.parse(extClass);
extUser = jsonSender[0].objectId;
} else {
extUser = extUserId;
}
const baseURL = localStorage.getItem("baseUrl");
const url = `${baseURL}functions/getsubscriptions`;
const headers = {
@@ -24,7 +30,7 @@ export async function fetchSubscription() {
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
sessionToken: localStorage.getItem("accesstoken")
};
const params = { extUserId: jsonSender[0].objectId };
const params = { extUserId: extUser };
const tenatRes = await axios.post(url, params, { headers: headers });
const plan = tenatRes.data?.result?.result?.PlanCode;
const billingDate = tenatRes.data?.result?.result?.Next_billing_date?.iso;
+1 -6
View File
@@ -178,12 +178,7 @@ function GuestLogin() {
>
<div className="main_head">
<div className="w-[250px] h-[66px] inline-block overflow-hidden">
<img
src={appLogo}
loading={true}
className="object-contain h-full"
alt="logo"
/>
<img src={appLogo} className="object-contain h-full" alt="logo" />
</div>
</div>
+5 -4
View File
@@ -138,8 +138,8 @@ function PdfRequestFiles() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [divRef.current]);
async function checkIsSubscribed() {
const res = await fetchSubscription();
async function checkIsSubscribed(extUserId) {
const res = await fetchSubscription(extUserId);
const plan = res.plan;
const billingDate = res.billingDate;
if (plan === "freeplan") {
@@ -169,7 +169,8 @@ function PdfRequestFiles() {
//getting document details
const documentData = await contractDocument(documentId);
if (documentData && documentData.length > 0) {
const url = documentData[0] && documentData[0]?.URL;
const url =
documentData[0] && (documentData[0]?.SignedUrl || documentData[0]?.URL);
//convert document url in array buffer format to use embed widgets in pdf using pdf-lib
const arrayBuffer = await convertPdfArrayBuffer(url);
if (arrayBuffer === "Error") {
@@ -178,7 +179,7 @@ function PdfRequestFiles() {
setPdfArrayBuffer(arrayBuffer);
}
if (isEnableSubscription) {
await checkIsSubscribed(documentData[0]?.ExtUserPtr?.Email);
await checkIsSubscribed(documentData[0]?.ExtUserPtr?.objectId);
}
setExtUserId(documentData[0]?.ExtUserPtr?.objectId);
const isCompleted =
+3 -1
View File
@@ -1001,7 +1001,9 @@ function SignYourSelf() {
{/* this component used to render all pdf pages in left side */}
<RenderAllPdfPage
signPdfUrl={pdfDetails[0] && pdfDetails[0].URL}
signPdfUrl={
pdfDetails[0] && (pdfDetails[0].SignedUrl || pdfDetails[0].URL)
}
allPages={allPages}
setAllPages={setAllPages}
setPageNumber={setPageNumber}