mirror of
https://github.com/documenso/documenso.git
synced 2025-11-20 11:41:44 +10:00
fix: assorted updates
This commit is contained in:
@ -3,7 +3,6 @@
|
||||
import { createElement } from 'react';
|
||||
|
||||
import { DateTime } from 'luxon';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { PDFDocument } from 'pdf-lib';
|
||||
import { match } from 'ts-pattern';
|
||||
import { z } from 'zod';
|
||||
@ -13,6 +12,7 @@ import { render } from '@documenso/email/render';
|
||||
import { DocumentSelfSignedEmailTemplate } from '@documenso/email/templates/document-self-signed';
|
||||
import { FROM_ADDRESS, FROM_NAME, SERVICE_USER_EMAIL } from '@documenso/lib/constants/email';
|
||||
import { insertFieldInPDF } from '@documenso/lib/server-only/pdf/insert-field-in-pdf';
|
||||
import { alphaid } from '@documenso/lib/universal/id';
|
||||
import { getFile } from '@documenso/lib/universal/upload/get-file';
|
||||
import { prisma } from '@documenso/prisma';
|
||||
import {
|
||||
@ -101,7 +101,7 @@ export const createSinglePlayerDocument = async (
|
||||
|
||||
const documentToken = await prisma.$transaction(
|
||||
async (tx) => {
|
||||
const documentToken = nanoid();
|
||||
const documentToken = alphaid();
|
||||
|
||||
// Fetch service user who will be the owner of the document.
|
||||
const serviceUser = await tx.user.findFirstOrThrow({
|
||||
@ -179,7 +179,7 @@ export const createSinglePlayerDocument = async (
|
||||
|
||||
// Todo: Handle `downloadLink`
|
||||
const template = createElement(DocumentSelfSignedEmailTemplate, {
|
||||
downloadLink: 'https://documenso.com',
|
||||
downloadLink: `${process.env.NEXT_PUBLIC_MARKETING_URL}/single-player-mode/${documentToken}`,
|
||||
documentName: documentName,
|
||||
assetBaseUrl: process.env.NEXT_PUBLIC_WEBAPP_URL || 'http://localhost:3000',
|
||||
});
|
||||
|
||||
@ -26,10 +26,7 @@ interface SinglePlayerModeSuccessProps {
|
||||
document: DocumentWithRecipient;
|
||||
}
|
||||
|
||||
export default function SinglePlayerModeSuccess({
|
||||
className,
|
||||
document,
|
||||
}: SinglePlayerModeSuccessProps) {
|
||||
export const SinglePlayerModeSuccess = ({ className, document }: SinglePlayerModeSuccessProps) => {
|
||||
const { getFlag } = useFeatureFlags();
|
||||
|
||||
const isConfettiEnabled = getFlag('marketing_spm_confetti');
|
||||
@ -40,7 +37,7 @@ export default function SinglePlayerModeSuccess({
|
||||
|
||||
const { toast } = useToast();
|
||||
|
||||
const handleShowDocumentDialog = async () => {
|
||||
const onShowDocumentClick = async () => {
|
||||
if (isFetchingDocumentFile) {
|
||||
return;
|
||||
}
|
||||
@ -103,7 +100,7 @@ export default function SinglePlayerModeSuccess({
|
||||
/>
|
||||
|
||||
<Button
|
||||
onClick={async () => handleShowDocumentDialog()}
|
||||
onClick={async () => onShowDocumentClick()}
|
||||
loading={isFetchingDocumentFile}
|
||||
className="col-span-2"
|
||||
>
|
||||
@ -132,4 +129,4 @@ export default function SinglePlayerModeSuccess({
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user