0351d front end linting (#377)

* feat: disable custom script for  trial users

* after lint fix

* frontend linting

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Favour Olayinka
2024-04-15 18:39:03 +01:00
committed by GitHub
parent 8d35fc8b1a
commit bcd45ce8a6
228 changed files with 17036 additions and 8744 deletions

View File

@@ -1,35 +1,38 @@
import {generateUUID} from "~/lib/utils.js";
import { generateUUID } from "~/lib/utils.js"
export const initForm = (defaultValue = {}, withDefaultProperties = false) => {
return useForm({
title: 'My Form',
title: "My Form",
description: null,
visibility: 'public',
visibility: "public",
workspace_id: null,
properties: withDefaultProperties ? getDefaultProperties() :[],
properties: withDefaultProperties ? getDefaultProperties() : [],
// Customization
theme: 'default',
width: 'centered',
dark_mode: 'auto',
color: '#3B82F6',
theme: "default",
width: "centered",
dark_mode: "auto",
color: "#3B82F6",
hide_title: false,
no_branding: false,
uppercase_labels: true,
transparent_background: false,
closes_at: null,
closed_text: 'This form has now been closed by its owner and does not accept submissions anymore.',
closed_text:
"This form has now been closed by its owner and does not accept submissions anymore.",
auto_save: true,
// Submission
submit_button_text: 'Submit',
submit_button_text: "Submit",
re_fillable: false,
re_fill_button_text: 'Fill Again',
submitted_text: 'Amazing, we saved your answers. Thank you for your time and have a great day!',
re_fill_button_text: "Fill Again",
submitted_text:
"Amazing, we saved your answers. Thank you for your time and have a great day!",
use_captcha: false,
max_submissions_count: null,
max_submissions_reached_text: 'This form has now reached the maximum number of allowed submissions and is now closed.',
editable_submissions_button_text: 'Edit submission',
max_submissions_reached_text:
"This form has now reached the maximum number of allowed submissions and is now closed.",
editable_submissions_button_text: "Edit submission",
confetti_on_submission: false,
// Security & Privacy
@@ -38,31 +41,31 @@ export const initForm = (defaultValue = {}, withDefaultProperties = false) => {
// Custom SEO
seo_meta: {},
...defaultValue
...defaultValue,
})
}
function getDefaultProperties () {
function getDefaultProperties() {
return [
{
name: 'Name',
type: 'text',
name: "Name",
type: "text",
hidden: false,
required: true,
id: generateUUID()
id: generateUUID(),
},
{
name: 'Email',
type: 'email',
name: "Email",
type: "email",
hidden: false,
id: generateUUID()
id: generateUUID(),
},
{
name: 'Message',
type: 'text',
name: "Message",
type: "text",
hidden: false,
multi_lines: true,
id: generateUUID()
}
id: generateUUID(),
},
]
}

View File

@@ -1,10 +1,11 @@
import {hash} from "~/lib/utils.js"
import {useStorage} from "@vueuse/core"
import { hash } from "~/lib/utils.js"
import { useStorage } from "@vueuse/core"
export const pendingSubmission = (form) => {
const formPendingSubmissionKey = computed(() => {
return (form) ? form.form_pending_submission_key + '-' + hash(window.location.href) : ''
return form
? form.form_pending_submission_key + "-" + hash(window.location.href)
: ""
})
const enabled = computed(() => {
@@ -13,7 +14,8 @@ export const pendingSubmission = (form) => {
const set = (value) => {
if (import.meta.server || !enabled.value) return
useStorage(formPendingSubmissionKey.value).value = value === null ? value : JSON.stringify(value)
useStorage(formPendingSubmissionKey.value).value =
value === null ? value : JSON.stringify(value)
}
const remove = () => {
@@ -30,6 +32,6 @@ export const pendingSubmission = (form) => {
enabled,
set,
get,
remove
remove,
}
}

View File

@@ -1,12 +1,12 @@
import FormPropertyLogicRule from "~/lib/forms/FormPropertyLogicRule.js";
import FormPropertyLogicRule from "~/lib/forms/FormPropertyLogicRule.js"
export const validatePropertiesLogic = (properties) => {
properties.forEach((field) => {
const isValid = (new FormPropertyLogicRule(field)).isValid()
const isValid = new FormPropertyLogicRule(field).isValid()
if (!isValid) {
field.logic = {
conditions: null,
actions: []
actions: [],
}
}
})