MCPcopy Index your code
hub / github.com/OpenSignLabs/OpenSign / embedWidgetsData

Function embedWidgetsData

apps/OpenSign/src/pages/SignyourselfPdf.jsx:616–757  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

614 };
615 //function for send placeholder's co-ordinate(x,y) position embed signature url or stamp url
616 async function embedWidgetsData() {
617 //check current user email is verified or not
618 const currentUser = JSON.parse(JSON.stringify(Parse.User.current()));
619 let isEmailVerified;
620 isEmailVerified = currentUser?.emailVerified;
621 const isEnableOTP = pdfDetails?.[0]?.IsEnableOTP || false;
622 if (isEnableOTP) {
623 if (isEmailVerified) {
624 setIsEmailVerified(isEmailVerified);
625 } else {
626 try {
627 const userQuery = new Parse.Query(Parse.User);
628 const user = await userQuery.get(currentUser.objectId, {
629 sessionToken: localStorage.getItem("accesstoken")
630 });
631 if (user) {
632 isEmailVerified = user?.get("emailVerified");
633 setIsEmailVerified(isEmailVerified);
634 }
635 } catch (e) {
636 setHandleError(t("something-went-wrong-mssg"));
637 }
638 }
639 }
640 if (!isEnableOTP || isEmailVerified) {
641 let showAlert = false,
642 widgetKey,
643 tourPageNumber;
644 try {
645 const isSignatureExist = xyPosition?.some((p) =>
646 p?.pos?.some((x) => x?.type === "signature")
647 );
648 if (!isSignatureExist) {
649 setIsAlert({
650 header: t("fields-required"),
651 isShow: true,
652 alertMessage: t("signature-widget-alert-1")
653 });
654 return;
655 }
656
657 for (let i = 0; i < xyPosition?.length; i++) {
658 tourPageNumber = xyPosition[i]?.pageNumber;
659 const requiredWidgets = xyPosition[i].pos.filter(
660 (position) => position.type !== "checkbox"
661 );
662 if (requiredWidgets && requiredWidgets?.length > 0) {
663 let checkSigned;
664 for (let i = 0; i < requiredWidgets?.length; i++) {
665 checkSigned = requiredWidgets[i]?.options?.response;
666 if (isEmptyValue(checkSigned)) {
667 const checkSignUrl = requiredWidgets[i]?.SignUrl;
668 let checkDefaultSigned =
669 requiredWidgets[i]?.options?.defaultValue;
670 if (
671 !checkSignUrl &&
672 isEmptyValue(checkDefaultSigned) &&
673 !showAlert

Callers

nothing calls this directly

Calls 4

isEmptyValueFunction · 0.90
embedDocIdFunction · 0.90
embedWidgetsToDocFunction · 0.90
signPdfFunFunction · 0.70

Tested by

no test coverage detected