Compare commits

...
28 Commits
Author SHA1 Message Date
Pete Matsyburka 2508b5fc8a adjust template account clone 2024-04-28 16:43:31 +03:00
Pete Matsyburka 4bd1ef0da3 fix params normalize 2024-04-28 16:33:11 +03:00
Pete Matsyburka 4efd748571 fix 2024-04-28 16:32:23 +03:00
Pete Matsyburka 859892d1fd adjust template preferences 2024-04-28 16:26:47 +03:00
Pete Matsyburka 7adeaf93cd only active linked accounts 2024-04-28 15:01:15 +03:00
Pete Matsyburka 5dbe155ecb shorten call 2024-04-28 14:44:33 +03:00
Pete Matsyburka 667d065bee populate linked accounts 2024-04-28 14:27:23 +03:00
Pete Matsyburka bb613059de add archived at to accounts 2024-04-28 13:43:53 +03:00
Pete Matsyburka 1b2dec4c2a adjust create submission resp 2024-04-27 23:08:16 +03:00
Pete Matsyburka 2c2ef97c30 validate params 2024-04-27 21:35:20 +03:00
Pete Matsyburka 6df1d68237 addept value param 2024-04-27 21:35:09 +03:00
Pete Matsyburka 20c9faedff update dep 2024-04-27 20:15:39 +03:00
Pete Matsyburka d931a40ea9 adjust log 2024-04-27 11:11:00 +03:00
Pete Matsyburka 1097b98b85 add log 2024-04-26 23:37:04 +03:00
Pete Matsyburka 2e597fcf43 ruby 3.3.1 2024-04-26 12:39:45 +03:00
Pete Matsyburka bb2fa6a261 add reuse signature prop 2024-04-25 17:51:36 +03:00
Pete Matsyburka 1dc8369487 fix template clone 2024-04-24 21:02:19 +03:00
Pete Matsyburka e6d60f1985 better error message 2024-04-24 13:18:57 +03:00
Pete Matsyburka 82e3cb8a4d fix audit log toggle 2024-04-24 01:19:07 +03:00
Pete Matsyburka aeec0cbf8e phone step langauge 2024-04-23 21:33:40 +03:00
Pete Matsyburka 7a2d1fc6c5 allow to remove personalization configs 2024-04-23 20:47:12 +03:00
Pete Matsyburka 68033ab7d2 fix files link position 2024-04-23 20:09:39 +03:00
Pete Matsyburka 7595c60ea8 remove pattern validation 2024-04-23 15:02:42 +03:00
Pete Matsyburka d9318c04f8 fix builder bg color 2024-04-23 01:57:45 +03:00
Pete Matsyburka 2d76198290 add flatten pdf toggle 2024-04-22 21:34:55 +03:00
Pete Matsyburka 02a7b6ea55 do not allow to skip required field with whitespace 2024-04-22 21:15:57 +03:00
Pete Matsyburka ab57076b8f add class 2024-04-22 20:01:30 +03:00
Pete Matsyburka 82fba47c98 rotate pdf 2024-04-22 19:10:58 +03:00
40 changed files with 385 additions and 160 deletions

No files matched your search

+3 -3
View File
@@ -11,7 +11,7 @@ jobs:
- name: Install Ruby - name: Install Ruby
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: 3.2.2 ruby-version: 3.3.1
- name: Cache gems - name: Cache gems
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
@@ -35,7 +35,7 @@ jobs:
- name: Install Ruby - name: Install Ruby
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: 3.2.2 ruby-version: 3.3.1
- name: Cache gems - name: Cache gems
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
@@ -100,7 +100,7 @@ jobs:
- name: Install Ruby - name: Install Ruby
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: 3.2.2 ruby-version: 3.3.1
- name: Set up Node - name: Set up Node
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
+1 -1
View File
@@ -10,7 +10,7 @@ AllCops:
- node_modules/**/* - node_modules/**/*
- bin/* - bin/*
- vendor/**/* - vendor/**/*
TargetRubyVersion: '3.2' TargetRubyVersion: '3.3'
Metrics/BlockLength: Metrics/BlockLength:
Exclude: Exclude:
+3 -3
View File
@@ -1,4 +1,4 @@
FROM ruby:3.2.2-alpine3.18 as fonts FROM ruby:3.3.1-alpine3.18 as fonts
WORKDIR /fonts WORKDIR /fonts
@@ -6,7 +6,7 @@ RUN apk --no-cache add fontforge wget && wget https://github.com/satbyy/go-noto-
RUN fontforge -lang=py -c 'font1 = fontforge.open("FreeSans.ttf"); font2 = fontforge.open("NotoSansSymbols2-Regular.ttf"); font1.mergeFonts(font2); font1.generate("FreeSans.ttf")' RUN fontforge -lang=py -c 'font1 = fontforge.open("FreeSans.ttf"); font2 = fontforge.open("NotoSansSymbols2-Regular.ttf"); font1.mergeFonts(font2); font1.generate("FreeSans.ttf")'
FROM ruby:3.2.2-alpine3.18 as webpack FROM ruby:3.3.1-alpine3.18 as webpack
ENV RAILS_ENV=production ENV RAILS_ENV=production
ENV NODE_ENV=production ENV NODE_ENV=production
@@ -32,7 +32,7 @@ COPY ./app/views ./app/views
RUN echo "gem 'shakapacker'" > Gemfile && ./bin/shakapacker RUN echo "gem 'shakapacker'" > Gemfile && ./bin/shakapacker
FROM ruby:3.2.2-alpine3.18 as app FROM ruby:3.3.1-alpine3.18 as app
ENV RAILS_ENV=production ENV RAILS_ENV=production
ENV BUNDLE_WITHOUT="development:test" ENV BUNDLE_WITHOUT="development:test"
+2 -1
View File
@@ -2,13 +2,14 @@
source 'https://rubygems.org' source 'https://rubygems.org'
ruby '3.2.2' ruby '3.3.1'
gem 'arabic-letter-connector', require: 'arabic-letter-connector/logic' gem 'arabic-letter-connector', require: 'arabic-letter-connector/logic'
gem 'aws-sdk-s3', require: false gem 'aws-sdk-s3', require: false
gem 'azure-storage-blob', require: false gem 'azure-storage-blob', require: false
gem 'bootsnap', require: false gem 'bootsnap', require: false
gem 'cancancan' gem 'cancancan'
gem 'csv'
gem 'devise' gem 'devise'
gem 'devise-two-factor' gem 'devise-two-factor'
gem 'dotenv', require: false gem 'dotenv', require: false
+5 -3
View File
@@ -149,6 +149,7 @@ GEM
crass (1.0.6) crass (1.0.6)
css_parser (1.17.1) css_parser (1.17.1)
addressable addressable
csv (3.3.0)
cuprite (0.15) cuprite (0.15)
capybara (~> 3.0) capybara (~> 3.0)
ferrum (~> 0.14.0) ferrum (~> 0.14.0)
@@ -342,7 +343,7 @@ GEM
package_json (0.1.0) package_json (0.1.0)
pagy (8.1.2) pagy (8.1.2)
parallel (1.24.0) parallel (1.24.0)
parser (3.3.0.5) parser (3.3.1.0)
ast (~> 2.4.1) ast (~> 2.4.1)
racc racc
pdf-reader (2.12.0) pdf-reader (2.12.0)
@@ -461,7 +462,7 @@ GEM
rspec-mocks (~> 3.13) rspec-mocks (~> 3.13)
rspec-support (~> 3.13) rspec-support (~> 3.13)
rspec-support (3.13.1) rspec-support (3.13.1)
rubocop (1.63.1) rubocop (1.63.3)
json (~> 2.3) json (~> 2.3)
language_server-protocol (>= 3.17.0) language_server-protocol (>= 3.17.0)
parallel (~> 1.10) parallel (~> 1.10)
@@ -585,6 +586,7 @@ DEPENDENCIES
bullet bullet
cancancan cancancan
capybara capybara
csv
cuprite cuprite
debug debug
devise devise
@@ -636,7 +638,7 @@ DEPENDENCIES
webmock webmock
RUBY VERSION RUBY VERSION
ruby 3.2.2p53 ruby 3.3.1p55
BUNDLED WITH BUNDLED WITH
2.5.3 2.5.3
@@ -11,7 +11,8 @@ class AccountConfigsController < ApplicationController
AccountConfig::ESIGNING_PREFERENCE_KEY, AccountConfig::ESIGNING_PREFERENCE_KEY,
AccountConfig::FORM_WITH_CONFETTI_KEY, AccountConfig::FORM_WITH_CONFETTI_KEY,
AccountConfig::DOWNLOAD_LINKS_AUTH_KEY, AccountConfig::DOWNLOAD_LINKS_AUTH_KEY,
AccountConfig::FORCE_SSO_AUTH_KEY AccountConfig::FORCE_SSO_AUTH_KEY,
AccountConfig::FLATTEN_RESULT_PDF_KEY
].freeze ].freeze
InvalidKey = Class.new(StandardError) InvalidKey = Class.new(StandardError)
+10 -4
View File
@@ -70,7 +70,7 @@ module Api
end end
def create def create
Params::SubmissionCreateValidator.call(params, dry_run: !Docuseal.multitenant?) Params::SubmissionCreateValidator.call(params)
return render json: { error: 'Template not found' }, status: :unprocessable_entity if @template.nil? return render json: { error: 'Template not found' }, status: :unprocessable_entity if @template.nil?
@@ -93,7 +93,13 @@ module Api
end end
end end
render json: submissions.flat_map(&:submitters) json = submissions.flat_map do |submission|
submission.submitters.map do |s|
Submitters::SerializeForApi.call(s, with_documents: false, with_urls: true)
end
end
render json:
rescue Submitters::NormalizeValues::BaseError => e rescue Submitters::NormalizeValues::BaseError => e
Rollbar.warning(e) if defined?(Rollbar) Rollbar.warning(e) if defined?(Rollbar)
@@ -171,9 +177,9 @@ module Api
submitters: [[:send_email, :send_sms, :completed_redirect_url, :uuid, :name, :email, :role, submitters: [[:send_email, :send_sms, :completed_redirect_url, :uuid, :name, :email, :role,
:completed, :phone, :application_key, :external_id, :reply_to, :go_to_last, :completed, :phone, :application_key, :external_id, :reply_to, :go_to_last,
{ metadata: {}, values: {}, readonly_fields: [], message: %i[subject body], { metadata: {}, values: {}, readonly_fields: [], message: %i[subject body],
fields: [:name, :uuid, :default_value, :title, :description, fields: [:name, :uuid, :default_value, :value, :title, :description,
:readonly, :redacted, :validation_pattern, :invalid_message, :readonly, :redacted, :validation_pattern, :invalid_message,
{ default_value: [] }] }]] { default_value: [], value: [] }] }]]
} }
] ]
+6 -3
View File
@@ -71,7 +71,9 @@ module Api
Submitters.send_signature_requests([@submitter]) Submitters.send_signature_requests([@submitter])
end end
render json: Submitters::SerializeForApi.call(@submitter, with_template: false, with_events: false) render json: Submitters::SerializeForApi.call(@submitter, with_template: false,
with_urls: true,
with_events: false)
end end
def submitter_params def submitter_params
@@ -81,8 +83,9 @@ module Api
:send_email, :send_sms, :reply_to, :completed_redirect_url, :uuid, :name, :email, :role, :send_email, :send_sms, :reply_to, :completed_redirect_url, :uuid, :name, :email, :role,
:completed, :phone, :application_key, :external_id, :go_to_last, :completed, :phone, :application_key, :external_id, :go_to_last,
{ metadata: {}, values: {}, readonly_fields: [], message: %i[subject body], { metadata: {}, values: {}, readonly_fields: [], message: %i[subject body],
fields: [[:name, :uuid, :default_value, :readonly, :redacted, :validation_pattern, :invalid_message, fields: [[:name, :uuid, :default_value, :value,
{ default_value: [] }]] } :readonly, :redacted, :validation_pattern, :invalid_message,
{ default_value: [], value: [] }]] }
) )
end end
+10 -1
View File
@@ -15,6 +15,11 @@ class ErrorsController < ActionController::Base
'/api/templates/docx' '/api/templates/docx'
].freeze ].freeze
SAFE_ERROR_MESSAGE_CLASSES = [
ActionDispatch::Http::Parameters::ParseError,
JSON::ParserError
].freeze
def show def show
if request.original_fullpath.in?(ENTERPRISE_PATHS) && error_status_code == 404 if request.original_fullpath.in?(ENTERPRISE_PATHS) && error_status_code == 404
return render json: { status: 404, message: ENTERPRISE_FEATURE_MESSAGE }, status: :not_found return render json: { status: 404, message: ENTERPRISE_FEATURE_MESSAGE }, status: :not_found
@@ -24,7 +29,11 @@ class ErrorsController < ActionController::Base
f.json do f.json do
set_cors_headers set_cors_headers
render json: { status: error_status_code }, status: error_status_code exception = request.env['action_dispatch.exception']
error = exception.message if exception.class.in?(SAFE_ERROR_MESSAGE_CLASSES)
render json: { status: error_status_code, error: }.compact, status: error_status_code
end end
f.html { render error_status_code.to_s, status: error_status_code } f.html { render error_status_code.to_s, status: error_status_code }
@@ -18,6 +18,12 @@ class PersonalizationSettingsController < ApplicationController
end end
def create def create
if @account_config.value.is_a?(Hash)
@account_config.value = @account_config.value.reject do |_, v|
v.blank? && v != false
end
end
if @account_config.value != false && @account_config.value.blank? if @account_config.value != false && @account_config.value.blank?
@account_config.destroy! @account_config.destroy!
else else
@@ -7,6 +7,8 @@ class SubmittersSendEmailController < ApplicationController
if Docuseal.multitenant? && SubmissionEvent.exists?(submitter: @submitter, if Docuseal.multitenant? && SubmissionEvent.exists?(submitter: @submitter,
event_type: 'send_email', event_type: 'send_email',
created_at: 24.hours.ago..Time.current) created_at: 24.hours.ago..Time.current)
Rollbar.warning("Already sent: #{@submitter.id}") if defined?(Rollbar)
return redirect_back(fallback_location: submission_path(@submitter.submission), return redirect_back(fallback_location: submission_path(@submitter.submission),
alert: 'Email has been sent already.') alert: 'Email has been sent already.')
end end
+10 -5
View File
@@ -1,10 +1,10 @@
# frozen_string_literal: true # frozen_string_literal: true
class UsersController < ApplicationController class UsersController < ApplicationController
load_and_authorize_resource :user, only: %i[index edit new update destroy] load_and_authorize_resource :user, only: %i[index edit update destroy]
before_action :build_user, only: :create before_action :build_user, only: %i[new create]
authorize_resource :user, only: :create authorize_resource :user, only: %i[new create]
def index def index
@users = @users =
@@ -14,7 +14,7 @@ class UsersController < ApplicationController
@users.active @users.active
end end
@pagy, @users = pagy(@users.order(id: :desc)) @pagy, @users = pagy(@users.where(account: current_account).order(id: :desc))
end end
def new; end def new; end
@@ -81,6 +81,11 @@ class UsersController < ApplicationController
end end
def user_params def user_params
params.require(:user).permit(:email, :first_name, :last_name, :password, :role, :archived_at) if params.key?(:user)
params.require(:user).permit(:email, :first_name, :last_name, :password,
:role, :archived_at, :account_id)
else
{}
end
end end
end end
+1 -1
View File
@@ -1,6 +1,6 @@
<template> <template>
<div <div
class="flex absolute lg:text-base -outline-offset-1" class="field-area flex absolute lg:text-base -outline-offset-1"
dir="auto" dir="auto"
:style="computedStyle" :style="computedStyle"
:class="{ 'text-[1.5vw] lg:text-base': !textOverflowChars, 'text-[1.0vw] lg:text-xs': textOverflowChars, 'cursor-default': !submittable, 'border border-red-100 bg-red-100 cursor-pointer': submittable, 'border border-red-100': !isActive && submittable, 'bg-opacity-80': !isActive && !isValueSet && submittable, 'outline-red-500 outline-dashed outline-2 z-10': isActive && submittable, 'bg-opacity-40': (isActive || isValueSet) && submittable }" :class="{ 'text-[1.5vw] lg:text-base': !textOverflowChars, 'text-[1.0vw] lg:text-xs': textOverflowChars, 'cursor-default': !submittable, 'border border-red-100 bg-red-100 cursor-pointer': submittable, 'border border-red-100': !isActive && submittable, 'bg-opacity-80': !isActive && !isValueSet && submittable, 'outline-red-500 outline-dashed outline-2 z-10': isActive && submittable, 'bg-opacity-40': (isActive || isValueSet) && submittable }"
+25 -7
View File
@@ -360,6 +360,7 @@
:key="currentField.uuid" :key="currentField.uuid"
v-model="values[currentField.uuid]" v-model="values[currentField.uuid]"
:field="currentField" :field="currentField"
:locale="language?.toLowerCase() || browserLanguage"
:show-field-names="showFieldNames" :show-field-names="showFieldNames"
:verified-value="phoneVerifiedValues[currentField.uuid]" :verified-value="phoneVerifiedValues[currentField.uuid]"
:default-value="submitter.phone" :default-value="submitter.phone"
@@ -471,10 +472,14 @@ import i18n from './i18n'
const isEmpty = (obj) => { const isEmpty = (obj) => {
if (obj == null) return true if (obj == null) return true
if (Array.isArray(obj) || typeof obj === 'string') { if (Array.isArray(obj)) {
return obj.length === 0 return obj.length === 0
} }
if (typeof obj === 'string') {
return obj.trim().length === 0
}
if (typeof obj === 'object') { if (typeof obj === 'object') {
return Object.keys(obj).length === 0 return Object.keys(obj).length === 0
} }
@@ -549,6 +554,11 @@ export default {
required: false, required: false,
default: false default: false
}, },
reuseSignature: {
type: Boolean,
required: false,
default: true
},
withConfetti: { withConfetti: {
type: Boolean, type: Boolean,
required: false, required: false,
@@ -695,9 +705,13 @@ export default {
}, {}) }, {})
}, },
previousInitialsValue () { previousInitialsValue () {
const initialsField = [...this.fields].reverse().find((field) => field.type === 'initials' && !!this.values[field.uuid]) if (this.reuseSignature !== false) {
const initialsField = [...this.fields].reverse().find((field) => field.type === 'initials' && !!this.values[field.uuid])
return this.values[initialsField?.uuid] return this.values[initialsField?.uuid]
} else {
return null
}
}, },
isAnonymousChecboxes () { isAnonymousChecboxes () {
return this.currentField.type === 'checkbox' && this.currentStepFields.every((e) => !e.name && !e.required) && this.currentStepFields.length > 4 return this.currentField.type === 'checkbox' && this.currentStepFields.every((e) => !e.name && !e.required) && this.currentStepFields.length > 4
@@ -925,11 +939,15 @@ export default {
}) })
}, },
previousSignatureValueFor (field) { previousSignatureValueFor (field) {
const signatureField = [...this.fields].reverse().find((f) => if (this.reuseSignature !== false) {
f.type === 'signature' && field.preferences?.format === f.preferences?.format && !!this.values[f.uuid] const signatureField = [...this.fields].reverse().find((f) =>
) f.type === 'signature' && field.preferences?.format === f.preferences?.format && !!this.values[f.uuid]
)
return this.values[signatureField?.uuid] return this.values[signatureField?.uuid]
} else {
return null
}
}, },
goToStep (step, scrollToArea = false, clickUpload = false) { goToStep (step, scrollToArea = false, clickUpload = false) {
this.currentStep = this.stepFields.indexOf(step) this.currentStep = this.stepFields.indexOf(step)
@@ -117,6 +117,11 @@ export default {
type: String, type: String,
required: true required: true
}, },
locale: {
type: String,
required: false,
default: 'en'
},
showFieldNames: { showFieldNames: {
type: Boolean, type: Boolean,
required: false, required: false,
@@ -163,6 +168,7 @@ export default {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
submitter_slug: this.submitterSlug, submitter_slug: this.submitterSlug,
locale: this.locale,
phone: this.$refs.phone.value phone: this.$refs.phone.value
}), }),
headers: { 'Content-Type': 'application/json' } headers: { 'Content-Type': 'application/json' }
+15 -9
View File
@@ -16,6 +16,8 @@
v-model="field.type" v-model="field.type"
:editable="editable && !defaultField" :editable="editable && !defaultField"
:button-width="20" :button-width="20"
:menu-classes="'mt-1.5'"
:menu-style="{ backgroundColor: dropdownBgColor }"
@update:model-value="[maybeUpdateOptions(), save()]" @update:model-value="[maybeUpdateOptions(), save()]"
@click="scrollToFirstArea" @click="scrollToFirstArea"
/> />
@@ -110,7 +112,8 @@
<ul <ul
v-if="renderDropdown" v-if="renderDropdown"
tabindex="0" tabindex="0"
class="mt-1.5 dropdown-content menu menu-xs p-2 shadow bg-base-100 rounded-box w-52 z-10" class="mt-1.5 dropdown-content menu menu-xs p-2 shadow rounded-box w-52 z-10"
:style="{ backgroundColor: dropdownBgColor }"
draggable="true" draggable="true"
@dragstart.prevent.stop @dragstart.prevent.stop
@click="closeDropdown" @click="closeDropdown"
@@ -121,7 +124,7 @@
@click.stop @click.stop
> >
<select <select
class="select select-bordered select-xs w-full max-w-xs h-7 !outline-0 font-normal" class="select select-bordered select-xs w-full max-w-xs h-7 !outline-0 font-normal bg-transparent"
@change="[field.preferences ||= {}, field.preferences.align = $event.target.value, save()]" @change="[field.preferences ||= {}, field.preferences.align = $event.target.value, save()]"
> >
<option <option
@@ -134,7 +137,7 @@
</option> </option>
</select> </select>
<label <label
:style="{ backgroundColor: backgroundColor }" :style="{ backgroundColor: dropdownBgColor }"
class="absolute -top-1 left-2.5 px-1 h-4" class="absolute -top-1 left-2.5 px-1 h-4"
style="font-size: 8px" style="font-size: 8px"
> >
@@ -151,12 +154,12 @@
:placeholder="t('default_value')" :placeholder="t('default_value')"
dir="auto" dir="auto"
:type="field.type" :type="field.type"
class="input input-bordered input-xs w-full max-w-xs h-7 !outline-0" class="input input-bordered input-xs w-full max-w-xs h-7 !outline-0 bg-transparent"
@blur="save" @blur="save"
> >
<label <label
v-if="field.default_value" v-if="field.default_value"
:style="{ backgroundColor: backgroundColor }" :style="{ backgroundColor: dropdownBgColor }"
class="absolute -top-1 left-2.5 px-1 h-4" class="absolute -top-1 left-2.5 px-1 h-4"
style="font-size: 8px" style="font-size: 8px"
> >
@@ -171,7 +174,7 @@
<select <select
v-model="field.preferences.format" v-model="field.preferences.format"
:placeholder="t('format')" :placeholder="t('format')"
class="select select-bordered select-xs font-normal w-full max-w-xs !h-7 !outline-0" class="select select-bordered select-xs font-normal w-full max-w-xs !h-7 !outline-0 bg-transparent"
@change="save" @change="save"
> >
<option <option
@@ -183,7 +186,7 @@
</option> </option>
</select> </select>
<label <label
:style="{ backgroundColor: backgroundColor }" :style="{ backgroundColor: dropdownBgColor }"
class="absolute -top-1 left-2.5 px-1 h-4" class="absolute -top-1 left-2.5 px-1 h-4"
style="font-size: 8px" style="font-size: 8px"
> >
@@ -197,7 +200,7 @@
> >
<select <select
:placeholder="t('format')" :placeholder="t('format')"
class="select select-bordered select-xs font-normal w-full max-w-xs !h-7 !outline-0" class="select select-bordered select-xs font-normal w-full max-w-xs !h-7 !outline-0 bg-transparent"
@change="[field.preferences.format = $event.target.value, save()]" @change="[field.preferences.format = $event.target.value, save()]"
> >
<option <option
@@ -220,7 +223,7 @@
</option> </option>
</select> </select>
<label <label
:style="{ backgroundColor: backgroundColor }" :style="{ backgroundColor: dropdownBgColor }"
class="absolute -top-1 left-2.5 px-1 h-4" class="absolute -top-1 left-2.5 px-1 h-4"
style="font-size: 8px" style="font-size: 8px"
> >
@@ -569,6 +572,9 @@ export default {
}, },
computed: { computed: {
fieldNames: FieldType.computed.fieldNames, fieldNames: FieldType.computed.fieldNames,
dropdownBgColor () {
return ['', null, 'transparent'].includes(this.backgroundColor) ? 'white' : this.backgroundColor
},
schemaAttachmentsIndexes () { schemaAttachmentsIndexes () {
return (this.template.schema || []).reduce((acc, item, index) => { return (this.template.schema || []).reduce((acc, item, index) => {
acc[item.attachment_uuid] = index acc[item.attachment_uuid] = index
@@ -37,6 +37,7 @@
tabindex="0" tabindex="0"
class="rounded-md min-w-max mb-2" class="rounded-md min-w-max mb-2"
:class="menuClasses" :class="menuClasses"
:style="menuStyle"
@click="closeDropdown" @click="closeDropdown"
> >
<li <li
@@ -136,6 +137,7 @@
v-if="(editable || !compact) && renderDropdown" v-if="(editable || !compact) && renderDropdown"
tabindex="0" tabindex="0"
:class="menuClasses" :class="menuClasses"
:style="menuStyle"
@click="closeDropdown" @click="closeDropdown"
> >
<li <li
@@ -253,10 +255,15 @@ export default {
type: String, type: String,
required: true required: true
}, },
menuStyle: {
type: Object,
required: false,
default: () => ({})
},
menuClasses: { menuClasses: {
type: String, type: String,
required: false, required: false,
default: 'dropdown-content menu p-2 shadow bg-base-100 rounded-box w-full z-10' default: 'dropdown-content menu p-2 shadow rounded-box w-full z-10'
} }
}, },
emits: ['update:model-value', 'remove', 'new-submitter', 'name-change'], emits: ['update:model-value', 'remove', 'new-submitter', 'name-change'],
@@ -22,6 +22,7 @@
v-if="editable && renderDropdown" v-if="editable && renderDropdown"
tabindex="0" tabindex="0"
class="dropdown-content menu menu-xs p-2 shadow rounded-box w-52 z-10 mb-3" class="dropdown-content menu menu-xs p-2 shadow rounded-box w-52 z-10 mb-3"
:style="menuStyle"
:class="menuClasses" :class="menuClasses"
@click="closeDropdown" @click="closeDropdown"
> >
@@ -65,6 +66,11 @@ export default {
required: false, required: false,
default: 'mt-1.5 bg-base-100' default: 'mt-1.5 bg-base-100'
}, },
menuStyle: {
type: Object,
required: false,
default: () => ({})
},
buttonClasses: { buttonClasses: {
type: String, type: String,
required: false, required: false,
+5 -4
View File
@@ -3,8 +3,9 @@
<FieldSubmitter <FieldSubmitter
:model-value="selectedSubmitter.uuid" :model-value="selectedSubmitter.uuid"
class="roles-dropdown w-full rounded-lg" class="roles-dropdown w-full rounded-lg"
:class="{ 'bg-base-100': withStickySubmitters }" :style="withStickySubmitters ? { backgroundColor } : {}"
:submitters="submitters" :submitters="submitters"
:menu-style="{ backgroundColor: ['', null, 'transparent'].includes(backgroundColor) ? 'white' : backgroundColor }"
:editable="editable && !defaultSubmitters.length" :editable="editable && !defaultSubmitters.length"
@new-submitter="save" @new-submitter="save"
@remove="removeSubmitter" @remove="removeSubmitter"
@@ -71,7 +72,7 @@
:key="field.name" :key="field.name"
> >
<div <div
:style="{ backgroundColor: backgroundColor }" :style="{ backgroundColor }"
draggable="true" draggable="true"
class="default-field border border-base-300 rounded rounded-tr-none relative group mb-2" class="default-field border border-base-300 rounded rounded-tr-none relative group mb-2"
@dragstart="onDragstart({ type: 'text', ...field })" @dragstart="onDragstart({ type: 'text', ...field })"
@@ -113,7 +114,7 @@
v-if="(fieldTypes.length === 0 || fieldTypes.includes(type)) && (withPhone || type != 'phone') && (withPayment || type != 'payment')" v-if="(fieldTypes.length === 0 || fieldTypes.includes(type)) && (withPhone || type != 'phone') && (withPayment || type != 'payment')"
draggable="true" draggable="true"
class="field-type-button group flex items-center justify-center border border-dashed w-full rounded relative" class="field-type-button group flex items-center justify-center border border-dashed w-full rounded relative"
:style="{ backgroundColor: backgroundColor }" :style="{ backgroundColor }"
:class="drawFieldType === type ? 'border-base-content/40' : 'border-base-300 hover:border-base-content/20'" :class="drawFieldType === type ? 'border-base-content/40' : 'border-base-300 hover:border-base-content/20'"
@dragstart="onDragstart({ type: type })" @dragstart="onDragstart({ type: type })"
@dragend="$emit('drag-end')" @dragend="$emit('drag-end')"
@@ -142,7 +143,7 @@
href="https://www.docuseal.co/pricing" href="https://www.docuseal.co/pricing"
target="_blank" target="_blank"
class="opacity-50 flex items-center justify-center border border-dashed border-base-300 w-full rounded relative" class="opacity-50 flex items-center justify-center border border-dashed border-base-300 w-full rounded relative"
:style="{ backgroundColor: backgroundColor }" :style="{ backgroundColor }"
> >
<div class="w-0 absolute left-0"> <div class="w-0 absolute left-0">
<IconLock <IconLock
@@ -24,6 +24,7 @@
:submitters="submitters" :submitters="submitters"
:editable="editable" :editable="editable"
:mobile-view="true" :mobile-view="true"
:menu-style="{ backgroundColor: ['', null, 'transparent'].includes(backgroundColor) ? 'white' : backgroundColor }"
@new-submitter="save" @new-submitter="save"
@remove="removeSubmitter" @remove="removeSubmitter"
@name-change="save" @name-change="save"
@@ -43,7 +44,7 @@ export default {
Field, Field,
FieldSubmitter FieldSubmitter
}, },
inject: ['save', 't'], inject: ['save', 't', 'backgroundColor'],
props: { props: {
drawField: { drawField: {
type: Object, type: Object,
+10 -7
View File
@@ -4,13 +4,14 @@
# #
# Table name: accounts # Table name: accounts
# #
# id :bigint not null, primary key # id :bigint not null, primary key
# locale :string not null # archived_at :datetime
# name :string not null # locale :string not null
# timezone :string not null # name :string not null
# uuid :string not null # timezone :string not null
# created_at :datetime not null # uuid :string not null
# updated_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null
# #
# Indexes # Indexes
# #
@@ -49,6 +50,8 @@ class Account < ApplicationRecord
attribute :timezone, :string, default: 'UTC' attribute :timezone, :string, default: 'UTC'
attribute :locale, :string, default: 'en-US' attribute :locale, :string, default: 'en-US'
scope :active, -> { where(archived_at: nil) }
def testing? def testing?
linked_account_account&.testing? linked_account_account&.testing?
end end
+1
View File
@@ -36,6 +36,7 @@ class AccountConfig < ApplicationRecord
WEBHOOK_PREFERENCES_KEY = 'webhook_preferences' WEBHOOK_PREFERENCES_KEY = 'webhook_preferences'
DOWNLOAD_LINKS_AUTH_KEY = 'download_links_auth' DOWNLOAD_LINKS_AUTH_KEY = 'download_links_auth'
FORCE_SSO_AUTH_KEY = 'force_sso_auth' FORCE_SSO_AUTH_KEY = 'force_sso_auth'
FLATTEN_RESULT_PDF_KEY = 'flatten_result_pdf'
DEFAULT_VALUES = { DEFAULT_VALUES = {
SUBMITTER_INVITATION_EMAIL_KEY => { SUBMITTER_INVITATION_EMAIL_KEY => {
+1 -1
View File
@@ -73,7 +73,7 @@ class User < ApplicationRecord
end end
def active_for_authentication? def active_for_authentication?
super && !archived_at? super && !archived_at? && !account.archived_at?
end end
def remember_me def remember_me
+12
View File
@@ -140,6 +140,18 @@
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
<% account_config = AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::FLATTEN_RESULT_PDF_KEY) %>
<% if can?(:manage, account_config) %>
<%= form_for account_config, url: account_configs_path, method: :post do |f| %>
<%= f.hidden_field :key %>
<div class="flex items-center justify-between py-2.5">
<span>
Remove PDF form fillable fields from the signed PDF (flatten form)
</span>
<%= f.check_box :value, { class: 'toggle', checked: account_config.value != false, onchange: 'this.form.requestSubmit()' } %>
</div>
<% end %>
<% end %>
</div> </div>
<% end %> <% end %>
</div> </div>
+6 -6
View File
@@ -37,11 +37,17 @@
<%= link_to 'E-Signature', settings_esign_path, class: 'text-base hover:bg-base-300' %> <%= link_to 'E-Signature', settings_esign_path, class: 'text-base hover:bg-base-300' %>
</li> </li>
<% end %> <% end %>
<% if can?(:read, AccountConfig) %>
<li>
<%= link_to 'Personalization', settings_personalization_path, class: 'text-base hover:bg-base-300' %>
</li>
<% end %>
<% if can?(:read, User) %> <% if can?(:read, User) %>
<li> <li>
<%= link_to 'Users', settings_users_path, class: 'text-base hover:bg-base-300' %> <%= link_to 'Users', settings_users_path, class: 'text-base hover:bg-base-300' %>
</li> </li>
<% end %> <% end %>
<%= render 'shared/settings_nav_extra' %>
<% if Docuseal.demo? || !Docuseal.multitenant? %> <% if Docuseal.demo? || !Docuseal.multitenant? %>
<% if can?(:read, AccessToken) %> <% if can?(:read, AccessToken) %>
<li> <li>
@@ -54,12 +60,6 @@
</li> </li>
<% end %> <% end %>
<% end %> <% end %>
<% if can?(:read, AccountConfig) %>
<li>
<%= link_to 'Personalization', settings_personalization_path, class: 'text-base hover:bg-base-300' %>
</li>
<% end %>
<%= render 'shared/settings_nav_extra' %>
<% if !Docuseal.demo? && can?(:manage, EncryptedConfig) && (current_user != true_user || !current_account.testing?) %> <% if !Docuseal.demo? && can?(:manage, EncryptedConfig) && (current_user != true_user || !current_account.testing?) %>
<li> <li>
<%= link_to Docuseal.multitenant? ? console_redirect_index_path(redir: "#{Docuseal::CONSOLE_URL}/plans") : "#{Docuseal::CLOUD_URL}/sign_up?#{{ redir: "#{Docuseal::CONSOLE_URL}/on_premise" }.to_query}", class: 'text-base hover:bg-base-300', data: { prefetch: false } do %> <%= link_to Docuseal.multitenant? ? console_redirect_index_path(redir: "#{Docuseal::CONSOLE_URL}/plans") : "#{Docuseal::CLOUD_URL}/sign_up?#{{ redir: "#{Docuseal::CONSOLE_URL}/on_premise" }.to_query}", class: 'text-base hover:bg-base-300', data: { prefetch: false } do %>
+1 -1
View File
@@ -37,7 +37,7 @@
</div> </div>
<% if !template.archived_at? %> <% if !template.archived_at? %>
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-2">
<% if can?(:update, template) && (Docuseal.multitenant? || current_account.testing? || current_account.id == 1) %> <% if can?(:update, template) %>
<div class="tooltip" data-tip="Preferences"> <div class="tooltip" data-tip="Preferences">
<%= link_to template_preferences_path(template), class: 'btn border border-base-200 bg-base-200 hover:bg-base-300 hover:border-base-300 btn-sm flex-1 hidden md:flex', data: { turbo_frame: :modal } do %> <%= link_to template_preferences_path(template), class: 'btn border border-base-200 bg-base-200 hover:bg-base-300 hover:border-base-300 btn-sm flex-1 hidden md:flex', data: { turbo_frame: :modal } do %>
<span class="flex items-center justify-center space-x-2"> <span class="flex items-center justify-center space-x-2">
+2 -2
View File
@@ -3,9 +3,9 @@
<% if @base_template %> <% if @base_template %>
<%= hidden_field_tag :base_template_id, @base_template.id %> <%= hidden_field_tag :base_template_id, @base_template.id %>
<% end %> <% end %>
<% if @base_template && (can?(:manage, :tenants) || true_user != current_user) && true_user.account.account_linked_accounts.exists? %> <% if @base_template && (can?(:manage, :tenants) || true_user != current_user) && true_user.account.linked_accounts.active.exists? %>
<div class="form-control -mb-2 mt-2"> <div class="form-control -mb-2 mt-2">
<%= select_tag :account_id, options_for_select([true_user.account, *true_user.account.linked_accounts].uniq.map { |e| [e.name, e.id] }, current_account.id), required: true, class: 'base-select' %> <%= select_tag :account_id, options_for_select([true_user.account, *true_user.account.linked_accounts.active].uniq.map { |e| [e.name, e.id] }, current_account.id), required: true, class: 'base-select' %>
</div> </div>
<% end %> <% end %>
<div class="form-control mt-6"> <div class="form-control mt-6">
+50 -44
View File
@@ -1,17 +1,21 @@
<%= render 'shared/turbo_modal_large', title: 'Preferences', close_after_submit: false do %> <%= render 'shared/turbo_modal_large', title: 'Preferences', close_after_submit: false do %>
<% options = [['General', 'general'], ['API and Embedding', 'api']] %> <% show_api = Docuseal.multitenant? || current_account.testing? || !current_account.linked_account_account %>
<toggle-visible data-element-ids="<%= options.map(&:last).to_json %>" class="relative text-center mt-3 block"> <% options = [%w[General general]] %>
<div class="join"> <% options << ['API and Embedding', 'api'] if show_api %>
<% options.each_with_index do |(label, value), index| %> <% if options.size > 1 %>
<span> <toggle-visible data-element-ids="<%= options.map(&:last).to_json %>" class="relative text-center mt-3 block">
<%= radio_button_tag 'option', value, value == 'general', class: 'peer hidden', data: { action: 'change:toggle-visible#trigger' } %> <div class="join">
<label for="option_<%= value %>" class="<%= '!rounded-s-full' if index.zero? %> btn btn-focus btn-sm join-item md:w-48 peer-checked:btn-active normal-case <%= 'px-8 md:px-0' if value == 'general' %>"> <% options.each_with_index do |(label, value), index| %>
<%= label %> <span>
</label> <%= radio_button_tag 'option', value, value == 'general', class: 'peer hidden', data: { action: 'change:toggle-visible#trigger' } %>
</span> <label for="option_<%= value %>" class="<%= '!rounded-s-full' if index.zero? %> btn btn-focus btn-sm join-item md:w-48 peer-checked:btn-active normal-case <%= 'px-8 md:px-0' if value == 'general' %>">
<% end %> <%= label %>
</div> </label>
</toggle-visible> </span>
<% end %>
</div>
</toggle-visible>
<% end %>
<div id="general" class="px-5 mb-4"> <div id="general" class="px-5 mb-4">
<%= form_for @template, url: template_preferences_path(@template), method: :post, html: { autocomplete: 'off', class: 'mt-1' } do |f| %> <%= form_for @template, url: template_preferences_path(@template), method: :post, html: { autocomplete: 'off', class: 'mt-1' } do |f| %>
<toggle-on-submit data-element-id="email_saved_alert"></toggle-on-submit> <toggle-on-submit data-element-id="email_saved_alert"></toggle-on-submit>
@@ -62,39 +66,41 @@
<% end %> <% end %>
<%= render 'templates_code_modal/preferences' %> <%= render 'templates_code_modal/preferences' %>
</div> </div>
<div id="api" class="hidden mt-2 mb-4 px-5"> <% if show_api %>
<div> <div id="api" class="hidden mt-2 mb-4 px-5">
<label class="text-sm font-semibold" for="template_id"> <div>
Template ID <label class="text-sm font-semibold" for="template_id">
</label> Template ID
<div class="flex gap-2 mb-4 mt-2"> </label>
<input id="template_id" type="text" value="<%= @template.id %>" class="base-input w-full" autocomplete="off" readonly> <div class="flex gap-2 mb-4 mt-2">
<%= render 'shared/clipboard_copy', icon: 'copy', text: @template.id, class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy', copied_title: 'Copied' %> <input id="template_id" type="text" value="<%= @template.id %>" class="base-input w-full" autocomplete="off" readonly>
<%= render 'shared/clipboard_copy', icon: 'copy', text: @template.id, class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy', copied_title: 'Copied' %>
</div>
</div> </div>
</div> <div>
<div> <label class="text-sm font-semibold" for="embedding_url">
<label class="text-sm font-semibold" for="embedding_url"> Embedding URL
Embedding URL </label>
</label> <div class="flex gap-2 mb-4 mt-2">
<div class="flex gap-2 mb-4 mt-2"> <input id="embedding_url" type="text" value="<%= start_form_url(slug: @template.slug) %>" class="base-input w-full" autocomplete="off" readonly>
<input id="embedding_url" type="text" value="<%= start_form_url(slug: @template.slug) %>" class="base-input w-full" autocomplete="off" readonly> <%= render 'shared/clipboard_copy', icon: 'copy', text: start_form_url(slug: @template.slug), class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy', copied_title: 'Copied' %>
<%= render 'shared/clipboard_copy', icon: 'copy', text: start_form_url(slug: @template.slug), class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy', copied_title: 'Copied' %> </div>
</div> </div>
</div> <%= render 'templates_code_modal/placeholder' %>
<%= render 'templates_code_modal/placeholder' %> <%= render 'templates/embedding', template: @template %>
<%= render 'templates/embedding', template: @template %> <% if can?(:manage, TemplateSharing.new(template: @template)) %>
<% if can?(:manage, TemplateSharing.new(template: @template)) %> <%= form_for '', url: template_sharings_testing_index_path, method: :post, html: { class: 'mt-1' } do |f| %>
<%= form_for '', url: template_sharings_testing_index_path, method: :post, html: { class: 'mt-1' } do |f| %> <%= f.hidden_field :template_id, value: @template.id %>
<%= f.hidden_field :template_id, value: @template.id %> <div class="flex items-center justify-between">
<div class="flex items-center justify-between"> <span>
<span> Share template with Test Environment
Share template with Test Environment </span>
</span> <%= f.check_box :value, class: 'toggle', checked: @template.template_sharings.exists?(account_id: current_account.testing_accounts), onchange: 'this.form.requestSubmit()' %>
<%= f.check_box :value, class: 'toggle', checked: @template.template_sharings.exists?(account_id: current_account.testing_accounts), onchange: 'this.form.requestSubmit()' %> </div>
<% end %>
<div class="mb-4">
</div> </div>
<% end %> <% end %>
<div class="mb-4"> </div>
</div> <% end %>
<% end %>
</div>
<% end %> <% end %>
+10 -2
View File
@@ -128,14 +128,22 @@ Rails.application.configure do
config.lograge.formatter = ->(data) { data.except(:path, :location).to_json } config.lograge.formatter = ->(data) { data.except(:path, :location).to_json }
config.lograge.custom_payload do |controller| config.lograge.custom_payload do |controller|
params = controller.request.try(:params) || {} params =
begin
controller.request.try(:params) || {}
rescue StandardError
{}
end
{ {
fwd: controller.request.ip, fwd: controller.request.ip,
params: { params: {
id: params[:id], id: params[:id],
sig: (params[:signed_uuid] || params[:signed_id]).to_s.split('--').first, sig: (params[:signed_uuid] || params[:signed_id]).to_s.split('--').first,
slug: (params[:slug] || params[:submission_slug] || params[:template_slug]).to_s.last(5) slug: (params[:slug] ||
params[:submitter_slug] ||
params[:submission_slug] ||
params[:template_slug]).to_s.last(5)
}.compact_blank, }.compact_blank,
host: controller.request.host, host: controller.request.host,
uid: controller.instance_variable_get(:@current_user).try(:id) uid: controller.instance_variable_get(:@current_user).try(:id)
+13
View File
@@ -1,5 +1,6 @@
en: &en en: &en
email: Email email: Email
verification_code_code: 'Verification code: %{code}'
digitally_signed_by: Digitally signed by digitally_signed_by: Digitally signed by
role: Role role: Role
provide_your_email_to_start: Provide your email to start provide_your_email_to_start: Provide your email to start
@@ -21,6 +22,7 @@ en: &en
es: &es es: &es
role: Rol role: Rol
verification_code_code: 'Código de verificación: %{code}'
email: Correo electrónico email: Correo electrónico
digitally_signed_by: Firmado digitalmente por digitally_signed_by: Firmado digitalmente por
role: Rol role: Rol
@@ -42,6 +44,7 @@ es: &es
it: it:
role: Rôle role: Rôle
verification_code_code: 'Codice di verifica: %{code}'
email: Email email: Email
digitally_signed_by: Firmato digitalmente da digitally_signed_by: Firmato digitalmente da
role: Ruolo role: Ruolo
@@ -63,6 +66,7 @@ it:
fr: &fr fr: &fr
email: Email email: Email
verification_code_code: 'Code de vérification: %{code}'
digitally_signed_by: Signé numériquement par digitally_signed_by: Signé numériquement par
role: Rôle role: Rôle
provide_your_email_to_start: Entrez votre adresse email pour commencer provide_your_email_to_start: Entrez votre adresse email pour commencer
@@ -84,6 +88,7 @@ fr: &fr
pt: &pt pt: &pt
role: Função role: Função
email: Email email: Email
verification_code_code: 'Código de verificação: %{code}'
digitally_signed_by: Assinado digitalmente por digitally_signed_by: Assinado digitalmente por
role: Função role: Função
provide_your_email_to_start: Forneça o seu email para começar provide_your_email_to_start: Forneça o seu email para começar
@@ -104,6 +109,7 @@ pt: &pt
de: &de de: &de
role: Rolle role: Rolle
verification_code_code: 'Verifizierungscode: %{code}'
email: E-Mail email: E-Mail
digitally_signed_by: Digital signiert von digitally_signed_by: Digital signiert von
role: Rolle role: Rolle
@@ -125,6 +131,7 @@ de: &de
pl: pl:
email: Email email: Email
verification_code_code: 'Kod weryfikacyjny: %{code}'
digitally_signed_by: Podpis cyfrowy przez digitally_signed_by: Podpis cyfrowy przez
role: Rola role: Rola
provide_your_email_to_start: Podaj swój adres email, aby rozpocząć provide_your_email_to_start: Podaj swój adres email, aby rozpocząć
@@ -146,6 +153,7 @@ pl:
uk: uk:
email: Email email: Email
digitally_signed_by: Цифровий підпис від digitally_signed_by: Цифровий підпис від
verification_code_code: 'Код підтвердження: %{code}'
role: Роль role: Роль
provide_your_email_to_start: Введіть свій email, щоб почати provide_your_email_to_start: Введіть свій email, щоб почати
start: Почати start: Почати
@@ -166,6 +174,7 @@ uk:
cs: cs:
email: Email email: Email
digitally_signed_by: Digitálně podepsáno uživatelem digitally_signed_by: Digitálně podepsáno uživatelem
verification_code_code: 'Ověřovací kód: %{code}'
role: Role role: Role
provide_your_email_to_start: Zadejte svůj email pro zahájení provide_your_email_to_start: Zadejte svůj email pro zahájení
start: Zahájit start: Zahájit
@@ -187,6 +196,7 @@ he:
email: דוא"ל email: דוא"ל
digitally_signed_by: חתום דיגיטלית על ידי digitally_signed_by: חתום דיגיטלית על ידי
role: תפקיד role: תפקיד
verification_code_code: 'קוד אימות: %{code}'
provide_your_email_to_start: ספק את כתובת הדוא"ל שלך כדי להתחיל provide_your_email_to_start: ספק את כתובת הדוא"ל שלך כדי להתחיל
start: התחל start: התחל
starting: מתחיל starting: מתחיל
@@ -207,6 +217,7 @@ nl:
email: E-mail email: E-mail
digitally_signed_by: Digitaal ondertekend door digitally_signed_by: Digitaal ondertekend door
role: Rol role: Rol
verification_code_code: 'Verificatiecode: %{code}'
provide_your_email_to_start: Geef uw e-mailadres om te beginnen provide_your_email_to_start: Geef uw e-mailadres om te beginnen
start: Start start: Start
starting: Starten starting: Starten
@@ -231,6 +242,7 @@ ar:
provide_your_email_to_start: قدم بريدك الإلكتروني للبدء provide_your_email_to_start: قدم بريدك الإلكتروني للبدء
start: بدء start: بدء
starting: بداية starting: بداية
verification_code_code: 'رمز التحقق: %{code}'
form_has_been_deleted_by_html: 'تم حذف الاستمارة بواسطة <span class="font-semibold">%{name}</span>.' form_has_been_deleted_by_html: 'تم حذف الاستمارة بواسطة <span class="font-semibold">%{name}</span>.'
invited_by_html: 'تمت الدعوة بواسطة <span class="font-semibold">%{name}</span>' invited_by_html: 'تمت الدعوة بواسطة <span class="font-semibold">%{name}</span>'
you_have_been_invited_to_submit_a_form: تمت دعوتك لتقديم استمارة you_have_been_invited_to_submit_a_form: تمت دعوتك لتقديم استمارة
@@ -255,6 +267,7 @@ ko:
form_has_been_deleted_by_html: '<span class="font-semibold">%{name}</span>에 의해 양식이 삭제되었습니다.' form_has_been_deleted_by_html: '<span class="font-semibold">%{name}</span>에 의해 양식이 삭제되었습니다.'
invited_by_html: '<span class="font-semibold">%{name}</span>에 의해 초대되었습니다.' invited_by_html: '<span class="font-semibold">%{name}</span>에 의해 초대되었습니다.'
you_have_been_invited_to_submit_a_form: 양식을 제출하도록 초대되었습니다. you_have_been_invited_to_submit_a_form: 양식을 제출하도록 초대되었습니다.
verification_code_code: '확인 코드: %{code}'
signed_on_time: '%{time}에 서명됨' signed_on_time: '%{time}에 서명됨'
form_has_been_submitted_already: 양식이 이미 제출되었습니다. form_has_been_submitted_already: 양식이 이미 제출되었습니다.
send_copy_to_email: 이메일로 사본 보내기 send_copy_to_email: 이메일로 사본 보내기
@@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddArchivedAtToAccounts < ActiveRecord::Migration[7.1]
def change
add_column :accounts, :archived_at, :datetime
end
end
@@ -0,0 +1,28 @@
# frozen_string_literal: true
class PopulateAccountLinkedAccounts < ActiveRecord::Migration[7.1]
class MigrationAccount < ApplicationRecord
self.table_name = 'accounts'
end
class MigrationAccountLinkedAccount < ApplicationRecord
self.table_name = 'account_linked_accounts'
end
def up
return if Docuseal.multitenant?
MigrationAccount.order(:id).each do |account|
next if account.id == 1
next if MigrationAccountLinkedAccount.exists?(linked_account_id: account.id)
MigrationAccountLinkedAccount.create!(account_id: 1,
linked_account_id: account.id,
account_type: :linked)
end
end
def down
nil
end
end
+2 -1
View File
@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2024_04_16_170023) do ActiveRecord::Schema[7.1].define(version: 2024_04_28_112400) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@@ -52,6 +52,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_16_170023) do
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "uuid", null: false t.string "uuid", null: false
t.datetime "archived_at"
t.index ["uuid"], name: "index_accounts_on_uuid", unique: true t.index ["uuid"], name: "index_accounts_on_uuid", unique: true
end end
+1 -1
View File
@@ -80,7 +80,7 @@ module Submissions
composer.column(columns: 1) do |column| composer.column(columns: 1) do |column|
add_logo(column, submission) add_logo(column, submission)
column.text(account.linked_account_account&.testing? ? 'Testing Log - Not for Production Use' : 'Audit Log', column.text(account.testing? ? 'Testing Log - Not for Production Use' : 'Audit Log',
font_size: 16, font_size: 16,
padding: [10, 0, 0, 0], padding: [10, 0, 0, 0],
position: :float, text_align: :right) position: :float, text_align: :right)
+50 -14
View File
@@ -17,6 +17,7 @@ module Submissions
TEXT_LEFT_MARGIN = 1 TEXT_LEFT_MARGIN = 1
TEXT_TOP_MARGIN = 1 TEXT_TOP_MARGIN = 1
MAX_PAGE_ROTATE = 20
A4_SIZE = [595, 842].freeze A4_SIZE = [595, 842].freeze
SUPPORTED_IMAGE_TYPES = ['image/png', 'image/jpeg'].freeze SUPPORTED_IMAGE_TYPES = ['image/png', 'image/jpeg'].freeze
@@ -43,12 +44,16 @@ module Submissions
template = submitter.submission.template template = submitter.submission.template
is_flatten =
submitter.account.account_configs
.find_or_initialize_by(key: AccountConfig::FLATTEN_RESULT_PDF_KEY).value != false
account = submitter.account account = submitter.account
pkcs = Accounts.load_signing_pkcs(account) pkcs = Accounts.load_signing_pkcs(account)
tsa_url = Accounts.load_timeserver_url(account) tsa_url = Accounts.load_timeserver_url(account)
attachments_data_cache = {} attachments_data_cache = {}
pdfs_index = build_pdfs_index(submitter) pdfs_index = build_pdfs_index(submitter, flatten: is_flatten)
submitter.submission.template_fields.each do |field| submitter.submission.template_fields.each do |field|
next if field['submitter_uuid'] != submitter.uuid next if field['submitter_uuid'] != submitter.uuid
@@ -85,10 +90,12 @@ module Submissions
next if Array.wrap(value).compact_blank.blank? next if Array.wrap(value).compact_blank.blank?
begin if is_flatten
page.flatten_annotations begin
rescue StandardError => e page.flatten_annotations
Rollbar.error(e) if defined?(Rollbar) rescue StandardError => e
Rollbar.error(e) if defined?(Rollbar)
end
end end
canvas = page.canvas(type: :overlay) canvas = page.canvas(type: :overlay)
@@ -140,17 +147,22 @@ module Submissions
attachment_uuid = Array.wrap(value)[acc] attachment_uuid = Array.wrap(value)[acc]
attachment = submitter.attachments.find { |a| a.uuid == attachment_uuid } attachment = submitter.attachments.find { |a| a.uuid == attachment_uuid }
next_index = next_index = lines[(index + 1)..].index { |l| l.items.first.is_a?(HexaPDF::Layout::InlineBox) }
lines[(index + 1)..].index { |l| l.items.first.is_a?(HexaPDF::Layout::InlineBox) } || (lines.size - 1) next_index += index if next_index
next_index ||= lines.size - 1
diff = ((area['h'] * height) / 2) - (lines.sum(&:height) / 2)
page[:Annots] << pdf.add( page[:Annots] << pdf.add(
{ {
Type: :Annot, Subtype: :Link, Type: :Annot, Subtype: :Link,
Rect: [ Rect: [
(area['x'] * width) + TEXT_LEFT_MARGIN, (area['x'] * width) + TEXT_LEFT_MARGIN,
height - (area['y'] * height) - lines[...index].sum(&:height) + height_diff, height - (area['y'] * height) - lines[...index].sum(&:height) +
height_diff - (height_diff.zero? ? diff : 0),
(area['x'] * width) + (area['w'] * width) + TEXT_LEFT_MARGIN, (area['x'] * width) + (area['w'] * width) + TEXT_LEFT_MARGIN,
height - (area['y'] * height) - lines[..next_index].sum(&:height) + height_diff height - (area['y'] * height) - lines[..next_index].sum(&:height) +
height_diff - (height_diff.zero? ? diff : 0)
], ],
A: { Type: :Action, S: :URI, A: { Type: :Action, S: :URI,
URI: ActiveStorage::Blob.proxy_url(attachment.blob) } URI: ActiveStorage::Blob.proxy_url(attachment.blob) }
@@ -334,7 +346,7 @@ module Submissions
Digest::UUID.uuid_v5(Digest::UUID::OID_NAMESPACE, attachments.map(&:uuid).sort.join(':')) Digest::UUID.uuid_v5(Digest::UUID::OID_NAMESPACE, attachments.map(&:uuid).sort.join(':'))
end end
def build_pdfs_index(submitter) def build_pdfs_index(submitter, flatten: true)
latest_submitter = find_last_submitter(submitter) latest_submitter = find_last_submitter(submitter)
Submissions::EnsureResultGenerated.call(latest_submitter) if latest_submitter Submissions::EnsureResultGenerated.call(latest_submitter) if latest_submitter
@@ -350,10 +362,14 @@ module Submissions
HexaPDF::Document.new(io: StringIO.new(attachment.download)) HexaPDF::Document.new(io: StringIO.new(attachment.download))
end end
begin pdf = maybe_rotate_pdf(pdf)
pdf.acro_form&.flatten
rescue StandardError => e if flatten
Rollbar.error(e) if defined?(Rollbar) begin
pdf.acro_form&.flatten
rescue StandardError => e
Rollbar.error(e) if defined?(Rollbar)
end
end end
pdf.config['font.on_missing_glyph'] = method(:on_missing_glyph).to_proc pdf.config['font.on_missing_glyph'] = method(:on_missing_glyph).to_proc
@@ -362,6 +378,26 @@ module Submissions
end end
end end
def maybe_rotate_pdf(pdf)
return pdf if pdf.pages.size > MAX_PAGE_ROTATE
is_rotated = pdf.pages.filter_map do |page|
page.rotate(0, flatten: true) if page[:Rotate] != 0
end.present?
return pdf unless is_rotated
io = StringIO.new
pdf.write(io, incremental: false, validate: false)
HexaPDF::Document.new(io:)
rescue StandardError => e
Rollbar.error(e) if defined?(Rollbar)
pdf
end
def on_missing_glyph(character, font_wrapper) def on_missing_glyph(character, font_wrapper)
Rollbar.error("Missing glyph: #{character}") if character.present? && defined?(Rollbar) Rollbar.error("Missing glyph: #{character}") if character.present? && defined?(Rollbar)
+1
View File
@@ -23,6 +23,7 @@ module Submissions
submitter_params[:fields]&.each do |f| submitter_params[:fields]&.each do |f|
default_values[f[:name].presence || f[:uuid]] = f[:default_value] if f.key?(:default_value) default_values[f[:name].presence || f[:uuid]] = f[:default_value] if f.key?(:default_value)
default_values[f[:name].presence || f[:uuid]] = f[:value] if f.key?(:value)
end end
return submitter_params if default_values.blank? return submitter_params if default_values.blank?
+27 -21
View File
@@ -2,38 +2,44 @@
module Submitters module Submitters
module SerializeForApi module SerializeForApi
SERIALIZE_PARAMS = {
only: %i[id slug uuid name email phone completed_at external_id
submission_id metadata opened_at sent_at created_at updated_at],
methods: %i[status application_key]
}.freeze
module_function module_function
def call(submitter, with_template: false, with_events: false) def call(submitter, with_template: false, with_events: false, with_documents: true, with_urls: false)
ActiveRecord::Associations::Preloader.new( ActiveRecord::Associations::Preloader.new(
records: [submitter], records: [submitter],
associations: [documents_attachments: :blob, attachments_attachments: :blob] associations: if with_documents
[documents_attachments: :blob, attachments_attachments: :blob]
else
[attachments_attachments: :blob]
end
).call ).call
values = SerializeForWebhook.build_values_array(submitter) additional_attrs = {}
documents = SerializeForWebhook.build_documents_array(submitter)
submitter_name = (submitter.submission.template_submitters || additional_attrs['values'] = SerializeForWebhook.build_values_array(submitter)
submitter.submission.template.submitters).find { |e| e['uuid'] == submitter.uuid }['name'] additional_attrs['documents'] = SerializeForWebhook.build_documents_array(submitter) if with_documents
additional_attrs['preferences'] = submitter.preferences.except('default_values')
serialize_params = { additional_attrs['role'] =
include: {}, (submitter.submission.template_submitters ||
only: %i[id slug uuid name email phone completed_at external_id submitter.submission.template.submitters).find { |e| e['uuid'] == submitter.uuid }['name']
submission_id metadata opened_at sent_at created_at updated_at],
methods: %i[status application_key]
}
serialize_params[:include][:template] = { only: %i[id name created_at updated_at] } if with_template if with_urls
additional_attrs['embed_src'] =
if with_events Rails.application.routes.url_helpers.submit_form_url(slug: submitter.slug, **Docuseal.default_url_options)
serialize_params[:include][:submission_events] =
{ as: :events, only: %i[id submitter_id event_type event_timestamp] }
end end
submitter.as_json(serialize_params) include_params = {}
.merge('values' => values, include_params[:template] = { only: %i[id name created_at updated_at] } if with_template
'documents' => documents, include_params[:submission_events] = { only: %i[id submitter_id event_type event_timestamp] } if with_events
'role' => submitter_name)
submitter.as_json(SERIALIZE_PARAMS.merge(include: include_params)).merge(additional_attrs)
end end
end end
end end
+7 -4
View File
@@ -2,6 +2,12 @@
module Submitters module Submitters
module SerializeForWebhook module SerializeForWebhook
SERIALIZE_PARAMS = {
methods: %i[status application_key],
only: %i[id submission_id email phone name ua ip sent_at opened_at
completed_at created_at updated_at external_id metadata]
}.freeze
module_function module_function
def call(submitter) def call(submitter)
@@ -16,10 +22,7 @@ module Submitters
submitter_name = (submitter.submission.template_submitters || submitter_name = (submitter.submission.template_submitters ||
submitter.submission.template.submitters).find { |e| e['uuid'] == submitter.uuid }['name'] submitter.submission.template.submitters).find { |e| e['uuid'] == submitter.uuid }['name']
submitter.as_json(methods: %i[status application_key], submitter.as_json(SERIALIZE_PARAMS)
only: %i[id submission_id email phone name ua ip sent_at opened_at
completed_at created_at updated_at external_id metadata])
.except('uuid', 'values', 'slug')
.merge('role' => submitter_name, .merge('role' => submitter_name,
'preferences' => submitter.preferences.except('default_values'), 'preferences' => submitter.preferences.except('default_values'),
'values' => values, 'values' => values,
+22 -4
View File
@@ -4,10 +4,9 @@ module Templates
module Clone module Clone
module_function module_function
# rubocop:disable Metrics
def call(original_template, author:, external_id: nil, name: nil, folder_name: nil) def call(original_template, author:, external_id: nil, name: nil, folder_name: nil)
original_template_account = original_template.account template = original_template.account.templates.new
template = original_template_account.templates.new
template.external_id = external_id template.external_id = external_id
template.author = author template.author = author
@@ -19,6 +18,7 @@ module Templates
template.folder = TemplateFolders.find_or_create_by_name(author, folder_name) if folder_name.present? template.folder = TemplateFolders.find_or_create_by_name(author, folder_name) if folder_name.present?
submitter_uuids_replacements = {} submitter_uuids_replacements = {}
field_uuids_replacements = {}
cloned_submitters = original_template['submitters'].deep_dup cloned_submitters = original_template['submitters'].deep_dup
cloned_fields = original_template['fields'].deep_dup cloned_fields = original_template['fields'].deep_dup
@@ -31,13 +31,31 @@ module Templates
end end
cloned_fields.each do |field| cloned_fields.each do |field|
field['uuid'] = SecureRandom.uuid new_field_uuid = SecureRandom.uuid
field_uuids_replacements[field['uuid']] = new_field_uuid
field['uuid'] = new_field_uuid
field['submitter_uuid'] = submitter_uuids_replacements[field['submitter_uuid']] field['submitter_uuid'] = submitter_uuids_replacements[field['submitter_uuid']]
end end
replace_fields_regexp = Regexp.union(field_uuids_replacements.keys)
cloned_fields.each do |field|
Array.wrap(field['conditions']).each do |condition|
condition['field_uuid'] = field_uuids_replacements[condition['field_uuid']]
end
if field.dig('preferences', 'formula').present?
field['preferences']['formula'] =
field['preferences']['formula'].gsub(replace_fields_regexp, field_uuids_replacements)
end
end
template.assign_attributes(fields: cloned_fields, submitters: cloned_submitters) template.assign_attributes(fields: cloned_fields, submitters: cloned_submitters)
template template
end end
# rubocop:enable Metrics
end end
end end
+6 -4
View File
@@ -2,13 +2,15 @@
module Templates module Templates
module SerializeForApi module SerializeForApi
SERIALIZE_PARAMS = {
methods: %i[application_key folder_name],
include: { author: { only: %i[id email first_name last_name] } }
}.freeze
module_function module_function
def call(template, schema_documents = template.schema_documents, preview_image_attachments = []) def call(template, schema_documents = template.schema_documents, preview_image_attachments = [])
json = template.as_json( json = template.as_json(SERIALIZE_PARAMS)
methods: %i[application_key folder_name],
include: { author: { only: %i[id email first_name last_name] } }
)
json[:documents] = template.schema.map do |item| json[:documents] = template.schema.map do |item|
attachment = schema_documents.find { |e| e.uuid == item['attachment_uuid'] } attachment = schema_documents.find { |e| e.uuid == item['attachment_uuid'] }