From ddb94058d3ad9b050dd8636c608f892edd39ee66 Mon Sep 17 00:00:00 2001 From: Lucas Smith Date: Wed, 11 Nov 2026 15:30:48 +1100 Subject: [PATCH] fix: add pdf download prop --- packages/angular/src/direct-template.ts | 12 +++++++ packages/angular/src/sign-document.ts | 12 +++++++ packages/mitosis/src/direct-template.lite.tsx | 17 +++++++++- packages/mitosis/src/sign-document.lite.tsx | 17 +++++++++- packages/preact/src/direct-template.tsx | 10 ++++++ packages/preact/src/sign-document.tsx | 10 ++++++ packages/react/src/direct-template.tsx | 10 ++++++ packages/react/src/sign-document.tsx | 10 ++++++ packages/solid/src/direct-template.tsx | 9 ++++++ packages/solid/src/sign-document.tsx | 9 ++++++ packages/svelte/src/direct-template.svelte | 11 +++++++ packages/svelte/src/sign-document.svelte | 11 +++++++ packages/vue/src/direct-template.vue | 31 ++++++++++++++++++- packages/vue/src/sign-document.vue | 31 ++++++++++++++++++- 14 files changed, 196 insertions(+), 4 deletions(-) diff --git a/packages/angular/src/direct-template.ts b/packages/angular/src/direct-template.ts index b2fb67c..3df6f92 100644 --- a/packages/angular/src/direct-template.ts +++ b/packages/angular/src/direct-template.ts @@ -19,6 +19,14 @@ export type EmbedDirectTemplateProps = { name?: string | undefined; lockName?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -32,6 +40,7 @@ export type EmbedDirectTemplateProps = { onFieldSigned?: () => void; onFieldUnsigned?: () => void; }; +const defaultProps: any = { allowDownloadPDF: true }; import { CssVars } from "./css-vars"; @@ -65,6 +74,8 @@ export default class EmbedDirectTemplate { @Input() cssVars!: EmbedDirectTemplateProps["cssVars"]; @Input() darkModeDisabled!: EmbedDirectTemplateProps["darkModeDisabled"]; @Input() language!: EmbedDirectTemplateProps["language"]; + @Input() allowDownloadPDF: EmbedDirectTemplateProps["allowDownloadPDF"] = + defaultProps["allowDownloadPDF"]; @Input() additionalProps!: EmbedDirectTemplateProps["additionalProps"]; @Input() token!: EmbedDirectTemplateProps["token"]; @Input() externalId!: EmbedDirectTemplateProps["externalId"]; @@ -91,6 +102,7 @@ export default class EmbedDirectTemplate { cssVars: this.cssVars, darkModeDisabled: this.darkModeDisabled, language: this.language, + allowDownloadPDF: this.allowDownloadPDF, ...this.additionalProps, }) ) diff --git a/packages/angular/src/sign-document.ts b/packages/angular/src/sign-document.ts index c74c290..1026743 100644 --- a/packages/angular/src/sign-document.ts +++ b/packages/angular/src/sign-document.ts @@ -28,6 +28,14 @@ export type EmbedSignDocumentProps = { lockEmail?: boolean | undefined; allowDocumentRejection?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -45,6 +53,7 @@ export type EmbedSignDocumentProps = { reason: string; }) => void; }; +const defaultProps: any = { allowDownloadPDF: true }; import { CssVars } from "./css-vars"; @@ -80,6 +89,8 @@ export default class EmbedSignDocument { @Input() language!: EmbedSignDocumentProps["language"]; @Input() allowDocumentRejection!: EmbedSignDocumentProps["allowDocumentRejection"]; + @Input() allowDownloadPDF: EmbedSignDocumentProps["allowDownloadPDF"] = + defaultProps["allowDownloadPDF"]; @Input() additionalProps!: EmbedSignDocumentProps["additionalProps"]; @Input() token!: EmbedSignDocumentProps["token"]; @Input() clientUserId!: EmbedSignDocumentProps["clientUserId"]; @@ -105,6 +116,7 @@ export default class EmbedSignDocument { darkModeDisabled: this.darkModeDisabled, language: this.language, allowDocumentRejection: this.allowDocumentRejection, + allowDownloadPDF: this.allowDownloadPDF, ...this.additionalProps, }) ) diff --git a/packages/mitosis/src/direct-template.lite.tsx b/packages/mitosis/src/direct-template.lite.tsx index e6be1d9..68f9d08 100644 --- a/packages/mitosis/src/direct-template.lite.tsx +++ b/packages/mitosis/src/direct-template.lite.tsx @@ -1,4 +1,4 @@ -import { onMount, onUnMount, useRef, useStore } from '@builder.io/mitosis'; +import { onMount, onUnMount, useDefaultProps, useRef, useStore } from '@builder.io/mitosis'; import { CssVars } from './css-vars'; @@ -20,6 +20,14 @@ export type EmbedDirectTemplateProps = { name?: string | undefined; lockName?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -31,6 +39,12 @@ export type EmbedDirectTemplateProps = { onFieldUnsigned?: () => void; }; +useDefaultProps({ + // Vue casts absent boolean props to `false`, which would hide the download + // button for anyone not passing the prop, so the default has to be explicit. + allowDownloadPDF: true, +}); + export default function EmbedDirectTemplate(props: EmbedDirectTemplateProps) { const __iframe = useRef(null); @@ -50,6 +64,7 @@ export default function EmbedDirectTemplate(props: EmbedDirectTemplateProps) { cssVars: props.cssVars, darkModeDisabled: props.darkModeDisabled, language: props.language, + allowDownloadPDF: props.allowDownloadPDF, ...props.additionalProps, }), ), diff --git a/packages/mitosis/src/sign-document.lite.tsx b/packages/mitosis/src/sign-document.lite.tsx index e285b46..dd6ef7f 100644 --- a/packages/mitosis/src/sign-document.lite.tsx +++ b/packages/mitosis/src/sign-document.lite.tsx @@ -1,4 +1,4 @@ -import { onMount, onUnMount, useRef, useStore } from '@builder.io/mitosis'; +import { onMount, onUnMount, useDefaultProps, useRef, useStore } from '@builder.io/mitosis'; import { CssVars } from './css-vars'; @@ -29,6 +29,14 @@ export type EmbedSignDocumentProps = { lockEmail?: boolean | undefined; allowDocumentRejection?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -44,6 +52,12 @@ export type EmbedSignDocumentProps = { }) => void; }; +useDefaultProps({ + // Vue casts absent boolean props to `false`, which would hide the download + // button for anyone not passing the prop, so the default has to be explicit. + allowDownloadPDF: true, +}); + export default function EmbedSignDocument(props: EmbedSignDocumentProps) { const __iframe = useRef(null); @@ -64,6 +78,7 @@ export default function EmbedSignDocument(props: EmbedSignDocumentProps) { darkModeDisabled: props.darkModeDisabled, language: props.language, allowDocumentRejection: props.allowDocumentRejection, + allowDownloadPDF: props.allowDownloadPDF, ...props.additionalProps, }), ), diff --git a/packages/preact/src/direct-template.tsx b/packages/preact/src/direct-template.tsx index 88c1125..08f01c2 100644 --- a/packages/preact/src/direct-template.tsx +++ b/packages/preact/src/direct-template.tsx @@ -18,6 +18,14 @@ export type EmbedDirectTemplateProps = { name?: string | undefined; lockName?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -34,6 +42,7 @@ export type EmbedDirectTemplateProps = { import { CssVars } from "./css-vars"; function EmbedDirectTemplate(props: EmbedDirectTemplateProps) { + props = { allowDownloadPDF: true, ...props }; const __iframe = useRef(null); function src() { const appHost = props.host || "https://app.documenso.com"; @@ -48,6 +57,7 @@ function EmbedDirectTemplate(props: EmbedDirectTemplateProps) { cssVars: props.cssVars, darkModeDisabled: props.darkModeDisabled, language: props.language, + allowDownloadPDF: props.allowDownloadPDF, ...props.additionalProps, }) ) diff --git a/packages/preact/src/sign-document.tsx b/packages/preact/src/sign-document.tsx index 4cddf34..b501a75 100644 --- a/packages/preact/src/sign-document.tsx +++ b/packages/preact/src/sign-document.tsx @@ -27,6 +27,14 @@ export type EmbedSignDocumentProps = { lockEmail?: boolean | undefined; allowDocumentRejection?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -47,6 +55,7 @@ export type EmbedSignDocumentProps = { import { CssVars } from "./css-vars"; function EmbedSignDocument(props: EmbedSignDocumentProps) { + props = { allowDownloadPDF: true, ...props }; const __iframe = useRef(null); function src() { const appHost = props.host || "https://app.documenso.com"; @@ -62,6 +71,7 @@ function EmbedSignDocument(props: EmbedSignDocumentProps) { darkModeDisabled: props.darkModeDisabled, language: props.language, allowDocumentRejection: props.allowDocumentRejection, + allowDownloadPDF: props.allowDownloadPDF, ...props.additionalProps, }) ) diff --git a/packages/react/src/direct-template.tsx b/packages/react/src/direct-template.tsx index 91fc11c..a5383ff 100644 --- a/packages/react/src/direct-template.tsx +++ b/packages/react/src/direct-template.tsx @@ -18,6 +18,14 @@ export type EmbedDirectTemplateProps = { name?: string | undefined; lockName?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -34,6 +42,7 @@ export type EmbedDirectTemplateProps = { import { CssVars } from "./css-vars"; function EmbedDirectTemplate(props: EmbedDirectTemplateProps) { + props = { allowDownloadPDF: true, ...props }; const __iframe = useRef(null); function src() { const appHost = props.host || "https://app.documenso.com"; @@ -48,6 +57,7 @@ function EmbedDirectTemplate(props: EmbedDirectTemplateProps) { cssVars: props.cssVars, darkModeDisabled: props.darkModeDisabled, language: props.language, + allowDownloadPDF: props.allowDownloadPDF, ...props.additionalProps, }) ) diff --git a/packages/react/src/sign-document.tsx b/packages/react/src/sign-document.tsx index 7327ff0..a3a7c20 100644 --- a/packages/react/src/sign-document.tsx +++ b/packages/react/src/sign-document.tsx @@ -27,6 +27,14 @@ export type EmbedSignDocumentProps = { lockEmail?: boolean | undefined; allowDocumentRejection?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -47,6 +55,7 @@ export type EmbedSignDocumentProps = { import { CssVars } from "./css-vars"; function EmbedSignDocument(props: EmbedSignDocumentProps) { + props = { allowDownloadPDF: true, ...props }; const __iframe = useRef(null); function src() { const appHost = props.host || "https://app.documenso.com"; @@ -62,6 +71,7 @@ function EmbedSignDocument(props: EmbedSignDocumentProps) { darkModeDisabled: props.darkModeDisabled, language: props.language, allowDocumentRejection: props.allowDocumentRejection, + allowDownloadPDF: props.allowDownloadPDF, ...props.additionalProps, }) ) diff --git a/packages/solid/src/direct-template.tsx b/packages/solid/src/direct-template.tsx index 29a22ba..7fdc674 100644 --- a/packages/solid/src/direct-template.tsx +++ b/packages/solid/src/direct-template.tsx @@ -16,6 +16,14 @@ export type EmbedDirectTemplateProps = { name?: string | undefined; lockName?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -46,6 +54,7 @@ function EmbedDirectTemplate(props: EmbedDirectTemplateProps) { cssVars: props.cssVars, darkModeDisabled: props.darkModeDisabled, language: props.language, + allowDownloadPDF: props.allowDownloadPDF, ...props.additionalProps, }) ) diff --git a/packages/solid/src/sign-document.tsx b/packages/solid/src/sign-document.tsx index 7731831..f94b9d4 100644 --- a/packages/solid/src/sign-document.tsx +++ b/packages/solid/src/sign-document.tsx @@ -25,6 +25,14 @@ export type EmbedSignDocumentProps = { lockEmail?: boolean | undefined; allowDocumentRejection?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -60,6 +68,7 @@ function EmbedSignDocument(props: EmbedSignDocumentProps) { darkModeDisabled: props.darkModeDisabled, language: props.language, allowDocumentRejection: props.allowDocumentRejection, + allowDownloadPDF: props.allowDownloadPDF, ...props.additionalProps, }) ) diff --git a/packages/svelte/src/direct-template.svelte b/packages/svelte/src/direct-template.svelte index ef106fb..89f23e3 100644 --- a/packages/svelte/src/direct-template.svelte +++ b/packages/svelte/src/direct-template.svelte @@ -15,6 +15,14 @@ name?: string | undefined; lockName?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -45,6 +53,8 @@ export let darkModeDisabled: EmbedDirectTemplateProps["darkModeDisabled"] = undefined; export let language: EmbedDirectTemplateProps["language"] = undefined; + export let allowDownloadPDF: EmbedDirectTemplateProps["allowDownloadPDF"] = + true; export let additionalProps: EmbedDirectTemplateProps["additionalProps"] = undefined; export let token: EmbedDirectTemplateProps["token"]; @@ -95,6 +105,7 @@ cssVars: cssVars, darkModeDisabled: darkModeDisabled, language: language, + allowDownloadPDF: allowDownloadPDF, ...additionalProps, }) ) diff --git a/packages/svelte/src/sign-document.svelte b/packages/svelte/src/sign-document.svelte index 965b6f1..eb1c330 100644 --- a/packages/svelte/src/sign-document.svelte +++ b/packages/svelte/src/sign-document.svelte @@ -24,6 +24,14 @@ lockEmail?: boolean | undefined; allowDocumentRejection?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -60,6 +68,8 @@ export let language: EmbedSignDocumentProps["language"] = undefined; export let allowDocumentRejection: EmbedSignDocumentProps["allowDocumentRejection"] = undefined; + export let allowDownloadPDF: EmbedSignDocumentProps["allowDownloadPDF"] = + true; export let additionalProps: EmbedSignDocumentProps["additionalProps"] = undefined; export let token: EmbedSignDocumentProps["token"]; @@ -106,6 +116,7 @@ darkModeDisabled: darkModeDisabled, language: language, allowDocumentRejection: allowDocumentRejection, + allowDownloadPDF: allowDownloadPDF, ...additionalProps, }) ) diff --git a/packages/vue/src/direct-template.vue b/packages/vue/src/direct-template.vue index aa133c4..4c5e9c5 100644 --- a/packages/vue/src/direct-template.vue +++ b/packages/vue/src/direct-template.vue @@ -28,6 +28,14 @@ export type EmbedDirectTemplateProps = { name?: string | undefined; lockName?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -42,7 +50,27 @@ export type EmbedDirectTemplateProps = { onFieldUnsigned?: () => void; }; -const props = defineProps(); +const props = withDefaults(defineProps(), { + host: undefined, + name: undefined, + lockName: undefined, + email: undefined, + lockEmail: undefined, + css: undefined, + cssVars: undefined, + darkModeDisabled: undefined, + language: undefined, + allowDownloadPDF: true, + additionalProps: undefined, + token: undefined, + externalId: undefined, + onDocumentReady: undefined, + onDocumentCompleted: undefined, + onDocumentError: undefined, + onFieldSigned: undefined, + onFieldUnsigned: undefined, + className: undefined, +}); const __iframe = ref(null); @@ -65,6 +93,7 @@ const src = computed(() => { cssVars: props.cssVars, darkModeDisabled: props.darkModeDisabled, language: props.language, + allowDownloadPDF: props.allowDownloadPDF, ...props.additionalProps, }) ) diff --git a/packages/vue/src/sign-document.vue b/packages/vue/src/sign-document.vue index 49fe010..09c40d9 100644 --- a/packages/vue/src/sign-document.vue +++ b/packages/vue/src/sign-document.vue @@ -37,6 +37,14 @@ export type EmbedSignDocumentProps = { lockEmail?: boolean | undefined; allowDocumentRejection?: boolean | undefined; + /** + * Whether to show the "Download PDF" action. Defaults to `true`. + * + * This only hides the button, it does not prevent the recipient from downloading + * the document. + */ + allowDownloadPDF?: boolean | undefined; + // Additional props to be passed to the iframe, used for testing out features // prior to being added to the main props additionalProps?: Record | undefined; @@ -55,7 +63,27 @@ export type EmbedSignDocumentProps = { }) => void; }; -const props = defineProps(); +const props = withDefaults(defineProps(), { + host: undefined, + name: undefined, + lockName: undefined, + email: undefined, + lockEmail: undefined, + css: undefined, + cssVars: undefined, + darkModeDisabled: undefined, + language: undefined, + allowDocumentRejection: undefined, + allowDownloadPDF: true, + additionalProps: undefined, + token: undefined, + clientUserId: undefined, + onDocumentReady: undefined, + onDocumentCompleted: undefined, + onDocumentError: undefined, + onDocumentRejected: undefined, + className: undefined, +}); const __iframe = ref(null); @@ -79,6 +107,7 @@ const src = computed(() => { darkModeDisabled: props.darkModeDisabled, language: props.language, allowDocumentRejection: props.allowDocumentRejection, + allowDownloadPDF: props.allowDownloadPDF, ...props.additionalProps, }) )