Merge from docusealco/wip

pull/493/head 2.0.0
Alex Turchyn 5 months ago committed by GitHub
commit 019222ae40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -162,7 +162,7 @@ module Api
submitters = submitters.where(submission_id: params[:submission_id]) if params[:submission_id].present?
if params[:template_id].present?
submitters = submitters.joins(:submission).where(submission: { template_id: params[:template_id] })
submitters = submitters.joins(:submission).where(submissions: { template_id: params[:template_id] })
end
maybe_filder_by_completed_at(submitters, params)

@ -43,9 +43,11 @@ class StartFormController < ApplicationController
if @submitter.save
if is_new_record
WebhookUrls.for_account_id(@submitter.account_id, 'submission.created').each do |webhook_url|
SendSubmissionCreatedWebhookRequestJob.perform_async('submission_id' => @submitter.submission_id,
'webhook_url_id' => webhook_url.id)
enqueue_submission_create_webhooks(@submitter)
if @submitter.submission.expire_at?
ProcessSubmissionExpiredJob.perform_at(@submitter.submission.expire_at,
'submission_id' => @submitter.submission_id)
end
end
@ -64,6 +66,13 @@ class StartFormController < ApplicationController
private
def enqueue_submission_create_webhooks(submitter)
WebhookUrls.for_account_id(submitter.account_id, 'submission.created').each do |webhook_url|
SendSubmissionCreatedWebhookRequestJob.perform_async('submission_id' => submitter.submission_id,
'webhook_url_id' => webhook_url.id)
end
end
def find_or_initialize_submitter(template, submitter_params)
Submitter.where(submission: template.submissions.where(expire_at: Time.current..)
.or(template.submissions.where(expire_at: nil)).where(archived_at: nil))

@ -16,7 +16,7 @@ class UsersController < ApplicationController
@users.active.where.not(role: 'integration')
end
@pagy, @users = pagy(@users.where(account: current_account).order(id: :desc))
@pagy, @users = pagy(@users.preload(account: :account_accesses).where(account: current_account).order(id: :desc))
end
def new; end

@ -165,11 +165,27 @@ export default targetable(class extends HTMLElement {
onDragover (e) {
if (e.dataTransfer?.types?.includes('Files') || this.dataset.targets !== 'dashboard-dropzone.templateCards') {
this.style.backgroundColor = '#F7F3F0'
if (this.classList.contains('before:border-base-300')) {
this.classList.remove('before:border-base-300')
this.classList.add('before:border-base-content/30')
} else if (this.classList.contains('border-base-300')) {
this.classList.remove('border-base-300')
this.classList.add('border-base-content/30')
}
}
}
onDragleave () {
this.style.backgroundColor = null
if (this.classList.contains('before:border-base-content/30')) {
this.classList.remove('before:border-base-content/30')
this.classList.add('before:border-base-300')
} else if (this.classList.contains('border-base-content/30')) {
this.classList.remove('border-base-content/30')
this.classList.add('border-base-300')
}
}
onWindowDragleave = (e) => {

@ -5,19 +5,37 @@ export default actionable(targetable(class extends HTMLElement {
static [target.static] = [
'loading',
'icon',
'input'
'input',
'area'
]
connectedCallback () {
this.addEventListener('drop', this.onDrop)
this.addEventListener('dragover', (e) => e.preventDefault())
this.addEventListener('drop', this.onDrop)
document.addEventListener('turbo:submit-end', this.toggleLoading)
this.area?.addEventListener('dragover', this.onDragover)
this.area?.addEventListener('dragleave', this.onDragleave)
}
disconnectedCallback () {
this.removeEventListener('drop', this.onDrop)
document.removeEventListener('turbo:submit-end', this.toggleLoading)
this.area?.removeEventListener('dragover', this.onDragover)
this.area?.removeEventListener('dragleave', this.onDragleave)
}
onDragover (e) {
if (e.dataTransfer?.types?.includes('Files')) {
this.style.backgroundColor = '#F7F3F0'
this.classList.remove('border-base-300', 'hover:bg-base-200/30')
this.classList.add('border-base-content/30')
}
}
onDragleave () {
this.style.backgroundColor = null
this.classList.remove('border-base-content/30')
this.classList.add('border-base-300', 'hover:bg-base-200/30')
}
onDrop (e) {

@ -55,10 +55,12 @@
>
<div
v-else-if="field.type === 'signature' && signature"
class="flex flex-col justify-between h-full overflow-hidden"
class="flex justify-between h-full gap-1 overflow-hidden"
:class="isNarrow ? 'flex-row' : 'flex-col'"
>
<div
class="flex-grow flex overflow-hidden"
class="flex overflow-hidden"
:class="isNarrow ? 'w-1/2' : 'flex-grow'"
style="min-height: 50%"
>
<img
@ -68,7 +70,8 @@
</div>
<div
v-if="withSignatureId"
class="w-full mt-1 text-[1vw] lg:text-[0.55rem] lg:leading-[0.65rem]"
class="text-[1vw] lg:text-[0.55rem] lg:leading-[0.65rem]"
:class="isNarrow ? 'w-1/2' : 'w-full'"
>
<div class="truncate uppercase">
ID: {{ signature.uuid }}
@ -444,6 +447,9 @@ export default {
}
return style
},
isNarrow () {
return this.area.h > 0 && (this.area.w / this.area.h) > 6
}
},
watch: {

@ -93,7 +93,7 @@
<div
v-show="isFormVisible"
id="form_container"
class="shadow-md bg-base-100 absolute bottom-0 w-full border-base-200 border p-4 rounded form-container"
class="shadow-md bg-base-100 absolute bottom-0 w-full border-base-200 border p-4 rounded form-container overflow-hidden"
:class="{ 'md:bottom-4': isBreakpointMd }"
:style="{ backgroundColor: backgroundColor }"
>
@ -1133,7 +1133,7 @@ export default {
parent.style.overflow = 'hidden'
scrollbox.classList.add('h-full', 'overflow-y-auto')
scrollbox.parentNode.classList.add('h-screen', 'overflow-y-auto')
scrollbox.parentNode.classList.add('h-screen', 'h-[100dvh]', 'overflow-y-auto')
scrollbox.parentNode.style.maxHeight = '-webkit-fill-available'
})
}

@ -13,7 +13,6 @@
:template-id="template.id"
:accept-file-types="acceptFileTypes"
:with-replace-and-clone="withReplaceAndCloneUpload"
hover-class="bg-base-200/50"
@add="[updateFromUpload($event), isDragFile = false]"
@replace="[onDocumentsReplace($event), isDragFile = false]"
@replace-and-clone="onDocumentsReplaceAndTemplateClone($event)"

@ -10,7 +10,7 @@
id="document_dropzone"
class="w-full relative rounded-md border-2 border-base-content/10 border-dashed"
:for="inputId"
:class="[{ 'opacity-50': isLoading, 'hover:bg-base-200/30': !hoverClass }, isDragEntering && hoverClass ? hoverClass : '']"
:class="{ 'opacity-50': isLoading, 'hover:bg-base-200/50': withHoverClass && !isDragEntering, 'bg-base-200/50 border-base-content/30': isDragEntering }"
>
<div class="absolute top-0 right-0 left-0 bottom-0 flex items-center justify-center pointer-events-none">
<div class="flex flex-col items-center">
@ -79,15 +79,15 @@ export default {
type: [Number, String],
required: true
},
icon: {
type: String,
withHoverClass: {
type: Boolean,
required: false,
default: 'IconCloudUpload'
default: true
},
hoverClass: {
icon: {
type: String,
required: false,
default: null
default: 'IconCloudUpload'
},
cloneTemplateOnUpload: {
type: Boolean,

@ -6,12 +6,12 @@
<div class="flex flex-col gap-2 p-4 items-center bg-base-100 h-full max-h-[85vh] max-w-6xl rounded-2xl w-full">
<Dropzone
class="flex-1 h-full"
hover-class="bg-base-200/50"
icon="IconFilePlus"
:template-id="templateId"
:accept-file-types="acceptFileTypes"
:with-hover-class="false"
:with-description="false"
:title="t('upload_a_new_document')"
:title="t('add_a_new_document')"
type="add_files"
@loading="isLoading = $event"
@success="$emit('add', $event)"
@ -20,10 +20,10 @@
<div class="flex-1 flex gap-2 w-full">
<Dropzone
class="flex-1 h-full"
hover-class="bg-base-200/50"
icon="IconFileSymlink"
:template-id="templateId"
:accept-file-types="acceptFileTypes"
:with-hover-class="false"
:with-description="false"
:title="t('replace_existing_document')"
@loading="isLoading = $event"
@ -33,10 +33,10 @@
<Dropzone
v-if="withReplaceAndClone"
class="flex-1 h-full"
hover-class="bg-base-200/50"
icon="IconFiles"
:template-id="templateId"
:accept-file-types="acceptFileTypes"
:with-hover-class="false"
:with-description="false"
:clone-template-on-upload="true"
:title="t('clone_and_replace_documents')"

@ -63,7 +63,7 @@ const en = {
processing_: 'Processing...',
add_pdf_documents_or_images: 'Add PDF documents or images',
add_documents_or_images: 'Add documents or images',
upload_a_new_document: 'Upload a new document',
add_a_new_document: 'Add a new document',
replace_existing_document: 'Replace existing document',
clone_and_replace_documents: 'Clone and replace documents',
required: 'Required',
@ -228,7 +228,7 @@ const es = {
processing_: 'Procesando...',
add_pdf_documents_or_images: 'Agregar documentos PDF o imágenes',
add_documents_or_images: 'Agregar documentos o imágenes',
upload_a_new_document: 'Subir un nuevo documento',
add_a_new_document: 'Agregar un nuevo documento',
replace_existing_document: 'Reemplazar documento existente',
clone_and_replace_documents: 'Clonar y reemplazar documentos',
required: 'Requerido',
@ -399,7 +399,7 @@ const it = {
processing_: 'Elaborazione...',
add_pdf_documents_or_images: 'Aggiungi documenti PDF o immagini',
add_documents_or_images: 'Aggiungi documenti o immagini',
upload_a_new_document: 'Carica un nuovo documento',
add_a_new_document: 'Aggiungi un nuovo documento',
replace_existing_document: 'Sostituisci documento esistente',
clone_and_replace_documents: 'Clona e sostituisci documenti',
required: 'Obbligatorio',
@ -564,7 +564,7 @@ const pt = {
processing_: 'Processando...',
add_pdf_documents_or_images: 'Adicionar documentos PDF ou imagens',
add_documents_or_images: 'Adicionar documentos ou imagens',
upload_a_new_document: 'Enviar um novo documento',
add_a_new_document: 'Ajouter un nouveau document',
replace_existing_document: 'Substituir documento existente',
clone_and_replace_documents: 'Clonar e substituir documentos',
required: 'Obrigatório',
@ -731,7 +731,7 @@ const fr = {
processing_: 'Traitement en cours...',
add_pdf_documents_or_images: 'Ajoutez des documents PDF ou des images',
add_documents_or_images: 'Ajoutez des documents ou des images',
upload_a_new_document: 'Téléverser un nouveau document',
add_a_new_document: 'Adicionar um novo documento',
replace_existing_document: 'Remplacer le document existant',
clone_and_replace_documents: 'Cloner et remplacer les documents',
required: 'Requis',
@ -899,7 +899,7 @@ const de = {
processing_: 'Verarbeitung...',
add_pdf_documents_or_images: 'PDF-Dokumente oder Bilder hinzufügen',
add_documents_or_images: 'Dokumente oder Bilder hinzufügen',
upload_a_new_document: 'Neues Dokument hochladen',
add_a_new_document: 'Neues Dokument hinzufügen',
replace_existing_document: 'Vorhandenes Dokument ersetzen',
clone_and_replace_documents: 'Dokumente klonen und ersetzen',
required: 'Erforderlich',

@ -33,6 +33,7 @@ class Account < ApplicationRecord
has_many :account_linked_accounts, dependent: :destroy
has_many :email_events, dependent: :destroy
has_many :webhook_urls, dependent: :destroy
has_many :account_accesses, dependent: :destroy
has_many :account_testing_accounts, -> { testing }, dependent: :destroy,
class_name: 'AccountLinkedAccount',
inverse_of: :account

@ -0,0 +1,24 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: account_accesses
#
# id :bigint not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint not null
# user_id :bigint not null
#
# Indexes
#
# index_account_accesses_on_account_id_and_user_id (account_id,user_id) UNIQUE
#
# Foreign Keys
#
# fk_rails_... (account_id => accounts.id)
#
class AccountAccess < ApplicationRecord
belongs_to :account
belongs_to :user
end

@ -1,12 +1,52 @@
<div class="text-center">
<% eu_server = request.host == 'docuseal.eu' %>
<server-selector>
<div id="global_server_selector" class="text-center hidden">
<div class="join">
<a href="https://docuseal.com<%= request.fullpath.gsub('docuseal.eu', 'docuseal.com') %>" class="btn bg-base-200 join-item w-32 <%= 'bg-base-300' if request.host == 'docuseal.com' %>">
<a href="https://docuseal.com<%= request.fullpath.gsub('docuseal.eu', 'docuseal.com') %>" class="btn bg-base-200 join-item w-40 <%= 'bg-base-300' unless eu_server %>">
<%= svg_icon 'world', class: 'w-5 h-5' %>
Global
</a>
<a href="https://docuseal.eu<%= request.fullpath.gsub('docuseal.com', 'docuseal.eu') %>" class="btn bg-base-200 join-item w-32 <%= 'bg-base-300' if request.host == 'docuseal.eu' %>">
<a href="https://docuseal.eu<%= request.fullpath.gsub('docuseal.com', 'docuseal.eu') %>" class="relative btn bg-base-200 join-item w-40 <%= 'bg-base-300' if eu_server %>">
<%= svg_icon 'eu_flag', class: 'w-5 h-5' %>
Europe
<% unless eu_server %>
<span id="eu_server_alert" class="absolute flex space-x-0.5 hidden" style="top: -1.5rem;">
<span class="text-xs font-normal leading-none text-base-content normal-case">
<%= t('eu_data_residency') %>
</span>
<%= svg_icon 'corner_right_down', class: 'w-4 h-5 stroke-1 shrink-0 pt-1' %>
</span>
<% end %>
</a>
</div>
</div>
</div>
<div id="us_server_selector" class="flex justify-center hidden">
<div class="dropdown">
<label tabindex="0" class="relative btn btn-sm bg-transparent font-medium normal-case border-base-content/20 justify-start" style="width: 141px; padding: 0 20px">
<% if eu_server %>
<%= svg_icon 'eu_flag', class: 'w-5 h-5' %>
<span>EU Cloud</span>
<% else %>
<%= svg_icon 'usa_flag', class: 'w-5 h-5' %>
<span>US Cloud</span>
<% end %>
<%= svg_icon 'chevron_down', class: 'mr-1 w-4 h-4 absolute right-1' %>
</label>
<ul tabindex="0" class="dropdown-content z-[1] menu border border-base-content/20 mt-1 bg-base-100 rounded-box w-36">
<li>
<a href="https://docuseal.com<%= request.fullpath.gsub('docuseal.eu', 'docuseal.com') %>" class="flex items-center space-x-2 <%= 'bg-base-300' unless eu_server %>">
<%= svg_icon 'usa_flag', class: 'w-5 h-5' %>
US Cloud
</a>
</li>
<li>
<a href="https://docuseal.eu<%= request.fullpath.gsub('docuseal.com', 'docuseal.eu') %>" class="flex items-center space-x-2 <%= 'bg-base-300' if eu_server %>">
<%= svg_icon 'eu_flag', class: 'w-5 h-5' %>
EU Cloud
</a>
</li>
</ul>
</div>
</div>
</server-selector>
<%= render 'scripts/server_selector' %>

@ -0,0 +1,3 @@
<svg class="<%= local_assigns[:class] %>" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" width="24" height="24" stroke-width="2">
<path d="M6 6h6a3 3 0 0 1 3 3v10l-4 -4m8 0l-4 4"></path>
</svg>

After

Width:  |  Height:  |  Size: 285 B

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" viewBox="0 0 640 480">
<path fill="#bd3d44" d="M0 0h640v480H0" />
<path stroke="#fff" stroke-width="37" d="M0 55.3h640M0 129h640M0 203h640M0 277h640M0 351h640M0 425h640" />
<path fill="#192f5d" d="M0 0h364.8v258.5H0" />
<marker id="um-a" markerHeight="30" markerWidth="30">
<path fill="#fff" d="m14 0 9 27L0 10h28L5 27z" />
</marker>
<path fill="none" marker-mid="url(#um-a)" d="m0 0 16 11h61 61 61 61 60L47 37h61 61 60 61L16 63h61 61 61 61 60L47 89h61 61 60 61L16 115h61 61 61 61 60L47 141h61 61 60 61L16 166h61 61 61 61 60L47 192h61 61 60 61L16 218h61 61 61 61 60z" />
</svg>

After

Width:  |  Height:  |  Size: 671 B

@ -0,0 +1,22 @@
<script>
if (!window.customElements.get('server-selector')) {
customElements.define('server-selector', class extends HTMLElement {
connectedCallback() {
const usServerSelector = this.querySelector('#us_server_selector');
const globalServerSelector = this.querySelector('#global_server_selector');
const euServerAlert = this.querySelector('#eu_server_alert');
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
const usTimezones = /^(?:America\/(?:New_York|Detroit|Kentucky|Indiana|Chicago|Menominee|North_Dakota|Denver|Boise|Phoenix|Los_Angeles|Anchorage|Juneau|Sitka|Metlakatla|Yakutat|Nome|Adak)|Pacific\/Honolulu)/;
if (usTimezones.test(timezone)) {
usServerSelector.classList.remove('hidden');
} else if (timezone.includes('Europe')) {
globalServerSelector.classList.remove('hidden');
euServerAlert?.classList?.remove('hidden');
} else {
globalServerSelector.classList.remove('hidden');
}
}
});
}
</script>

@ -1 +1 @@
<% 'stats stat stat-figure stat-title stat-value text-accent w-fit hover:bg-white dropdown-open' %>
<% 'stats stat stat-figure stat-title stat-value text-accent w-fit hover:bg-white dropdown-open border-base-content/30 before:border-base-content/30' %>

@ -5,12 +5,13 @@
<% font_type = field.dig('preferences', 'font_type') %>
<field-value dir="auto" class="flex absolute text-[1.6vw] lg:text-base <%= 'font-mono' if font == 'Courier' %> <%= 'font-serif' if font == 'Times' %> <%= 'font-bold' if font_type == 'bold' || font_type == 'bold_italic' %> <%= 'italic' if font_type == 'italic' || font_type == 'bold_italic' %> <%= align == 'right' ? 'text-right' : (align == 'center' ? 'text-center' : '') %>" style="<%= "color: #{color}; " if color.present? %>width: <%= area['w'] * 100 %>%; height: <%= area['h'] * 100 %>%; left: <%= area['x'] * 100 %>%; top: <%= area['y'] * 100 %>%; <%= "font-size: clamp(4pt, 1.6vw, #{field['preferences']['font_size'].to_i * 1.23}pt); line-height: `clamp(6pt, 2.0vw, #{(field['preferences']['font_size'].to_i * 1.23) + 3}pt)`" if field.dig('preferences', 'font_size') %>">
<% if field['type'] == 'signature' %>
<div class="flex flex-col justify-between h-full overflow-hidden">
<div class="flex-grow flex overflow-hidden" style="min-height: 50%">
<% is_narrow = area['h']&.positive? && (area['w'].to_f / area['h']) > 6 %>
<div class="flex justify-between w-full h-full gap-1 <%= is_narrow ? 'flex-row' : 'flex-col' %>">
<div class="flex overflow-hidden <%= is_narrow ? 'w-1/2' : 'flex-grow' %>" style="min-height: 50%">
<img class="object-contain mx-auto" src="<%= attachments_index[value].url %>">
</div>
<% if local_assigns[:with_signature_id] && attachment = attachments_index[value] %>
<div class="w-full mt-1 text-[1vw] lg:text-[0.55rem] lg:leading-[0.65rem]">
<div class="text-[1vw] lg:text-[0.55rem] lg:leading-[0.65rem] <%= is_narrow ? 'w-1/2' : 'w-full' %>">
<div class="truncate uppercase">
ID: <%= attachment.uuid %>
</div>

@ -2,8 +2,8 @@
<input type="hidden" name="form_id" value="<%= form_id %>">
<button type="submit" class="hidden"></button>
<file-dropzone data-submit-on-upload="true" class="w-full">
<label for="file_dropzone_input" class="w-full block h-52 relative hover:bg-base-200/30 rounded-xl border border-2 border-base-300 border-dashed">
<div class="absolute top-0 right-0 left-0 bottom-0 flex items-center justify-center p-2">
<label for="file_dropzone_input" class="w-full block h-52 relative hover:bg-base-200/30 rounded-xl border-2 border-base-300 border-dashed" data-target="file-dropzone.area">
<div class="absolute top-0 right-0 left-0 bottom-0 flex items-center justify-center p-2 pointer-events-none">
<div class="flex flex-col items-center text-center">
<span data-target="file-dropzone.icon" class="flex flex-col items-center">
<span>

@ -56,7 +56,7 @@
<% if @templates.present? %>
<div class="grid gap-4 md:grid-cols-3">
<%= render partial: 'templates/template', collection: @templates %>
<% if show_dropzone && current_user.created_at > 2.weeks.ago || params[:tour] == 'true' %>
<% if show_dropzone && (current_user.created_at > 2.weeks.ago || params[:tour] == 'true') && current_user == true_user %>
<% user_config = current_user.user_configs.find_or_initialize_by(key: UserConfig::SHOW_APP_TOUR) %>
<% if user_config.new_record? || user_config.value || params[:tour] == 'true' %>
<div class="hidden md:block">

@ -55,8 +55,8 @@
<%= user.email %>
</td>
<td>
<span class="badge badge-info badge-outline">
<%= user.role %>
<span class="badge badge-info badge-outline whitespace-nowrap">
<%= t(user.role) %>
</span>
</td>
<td>

@ -469,7 +469,9 @@ en: &en
upload_initials: Upload Initials
draw: Draw
upload_signature: Upload Signature
integration: Integration
admin: Admin
tenant_admin: Tenant Admin
editor: Editor
viewer: Viewer
member: Member
@ -738,6 +740,7 @@ en: &en
one_month: 1 month
two_months: 2 months
three_months: 3 months
eu_data_residency: EU data residency
submission_sources:
api: API
bulk: Bulk Send
@ -845,7 +848,7 @@ es: &es
select_user: Seleccionar usuario
team_member_permissions: Permisos de miembros del equipo
entire_team: Todo el equipo
admin_only: Solo administrador
admin_only: Solo admin
accessiable_by: Accesible por
team_access: Acceso del equipo
remove_filter: Eliminar filtro
@ -1274,7 +1277,9 @@ es: &es
upload_initials: Subir iniciales
draw: Dibujar
upload_signature: Subir firma
integration: Integración
admin: Administrador
tenant_admin: Tenant Administrador
editor: Editor
viewer: Visor
member: Miembro
@ -1543,6 +1548,7 @@ es: &es
one_month: 1 mes
two_months: 2 meses
three_months: 3 meses
eu_data_residency: Datos alojados UE
submission_sources:
api: API
bulk: Envío masivo
@ -1649,7 +1655,7 @@ it: &it
select_user: Seleziona utente
team_member_permissions: Permessi membri del team
entire_team: Intero team
admin_only: Solo amministratore
admin_only: Solo admin
accessiable_by: Accessibile da
team_access: Accesso al team
remove_filter: Rimuovi filtro
@ -2078,6 +2084,7 @@ it: &it
upload_initials: Carica iniziali
draw: Disegna
upload_signature: Carica firma
integration: Integrazione
admin: Amministratore
editor: Editor
viewer: Visualizzatore
@ -2347,6 +2354,7 @@ it: &it
one_month: 1 mese
two_months: 2 mesi
three_months: 3 mesi
eu_data_residency: "Dati nell'UE"
submission_sources:
api: API
bulk: Invio massivo
@ -2454,7 +2462,7 @@ fr: &fr
select_user: Sélectionner un utilisateur
team_member_permissions: Permissions des membres de l'équipe
entire_team: Équipe entière
admin_only: Administrateur uniquement
admin_only: Admin seul
accessiable_by: Accessible par
team_access: Accès à l'équipe
remove_filter: Supprimer le filtre
@ -2884,7 +2892,9 @@ fr: &fr
upload_initials: Télécharger les initiales
draw: Dessiner
upload_signature: Télécharger la signature
integration: Intégration
admin: Administrateur
tenant_admin: Tenant Administrateur
editor: Éditeur
viewer: Lecteur
member: Membre
@ -3153,6 +3163,7 @@ fr: &fr
one_month: 1 mois
two_months: 2 mois
three_months: 3 mois
eu_data_residency: "Données dans l'UE"
submission_sources:
api: API
bulk: Envoi en masse
@ -3260,7 +3271,7 @@ pt: &pt
select_user: Selecionar usuário
team_member_permissions: Permissões de membro da equipe
entire_team: Toda a equipe
admin_only: Somente administrador
admin_only: Somente admin
accessiable_by: Acessível por
team_access: Acesso à equipe
remove_filter: Remover filtro
@ -3689,7 +3700,9 @@ pt: &pt
upload_initials: Enviar iniciais
draw: Desenhar
upload_signature: Enviar assinatura
integration: Integração
admin: Administrador
tenant_admin: Tenant Administrador
editor: Editor
viewer: Visualizador
member: Membro
@ -3958,6 +3971,7 @@ pt: &pt
one_month: 1 mês
two_months: 2 meses
three_months: 3 meses
eu_data_residency: Dados na UE
submission_sources:
api: API
bulk: Envio em massa
@ -4066,7 +4080,7 @@ de: &de
select_user: Benutzer auswählen
team_member_permissions: Berechtigungen für Teammitglieder
entire_team: Gesamtes Team
admin_only: Nur Administratoren
admin_only: Nur Admins
accessiable_by: Zugänglich für
team_access: Teamzugang
remove_filter: Filter entfernen
@ -4495,7 +4509,9 @@ de: &de
upload_initials: Initialen hochladen
draw: Zeichnen
upload_signature: Unterschrift hochladen
integration: Integration
admin: Administrator
tenant_admin: Tenant Administrator
editor: Redakteur
viewer: Betrachter
member: Mitglied
@ -4764,6 +4780,7 @@ de: &de
one_month: 1 Monat
two_months: 2 Monate
three_months: 3 Monate
eu_data_residency: EU-Datenspeicher
submission_sources:
api: API
bulk: Massenversand
@ -4915,6 +4932,7 @@ pl:
powered_by: 'Napędzany prze'
count_documents_signed_with_html: '<b>%{count}</b> dokumentów podpisanych za pomocą'
open_source_documents_software: 'oprogramowanie do dokumentów open source'
eu_data_residency: Dane w UE
uk:
require_phone_2fa_to_open: Вимагати двофакторну автентифікацію через телефон для відкриття
@ -4982,6 +5000,7 @@ uk:
powered_by: 'Працює на базі'
count_documents_signed_with_html: '<b>%{count}</b> документів підписано за допомогою'
open_source_documents_software: 'відкрите програмне забезпечення для документів'
eu_data_residency: 'Зберігання даних в ЄС'
cs:
require_phone_2fa_to_open: Vyžadovat otevření pomocí telefonního 2FA
@ -5049,6 +5068,7 @@ cs:
powered_by: 'Poháněno'
count_documents_signed_with_html: '<b>%{count}</b> dokumentů podepsáno pomocí'
open_source_documents_software: 'open source software pro dokumenty'
eu_data_residency: 'Uložení dat v EU'
he:
require_phone_2fa_to_open: דרוש אימות דו-שלבי באמצעות טלפון לפתיחה
@ -5116,6 +5136,7 @@ he:
powered_by: 'מופעל על ידי'
count_documents_signed_with_html: '<b>%{count}</b> מסמכים נחתמו באמצעות'
open_source_documents_software: 'תוכנה בקוד פתוח למסמכים'
eu_data_residency: 'נתונים באיחוד האירופי '
nl:
require_phone_2fa_to_open: Vereis telefoon 2FA om te openen
@ -5183,6 +5204,7 @@ nl:
powered_by: 'Aangedreven door'
count_documents_signed_with_html: '<b>%{count}</b> documenten ondertekend met'
open_source_documents_software: 'open source documenten software'
eu_data_residency: Gegevens EU
ar:
require_phone_2fa_to_open: "تطلب فتح عبر تحقق الهاتف ذو العاملين"
@ -5250,6 +5272,7 @@ ar:
powered_by: 'مشغل بواسطة'
count_documents_signed_with_html: '<b>%{count}</b> مستندات تم توقيعها باستخدام'
open_source_documents_software: 'برنامج مستندات مفتوح المصدر'
eu_data_residency: 'بيانات في الاتحاد الأوروبي'
ko:
require_phone_2fa_to_open: 휴대폰 2FA를 열 때 요구함
@ -5317,6 +5340,7 @@ ko:
powered_by: '제공:'
count_documents_signed_with_html: '<b>%{count}</b>개의 문서가 다음을 통해 서명됨'
open_source_documents_software: '오픈소스 문서 소프트웨어'
eu_data_residency: 'EU 데이터 보관'
ja:
require_phone_2fa_to_open: 電話による2段階認証が必要です
@ -5384,6 +5408,7 @@ ja:
powered_by: '提供元:'
count_documents_signed_with_html: '<b>%{count}</b> 件のドキュメントが以下で署名されました'
open_source_documents_software: 'オープンソースのドキュメントソフトウェア'
eu_data_residency: 'EU データ居住'
en-US:
<<: *en

@ -0,0 +1,14 @@
# frozen_string_literal: true
class AccountAccesses < ActiveRecord::Migration[8.0]
def change
create_table :account_accesses do |t|
t.references :account, null: false, foreign_key: true, index: false
t.references :user, null: false, foreign_key: false, index: false
t.index %i[account_id user_id], unique: true
t.timestamps
end
end
end

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_02_25_111255) do
ActiveRecord::Schema[8.0].define(version: 2025_05_18_070555) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -24,6 +24,14 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_25_111255) do
t.index ["user_id"], name: "index_access_tokens_on_user_id"
end
create_table "account_accesses", force: :cascade do |t|
t.bigint "account_id", null: false
t.bigint "user_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["account_id", "user_id"], name: "index_account_accesses_on_account_id_and_user_id", unique: true
end
create_table "account_configs", force: :cascade do |t|
t.bigint "account_id", null: false
t.string "key", null: false
@ -415,6 +423,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_02_25_111255) do
end
add_foreign_key "access_tokens", "users"
add_foreign_key "account_accesses", "accounts"
add_foreign_key "account_configs", "accounts"
add_foreign_key "account_linked_accounts", "accounts"
add_foreign_key "account_linked_accounts", "accounts", column: "linked_account_id"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,513 @@
# Angular Form Builder
### Example Code
```angular
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { DocusealBuilderComponent } from '@docuseal/angular';
@Component({
selector: 'app-root',
standalone: true,
imports: [DocusealBuilderComponent],
template: `
<div class="app">
<ng-container *ngIf="token">
<docuseal-builder [token]="token"></docuseal-builder>
</ng-container>
</div>
`
})
export class AppComponent implements OnInit {
token: string = ''
constructor(private http: HttpClient) {}
ngOnInit() {
this.http.post('/api/docuseal/builder_token', {}).subscribe((data: any) => {
this.token = data.token;
});
}
}
```
```javascript
const jwt = require('jsonwebtoken');
const token = jwt.sign({
user_email: '{{admin_user_email}}',
integration_email: '{{signer_email}}',
external_id: 'TestForm123',
name: 'Integration W-9 Test Form',
document_urls: ['https://www.irs.gov/pub/irs-pdf/fw9.pdf'],
}, '{{api_key}}');
```
### Attributes
```json
{
"token": {
"type": "string",
"doc_type": "object",
"description": "JSON Web Token (JWT HS256) with a payload signed using the API key. <br><b>Ensure that the JWT token is generated on the backend to prevent unauthorized access to your documents</b>.",
"required": true,
"properties": {
"user_email": {
"type": "string",
"required": true,
"description": "Email of the owner of the API signing key - admin user email."
},
"integration_email": {
"type": "string",
"required": false,
"description": "Email of the user to create a template for.",
"example": "signer@example.com"
},
"template_id": {
"type": "number",
"required": false,
"description": "ID of the template to open in the form builder. Optional when `document_urls` are specified."
},
"external_id": {
"type": "string",
"description": "Your application-specific unique string key to identify this template within your app.",
"required": false
},
"folder_name": {
"type": "string",
"description": "The folder name in which the template should be created.",
"required": false
},
"document_urls": {
"type": "array",
"required": false,
"description": "An Array of URLs with PDF files to open in the form builder. Optional when `template_id` is specified.",
"example": "['https://www.irs.gov/pub/irs-pdf/fw9.pdf']"
},
"name": {
"type": "string",
"required": false,
"description": "New template name when creating a template with document_urls specified.",
"example": "Integration W-9 Test Form"
},
"extract_fields": {
"type": "boolean",
"required": false,
"description": "Pass `false` to disable automatic PDF form fields extraction. PDF fields are automatically added by default."
}
}
},
"host": {
"type": "string",
"required": false,
"description": "DocuSeal host domain name. Only use this attribute if you are using the on-premises DocuSeal installation or docuseal.eu Cloud.",
"example": "yourdomain.com"
},
"customButton": {
"type": "object",
"required": false,
"description": "Custom button will be displayed on the top right corner of the form builder.",
"properties": {
"title": {
"type": "string",
"required": true,
"description": "Custom button title."
},
"url": {
"type": "string",
"required": true,
"description": "Custom button URL. Only absolute URLs are supported."
}
}
},
"roles": {
"type": "array",
"required": false,
"description": "Submitter role names to be used by default in the form."
},
"fieldTypes": {
"type": "array",
"required": false,
"description": "Field type names to be used in the form builder. All field types are used by default."
},
"drawFieldType": {
"type": "string",
"required": false,
"default": "text",
"description": "Field type to be used by default with the field drawing tool.",
"example": "signature"
},
"fields": {
"type": "array",
"required": false,
"description": "An array of default custom field properties with `name` to be added to the document.",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true,
"description": "Field name."
},
"type": {
"type": "string",
"required": false,
"description": "Field type.",
"enum": [
"heading",
"text",
"signature",
"initials",
"date",
"number",
"image",
"checkbox",
"multiple",
"file",
"radio",
"select",
"cells",
"stamp",
"payment",
"phone",
"verification"
]
},
"role": {
"type": "string",
"required": false,
"description": "Submitter role name for the field."
},
"default_value": {
"type": "string",
"required": false,
"description": "Default value of the field."
},
"title": {
"type": "string",
"required": false,
"description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown."
},
"description": {
"type": "string",
"required": false,
"description": "Field description displayed on the signing form. Supports Markdown."
},
"width": {
"type": "number",
"required": false,
"description": "Field width in pixels."
},
"height": {
"type": "number",
"required": false,
"description": "Field height in pixels."
},
"format": {
"type": "string",
"required": false,
"description": "Field format. Depends on the field type."
},
"options": {
"type": "array",
"required": false,
"description": "Field options. Required for the select field type."
},
"validation": {
"type": "object",
"required": false,
"description": "Field validation rules.",
"properties": {
"pattern": {
"type": "string",
"required": false,
"description": "Field pattern.",
"example": "^[0-9]{5}$"
},
"message": {
"type": "string",
"required": false,
"description": "Validation error message."
}
}
}
}
}
},
"submitters": {
"type": "array",
"required": false,
"description": "An array of default submitters with `role` name to be added to the document.",
"items": {
"type": "object",
"properties": {
"email": {
"type": "string",
"required": false,
"description": "Submitter email."
},
"role": {
"type": "string",
"required": true,
"description": "Submitter role name."
},
"name": {
"type": "string",
"required": false,
"description": "Submitter name."
},
"phone": {
"type": "string",
"required": false,
"description": "Submitter phone number, formatted according to the E.164 standard."
}
}
}
},
"requiredFields": {
"type": "array",
"required": false,
"description": "An array of default required custom field properties with `name` that should be added to the document.",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true,
"description": "Field name."
},
"type": {
"type": "string",
"required": false,
"description": "Field type.",
"enum": [
"heading",
"text",
"signature",
"initials",
"date",
"number",
"image",
"checkbox",
"multiple",
"file",
"radio",
"select",
"cells",
"stamp",
"payment",
"phone",
"verification"
]
},
"role": {
"type": "string",
"required": false,
"description": "Submitter role name for the field."
},
"default_value": {
"type": "string",
"required": false,
"description": "Default value of the field."
},
"title": {
"type": "string",
"required": false,
"description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown."
},
"description": {
"type": "string",
"required": false,
"description": "Field description displayed on the signing form. Supports Markdown."
},
"width": {
"type": "number",
"required": false,
"description": "Field width in pixels."
},
"height": {
"type": "number",
"required": false,
"description": "Field height in pixels."
},
"format": {
"type": "string",
"required": false,
"description": "Field format. Depends on the field type."
},
"options": {
"type": "array",
"required": false,
"description": "Field options. Required for the select field type."
},
"validation": {
"type": "object",
"required": false,
"description": "Field validation rules.",
"properties": {
"pattern": {
"type": "string",
"required": false,
"description": "Field pattern.",
"example": "^[0-9]{5}$"
},
"message": {
"type": "string",
"required": false,
"description": "Validation error message."
}
}
}
}
}
},
"emailMessage": {
"type": "object",
"required": false,
"description": "Email subject and body for the signature request.",
"properties": {
"subject": {
"type": "string",
"required": true,
"description": "Email subject for the signature request."
},
"body": {
"type": "string",
"required": true,
"description": "Email body for the signature request."
}
}
},
"withTitle": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove document title from the builder."
},
"withSendButton": {
"type": "boolean",
"required": false,
"default": true,
"description": "Show the \"Send\" button."
},
"withUploadButton": {
"type": "boolean",
"required": false,
"default": true,
"description": "Show the \"Upload\" button."
},
"withAddPageButton": {
"type": "boolean",
"required": false,
"default": false,
"description": "Show the \"Add Blank Page\" button."
},
"withSignYourselfButton": {
"type": "boolean",
"required": false,
"default": true,
"description": "Show the \"Sign Yourself\" button."
},
"withDocumentsList": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to now show the documents list on the left. Documents list is displayed by default."
},
"withFieldsList": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to now show the fields list on the right. Fields list is displayed by default."
},
"withFieldPlaceholder": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display field name placeholders instead of the field type icons."
},
"onlyDefinedFields": {
"type": "boolean",
"required": false,
"default": false,
"description": "Allow to add fields only defined in the `fields` prop."
},
"preview": {
"type": "boolean",
"required": false,
"default": false,
"description": "Show template in preview mode without ability to edit it."
},
"autosave": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disable form changes autosaving."
},
"language": {
"type": "string",
"required": false,
"default": "en",
"description": "UI language, 'en', 'es', 'de', 'fr', 'pt', 'he', 'ar' languages are available."
},
"i18n": {
"type": "object",
"required": false,
"default": "{}",
"description": "Object that contains i18n keys to replace the default UI text with custom values. See <a href=\"https://github.com/docusealco/docuseal/blob/master/app/javascript/template_builder/i18n.js\" class=\"link\" target=\"_blank\" rel=\"nofollow\">template_builder/i18n.js</a> for available i18n keys."
},
"backgroundColor": {
"type": "string",
"required": false,
"description": "The form builder background color. Only HEX color codes are supported.",
"example": "#ffffff"
},
"customCss": {
"type": "string",
"required": false,
"description": "Custom CSS styles to be applied to the form builder.",
"example": "#sign_yourself_button { background-color: #FFA500; }"
}
}
```
### Callback
```json
{
"onLoad": {
"type": "event emitter",
"required": false,
"description": "Event emitted on loading the form builder template data.",
"example": "handleLoad($event)"
},
"onUpload": {
"type": "event emitter",
"required": false,
"description": "Event emitted on uploading a document to the template.",
"example": "handleUpload($event)"
},
"onSend": {
"type": "event emitter",
"required": false,
"description": "Event emitted on sending documents for signature to recipients.",
"example": "handleSend($event)"
},
"onChange": {
"type": "function",
"required": false,
"description": "Function to be called when changes are made to the template form.",
"example": "handleChange($event)"
},
"onSave": {
"type": "event emitter",
"required": false,
"description": "Event emitted on saving changes of the template form.",
"example": "handleSave($event)"
}
}
```

@ -0,0 +1,477 @@
# JavaScript Form Builder
### Example Code
```javascript
<script src="https://docuseal.com/js/builder.js"></script>
<docuseal-builder
data-token="<%= JWT.encode({
user_email: '{{admin_user_email}}',
integration_email: '{{signer_email}}',
name: 'Integration W-9 Test Form',
document_urls: ['https://www.irs.gov/pub/irs-pdf/fw9.pdf'],
}, '{{api_key}}') %>">
</docuseal-builder>
```
### Attributes
```json
{
"data-token": {
"type": "string",
"doc_type": "object",
"description": "JSON Web Token (JWT HS256) with a payload signed using the API key. <br><b>Ensure that the JWT token is generated on the backend to prevent unauthorized access to your documents</b>.",
"required": true,
"properties": {
"user_email": {
"type": "string",
"required": true,
"description": "Email of the owner of the API signing key - admin user email."
},
"integration_email": {
"type": "string",
"required": false,
"description": "Email of the user to create a template for.",
"example": "signer@example.com"
},
"template_id": {
"type": "number",
"required": false,
"description": "ID of the template to open in the form builder. Optional when `document_urls` are specified."
},
"external_id": {
"type": "string",
"description": "Your application-specific unique string key to identify this template within your app.",
"required": false
},
"folder_name": {
"type": "string",
"description": "The folder name in which the template should be created.",
"required": false
},
"document_urls": {
"type": "array",
"required": false,
"description": "An Array of URLs with PDF files to open in the form builder. Optional when `template_id` is specified.",
"example": "['https://www.irs.gov/pub/irs-pdf/fw9.pdf']"
},
"name": {
"type": "string",
"required": false,
"description": "New template name when creating a template with document_urls specified.",
"example": "Integration W-9 Test Form"
},
"extract_fields": {
"type": "boolean",
"required": false,
"description": "Pass `false` to disable automatic PDF form fields extraction. PDF fields are automatically added by default."
}
}
},
"data-host": {
"type": "string",
"required": false,
"description": "DocuSeal host domain name. Only use this attribute if you are using the on-premises DocuSeal installation or docuseal.eu Cloud.",
"example": "yourdomain.com"
},
"data-roles": {
"type": "string",
"required": false,
"description": "Comma separated submitter role names to be used by default in the form.",
"example": "Company,Customer"
},
"data-fields": {
"type": "string",
"doc_type": "array",
"required": false,
"description": "A list of default custom fields with `name` to be added to the document. Should contain an array of field properties as a JSON encoded string.",
"example": "[{ \"name\": \"FIELD_1\", \"type\": \"date\", \"role\": \"Customer\", \"default_value\": \"2021-01-01\" }]",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true,
"description": "Field name."
},
"type": {
"type": "string",
"required": false,
"description": "Field type.",
"enum": [
"heading",
"text",
"signature",
"initials",
"date",
"number",
"image",
"checkbox",
"multiple",
"file",
"radio",
"select",
"cells",
"stamp",
"payment",
"phone",
"verification"
]
},
"role": {
"type": "string",
"required": false,
"description": "Submitter role name for the field."
},
"default_value": {
"type": "string",
"required": false,
"description": "Default value of the field."
},
"title": {
"type": "string",
"required": false,
"description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown."
},
"description": {
"type": "string",
"required": false,
"description": "Field description displayed on the signing form. Supports Markdown."
},
"width": {
"type": "number",
"required": false,
"description": "Field width in pixels."
},
"height": {
"type": "number",
"required": false,
"description": "Field height in pixels."
},
"format": {
"type": "string",
"required": false,
"description": "Field format. Depends on the field type."
},
"options": {
"type": "array",
"required": false,
"description": "Field options. Required for the select field type."
},
"validation": {
"type": "object",
"required": false,
"description": "Field validation rules.",
"properties": {
"pattern": {
"type": "string",
"required": false,
"description": "Field pattern.",
"example": "^[0-9]{5}$"
},
"message": {
"type": "string",
"required": false,
"description": "Validation error message."
}
}
}
}
}
},
"data-submitters": {
"type": "string",
"doc_type": "array",
"required": false,
"description": "A list of default submitters with `role` name to be added to the document. Should contain an array of field properties as a JSON encoded string.",
"example": "[{ \"email\": \"example@company.com\", \"name\": \"John Doe\", \"phone\": \"+1234567890\", \"role\": \"Customer\" }]",
"items": {
"type": "object",
"properties": {
"email": {
"type": "string",
"required": false,
"description": "Submitter email."
},
"role": {
"type": "string",
"required": true,
"description": "Submitter role name."
},
"name": {
"type": "string",
"required": false,
"description": "Submitter name."
},
"phone": {
"type": "string",
"required": false,
"description": "Submitter phone number, formatted according to the E.164 standard."
}
}
}
},
"data-required-fields": {
"type": "string",
"doc_type": "array",
"required": false,
"description": "A list of required default custom fields with `name` that should be added to the document. Should contain an array of field properties as a JSON encoded string.",
"example": "[{ \"name\": \"FIELD_1\", \"type\": \"date\", \"role\": \"Customer\", \"default_value\": \"2021-01-01\" }]",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true,
"description": "Field name."
},
"type": {
"type": "string",
"required": false,
"description": "Field type.",
"enum": [
"heading",
"text",
"signature",
"initials",
"date",
"number",
"image",
"checkbox",
"multiple",
"file",
"radio",
"select",
"cells",
"stamp",
"payment",
"phone",
"verification"
]
},
"role": {
"type": "string",
"required": false,
"description": "Submitter role name for the field."
},
"default_value": {
"type": "string",
"required": false,
"description": "Default value of the field."
},
"title": {
"type": "string",
"required": false,
"description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown."
},
"description": {
"type": "string",
"required": false,
"description": "Field description displayed on the signing form. Supports Markdown."
},
"width": {
"type": "number",
"required": false,
"description": "Field width in pixels."
},
"height": {
"type": "number",
"required": false,
"description": "Field height in pixels."
},
"format": {
"type": "string",
"required": false,
"description": "Field format. Depends on the field type."
},
"options": {
"type": "array",
"required": false,
"description": "Field options. Required for the select field type."
},
"validation": {
"type": "object",
"required": false,
"description": "Field validation rules.",
"properties": {
"pattern": {
"type": "string",
"required": false,
"description": "Field pattern.",
"example": "^[0-9]{5}$"
},
"message": {
"type": "string",
"required": false,
"description": "Validation error message."
}
}
}
}
}
},
"data-field-types": {
"type": "string",
"required": false,
"description": "Comma separated field type names to be used in the form builder. All field types are used by default.",
"example": "text,date"
},
"data-draw-field-type": {
"type": "string",
"required": false,
"default": "text",
"description": "Field type to be used by default with the field drawing tool.",
"example": "signature"
},
"data-custom-button-title": {
"type": "string",
"required": false,
"description": "Custom button title. This button will be displayed on the top right corner of the form builder."
},
"data-custom-button-url": {
"type": "string",
"required": false,
"description": "Custom button URL. Only absolute URLs are supported."
},
"data-with-title": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove document title from the builder."
},
"email-subject": {
"type": "string",
"required": false,
"description": "Email subject for the signature request. Required if `email-body` specified"
},
"email-body": {
"type": "string",
"required": false,
"description": "Email body for the signature request. Required if `email-subject` specified"
},
"data-with-send-button": {
"type": "boolean",
"required": false,
"default": true,
"description": "Show the \"Recipients\" button."
},
"data-with-upload-button": {
"type": "boolean",
"required": false,
"default": true,
"description": "Show the \"Upload\" button."
},
"data-with-add-page-button": {
"type": "boolean",
"required": false,
"default": false,
"description": "Show the \"Add Blank Page\" button."
},
"data-with-sign-yourself-button": {
"type": "boolean",
"required": false,
"default": true,
"description": "Show the \"Sign Yourself\" button."
},
"data-with-documents-list": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to now show the documents list on the left. Documents list is displayed by default."
},
"data-with-fields-list": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to now show the fields list on the right. Fields list is displayed by default."
},
"data-with-field-placeholder": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display field name placeholders instead of the field type icons."
},
"data-preview": {
"type": "boolean",
"required": false,
"default": false,
"description": "Show template in preview mode without ability to edit it."
},
"data-only-defined-fields": {
"type": "boolean",
"required": false,
"default": false,
"description": "Allow to add fields only defined in the `data-fields` attribute."
},
"data-autosave": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disable form changes autosaving."
},
"data-i18n": {
"type": "string",
"required": false,
"default": "{}",
"description": "JSON encoded string that contains i18n keys to replace the default UI text with custom values. See <a href=\"https://github.com/docusealco/docuseal/blob/master/app/javascript/template_builder/i18n.js\" class=\"link\" target=\"_blank\" rel=\"nofollow\">template_builder/i18n.js</a> for available i18n keys."
},
"data-language": {
"type": "string",
"required": false,
"default": "en",
"description": "UI language, 'en', 'es', 'de', 'fr', 'pt', 'he', 'ar' languages are available."
},
"data-background-color": {
"type": "string",
"required": false,
"description": "The form builder background color. Only HEX color codes are supported.",
"example": "#ffffff"
},
"data-custom-css": {
"type": "string",
"required": false,
"description": "Custom CSS styles to be applied to the form builder.",
"example": "#sign_yourself_button { background-color: #FFA500; }"
}
}
```
### Callback
```json
{
"load": {
"type": "event",
"required": false,
"description": "Custom event to be triggered on loading the form builder template data.",
"example": "document.querySelector('docuseal-builder').addEventListener('load', (e) => e.detail)"
},
"upload": {
"type": "event",
"required": false,
"description": "Custom event to be triggered on uploading a document to the template.",
"example": "document.querySelector('docuseal-builder').addEventListener('upload', (e) => e.detail)"
},
"send": {
"type": "event",
"required": false,
"description": "Custom event to be triggered on sending documents for signature to recipients.",
"example": "document.querySelector('docuseal-builder').addEventListener('send', (e) => e.detail)"
},
"change": {
"type": "event",
"required": false,
"description": "Custom event to be triggered every time a change to the template is made.",
"example": "document.querySelector('docuseal-builder').addEventListener('change', (e) => e.detail)"
},
"save": {
"type": "event",
"required": false,
"description": "Custom event to be triggered on saving changes of the template form.",
"example": "document.querySelector('docuseal-builder').addEventListener('save', (e) => e.detail)"
}
}
```

@ -0,0 +1,504 @@
# React Form Builder
### Example Code
```react
import React, { useState, useEffect } from 'react';
import { DocusealBuilder } from '@docuseal/react'
const App = () => {
const [token, setToken] = useState();
useEffect(() => {
fetch('/api/docuseal/builder_token', {
method: 'POST',
})
.then((response) => response.json())
.then((data) => {
setToken(data.token);
});
}, []);
return token && <DocusealBuilder token={token} />;
};
```
```javascript
const jwt = require('jsonwebtoken');
const token = jwt.sign({
user_email: '{{admin_user_email}}',
integration_email: '{{signer_email}}',
external_id: 'TestForm123',
name: 'Integration W-9 Test Form',
document_urls: ['https://www.irs.gov/pub/irs-pdf/fw9.pdf'],
}, '{{api_key}}');
```
### Attributes
```json
{
"token": {
"type": "string",
"doc_type": "object",
"description": "JSON Web Token (JWT HS256) with a payload signed using the API key. <br><b>Ensure that the JWT token is generated on the backend to prevent unauthorized access to your documents</b>.",
"required": true,
"properties": {
"user_email": {
"type": "string",
"required": true,
"description": "Email of the owner of the API signing key - admin user email."
},
"integration_email": {
"type": "string",
"required": false,
"description": "Email of the user to create a template for.",
"example": "signer@example.com"
},
"template_id": {
"type": "number",
"required": false,
"description": "ID of the template to open in the form builder. Optional when `document_urls` are specified."
},
"external_id": {
"type": "string",
"description": "Your application-specific unique string key to identify this template within your app.",
"required": false
},
"folder_name": {
"type": "string",
"description": "The folder name in which the template should be created.",
"required": false
},
"document_urls": {
"type": "array",
"required": false,
"description": "An Array of URLs with PDF files to open in the form builder. Optional when `template_id` is specified.",
"example": "['https://www.irs.gov/pub/irs-pdf/fw9.pdf']"
},
"name": {
"type": "string",
"required": false,
"description": "New template name when creating a template with document_urls specified.",
"example": "Integration W-9 Test Form"
},
"extract_fields": {
"type": "boolean",
"required": false,
"description": "Pass `false` to disable automatic PDF form fields extraction. PDF fields are automatically added by default."
}
}
},
"host": {
"type": "string",
"required": false,
"description": "DocuSeal host domain name. Only use this attribute if you are using the on-premises DocuSeal installation or docuseal.eu Cloud.",
"example": "yourdomain.com"
},
"customButton": {
"type": "object",
"required": false,
"description": "Custom button will be displayed on the top right corner of the form builder.",
"properties": {
"title": {
"type": "string",
"required": true,
"description": "Custom button title."
},
"url": {
"type": "string",
"required": true,
"description": "Custom button URL. Only absolute URLs are supported."
}
}
},
"roles": {
"type": "array",
"required": false,
"description": "Submitter role names to be used by default in the form."
},
"fieldTypes": {
"type": "array",
"required": false,
"description": "Field type names to be used in the form builder. All field types are used by default."
},
"drawFieldType": {
"type": "string",
"required": false,
"default": "text",
"description": "Field type to be used by default with the field drawing tool.",
"example": "signature"
},
"fields": {
"type": "array",
"required": false,
"description": "An array of default custom field properties with `name` to be added to the document.",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true,
"description": "Field name."
},
"type": {
"type": "string",
"required": false,
"description": "Field type.",
"enum": [
"heading",
"text",
"signature",
"initials",
"date",
"number",
"image",
"checkbox",
"multiple",
"file",
"radio",
"select",
"cells",
"stamp",
"payment",
"phone",
"verification"
]
},
"role": {
"type": "string",
"required": false,
"description": "Submitter role name for the field."
},
"default_value": {
"type": "string",
"required": false,
"description": "Default value of the field."
},
"title": {
"type": "string",
"required": false,
"description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown."
},
"description": {
"type": "string",
"required": false,
"description": "Field description displayed on the signing form. Supports Markdown."
},
"width": {
"type": "number",
"required": false,
"description": "Field width in pixels."
},
"height": {
"type": "number",
"required": false,
"description": "Field height in pixels."
},
"format": {
"type": "string",
"required": false,
"description": "Field format. Depends on the field type."
},
"options": {
"type": "array",
"required": false,
"description": "Field options. Required for the select field type."
},
"validation": {
"type": "object",
"required": false,
"description": "Field validation rules.",
"properties": {
"pattern": {
"type": "string",
"required": false,
"description": "Field pattern.",
"example": "^[0-9]{5}$"
},
"message": {
"type": "string",
"required": false,
"description": "Validation error message."
}
}
}
}
}
},
"submitters": {
"type": "array",
"required": false,
"description": "An array of default submitters with `role` name to be added to the document.",
"items": {
"type": "object",
"properties": {
"email": {
"type": "string",
"required": false,
"description": "Submitter email."
},
"role": {
"type": "string",
"required": true,
"description": "Submitter role name."
},
"name": {
"type": "string",
"required": false,
"description": "Submitter name."
},
"phone": {
"type": "string",
"required": false,
"description": "Submitter phone number, formatted according to the E.164 standard."
}
}
}
},
"requiredFields": {
"type": "array",
"required": false,
"description": "An array of default required custom field properties with `name` that should be added to the document.",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true,
"description": "Field name."
},
"type": {
"type": "string",
"required": false,
"description": "Field type.",
"enum": [
"heading",
"text",
"signature",
"initials",
"date",
"number",
"image",
"checkbox",
"multiple",
"file",
"radio",
"select",
"cells",
"stamp",
"payment",
"phone",
"verification"
]
},
"role": {
"type": "string",
"required": false,
"description": "Submitter role name for the field."
},
"default_value": {
"type": "string",
"required": false,
"description": "Default value of the field."
},
"title": {
"type": "string",
"required": false,
"description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown."
},
"description": {
"type": "string",
"required": false,
"description": "Field description displayed on the signing form. Supports Markdown."
},
"width": {
"type": "number",
"required": false,
"description": "Field width in pixels."
},
"height": {
"type": "number",
"required": false,
"description": "Field height in pixels."
},
"format": {
"type": "string",
"required": false,
"description": "Field format. Depends on the field type."
},
"options": {
"type": "array",
"required": false,
"description": "Field options. Required for the select field type."
},
"validation": {
"type": "object",
"required": false,
"description": "Field validation rules.",
"properties": {
"pattern": {
"type": "string",
"required": false,
"description": "Field pattern.",
"example": "^[0-9]{5}$"
},
"message": {
"type": "string",
"required": false,
"description": "Validation error message."
}
}
}
}
}
},
"emailMessage": {
"type": "object",
"required": false,
"description": "Email subject and body for the signature request.",
"properties": {
"subject": {
"type": "string",
"required": true,
"description": "Email subject for the signature request."
},
"body": {
"type": "string",
"required": true,
"description": "Email body for the signature request."
}
}
},
"withTitle": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove document title from the builder."
},
"withSendButton": {
"type": "boolean",
"required": false,
"default": true,
"description": "Show the \"Send\" button."
},
"withUploadButton": {
"type": "boolean",
"required": false,
"default": true,
"description": "Show the \"Upload\" button."
},
"withAddPageButton": {
"type": "boolean",
"required": false,
"default": false,
"description": "Show the \"Add Blank Page\" button."
},
"withSignYourselfButton": {
"type": "boolean",
"required": false,
"default": true,
"description": "Show the \"Sign Yourself\" button."
},
"withDocumentsList": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to now show the documents list on the left. Documents list is displayed by default."
},
"withFieldsList": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to now show the fields list on the right. Fields list is displayed by default."
},
"withFieldPlaceholder": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display field name placeholders instead of the field type icons."
},
"onlyDefinedFields": {
"type": "boolean",
"required": false,
"default": false,
"description": "Allow to add fields only defined in the `fields` prop."
},
"preview": {
"type": "boolean",
"required": false,
"default": false,
"description": "Show template in preview mode without ability to edit it."
},
"autosave": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disable form changes autosaving."
},
"language": {
"type": "string",
"required": false,
"default": "en",
"description": "UI language, 'en', 'es', 'de', 'fr', 'pt', 'he', 'ar' languages are available."
},
"i18n": {
"type": "object",
"required": false,
"default": "{}",
"description": "Object that contains i18n keys to replace the default UI text with custom values. See <a href=\"https://github.com/docusealco/docuseal/blob/master/app/javascript/template_builder/i18n.js\" class=\"link\" target=\"_blank\" rel=\"nofollow\">template_builder/i18n.js</a> for available i18n keys."
},
"backgroundColor": {
"type": "string",
"required": false,
"description": "The form builder background color. Only HEX color codes are supported.",
"example": "#ffffff"
},
"customCss": {
"type": "string",
"required": false,
"description": "Custom CSS styles to be applied to the form builder.",
"example": "#sign_yourself_button { background-color: #FFA500; }"
}
}
```
### Callback
```json
{
"onLoad": {
"type": "function",
"required": false,
"description": "Function to be called on loading the form builder template data.",
"example": "(data) => { console.log(data) }"
},
"onUpload": {
"type": "function",
"required": false,
"description": "Function to be called on uploading a document to the template.",
"example": "(data) => { console.log(data) }"
},
"onSend": {
"type": "function",
"required": false,
"description": "Function to be called on sending documents for signature to recipients.",
"example": "(data) => { console.log(data) }"
},
"onChange": {
"type": "function",
"required": false,
"description": "Function to be called when changes are made to the template form.",
"example": "(data) => { console.log(data) }"
},
"onSave": {
"type": "function",
"required": false,
"description": "Function to be called on saving changes of the template form.",
"example": "(data) => { console.log(data) }"
}
}
```

@ -0,0 +1,513 @@
# Vue Form Builder
### Example Code
```vue
<template>
<DocusealBuilder
v-if="token"
:token="token"
/>
</template>
<script>
import { DocusealBuilder } from '@docuseal/vue'
export default {
name: 'App',
components: { DocusealBuilder },
data () {
return { token: '' }
},
mounted () {
fetch('/api/docuseal/builder_token', {
method: 'POST'
}).then(async (resp) => {
const data = await resp.json()
this.token = data.token
})
}
}
</script>
```
```javascript
const jwt = require('jsonwebtoken');
const token = jwt.sign({
user_email: '{{admin_user_email}}',
integration_email: '{{signer_email}}',
external_id: 'TestForm123',
name: 'Integration W-9 Test Form',
document_urls: ['https://www.irs.gov/pub/irs-pdf/fw9.pdf'],
}, '{{api_key}}');
```
### Attributes
```json
{
"token": {
"type": "string",
"doc_type": "object",
"description": "JSON Web Token (JWT HS256) with a payload signed using the API key. <br><b>Ensure that the JWT token is generated on the backend to prevent unauthorized access to your documents</b>.",
"required": true,
"properties": {
"user_email": {
"type": "string",
"required": true,
"description": "Email of the owner of the API signing key - admin user email."
},
"integration_email": {
"type": "string",
"required": false,
"description": "Email of the user to create a template for.",
"example": "signer@example.com"
},
"template_id": {
"type": "number",
"required": false,
"description": "ID of the template to open in the form builder. Optional when `document_urls` are specified."
},
"external_id": {
"type": "string",
"description": "Your application-specific unique string key to identify this template within your app.",
"required": false
},
"folder_name": {
"type": "string",
"description": "The folder name in which the template should be created.",
"required": false
},
"document_urls": {
"type": "array",
"required": false,
"description": "An Array of URLs with PDF files to open in the form builder. Optional when `template_id` is specified.",
"example": "['https://www.irs.gov/pub/irs-pdf/fw9.pdf']"
},
"name": {
"type": "string",
"required": false,
"description": "New template name when creating a template with document_urls specified.",
"example": "Integration W-9 Test Form"
},
"extract_fields": {
"type": "boolean",
"required": false,
"description": "Pass `false` to disable automatic PDF form fields extraction. PDF fields are automatically added by default."
}
}
},
"host": {
"type": "string",
"required": false,
"description": "DocuSeal host domain name. Only use this attribute if you are using the on-premises DocuSeal installation or docuseal.eu Cloud.",
"example": "yourdomain.com"
},
"custom-button": {
"type": "object",
"required": false,
"description": "Custom button will be displayed on the top right corner of the form builder.",
"properties": {
"title": {
"type": "string",
"required": true,
"description": "Custom button title."
},
"url": {
"type": "string",
"required": true,
"description": "Custom button URL. Only absolute URLs are supported."
}
}
},
"only-defined-fields": {
"type": "boolean",
"required": false,
"default": false,
"description": "Allow to add fields only defined in the `:fields` prop."
},
"with-send-button": {
"type": "boolean",
"required": false,
"default": true,
"description": "Show the \"Recipients\" button."
},
"roles": {
"type": "array",
"required": false,
"description": "Submitter role names to be used by default in the form."
},
"field-types": {
"type": "array",
"required": false,
"description": "Field type names to be used in the form builder. All field types are used by default."
},
"draw-field-type": {
"type": "string",
"required": false,
"default": "text",
"description": "Field type to be used by default with the field drawing tool.",
"example": "signature"
},
"fields": {
"type": "array",
"required": false,
"description": "An array of default custom field properties with `name` to be added to the document.",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true,
"description": "Field name."
},
"type": {
"type": "string",
"required": false,
"description": "Field type.",
"enum": [
"heading",
"text",
"signature",
"initials",
"date",
"number",
"image",
"checkbox",
"multiple",
"file",
"radio",
"select",
"cells",
"stamp",
"payment",
"phone",
"verification"
]
},
"role": {
"type": "string",
"required": false,
"description": "Submitter role name for the field."
},
"default_value": {
"type": "string",
"required": false,
"description": "Default value of the field."
},
"title": {
"type": "string",
"required": false,
"description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown."
},
"description": {
"type": "string",
"required": false,
"description": "Field description displayed on the signing form. Supports Markdown."
},
"width": {
"type": "number",
"required": false,
"description": "Field width in pixels."
},
"height": {
"type": "number",
"required": false,
"description": "Field height in pixels."
},
"format": {
"type": "string",
"required": false,
"description": "Field format. Depends on the field type."
},
"options": {
"type": "array",
"required": false,
"description": "Field options. Required for the select field type."
},
"validation": {
"type": "object",
"required": false,
"description": "Field validation rules.",
"properties": {
"pattern": {
"type": "string",
"required": false,
"description": "Field pattern.",
"example": "^[0-9]{5}$"
},
"message": {
"type": "string",
"required": false,
"description": "Validation error message."
}
}
}
}
}
},
"submitters": {
"type": "array",
"required": false,
"description": "An array of default submitters with `role` name to be added to the document.",
"items": {
"type": "object",
"properties": {
"email": {
"type": "string",
"required": false,
"description": "Submitter email."
},
"role": {
"type": "string",
"required": true,
"description": "Submitter role name."
},
"name": {
"type": "string",
"required": false,
"description": "Submitter name."
},
"phone": {
"type": "string",
"required": false,
"description": "Submitter phone number, formatted according to the E.164 standard."
}
}
}
},
"required-fields": {
"type": "array",
"required": false,
"description": "An array of default required custom field properties with `name` that should be added to the document.",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true,
"description": "Field name."
},
"type": {
"type": "string",
"required": false,
"description": "Field type.",
"enum": [
"heading",
"text",
"signature",
"initials",
"date",
"number",
"image",
"checkbox",
"multiple",
"file",
"radio",
"select",
"cells",
"stamp",
"payment",
"phone",
"verification"
]
},
"role": {
"type": "string",
"required": false,
"description": "Submitter role name for the field."
},
"default_value": {
"type": "string",
"required": false,
"description": "Default value of the field."
},
"title": {
"type": "string",
"required": false,
"description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown."
},
"description": {
"type": "string",
"required": false,
"description": "Field description displayed on the signing form. Supports Markdown."
},
"width": {
"type": "number",
"required": false,
"description": "Field width in pixels."
},
"height": {
"type": "number",
"required": false,
"description": "Field height in pixels."
},
"format": {
"type": "string",
"required": false,
"description": "Field format. Depends on the field type."
},
"options": {
"type": "array",
"required": false,
"description": "Field options. Required for the select field type."
},
"validation": {
"type": "object",
"required": false,
"description": "Field validation rules.",
"properties": {
"pattern": {
"type": "string",
"required": false,
"description": "Field pattern.",
"example": "^[0-9]{5}$"
},
"message": {
"type": "string",
"required": false,
"description": "Validation error message."
}
}
}
}
}
},
"email-message": {
"type": "object",
"required": false,
"description": "Email subject and body for the signature request.",
"properties": {
"subject": {
"type": "string",
"required": true,
"description": "Email subject for the signature request."
},
"body": {
"type": "string",
"required": true,
"description": "Email body for the signature request."
}
}
},
"with-title": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove document title from the builder."
},
"with-upload-button": {
"type": "boolean",
"required": false,
"default": true,
"description": "Show the \"Upload\" button."
},
"with-add-page-button": {
"type": "boolean",
"required": false,
"default": false,
"description": "Show the \"Add Blank Page\" button."
},
"with-sign-yourself-button": {
"type": "boolean",
"required": false,
"default": true,
"description": "Show the \"Sign Yourself\" button."
},
"with-documents-list": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to now show the documents list on the left. Documents list is displayed by default."
},
"with-fields-list": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to now show the fields list on the right. Fields list is displayed by default."
},
"with-field-placeholder": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display field name placeholders instead of the field type icons."
},
"autosave": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disable form changes autosaving."
},
"preview": {
"type": "boolean",
"required": false,
"default": false,
"description": "Show template in preview mode without ability to edit it."
},
"language": {
"type": "string",
"required": false,
"default": "en",
"description": "UI language, 'en', 'es', 'de', 'fr', 'pt', 'he', 'ar' languages are available."
},
"i18n": {
"type": "object",
"required": false,
"default": "{}",
"description": "Object that contains i18n keys to replace the default UI text with custom values. See <a href=\"https://github.com/docusealco/docuseal/blob/master/app/javascript/template_builder/i18n.js\" class=\"link\" target=\"_blank\" rel=\"nofollow\">template_builder/i18n.js</a> for available i18n keys."
},
"background-color": {
"type": "string",
"required": false,
"description": "The form builder background color. Only HEX color codes are supported.",
"example": "#ffffff"
},
"custom-css": {
"type": "string",
"required": false,
"description": "Custom CSS styles to be applied to the form builder.",
"example": "#sign_yourself_button { background-color: #FFA500; }"
}
}
```
### Callback
```json
{
"@load": {
"type": "function",
"required": false,
"description": "Function to be called on loading the form builder template data.",
"example": "onBuilderLoad"
},
"@upload": {
"type": "function",
"required": false,
"description": "Function to be called on uploading a document to the template.",
"example": "onBuilderUpload"
},
"@send": {
"type": "function",
"required": false,
"description": "Function to be called on sending documents for signature to recipients.",
"example": "onBuilderSend"
},
"@change": {
"type": "function",
"required": false,
"description": "Function to be called when changes are made to the template form.",
"example": "onBuilderChange"
},
"@save": {
"type": "function",
"required": false,
"description": "Function to be called on saving changes of the template form.",
"example": "onBuilderSave"
}
}
```

@ -0,0 +1,295 @@
# Angular Signing Form
### Example Code
```angular
import { Component } from '@angular/core';
import { DocusealFormComponent } from '@docuseal/angular';
@Component({
selector: 'app-root',
standalone: true,
imports: [DocusealFormComponent],
template: `
<div class="app">
<docuseal-form
[src]="'https://docuseal.com/d/{{template_slug}}'"
[email]="'{{signer_email}}'">
</docuseal-form>
</div>
`
})
export class AppComponent {}
```
### Attributes
```json
{
"src": {
"type": "string",
"required": true,
"description": "Public URL of the document signing form. There are two types of URLs: <li><code>/d/{slug}</code> - template form signing URL can be copied from the template page in the admin dashboard. Also template \"slug\" key can be obtained via the <code>/templates</code> API.</li><li><code>/s/{slug}</code> - individual signer URL. Signer \"slug\" key can be obtained via the <code>/submissions</code> API which is used to initiate signature requests for a template form with recipients.</li>"
},
"email": {
"type": "string",
"required": false,
"description": "Email address of the signer. Additional email form step will be displayed if the email attribute is not specified."
},
"name": {
"type": "string",
"required": false,
"description": "Name of the signer."
},
"role": {
"type": "string",
"required": false,
"description": "The role name or title of the signer.",
"example": "First Party"
},
"expand": {
"type": "boolean",
"required": false,
"description": "Expand form on open.",
"default": true
},
"minimize": {
"type": "boolean",
"required": false,
"description": "Set to `true` to always minimize form fields. Requires to click on the field to expand the form.",
"default": false
},
"orderAsOnPage": {
"type": "boolean",
"required": false,
"default": false,
"description": "Order form fields based on their position on the pages."
},
"externalId": {
"type": "string",
"required": false,
"description": "Your application-specific unique string key to identify signer within your app."
},
"logo": {
"type": "string",
"required": false,
"description": "Public logo image URL to use in the signing form."
},
"language": {
"type": "string",
"required": false,
"description": "UI language: en, es, it, de, fr, nl, pl, uk, cs, pt, he, ar, kr, ja languages are available. Be default the form is displayed in the user browser language automatically."
},
"i18n": {
"type": "object",
"required": false,
"default": "{}",
"description": "Object that contains i18n keys to replace the default UI text with custom values. See <a href=\"https://github.com/docusealco/docuseal/blob/master/app/javascript/submission_form/i18n.js\" class=\"link\" target=\"_blank\" rel=\"nofollow\">submission_form/i18n.js</a> for available i18n keys."
},
"preview": {
"type": "boolean",
"required": false,
"default": false,
"description": "Show form in preview mode without ability to submit it."
},
"goToLast": {
"type": "boolean",
"required": false,
"default": true,
"description": "Navigate to the last unfinished step."
},
"withFieldNames": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to hide field name. Hidding field names can be useful for when they are not in the human readable format. Field names are displayed by default."
},
"withFieldPlaceholder": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display field name placeholders instead of the field type icons."
},
"skipFields": {
"type": "boolean",
"required": false,
"default": false,
"description": "Allow skipping form fields."
},
"autoscrollFields": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disable auto-scrolling to the next document field."
},
"sendCopyEmail": {
"type": "boolean",
"required": false,
"description": "Set `false` to disable automatic email sending with signed documents to the signers. Emails with signed documents are sent to the signers by default."
},
"backgroundColor": {
"type": "string",
"required": false,
"description": "Form background color. Only HEX color codes are supported.",
"example": "#d9d9d9"
},
"completedRedirectUrl": {
"type": "string",
"required": false,
"description": "URL to redirect to after the submission completion.",
"example": "https://docuseal.com/success"
},
"completedMessage": {
"type": "object",
"required": false,
"description": "Message displayed after the form completion.",
"properties": {
"title": {
"type": "string",
"required": false,
"description": "Message title.",
"example": "Documents have been signed!"
},
"body": {
"type": "string",
"required": false,
"description": "Message content.",
"example": "If you have any questions, please contact us."
}
}
},
"completedButton": {
"type": "object",
"required": false,
"description": "Customizable button after form completion.",
"properties": {
"title": {
"type": "string",
"required": true,
"description": "Button label.",
"example": "Go Back"
},
"url": {
"type": "string",
"required": true,
"description": "Button link. Only absolute URLs are supported.",
"example": "https://example.com"
}
}
},
"withTitle": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove the document title from the form."
},
"withDecline": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display the decline button in the form."
},
"withDownloadButton": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove the signed document download button from the completed form card."
},
"withSendCopyButton": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove the signed document send email button from the completed form card."
},
"withCompleteButton": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display the complete button in the form header."
},
"allowToResubmit": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disallow user to re-submit the form."
},
"signature": {
"type": "string",
"required": false,
"description": "Allows pre-filling signature fields. The value can be a base64 encoded image string, a public URL to an image, or plain text that will be rendered as a typed signature using a standard font."
},
"rememberSignature": {
"type": "boolean",
"required": false,
"description": "Allows to specify whether the signature should be remembered for future use. Remembered signatures are stored in the signer's browser local storage and can be automatically reused to prefill signature fields in new forms for the signer when the value is set to `true`."
},
"reuseSignature": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to not reuse the signature in the second signature field and collect a new one."
},
"allowTypedSignature": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disallow users to type their signature."
},
"values": {
"type": "object",
"required": false,
"description": "Pre-assigned values for form fields.",
"example": "{ 'First Name': 'Jon', 'Last Name': 'Doe' }"
},
"metadata": {
"type": "object",
"required": false,
"description": "Metadata object with additional signer information.",
"example": "{ customData: 'custom value' }"
},
"readonlyFields": {
"type": "array",
"required": false,
"description": "List of read-only fields.",
"example": "['First Name','Last Name']"
},
"customCss": {
"type": "string",
"required": false,
"description": "Custom CSS styles to be applied to the form.",
"example": "#submit_form_button { background-color: #d9d9d9; }"
}
}
```
### Callback
```json
{
"onInit": {
"type": "event emitter",
"required": false,
"description": "Event emitted on initializing the form component.",
"example": "handleInit($event)"
},
"onLoad": {
"type": "event emitter",
"required": false,
"description": "Event emitted on loading the form data.",
"example": "handleLoad($event)"
},
"onComplete": {
"type": "event emitter",
"required": false,
"description": "Event emitted the form completion.",
"example": "handleComplete($event)"
},
"onDecline": {
"type": "event emitter",
"required": false,
"description": "Event emitted after the form decline.",
"example": "handleDecline($event)"
}
}
```

@ -0,0 +1,275 @@
# JavaScript Signing Form
### Example Code
```javascript
<script src="https://cdn.docuseal.com/js/form.js"></script>
<docuseal-form
id="docusealForm"
data-src="https://docuseal.com/d/{{template_slug}}"
data-email="{{signer_email}}">
</docuseal-form>
<script>
window.docusealForm.addEventListener('completed', (e) => e.detail)
</script>
```
### Attributes
```json
{
"data-src": {
"type": "string",
"required": true,
"description": "Public URL of the document signing form. There are two types of URLs: <li><code>/d/{slug}</code> - template form signing URL can be copied from the template page in the admin dashboard. Also template \"slug\" key can be obtained via the <code>/templates</code> API.</li><li><code>/s/{slug}</code> - individual signer URL. Signer \"slug\" key can be obtained via the <code>/submissions</code> API which is used to initiate signature requests for a template form with recipients.</li>"
},
"data-email": {
"type": "string",
"required": false,
"description": "Email address of the signer. Additional email form step will be displayed if the email attribute is not specified."
},
"data-name": {
"type": "string",
"required": false,
"description": "Name of the signer."
},
"data-role": {
"type": "string",
"required": false,
"description": "The role name or title of the signer.",
"example": "First Party"
},
"data-expand": {
"type": "boolean",
"required": false,
"description": "Expand form on open.",
"default": true
},
"data-minimize": {
"type": "boolean",
"required": false,
"description": "Set to `true` to always minimize form fields. Requires to click on the field to expand the form.",
"default": false
},
"data-order-as-on-page": {
"type": "boolean",
"required": false,
"default": false,
"description": "Order form fields based on their position on the pages."
},
"data-preview": {
"type": "boolean",
"required": false,
"default": false,
"description": "Show form in preview mode without ability to submit it."
},
"data-logo": {
"type": "string",
"required": false,
"description": "Public logo image URL to use in the signing form."
},
"data-language": {
"type": "string",
"required": false,
"description": "UI language: en, es, it, de, fr, nl, pl, uk, cs, pt, he, ar, kr, ja languages are available. Be default the form is displayed in the user browser language automatically."
},
"data-i18n": {
"type": "string",
"required": false,
"default": "{}",
"description": "JSON encoded string that contains i18n keys to replace the default UI text with custom values. See <a href=\"https://github.com/docusealco/docuseal/blob/master/app/javascript/submission_form/i18n.js\" class=\"link\" target=\"_blank\" rel=\"nofollow\">submission_form/i18n.js</a> for available i18n keys."
},
"data-go-to-last": {
"type": "boolean",
"required": false,
"default": true,
"description": "Navigate to the last unfinished step."
},
"data-skip-fields": {
"type": "boolean",
"required": false,
"default": false,
"description": "Allow skipping form fields."
},
"data-autoscroll-fields": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disable auto-scrolling to the next document field."
},
"data-send-copy-email": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disable automatic email sending with signed documents to the signers. Emails with signed documents are sent to the signers by default."
},
"data-with-title": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove the document title from the form."
},
"data-with-decline": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display the decline button in the form."
},
"data-with-field-names": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to hide field name. Hidding field names can be useful for when they are not in the human readable format. Field names are displayed by default."
},
"data-with-field-placeholder": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display field name placeholders instead of the field type icons."
},
"data-with-download-button": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove the signed document download button from the completed form card."
},
"data-with-send-copy-button": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove the signed document send email button from the completed form card."
},
"data-with-complete-button": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display the complete button in the form header."
},
"data-allow-to-resubmit": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disallow users to re-submit the form."
},
"data-allow-typed-signature": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disallow users to type their signature."
},
"data-signature": {
"type": "string",
"required": false,
"description": "Allows pre-filling signature fields. The value can be a base64 encoded image string, a public URL to an image, or plain text that will be rendered as a typed signature using a standard font."
},
"data-remember-signature": {
"type": "boolean",
"required": false,
"description": "Allows to specify whether the signature should be remembered for future use. Remembered signatures are stored in the signer's browser local storage and can be automatically reused to prefill signature fields in new forms for the signer when the value is set to `true`."
},
"data-reuse-signature": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to not reuse the signature in the second signature field and collect a new one."
},
"data-background-color": {
"type": "string",
"required": false,
"description": "Form background color. Only HEX color codes are supported.",
"example": "#d9d9d9"
},
"data-values": {
"type": "object",
"required": false,
"description": "Pre-assigned values for form fields.",
"example": "{\"First Name\":\"Jon\",\"Last Name\":\"Doe\"}"
},
"data-external-id": {
"type": "string",
"required": false,
"description": "Your application-specific unique string key to identify signer within your app."
},
"data-metadata": {
"type": "object",
"required": false,
"description": "Signer metadata Object in JSON format. ",
"example": "{\"customData\":\"customValue\"}"
},
"data-readonly-fields": {
"type": "string",
"required": false,
"description": "Comma separated read-only field names",
"example": "First Name,Last Name"
},
"data-completed-redirect-url": {
"type": "string",
"required": false,
"description": "URL to redirect to after the submission completion.",
"example": "https://docuseal.com/success"
},
"data-completed-message-title": {
"type": "string",
"required": false,
"description": "Message title displayed after the form completion.",
"example": "Documents have been completed"
},
"data-completed-message-body": {
"type": "string",
"required": false,
"description": "Message body displayed after the form completion.",
"example": "If you have any questions, please contact us."
},
"data-completed-button-title": {
"type": "string",
"required": false,
"description": "Button title displayed after the form completion.",
"example": "Go Back"
},
"data-completed-button-url": {
"type": "string",
"required": false,
"description": "URL of the button displayed after the form completion.",
"example": "https://example.com"
},
"data-custom-css": {
"type": "string",
"required": false,
"description": "Custom CSS styles to be applied to the form.",
"example": "#submit_form_button { background-color: #d9d9d9; }"
}
}
```
### Callback
```json
{
"init": {
"type": "event",
"required": false,
"description": "Custom event to be triggered on initializing the form component.",
"example": "document.querySelector('docuseal-form').addEventListener('init', () => console.log('init'))"
},
"load": {
"type": "event",
"required": false,
"description": "Custom event to be triggered on loading the form data.",
"example": "document.querySelector('docuseal-form').addEventListener('load', (e) => e.detail)"
},
"completed": {
"type": "event",
"required": false,
"description": "Custom event to be triggered after form completion.",
"example": "document.querySelector('docuseal-form').addEventListener('completed', (e) => e.detail)"
},
"declined": {
"type": "event",
"description": "Custom event to be triggered after form decline.",
"example": "document.querySelector('docuseal-form').addEventListener('declined', (e) => e.detail)"
}
}
```

@ -0,0 +1,292 @@
# React Signing Form
### Example Code
```react
import React from "react"
import { DocusealForm } from '@docuseal/react'
export function App() {
return (
<div className="app">
<DocusealForm
src="https://docuseal.com/d/{{template_slug}}"
email="{{signer_email}}"
onComplete={(data) => console.log(data)}
/>
</div>
);
}
```
### Attributes
```json
{
"src": {
"type": "string",
"required": true,
"description": "Public URL of the document signing form. There are two types of URLs: <li><code>/d/{slug}</code> - template form signing URL can be copied from the template page in the admin dashboard. Also template \"slug\" key can be obtained via the <code>/templates</code> API.</li><li><code>/s/{slug}</code> - individual signer URL. Signer \"slug\" key can be obtained via the <code>/submissions</code> API which is used to initiate signature requests for a template form with recipients.</li>"
},
"email": {
"type": "string",
"required": false,
"description": "Email address of the signer. Additional email form step will be displayed if the email attribute is not specified."
},
"name": {
"type": "string",
"required": false,
"description": "Name of the signer."
},
"role": {
"type": "string",
"required": false,
"description": "The role name or title of the signer.",
"example": "First Party"
},
"expand": {
"type": "boolean",
"required": false,
"description": "Expand form on open.",
"default": true
},
"minimize": {
"type": "boolean",
"required": false,
"description": "Set to `true` to always minimize form fields. Requires to click on the field to expand the form.",
"default": false
},
"orderAsOnPage": {
"type": "boolean",
"required": false,
"default": false,
"description": "Order form fields based on their position on the pages."
},
"externalId": {
"type": "string",
"required": false,
"description": "Your application-specific unique string key to identify signer within your app."
},
"logo": {
"type": "string",
"required": false,
"description": "Public logo image URL to use in the signing form."
},
"language": {
"type": "string",
"required": false,
"description": "UI language: en, es, it, de, fr, nl, pl, uk, cs, pt, he, ar, kr, ja languages are available. Be default the form is displayed in the user browser language automatically."
},
"i18n": {
"type": "object",
"required": false,
"default": "{}",
"description": "Object that contains i18n keys to replace the default UI text with custom values. See <a href=\"https://github.com/docusealco/docuseal/blob/master/app/javascript/submission_form/i18n.js\" class=\"link\" target=\"_blank\" rel=\"nofollow\">submission_form/i18n.js</a> for available i18n keys."
},
"preview": {
"type": "boolean",
"required": false,
"default": false,
"description": "Show form in preview mode without ability to submit it."
},
"goToLast": {
"type": "boolean",
"required": false,
"default": true,
"description": "Navigate to the last unfinished step."
},
"withFieldNames": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to hide field name. Hidding field names can be useful for when they are not in the human readable format. Field names are displayed by default."
},
"withFieldPlaceholder": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display field name placeholders instead of the field type icons."
},
"skipFields": {
"type": "boolean",
"required": false,
"default": false,
"description": "Allow skipping form fields."
},
"autoscrollFields": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disable auto-scrolling to the next document field."
},
"sendCopyEmail": {
"type": "boolean",
"required": false,
"description": "Set `false` to disable automatic email sending with signed documents to the signers. Emails with signed documents are sent to the signers by default."
},
"backgroundColor": {
"type": "string",
"required": false,
"description": "Form background color. Only HEX color codes are supported.",
"example": "#d9d9d9"
},
"completedRedirectUrl": {
"type": "string",
"required": false,
"description": "URL to redirect to after the submission completion.",
"example": "https://docuseal.com/success"
},
"completedMessage": {
"type": "object",
"required": false,
"description": "Message displayed after the form completion.",
"properties": {
"title": {
"type": "string",
"required": false,
"description": "Message title.",
"example": "Documents have been signed!"
},
"body": {
"type": "string",
"required": false,
"description": "Message content.",
"example": "If you have any questions, please contact us."
}
}
},
"completedButton": {
"type": "object",
"required": false,
"description": "Customizable button after form completion.",
"properties": {
"title": {
"type": "string",
"required": true,
"description": "Button label.",
"example": "Go Back"
},
"url": {
"type": "string",
"required": true,
"description": "Button link. Only absolute URLs are supported.",
"example": "https://example.com"
}
}
},
"withTitle": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove the document title from the form."
},
"withDecline": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display the decline button in the form."
},
"withDownloadButton": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove the signed document download button from the completed form card."
},
"withSendCopyButton": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove the signed document send email button from the completed form card."
},
"withCompleteButton": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display the complete button in the form header."
},
"allowToResubmit": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disallow user to re-submit the form."
},
"allowTypedSignature": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disallow users to type their signature."
},
"signature": {
"type": "string",
"required": false,
"description": "Allows pre-filling signature fields. The value can be a base64 encoded image string, a public URL to an image, or plain text that will be rendered as a typed signature using a standard font."
},
"rememberSignature": {
"type": "boolean",
"required": false,
"description": "Allows to specify whether the signature should be remembered for future use. Remembered signatures are stored in the signer's browser local storage and can be automatically reused to prefill signature fields in new forms for the signer when the value is set to `true`."
},
"reuseSignature": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to not reuse the signature in the second signature field and collect a new one."
},
"values": {
"type": "object",
"required": false,
"description": "Pre-assigned values for form fields.",
"example": "{ 'First Name': 'Jon', 'Last Name': 'Doe' }"
},
"metadata": {
"type": "object",
"required": false,
"description": "Metadata object with additional signer information.",
"example": "{ customData: 'custom value' }"
},
"readonlyFields": {
"type": "array",
"required": false,
"description": "List of read-only fields.",
"example": "['First Name','Last Name']"
},
"customCss": {
"type": "string",
"required": false,
"description": "Custom CSS styles to be applied to the form.",
"example": "#submit_form_button { background-color: #d9d9d9; }"
}
}
```
### Callback
```json
{
"onInit": {
"type": "function",
"required": false,
"description": "Function to be called on initializing the form component.",
"example": "() => { console.log(\"Loaded\") }"
},
"onLoad": {
"type": "function",
"required": false,
"description": "Function to be called on loading the form data.",
"example": "(data) => { console.log(data) }"
},
"onComplete": {
"type": "function",
"required": false,
"description": "Function to be called after the form completion.",
"example": "(data) => { console.log(data) }"
},
"onDecline": {
"type": "function",
"required": false,
"description": "Function to be called after the form decline.",
"example": "(data) => { console.log(data) }"
}
}
```

@ -0,0 +1,302 @@
# Vue Signing Form
### Example Code
```vue
<template>
<DocusealForm
:src="'https://docuseal.com/d/{{template_slug}}'"
:email="'{{signer_email}}'"
@complete="onFormComplete"
/>
</template>
<script>
import { DocusealForm } from '@docuseal/vue'
export default {
name: 'App',
components: {
DocusealForm
},
methods: {
onFormComplete (data) {
console.log(data)
}
}
}
</script>
```
### Attributes
```json
{
"src": {
"type": "string",
"required": true,
"description": "Public URL of the document signing form. There are two types of URLs: <li><code>/d/{slug}</code> - template form signing URL can be copied from the template page in the admin dashboard. Also template \"slug\" key can be obtained via the <code>/templates</code> API.</li><li><code>/s/{slug}</code> - individual signer URL. Signer \"slug\" key can be obtained via the <code>/submissions</code> API which is used to initiate signature requests for a template form with recipients.</li>"
},
"email": {
"type": "string",
"required": false,
"description": "Email address of the signer. Additional email form step will be displayed if the email attribute is not specified."
},
"name": {
"type": "string",
"required": false,
"description": "Name of the signer."
},
"role": {
"type": "string",
"required": false,
"description": "The role name or title of the signer.",
"example": "First Party"
},
"external-id": {
"type": "string",
"required": false,
"description": "Your application-specific unique string key to identify signer within your app."
},
"expand": {
"type": "boolean",
"required": false,
"description": "Expand form on open.",
"default": true
},
"minimize": {
"type": "boolean",
"required": false,
"description": "Set to `true` to always minimize form fields. Requires to click on the field to expand the form.",
"default": false
},
"order-as-on-page": {
"type": "boolean",
"required": false,
"default": false,
"description": "Order form fields based on their position on the pages."
},
"logo": {
"type": "string",
"required": false,
"description": "Public logo image URL to use in the signing form."
},
"language": {
"type": "string",
"required": false,
"description": "UI language: en, es, it, de, fr, nl, pl, uk, cs, pt, he, ar, kr, ja languages are available. Be default the form is displayed in the user browser language automatically."
},
"i18n": {
"type": "object",
"required": false,
"default": "{}",
"description": "Object that contains i18n keys to replace the default UI text with custom values. See <a href=\"https://github.com/docusealco/docuseal/blob/master/app/javascript/submission_form/i18n.js\" class=\"link\" target=\"_blank\" rel=\"nofollow\">submission_form/i18n.js</a> for available i18n keys."
},
"preview": {
"type": "boolean",
"required": false,
"default": false,
"description": "Show form in preview mode without ability to submit it."
},
"go-to-last": {
"type": "boolean",
"required": false,
"default": true,
"description": "Navigate to the last unfinished step."
},
"skip-fields": {
"type": "boolean",
"required": false,
"default": false,
"description": "Allow skipping form fields."
},
"autoscroll-fields": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disable auto-scrolling to the next document field."
},
"with-field-names": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to hide field name. Hidding field names can be useful for when they are not in the human readable format. Field names are displayed by default."
},
"with-field-placeholder": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display field name placeholders instead of the field type icons."
},
"send-copy-email": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disable automatic email sending with signed documents to the signers. Emails with signed documents are sent to the signers by default."
},
"background-color": {
"type": "string",
"required": false,
"description": "Form background color. Only HEX color codes are supported.",
"example": "#d9d9d9"
},
"with-title": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove the document title from the form."
},
"with-decline": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display the decline button in the form."
},
"with-download-button": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove the signed document download button from the completed form card."
},
"with-send-copy-button": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to remove the signed document send email button from the completed form card."
},
"with-complete-button": {
"type": "boolean",
"required": false,
"default": false,
"description": "Set `true` to display the complete button in the form header."
},
"allow-to-resubmit": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disallow user to re-submit the form."
},
"signature": {
"type": "string",
"required": false,
"description": "Allows pre-filling signature fields. The value can be a base64 encoded image string, a public URL to an image, or plain text that will be rendered as a typed signature using a standard font."
},
"remember-signature": {
"type": "boolean",
"required": false,
"description": "Allows to specify whether the signature should be remembered for future use. Remembered signatures are stored in the signer's browser local storage and can be automatically reused to prefill signature fields in new forms for the signer when the value is set to `true`."
},
"reuse-signature": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to not reuse the signature in the second signature field and collect a new one."
},
"allow-typed-signature": {
"type": "boolean",
"required": false,
"default": true,
"description": "Set `false` to disallow users to type their signature."
},
"completed-redirect-url": {
"type": "string",
"required": false,
"description": "URL to redirect to after the submission completion.",
"example": "https://docuseal.com/success"
},
"completed-message": {
"type": "object",
"required": false,
"description": "Message displayed after the form completion.",
"properties": {
"title": {
"type": "string",
"required": false,
"description": "Message title.",
"example": "Documents have been signed!"
},
"body": {
"type": "string",
"required": false,
"description": "Message content.",
"example": "If you have any questions, please contact us."
}
}
},
"completed-button": {
"type": "object",
"required": false,
"description": "Customizable button after form completion.",
"properties": {
"title": {
"type": "string",
"required": true,
"description": "Button label.",
"example": "Go Back"
},
"url": {
"type": "string",
"required": true,
"description": "Button link. Only absolute URLs are supported.",
"example": "https://example.com"
}
}
},
"values": {
"type": "object",
"required": false,
"description": "Pre-assigned values for form fields.",
"example": "{ 'First Name': 'Jon', 'Last Name': 'Doe' }"
},
"metadata": {
"type": "object",
"required": false,
"description": "Metadata object with additional signer information.",
"example": "{ customData: 'custom value' }"
},
"readonly-fields": {
"type": "array",
"required": false,
"description": "List of read-only fields.",
"example": "['First Name','Last Name']"
},
"custom-css": {
"type": "string",
"required": false,
"description": "Custom CSS styles to be applied to the form.",
"example": "#submit_form_button { background-color: #d9d9d9; }"
}
}
```
### Callback
```json
{
"@init": {
"type": "function",
"required": false,
"description": "Function to be called on initializing the form component.",
"example": "onFormLoad"
},
"@load": {
"type": "function",
"required": false,
"description": "Function to be called on loading the form data.",
"example": "onFormLoad"
},
"@complete": {
"type": "function",
"required": false,
"description": "Function to be called after the form completion.",
"example": "onFormComplete"
},
"@decline": {
"type": "function",
"required": false,
"description": "Function to be called after the form decline.",
"example": "onFormDecline"
}
}
```

File diff suppressed because it is too large Load Diff

@ -0,0 +1,247 @@
# Form Webhook
During the form filling and signing process, 3 types of events may occur and are dispatched at different stages:
- **'form.viewed'** event is triggered when the submitter first opens the form.
- **'form.started'** event is triggered when the submitter initiates filling out the form.
- **'form.completed'** event is triggered upon successful form completion and signing by one of the parties.
- **'form.declined'** event is triggered when a signer declines the submission.
It's important to note that each of these events contain information available at the time of dispatch, so some data may be missing or incomplete depending on the specific event. Failed webhook requests (4xx, 5xx) are automatically retried multiple times within 48 hours (every 2^attempt minutes) for all production accounts.
**Related Guides**
[Download Signed Documents](https://www.docuseal.com/guides/download-signed-documents)
```json
{
"event_type": {
"type": "string",
"description": "The event type.",
"enum": [
"form.viewed",
"form.started",
"form.completed"
]
},
"timestamp": {
"type": "string",
"description": "The event timestamp.",
"example": "2023-09-24T11:20:42Z",
"format": "date-time"
},
"data": {
"type": "object",
"description": "Submitted data object.",
"properties": {
"id": {
"type": "number",
"description": "The submitter's unique identifier."
},
"submission_id": {
"type": "number",
"description": "The unique submission identifier."
},
"email": {
"type": "string",
"description": "The submitter's email address",
"format": "email",
"example": "john.doe@example.com"
},
"ua": {
"type": "string",
"description": "The user agent string that provides information about the submitter's web browser.",
"example": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
},
"ip": {
"type": "string",
"description": "The submitter's IP address."
},
"name": {
"type": "string",
"description": "The submitter's name."
},
"phone": {
"type": "string",
"description": "The submitter's phone number, formatted according to the E.164 standard.",
"example": "+1234567890"
},
"role": {
"type": "string",
"description": "The submitter's role name or title.",
"example": "First Party"
},
"external_id": {
"type": "string",
"description": "Your application-specific unique string key to identify submitter within your app."
},
"application_key": {
"type": "string",
"description": "Your application-specific unique string key to identify submitter within your app. Backward compatibility with the previous version of the API. Use external_id instead."
},
"decline_reason": {
"type": "string",
"description": "Submitter provided decline message."
},
"sent_at": {
"type": "string",
"format": "date-time"
},
"status": {
"type": "string",
"description": "The submitter status.",
"enum": [
"completed",
"declined",
"opened",
"sent",
"awaiting"
]
},
"opened_at": {
"type": "string",
"format": "date-time"
},
"completed_at": {
"type": "string",
"format": "date-time"
},
"declined_at": {
"type": "string",
"format": "date-time"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"submission": {
"type": "object",
"description": "The submission details.",
"properties": {
"id": {
"type": "number",
"description": "The submission's unique identifier."
},
"audit_log_url": {
"type": "string",
"description": "The audit log PDF URL. Available only if the submission was completed by all submitters."
},
"combined_document_url": {
"type": "string",
"description": "The URL of the combined documents with audit log. Combined documents can be enabled via <a href=\"https://docuseal.com/settings/account\" target=\"_blank\" class=\"link\">/settings/accounts</a>."
},
"status": {
"type": "string",
"description": "The submission status.",
"enum": [
"completed",
"declined",
"expired",
"pending"
]
},
"url": {
"type": "string",
"description": "The submission URL."
},
"created_at": {
"type": "string",
"description": "The submission creation date.",
"format": "date-time"
}
}
},
"template": {
"type": "object",
"description": "Base template details.",
"properties": {
"id": {
"type": "number",
"description": "The template's unique identifier."
},
"name": {
"type": "string",
"description": "The template's name."
},
"external_id": {
"type": "string",
"description": "Your application-specific unique string key to identify template within your app."
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"folder_name": {
"type": "string",
"description": "Template folder name."
}
}
},
"preferences": {
"type": "object",
"properties": {
"send_email": {
"type": "boolean",
"description": "The flag indicating whether the submitter has opted to receive an email."
},
"send_sms": {
"type": "boolean",
"description": "The flag indicating whether the submitter has opted to receive an SMS."
}
}
},
"values": {
"type": "array",
"description": "List of the filled values passed by the submitter.",
"items": {
"type": "object",
"properties": {
"field": {
"type": "string",
"description": "The field name."
},
"values": {
"type": "string",
"description": "The field value."
}
}
}
},
"metadata": {
"type": "object",
"description": "Metadata object with additional submitter information."
},
"audit_log_url": {
"type": "string",
"description": "The audit log PDF URL. Available only if the submission was completed by all submitters."
},
"submission_url": {
"type": "string",
"description": "The submission URL."
},
"documents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The document file name."
},
"url": {
"type": "string",
"description": "The document file URL."
}
}
}
}
}
}
}
```

@ -0,0 +1,317 @@
# Submission Webhook
Get submission creation, completion, expiration, and archiving notifications using these events:
- **'submission.created'** event is triggered when the submission is created.
- **'submission.completed'** event is triggered when the submission is completed by all signing parties.
- **'submission.expired'** event is triggered when the submission expires.
- **'submission.archived'** event is triggered when the submission is archived.
```json
{
"event_type": {
"type": "string",
"description": "The event type.",
"enum": [
"submission.created",
"submission.archived"
]
},
"timestamp": {
"type": "string",
"description": "The event timestamp.",
"example": "2023-09-24T11:20:42Z",
"format": "date-time"
},
"data": {
"type": "object",
"description": "Submitted data object.",
"properties": {
"id": {
"type": "number",
"description": "The submission's unique identifier."
},
"archived_at": {
"type": "string",
"description": "The submission archive date."
},
"created_at": {
"type": "string",
"description": "The submission creation date."
},
"updated_at": {
"type": "string",
"description": "The submission update date."
},
"source": {
"type": "string",
"description": "The submission source.",
"enum": [
"invite",
"bulk",
"api",
"embed",
"link"
]
},
"submitters_order": {
"type": "string",
"description": "The submitters order.",
"enum": [
"random",
"preserved"
]
},
"audit_log_url": {
"type": "string",
"description": "Audit log file URL."
},
"submitters": {
"type": "array",
"description": "The list of submitters for the submission.",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "The submitter's unique identifier."
},
"submission_id": {
"type": "number",
"description": "The unique submission identifier."
},
"uuid": {
"type": "string",
"description": "The submitter UUID."
},
"email": {
"type": "string",
"description": "The email address of the submitter.",
"format": "email",
"example": "john.doe@example.com"
},
"slug": {
"type": "string",
"description": "The unique slug of the document template."
},
"sent_at": {
"type": "string",
"description": "The date and time when the signing request was sent to the submitter."
},
"opened_at": {
"type": "string",
"description": "The date and time when the submitter opened the signing form."
},
"completed_at": {
"type": "string",
"description": "The date and time when the submitter completed the signing form."
},
"declined_at": {
"type": "string",
"description": "The date and time when the submitter declined the signing form."
},
"created_at": {
"type": "string",
"description": "The date and time when the submitter was created."
},
"updated_at": {
"type": "string",
"description": "The date and time when the submitter was last updated."
},
"name": {
"type": "string",
"description": "The name of the submitter."
},
"phone": {
"type": "string",
"description": "The phone number of the submitter, formatted according to the E.164 standard.",
"example": "+1234567890"
},
"role": {
"type": "string",
"description": "The role name or title of the submitter.",
"example": "First Party"
},
"external_id": {
"type": "string",
"description": "Your application-specific unique string key to identify this submitter within your app."
},
"metadata": {
"type": "object",
"description": "Metadata object with additional submitter information.",
"example": "{ 'customField': 'value' }"
},
"status": {
"type": "string",
"description": "The submitter status.",
"enum": [
"completed",
"declined",
"opened",
"sent",
"awaiting"
]
},
"application_key": {
"type": "string",
"description": "Your application-specific unique string key to identify this submitter within your app."
},
"values": {
"type": "object",
"description": "An object with pre-filled values for the submission. Use field names for keys of the object. For more configurations see `fields` param."
},
"documents": {
"type": "array",
"description": "The list of documents for the submission.",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The document file name."
},
"url": {
"type": "string",
"description": "The document file URL."
}
}
}
},
"preferences": {
"type": "object",
"description": "The submitter preferences."
}
}
}
},
"template": {
"type": "object",
"description": "Base template details.",
"properties": {
"id": {
"type": "number",
"description": "The template's unique identifier."
},
"name": {
"type": "string",
"description": "The template's name."
},
"external_id": {
"type": "string",
"description": "Your application-specific unique string key to identify template within your app."
},
"folder_name": {
"type": "string",
"description": "The folder name."
},
"created_at": {
"type": "string",
"description": "The date and time when the template was created."
},
"updated_at": {
"type": "string",
"description": "The date and time when the template was last updated."
}
}
},
"created_by_user": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "Unique identifier of the user who created the submission."
},
"first_name": {
"type": "string",
"description": "The first name of the user who created the submission."
},
"last_name": {
"type": "string",
"description": "The last name of the user who created the submission."
},
"email": {
"type": "string",
"description": "The email address of the user who created the submission."
}
}
},
"submission_events": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "Submission event unique ID number."
},
"submitter_id": {
"type": "integer",
"description": "Unique identifier of the submitter that triggered the event."
},
"event_type": {
"type": "string",
"description": "Event type.",
"enum": [
"send_email",
"bounce_email",
"complaint_email",
"send_reminder_email",
"send_sms",
"send_2fa_sms",
"open_email",
"click_email",
"click_sms",
"phone_verified",
"start_form",
"start_verification",
"complete_verification",
"view_form",
"invite_party",
"complete_form",
"decline_form",
"api_complete_form"
]
},
"event_timestamp": {
"type": "string",
"description": "Date and time when the event was triggered."
}
}
}
},
"documents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Document name."
},
"url": {
"type": "string",
"description": "Document URL."
}
}
}
},
"status": {
"type": "string",
"description": "The status of the submission.",
"enum": [
"completed",
"declined",
"expired",
"pending"
]
},
"completed_at": {
"type": "string",
"description": "The date and time when the submission was fully completed."
}
}
}
}
```

@ -0,0 +1,235 @@
# Template Webhook
Get template creation and update notifications using these events:
- **'template.created'** is triggered when the template is created.
- **'tempate.updated'** is triggered when the template is updated.
```json
{
"event_type": {
"type": "string",
"description": "The event type.",
"enum": [
"template.created",
"template.updated"
]
},
"timestamp": {
"type": "string",
"description": "The event timestamp.",
"example": "2023-09-24T11:20:42Z",
"format": "date-time"
},
"data": {
"type": "object",
"description": "Submitted data object.",
"properties": {
"id": {
"type": "number",
"description": "The template's unique identifier."
},
"slug": {
"type": "string",
"description": "The template's unique slug."
},
"name": {
"type": "string",
"description": "The template's name."
},
"schema": {
"type": "array",
"description": "The template document files.",
"items": {
"type": "object",
"properties": {
"attachment_uuid": {
"type": "string",
"description": "The attachment UUID."
},
"name": {
"type": "string",
"description": "The attachment name."
}
}
}
},
"fields": {
"type": "array",
"description": "The template fields.",
"items": {
"type": "object",
"properties": {
"uuid": {
"type": "string",
"description": "The field UUID."
},
"submitter_uuid": {
"type": "string",
"description": "The submitter role UUID."
},
"name": {
"type": "string",
"description": "The field name."
},
"required": {
"type": "boolean",
"description": "The flag indicating whether the field is required."
},
"preferences": {
"type": "object",
"description": "The field preferences."
},
"areas": {
"type": "array",
"description": "List of areas where the field is located in the document.",
"items": {
"type": "object",
"properties": {
"x": {
"type": "number",
"description": "X coordinate of the area where the field is located in the document."
},
"y": {
"type": "number",
"description": "Y coordinate of the area where the field is located in the document."
},
"w": {
"type": "number",
"description": "Width of the area where the field is located in the document."
},
"h": {
"type": "number",
"description": "Height of the area where the field is located in the document."
},
"attachment_uuid": {
"type": "string",
"description": "Unique identifier of the attached document where the field is located."
},
"page": {
"type": "integer",
"description": "Page number of the attached document where the field is located."
}
}
}
}
}
}
},
"submitters": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Submitter name."
},
"uuid": {
"type": "string",
"description": "Unique identifier of the submitter."
}
}
}
},
"author_id": {
"type": "integer",
"description": "Unique identifier of the author of the template."
},
"account_id": {
"type": "integer",
"description": "Unique identifier of the account of the template."
},
"archived_at": {
"type": "string",
"description": "Date and time when the template was archived."
},
"created_at": {
"type": "string",
"description": "Date and time when the template was created."
},
"updated_at": {
"type": "string",
"description": "Date and time when the template was updated."
},
"source": {
"type": "string",
"description": "Source of the template.",
"enum": [
"native",
"api",
"embed"
]
},
"external_id": {
"type": "string",
"description": "Identifier of the template in the external system."
},
"folder_id": {
"type": "integer",
"description": "Unique identifier of the folder where the template is placed."
},
"folder_name": {
"type": "string",
"description": "Folder name where the template is placed."
},
"application_key": {
"type": "string",
"description": "Your application-specific unique string key to identify tempate_id within your app."
},
"author": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "Unique identifier of the author."
},
"first_name": {
"type": "string",
"description": "First name of the author."
},
"last_name": {
"type": "string",
"description": "Last name of the author."
},
"email": {
"type": "string",
"description": "Author email."
}
}
},
"documents": {
"type": "array",
"description": "List of documents attached to the template.",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "Unique identifier of the document."
},
"uuid": {
"type": "string",
"description": "Unique identifier of the document."
},
"url": {
"type": "string",
"description": "URL of the document."
},
"preview_image_url": {
"type": "string",
"description": "Document preview image URL."
},
"filename": {
"type": "string",
"description": "Document filename."
}
}
}
}
}
}
}
```

@ -9,7 +9,11 @@ module AccountConfigs
'twelve_hours' => '12 hours',
'twenty_four_hours' => '24 hours',
'two_days' => '2 days',
'three_days' => '3 days',
'four_days' => '4 days',
'five_days' => '5 days',
'six_days' => '6 days',
'seven_days' => '7 days',
'eight_days' => '8 days',
'fifteen_days' => '15 days'
}.freeze

@ -72,8 +72,8 @@ module Params
return if params[key].blank?
return if params[key].to_s.include?('<')
if params[key].to_s.strip.split(/\s*[;,]\s*/).compact_blank
.all? { |email| EmailTypo::DotCom.call(email).match?(EMAIL_REGEXP) }
if params[key].to_s.strip.split(%r{\s*[;,/]\s*}).compact_blank
.all? { |email| EmailTypo::DotCom.call(email).match?(EMAIL_REGEXP) || email.include?('--') }
return
end

@ -13,6 +13,7 @@ module ReplaceEmailVariables
SUBMITTER_FIRST_NAME = /\{+submitter\.first_name\}+/i
SUBMITTER_ID = /\{+submitter\.id\}+/i
SUBMITTER_SLUG = /\{+submitter\.slug\}+/i
SUBMITTER_FIELD_VALUE = /\{+submitter\.(?<field_name>[^}]+)\}+/i
SUBMISSION_LINK = /\{+submission\.link\}+/i
SUBMISSION_ID = /\{+submission\.id\}+/i
SUBMISSION_EXPIRE_AT = /\{+submission\.expire_at\}+/i
@ -72,6 +73,13 @@ module ReplaceEmailVariables
build_submitters_n_field(submitter.submission, match[:index].to_i - 1, :values, match[:field_name].to_s.strip)
end
text = replace(text, SUBMITTER_FIELD_VALUE, html_escape:) do |match|
submitters = submitter.submission.template_submitters || submitter.submission.template.submitters
index = submitters.find_index { |e| e['uuid'] == submitter.uuid }
build_submitters_n_field(submitter.submission, index, :values, match[:field_name].to_s.strip)
end
replace(text, SENDER_EMAIL, html_escape:) { submitter.submission.created_by_user&.email.to_s.sub(/\+\w+@/, '@') }
end
# rubocop:enable Metrics

@ -74,7 +74,13 @@ module Submissions
preferences:,
sent_at: mark_as_sent ? Time.current : nil)
submission.tap(&:save!)
submission.save!
if submission.expire_at?
ProcessSubmissionExpiredJob.perform_at(submission.expire_at, 'submission_id' => submission.id)
end
submission
end
end
@ -112,18 +118,21 @@ module Submissions
return if email.blank?
return if email.is_a?(Numeric)
return email.downcase if email.to_s.include?(',') ||
email.to_s.match?(/\.(?:gob|om|mm|cm|et|mo|nz|za|ie)\z/) ||
email.to_s.exclude?('.')
email = email.to_s.tr('/', ',')
return email.downcase if email.include?(',') ||
email.match?(/\.(?:gob|om|mm|cm|et|mo|nz|za|ie)\z/) ||
email.exclude?('.')
fixed_email = EmailTypo.call(email.delete_prefix('<'))
return fixed_email if fixed_email == email
domain = email.to_s.split('@').last.to_s.downcase
domain = email.split('@').last.to_s.downcase
fixed_domain = fixed_email.to_s.split('@').last
return email.downcase if domain == fixed_domain
return email.downcase if fixed_domain.match?(/\Agmail\.(?!com\z)/i)
if DidYouMean::Levenshtein.distance(domain, fixed_domain) > 3
Rails.logger.info("Skipped email fix #{domain}")

@ -254,6 +254,37 @@ module Submissions
image = Vips::Image.new_from_buffer(attachments_data_cache[attachment.uuid], '').autorot
reason_value = submitter.values[field.dig('preferences', 'reason_field_uuid')].presence
reason_string =
I18n.with_locale(submitter.account.locale) do
"#{reason_value ? "#{I18n.t('reason')}: " : ''}#{reason_value || I18n.t('digitally_signed_by')} " \
"#{submitter.name}#{submitter.email.present? ? " <#{submitter.email}>" : ''}\n" \
"#{I18n.l(attachment.created_at.in_time_zone(submitter.account.timezone), format: :long)} " \
"#{TimeUtils.timezone_abbr(submitter.account.timezone, attachment.created_at)}"
end
reason_text = HexaPDF::Layout::TextFragment.create(reason_string,
font:,
font_size: (font_size / 1.8).to_i)
if area['h']&.positive? && (area['w'].to_f / area['h']) > 6
area_x = area['x'] * width
area_y = area['y'] * height
area_w = area['w'] * width
area_h = area['h'] * height
half_width = area_w / 2.0
scale = [half_width / image.width, area_h / image.height].min
image_width = image.width * scale
image_height = image.height * scale
image_x = area_x + ((half_width - image_width) / 2.0)
image_y = height - area_y - image_height
io = StringIO.new(image.resize([scale * 4, 1].select(&:positive?).min).write_to_buffer('.png'))
canvas.image(io, at: [image_x, image_y], width: image_width, height: image_height)
id_string = "ID: #{attachment.uuid}".upcase
while true
@ -261,7 +292,7 @@ module Submissions
font:,
font_size: (font_size / 1.8).to_i)
result = layouter.fit([text], area['w'] * width, (font_size / 1.8) / 0.65)
result = layouter.fit([text], half_width, (font_size / 1.8) / 0.65)
break if result.status == :success
@ -270,22 +301,34 @@ module Submissions
break if id_string.length < 8
end
reason_value = submitter.values[field.dig('preferences', 'reason_field_uuid')].presence
text_x = area_x + half_width
text_y = height - area_y
reason_string =
I18n.with_locale(submitter.account.locale) do
"#{reason_value ? "#{I18n.t('reason')}: " : ''}#{reason_value || I18n.t('digitally_signed_by')} " \
"#{submitter.name}#{submitter.email.present? ? " <#{submitter.email}>" : ''}\n" \
"#{I18n.l(attachment.created_at.in_time_zone(submitter.account.timezone), format: :long)} " \
"#{TimeUtils.timezone_abbr(submitter.account.timezone, attachment.created_at)}"
end
reason_result = layouter.fit([reason_text], half_width, height)
reason_text = HexaPDF::Layout::TextFragment.create(reason_string,
layouter.fit([text], half_width, (font_size / 1.8) / 0.65)
.draw(canvas, text_x + TEXT_LEFT_MARGIN, text_y)
layouter.fit([reason_text], half_width, reason_result.lines.sum(&:height))
.draw(canvas, text_x + TEXT_LEFT_MARGIN, text_y - TEXT_TOP_MARGIN - result.lines.sum(&:height))
else
id_string = "ID: #{attachment.uuid}".upcase
loop do
text = HexaPDF::Layout::TextFragment.create(id_string,
font:,
font_size: (font_size / 1.8).to_i)
reason_result = layouter.fit([reason_text], area['w'] * width, height)
result = layouter.fit([text], area['w'] * width, (font_size / 1.8) / 0.65)
break if result.status == :success
id_string = "#{id_string.delete_suffix('...')[0..-2]}..."
break if id_string.length < 8
end
reason_result = layouter.fit([reason_text], area['w'] * width, height)
text_height = result.lines.sum(&:height) + reason_result.lines.sum(&:height)
image_height = (area['h'] * height) - text_height
@ -313,6 +356,7 @@ module Submissions
width: image.width * scale,
height: image.height * scale
)
end
when 'image', 'signature', 'initials', 'stamp'
attachment = submitter.attachments.find { |a| a.uuid == value }

@ -52,12 +52,12 @@ module Submitters
attachments.push(*new_attachments)
value = new_value
end
acc[field['uuid']] = normalize_value(field, new_value)
else
acc[field['uuid']] = normalize_value(field, value)
end
end
end
[normalized_values, attachments]
end

@ -0,0 +1,34 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Template Builder' do
let(:account) { create(:account) }
let(:author) { create(:user, account:) }
let(:template) { create(:template, account:, author:, attachment_count: 3, except_field_types: %w[phone payment]) }
before do
sign_in(author)
end
context 'when manage template documents' do
before do
visit edit_template_path(template)
end
it 'replaces the document' do
doc = find("div[id='documents_container'] div[data-document-uuid='#{template.schema[1]['attachment_uuid']}'")
doc.click
expect do
doc.find('.replace-document-button').click
doc.find('.replace-document-button input[type="file"]', visible: false)
.attach_file(Rails.root.join('spec/fixtures/sample-image.png'))
page.driver.wait_for_network_idle
end.to change { template.documents.count }.by(1)
expect(page).to have_content('sample-image')
end
end
end
Loading…
Cancel
Save