feat: create duplicate template functionality
feat: add support of csv and xlsx for bulk contacts import
feat: add info text for forms and dashboard button
feat: implement functionality to delete a PDF page while editing the document
feat: show completed documents in which signers included but not owner in completed reports
feat: add delete folder button in opensign drive
feat: introduce Bcc email support for sending completed documents
feat: allow merging multiple pdf while drafting document and template
feat: add 'My Initials' tab for auto-signing in request-sign flow
feat: add support for redirect URL to navigate after document completion
feat: introduce privacy policy and digital signature terms before signing documents.
feat: add feature to allow adding new pages to existing document
feat: add save signature, initials, stamp functionality in sign pad for logged in user
feat: add preferences menu
feat: add save custom email template, notifyonsignature, set timezone, allow signature types in preferences
feat: secure local url
feat: implement Italian language translation
feat: implement German language translation
feat: update menu name from report to documents and shift contactbook in main menu
feat: provide edit contact functionality

fix: unable to delete folder when all its documents are deleted
fix: fields.push is not function
fix: document loading issue in opensign drive
fix: adjust the guest signature flow to display the document in full screen, eliminating any blank space which is displayed below the place holder in mobile view
fix: resolve issue of instance of pdfdict or pdfstream but got undefined

build(deps): update dependencies

refactor: change note text from add contact form
This commit is contained in:
prafull-opensignlabs
2025-02-10 14:41:16 +00:00
parent b55aff20d3
commit e299891174
260 changed files with 22438 additions and 25112 deletions
+79 -12
View File
@@ -1,4 +1,7 @@
import dotenv from 'dotenv';
import { format, toZonedTime } from 'date-fns-tz';
import { getSignedLocalUrl } from './cloud/parsefunction/getSignedUrl.js';
import { PDFDocument } from 'pdf-lib';
dotenv.config();
export const cloudServerUrl = 'http://localhost:8080/app';
@@ -200,6 +203,7 @@ export function formatWidgetOptions(type, options) {
validation: { type: 'regex', pattern: options?.regularexpression || '/^[a-zA-Z0-9s]+$/' },
fontColor: fontColor,
fontSize: fontSize,
isReadOnly: options?.readonly || false,
};
case 'checkbox': {
const arr = options?.values;
@@ -243,6 +247,7 @@ export function formatWidgetOptions(type, options) {
defaultValue: defaultValue,
fontColor: fontColor,
fontSize: fontSize,
isReadOnly: options?.readonly || false,
};
default:
break;
@@ -261,17 +266,79 @@ export const smtpsecure = process.env.SMTP_PORT && process.env.SMTP_PORT !== '46
export const smtpenable =
process.env.SMTP_ENABLE && process.env.SMTP_ENABLE.toLowerCase() === 'true' ? true : false;
export const planCredits = {
'pro-weekly': 100,
'pro-yearly': 240,
'professional-monthly': 100,
'professional-yearly': 240,
'team-weekly': 100,
'team-yearly': 500,
'teams-monthly': 100,
'teams-yearly': 500,
// `generateId` is used to unique Id for fileAdapter
export function generateId(length) {
const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
const charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
// Format date and time for the selected timezone
export const formatTimeInTimezone = (date, timezone) => {
const nyDate = timezone && toZonedTime(date, timezone);
const generatedDate = timezone
? format(nyDate, 'EEE, dd MMM yyyy HH:mm:ss zzz', { timeZone: timezone })
: new Date(date).toUTCString();
return generatedDate;
};
export function parseJwt(token) {
return JSON.parse(Buffer.from(token.split('.')[1], 'base64').toString());
}
// `getSecureUrl` is used to return local secure url if local files
export const getSecureUrl = url => {
const fileUrl = new URL(url)?.pathname?.includes('files');
if (fileUrl) {
try {
const file = getSignedLocalUrl(url);
if (file) {
return { url: file };
} else {
return { url: '' };
}
} catch (err) {
console.log('err while fileupload ', err);
return { url: '' };
}
} else {
return { url: url };
}
};
/**
* FlattenPdf is used to remove existing widgets if present any and flatten pdf.
* @param {string | Uint8Array | ArrayBuffer} pdfFile - pdf file.
* @returns {Promise<Uint8Array>} flatPdf - pdf file in unit8arry
*/
export const flattenPdf = async pdfFile => {
try {
const pdfDoc = await PDFDocument.load(pdfFile);
// Get the form
const form = pdfDoc.getForm();
// fetch form fields
const fields = form.getFields();
// remove form all existing fields and their widgets
if (fields && fields?.length > 0) {
try {
for (const field of fields) {
while (field.acroField.getWidgets().length) {
field.acroField.removeWidget(0);
}
form.removeField(field);
}
} catch (err) {
console.log('err while removing field from pdf', err);
}
}
// Updates the field appearances to ensure visual changes are reflected.
form.updateFieldAppearances();
// Flattens the form, converting all form fields into non-editable, static content
form.flatten();
const flatPdf = await pdfDoc.save({ useObjectStreams: false });
return flatPdf;
} catch (err) {
throw new Error('error in pdf');
}
};