Merge branch 'staging' into raktima-opensignlabs-patch-11

This commit is contained in:
Raktima
2024-07-17 15:19:03 +05:30
committed by GitHub
23 changed files with 690 additions and 820 deletions
File diff suppressed because one or more lines are too long
+14 -9
View File
@@ -136,10 +136,6 @@ function App() {
</>
)}
<Route element={<HomeLayout />}>
{isEnableSubscription && (
<Route path="/teams" element={<TeamList />} />
)}
<Route path="/users" element={<UserList />} />
<Route
path="/changepassword"
element={<LazyPage Page={ChangePassword} />}
@@ -159,11 +155,6 @@ function App() {
path="/managesign"
element={<LazyPage Page={ManageSign} />}
/>
<Route
path="/generatetoken"
element={<LazyPage Page={GenerateToken} />}
/>
<Route path="/webhook" element={<LazyPage Page={Webhook} />} />
<Route
path="/template/:templateId"
element={<TemplatePlaceholder />}
@@ -194,6 +185,20 @@ function App() {
path="/recipientSignPdf/:docId"
element={<PdfRequestFiles />}
/>
{isEnableSubscription && (
<>
<Route path="/teams" element={<TeamList />} />
<Route
path="/generatetoken"
element={<LazyPage Page={GenerateToken} />}
/>
<Route
path="/webhook"
element={<LazyPage Page={Webhook} />}
/>
</>
)}
<Route path="/users" element={<UserList />} />
</Route>
<Route path="/sso" element={<SSOVerify />} />
<Route path="*" element={<PageNotFound />} />
+3 -1
View File
@@ -46,7 +46,6 @@ const AddUser = (props) => {
const teamRes = await team.find();
if (teamRes.length > 0) {
const _teamRes = JSON.parse(JSON.stringify(teamRes));
// if (isEnableSubscription) {
setTeamList(_teamRes);
if (!isEnableSubscription) {
const allUserId =
@@ -107,6 +106,9 @@ const AddUser = (props) => {
objectId: localUser.OrganizationId.objectId
});
}
if (localUser && localUser.Company) {
extUser.set("Company", localUser.Company);
}
if (localStorage.getItem("TenantId")) {
extUser.set("TenantId", {
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from "react";
import { isEnableSubscription } from "../../constant/const";
import ModalUi from "../../primitives/ModalUi";
import { radioButtonWidget } from "../../constant/Utils";
import PremiumAlertHeader from "../../primitives/PremiumAlertHeader";
import Upgrade from "../../primitives/Upgrade";
function DropdownWidgetOption(props) {
const [dropdownOptionList, setDropdownOptionList] = useState([
@@ -214,55 +213,57 @@ function DropdownWidgetOption(props) {
onClick={handleAddInput}
className="fa-light fa-square-plus text-[25px] ml-[10px] op-text-primary cursor-pointer"
></i>
<div>
{props.type === "checkbox" && !props.isSignYourself && (
<>
<label
className={`${
!props.isSubscribe ? "text-[gray]" : ""
} text-[13px] font-semibold`}
>
Minimun check
</label>
{!props.isSubscribe && isEnableSubscription && <Upgrade />}
<input
required
defaultValue={0}
value={minCount}
onChange={(e) => {
const count = handleSetMinMax(e);
setMinCount(count);
}}
className={`${
props.isSubscribe || !isEnableSubscription
? ""
: "pointer-events-none bg-opacity-50"
} op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs`}
/>
<label
className={`${
!props.isSubscribe ? "text-[gray]" : ""
} text-[13px] font-semibold`}
>
Maximum check
</label>
<input
required
defaultValue={0}
value={maxCount}
onChange={(e) => {
const count = handleSetMinMax(e);
setMaxCount(count);
}}
className={`${
props.isSubscribe || !isEnableSubscription
? ""
: "pointer-events-none bg-opacity-50"
} op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs`}
/>
</>
)}
</div>
{isEnableSubscription && (
<div>
{props.type === "checkbox" && !props.isSignYourself && (
<>
<label
className={`${
!props.isSubscribe ? "text-[gray]" : ""
} text-[13px] font-semibold`}
>
Minimun check
</label>
{!props.isSubscribe && isEnableSubscription && (
<Upgrade />
)}
<input
required
defaultValue={0}
value={minCount}
disabled={props.isSubscribe ? false : true}
onChange={(e) => {
const count = handleSetMinMax(e);
setMinCount(count);
}}
className={`${
props.isSubscribe ? "" : "pointer-events-none"
} op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs`}
/>
<label
className={`${
!props.isSubscribe ? "text-[gray]" : ""
} text-[13px] font-semibold`}
>
Maximum check
</label>
<input
required
defaultValue={0}
value={maxCount}
disabled={props.isSubscribe ? false : true}
onChange={(e) => {
const count = handleSetMinMax(e);
setMaxCount(count);
}}
className={`${
props.isSubscribe ? "" : "pointer-events-none"
} op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs`}
/>
</>
)}
</div>
)}
</div>
{["dropdown", radioButtonWidget].includes(props.type) && (
<>
@@ -344,15 +345,6 @@ function DropdownWidgetOption(props) {
</div>
)}
</div>
{props.type === "checkbox" &&
!props.isSignYourself &&
!isEnableSubscription && (
<PremiumAlertHeader
message={
"Field validations are free in beta, this feature will incur a fee later."
}
/>
)}
<div
className={`${
props.type === "checkbox" && !props.isSignYourself
@@ -1,6 +1,5 @@
import React, { useState, useEffect } from "react";
import { checkIsSubscribed, getFileName } from "../../constant/Utils";
import PremiumAlertHeader from "../../primitives/PremiumAlertHeader";
import Upgrade from "../../primitives/Upgrade";
import { isEnableSubscription } from "../../constant/const";
// import SelectFolder from "../../premitives/SelectFolder";
@@ -134,39 +133,32 @@ const EditTemplate = ({ template, onSuccess }) => {
<div className="text-[12px]">No</div>
</div>
</div>
<div className="text-xs mt-2">
{!isEnableSubscription && (
<PremiumAlertHeader
message={
"Auto reminder is free in beta, this feature will incur a fee later."
{isEnableSubscription && (
<div className="text-xs mt-2">
<span
className={
isSubscribe ? "font-semibold" : "font-semibold text-gray-300"
}
/>
)}
<span
className={
isSubscribe || !isEnableSubscription
? "font-semibold"
: "font-semibold text-gray-300"
}
>
Auto reminder{" "}
{!isSubscribe && isEnableSubscription && <Upgrade />}
</span>
<label
className={`${
isSubscribe || !isEnableSubscription
? "cursor-pointer "
: "pointer-events-none opacity-50"
} relative block items-center mb-0`}
>
<input
checked={formData.AutomaticReminders}
onChange={handleAutoReminder}
type="checkbox"
className="op-toggle transition-all checked:[--tglbg:#3368ff] checked:bg-white mt-2"
/>
</label>
</div>
>
Auto reminder{" "}
{!isSubscribe && isEnableSubscription && <Upgrade />}
</span>
<label
className={`${
isSubscribe
? "cursor-pointer "
: "pointer-events-none opacity-50"
} relative block items-center mb-0`}
>
<input
checked={formData.AutomaticReminders}
onChange={handleAutoReminder}
type="checkbox"
className="op-toggle transition-all checked:[--tglbg:#3368ff] checked:bg-white mt-2"
/>
</label>
</div>
)}
{isSubscribe && formData?.AutomaticReminders === true && (
<div className="text-xs mt-2">
<label className="block">
@@ -9,9 +9,7 @@ function TextFontSetting(props) {
isOpen={props.isTextSetting}
reduceWidth={"max-w-[350px]"}
title={"Text field"}
handleClose={() => {
props.setIsTextSetting(false);
}}
handleClose={() => props.setIsTextSetting(false)}
>
<div className="h-full p-[20px]">
<div className="flex items-center">
@@ -3,7 +3,6 @@ import ModalUi from "../../primitives/ModalUi";
import "../../styles/AddUser.css";
import RegexParser from "regex-parser";
import { textInputWidget, textWidget } from "../../constant/Utils";
import PremiumAlertHeader from "../../primitives/PremiumAlertHeader";
import Upgrade from "../../primitives/Upgrade";
import { isEnableSubscription } from "../../constant/const";
import Tooltip from "../../primitives/Tooltip";
@@ -107,15 +106,6 @@ const WidgetNameModal = (props) => {
handleClose={props.handleClose && props.handleClose}
title={"Widget info"}
>
{(props.defaultdata?.type === textInputWidget ||
props.widgetName === textInputWidget) &&
!isEnableSubscription && (
<PremiumAlertHeader
message={
"Field validations are free in beta, this feature will incur a fee later."
}
/>
)}
<form
onSubmit={handleSubmit}
className={`${
@@ -141,64 +131,69 @@ const WidgetNameModal = (props) => {
{(props.defaultdata?.type === textInputWidget ||
props.widgetName === textInputWidget) && (
<>
<div className="mb-[0.75rem]">
<div className="flex items-center gap-1">
<label
htmlFor="textvalidate"
{isEnableSubscription && (
<div className="mb-[0.75rem]">
<div className="flex items-center gap-1">
<label
htmlFor="textvalidate"
className={`${
!props.isSubscribe && isEnableSubscription
? "bg-opacity-50 pointer-events-none"
: ""
} text-[13px]`}
>
Validation
</label>
<Tooltip
url={"https://www.w3schools.com/jsref/jsref_obj_regexp.asp"}
/>
{!props.isSubscribe && isEnableSubscription && <Upgrade />}
</div>
<div
className={`${
!props.isSubscribe && isEnableSubscription
? "bg-opacity-50 pointer-events-none"
: ""
} text-[13px]`}
} flex flex-row gap-[10px] mb-[0.5rem]`}
>
Validation
</label>
<Tooltip
url={"https://www.w3schools.com/jsref/jsref_obj_regexp.asp"}
/>
{!props.isSubscribe && isEnableSubscription && <Upgrade />}
</div>
<div
className={`${
!props.isSubscribe && isEnableSubscription
? "bg-opacity-50 pointer-events-none"
: ""
} flex flex-row gap-[10px] mb-[0.5rem]`}
>
<div className="w-full relative group">
<input
className="z-20 relative op-input op-input-bordered rounded-r-none op-input-sm focus:outline-none group-hover:border-base-content w-[87%] md:w-[92%] text-xs"
name="textvalidate"
placeholder="Enter custom regular expression"
value={formdata.textvalidate}
onChange={(e) => handleChange(e)}
// onBlur={() => handleBlurRegex()}
/>
<select
className="validationlist op-input op-input-bordered op-input-sm focus:outline-none group-hover:border-base-content w-full text-xs"
name="textvalidate"
value={formdata.textvalidate}
onChange={(e) => handleChange(e)}
onBlur={() => handleBlurRegex()}
>
<option
disabled={formdata?.textvalidate}
className="text-[13px]"
<div className="w-full relative group">
<input
className="z-20 relative op-input op-input-bordered rounded-r-none op-input-sm focus:outline-none group-hover:border-base-content w-[87%] md:w-[92%] text-xs"
name="textvalidate"
placeholder="Enter custom regular expression"
value={formdata.textvalidate}
onChange={(e) => handleChange(e)}
// onBlur={() => handleBlurRegex()}
/>
<select
className="validationlist op-input op-input-bordered op-input-sm focus:outline-none group-hover:border-base-content w-full text-xs"
name="textvalidate"
value={formdata.textvalidate}
onChange={(e) => handleChange(e)}
onBlur={() => handleBlurRegex()}
>
Select...
</option>
{inputOpt.map((data, ind) => {
return (
<option className="text-[13px]" key={ind} value={data}>
{data}
</option>
);
})}
</select>
<option
disabled={formdata?.textvalidate}
className="text-[13px]"
>
Select...
</option>
{inputOpt.map((data, ind) => {
return (
<option
className="text-[13px]"
key={ind}
value={data}
>
{data}
</option>
);
})}
</select>
</div>
</div>
</div>
</div>
)}
<div className="mb-[0.75rem]">
<label htmlFor="name" className="text-[13px]">
Default value
@@ -62,8 +62,9 @@ const Sidebar = ({ isOpen, closeSidebar }) => {
}
];
} else {
const arr = newItem.children.slice(1, 2);
newItem.children = [
...newItem.children,
...arr,
{
icon: "fa-light fa-users fa-fw",
title: "Users",
+1 -2
View File
@@ -1,6 +1,5 @@
import axios from "axios";
import moment from "moment";
import { isEnableSubscription } from "./const";
import React from "react";
import { rgb } from "pdf-lib";
import Parse from "parse";
@@ -569,7 +568,7 @@ export const signPdfFun = async (
if (
tenantDetails?.CompletionBody &&
tenantDetails?.CompletionSubject &&
(!isEnableSubscription || isSubscribed)
isSubscribed
) {
isCustomCompletionMail = true;
}
+4 -4
View File
@@ -143,17 +143,17 @@ const sidebarList = [
icon: "fa-light fa-key",
title: "API Token",
target: "_self",
pageType: "generatetoken",
pageType: "",
description: "",
objectId: ""
objectId: "generatetoken"
},
{
icon: "fa-light fa-globe",
title: "Webhook",
target: "_self",
pageType: "webhook",
pageType: "",
description: "",
objectId: ""
objectId: "webhook"
}
]
}
+27 -33
View File
@@ -18,7 +18,6 @@ import { isEnableSubscription } from "../constant/const";
import ModalUi from "../primitives/ModalUi";
import { Tooltip } from "react-tooltip";
import Upgrade from "../primitives/Upgrade";
import PremiumAlertHeader from "../primitives/PremiumAlertHeader";
import Loader from "../primitives/Loader";
// `Form` render all type of Form on this basis of their provided in path
@@ -830,39 +829,34 @@ const Forms = (props) => {
<div className="text-center">No</div>
</div>
</div>
<div className="text-xs mt-2">
{!isEnableSubscription && (
<PremiumAlertHeader
message={
"Auto reminder is free in beta, this feature will incur a fee later."
{isEnableSubscription && (
<div className="text-xs mt-2">
<span
className={
isSubscribe
? "font-semibold"
: "font-semibold text-gray-300"
}
/>
)}
<span
className={
isSubscribe || !isEnableSubscription
? "font-semibold"
: "font-semibold text-gray-300"
}
>
Auto reminder{" "}
{!isSubscribe && isEnableSubscription && <Upgrade />}
</span>
<label
className={`${
isSubscribe || !isEnableSubscription
? "cursor-pointer "
: "pointer-events-none opacity-50"
} relative block items-center mb-0`}
>
<input
type="checkbox"
className="op-toggle transition-all checked:[--tglbg:#3368ff] checked:bg-white"
checked={formData.autoreminder}
onChange={handleAutoReminder}
/>
</label>
</div>
>
Auto reminder{" "}
{!isSubscribe && isEnableSubscription && <Upgrade />}
</span>
<label
className={`${
isSubscribe
? "cursor-pointer "
: "pointer-events-none opacity-50"
} relative block items-center mb-0`}
>
<input
type="checkbox"
className="op-toggle transition-all checked:[--tglbg:#3368ff] checked:bg-white"
checked={formData.autoreminder}
onChange={handleAutoReminder}
/>
</label>
</div>
)}
{formData?.autoreminder === true && (
<div className="text-xs mt-2">
<label className="block">
+2 -9
View File
@@ -5,7 +5,6 @@ import Alert from "../primitives/Alert";
import ModalUi from "../primitives/ModalUi";
import { isEnableSubscription } from "../constant/const";
import { checkIsSubscribed, copytoData, openInNewTab } from "../constant/Utils";
import PremiumAlertHeader from "../primitives/PremiumAlertHeader";
import Tooltip from "../primitives/Tooltip";
import Loader from "../primitives/Loader";
import SubscribeCard from "../primitives/SubscribeCard";
@@ -112,7 +111,6 @@ function GenerateToken() {
) : (
<>
<div className="bg-base-100 text-base-content flex flex-col justify-center shadow-md rounded-box mb-3">
{!isEnableSubscription && <PremiumAlertHeader />}
<h1 className={"ml-4 mt-3 mb-2 font-semibold"}>
OpenSign API{" "}
<Tooltip
@@ -122,19 +120,14 @@ function GenerateToken() {
isSubscribe={true}
/>
</h1>
<ul
className={"w-full flex flex-col p-2 text-sm"}
// isSubscribe || !isEnableSubscription
// ? "w-full flex flex-col p-2 text-sm "
// : "w-full flex flex-col p-2 text-sm opacity-20 pointer-events-none select-none"
>
<ul className="w-full flex flex-col p-2 text-sm">
<li className="flex flex-col md:flex-row justify-between items-center border-y-[1px] border-gray-300 break-all py-2">
<div className="w-full md:w-[70%] flex-col md:flex-row text-xs md:text-[15px] flex items-center gap-x-5">
<span className="ml-1">API Token:</span>{" "}
<span
id="token"
className={`${
isSubscribe || !isEnableSubscription
isSubscribe
? ""
: "bg-white/20 pointer-events-none select-none"
} md:text-end py-2 md:py-0`}
+1 -5
View File
@@ -962,11 +962,7 @@ function PdfRequestFiles(props) {
: "";
const themeBGcolor = themeColor;
let replaceVar;
if (
requestBody &&
requestSubject &&
(!isEnableSubscription || isSubscribed)
) {
if (requestBody && requestSubject && isSubscribed) {
const replacedRequestBody = requestBody.replace(
/"/g,
"'"
+60 -88
View File
@@ -1135,12 +1135,7 @@ function PlaceHolderSign() {
const senderName = `${pdfDetails?.[0].ExtUserPtr.Name}`;
const documentName = `${pdfDetails?.[0].Name}`;
let replaceVar;
if (
requestBody &&
requestSubject &&
isCustomize &&
(isSubscribe || !isEnableSubscription)
) {
if (requestBody && requestSubject && isCustomize && isSubscribe) {
const replacedRequestBody = requestBody.replace(/"/g, "'");
htmlReqBody =
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body>" +
@@ -1208,12 +1203,7 @@ function PlaceHolderSign() {
setMailStatus("success");
try {
let data;
if (
requestBody &&
requestSubject &&
isCustomize &&
(isSubscribe || !isEnableSubscription)
) {
if (requestBody && requestSubject && isCustomize && isSubscribe) {
data = {
RequestBody: htmlReqBody,
RequestSubject: requestSubject,
@@ -1478,7 +1468,7 @@ function PlaceHolderSign() {
hint: defaultdata?.hint || "",
defaultValue: defaultdata?.defaultValue || "",
validation:
(isSubscribe || !isEnableSubscription) && inputype
isSubscribe && inputype
? {
type: inputype,
pattern:
@@ -1769,7 +1759,6 @@ function PlaceHolderSign() {
: isSendAlert.mssg === "confirm" && "Send Mail"
}
handleClose={() => setIsSendAlert({})}
showHeaderMessage={isSendAlert.mssg === "confirm"}
>
<div className="max-h-96 overflow-y-scroll scroll-hide p-[20px] text-base-content">
{isSendAlert.mssg === "sure" ? (
@@ -1784,86 +1773,69 @@ function PlaceHolderSign() {
) : (
isSendAlert.mssg === "confirm" && (
<>
<>
{!isCustomize && (
<span>
Are you sure you want to send out this
document for signatures?
</span>
)}
{isCustomize &&
(!isEnableSubscription || isSubscribe) && (
<>
<EmailBody
editorRef={editorRef}
requestBody={requestBody}
requestSubject={requestSubject}
handleOnchangeRequest={
handleOnchangeRequest
}
setRequestSubject={setRequestSubject}
/>
<div
className="flex justify-end items-center gap-1 mt-2 op-link op-link-primary"
onClick={() => {
setRequestBody(defaultBody);
setRequestSubject(defaultSubject);
}}
>
<span>Reset to default</span>
</div>
</>
)}
<div
className={
"flex flex-row md:items-center gap-2 md:gap-6 mt-2 "
}
>
<div className="flex flex-row gap-2">
<button
onClick={() => sendEmailToSigners()}
className="op-btn op-btn-primary font-[500] text-sm shadow"
>
Send
</button>
{isCustomize && (
<button
onClick={() => {
setIsCustomize(false);
}}
className="op-btn op-btn-ghost font-[500] text-sm"
>
Close
</button>
)}
{!isCustomize && (
<span>
Are you sure you want to send out this document
for signatures?
</span>
)}
{isCustomize && isSubscribe && (
<>
<EmailBody
editorRef={editorRef}
requestBody={requestBody}
requestSubject={requestSubject}
handleOnchangeRequest={handleOnchangeRequest}
setRequestSubject={setRequestSubject}
/>
<div
className="flex justify-end items-center gap-1 mt-2 op-link op-link-primary"
onClick={() => {
setRequestBody(defaultBody);
setRequestSubject(defaultSubject);
}}
>
<span>Reset to default</span>
</div>
{!isCustomize &&
(isSubscribe || !isEnableSubscription) && (
<span
className="op-link op-link-accent text-sm"
onClick={() => {
setIsCustomize(!isCustomize);
}}
>
Cutomize Email
</span>
)}
{!isSubscribe && isEnableSubscription && (
<div className="mt-2">
<Upgrade
message="Upgrade to customize Email"
newWindow={true}
/>
</div>
</>
)}
<div className="flex flex-row md:items-center gap-2 md:gap-6 mt-2">
<div className="flex flex-row gap-2">
<button
onClick={() => sendEmailToSigners()}
className="op-btn op-btn-primary font-[500] text-sm shadow"
>
Send
</button>
{isCustomize && (
<button
onClick={() => setIsCustomize(false)}
className="op-btn op-btn-ghost font-[500] text-sm"
>
Close
</button>
)}
</div>
</>
{!isCustomize && isSubscribe && (
<span
className="op-link op-link-accent text-sm"
onClick={() => setIsCustomize(!isCustomize)}
>
Cutomize Email
</span>
)}
{!isSubscribe && isEnableSubscription && (
<div className="mt-2">
<Upgrade
message="Upgrade to customize Email"
newWindow={true}
/>
</div>
)}
</div>
</>
)
)}
{isSendAlert.mssg === "confirm" && (
<>
<div className="flex justify-center items-center mt-3">
+1 -2
View File
@@ -2,7 +2,6 @@ import React, { useState, useRef, useEffect } from "react";
import { PDFDocument } from "pdf-lib";
import "../styles/signature.css";
import Parse from "parse";
import { isEnableSubscription } from "../constant/const";
import Confetti from "react-confetti";
import axios from "axios";
import LoaderWithMsg from "../primitives/LoaderWithMsg";
@@ -739,7 +738,7 @@ function SignYourSelf() {
if (
tenantDetails?.CompletionBody &&
tenantDetails?.CompletionSubject &&
(!isEnableSubscription || getIsSubscribe)
getIsSubscribe
) {
isCustomCompletionMail = true;
}
@@ -1197,7 +1197,7 @@ const TemplatePlaceholder = () => {
hint: defaultdata?.hint || "",
defaultValue: defaultdata?.defaultValue || "",
validation:
(isSubscribe || !isEnableSubscription) && inputype
isSubscribe && inputype
? {
type: inputype,
pattern:
+40 -42
View File
@@ -6,7 +6,6 @@ import dp from "../assets/images/dp.png";
import Title from "../components/Title";
import sanitizeFileName from "../primitives/sanitizeFileName";
import axios from "axios";
import PremiumAlertHeader from "../primitives/PremiumAlertHeader";
import Tooltip from "../primitives/Tooltip";
import { isEnableSubscription } from "../constant/const";
import { checkIsSubscribed, handleSendOTP } from "../constant/Utils";
@@ -509,49 +508,48 @@ function UserProfile() {
</li>
</>
)}
<li className="border-y-[1px] border-gray-300 break-all">
<div className="flex justify-between items-center py-2">
<span
className={
isSubscribe || !isEnableSubscription
? "font-semibold"
: "font-semibold text-gray-300"
}
>
Disable DocumentId :{" "}
<Tooltip
url={
"https://docs.opensignlabs.com/docs/help/Settings/disabledocumentid"
{isEnableSubscription && (
<li className="border-y-[1px] border-gray-300 break-all">
<div className="flex justify-between items-center py-2">
<span
className={
isSubscribe
? "font-semibold"
: "font-semibold text-gray-300"
}
/>
{!isSubscribe && isEnableSubscription && <Upgrade />}
</span>
<label
className={`${
isSubscribe || !isEnableSubscription
? `${editmode ? "cursor-pointer" : ""}`
: "pointer-events-none opacity-50"
} relative block items-center mb-0`}
>
<input
disabled={editmode ? false : true}
type="checkbox"
className="op-toggle transition-all checked:[--tglbg:#3368ff] checked:bg-white"
checked={isDisableDocId}
onChange={handleDisableDocId}
/>
</label>
</div>
{!isEnableSubscription && (
<PremiumAlertHeader
message={
"Disable documentId is free in beta, this feature will incur a fee later."
}
/>
)}
</li>
>
Disable DocumentId :{" "}
<Tooltip
url={
"https://docs.opensignlabs.com/docs/help/Settings/disabledocumentid"
}
/>
{!isSubscribe && isEnableSubscription && <Upgrade />}
</span>
<label
className={`${
isSubscribe
? `${editmode ? "cursor-pointer" : ""}`
: "pointer-events-none opacity-50"
} relative block items-center mb-0`}
>
<input
disabled={editmode ? false : true}
type="checkbox"
className="op-toggle transition-all checked:[--tglbg:#3368ff] checked:bg-white"
checked={isDisableDocId}
onChange={handleDisableDocId}
/>
</label>
</div>
</li>
)}
</ul>
<div className="flex justify-center gap-2 pt-2 pb-3 md:pt-3 md:pb-4">
<div
className={`${
!isEnableSubscription ? "border-t-[1px] border-gray-300" : ""
} flex justify-center gap-2 pt-2 pb-3 md:pt-3 md:pb-4`}
>
<button
type="button"
onClick={(e) => {
-2
View File
@@ -6,7 +6,6 @@ import ModalUi from "../primitives/ModalUi";
import { isEnableSubscription } from "../constant/const";
import { checkIsSubscribed, openInNewTab } from "../constant/Utils";
import Parse from "parse";
import PremiumAlertHeader from "../primitives/PremiumAlertHeader";
import Tooltip from "../primitives/Tooltip";
import Loader from "../primitives/Loader";
import SubscribeCard from "../primitives/SubscribeCard";
@@ -107,7 +106,6 @@ function Webhook() {
) : (
<>
<div className="bg-base-100 text-base-content flex flex-col justify-center shadow-md rounded-box mb-3">
{!isEnableSubscription && <PremiumAlertHeader />}
<h1 className={"ml-4 mt-3 mb-2 font-semibold"}>
OpenSign Webhook{" "}
<Tooltip
+1 -11
View File
@@ -1,6 +1,4 @@
import React from "react";
import { isEnableSubscription } from "../constant/const";
import PremiumAlertHeader from "./PremiumAlertHeader";
const ModalUi = ({
children,
@@ -9,8 +7,7 @@ const ModalUi = ({
handleClose,
showHeader = true,
showClose = true,
reduceWidth,
showHeaderMessage
reduceWidth
}) => {
const width = reduceWidth;
return (
@@ -37,13 +34,6 @@ const ModalUi = ({
)}
</>
)}
{!isEnableSubscription && showHeaderMessage && (
<PremiumAlertHeader
message={
"Cutomize Email is free in beta, this feature will incur a fee later."
}
/>
)}
<div>{children}</div>
</div>
</dialog>
@@ -1,11 +0,0 @@
import React from "react";
const PremiumAlertHeader = ({ message }) => (
<marquee className="bg-yellow-300 text-black px-2">
{message
? message
: "Currently free in Beta, this feature will incur a fee later."}
</marquee>
);
export default PremiumAlertHeader;
@@ -3,10 +3,10 @@ export default async function CheckAdminExist() {
try {
const extClsQuery = new Parse.Query('contracts_Users');
extClsQuery.equalTo('UserRole', 'contracts_Admin');
extClsQuery.exists('OrganizationId');
extClsQuery.notEqualTo('IsDisabled', true);
const extAdminRes = await extClsQuery.first({ useMasterKey: true });
if (extAdminRes) {
const extAdminRes = await extClsQuery.find({ useMasterKey: true });
// must be only one admin
if (extAdminRes && extAdminRes.length === 1 && extAdminRes?.[0]?.get('OrganizationId')) {
return 'exist';
} else {
return 'not_exist';
@@ -6,7 +6,7 @@ async function updateUserExceptAdmin(data) {
while (hasMore) {
const query = new Parse.Query(Contracts);
query.notEqualTo('UserRole', 'contracts_Admin');
query.notEqualTo('Email', data.email);
query.limit(limit);
query.skip(skip);
@@ -24,6 +24,8 @@ async function updateUserExceptAdmin(data) {
contract.set('UserRole', 'contracts_User');
contract.set('OrganizationId', data.orgPtr);
contract.set('TeamIds', data.teamIds);
contract.set('CreatedBy', data.createdBy);
contract.set('TenantId', data.tenantId);
}
// Save all the updated entries
@@ -46,11 +48,9 @@ export default async function UpdateExistUserAsAdmin(request) {
}
const extClsQuery = new Parse.Query('contracts_Users');
extClsQuery.equalTo('UserRole', 'contracts_Admin');
extClsQuery.exists('OrganizationId');
extClsQuery.exists('TeamIds');
extClsQuery.notEqualTo('IsDisabled', true);
const extAdminRes = await extClsQuery.first({ useMasterKey: true });
if (extAdminRes) {
const extAdminRes = await extClsQuery.find({ useMasterKey: true });
if (extAdminRes && extAdminRes.length === 1 && extAdminRes?.[0]?.get('OrganizationId')) {
throw new Parse.Error(Parse.Error.DUPLICATE_VALUE, 'Admin already exist.');
} else {
const extCls = new Parse.Query('contracts_Users');
@@ -60,24 +60,26 @@ export default async function UpdateExistUserAsAdmin(request) {
console.log('extRes ', extRes);
if (extRes) {
const _extRes = JSON.parse(JSON.stringify(extRes));
const org = new Parse.Object('contracts_Organizations');
org.set('Name', _extRes.Company);
org.set('IsActive', true);
org.set('TenantId', {
const tenantId = {
__type: 'Pointer',
className: 'partners_Tenant',
objectId: _extRes.TenantId.objectId,
});
};
const createdBy = {
__type: 'Pointer',
className: '_User',
objectId: _extRes.UserId.objectId,
};
const org = new Parse.Object('contracts_Organizations');
org.set('Name', _extRes.Company);
org.set('IsActive', true);
org.set('TenantId', tenantId);
org.set('ExtUserId', {
__type: 'Pointer',
className: 'contracts_Users',
objectId: extRes.id,
});
org.set('CreatedBy', {
__type: 'Pointer',
className: '_User',
objectId: _extRes.UserId.objectId,
});
org.set('CreatedBy', createdBy);
const orgRes = await org.save(null, { useMasterKey: true });
const teamCls = new Parse.Object('contracts_Teams');
teamCls.set('Name', 'All Users');
@@ -107,7 +109,13 @@ export default async function UpdateExistUserAsAdmin(request) {
extUser.set('TeamIds', teamIds);
const extUserRes = await extUser.save(null, { useMasterKey: true });
if (extUserRes) {
const data = { orgPtr: orgPtr, teamIds: teamIds };
const data = {
orgPtr: orgPtr,
teamIds: teamIds,
email: email,
createdBy: createdBy,
tenantId: tenantId,
};
updateUserExceptAdmin(data);
return 'admin_created';
}
-17
View File
@@ -1,17 +0,0 @@
#!/bin/bash
echo "Starting MongoDB initial data import..."
# Wait for MongoDB to fully start
sleep 10
# Import the data
mongoimport --host localhost --db OpenSignDB --collection _Role --type json --file /docker-entrypoint-initdb.d/legadraGCva._Role.json --jsonArray
mongoimport --host localhost --db OpenSignDB --collection _SCHEMA --type json --file /docker-entrypoint-initdb.d/legadraGCva._SCHEMA.json --jsonArray
mongoimport --host localhost --db OpenSignDB --collection w_appinfo --type json --file /docker-entrypoint-initdb.d/legadraGCva.w_appinfo.json --jsonArray
mongoimport --host localhost --db OpenSignDB --collection w_dashboard --type json --file /docker-entrypoint-initdb.d/legadraGCva.w_dashboard.json --jsonArray
mongoimport --host localhost --db OpenSignDB --collection w_menu --type json --file /docker-entrypoint-initdb.d/legadraGCva.w_menu.json --jsonArray
echo "MongoDB initial data import done."