Compare commits

..

1 Commits

Author SHA1 Message Date
Mythie
1aeb6325b0 wip: wip 2024-10-16 15:45:46 +11:00
269 changed files with 9409 additions and 13931 deletions

View File

@@ -0,0 +1,38 @@
# Extract and compile translations for all PRs.
name: 'Extract and compile translations'
on:
workflow_call:
pull_request:
branches: ['main']
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
extract_translations:
name: Extract and compile translations
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: ./.github/actions/node-install
- name: Extract and compile translations
run: |
npm run translate:extract
npm run translate:compile
- name: Check and commit any files created
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@documenso.com'
git add packages/lib/translations
git diff --staged --quiet --exit-code || (git commit -m "chore: extract translations" && git push)

View File

@@ -21,12 +21,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}
ref: ${{ github.event.pull_request.head.ref }}
- uses: ./.github/actions/node-install
- name: Extract translations
run: npm run translate:extract
- name: Extract and compile translations
run: |
npm run translate:extract
npm run translate:compile
- name: Check and commit any files created
run: |

View File

@@ -13,4 +13,9 @@ node "$MONOREPO_ROOT/scripts/copy-wellknown.cjs"
git add "$MONOREPO_ROOT/apps/web/public/"
git add "$MONOREPO_ROOT/apps/marketing/public/"
echo "Extract and compile translations"
npm run translate:extract
npm run translate:compile
git add "$MONOREPO_ROOT/packages/lib/translations/"
npx lint-staged

View File

@@ -1,507 +0,0 @@
---
title: API Reference
description: Reference documentation for the Documenso public API.
---
import { Callout, Steps } from 'nextra/components';
# API Reference
The Swagger UI for the API is available at [/api/v1/openapi](https://app.documenso.com/api/v1/openapi). This page provides detailed information about the API endpoints, request and response formats, and authentication requirements.
## Upload a Document
Uploading a document to your Documenso account requires a two-step process.
<Steps>
### Create Document
First, you need to make a `POST` request to the `/api/v1/documents` endpoint, which takes a JSON payload with the following fields:
```json
{
"title": "string",
"externalId": "string",
"recipients": [
{
"name": "string",
"email": "user@example.com",
"role": "SIGNER",
"signingOrder": 0
}
],
"meta": {
"subject": "string",
"message": "string",
"timezone": "Etc/UTC",
"dateFormat": "yyyy-MM-dd hh:mm a",
"redirectUrl": "string",
"signingOrder": "PARALLEL"
},
"authOptions": {
"globalAccessAuth": "ACCOUNT",
"globalActionAuth": "ACCOUNT"
},
"formValues": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
}
```
- `title` _(required)_ - This represents the document's title.
- `externalId` - This is an optional field that you can use to store an external identifier for the document. This can be useful for tracking the document in your system.
- `recipients` _(required)_ - This is an array of recipient objects. Each recipient object has the following fields:
- `name` - The name of the recipient.
- `email` - The email address of the recipient.
- `role` - The role of the recipient. See the [available roles](/users/signing-documents#roles).
- `signingOrder` - The order in which the recipient should sign the document. This is an integer value starting from 0.
- `meta` - This object contains additional metadata for the document. It has the following fields:
- `subject` - The subject of the email that will be sent to the recipients.
- `message` - The message of the email that will be sent to the recipients.
- `timezone` - The timezone in which the document should be signed.
- `dateFormat` - The date format that should be used in the document.
- `redirectUrl` - The URL to which the user should be redirected after signing the document.
- `signingOrder` - The signing order for the document. This can be either `SEQUENTIAL` or `PARALLEL`.
- `authOptions` - This object contains authentication options for the document. It has the following fields:
- `globalAccessAuth` - The authentication level required to access the document. This can be either `ACCOUNT` or `null`.
- If the document is set to `ACCOUNT`, all recipients must authenticate with their Documenso account to access it.
- The document can be accessed without a Documenso account if it's set to `null`.
- `globalActionAuth` - The authentication level required to perform actions on the document. This can be `ACCOUNT`, `PASSKEY`, `TWO_FACTOR_AUTH`, or `null`.
- If the document is set to `ACCOUNT`, all recipients must authenticate with their Documenso account to perform actions on the document.
- If it's set to `PASSKEY`, all recipients must have the passkey active to perform actions on the document.
- If it's set to `TWO_FACTOR_AUTH`, all recipients must have the two-factor authentication active to perform actions on the document.
- If it's set to `null`, all the recipients can perform actions on the document without any authentication.
- `formValues` - This object contains additional form values for the document. This property only works with native PDF fields and accepts three types: number, text and boolean.
<Callout type="info">
The `globalActionAuth` property is only available for Enterprise accounts.
</Callout>
Here's an example of the JSON payload for uploading a document:
```json
{
"title": "my-document.pdf",
"externalId": "12345",
"recipients": [
{
"name": "Alex Blake",
"email": "alexblake@email.com",
"role": "SIGNER",
"signingOrder": 1
},
{
"name": "Ash Drew",
"email": "ashdrew@email.com",
"role": "SIGNER",
"signingOrder": 0
}
],
"meta": {
"subject": "Sign the document",
"message": "Hey there, please sign this document.",
"timezone": "Europe/London",
"dateFormat": "Day, Month Year",
"redirectUrl": "https://mysite.com/welcome",
"signingOrder": "SEQUENTIAL"
},
"authOptions": {
"globalAccessAuth": "ACCOUNT",
"globalActionAuth": "PASSKEY"
}
}
```
### Upload to S3
A successful API call to the `/api/v1/documents` endpoint returns a JSON response containing the upload URL, document ID, and recipient information.
The upload URL is a pre-signed S3 URL that you can use to upload the document to the Documenso (or your) S3 bucket. You need to make a `PUT` request to this URL to upload the document.
```json
{
"uploadUrl": "https://<url>/<bucket-name>/<id>/my-document.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=<credentials>&X-Amz-Date=<date>&X-Amz-Expires=3600&X-Amz-Signature=<signature>&X-Amz-SignedHeaders=host&x-id=PutObject",
"documentId": 51,
"recipients": [
{
"recipientId": 11,
"name": "Alex Blake",
"email": "alexblake@email.com",
"token": "<unique-signer-token>",
"role": "SIGNER",
"signingOrder": 1,
"signingUrl": "https://app.documenso.com/sign/<unique-signer-token>"
},
{
"recipientId": 12,
"name": "Ash Drew",
"email": "ashdrew@email.com",
"token": "<unique-signer-token>",
"role": "SIGNER",
"signingOrder": 0,
"signingUrl": "https://app.documenso.com/sign/<unique-signer-token>"
}
]
}
```
When you make the `PUT` request to the pre-signed URL, you need to include the document file you want to upload. The image below shows how to upload a document to the S3 bucket via Postman.
![Upload document to S3](/api-reference/upload-document-to-s3.webp)
Here's an example of how to upload a document using cURL:
```bash
curl --location --request PUT 'https://<url>/<bucket-name>/<id>/my-document.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=<credentials>&X-Amz-Date=<date>&X-Amz-Expires=3600&X-Amz-Signature=<signature>&X-Amz-SignedHeaders=host&x-id=PutObject' \
--form '=@"/Users/my-user/Documents/documenso.pdf"'
```
Once the document is successfully uploaded, you can access it in your Documenso account dashboard. The screenshot below shows the document that was uploaded via the API.
![Uploaded Document](/api-reference/document-uploaded-to-documenso-via-api.webp)
</Steps>
## Generate Document From Template
Documenso allows you to generate documents from templates. This is useful when you have a standard document format you want to reuse.
The API endpoint for generating a document from a template is `/api/v1/templates/{templateId}/generate-document`, and it takes a JSON payload with the following fields:
```json
{
"title": "string",
"externalId": "string",
"recipients": [
{
"id": 0,
"name": "string",
"email": "user@example.com",
"signingOrder": 0
}
],
"meta": {
"subject": "string",
"message": "string",
"timezone": "string",
"dateFormat": "string",
"redirectUrl": "string",
"signingOrder": "PARALLEL"
},
"authOptions": {
"globalAccessAuth": "ACCOUNT",
"globalActionAuth": "ACCOUNT"
},
"formValues": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
}
```
The JSON payload is identical to the payload for uploading a document, so you can read more about the fields in the [Create Document](/developers/public-api/reference#create-document) step. For this API endpoint, the `recipients` property is required.
<Steps>
### Grab the Template ID
The first step is to retrieve the template ID from the Documenso dashboard. You can find the template ID in the URL by navigating to the template details page.
![Template ID](/api-reference/documenso-template-id.webp)
In this case, the template ID is "99999".
### Retrieve the Recipient(s) ID(s)
Once you have the template ID, the next step involves retrieving the ID(s) of the recipient(s) from the template. You can do this by making a GET request to `/api/v1/templates/{template-id}`.
A successful response looks as follows:
```json
{
"id": 0,
"externalId": "string",
"type": "PUBLIC",
"title": "string",
"userId": 0,
"teamId": 0,
"templateDocumentDataId": "string",
"createdAt": "2024-10-11T08:46:58.247Z",
"updatedAt": "2024-10-11T08:46:58.247Z",
"templateMeta": {
"id": "string",
"subject": "string",
"message": "string",
"timezone": "string",
"dateFormat": "string",
"templateId": 0,
"redirectUrl": "string",
"signingOrder": "PARALLEL"
},
"directLink": {
"token": "string",
"enabled": true
},
"templateDocumentData": {
"id": "string",
"type": "S3_PATH",
"data": "string"
},
"Field": [
{
"id": 0,
"recipientId": 0,
"type": "SIGNATURE",
"page": 0,
"positionX": "string",
"positionY": "string",
"width": "string",
"height": "string"
}
],
"Recipient": [
{
"id": 0,
"email": "user@example.com",
"name": "string",
"signingOrder": 0,
"authOptions": "string",
"role": "CC"
}
]
}
```
You'll need the recipient(s) ID(s) for the next step.
### Generate the Document
To generate a document from the template, you need to make a POST request to the `/api/v1/templates/{template-id}/generate-document` endpoint.
At the minimum, you must provide the `recipients` array in the JSON payload. Here's an example of the JSON payload:
```json
{
"recipients": [
{
"id": 0,
"name": "Ash Drew",
"email": "ashdrew@email.com",
"signingOrder": 0
}
]
}
```
Filling the `recipients` array with the corresponding recipient for each template placeholder recipient is recommended. For example, if the template has two placeholders, you should provide at least two recipients in the `recipients` array. Otherwise, the document will be sent to inexistent recipients such as `<recipient.1@documenso.com>`. However, the recipients can always be edited via the API or the web app.
A successful response will contain the document ID and recipient(s) information.
```json
{
"documentId": 999,
"recipients": [
{
"recipientId": 0,
"name": "Ash Drew",
"email": "ashdrew@email.com",
"token": "<signing-token>",
"role": "SIGNER",
"signingOrder": null,
"signingUrl": "https://app.documenso.com/sign/<signing-token>"
}
]
}
```
You can now access the document in your Documenso account dashboard. The screenshot below shows the document that was generated from the template.
![Generated Document](/api-reference/document-generated-from-template.webp)
</Steps>
## Add Fields to Document
The API allows you to add fields to a document via the `/api/v1/documents/{documentId}/fields` endpoint. This is useful when you want to add fields to a document before sending it to recipients.
To add fields to a document, you need to make a `POST` request with a JSON payload containing the field(s) information.
```json
{
"recipientId": 0,
"type": "SIGNATURE",
"pageNumber": 0,
"pageX": 0,
"pageY": 0,
"pageWidth": 0,
"pageHeight": 0,
"fieldMeta": {
"label": "string",
"placeholder": "string",
"required": true,
"readOnly": true,
"type": "text",
"text": "string",
"characterLimit": 0
}
}
// or
[
{
"recipientId": 0,
"type": "SIGNATURE",
"pageNumber": 0,
"pageX": 0,
"pageY": 0,
"pageWidth": 0,
"pageHeight": 0
},
{
"recipientId": 0,
"type": "TEXT",
"pageNumber": 0,
"pageX": 0,
"pageY": 0,
"pageWidth": 0,
"pageHeight": 0,
"fieldMeta": {
"label": "string",
"placeholder": "string",
"required": true,
"readOnly": true,
"type": "text",
"text": "string",
"characterLimit": 0
}
}
]
```
<Callout type="info">This endpoint accepts either one field or an array of fields.</Callout>
Before adding fields to a document, you need each recipient's ID. If the document already has recipients, you can query the document to retrieve the recipient's details. If the document has no recipients, you need to add a recipient via the UI or API before adding a field.
<Steps>
### Retrieve the Recipient(s) ID(s)
Perform a `GET` request to the `/api/v1/documents/{id}` to retrieve the details of a specific document, including the recipient's information.
An example response would look like this:
```json
{
"id": 137,
"externalId": null,
"userId": 3,
"teamId": null,
"title": "documenso.pdf",
"status": "DRAFT",
"documentDataId": "<document-data-id>",
"createdAt": "2024-10-11T12:29:12.725Z",
"updatedAt": "2024-10-11T12:29:12.725Z",
"completedAt": null,
"recipients": [
{
"id": 55,
"documentId": 137,
"email": "ashdrew@email.com",
"name": "Ash Drew",
"role": "SIGNER",
"signingOrder": null,
"token": "<signing-token>",
"signedAt": null,
"readStatus": "NOT_OPENED",
"signingStatus": "NOT_SIGNED",
"sendStatus": "NOT_SENT",
"signingUrl": "https://app.documenso.com/sign/<signing-token>"
}
]
}
```
From this response, you'll only need the recipient ID, which is `55` in this case.
### (OR) Add a Recipient
If the document doesn't already have recipient(s), you can add recipient(s) via the API. Make a `POST` request to the `/api/v1/documents/{documentId}/recipients` endpoint with the recipient information. This endpoint takes the following JSON payload:
```json
{
"name": "string",
"email": "user@example.com",
"role": "SIGNER",
"signingOrder": 0,
"authOptions": {
"actionAuth": "ACCOUNT"
}
}
```
<Callout type="info">The `authOptions` property is only available for Enterprise accounts.</Callout>
Here's an example of the JSON payload for adding a recipient:
```json
{
"name": "Ash Drew",
"email": "ashdrew@email.com",
"role": "SIGNER",
"signingOrder": 0
}
```
A successful request will return a JSON response with the newly added recipient. You can now use the recipient ID to add fields to the document.
### Add Field(s)
Now you can make a `POST` request to the `/api/v1/documents/{documentId}/fields` endpoint with the field(s) information. Here's an example:
```json
[
{
"recipientId": 55,
"type": "SIGNATURE",
"pageNumber": 1,
"pageX": 50,
"pageY": 20,
"pageWidth": 25,
"pageHeight": 5
},
{
"recipientId": 55,
"type": "TEXT",
"pageNumber": 1,
"pageX": 20,
"pageY": 50,
"pageWidth": 30,
"pageHeight": 7.5,
"fieldMeta": {
"label": "Address",
"placeholder": "32 New York Street, 41241",
"required": true,
"readOnly": false,
"type": "text",
"text": "32 New York Street, 41241",
"characterLimit": 40
}
}
]
```
<Callout type="info">
The `text` field represents the default value of the field. If the user doesn't provide any other
value, this is the value that will be used to sign the field.
</Callout>
A successful request will return a JSON response with the newly added fields. The image below illustrates the fields added to the document via the API.
![A screenshot of the document in the Documenso editor](/api-reference/fields-added-via-api.webp)
</Steps>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

View File

@@ -1,82 +0,0 @@
---
title: Cal.com Chooses Documenso for DPA and BAA Scalability and Compliance
description: Learn how Cal.com scales their Data Processing Agreement (DPA) and Business Associate Agreement (BAA) processes with Documensos open source platform as they grow.
authorName: 'Timur Ercan'
authorImage: '/blog/blog-author-timur.jpeg'
authorRole: 'Co-Founder'
date: 2024-10-11
tags:
- Customer Story
- Open Startup
- Open Source
---
<figure>
<MdxNextImage
src="/blog/cal2.png"
width="1260"
height="630"
alt="Scheduling Infrastructure for Everyone"
/>
<figcaption className="text-center">
Scheduling Infrastructure for Everyone.
</figcaption>
</figure>
TL;DR: Cal.com uses Documensos template direct links to facilitate low-friction compliance paperwork, enhancing scalability and user experience.
## Cal.com The Most Public Private Company
[Cal.com](Cal.com) is an open source company that needs no introduction. Founded in 2021 by Bailey Pumfleet and Peer Richelsen, it quickly evolved from an open source alternative to the widespread but limited scheduling platform Calendly into the internets most beloved scheduling solution. Starting with just two founders, Cal.com has grown into a team of 22, facilitating millions of bookings per year for its ever-growing user and customer base.
Their commitment to transparency is evident as they follow the [open startup movement](https://cal.com/open), opening up not only their source code but also providing insights into their business operations. Their Commercial Open Source Software (COSS) model, combining a company and an open source project, has inspired a whole cohort of startups joining the space—not least of which is Documenso.
## The Need
At this point, Cal.com serves customers of all sizes, from single users to large enterprises. To provide the best product for their customers, they are certified for SOC 2, HIPAA, GDPR, and many other compliance regulations. One challenge that comes with this is the increasing number of waivers that need to be signed when onboarding customers. Business Associate Agreements (BAAs) and Data Processing Agreements (DPAs) are two of the more commonly known examples. To get these signed with minimal effort for both sides, they were looking for a solution to handle these at scale.
> We love open source.
— Peer Richelsen, Co-Founder, Cal.com
Being an open source company, they also prefer open source in their vendors—for both the shared philosophy and the higher level of trust. The goal was to integrate signing into the checkout process as seamlessly as possible.
## The Solution
<figure>
<MdxNextImage
src="/blog/cal.png"
width="1260"
height="630"
alt="Cal.com direct link template to sign a DPA"
/>
<figcaption className="text-center">
Sign a DPA with Cal by clicking a link anytime.
</figcaption>
</figure>
Documenso offers exactly this solution through direct link templates, enabling Cal.com to:
- Provide Immediate Access: Customers can access and sign necessary compliance documents through direct links at any time.
- Enhance User Experience: Users are immediately forwarded to onboarding after signing.
- Ensure Easy Access: The documents are stored within the companys team account, allowing easy access for anyone who needs them.
Direct Link templates can also easily be embedded, using the [Documenso widget](https://documen.so/embedded). Embedding anywhere, pre-Filling the templates and notfiying the compliance team at certain point of the flow are a few of the many option the team now has in continously enhanceing their onboard and compliance UX.
Read more about our direct link templates here: [Direct Link Signing](https://docs.documenso.com/users/direct-links).
## The Journey
Initially, Cal.coms team approached the new solution with skepticism. As Bailey reflected:
> We were intrigued but skeptical at first, as we put a lot of thought into compliance and doing things right. Documensos documentation and support showcased how their direct link templates could meet our needs while being highly compliant.
This experience highlights Documensos trust philosophy. We strive to be transparent in everything we do and let people judge for themselves. It also shows that we neither want nor get trust by default. Doing things right is a conversation worth having, especially in a space as opaque as digital signatures. It goes without saying that the whole team is hyped to have Cal.com on board and yet another open source company joining the open signing movement 🚀
If you have any questions or comments, please reach out on [Twitter / X](https://twitter.com/eltimuro) (DM open) or [Discord](https://documen.so/discord).
Thinking about switching to a modern signing platform? Reach out anytime: [https://documen.so/sales](https://documen.so/sales)
Best from Hamburg\
Timur

View File

@@ -1,11 +1,11 @@
{
"name": "@documenso/marketing",
"version": "1.7.2-rc.4",
"version": "1.7.2-rc.0",
"private": true,
"license": "AGPL-3.0",
"scripts": {
"dev": "next dev -p 3001",
"build": "npm run translate:extract --prefix ../../ && turbo run translate:compile && next build",
"build": "next build",
"start": "next start -p 3001",
"lint": "next lint",
"lint:fix": "next lint --fix",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

View File

@@ -30,8 +30,8 @@ const mdxComponents: MDXComponents = {
*
* Will render the document if it exists, otherwise will return a 404.
*/
export default async function ContentPage({ params }: { params: { content: string } }) {
await setupI18nSSR();
export default function ContentPage({ params }: { params: { content: string } }) {
setupI18nSSR();
const post = allDocuments.find((post) => post._raw.flattenedPath === params.content);

View File

@@ -48,8 +48,8 @@ const mdxComponents: MDXComponents = {
),
};
export default async function BlogPostPage({ params }: { params: { post: string } }) {
await setupI18nSSR();
export default function BlogPostPage({ params }: { params: { post: string } }) {
setupI18nSSR();
const post = allBlogPosts.find((post) => post._raw.flattenedPath === `blog/${params.post}`);

View File

@@ -9,8 +9,8 @@ export const metadata: Metadata = {
title: 'Blog',
};
export default async function BlogPage() {
const { i18n } = await setupI18nSSR();
export default function BlogPage() {
const { i18n } = setupI18nSSR();
const blogPosts = allBlogPosts.sort((a, b) => {
const dateA = new Date(a.date);

View File

@@ -1,6 +1,7 @@
import type { Metadata } from 'next';
import { Trans, msg } from '@lingui/macro';
import { useLingui } from '@lingui/react';
import { z } from 'zod';
import { setupI18nSSR } from '@documenso/lib/client-only/providers/i18n.server';
@@ -130,9 +131,9 @@ const fetchEarlyAdopters = async () => {
};
export default async function OpenPage() {
const { i18n } = await setupI18nSSR();
setupI18nSSR();
const { _ } = i18n;
const { _ } = useLingui();
const [
{ forks_count: forksCount, stargazers_count: stargazersCount },

View File

@@ -26,7 +26,7 @@ const fontCaveat = Caveat({
});
export default async function IndexPage() {
await setupI18nSSR();
setupI18nSSR();
const starCount = await fetch('https://api.github.com/repos/documenso/documenso', {
headers: {

View File

@@ -30,8 +30,8 @@ export type PricingPageProps = {
};
};
export default async function PricingPage() {
await setupI18nSSR();
export default function PricingPage() {
setupI18nSSR();
return (
<div className="mt-6 sm:mt-12">

View File

@@ -14,8 +14,8 @@ export const dynamic = 'force-dynamic';
// !: This entire file is a hack to get around failed prerendering of
// !: the Single Player Mode page. This regression was introduced during
// !: the upgrade of Next.js to v13.5.x.
export default async function SingleplayerPage() {
await setupI18nSSR();
export default function SingleplayerPage() {
setupI18nSSR();
return <SinglePlayerClient />;
}

View File

@@ -56,7 +56,7 @@ export function generateMetadata() {
export default async function RootLayout({ children }: { children: React.ReactNode }) {
const flags = await getAllAnonymousFlags();
const { lang, locales, i18n } = await setupI18nSSR();
const { lang, locales, i18n } = setupI18nSSR();
return (
<html

View File

@@ -1,11 +1,11 @@
{
"name": "@documenso/web",
"version": "1.7.2-rc.4",
"version": "1.7.2-rc.0",
"private": true,
"license": "AGPL-3.0",
"scripts": {
"dev": "next dev -p 3000",
"build": "npm run translate:extract --prefix ../../ && turbo run translate:compile && next build",
"build": "next build",
"start": "next start",
"lint": "next lint",
"e2e:prepare": "next build && next start",

View File

@@ -24,7 +24,7 @@ type AdminDocumentDetailsPageProps = {
};
export default async function AdminDocumentDetailsPage({ params }: AdminDocumentDetailsPageProps) {
const { i18n } = await setupI18nSSR();
const { i18n } = setupI18nSSR();
const document = await getEntireDocument({ id: Number(params.id) });

View File

@@ -4,8 +4,8 @@ import { setupI18nSSR } from '@documenso/lib/client-only/providers/i18n.server';
import { AdminDocumentResults } from './document-results';
export default async function AdminDocumentsPage() {
await setupI18nSSR();
export default function AdminDocumentsPage() {
setupI18nSSR();
return (
<div>

View File

@@ -13,7 +13,7 @@ export type AdminSectionLayoutProps = {
};
export default async function AdminSectionLayout({ children }: AdminSectionLayoutProps) {
await setupI18nSSR();
setupI18nSSR();
const { user } = await getRequiredServerComponentSession();

View File

@@ -12,7 +12,7 @@ import { BannerForm } from './banner-form';
// import { BannerForm } from './banner-form';
export default async function AdminBannerPage() {
await setupI18nSSR();
setupI18nSSR();
const { _ } = useLingui();

View File

@@ -30,7 +30,7 @@ import { SignerConversionChart } from './signer-conversion-chart';
import { UserWithDocumentChart } from './user-with-document';
export default async function AdminStatsPage() {
await setupI18nSSR();
setupI18nSSR();
const { _ } = useLingui();

View File

@@ -14,7 +14,7 @@ import {
} from '@documenso/ui/primitives/table';
export default async function Subscriptions() {
await setupI18nSSR();
setupI18nSSR();
const subscriptions = await findSubscriptions();

View File

@@ -16,7 +16,7 @@ type AdminManageUsersProps = {
};
export default async function AdminManageUsers({ searchParams = {} }: AdminManageUsersProps) {
await setupI18nSSR();
setupI18nSSR();
const page = Number(searchParams.page) || 1;
const perPage = Number(searchParams.perPage) || 10;

View File

@@ -7,7 +7,6 @@ import { useRouter, useSearchParams } from 'next/navigation';
import { msg } from '@lingui/macro';
import { useLingui } from '@lingui/react';
import { isValidLanguageCode } from '@documenso/lib/constants/i18n';
import {
DO_NOT_INVALIDATE_QUERY_ON_MUTATION,
SKIP_QUERY_BATCH_META,
@@ -113,24 +112,6 @@ export const EditDocumentForm = ({
},
});
const { mutateAsync: updateTypedSignature } =
trpc.document.updateTypedSignatureSettings.useMutation({
...DO_NOT_INVALIDATE_QUERY_ON_MUTATION,
onSuccess: (newData) => {
utils.document.getDocumentWithDetailsById.setData(
{
id: initialDocument.id,
teamId: team?.id,
},
(oldData) => ({
...(oldData || initialDocument),
...newData,
id: Number(newData.id),
}),
);
},
});
const { mutateAsync: addSigners } = trpc.recipient.addSigners.useMutation({
...DO_NOT_INVALIDATE_QUERY_ON_MUTATION,
onSuccess: (newRecipients) => {
@@ -202,7 +183,7 @@ export const EditDocumentForm = ({
const onAddSettingsFormSubmit = async (data: TAddSettingsFormSchema) => {
try {
const { timezone, dateFormat, redirectUrl, language } = data.meta;
const { timezone, dateFormat, redirectUrl } = data.meta;
await setSettingsForDocument({
documentId: document.id,
@@ -218,7 +199,6 @@ export const EditDocumentForm = ({
timezone,
dateFormat,
redirectUrl,
language: isValidLanguageCode(language) ? language : undefined,
},
});
@@ -278,11 +258,6 @@ export const EditDocumentForm = ({
fields: data.fields,
});
await updateTypedSignature({
documentId: document.id,
typedSignatureEnabled: data.typedSignatureEnabled,
});
// Clear all field data from localStorage
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
@@ -412,7 +387,6 @@ export const EditDocumentForm = ({
fields={fields}
onSubmit={onAddFieldsFormSubmit}
isDocumentPdfLoaded={isDocumentPdfLoaded}
typedSignatureEnabled={document.documentMeta?.typedSignatureEnabled}
teamId={team?.id}
/>

View File

@@ -8,8 +8,8 @@ export type DocumentPageProps = {
};
};
export default async function DocumentEditPage({ params }: DocumentPageProps) {
await setupI18nSSR();
export default function DocumentEditPage({ params }: DocumentPageProps) {
setupI18nSSR();
return <DocumentEditPageView params={params} />;
}

View File

@@ -6,8 +6,8 @@ import { ChevronLeft, Loader } from 'lucide-react';
import { setupI18nSSR } from '@documenso/lib/client-only/providers/i18n.server';
import { Skeleton } from '@documenso/ui/primitives/skeleton';
export default async function Loading() {
await setupI18nSSR();
export default function Loading() {
setupI18nSSR();
return (
<div className="mx-auto -mt-4 flex w-full max-w-screen-xl flex-col px-4 md:px-8">

View File

@@ -8,8 +8,8 @@ export type DocumentsLogsPageProps = {
};
};
export default async function DocumentsLogsPage({ params }: DocumentsLogsPageProps) {
await setupI18nSSR();
export default function DocumentsLogsPage({ params }: DocumentsLogsPageProps) {
setupI18nSSR();
return <DocumentLogsPageView params={params} />;
}

View File

@@ -8,8 +8,8 @@ export type DocumentPageProps = {
};
};
export default async function DocumentPage({ params }: DocumentPageProps) {
await setupI18nSSR();
export default function DocumentPage({ params }: DocumentPageProps) {
setupI18nSSR();
return <DocumentPageView params={params} />;
}

View File

@@ -5,8 +5,8 @@ import { ChevronLeft } from 'lucide-react';
import { setupI18nSSR } from '@documenso/lib/client-only/providers/i18n.server';
export default async function DocumentSentPage() {
await setupI18nSSR();
export default function DocumentSentPage() {
setupI18nSSR();
return (
<div className="mx-auto -mt-4 flex w-full max-w-screen-xl flex-col px-4 md:px-8">

View File

@@ -87,7 +87,7 @@ export const DeleteDocumentDialog = ({
const onInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setInputValue(event.target.value);
setIsDeleteEnabled(event.target.value === _(msg`delete`));
setIsDeleteEnabled(event.target.value === 'delete');
};
return (

View File

@@ -117,10 +117,10 @@ export const MoveDocumentDialog = ({ documentId, open, onOpenChange }: MoveDocum
<DialogFooter>
<Button variant="secondary" onClick={() => onOpenChange(false)}>
<Trans>Cancel</Trans>
Cancel
</Button>
<Button onClick={onMove} loading={isLoading} disabled={!selectedTeamId || isLoading}>
{isLoading ? <Trans>Moving...</Trans> : <Trans>Move</Trans>}
{isLoading ? 'Moving...' : 'Move'}
</Button>
</DialogFooter>
</DialogContent>

View File

@@ -16,7 +16,7 @@ export const metadata: Metadata = {
};
export default async function DocumentsPage({ searchParams = {} }: DocumentsPageProps) {
await setupI18nSSR();
setupI18nSSR();
const { user } = await getRequiredServerComponentSession();

View File

@@ -23,7 +23,7 @@ export type AuthenticatedDashboardLayoutProps = {
export default async function AuthenticatedDashboardLayout({
children,
}: AuthenticatedDashboardLayoutProps) {
await setupI18nSSR();
setupI18nSSR();
const session = await getServerSession(NEXT_AUTH_OPTIONS);

View File

@@ -24,7 +24,7 @@ export const metadata: Metadata = {
};
export default async function BillingSettingsPage() {
const { i18n } = await setupI18nSSR();
const { i18n } = setupI18nSSR();
let { user } = await getRequiredServerComponentSession();

View File

@@ -11,8 +11,8 @@ export type DashboardSettingsLayoutProps = {
children: React.ReactNode;
};
export default async function DashboardSettingsLayout({ children }: DashboardSettingsLayoutProps) {
await setupI18nSSR();
export default function DashboardSettingsLayout({ children }: DashboardSettingsLayoutProps) {
setupI18nSSR();
return (
<div className="mx-auto w-full max-w-screen-xl px-4 md:px-8">

View File

@@ -17,7 +17,7 @@ export const metadata: Metadata = {
};
export default async function ProfileSettingsPage() {
await setupI18nSSR();
setupI18nSSR();
const { _ } = useLingui();
const { user } = await getRequiredServerComponentSession();

View File

@@ -5,7 +5,7 @@ import { getUserPublicProfile } from '@documenso/lib/server-only/user/get-user-p
import { PublicProfilePageView } from './public-profile-page-view';
export default async function Page() {
await setupI18nSSR();
setupI18nSSR();
const { user } = await getRequiredServerComponentSession();

View File

@@ -14,8 +14,8 @@ export const metadata: Metadata = {
title: 'Security activity',
};
export default async function SettingsSecurityActivityPage() {
await setupI18nSSR();
export default function SettingsSecurityActivityPage() {
setupI18nSSR();
const { _ } = useLingui();

View File

@@ -21,7 +21,7 @@ export const metadata: Metadata = {
};
export default async function SecuritySettingsPage() {
await setupI18nSSR();
setupI18nSSR();
const { _ } = useLingui();
const { user } = await getRequiredServerComponentSession();

View File

@@ -17,7 +17,7 @@ export const metadata: Metadata = {
};
export default async function SettingsManagePasskeysPage() {
await setupI18nSSR();
setupI18nSSR();
const { _ } = useLingui();
const isPasskeyEnabled = await getServerComponentFlag('app_passkey');

View File

@@ -10,7 +10,7 @@ import DeleteTokenDialog from '~/components/(dashboard)/settings/token/delete-to
import { ApiTokenForm } from '~/components/forms/token';
export default async function ApiTokensPage() {
const { i18n } = await setupI18nSSR();
const { i18n } = setupI18nSSR();
const { user } = await getRequiredServerComponentSession();

View File

@@ -7,7 +7,6 @@ import { useRouter } from 'next/navigation';
import { msg } from '@lingui/macro';
import { useLingui } from '@lingui/react';
import { isValidLanguageCode } from '@documenso/lib/constants/i18n';
import {
DO_NOT_INVALIDATE_QUERY_ON_MUTATION,
SKIP_QUERY_BATCH_META,
@@ -152,10 +151,7 @@ export const EditTemplateForm = ({
globalAccessAuth: data.globalAccessAuth ?? null,
globalActionAuth: data.globalActionAuth ?? null,
},
meta: {
...data.meta,
language: isValidLanguageCode(data.meta.language) ? data.meta.language : undefined,
},
meta: data.meta,
});
// Router refresh is here to clear the router cache for when navigating to /documents.

View File

@@ -7,8 +7,8 @@ import { TemplatePageView } from './template-page-view';
type TemplatePageProps = Pick<TemplatePageViewProps, 'params'>;
export default async function TemplatePage({ params }: TemplatePageProps) {
await setupI18nSSR();
export default function TemplatePage({ params }: TemplatePageProps) {
setupI18nSSR();
return <TemplatePageView params={params} />;
}

View File

@@ -144,7 +144,6 @@ export const TemplatesDataTable = ({
<div className="flex items-center gap-x-4">
<UseTemplateDialog
templateId={row.original.id}
templateSigningOrder={row.original.templateMeta?.signingOrder}
recipients={row.original.Recipient}
documentRootPath={documentRootPath}
/>

View File

@@ -15,8 +15,8 @@ export const metadata: Metadata = {
title: 'Templates',
};
export default async function TemplatesPage({ searchParams = {} }: TemplatesPageProps) {
await setupI18nSSR();
export default function TemplatesPage({ searchParams = {} }: TemplatesPageProps) {
setupI18nSSR();
return <TemplatesPageView searchParams={searchParams} />;
}

View File

@@ -434,14 +434,12 @@ export const TemplateDirectLinkDialog = ({
<Button
type="button"
loading={isTogglingTemplateAccess}
onClick={async () => {
await toggleTemplateDirectLink({
onClick={async () =>
toggleTemplateDirectLink({
templateId: template.id,
enabled: isEnabled,
}).catch((e) => null);
onOpenChange(false);
}}
})
}
>
<Trans>Save</Trans>
</Button>

View File

@@ -15,9 +15,7 @@ import {
} from '@documenso/lib/constants/template';
import { AppError } from '@documenso/lib/errors/app-error';
import type { Recipient } from '@documenso/prisma/client';
import { DocumentSigningOrder } from '@documenso/prisma/client';
import { trpc } from '@documenso/trpc/react';
import { cn } from '@documenso/ui/lib/utils';
import { Button } from '@documenso/ui/primitives/button';
import { Checkbox } from '@documenso/ui/primitives/checkbox';
import {
@@ -53,7 +51,6 @@ const ZAddRecipientsForNewDocumentSchema = z
id: z.number(),
email: z.string().email(),
name: z.string(),
signingOrder: z.number().optional(),
}),
),
})
@@ -89,7 +86,6 @@ type TAddRecipientsForNewDocumentSchema = z.infer<typeof ZAddRecipientsForNewDoc
export type UseTemplateDialogProps = {
templateId: number;
templateSigningOrder?: DocumentSigningOrder | null;
recipients: Recipient[];
documentRootPath: string;
};
@@ -98,7 +94,6 @@ export function UseTemplateDialog({
recipients,
documentRootPath,
templateId,
templateSigningOrder,
}: UseTemplateDialogProps) {
const router = useRouter();
@@ -113,24 +108,21 @@ export function UseTemplateDialog({
resolver: zodResolver(ZAddRecipientsForNewDocumentSchema),
defaultValues: {
sendDocument: false,
recipients: recipients
.sort((a, b) => (a.signingOrder || 0) - (b.signingOrder || 0))
.map((recipient) => {
const isRecipientEmailPlaceholder = recipient.email.match(
TEMPLATE_RECIPIENT_EMAIL_PLACEHOLDER_REGEX,
);
recipients: recipients.map((recipient) => {
const isRecipientEmailPlaceholder = recipient.email.match(
TEMPLATE_RECIPIENT_EMAIL_PLACEHOLDER_REGEX,
);
const isRecipientNamePlaceholder = recipient.name.match(
TEMPLATE_RECIPIENT_NAME_PLACEHOLDER_REGEX,
);
const isRecipientNamePlaceholder = recipient.name.match(
TEMPLATE_RECIPIENT_NAME_PLACEHOLDER_REGEX,
);
return {
id: recipient.id,
name: !isRecipientNamePlaceholder ? recipient.name : '',
email: !isRecipientEmailPlaceholder ? recipient.email : '',
signingOrder: recipient.signingOrder ?? undefined,
};
}),
return {
id: recipient.id,
name: !isRecipientNamePlaceholder ? recipient.name : '',
email: !isRecipientEmailPlaceholder ? recipient.email : '',
};
}),
},
});
@@ -211,33 +203,6 @@ export function UseTemplateDialog({
<div className="custom-scrollbar -m-1 max-h-[60vh] space-y-4 overflow-y-auto p-1">
{formRecipients.map((recipient, index) => (
<div className="flex w-full flex-row space-x-4" key={recipient.id}>
{templateSigningOrder === DocumentSigningOrder.SEQUENTIAL && (
<FormField
control={form.control}
name={`recipients.${index}.signingOrder`}
render={({ field }) => (
<FormItem
className={cn('w-20', {
'mt-8': index === 0,
})}
>
<FormControl>
<Input
{...field}
disabled
className="items-center justify-center"
value={
field.value?.toString() ||
recipients[index]?.signingOrder?.toString()
}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
<FormField
control={form.control}
name={`recipients.${index}.email`}

View File

@@ -14,7 +14,7 @@ type PublicProfileLayoutProps = {
};
export default async function PublicProfileLayout({ children }: PublicProfileLayoutProps) {
await setupI18nSSR();
setupI18nSSR();
const { user, session } = await getServerComponentSession();

View File

@@ -42,7 +42,7 @@ const BADGE_DATA = {
};
export default async function PublicProfilePage({ params }: PublicProfilePageProps) {
await setupI18nSSR();
setupI18nSSR();
const { url: profileUrl } = params;

View File

@@ -1,7 +1,7 @@
'use client';
import { zodResolver } from '@hookform/resolvers/zod';
import { Trans, msg } from '@lingui/macro';
import { Trans } from '@lingui/macro';
import { useLingui } from '@lingui/react';
import { useSession } from 'next-auth/react';
import { useForm } from 'react-hook-form';
@@ -77,7 +77,7 @@ export const ConfigureDirectTemplateFormPartial = ({
if (template.Recipient.map((recipient) => recipient.email).includes(items.email)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: _(msg`Email cannot already exist in the template`),
message: 'Email cannot already exist in the template',
path: ['email'],
});
}

View File

@@ -24,7 +24,7 @@ export type TemplatesDirectPageProps = {
};
export default async function TemplatesDirectPage({ params }: TemplatesDirectPageProps) {
await setupI18nSSR();
setupI18nSSR();
const { token } = params;

View File

@@ -19,7 +19,7 @@ type RecipientLayoutProps = {
* Such as direct template access, or signing.
*/
export default async function RecipientLayout({ children }: RecipientLayoutProps) {
await setupI18nSSR();
setupI18nSSR();
const { user, session } = await getServerComponentSession();

View File

@@ -8,8 +8,8 @@ export type SigningLayoutProps = {
children: React.ReactNode;
};
export default async function SigningLayout({ children }: SigningLayoutProps) {
await setupI18nSSR();
export default function SigningLayout({ children }: SigningLayoutProps) {
setupI18nSSR();
return (
<div>

View File

@@ -40,7 +40,7 @@ export type CompletedSigningPageProps = {
export default async function CompletedSigningPage({
params: { token },
}: CompletedSigningPageProps) {
await setupI18nSSR();
setupI18nSSR();
const { _ } = useLingui();
@@ -222,7 +222,7 @@ export default async function CompletedSigningPage({
)}
{isLoggedIn && (
<Link href="/documents" className="text-documenso-700 hover:text-documenso-600 mt-2">
<Link href="/documents" className="text-documenso-700 hover:text-documenso-600">
<Trans>Go Back Home</Trans>
</Link>
)}

View File

@@ -9,10 +9,9 @@ import { useSession } from 'next-auth/react';
import { useForm } from 'react-hook-form';
import { useAnalytics } from '@documenso/lib/client-only/hooks/use-analytics';
import type { DocumentAndSender } from '@documenso/lib/server-only/document/get-document-by-token';
import type { TRecipientActionAuth } from '@documenso/lib/types/document-auth';
import { sortFieldsByPosition, validateFieldsInserted } from '@documenso/lib/utils/fields';
import { type Field, type Recipient, RecipientRole } from '@documenso/prisma/client';
import { type Document, type Field, type Recipient, RecipientRole } from '@documenso/prisma/client';
import { trpc } from '@documenso/trpc/react';
import { FieldToolTip } from '@documenso/ui/components/field/field-tooltip';
import { cn } from '@documenso/ui/lib/utils';
@@ -26,7 +25,7 @@ import { useRequiredSigningContext } from './provider';
import { SignDialog } from './sign-dialog';
export type SigningFormProps = {
document: DocumentAndSender;
document: Document;
recipient: Recipient;
fields: Field[];
redirectUrl?: string | null;
@@ -124,9 +123,9 @@ export const SigningForm = ({
>
<div className={cn('flex flex-1 flex-col')}>
<h3 className="text-foreground text-2xl font-semibold">
{recipient.role === RecipientRole.VIEWER && <Trans>View Document</Trans>}
{recipient.role === RecipientRole.SIGNER && <Trans>Sign Document</Trans>}
{recipient.role === RecipientRole.APPROVER && <Trans>Approve Document</Trans>}
{recipient.role === RecipientRole.VIEWER && 'View Document'}
{recipient.role === RecipientRole.SIGNER && 'Sign Document'}
{recipient.role === RecipientRole.APPROVER && 'Approve Document'}
</h3>
{recipient.role === RecipientRole.VIEWER ? (
@@ -166,7 +165,7 @@ export const SigningForm = ({
) : (
<>
<p className="text-muted-foreground mt-2 text-sm">
<Trans>Please review the document before signing.</Trans>
Please review the document before signing.
</p>
<hr className="border-border mb-8 mt-4" />
@@ -174,9 +173,7 @@ export const SigningForm = ({
<div className="-mx-2 flex flex-1 flex-col gap-4 overflow-y-auto px-2">
<div className="flex flex-1 flex-col gap-y-4">
<div>
<Label htmlFor="full-name">
<Trans>Full Name</Trans>
</Label>
<Label htmlFor="full-name">Full Name</Label>
<Input
type="text"
@@ -188,9 +185,7 @@ export const SigningForm = ({
</div>
<div>
<Label htmlFor="Signature">
<Trans>Signature</Trans>
</Label>
<Label htmlFor="Signature">Signature</Label>
<Card className="mt-2" gradient degrees={-120}>
<CardContent className="p-0">
@@ -201,7 +196,6 @@ export const SigningForm = ({
onChange={(value) => {
setSignature(value);
}}
allowTypedSignature={document.documentMeta?.typedSignatureEnabled}
/>
</CardContent>
</Card>
@@ -217,7 +211,7 @@ export const SigningForm = ({
disabled={typeof window !== 'undefined' && window.history.length <= 1}
onClick={() => router.back()}
>
<Trans>Cancel</Trans>
Cancel
</Button>
<SignDialog

View File

@@ -4,8 +4,6 @@ import { useTransition } from 'react';
import { useRouter } from 'next/navigation';
import { Trans, msg } from '@lingui/macro';
import { useLingui } from '@lingui/react';
import { Loader } from 'lucide-react';
import { DO_NOT_INVALIDATE_QUERY_ON_MUTATION } from '@documenso/lib/constants/trpc';
@@ -39,7 +37,6 @@ export const InitialsField = ({
}: InitialsFieldProps) => {
const router = useRouter();
const { toast } = useToast();
const { _ } = useLingui();
const { fullName } = useRequiredSigningContext();
const initials = extractInitials(fullName);
@@ -86,8 +83,8 @@ export const InitialsField = ({
console.error(err);
toast({
title: _(msg`Error`),
description: _(msg`An error occurred while signing the document.`),
title: 'Error',
description: 'An error occurred while signing the document.',
variant: 'destructive',
});
}
@@ -112,8 +109,8 @@ export const InitialsField = ({
console.error(err);
toast({
title: _(msg`Error`),
description: _(msg`An error occurred while removing the field.`),
title: 'Error',
description: 'An error occurred while removing the signature.',
variant: 'destructive',
});
}
@@ -129,7 +126,7 @@ export const InitialsField = ({
{!field.inserted && (
<p className="group-hover:text-primary text-muted-foreground duration-200 group-hover:text-yellow-300">
<Trans>Initials</Trans>
Initials
</p>
)}

View File

@@ -13,7 +13,7 @@ export type SigningLayoutProps = {
};
export default async function SigningLayout({ children }: SigningLayoutProps) {
await setupI18nSSR();
setupI18nSSR();
const { user, session } = await getServerComponentSession();

View File

@@ -31,7 +31,7 @@ export type SigningPageProps = {
};
export default async function SigningPage({ params: { token } }: SigningPageProps) {
await setupI18nSSR();
setupI18nSSR();
if (!token) {
return notFound();
@@ -43,6 +43,12 @@ export default async function SigningPage({ params: { token } }: SigningPageProp
const requestMetadata = extractNextHeaderRequestMetadata(requestHeaders);
const isRecipientsTurn = await getIsRecipientsTurnToSign({ token });
if (!isRecipientsTurn) {
return redirect(`/sign/${token}/waiting`);
}
const [document, fields, recipient, completedFields] = await Promise.all([
getDocumentAndSenderByToken({
token,
@@ -63,12 +69,6 @@ export default async function SigningPage({ params: { token } }: SigningPageProp
return notFound();
}
const isRecipientsTurn = await getIsRecipientsTurnToSign({ token });
if (!isRecipientsTurn) {
return redirect(`/sign/${token}/waiting`);
}
const { derivedRecipientAccessAuth } = extractDocumentAuthMethods({
documentAuth: document.authOptions,
recipientAuth: recipient.authOptions,

View File

@@ -31,12 +31,12 @@ import { useRequiredSigningContext } from './provider';
import { SigningFieldContainer } from './signing-field-container';
type SignatureFieldState = 'empty' | 'signed-image' | 'signed-text';
export type SignatureFieldProps = {
field: FieldWithSignature;
recipient: Recipient;
onSignField?: (value: TSignFieldWithTokenMutationSchema) => Promise<void> | void;
onUnsignField?: (value: TRemovedSignedFieldWithTokenMutationSchema) => Promise<void> | void;
typedSignatureEnabled?: boolean;
};
export const SignatureField = ({
@@ -44,7 +44,6 @@ export const SignatureField = ({
recipient,
onSignField,
onUnsignField,
typedSignatureEnabled,
}: SignatureFieldProps) => {
const router = useRouter();
@@ -93,12 +92,14 @@ export const SignatureField = ({
return true;
};
/**
* When the user clicks the sign button in the dialog where they enter their signature.
*/
const onDialogSignClick = () => {
setShowSignatureModal(false);
setProvidedSignature(localSignature);
if (!localSignature) {
return;
}
@@ -108,6 +109,7 @@ export const SignatureField = ({
actionTarget: field.type,
});
};
const onSign = async (authOptions?: TRecipientActionAuth, signature?: string) => {
try {
const value = signature || providedSignature;
@@ -229,11 +231,11 @@ export const SignatureField = ({
id="signature"
className="border-border mt-2 h-44 w-full rounded-md border"
onChange={(value) => setLocalSignature(value)}
allowTypedSignature={typedSignatureEnabled}
/>
</div>
<SigningDisclosure />
<DialogFooter>
<div className="flex w-full flex-1 flex-nowrap gap-4">
<Button
@@ -247,6 +249,7 @@ export const SignatureField = ({
>
<Trans>Cancel</Trans>
</Button>
<Button
type="button"
className="flex-1"

View File

@@ -128,7 +128,7 @@ export const SigningFieldContainer = ({
};
return (
<div className={cn('[container-type:size]', { group: type === 'Checkbox' })}>
<div className={cn('[container-type:size]', type === 'Checkbox' ? 'group' : '')}>
<FieldRootContainer field={field}>
{!field.inserted && !loading && !readOnlyField && (
<button

View File

@@ -112,12 +112,7 @@ export const SigningPageView = ({
{fields.map((field) =>
match(field.type)
.with(FieldType.SIGNATURE, () => (
<SignatureField
key={field.id}
field={field}
recipient={recipient}
typedSignatureEnabled={documentMeta?.typedSignatureEnabled}
/>
<SignatureField key={field.id} field={field} recipient={recipient} />
))
.with(FieldType.INITIALS, () => (
<InitialsField key={field.id} field={field} recipient={recipient} />

View File

@@ -21,7 +21,7 @@ type WaitingForTurnToSignPageProps = {
export default async function WaitingForTurnToSignPage({
params: { token },
}: WaitingForTurnToSignPageProps) {
await setupI18nSSR();
setupI18nSSR();
if (!token) {
return notFound();

View File

@@ -12,7 +12,7 @@ export type DocumentPageProps = {
};
export default async function TeamsDocumentEditPage({ params }: DocumentPageProps) {
await setupI18nSSR();
setupI18nSSR();
const { teamUrl } = params;

View File

@@ -12,7 +12,7 @@ export type TeamDocumentsLogsPageProps = {
};
export default async function TeamsDocumentsLogsPage({ params }: TeamDocumentsLogsPageProps) {
await setupI18nSSR();
setupI18nSSR();
const { teamUrl } = params;

View File

@@ -12,7 +12,7 @@ export type DocumentPageProps = {
};
export default async function DocumentPage({ params }: DocumentPageProps) {
await setupI18nSSR();
setupI18nSSR();
const { teamUrl } = params;

View File

@@ -16,7 +16,7 @@ export default async function TeamsDocumentPage({
params,
searchParams = {},
}: TeamsDocumentPageProps) {
await setupI18nSSR();
setupI18nSSR();
const { teamUrl } = params;

View File

@@ -27,7 +27,7 @@ export default async function AuthenticatedTeamsLayout({
children,
params,
}: AuthenticatedTeamsLayoutProps) {
await setupI18nSSR();
setupI18nSSR();
const { session, user } = await getServerComponentSession();

View File

@@ -21,7 +21,7 @@ export type TeamsSettingsBillingPageProps = {
};
export default async function TeamsSettingBillingPage({ params }: TeamsSettingsBillingPageProps) {
await setupI18nSSR();
setupI18nSSR();
const { _ } = useLingui();

View File

@@ -24,7 +24,7 @@ export default async function TeamsSettingsLayout({
children,
params: { teamUrl },
}: TeamSettingsLayoutProps) {
await setupI18nSSR();
setupI18nSSR();
const session = await getRequiredServerComponentSession();

View File

@@ -16,7 +16,7 @@ export type TeamsSettingsMembersPageProps = {
};
export default async function TeamsSettingsMembersPage({ params }: TeamsSettingsMembersPageProps) {
await setupI18nSSR();
setupI18nSSR();
const { _ } = useLingui();
const { teamUrl } = params;

View File

@@ -28,7 +28,7 @@ export type TeamsSettingsPageProps = {
};
export default async function TeamsSettingsPage({ params }: TeamsSettingsPageProps) {
await setupI18nSSR();
setupI18nSSR();
const { teamUrl } = params;

View File

@@ -14,7 +14,7 @@ export type TeamsSettingsPublicProfilePageProps = {
export default async function TeamsSettingsPublicProfilePage({
params,
}: TeamsSettingsPublicProfilePageProps) {
await setupI18nSSR();
setupI18nSSR();
const { teamUrl } = params;

View File

@@ -21,7 +21,7 @@ type ApiTokensPageProps = {
};
export default async function ApiTokensPage({ params }: ApiTokensPageProps) {
const { i18n } = await setupI18nSSR();
const { i18n } = setupI18nSSR();
const { teamUrl } = params;
@@ -97,11 +97,17 @@ export default async function ApiTokensPage({ params }: ApiTokensPageProps) {
<h5 className="text-base">{token.name}</h5>
<p className="text-muted-foreground mt-2 text-xs">
<Trans>Created on {i18n.date(token.createdAt, DateTime.DATETIME_FULL)}</Trans>
<Trans>
Created on
{i18n.date(token.createdAt, DateTime.DATETIME_FULL)}
</Trans>
</p>
{token.expires ? (
<p className="text-muted-foreground mt-1 text-xs">
<Trans>Expires on {i18n.date(token.expires, DateTime.DATETIME_FULL)}</Trans>
<Trans>
Expires on
{i18n.date(token.expires, DateTime.DATETIME_FULL)}
</Trans>
</p>
) : (
<p className="text-muted-foreground mt-1 text-xs">

View File

@@ -14,7 +14,7 @@ type TeamTemplatePageProps = {
};
export default async function TeamTemplatePage({ params }: TeamTemplatePageProps) {
await setupI18nSSR();
setupI18nSSR();
const { teamUrl } = params;

View File

@@ -18,7 +18,7 @@ export default async function TeamTemplatesPage({
searchParams = {},
params,
}: TeamTemplatesPageProps) {
await setupI18nSSR();
setupI18nSSR();
const { teamUrl } = params;

View File

@@ -5,156 +5,101 @@ import { Trans } from '@lingui/macro';
import { setupI18nSSR } from '@documenso/lib/client-only/providers/i18n.server';
import { Button } from '@documenso/ui/primitives/button';
const SUPPORT_EMAIL = 'support@documenso.com';
export default async function SignatureDisclosure() {
await setupI18nSSR();
export default function SignatureDisclosure() {
setupI18nSSR();
return (
<div>
<article className="prose dark:prose-invert">
<h1>
<Trans>Electronic Signature Disclosure</Trans>
</h1>
<h1>Electronic Signature Disclosure</h1>
<h2>
<Trans>Welcome</Trans>
</h2>
<h2>Welcome</h2>
<p>
<Trans>
Thank you for using Documenso to perform your electronic document signing. The purpose
of this disclosure is to inform you about the process, legality, and your rights
regarding the use of electronic signatures on our platform. By opting to use an
electronic signature, you are agreeing to the terms and conditions outlined below.
</Trans>
Thank you for using Documenso to perform your electronic document signing. The purpose of
this disclosure is to inform you about the process, legality, and your rights regarding
the use of electronic signatures on our platform. By opting to use an electronic
signature, you are agreeing to the terms and conditions outlined below.
</p>
<h2>
<Trans>Acceptance and Consent</Trans>
</h2>
<h2>Acceptance and Consent</h2>
<p>
<Trans>
When you use our platform to affix your electronic signature to documents, you are
consenting to do so under the Electronic Signatures in Global and National Commerce Act
(E-Sign Act) and other applicable laws. This action indicates your agreement to use
electronic means to sign documents and receive notifications.
</Trans>
When you use our platform to affix your electronic signature to documents, you are
consenting to do so under the Electronic Signatures in Global and National Commerce Act
(E-Sign Act) and other applicable laws. This action indicates your agreement to use
electronic means to sign documents and receive notifications.
</p>
<h2>
<Trans>Legality of Electronic Signatures</Trans>
</h2>
<h2>Legality of Electronic Signatures</h2>
<p>
<Trans>
An electronic signature provided by you on our platform, achieved through clicking
through to a document and entering your name, or any other electronic signing method we
provide, is legally binding. It carries the same weight and enforceability as a manual
signature written with ink on paper.
</Trans>
An electronic signature provided by you on our platform, achieved through clicking through
to a document and entering your name, or any other electronic signing method we provide,
is legally binding. It carries the same weight and enforceability as a manual signature
written with ink on paper.
</p>
<h2>
<Trans>System Requirements</Trans>
</h2>
<p>
<Trans>To use our electronic signature service, you must have access to:</Trans>
</p>
<h2>System Requirements</h2>
<p>To use our electronic signature service, you must have access to:</p>
<ul>
<li>
<Trans>A stable internet connection</Trans>
</li>
<li>
<Trans>An email account</Trans>
</li>
<li>
<Trans>A device capable of accessing, opening, and reading documents</Trans>
</li>
<li>
<Trans>A means to print or download documents for your records</Trans>
</li>
<li>A stable internet connection</li>
<li>An email account</li>
<li>A device capable of accessing, opening, and reading documents</li>
<li>A means to print or download documents for your records</li>
</ul>
<h2>
<Trans>Electronic Delivery of Documents</Trans>
</h2>
<h2>Electronic Delivery of Documents</h2>
<p>
<Trans>
All documents related to the electronic signing process will be provided to you
electronically through our platform or via email. It is your responsibility to ensure
that your email address is current and that you can receive and open our emails.
</Trans>
All documents related to the electronic signing process will be provided to you
electronically through our platform or via email. It is your responsibility to ensure that
your email address is current and that you can receive and open our emails.
</p>
<h2>
<Trans>Consent to Electronic Transactions</Trans>
</h2>
<h2>Consent to Electronic Transactions</h2>
<p>
<Trans>
By using the electronic signature feature, you are consenting to conduct transactions
and receive disclosures electronically. You acknowledge that your electronic signature
on documents is binding and that you accept the terms outlined in the documents you are
signing.
</Trans>
By using the electronic signature feature, you are consenting to conduct transactions and
receive disclosures electronically. You acknowledge that your electronic signature on
documents is binding and that you accept the terms outlined in the documents you are
signing.
</p>
<h2>
<Trans>Withdrawing Consent</Trans>
</h2>
<h2>Withdrawing Consent</h2>
<p>
<Trans>
You have the right to withdraw your consent to use electronic signatures at any time
before completing the signing process. To withdraw your consent, please contact the
sender of the document. In failing to contact the sender you may reach out to{' '}
<a href={`mailto:${SUPPORT_EMAIL}`}>{SUPPORT_EMAIL}</a> for assistance. Be aware that
withdrawing consent may delay or halt the completion of the related transaction or
service.
</Trans>
You have the right to withdraw your consent to use electronic signatures at any time
before completing the signing process. To withdraw your consent, please contact the sender
of the document. In failing to contact the sender you may reach out to{' '}
<a href="mailto:support@documenso.com">support@documenso.com</a> for assistance. Be aware
that withdrawing consent may delay or halt the completion of the related transaction or
service.
</p>
<h2>
<Trans>Updating Your Information</Trans>
</h2>
<h2>Updating Your Information</h2>
<p>
<Trans>
It is crucial to keep your contact information, especially your email address, up to
date with us. Please notify us immediately of any changes to ensure that you continue to
receive all necessary communications.
</Trans>
It is crucial to keep your contact information, especially your email address, up to date
with us. Please notify us immediately of any changes to ensure that you continue to
receive all necessary communications.
</p>
<h2>
<Trans>Retention of Documents</Trans>
</h2>
<h2>Retention of Documents</h2>
<p>
<Trans>
After signing a document electronically, you will be provided the opportunity to view,
download, and print the document for your records. It is highly recommended that you
retain a copy of all electronically signed documents for your personal records. We will
also retain a copy of the signed document for our records however we may not be able to
provide you with a copy of the signed document after a certain period of time.
</Trans>
After signing a document electronically, you will be provided the opportunity to view,
download, and print the document for your records. It is highly recommended that you
retain a copy of all electronically signed documents for your personal records. We will
also retain a copy of the signed document for our records however we may not be able to
provide you with a copy of the signed document after a certain period of time.
</p>
<h2>
<Trans>Acknowledgment</Trans>
</h2>
<h2>Acknowledgment</h2>
<p>
<Trans>
By proceeding to use the electronic signature service provided by Documenso, you affirm
that you have read and understood this disclosure. You agree to all terms and conditions
related to the use of electronic signatures and electronic transactions as outlined
herein.
</Trans>
By proceeding to use the electronic signature service provided by Documenso, you affirm
that you have read and understood this disclosure. You agree to all terms and conditions
related to the use of electronic signatures and electronic transactions as outlined
herein.
</p>
<h2>
<Trans>Contact Information</Trans>
</h2>
<h2>Contact Information</h2>
<p>
<Trans>
For any questions regarding this disclosure, electronic signatures, or any related
process, please contact us at: <a href={`mailto:${SUPPORT_EMAIL}`}>{SUPPORT_EMAIL}</a>
</Trans>
For any questions regarding this disclosure, electronic signatures, or any related
process, please contact us at:{' '}
<a href="mailto:support@documenso.com">support@documenso.com</a>
</p>
</article>

View File

@@ -10,8 +10,8 @@ export const metadata: Metadata = {
title: 'Forgot password',
};
export default async function ForgotPasswordPage() {
await setupI18nSSR();
export default function ForgotPasswordPage() {
setupI18nSSR();
return (
<div className="w-screen max-w-lg px-4">

View File

@@ -11,8 +11,8 @@ export const metadata: Metadata = {
title: 'Forgot Password',
};
export default async function ForgotPasswordPage() {
await setupI18nSSR();
export default function ForgotPasswordPage() {
setupI18nSSR();
return (
<div className="w-screen max-w-lg px-4">

View File

@@ -9,8 +9,8 @@ type UnauthenticatedLayoutProps = {
children: React.ReactNode;
};
export default async function UnauthenticatedLayout({ children }: UnauthenticatedLayoutProps) {
await setupI18nSSR();
export default function UnauthenticatedLayout({ children }: UnauthenticatedLayoutProps) {
setupI18nSSR();
return (
<main className="relative flex min-h-screen flex-col items-center justify-center overflow-hidden px-4 py-12 md:p-12 lg:p-24">

View File

@@ -15,7 +15,7 @@ type ResetPasswordPageProps = {
};
export default async function ResetPasswordPage({ params: { token } }: ResetPasswordPageProps) {
await setupI18nSSR();
setupI18nSSR();
const isValid = await getResetTokenValidity({ token });

View File

@@ -10,8 +10,8 @@ export const metadata: Metadata = {
title: 'Reset Password',
};
export default async function ResetPasswordPage() {
await setupI18nSSR();
export default function ResetPasswordPage() {
setupI18nSSR();
return (
<div className="w-screen max-w-lg px-4">

View File

@@ -17,8 +17,8 @@ export const metadata: Metadata = {
title: 'Sign In',
};
export default async function SignInPage() {
await setupI18nSSR();
export default function SignInPage() {
setupI18nSSR();
const NEXT_PUBLIC_DISABLE_SIGNUP = env('NEXT_PUBLIC_DISABLE_SIGNUP');

View File

@@ -12,8 +12,8 @@ export const metadata: Metadata = {
title: 'Sign Up',
};
export default async function SignUpPage() {
await setupI18nSSR();
export default function SignUpPage() {
setupI18nSSR();
const NEXT_PUBLIC_DISABLE_SIGNUP = env('NEXT_PUBLIC_DISABLE_SIGNUP');

View File

@@ -21,7 +21,7 @@ type DeclineInvitationPageProps = {
export default async function DeclineInvitationPage({
params: { token },
}: DeclineInvitationPageProps) {
await setupI18nSSR();
setupI18nSSR();
const session = await getServerComponentSession();

View File

@@ -21,7 +21,7 @@ type AcceptInvitationPageProps = {
export default async function AcceptInvitationPage({
params: { token },
}: AcceptInvitationPageProps) {
await setupI18nSSR();
setupI18nSSR();
const session = await getServerComponentSession();

View File

@@ -14,7 +14,7 @@ type VerifyTeamEmailPageProps = {
};
export default async function VerifyTeamEmailPage({ params: { token } }: VerifyTeamEmailPageProps) {
await setupI18nSSR();
setupI18nSSR();
const teamEmailVerification = await prisma.teamEmailVerification.findUnique({
where: {

View File

@@ -17,7 +17,7 @@ type VerifyTeamTransferPage = {
export default async function VerifyTeamTransferPage({
params: { token },
}: VerifyTeamTransferPage) {
await setupI18nSSR();
setupI18nSSR();
const teamTransferVerification = await prisma.teamTransferVerification.findUnique({
where: {

View File

@@ -5,8 +5,8 @@ import { setupI18nSSR } from '@documenso/lib/client-only/providers/i18n.server';
import { SendConfirmationEmailForm } from '~/components/forms/send-confirmation-email';
export default async function UnverifiedAccount() {
await setupI18nSSR();
export default function UnverifiedAccount() {
setupI18nSSR();
return (
<div className="w-screen max-w-lg px-4">

View File

@@ -23,7 +23,7 @@ export type PageProps = {
};
export default async function VerifyEmailPage({ params: { token } }: PageProps) {
await setupI18nSSR();
setupI18nSSR();
if (!token) {
return (

View File

@@ -11,8 +11,8 @@ export const metadata: Metadata = {
title: 'Verify Email',
};
export default async function EmailVerificationWithoutTokenPage() {
await setupI18nSSR();
export default function EmailVerificationWithoutTokenPage() {
setupI18nSSR();
return (
<div className="w-screen max-w-lg px-4">

View File

@@ -318,7 +318,6 @@ export const EmbedDirectTemplateClientPage = ({
{/* Widget */}
<div
key={isExpanded ? 'expanded' : 'collapsed'}
className="group/document-widget fixed bottom-8 left-0 z-50 h-fit w-full flex-shrink-0 px-6 md:sticky md:top-4 md:z-auto md:w-[350px] md:px-0"
data-expanded={isExpanded || undefined}
>
@@ -368,7 +367,7 @@ export const EmbedDirectTemplateClientPage = ({
className="bg-background mt-2"
disabled={isNameLocked}
value={fullName}
onChange={(e) => !isNameLocked && setFullName(e.target.value)}
onChange={(e) => !isNameLocked && setFullName(e.target.value.trim())}
/>
</div>
@@ -395,17 +394,13 @@ export const EmbedDirectTemplateClientPage = ({
<Card className="mt-2" gradient degrees={-120}>
<CardContent className="p-0">
<SignaturePad
key={signature}
className="h-44 w-full"
disabled={isThrottled || isSubmitting}
defaultValue={signature ?? undefined}
onChange={(value) => {
setSignature(value);
}}
allowTypedSignature={Boolean(
metadata &&
'typedSignatureEnabled' in metadata &&
metadata.typedSignatureEnabled,
)}
/>
</CardContent>
</Card>

View File

@@ -198,7 +198,6 @@ export const EmbedSignDocumentClientPage = ({
{/* Widget */}
<div
key={isExpanded ? 'expanded' : 'collapsed'}
className="group/document-widget fixed bottom-8 left-0 z-50 h-fit w-full flex-shrink-0 px-6 md:sticky md:top-4 md:z-auto md:w-[350px] md:px-0"
data-expanded={isExpanded || undefined}
>
@@ -248,7 +247,7 @@ export const EmbedSignDocumentClientPage = ({
className="bg-background mt-2"
disabled={isNameLocked}
value={fullName}
onChange={(e) => !isNameLocked && setFullName(e.target.value)}
onChange={(e) => !isNameLocked && setFullName(e.target.value.trim())}
/>
</div>
@@ -274,17 +273,13 @@ export const EmbedSignDocumentClientPage = ({
<Card className="mt-2" gradient degrees={-120}>
<CardContent className="p-0">
<SignaturePad
key={signature}
className="h-44 w-full"
disabled={isThrottled || isSubmitting}
defaultValue={signature ?? undefined}
onChange={(value) => {
setSignature(value);
}}
allowTypedSignature={Boolean(
metadata &&
'typedSignatureEnabled' in metadata &&
metadata.typedSignatureEnabled,
)}
/>
</CardContent>
</Card>

View File

@@ -56,7 +56,7 @@ export function generateMetadata() {
export default async function RootLayout({ children }: { children: React.ReactNode }) {
const flags = await getServerComponentAllFlags();
const { i18n, lang, locales } = await setupI18nSSR();
const { i18n, lang, locales } = setupI18nSSR();
return (
<html

View File

@@ -9,7 +9,7 @@ import { Button } from '@documenso/ui/primitives/button';
import NotFoundPartial from '~/components/partials/not-found';
export default async function NotFound() {
await setupI18nSSR();
setupI18nSSR();
const { session } = await getServerComponentSession();

Some files were not shown because too many files have changed in this diff Show More