mirror of
https://github.com/documenso/documenso.git
synced 2025-11-19 19:21:39 +10:00
feat: generate recipients and fields based on recipients
This commit is contained in:
@ -27,7 +27,7 @@ if (loggingFilePath) {
|
||||
}
|
||||
|
||||
export const logger = pino({
|
||||
level: 'info',
|
||||
level: env('LOG_LEVEL') || 'info',
|
||||
transport:
|
||||
transports.length > 0
|
||||
? {
|
||||
|
||||
@ -4,6 +4,8 @@ import { type Field, type Recipient, RecipientRole, SigningStatus } from '@prism
|
||||
import { NEXT_PUBLIC_WEBAPP_URL } from '../constants/app';
|
||||
import { extractLegacyIds } from '../universal/id';
|
||||
|
||||
const UNKNOWN_RECIPIENT_NAME_PLACEHOLDER = '<UNKNOWN>';
|
||||
|
||||
export const formatSigningLink = (token: string) => `${NEXT_PUBLIC_WEBAPP_URL()}/sign/${token}`;
|
||||
|
||||
/**
|
||||
@ -58,3 +60,21 @@ export const mapRecipientToLegacyRecipient = (
|
||||
...legacyId,
|
||||
};
|
||||
};
|
||||
|
||||
export const sanitizeRecipientName = (name?: string | null) => {
|
||||
if (!name) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const trimmedName = name.trim();
|
||||
|
||||
if (!trimmedName) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (trimmedName.toUpperCase() === UNKNOWN_RECIPIENT_NAME_PLACEHOLDER) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return trimmedName;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user