mirror of
https://github.com/documenso/documenso.git
synced 2025-11-09 20:12:31 +10:00
Compare commits
5 Commits
1650c55b19
...
eff7d90f43
| Author | SHA1 | Date | |
|---|---|---|---|
| eff7d90f43 | |||
| db5524f8ce | |||
| 3d539b20ad | |||
| 48626b9169 | |||
| 88371b665a |
@ -41,6 +41,7 @@
|
|||||||
"@simplewebauthn/server": "^9.0.3",
|
"@simplewebauthn/server": "^9.0.3",
|
||||||
"autoprefixer": "^10.4.13",
|
"autoprefixer": "^10.4.13",
|
||||||
"colord": "^2.9.3",
|
"colord": "^2.9.3",
|
||||||
|
"content-disposition": "^0.5.4",
|
||||||
"framer-motion": "^10.12.8",
|
"framer-motion": "^10.12.8",
|
||||||
"hono": "4.7.0",
|
"hono": "4.7.0",
|
||||||
"hono-rate-limiter": "^0.4.2",
|
"hono-rate-limiter": "^0.4.2",
|
||||||
@ -87,6 +88,7 @@
|
|||||||
"@rollup/plugin-node-resolve": "^16.0.0",
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
||||||
"@rollup/plugin-typescript": "^12.1.2",
|
"@rollup/plugin-typescript": "^12.1.2",
|
||||||
"@simplewebauthn/types": "^9.0.1",
|
"@simplewebauthn/types": "^9.0.1",
|
||||||
|
"@types/content-disposition": "^0.5.9",
|
||||||
"@types/formidable": "^2.0.6",
|
"@types/formidable": "^2.0.6",
|
||||||
"@types/luxon": "^3.3.1",
|
"@types/luxon": "^3.3.1",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
@ -104,5 +106,5 @@
|
|||||||
"vite-plugin-babel-macros": "^1.0.6",
|
"vite-plugin-babel-macros": "^1.0.6",
|
||||||
"vite-tsconfig-paths": "^5.1.4"
|
"vite-tsconfig-paths": "^5.1.4"
|
||||||
},
|
},
|
||||||
"version": "2.0.0"
|
"version": "2.0.2"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { type DocumentDataType, DocumentStatus } from '@prisma/client';
|
import { type DocumentDataType, DocumentStatus } from '@prisma/client';
|
||||||
|
import contentDisposition from 'content-disposition';
|
||||||
import { type Context } from 'hono';
|
import { type Context } from 'hono';
|
||||||
|
|
||||||
import { sha256 } from '@documenso/lib/universal/crypto';
|
import { sha256 } from '@documenso/lib/universal/crypto';
|
||||||
@ -34,7 +35,7 @@ export const handleEnvelopeItemFileRequest = async ({
|
|||||||
|
|
||||||
const etag = Buffer.from(sha256(documentDataToUse)).toString('hex');
|
const etag = Buffer.from(sha256(documentDataToUse)).toString('hex');
|
||||||
|
|
||||||
if (c.req.header('If-None-Match') === etag) {
|
if (c.req.header('If-None-Match') === etag && !isDownload) {
|
||||||
return c.body(null, 304);
|
return c.body(null, 304);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,8 +59,7 @@ export const handleEnvelopeItemFileRequest = async ({
|
|||||||
if (status === DocumentStatus.COMPLETED) {
|
if (status === DocumentStatus.COMPLETED) {
|
||||||
c.header('Cache-Control', 'public, max-age=31536000, immutable');
|
c.header('Cache-Control', 'public, max-age=31536000, immutable');
|
||||||
} else {
|
} else {
|
||||||
// Set a tiny 1 minute cache, with must-revalidate to ensure the client always checks for updates.
|
c.header('Cache-Control', 'public, max-age=0, must-revalidate');
|
||||||
c.header('Cache-Control', 'public, max-age=60, must-revalidate');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ export const handleEnvelopeItemFileRequest = async ({
|
|||||||
const suffix = version === 'signed' ? '_signed.pdf' : '.pdf';
|
const suffix = version === 'signed' ? '_signed.pdf' : '.pdf';
|
||||||
const filename = `${baseTitle}${suffix}`;
|
const filename = `${baseTitle}${suffix}`;
|
||||||
|
|
||||||
c.header('Content-Disposition', `attachment; filename="${filename}"`);
|
c.header('Content-Disposition', contentDisposition(filename));
|
||||||
|
|
||||||
// For downloads, prevent caching to ensure fresh data
|
// For downloads, prevent caching to ensure fresh data
|
||||||
c.header('Cache-Control', 'no-cache, no-store, must-revalidate');
|
c.header('Cache-Control', 'no-cache, no-store, must-revalidate');
|
||||||
|
|||||||
15
package-lock.json
generated
15
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@documenso/root",
|
"name": "@documenso/root",
|
||||||
"version": "2.0.0",
|
"version": "2.0.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@documenso/root",
|
"name": "@documenso/root",
|
||||||
"version": "2.0.0",
|
"version": "2.0.2",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"apps/*",
|
"apps/*",
|
||||||
"packages/*"
|
"packages/*"
|
||||||
@ -100,7 +100,7 @@
|
|||||||
},
|
},
|
||||||
"apps/remix": {
|
"apps/remix": {
|
||||||
"name": "@documenso/remix",
|
"name": "@documenso/remix",
|
||||||
"version": "2.0.0",
|
"version": "2.0.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cantoo/pdf-lib": "^2.5.2",
|
"@cantoo/pdf-lib": "^2.5.2",
|
||||||
"@documenso/api": "*",
|
"@documenso/api": "*",
|
||||||
@ -129,6 +129,7 @@
|
|||||||
"@simplewebauthn/server": "^9.0.3",
|
"@simplewebauthn/server": "^9.0.3",
|
||||||
"autoprefixer": "^10.4.13",
|
"autoprefixer": "^10.4.13",
|
||||||
"colord": "^2.9.3",
|
"colord": "^2.9.3",
|
||||||
|
"content-disposition": "^0.5.4",
|
||||||
"framer-motion": "^10.12.8",
|
"framer-motion": "^10.12.8",
|
||||||
"hono": "4.7.0",
|
"hono": "4.7.0",
|
||||||
"hono-rate-limiter": "^0.4.2",
|
"hono-rate-limiter": "^0.4.2",
|
||||||
@ -175,6 +176,7 @@
|
|||||||
"@rollup/plugin-node-resolve": "^16.0.0",
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
||||||
"@rollup/plugin-typescript": "^12.1.2",
|
"@rollup/plugin-typescript": "^12.1.2",
|
||||||
"@simplewebauthn/types": "^9.0.1",
|
"@simplewebauthn/types": "^9.0.1",
|
||||||
|
"@types/content-disposition": "^0.5.9",
|
||||||
"@types/formidable": "^2.0.6",
|
"@types/formidable": "^2.0.6",
|
||||||
"@types/luxon": "^3.3.1",
|
"@types/luxon": "^3.3.1",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
@ -12315,6 +12317,13 @@
|
|||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/content-disposition": {
|
||||||
|
"version": "0.5.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.9.tgz",
|
||||||
|
"integrity": "sha512-8uYXI3Gw35MhiVYhG3s295oihrxRyytcRHjSjqnqZVDDy/xcGBRny7+Xj1Wgfhv5QzRtN2hB2dVRBUX9XW3UcQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@types/cross-spawn": {
|
"node_modules/@types/cross-spawn": {
|
||||||
"version": "6.0.2",
|
"version": "6.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/cross-spawn/-/cross-spawn-6.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/cross-spawn/-/cross-spawn-6.0.2.tgz",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "2.0.0",
|
"version": "2.0.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "turbo run build",
|
"build": "turbo run build",
|
||||||
"dev": "turbo run dev --filter=@documenso/remix",
|
"dev": "turbo run dev --filter=@documenso/remix",
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import { DocumentStatus } from '@prisma/client';
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf.js';
|
import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf.js';
|
||||||
import { getEnvelopeDownloadUrl } from '@documenso/lib/utils/envelope-download';
|
import { getEnvelopeItemPdfUrl } from '@documenso/lib/utils/envelope-download';
|
||||||
import { prisma } from '@documenso/prisma';
|
import { prisma } from '@documenso/prisma';
|
||||||
import { seedAlignmentTestDocument } from '@documenso/prisma/seed/initial-seed';
|
import { seedAlignmentTestDocument } from '@documenso/prisma/seed/initial-seed';
|
||||||
import { seedUser } from '@documenso/prisma/seed/users';
|
import { seedUser } from '@documenso/prisma/seed/users';
|
||||||
@ -94,7 +94,8 @@ test.skip('field placement visual regression', async ({ page }, testInfo) => {
|
|||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
completedDocument.envelopeItems.map(async (item) => {
|
completedDocument.envelopeItems.map(async (item) => {
|
||||||
const documentUrl = getEnvelopeDownloadUrl({
|
const documentUrl = getEnvelopeItemPdfUrl({
|
||||||
|
type: 'download',
|
||||||
envelopeItem: item,
|
envelopeItem: item,
|
||||||
token,
|
token,
|
||||||
version: 'signed',
|
version: 'signed',
|
||||||
@ -179,7 +180,8 @@ test.skip('download envelope images', async ({ page }) => {
|
|||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
completedDocument.envelopeItems.map(async (item) => {
|
completedDocument.envelopeItems.map(async (item) => {
|
||||||
const documentUrl = getEnvelopeDownloadUrl({
|
const documentUrl = getEnvelopeItemPdfUrl({
|
||||||
|
type: 'download',
|
||||||
envelopeItem: item,
|
envelopeItem: item,
|
||||||
token,
|
token,
|
||||||
version: 'signed',
|
version: 'signed',
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { expect, test } from '@playwright/test';
|
|||||||
import { DocumentStatus, FieldType } from '@prisma/client';
|
import { DocumentStatus, FieldType } from '@prisma/client';
|
||||||
|
|
||||||
import { getDocumentByToken } from '@documenso/lib/server-only/document/get-document-by-token';
|
import { getDocumentByToken } from '@documenso/lib/server-only/document/get-document-by-token';
|
||||||
import { getEnvelopeDownloadUrl } from '@documenso/lib/utils/envelope-download';
|
import { getEnvelopeItemPdfUrl } from '@documenso/lib/utils/envelope-download';
|
||||||
import { prisma } from '@documenso/prisma';
|
import { prisma } from '@documenso/prisma';
|
||||||
import { seedPendingDocumentWithFullFields } from '@documenso/prisma/seed/documents';
|
import { seedPendingDocumentWithFullFields } from '@documenso/prisma/seed/documents';
|
||||||
import { seedTeam } from '@documenso/prisma/seed/teams';
|
import { seedTeam } from '@documenso/prisma/seed/teams';
|
||||||
@ -34,7 +34,8 @@ test.describe('Signing Certificate Tests', () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(async (data) => {
|
.then(async (data) => {
|
||||||
const documentUrl = getEnvelopeDownloadUrl({
|
const documentUrl = getEnvelopeItemPdfUrl({
|
||||||
|
type: 'download',
|
||||||
envelopeItem: data,
|
envelopeItem: data,
|
||||||
token: recipient.token,
|
token: recipient.token,
|
||||||
version: 'signed',
|
version: 'signed',
|
||||||
@ -85,7 +86,8 @@ test.describe('Signing Certificate Tests', () => {
|
|||||||
|
|
||||||
const firstDocumentData = completedDocument.envelopeItems[0];
|
const firstDocumentData = completedDocument.envelopeItems[0];
|
||||||
|
|
||||||
const documentUrl = getEnvelopeDownloadUrl({
|
const documentUrl = getEnvelopeItemPdfUrl({
|
||||||
|
type: 'download',
|
||||||
envelopeItem: firstDocumentData,
|
envelopeItem: firstDocumentData,
|
||||||
token: recipient.token,
|
token: recipient.token,
|
||||||
version: 'signed',
|
version: 'signed',
|
||||||
@ -139,7 +141,8 @@ test.describe('Signing Certificate Tests', () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(async (data) => {
|
.then(async (data) => {
|
||||||
const documentUrl = getEnvelopeDownloadUrl({
|
const documentUrl = getEnvelopeItemPdfUrl({
|
||||||
|
type: 'download',
|
||||||
envelopeItem: data,
|
envelopeItem: data,
|
||||||
token: recipient.token,
|
token: recipient.token,
|
||||||
version: 'signed',
|
version: 'signed',
|
||||||
@ -188,7 +191,8 @@ test.describe('Signing Certificate Tests', () => {
|
|||||||
|
|
||||||
const firstDocumentData = completedDocument.envelopeItems[0];
|
const firstDocumentData = completedDocument.envelopeItems[0];
|
||||||
|
|
||||||
const documentUrl = getEnvelopeDownloadUrl({
|
const documentUrl = getEnvelopeItemPdfUrl({
|
||||||
|
type: 'download',
|
||||||
envelopeItem: firstDocumentData,
|
envelopeItem: firstDocumentData,
|
||||||
token: recipient.token,
|
token: recipient.token,
|
||||||
version: 'signed',
|
version: 'signed',
|
||||||
@ -242,7 +246,8 @@ test.describe('Signing Certificate Tests', () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(async (data) => {
|
.then(async (data) => {
|
||||||
const documentUrl = getEnvelopeDownloadUrl({
|
const documentUrl = getEnvelopeItemPdfUrl({
|
||||||
|
type: 'download',
|
||||||
envelopeItem: data,
|
envelopeItem: data,
|
||||||
token: recipient.token,
|
token: recipient.token,
|
||||||
version: 'signed',
|
version: 'signed',
|
||||||
@ -289,7 +294,8 @@ test.describe('Signing Certificate Tests', () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const documentUrl = getEnvelopeDownloadUrl({
|
const documentUrl = getEnvelopeItemPdfUrl({
|
||||||
|
type: 'download',
|
||||||
envelopeItem: completedDocument.envelopeItems[0],
|
envelopeItem: completedDocument.envelopeItems[0],
|
||||||
token: recipient.token,
|
token: recipient.token,
|
||||||
version: 'signed',
|
version: 'signed',
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { EnvelopeItem } from '@prisma/client';
|
import type { EnvelopeItem } from '@prisma/client';
|
||||||
|
|
||||||
import { getEnvelopeDownloadUrl } from '../utils/envelope-download';
|
import { getEnvelopeItemPdfUrl } from '../utils/envelope-download';
|
||||||
import { downloadFile } from './download-file';
|
import { downloadFile } from './download-file';
|
||||||
|
|
||||||
type DocumentVersion = 'original' | 'signed';
|
type DocumentVersion = 'original' | 'signed';
|
||||||
@ -24,7 +24,8 @@ export const downloadPDF = async ({
|
|||||||
fileName,
|
fileName,
|
||||||
version = 'signed',
|
version = 'signed',
|
||||||
}: DownloadPDFProps) => {
|
}: DownloadPDFProps) => {
|
||||||
const downloadUrl = getEnvelopeDownloadUrl({
|
const downloadUrl = getEnvelopeItemPdfUrl({
|
||||||
|
type: 'download',
|
||||||
envelopeItem: envelopeItem,
|
envelopeItem: envelopeItem,
|
||||||
token,
|
token,
|
||||||
version,
|
version,
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { AVAILABLE_RECIPIENT_COLORS } from '@documenso/ui/lib/recipient-colors';
|
|||||||
|
|
||||||
import type { TEnvelope } from '../../types/envelope';
|
import type { TEnvelope } from '../../types/envelope';
|
||||||
import type { FieldRenderMode } from '../../universal/field-renderer/render-field';
|
import type { FieldRenderMode } from '../../universal/field-renderer/render-field';
|
||||||
import { getEnvelopeDownloadUrl } from '../../utils/envelope-download';
|
import { getEnvelopeItemPdfUrl } from '../../utils/envelope-download';
|
||||||
|
|
||||||
type FileData =
|
type FileData =
|
||||||
| {
|
| {
|
||||||
@ -124,10 +124,10 @@ export const EnvelopeRenderProvider = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const downloadUrl = getEnvelopeDownloadUrl({
|
const downloadUrl = getEnvelopeItemPdfUrl({
|
||||||
|
type: 'view',
|
||||||
envelopeItem: envelopeItem,
|
envelopeItem: envelopeItem,
|
||||||
token,
|
token,
|
||||||
version: 'signed',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const blob = await fetch(downloadUrl).then(async (res) => await res.blob());
|
const blob = await fetch(downloadUrl).then(async (res) => await res.blob());
|
||||||
|
|||||||
@ -189,29 +189,34 @@ export const run = async ({
|
|||||||
settings,
|
settings,
|
||||||
});
|
});
|
||||||
|
|
||||||
const newDocumentData = await Promise.all(
|
const decoratePromises: Array<Promise<{ oldDocumentDataId: string; newDocumentDataId: string }>> =
|
||||||
envelopeItems.map(async (envelopeItem) =>
|
[];
|
||||||
io.runTask(`decorate-and-sign-envelope-item-${envelopeItem.id}`, async () => {
|
|
||||||
const envelopeItemFields = envelope.envelopeItems.find(
|
|
||||||
(item) => item.id === envelopeItem.id,
|
|
||||||
)?.field;
|
|
||||||
|
|
||||||
if (!envelopeItemFields) {
|
for (const envelopeItem of envelopeItems) {
|
||||||
throw new Error(`Envelope item fields not found for envelope item ${envelopeItem.id}`);
|
const task = io.runTask(`decorate-${envelopeItem.id}`, async () => {
|
||||||
}
|
const envelopeItemFields = envelope.envelopeItems.find(
|
||||||
|
(item) => item.id === envelopeItem.id,
|
||||||
|
)?.field;
|
||||||
|
|
||||||
return decorateAndSignPdf({
|
if (!envelopeItemFields) {
|
||||||
envelope,
|
throw new Error(`Envelope item fields not found for envelope item ${envelopeItem.id}`);
|
||||||
envelopeItem,
|
}
|
||||||
envelopeItemFields,
|
|
||||||
isRejected,
|
return decorateAndSignPdf({
|
||||||
rejectionReason,
|
envelope,
|
||||||
certificateData,
|
envelopeItem,
|
||||||
auditLogData,
|
envelopeItemFields,
|
||||||
});
|
isRejected,
|
||||||
}),
|
rejectionReason,
|
||||||
),
|
certificateData,
|
||||||
);
|
auditLogData,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
decoratePromises.push(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
const newDocumentData = await Promise.all(decoratePromises);
|
||||||
|
|
||||||
const postHog = PostHogServerClient();
|
const postHog = PostHogServerClient();
|
||||||
|
|
||||||
|
|||||||
@ -2,18 +2,33 @@ import type { EnvelopeItem } from '@prisma/client';
|
|||||||
|
|
||||||
import { NEXT_PUBLIC_WEBAPP_URL } from '../constants/app';
|
import { NEXT_PUBLIC_WEBAPP_URL } from '../constants/app';
|
||||||
|
|
||||||
export type EnvelopeDownloadUrlOptions = {
|
export type EnvelopeItemPdfUrlOptions =
|
||||||
envelopeItem: Pick<EnvelopeItem, 'id' | 'envelopeId'>;
|
| {
|
||||||
token: string | undefined;
|
type: 'download';
|
||||||
version: 'original' | 'signed';
|
envelopeItem: Pick<EnvelopeItem, 'id' | 'envelopeId'>;
|
||||||
};
|
token: string | undefined;
|
||||||
|
version: 'original' | 'signed';
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
type: 'view';
|
||||||
|
envelopeItem: Pick<EnvelopeItem, 'id' | 'envelopeId'>;
|
||||||
|
token: string | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
export const getEnvelopeDownloadUrl = (options: EnvelopeDownloadUrlOptions) => {
|
export const getEnvelopeItemPdfUrl = (options: EnvelopeItemPdfUrlOptions) => {
|
||||||
const { envelopeItem, token, version } = options;
|
const { envelopeItem, token, type } = options;
|
||||||
|
|
||||||
const { id, envelopeId } = envelopeItem;
|
const { id, envelopeId } = envelopeItem;
|
||||||
|
|
||||||
|
if (type === 'download') {
|
||||||
|
const version = options.version;
|
||||||
|
|
||||||
|
return token
|
||||||
|
? `${NEXT_PUBLIC_WEBAPP_URL()}/api/files/token/${token}/envelopeItem/${id}/download/${version}`
|
||||||
|
: `${NEXT_PUBLIC_WEBAPP_URL()}/api/files/envelope/${envelopeId}/envelopeItem/${id}/download/${version}`;
|
||||||
|
}
|
||||||
|
|
||||||
return token
|
return token
|
||||||
? `${NEXT_PUBLIC_WEBAPP_URL()}/api/files/token/${token}/envelopeItem/${id}/download/${version}`
|
? `${NEXT_PUBLIC_WEBAPP_URL()}/api/files/token/${token}/envelopeItem/${id}`
|
||||||
: `${NEXT_PUBLIC_WEBAPP_URL()}/api/files/envelope/${envelopeId}/envelopeItem/${id}/download/${version}`;
|
: `${NEXT_PUBLIC_WEBAPP_URL()}/api/files/envelope/${envelopeId}/envelopeItem/${id}`;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
|
|||||||
import 'react-pdf/dist/esm/Page/TextLayer.css';
|
import 'react-pdf/dist/esm/Page/TextLayer.css';
|
||||||
|
|
||||||
import { PDF_VIEWER_PAGE_SELECTOR } from '@documenso/lib/constants/pdf-viewer';
|
import { PDF_VIEWER_PAGE_SELECTOR } from '@documenso/lib/constants/pdf-viewer';
|
||||||
import { getEnvelopeDownloadUrl } from '@documenso/lib/utils/envelope-download';
|
import { getEnvelopeItemPdfUrl } from '@documenso/lib/utils/envelope-download';
|
||||||
|
|
||||||
import { cn } from '../lib/utils';
|
import { cn } from '../lib/utils';
|
||||||
import { useToast } from './use-toast';
|
import { useToast } from './use-toast';
|
||||||
@ -157,10 +157,10 @@ export const PDFViewer = ({
|
|||||||
try {
|
try {
|
||||||
setIsDocumentBytesLoading(true);
|
setIsDocumentBytesLoading(true);
|
||||||
|
|
||||||
const documentUrl = getEnvelopeDownloadUrl({
|
const documentUrl = getEnvelopeItemPdfUrl({
|
||||||
|
type: 'view',
|
||||||
envelopeItem: envelopeItem,
|
envelopeItem: envelopeItem,
|
||||||
token,
|
token,
|
||||||
version,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const bytes = await fetch(documentUrl).then(async (res) => await res.arrayBuffer());
|
const bytes = await fetch(documentUrl).then(async (res) => await res.arrayBuffer());
|
||||||
|
|||||||
Reference in New Issue
Block a user