🔥 The free & Open Source DocuSign alternative
JavaScript digital-signaturedocument-signingdocusign-alternativedocusign-freee-signatureelectronic-signatureelectronic-signaturesesignesignaturehacktoberfestjavascriptlegaltechmongodbnodejsopen-sourcepdf-signpdf-signaturereactjsself-hostedsign-pdf-files
fix: check subscription details issue in guest login flow
RaktimaNXGfc564ca37bc6
diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.jsindex 2d2e341d8..5214997a9 100644--- a/apps/OpenSign/src/constant/Utils.js+++ b/apps/OpenSign/src/constant/Utils.js@@ -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;diff --git a/apps/OpenSign/src/pages/PdfRequestFiles.js b/apps/OpenSign/src/pages/PdfRequestFiles.jsindex a1e25e61c..39073a2fd 100644--- a/apps/OpenSign/src/pages/PdfRequestFiles.js+++ b/apps/OpenSign/src/pages/PdfRequestFiles.js@@ -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 detailsconst 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-libconst 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 =